mirage2d 1.2.8 → 1.2.10

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.
@@ -17,7 +17,7 @@ am={get exports(){return hm},set exports(t){hm=t}},lm=hm,window,um=function(){re
17
17
  */
18
18
  var n=r(7),i=r(8),o=r(9);function s(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return l.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=l.prototype:(null===t&&(t=new l(e)),t.length=e),t}function l(t,e,r){if(!(l.TYPED_ARRAY_SUPPORT||this instanceof l))return new l(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}return u(this,t,e,r)}function u(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n),l.TYPED_ARRAY_SUPPORT?(t=e).__proto__=l.prototype:t=A(t,e),t}(t,e,r,n):"string"==typeof e?function(t,e,r){if("string"==typeof r&&""!==r||(r="utf8"),!l.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(e,r),i=(t=a(t,n)).write(e,r);return i!==n&&(t=t.slice(0,i)),t}(t,e,r):function(t,e){if(l.isBuffer(e)){var r=0|f(e.length);return 0===(t=a(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):A(t,e);if("Buffer"===e.type&&o(e.data))return A(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e){if(h(e),t=a(t,e<0?0:0|f(e)),!l.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function A(t,e){var r=e.length<0?0:0|f(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function f(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function p(t,e){if(l.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(t).length;default:if(n)return Q(t).length;e=(""+e).toLowerCase(),n=!0}}function d(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=l.from(e,n)),l.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){var o,s=1,a=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,l/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=r;o<a;o++)if(u(t,o)===u(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===l)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(r+l>a&&(r=a-l),o=r;o>=0;o--){for(var c=!0,A=0;A<l;A++)if(u(t,o+A)!==u(e,A)){c=!1;break}if(c)return o}return-1}function v(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function _(t,e,r,n){return j(Q(e,t.length-r),t,r,n)}function w(t,e,r,n){return j(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function b(t,e,r,n){return w(t,e,r,n)}function x(t,e,r,n){return j(G(e),t,r,n)}function C(t,e,r,n){return j(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function E(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function S(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,l,u=t[i],h=null,c=u>239?4:u>223?3:u>191?2:1;if(i+c<=r)switch(c){case 1:u<128&&(h=u);break;case 2:128==(192&(o=t[i+1]))&&(l=(31&u)<<6|63&o)>127&&(h=l);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(l=(15&u)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(h=l)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var e=t.length;if(e<=B)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=B));return r}(n)}e.Buffer=l,e.SlowBuffer=function(t){return+t!=t&&(t=0),l.alloc(+t)},e.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(UW){return!1}}(),e.kMaxLength=s(),l.poolSize=8192,l._augment=function(t){return t.__proto__=l.prototype,t},l.from=function(t,e,r){return u(null,t,e,r)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(t,e,r){return function(t,e,r,n){return h(e),e<=0?a(t,e):void 0!==r?"string"==typeof n?a(t,e).fill(r,n):a(t,e).fill(r):a(t,e)}(null,t,e,r)},l.allocUnsafe=function(t){return c(null,t)},l.allocUnsafeSlow=function(t){return c(null,t)},l.isBuffer=function(t){return!(null==t||!t._isBuffer)},l.compare=function(t,e){if(!l.isBuffer(t)||!l.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},l.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return l.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=l.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var s=t[r];if(!l.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},l.byteLength=p,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},l.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},l.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},l.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?S(this,0,t):d.apply(this,arguments)},l.prototype.equals=function(t){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===l.compare(this,t)},l.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},l.prototype.compare=function(t,e,r,n,i){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),u=this.slice(n,i),h=t.slice(e,r),c=0;c<a;++c)if(u[c]!==h[c]){o=u[c],s=h[c];break}return o<s?-1:s<o?1:0},l.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},l.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},l.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},l.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return b(this,t,e,r);case"base64":return x(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var B=4096;function I(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function T(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function P(t,e,r){var n,i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var o="",s=e;s<r;++s)o+=(n=t[s])<16?"0"+n.toString(16):n.toString(16);return o}function F(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function L(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,n,i,o){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function O(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function k(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function N(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function R(t,e,r,n,o){return o||N(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,o){return o||N(t,0,r,8),i.write(t,e,r,n,52,8),r+8}l.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),l.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=l.prototype;else{var i=e-t;r=new l(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},l.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},l.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},l.prototype.readUInt8=function(t,e){return e||L(t,1,this.length),this[t]},l.prototype.readUInt16LE=function(t,e){return e||L(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function(t,e){return e||L(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function(t,e){return e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function(t,e){return e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},l.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},l.prototype.readInt8=function(t,e){return e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){e||L(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(t,e){e||L(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(t,e){return e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return e||L(t,4,this.length),i.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return e||L(t,4,this.length),i.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return e||L(t,8,this.length),i.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return e||L(t,8,this.length),i.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function(t,e,r,n){t=+t,e|=0,r|=0,n||M(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},l.prototype.writeUIntBE=function(t,e,r,n){t=+t,e|=0,r|=0,n||M(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},l.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},l.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):O(this,t,e,!0),e+2},l.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):O(this,t,e,!1),e+2},l.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):k(this,t,e,!0),e+4},l.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):k(this,t,e,!1),e+4},l.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},l.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},l.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):O(this,t,e,!0),e+2},l.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):O(this,t,e,!1),e+2},l.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):k(this,t,e,!0),e+4},l.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):k(this,t,e,!1),e+4},l.prototype.writeFloatLE=function(t,e,r){return R(this,t,e,!0,r)},l.prototype.writeFloatBE=function(t,e,r){return R(this,t,e,!1,r)},l.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},l.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},l.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!l.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},l.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=l.isBuffer(t)?t:Q(new l(t,n).toString()),a=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var D=/[^+\/0-9A-Za-z-_]/g;function Q(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(D,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function j(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(1))},function(t,e,r){e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=u(t),s=n[0],a=n[1],l=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),h=0,c=a>0?s-4:s;for(r=0;r<c;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],l[h++]=e>>16&255,l[h++]=e>>8&255,l[h++]=255&e;return 2===a&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,l[h++]=255&e),1===a&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,l[h++]=e>>8&255,l[h++]=255&e),l},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,l=r-i;a<l;a+=s)o.push(h(t,a,a+s>l?l:a+s));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=s.length;a<l;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,r){for(var i,o,s=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){
19
19
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
20
- e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,l=(1<<a)-1,u=l>>1,h=-7,c=r?i-1:0,A=r?-1:1,f=t[e+c];for(c+=A,o=f&(1<<-h)-1,f>>=-h,h+=a;h>0;o=256*o+t[e+c],c+=A,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+c],c+=A,h-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),o-=u}return(f?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,l,u=8*o-i-1,h=(1<<u)-1,c=h>>1,A=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+c>=1?A/l:A*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(e*l-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[r+f]=255&s,f+=p,s/=256,u-=8);t[r+f-p]|=128*d}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){(function(t){var n=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,n,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,n,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(n,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(11),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(1))},function(t,e,r){(function(t,e){!function(t,r){if(!t.setImmediate){var n,i,o,s,a,l=1,u={},h=!1,c=t.document,A=Object.getPrototypeOf&&Object.getPrototypeOf(t);A=A&&A.setTimeout?A:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick((function(){p(t)}))}:function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&p(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),n=function(e){t.postMessage(s+e,"*")}):t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){p(t.data)},n=function(t){o.port2.postMessage(t)}):c&&"onreadystatechange"in c.createElement("script")?(i=c.documentElement,n=function(t){var e=c.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):n=function(t){setTimeout(p,0,t)},A.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r<e.length;r++)e[r]=arguments[r+1];var i={callback:t,args:e};return u[l]=i,n(l),l++},A.clearImmediate=f}function f(t){delete u[t]}function p(t){if(h)setTimeout(p,0,t);else{var e=u[t];if(e){h=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(r,n)}}(e)}finally{f(t),h=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,r(1),r(3))},function(t,e){function r(t){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}r.keys=function(){return[]},r.resolve=r,t.exports=r,r.id=12},function(t,e,r){function n(t){this.options=t||{locator:{}}}function i(){this.cdata=!1}function o(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function s(t,e,r){return"string"==typeof t?t.substr(e,r):t.length>=e+r||e?new java.lang.String(t,e,r)+"":t}function a(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}n.prototype.parseFromString=function(t,e){var r=this.options,n=new h,o=r.domBuilder||new i,s=r.errorHandler,a=r.locator,u=r.xmlns||{},c=/\/x?html?$/.test(e),A=c?l.entityMap:{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return a&&o.setDocumentLocator(a),n.errorHandler=function(t,e,r){if(!t){if(e instanceof i)return e;t=e}var n={},o=t instanceof Function;function s(e){var i=t[e];!i&&o&&(i=2==t.length?function(r){t(e,r)}:t),n[e]=i&&function(t){i("[xmldom "+e+"]\t"+t+function(t){if(t)return"\n@"+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}(r))}||function(){}}return r=r||{},s("warning"),s("error"),s("fatalError"),n}(s,o,a),n.domBuilder=r.domBuilder||o,c&&(u[""]="http://www.w3.org/1999/xhtml"),u.xml=u.xml||"http://www.w3.org/XML/1998/namespace",t&&"string"==typeof t?n.parse(t,u,A):n.errorHandler.error("invalid doc source"),o.doc},i.prototype={startDocument:function(){this.doc=(new A).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,r,n){var i=this.doc,s=i.createElementNS(t,r||e),l=n.length;a(this,s),this.currentElement=s,this.locator&&o(this.locator,s);for(var u=0;u<l;u++){t=n.getURI(u);var h=n.getValue(u),c=(r=n.getQName(u),i.createAttributeNS(t,r));this.locator&&o(n.getLocator(u),c),c.value=c.nodeValue=h,s.setAttributeNode(c)}},endElement:function(t,e,r){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var r=this.doc.createProcessingInstruction(t,e);this.locator&&o(this.locator,r),a(this,r)},ignorableWhitespace:function(t,e,r){},characters:function(t,e,r){if(t=s.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(t);else n=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(t)&&this.doc.appendChild(n),this.locator&&o(this.locator,n)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){(this.locator=t)&&(t.lineNumber=0)},comment:function(t,e,r){t=s.apply(this,arguments);var n=this.doc.createComment(t);this.locator&&o(this.locator,n),a(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,r){var n=this.doc.implementation;if(n&&n.createDocumentType){var i=n.createDocumentType(t,e,r);this.locator&&o(this.locator,i),a(this,i)}},warning:function(t){},error:function(t){},fatalError:function(t){throw new c(t,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(t){i.prototype[t]=function(){return null}}));var l=r(14),u=r(15),h=u.XMLReader,c=u.ParseError,A=e.DOMImplementation=r(4).DOMImplementation;e.XMLSerializer=r(4).XMLSerializer,e.DOMParser=n,e.__DOMHandler=i},function(t,e){e.entityMap={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}},function(t,e){var r=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,n=new RegExp("[\\-\\.0-9"+r.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+r.source+n.source+"*(?::"+r.source+n.source+"*)?$"),o=0,s=1,a=2,l=3,u=4,h=5,c=6,A=7;function f(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,f)}function p(){}function d(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function g(t,e,r,n,i,f){function p(t,e,n){t in r.attributeNames&&f.fatalError("Attribute "+t+" redefined"),r.addValue(t,e,n)}for(var d,g=++e,y=o;;){var m=t.charAt(g);switch(m){case"=":if(y===s)d=t.slice(e,g),y=l;else{if(y!==a)throw new Error("attribute equal must after attrName");y=l}break;case"'":case'"':if(y===l||y===s){if(y===s&&(f.warning('attribute value must after "="'),d=t.slice(e,g)),e=g+1,!((g=t.indexOf(m,e))>0))throw new Error("attribute value no end '"+m+"' match");p(d,v=t.slice(e,g).replace(/&#?\w+;/g,i),e-1),y=h}else{if(y!=u)throw new Error('attribute value must after "="');p(d,v=t.slice(e,g).replace(/&#?\w+;/g,i),e),f.warning('attribute "'+d+'" missed start quot('+m+")!!"),e=g+1,y=h}break;case"/":switch(y){case o:r.setTagName(t.slice(e,g));case h:case c:case A:y=A,r.closed=!0;case u:case s:case a:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return f.error("unexpected end of input"),y==o&&r.setTagName(t.slice(e,g)),g;case">":switch(y){case o:r.setTagName(t.slice(e,g));case h:case c:case A:break;case u:case s:"/"===(v=t.slice(e,g)).slice(-1)&&(r.closed=!0,v=v.slice(0,-1));case a:y===a&&(v=d),y==u?(f.warning('attribute "'+v+'" missed quot(")!'),p(d,v.replace(/&#?\w+;/g,i),e)):("http://www.w3.org/1999/xhtml"===n[""]&&v.match(/^(?:disabled|checked|selected)$/i)||f.warning('attribute "'+v+'" missed value!! "'+v+'" instead!!'),p(v,v,e));break;case l:throw new Error("attribute value missed!!")}return g;case"€":m=" ";default:if(m<=" ")switch(y){case o:r.setTagName(t.slice(e,g)),y=c;break;case s:d=t.slice(e,g),y=a;break;case u:var v=t.slice(e,g).replace(/&#?\w+;/g,i);f.warning('attribute "'+v+'" missed quot(")!!'),p(d,v,e);case h:y=c}else switch(y){case a:r.tagName,"http://www.w3.org/1999/xhtml"===n[""]&&d.match(/^(?:disabled|checked|selected)$/i)||f.warning('attribute "'+d+'" missed value!! "'+d+'" instead2!!'),p(d,d,e),e=g,y=s;break;case h:f.warning('attribute space is required"'+d+'"!!');case c:y=s,e=g;break;case l:y=u,e=g;break;case A:throw new Error("elements closed character '/' and '>' must be connected to")}}g++}}function y(t,e,r){for(var n=t.tagName,i=null,o=t.length;o--;){var s=t[o],a=s.qName,l=s.value;if((A=a.indexOf(":"))>0)var u=s.prefix=a.slice(0,A),h=a.slice(A+1),c="xmlns"===u&&h;else h=a,u=null,c="xmlns"===a&&"";s.localName=h,!1!==c&&(null==i&&(i={},_(r,r={})),r[c]=i[c]=l,s.uri="http://www.w3.org/2000/xmlns/",e.startPrefixMapping(c,l))}for(o=t.length;o--;)(u=(s=t[o]).prefix)&&("xml"===u&&(s.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==u&&(s.uri=r[u||""]));var A;(A=n.indexOf(":"))>0?(u=t.prefix=n.slice(0,A),h=t.localName=n.slice(A+1)):(u=null,h=t.localName=n);var f=t.uri=r[u||""];if(e.startElement(f,h,n,t),!t.closed)return t.currentNSMap=r,t.localNSMap=i,!0;if(e.endElement(f,h,n),i)for(u in i)e.endPrefixMapping(u)}function m(t,e,r,n,i){if(/^(?:script|textarea)$/i.test(r)){var o=t.indexOf("</"+r+">",e),s=t.substring(e+1,o);if(/[&<]/.test(s))return/^script$/i.test(r)?(i.characters(s,0,s.length),o):(s=s.replace(/&#?\w+;/g,n),i.characters(s,0,s.length),o)}return e+1}function v(t,e,r,n){var i=n[r];return null==i&&((i=t.lastIndexOf("</"+r+">"))<e&&(i=t.lastIndexOf("</"+r)),n[r]=i),i<e}function _(t,e){for(var r in t)e[r]=t[r]}function w(t,e,r,n){if("-"===t.charAt(e+2))return"-"===t.charAt(e+3)?(i=t.indexOf("--\x3e",e+4))>e?(r.comment(t,e+4,i-e-4),i+3):(n.error("Unclosed comment"),-1):-1;if("CDATA["==t.substr(e+3,6)){var i=t.indexOf("]]>",e+9);return r.startCDATA(),r.characters(t,e+9,i-e-9),r.endCDATA(),i+3}var o=function(t,e){var r,n=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=e,i.exec(t);r=i.exec(t);)if(n.push(r),r[1])return n}(t,e),s=o.length;if(s>1&&/!doctype/i.test(o[0][0])){var a=o[1][0],l=!1,u=!1;s>3&&(/^public$/i.test(o[2][0])?(l=o[3][0],u=s>4&&o[4][0]):/^system$/i.test(o[2][0])&&(u=o[3][0]));var h=o[s-1];return r.startDTD(a,l,u),r.endDTD(),h.index+h[0].length}return-1}function b(t,e,r){var n=t.indexOf("?>",e);if(n){var i=t.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return i?(i[0].length,r.processingInstruction(i[1],i[2]),n+2):-1}return-1}function x(){this.attributeNames={}}f.prototype=new Error,f.prototype.name=f.name,p.prototype={parse:function(t,e,r){var n=this.domBuilder;n.startDocument(),_(e,e={}),function(t,e,r,n,i){function o(t){var e=t.slice(1,-1);return e in r?r[e]:"#"===e.charAt(0)?function(t){if(t>65535){var e=55296+((t-=65536)>>10),r=56320+(1023&t);return String.fromCharCode(e,r)}return String.fromCharCode(t)}(parseInt(e.substr(1).replace("x","0x"))):(i.error("entity not found:"+t),t)}function s(e){if(e>_){var r=t.substring(_,e).replace(/&#?\w+;/g,o);c&&a(_),n.characters(r,0,e-_),_=e}}function a(e,r){for(;e>=u&&(r=h.exec(t));)l=r.index,u=l+r[0].length,c.lineNumber++;c.columnNumber=e-l+1}for(var l=0,u=0,h=/.*(?:\r\n?|\n)|.*$/g,c=n.locator,A=[{currentNSMap:e}],p={},_=0;;){try{var C=t.indexOf("<",_);if(C<0){if(!t.substr(_).match(/^\s*$/)){var E=n.doc,S=E.createTextNode(t.substr(_));E.appendChild(S),n.currentElement=S}return}switch(C>_&&s(C),t.charAt(C+1)){case"/":var B=t.indexOf(">",C+3),I=t.substring(C+2,B),T=A.pop();B<0?(I=t.substring(C+2).replace(/[\s<].*/,""),i.error("end tag name: "+I+" is not complete:"+T.tagName),B=C+1+I.length):I.match(/\s</)&&(I=I.replace(/[\s<].*/,""),i.error("end tag name: "+I+" maybe not complete"),B=C+1+I.length);var P=T.localNSMap,F=T.tagName==I;if(F||T.tagName&&T.tagName.toLowerCase()==I.toLowerCase()){if(n.endElement(T.uri,T.localName,I),P)for(var L in P)n.endPrefixMapping(L);F||i.fatalError("end tag name: "+I+" is not match the current start tagName:"+T.tagName)}else A.push(T);B++;break;case"?":c&&a(C),B=b(t,C,n);break;case"!":c&&a(C),B=w(t,C,n,i);break;default:c&&a(C);var M=new x,O=A[A.length-1].currentNSMap,k=(B=g(t,C,M,O,o,i),M.length);if(!M.closed&&v(t,B,M.tagName,p)&&(M.closed=!0,r.nbsp||i.warning("unclosed xml attribute")),c&&k){for(var N=d(c,{}),R=0;R<k;R++){var U=M[R];a(U.offset),U.locator=d(c,{})}n.locator=N,y(M,n,O)&&A.push(M),n.locator=c}else y(M,n,O)&&A.push(M);"http://www.w3.org/1999/xhtml"!==M.uri||M.closed?B++:B=m(t,B,M.tagName,o,n)}}catch(UW){if(UW instanceof f)throw UW;i.error("element parse error: "+UW),B=-1}B>_?_=B:s(Math.max(C,_)+1)}}(t,e,r,n,this.errorHandler),n.endDocument()}},x.prototype={setTagName:function(t){if(!i.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,r){if(!i.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:r}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},e.XMLReader=p,e.ParseError=f},function(t,e,r){r.r(e),r.d(e,"toKml",(function(){return A})),r.d(e,"toGeoJSON",(function(){return g}));var n=r(5),i=r(0);function o(t,e){return function(r){if(!r.properties||!s.valid(r.geometry))return"";var n=s.any(r.geometry);if(!n)return"";var i="",o="";if(t.simplestyle){var a=function(t){var e="";return t["marker-symbol"]&&(e=e+"ms"+t["marker-symbol"]),t["marker-color"]&&(e=e+"mc"+t["marker-color"].replace("#","")),t["marker-size"]&&(e=e+"ms"+t["marker-size"]),t.stroke&&(e=e+"s"+t.stroke.replace("#","")),t["stroke-width"]&&(e=e+"sw"+t["stroke-width"].toString().replace(".","")),t["stroke-opacity"]&&(e=e+"mo"+t["stroke-opacity"].toString().replace(".","")),t.fill&&(e=e+"f"+t.fill.replace("#","")),t["fill-opacity"]&&(e=e+"fo"+t["fill-opacity"].toString().replace(".","")),e}(r.properties);a&&(s.isPoint(r.geometry)&&function(t){return!!(t["marker-size"]||t["marker-symbol"]||t["marker-color"])}(r.properties)?(-1===e.indexOf(a)&&(i=function(t,e){return c("Style",c("IconStyle",c("Icon",c("href",function(t){return t["marker-symbol"]}(t))))+c("hotSpot","",[["xunits","fraction"],["yunits","fraction"],["x",.5],["y",.5]]),[["id",e]])}(r.properties,a),e.push(a)),o=c("styleUrl","#"+a)):(s.isPolygon(r.geometry)||s.isLine(r.geometry))&&function(t){for(var e in t)if({stroke:!0,"stroke-opacity":!0,"stroke-width":!0,fill:!0,"fill-opacity":!0}[e])return!0}(r.properties)&&(-1===e.indexOf(a)&&(i=function(t,e){var r=c("LineStyle",[c("color",l(t.stroke,t["stroke-opacity"])||"ff555555")+c("width",void 0===t["stroke-width"]?2:t["stroke-width"])]),n="";return(t.fill||t["fill-opacity"])&&(n=c("PolyStyle",[c("color",l(t.fill,t["fill-opacity"])||"88555555")])),c("Style",r+n,[["id",e]])}(r.properties,a),e.push(a)),o=c("styleUrl","#"+a)))}return i+c("Placemark",function(t,e){return t[e.name]?c("name",u(t[e.name])):""}(r.properties,t)+function(t,e){return t[e.description]?c("description",u(t[e.description])):""}(r.properties,t)+function(t){var e,r=[];for(var n in t){var i=t[n];e=i,"[object Object]"===Object.prototype.toString.call(e)?r.push('<Data name ="'.concat(n,'"><value>').concat(JSON.stringify(i),"</value></Data>")):r.push('<Data name ="'.concat(n,'"><value>').concat(i,"</value></Data>"))}return c("ExtendedData",r.join(""))}(r.properties)+function(t,e){return t[e.timestamp]?c("TimeStamp",c("when",u(t[e.timestamp]))):""}(r.properties,t)+n+o)}}var s={Point:function(t){return c("Point",c("coordinates",t.coordinates.join(",")))},LineString:function(t){return c("LineString",c("coordinates",a(t.coordinates)))},Polygon:function(t){if(!t.coordinates.length)return"";var e=t.coordinates[0],r=t.coordinates.slice(1),n=c("outerBoundaryIs",c("LinearRing",c("coordinates",a(e)))),i=r.map((function(t){return c("innerBoundaryIs",c("LinearRing",c("coordinates",a(t))))})).join("");return c("Polygon",n+i)},MultiPoint:function(t){return t.coordinates.length?c("MultiGeometry",t.coordinates.map((function(t){return s.Point({coordinates:t})})).join("")):""},MultiPolygon:function(t){return t.coordinates.length?c("MultiGeometry",t.coordinates.map((function(t){return s.Polygon({coordinates:t})})).join("")):""},MultiLineString:function(t){return t.coordinates.length?c("MultiGeometry",t.coordinates.map((function(t){return s.LineString({coordinates:t})})).join("")):""},GeometryCollection:function(t){return c("MultiGeometry",t.geometries.map(s.any).join(""))},valid:function(t){return t&&t.type&&(t.coordinates||"GeometryCollection"===t.type&&t.geometries&&t.geometries.every(s.valid))},any:function(t){return s[t.type]?s[t.type](t):""},isPoint:function(t){return"Point"===t.type||"MultiPoint"===t.type},isPolygon:function(t){return"Polygon"===t.type||"MultiPolygon"===t.type},isLine:function(t){return"LineString"===t.type||"MultiLineString"===t.type}};function a(t){return t.map((function(t){return t.join(",")})).join(" ")}function l(t,e){if("string"!=typeof t)return"";if(3===(t=t.replace("#","").toLowerCase()).length)t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2];else if(6!==t.length)return"";var r=t[0]+t[1],n=t[2]+t[3],i=t[4]+t[5],o="ff";return"number"==typeof e&&e>=0&&e<=1&&((o=(255*e).toString(16)).indexOf(".")>-1&&(o=o.substr(0,o.indexOf("."))),o.length<2&&(o="0"+o)),o+i+n+r}function u(t){return t?t.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):""}var h={">":"&gt;","<":"&lt;","'":"&apos;",'"':"&quot;","&":"&amp;"};function c(t,e,r){return(Array.isArray(e)||"string"==typeof e)&&(r=e,e={}),Array.isArray(r)&&(r="\n"+r.map((function(t){return" "+t})).join("\n")+"\n"),"<"+t+function(t){return Object.keys(t).length?" "+Object.keys(t).map((function(e){return e+'="'+function(t,e){var r;if(null!=t)return e=(e||"").replace(/[^&"<>\']/g,""),r="([&\"<>'])".replace(new RegExp("["+e+"]","g"),""),t.replace(new RegExp(r,"g"),(function(t,e){return h[e]}))}(t[e])+'"'})).join(" "):""}(e)+">"+r+"</"+t+">"}function A(t,e){return t.features&&t.features.forEach((function(t){if(t.properties){var e=t.properties.style;if(e){if(e.image)return t.properties["marker-symbol"]=e.image,void(e.outlineColor&&(t.properties["marker-color"]=e.outlineColor));var r,n,i;e.color&&(t.properties.fill=e.color,e.opacity&&(t.properties["fill-opacity"]=e.opacity)),e.outlineColor&&(t.properties.stroke=e.outlineColor,t.properties["stroke-width"]=null!==(r=e.outlineWidth)&&void 0!==r?r:1,t.properties["stroke-opacity"]=null!==(n=null!==(i=e.outlineOpacity)&&void 0!==i?i:e.opacity)&&void 0!==n?n:1)}}})),function(t,e){return'<?xml version="1.0" encoding="UTF-8"?>'+c("kml",c("Document",function(t){return void 0!==t.documentName?c("name",t.documentName):""}(e=e||{documentName:void 0,documentDescription:void 0,name:"name",description:"description",simplestyle:!1,timestamp:"timestamp"})+function(t){return void 0!==t.documentDescription?c("description",t.documentDescription):""}(e)+function(t,e){if(!t.type)return"";var r=[];switch(t.type){case"FeatureCollection":return t.features?t.features.map(o(e,r)).join(""):"";case"Feature":return o(e,r)(t);default:return o(e,r)({type:"Feature",geometry:t,properties:{}})}}(t,e)),[["xmlns","http://www.opengis.net/kml/2.2"]])}(t,e)}var f=function(t){return(new DOMParser).parseFromString(t,"text/xml")},p=function(t){return t.split(".").pop()},d=function(t){return(new n).loadAsync(t).then((function(t){var e=null;return t.forEach((function(t,r){"kml"===p(t)&&null===e&&(e=r.async("string").then(f))})),e||Promise.reject("No kml file found")}))};function g(t){if(!t)return Promise.reject("参数不能为空");if("string"==typeof(o=t)&&o.constructor==String){var e=p(t);if("kml"===e)return Cesium.Resource.fetchXML(t).then((function(t){return Object(i.a)(t)}));if("kmz"===e)return Cesium.Resource.fetchBlob(t).then((function(t){return d(t)})).then((function(t){return Object(i.a)(t)}));var r=Object(i.a)(f(t));return Promise.resolve(r)}if(t.getRootNode){var n=Object(i.a)(t);return Promise.resolve(n)}return d(t).then((function(t){return Object(i.a)(t)}));var o}}])},am.exports=um(),window.ol&&!ol.ext&&(ol.ext={});var cm=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t};window.ol&&(ol.inherits||(ol.inherits=cm)),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),window.Element&&!Element.prototype.remove&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)});var Am=function(t){var e;t||(t={});var r=this.canvas_=document.createElement("canvas"),n=(Number(t.scale)>0?Number(t.scale):1)*at||at,i=r.getContext("2d");if(t.image){var o;t.image.load();var s=t.image.getImage();if(s.width)r.width=Math.round(s.width*n),r.height=Math.round(s.height*n),i.globalAlpha="number"==typeof t.opacity?t.opacity:1,i.drawImage(s,0,0,s.width,s.height,0,0,r.width,r.height),e=i.createPattern(r,"repeat");else{var a=this;e=[0,0,0,0],s.onload=function(){r.width=Math.round(s.width*n),r.height=Math.round(s.height*n),i.globalAlpha="number"==typeof t.opacity?t.opacity:1,i.drawImage(s,0,0,s.width,s.height,0,0,r.width,r.height),e=i.createPattern(r,"repeat"),a.setColor(e)}}}else{var l=this.getPattern_(t);if(r.width=Math.round(l.width*n),r.height=Math.round(l.height*n),i.beginPath(),t.fill&&(i.fillStyle=jn(t.fill.getColor()),i.fillRect(0,0,r.width,r.height)),i.scale(n,n),i.lineCap="round",i.lineWidth=l.stroke||1,i.fillStyle=jn(t.color||"#000"),i.strokeStyle=jn(t.color||"#000"),l.circles)for(o=0;o<l.circles.length;o++){var u=l.circles[o];i.beginPath(),i.arc(u[0],u[1],u[2],0,2*Math.PI),l.fill&&i.fill(),l.stroke&&i.stroke()}if(l.repeat||(l.repeat=[[0,0]]),l.char&&(i.font=l.font||l.width+"px Arial",i.textAlign="center",i.textBaseline="middle",l.angle?(i.fillText(l.char,l.width/4,l.height/4),i.fillText(l.char,5*l.width/4,5*l.height/4),i.fillText(l.char,l.width/4,5*l.height/4),i.fillText(l.char,5*l.width/4,l.height/4),i.fillText(l.char,3*l.width/4,3*l.height/4),i.fillText(l.char,-l.width/4,-l.height/4),i.fillText(l.char,3*l.width/4,-l.height/4),i.fillText(l.char,-l.width/4,3*l.height/4)):i.fillText(l.char,l.width/2,l.height/2)),l.lines)for(o=0;o<l.lines.length;o++)for(var h=0;h<l.repeat.length;h++){var c=l.lines[o];i.beginPath(),i.moveTo(c[0]+l.repeat[h][0],c[1]+l.repeat[h][1]);for(var A=2;A<c.length;A+=2)i.lineTo(c[A]+l.repeat[h][0],c[A+1]+l.repeat[h][1]);l.fill&&i.fill(),l.stroke&&i.stroke(),i.save(),i.strokeStyle="red",i.strokeWidth=.1,i.restore()}if(e=i.createPattern(r,"repeat"),t.offset){var f=t.offset;if("number"==typeof f&&(f=[f,f]),f instanceof Array){var p=Math.round(f[0]*n),d=Math.round(f[1]*n);i.scale(1/n,1/n),i.clearRect(0,0,r.width,r.height),i.translate(p,d),i.fillStyle=e,i.fillRect(-p,-d,r.width,r.height),e=i.createPattern(r,"repeat")}}}Tn.call(this,{color:e})};cm(Am,Tn),Am.prototype.clone=function(){var t=Tn.prototype.clone.call(this);return t.canvas_=this.canvas_,t},Am.prototype.getImage=function(){return this.canvas_},Am.prototype.getPattern_=function(t){var e,r=Am.prototype.patterns[t.pattern]||Am.prototype.patterns.dot,n=Math.round(t.spacing)||10;switch(t.pattern){case"dot":case"circle":e=0===t.size?0:t.size/2||2,t.angle?(n=r.width=r.height=Math.round(1.4*n),r.circles=[[n/4,n/4,e],[3*n/4,3*n/4,e]],"circle"==t.pattern&&(r.circles=r.circles.concat([[n/4+n,n/4,e],[n/4,n/4+n,e],[3*n/4-n,3*n/4,e],[3*n/4,3*n/4-n,e],[n/4+n,n/4+n,e],[3*n/4-n,3*n/4-n,e]]))):(r.width=r.height=n,r.circles=[[n/2,n/2,e]],"circle"==t.pattern&&(r.circles=r.circles.concat([[n/2+n,n/2,e],[n/2-n,n/2,e],[n/2,n/2+n,e],[n/2,n/2-n,e],[n/2+n,n/2+n,e],[n/2+n,n/2-n,e],[n/2-n,n/2+n,e],[n/2-n,n/2-n,e]])));break;case"tile":case"square":e=0===t.size?0:t.size/2||2,t.angle?(r.width=r.height=n,r.lines=[[n/2-e,n/2,n/2,n/2-e,n/2+e,n/2,n/2,n/2+e,n/2-e,n/2]]):(r.width=r.height=n,r.lines=[[n/2-e,n/2-e,n/2+e,n/2-e,n/2+e,n/2+e,n/2-e,n/2+e,n/2-e,n/2-e]]),"square"==t.pattern&&(r.repeat=[[0,0],[0,n],[n,0],[0,-n],[-n,0],[-n,-n],[n,n],[-n,n],[n,-n]]);break;case"cross":t.angle&&(t.angle=45);case"hatch":var i=Math.round(((t.angle||0)-90)%360);i>180&&(i-=360),i*=Math.PI/180;var o=Math.cos(i),s=Math.sin(i);if(Math.abs(s)<1e-4)r.width=r.height=n,r.lines=[[0,.5,n,.5]],r.repeat=[[0,0],[0,n]];else if(Math.abs(o)<1e-4)r.width=r.height=n,r.lines=[[.5,0,.5,n]],r.repeat=[[0,0],[n,0]],"cross"==t.pattern&&(r.lines.push([0,.5,n,.5]),r.repeat.push([0,n]));else{var a=r.width=Math.round(Math.abs(n/s))||1,l=r.height=Math.round(Math.abs(n/o))||1;"cross"==t.pattern?(r.lines=[[-a,-l,2*a,2*l],[2*a,-l,-a,2*l]],r.repeat=[[0,0]]):o*s>0?(r.lines=[[-a,-l,2*a,2*l]],r.repeat=[[0,0],[a,0],[0,l]]):(r.lines=[[2*a,-l,-a,2*l]],r.repeat=[[0,0],[-a,0],[0,l]])}r.stroke=0===t.size?0:t.size||4}return r},Am.addPattern=function(t,e){e||(e={}),Am.prototype.patterns[t||e.char]={width:e.width||e.size||10,height:e.height||e.size||10,font:e.font,char:e.char,circles:e.circles,lines:e.lines,repeat:e.repeat,stroke:e.stroke,angle:e.angle,fill:e.fill}},Am.prototype.patterns={hatch:{width:5,height:5,lines:[[0,2.5,5,2.5]],stroke:1},cross:{width:7,height:7,lines:[[0,3,10,3],[3,0,3,10]],stroke:1},dot:{width:8,height:8,circles:[[5,5,2]],stroke:!1,fill:!0},circle:{width:10,height:10,circles:[[5,5,2]],stroke:1,fill:!1},square:{width:10,height:10,lines:[[3,3,3,8,8,8,8,3,3,3]],stroke:1,fill:!1},tile:{width:10,height:10,lines:[[3,3,3,8,8,8,8,3,3,3]],fill:!0},woven:{width:12,height:12,lines:[[3,3,9,9],[0,12,3,9],[9,3,12,0],[-1,1,1,-1],[13,11,11,13]],stroke:1},crosses:{width:8,height:8,lines:[[2,2,6,6],[2,6,6,2]],stroke:1},caps:{width:8,height:8,lines:[[2,6,4,2,6,6]],stroke:1},nylon:{width:20,height:20,lines:[[1,6,1,1,6,1],[6,11,11,11,11,6],[11,16,11,21,16,21],[16,11,21,11,21,16]],repeat:[[0,0],[-20,0],[0,-20]],stroke:1},hexagon:{width:20,height:12,lines:[[0,10,4,4,10,4,14,10,10,16,4,16,0,10]],stroke:1,repeat:[[0,0],[10,6],[10,-6],[-10,-6]]},cemetry:{width:15,height:19,lines:[[0,3.5,7,3.5],[3.5,0,3.5,10]],stroke:1,repeat:[[0,0],[7,9]]},sand:{width:20,height:20,circles:[[1,2,1],[9,3,1],[2,16,1],[7,8,1],[6,14,1],[4,19,1],[14,2,1],[12,10,1],[14,18,1],[18,8,1],[18,14,1]],fill:1},conglomerate:{width:60,height:40,circles:[[2,4,1],[17,3,1],[26,18,1],[12,17,1],[5,17,2],[28,11,2]],lines:[[7,5,6,7,9,9,11,8,11,6,9,5,7,5],[16,10,15,13,16,14,19,15,21,13,22,9,20,8,19,8,16,10],[24,6,26,7,27,5,26,4,24,4,24,6]],repeat:[[30,0],[-15,20],[15,20],[45,20]],stroke:1},conglomerate2:{width:60,height:40,circles:[[2,4,1],[17,3,1],[26,18,1],[12,17,1],[5,17,2],[28,11,2]],lines:[[7,5,6,7,9,9,11,8,11,6,9,5,7,5],[16,10,15,13,16,14,19,15,21,13,22,9,20,8,19,8,16,10],[24,6,26,7,27,5,26,4,24,4,24,6]],repeat:[[30,0],[-15,20],[15,20],[45,20]],fill:1},gravel:{width:15,height:10,circles:[[4,2,1],[5,9,1],[1,7,1]],lines:[[7,5,6,6,7,7,8,7,9,7,10,5,9,4,7,5],[11,2,14,4,14,1,12,1,11,2]],stroke:1},brick:{width:18,height:16,lines:[[0,1,18,1],[0,10,18,10],[6,1,6,10],[12,10,12,18],[12,0,12,1]],stroke:1},dolomite:{width:20,height:16,lines:[[0,1,20,1],[0,9,20,9],[1,9,6,1],[11,9,14,16],[14,0,14.4,1]],stroke:1},coal:{width:20,height:16,lines:[[1,5,7,1,7,7],[11,10,12,5,18,9],[5,10,2,15,9,15],[15,16,15,13,20,16],[15,0,15,2,20,0]],fill:1},breccia:{width:20,height:16,lines:[[1,5,7,1,7,7,1,5],[11,10,12,5,18,9,11,10],[5,10,2,15,9,15,5,10],[15,16,15,13,22,18],[15,0,15,2,20,0]],stroke:1},clay:{width:20,height:20,lines:[[0,0,3,11,0,20],[11,0,10,3,13,13,11,20],[0,0,10,3,20,0],[0,12,3,11,13,13,20,12]],stroke:1},flooded:{width:15,height:10,lines:[[0,1,10,1],[0,6,5,6],[10,6,15,6]],stroke:1},chaos:{width:40,height:40,lines:[[40,2,40,0,38,0,40,2],[4,0,3,2,2,5,0,0,0,3,2,7,5,6,7,7,8,10,9,12,9,13,9,14,8,14,6,15,2,15,0,20,0,22,2,20,5,19,8,15,10,14,11,12.25,10,12,10,10,12,9,13,7,12,6,13,4,16,7,17,4,20,0,18,0,15,3,14,2,14,0,12,1,11,0,10,1,11,4,10,7,9,8,8,5,6,4,5,3,5,1,5,0,4,0],[7,1,7,3,8,3,8,2,7,1],[4,3,5,5,4,5,4,3],[34,5,33,7,38,10,38,8,36,5,34,5],[27,0,23,2,21,8,30,0,27,0],[25,8,26,12,26,16,22.71875,15.375,20,13,18,15,17,18,13,22,17,21,19,22,21,20,19,18,22,17,30,25,26,26,24,28,21.75,33.34375,20,36,18,40,20,40,24,37,25,32,27,31,26,38,27,37,30,32,32,35,36,37,38,40,38,39,40,40,37,36,34,32,37,31,36,29,33,27,34,24,39,21,40,21,40,16,37,20,31,22,32,25,27,20,29,15,30,20,32,20,34,18,33,12,31,11,29,14,26,9,25,8],[39,24,37,26,40,28,39,24],[13,15,9,19,14,18,13,15],[18,23,14,27,16,27,17,25,20,26,18,23],[6,24,2,26,1,28,2,30,5,28,12,30,16,32,18,30,15,30,12,28,9,25,7,27,6,24],[29,27,32,28,33,31,30,29,27,28,29,27],[5,35,1,33,3,36,13,38,15,35,10,36,5,35]],fill:1},grass:{width:27,height:22,lines:[[0,10.5,13,10.5],[2.5,10,1.5,7],[4.5,10,4.5,5,3.5,4],[7,10,7.5,6,8.5,3],[10,10,11,6]],repeat:[[0,0],[14,10]],stroke:1},swamp:{width:24,height:23,lines:[[0,10.5,9.5,10.5],[2.5,10,2.5,7],[4.5,10,4.5,4],[6.5,10,6.5,6],[3,12.5,7,12.5]],repeat:[[0,0],[14,10]],stroke:1},reed:{width:26,height:23,lines:[[2.5,10,2,7],[4.5,10,4.2,4],[6.5,10,6.8,4],[8.5,10,9,6],[3.7,4,3.7,2.5],[4.7,4,4.7,2.5],[6.3,4,6.3,2.5],[7.3,4,7.3,2.5]],circles:[[4.2,2.5,.5],[18.2,12.5,.5],[6.8,2.5,.5],[20.8,12.5,.5],[9,6,.5],[23,16,.5]],repeat:[[0,0],[14,10]],stroke:1},wave:{width:10,height:8,lines:[[0,0,5,4,10,0]],stroke:1},vine:{width:13,height:13,lines:[[3,0,3,6],[9,7,9,13]],stroke:1},forest:{width:55,height:30,circles:[[7,7,3.5],[20,20,1.5],[42,22,3.5],[35,5,1.5]],stroke:1},forest2:{width:55,height:30,circles:[[7,7,3.5],[20,20,1.5],[42,22,3.5],[35,5,1.5]],fill:1,stroke:1},scrub:{width:26,height:20,lines:[[1,4,4,8,6,4]],circles:[[20,13,1.5]],stroke:1},tree:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78]],repeat:[[3,1],[18,16]],stroke:1},tree2:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78,4.95,10.61,7.78,10.61]],repeat:[[3,1],[18,16]],fill:1,stroke:1},pine:{width:30,height:30,lines:[[5.66,11.31,2.83,11.31,2.83,8.49,0,8.49,2.83,0,5.66,8.49,2.83,8.49]],repeat:[[3,1],[18,16]],stroke:1},pine2:{width:30,height:30,lines:[[5.66,11.31,2.83,11.31,2.83,8.49,0,8.49,2.83,0,5.66,8.49,2.83,8.49,2.83,11.31,5.66,11.31]],repeat:[[3,1],[18,16]],fill:1,stroke:1},mixtree:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78,4.95,10.61,7.78,10.61],[23.66,27.31,20.83,27.31,20.83,24.49,18,24.49,20.83,16,23.66,24.49,20.83,24.49,20.83,27.31,23.66,27.31]],repeat:[[3,1]],stroke:1},mixtree2:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78,4.95,10.61,7.78,10.61],[23.66,27.31,20.83,27.31,20.83,24.49,18,24.49,20.83,16,23.66,24.49,20.83,24.49,20.83,27.31,23.66,27.31]],repeat:[[3,1]],fill:1,stroke:1},pines:{width:22,height:20,lines:[[1,4,3.5,1,6,4],[1,8,3.5,5,6,8],[3.5,1,3.5,11],[12,14.5,14.5,14,17,14.5],[12,18,17,18],[14.5,12,14.5,18]],repeat:[[2,1]],stroke:1},rock:{width:20,height:20,lines:[[1,0,1,9],[4,0,4,9],[7,0,7,9],[10,1,19,1],[10,4,19,4],[10,7,19,7],[0,11,9,11],[0,14,9,14],[0,17,9,17],[12,10,12,19],[15,10,15,19],[18,10,18,19]],repeat:[[.5,.5]],stroke:1},rocks:{width:20,height:20,lines:[[5,0,3,0,5,4,4,6,0,3,0,5,3,6,5,9,3.75,10,2.5,10,0,9,0,10,4,11,5,14,4,15,0,13,0,13,0,13,0,14,0,14,5,16,5,18,3,19,0,19,-.25,19.9375,5,20,10,19,10,20,11,20,12,19,14,20,15,20,17,19,20,20,20,19,19,16,20,15,20,11,20,10,19,8,20,5,20,0,19,0,20,2,19,4,17,4,16,3,15,0,14,0,15,4,11,5,10,4,11,0,10,0,9,4,6,5,5,0],[18,5,19,6,18,10,16,10,14,9,16,5,18,5],[5,6,9,5,10,6,10,9,6,10,5,6],[14,5,14,8,13,9,12,9,11,7,12,5,14,5],[5,11,8,10,9,11,10,14,6,15,6,15,5,11],[13,10,14,11,15,14,15,14,15,14,11,15,10,11,11,10,13,10],[15,12,16,11,19,11,19,15,16,14,16,14,15,12],[6,16,9,15,10,18,5,19,6,16],[10,16,14,16,14,18,13,19,11,18,10,16],[15,15,18,16,18,18,16,19,15,18,15,15]],stroke:1}};class fm{static uuid15(){return fm.uuid(15,16)}static CheckIsColor(t){return CSS.supports("color",t)?t:"rgba(0, 0, 0, 0.8)"}static getDefaultImageFillStyle(){let t=[],e=new Am;for(let r in e.patterns){let e=new Am({pattern:r});t.push({title:r,image:e.getImage().toDataURL()})}return t}static saveToShp(t,e){}static toGeoJSON(t){return(new nf).writeFeaturesObject(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static formatStr(t,e){if(0===arguments.length)return null;let r=arguments[0];for(let n=1;n<arguments.length;n++){let t=new RegExp("\\{"+(n-1)+"\\}","gm");r=r.replace(t,arguments[n])}return r}static randomString(t){t=t||32;let e="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz",r=e.length,n="";for(let i=0;i<t;i++)n+=e.charAt(Math.floor(Math.random()*r));return n.toLowerCase()}static uuid(t,e){let r,n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=[];if(e=e||n.length,t)for(r=0;r<t;r++)i[r]=n[0|Math.random()*e];else{let t;for(i[8]=i[13]=i[18]=i[23]="-",i[14]="4",r=0;r<36;r++)i[r]||(t=0|16*Math.random(),i[r]=n[19===r?3&t|8:t])}return i.join("")}static format(t,e){if("object"==typeof e){for(let r in e)if(void 0!==e[r]){let n=new RegExp("({"+r+"})","g");t=t.replace(n,e[r])}}else for(let r=0;r<e.length;r++)if(void 0!==e[r]){let n=new RegExp("({["+r+"]})","g");t=t.replace(n,e[r])}return t}static getQueryString(t){return new URL(window.location.href).searchParams.get(t)}static ConvertKmlToJson(t,e){hm.toGeoJSON(t).then((t=>{e(t)}))}static saveTokml(t,e){let r=hm.toKml(t,{name:"标绘数据",documentName:"标绘数据文件",documentDescription:"标绘数据 by 幻景科技",simplestyle:!0});fm.downloadFile(e,r)}static saveJSON(t,e){if(!t)return void alert("保存的数据为空");e||(e="json.json"),"object"==typeof t&&(t=JSON.stringify(t,void 0,4));let r=new Blob([t],{type:"text/json"}),n=document.createEvent("MouseEvents"),i=document.createElement("a");i.download=e,i.href=window.URL.createObjectURL(r),i.dataset.downloadurl=["text/json",i.download,i.href].join(":"),n.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),i.dispatchEvent(n)}static downloadFile(t,e){const r=new Blob([e]),n=document.createElement("a");n.download=t,n.href=URL.createObjectURL(r),document.body.appendChild(n),n.click(),document.body.removeChild(n)}static randomHexColor(){return"#"+Math.random().toString(16).substring(2,6).toUpperCase()}static randomRgbColor(t=1){return fm.hexToRgba(fm.randomHexColor(),t)}static rgbToHex(t){let e,r,n,i,o=t.replace(/\s+/g,"").match(/rgba?\((\d{1,3}),(\d{1,3}),(\d{1,3})(,([.\d]+))?\)/);return o?(e=(+o[1]).toString(16),e=1===e.length?"0"+e:e,r=(+o[2]).toString(16),r=1===r.length?"0"+r:r,n=(+o[3]).toString(16),n=1===n.length?"0"+n:n,i=+(o[5]?o[5]:1),{hex:"#"+e+r+n,alpha:i}):{hex:t,alpha:1}}static hexToRgba(t,e){let r=t.toLowerCase();if(r&&/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(r)){if(4===r.length){let t="#";for(let e=1;e<4;e+=1)t+=r.slice(e,e+1).concat(r.slice(e,e+1));r=t}let t=[];for(let e=1;e<7;e+=2)t.push(parseInt("0x"+r.slice(e,e+2)));return"rgba("+t.join(",")+","+e+")"}return r}}const pm=class{constructor(t){r(this,"overlayStyle"),r(this,"StylesList",{highlightStyle:new Gi({stroke:new kn({color:"rgba(0, 255, 0,1)",width:5}),fill:new Tn({color:"rgba(0, 255, 0,0.0)"}),text:new zi({text:"",font:"12px Calibri,sans-serif",fill:new Tn({color:"#000"}),stroke:new kn({color:"#f00",width:3})}),image:new ki({radius:5,fill:new Tn({color:"rgba(0, 255, 0,1)"}),stroke:new kn({color:"rgba(255, 255, 255,1)",width:2})})}),point:new Gi({text:new zi({font:pm.option.Point.Font,text:"",offsetX:pm.option.Point.FontoffsetX,offsetY:pm.option.Point.FontoffsetY,fill:new Tn({color:pm.option.Point.FontColor}),stroke:new kn({color:pm.option.Point.FontStrokeColor,width:pm.option.Point.FontStrokeWidth})}),image:new ki({scale:pm.option.Point.scale,radius:pm.option.Point.radius,fill:new Tn({color:pm.option.Point.fillcolor}),stroke:new kn({color:pm.option.Point.strokecolor,width:pm.option.Point.strokewidth})})}),polyline:new Gi({stroke:new kn({color:pm.option.LineString.strokecolor,width:pm.option.LineString.strokewidth}),text:new zi({text:"",font:pm.option.LineString.Font,fill:new Tn({color:pm.option.LineString.FontColor}),stroke:new kn({color:pm.option.LineString.FontStrokeColor,width:pm.option.LineString.FontStrokeWidth})})}),polygon:new Gi({stroke:new kn({color:pm.option.Polygon.strokecolor,width:pm.option.Polygon.strokewidth}),fill:new Tn({color:pm.option.Polygon.fillcolor}),text:new zi({text:"",font:pm.option.Polygon.Font,fill:new Tn({color:pm.option.Polygon.FontColor}),stroke:new kn({color:pm.option.Polygon.FontStrokeColor,width:pm.option.Polygon.FontStrokeWidth})})}),bufferStyle:new Gi({stroke:new kn({color:pm.option.bufferStyle.strokecolor,width:pm.option.bufferStyle.strokewidth,lineDash:[10,10]}),fill:new Tn({color:pm.option.bufferStyle.fillcolor}),text:new zi({text:"",font:pm.option.bufferStyle.Font,fill:new Tn({color:pm.option.bufferStyle.FontColor}),stroke:new kn({color:pm.option.bufferStyle.FontStrokeColor,width:pm.option.bufferStyle.FontStrokeWidth})})}),overlapStyle:new Gi({stroke:new kn({color:pm.option.overlapStyle.strokecolor,width:pm.option.overlapStyle.strokewidth}),fill:new Tn({color:pm.option.overlapStyle.fillcolor}),text:new zi({text:"",font:pm.option.overlapStyle.Font,fill:new Tn({color:pm.option.overlapStyle.FontColor}),stroke:new kn({color:pm.option.overlapStyle.FontStrokeColor,width:pm.option.overlapStyle.FontStrokeWidth})}),image:new ki({radius:5,fill:new Tn({color:pm.option.overlapStyle.fillcolor}),stroke:new kn({color:pm.option.overlapStyle.strokecolor,width:pm.option.overlapStyle.strokewidth})}),zIndex:1/0}),MultiLineString:new Gi({stroke:new kn({color:"green",width:1})}),MultiPoint:new Gi({image:pm.image}),MultiPolygon:new Gi({stroke:new kn({color:"yellow",width:1}),fill:new Tn({color:"rgba(255, 255, 0, 0.1)"})}),Circle:new Gi({stroke:new kn({color:pm.option.Polygon.strokecolor,width:pm.option.Polygon.strokewidth}),fill:new Tn({color:pm.option.Polygon.fillcolor})}),square:new Gi({image:new Mi({fill:pm.fill,stroke:pm.stroke,points:4,radius:10,angle:Math.PI/4})}),triangle:new Gi({image:new Mi({fill:pm.fill,stroke:pm.stroke,points:3,radius:10,rotation:Math.PI/4,angle:0})}),star:new Gi({image:new Mi({fill:pm.fill,stroke:pm.stroke,points:5,radius:10,radius2:4,angle:0})}),cross:new Gi({image:new Mi({fill:pm.fill,stroke:pm.stroke,points:4,radius:10,radius2:0,angle:0})}),x:new Gi({image:new Mi({fill:pm.fill,stroke:pm.stroke,points:4,radius:10,radius2:0,angle:Math.PI/4})}),GeometryCollection:new Gi({fill:new Tn({color:"rgba(255, 255, 255, 0.1)"}),stroke:new kn({color:"rgba(255, 255, 0, 1)",width:3}),image:new ki({radius:5,stroke:new kn({color:"rgba(255, 0,0, 1)",width:2}),fill:new Tn({color:"rgba(255, 255, 0, 1)"})})})}),r(this,"option",{overlapStyle:{Font:"12px Microsoft YaHei",FontColor:"#8B4513",FontStrokeColor:"#fff",FontStrokeWidth:2,FontoffsetX:0,FontoffsetY:0,fillcolor:"rgba(255, 255, 255,0.5)",strokecolor:"blue",strokewidth:3,strokeradius:5}}),this.overlayStyle=function(){const t={};return t.Polygon=[new Gi({fill:new Tn({color:[255,255,255,.5]})}),new Gi({stroke:new kn({color:[255,255,255,1],width:5})}),new Gi({stroke:new kn({color:[0,153,255,1],width:3})}),new Gi({image:new ki({radius:3,fill:new Tn({color:"red"})})})],t.MultiPolygon=t.Polygon,t.LineString=[new Gi({stroke:new kn({color:[255,255,255,1],width:5})}),new Gi({stroke:new kn({color:[0,153,255,1],width:3})})],t.MultiLineString=t.LineString,t.Point=[new Gi({image:new ki({radius:7,fill:new Tn({color:[0,153,255,1]}),stroke:new kn({color:[255,255,255,.75],width:1.5})}),zIndex:1e5})],t.MultiPoint=t.Point,t.GeometryCollection=t.Polygon.concat(t.Point),function(e,r){return t[e.getGeometry().getType()]}}()}static getStyle(t,e){let r;switch(t){case Wy.Point:r=(null==e?void 0:e.imageOption)?pm.getIconStyle(e):pm.getPointStyle(e);break;case Wy.Line:r=pm.getPolylineStyle(e);break;case Wy.Polygon:case Wy.MultiPolygon:case Wy.Rectangle:case Wy.Circle:r=pm.getPolygonStyle(e);break;case Wy.GeometryCollection:r=new Gi({fill:new Tn({color:"rgba(255, 255, 255, 0.1)"}),stroke:new kn({color:"rgba(255, 255, 0, 1)",width:3}),image:new ki({radius:5,stroke:new kn({color:"rgba(255, 0,0, 1)",width:2}),fill:new Tn({color:"rgba(255, 255, 0, 1)"})})})}return r}static getDefaultPointStyle(){return{Font:"12px Microsoft YaHei",FontColor:"#8B4513",FontStrokeColor:"#fff",FontStrokeWidth:2,FontoffsetX:0,FontoffsetY:-10,fillcolor:"rgba(0, 153, 255,1)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1,radius:3,scale:1,text:""}}static getDefaulLineStyle(){return{Font:"12px Microsoft YaHei",FontColor:"#8B4513",FontStrokeColor:"#fff",FontStrokeWidth:2,FontoffsetX:0,FontoffsetY:10,fillcolor:"rgba(255, 255, 0,1)",strokecolor:"rgba(255, 255, 0,1)",strokewidth:2,strokeradius:5,strokelineDash:null,strokelineCap:"round",strokelineJoin:"round",text:""}}static getDefaultBufferStyleStyle(){return{Font:"12px Microsoft YaHei",FontColor:"#8B4513",FontStrokeColor:"#fff",FontStrokeWidth:2,FontoffsetX:0,FontoffsetY:0,fillcolor:"rgba(255, 255, 255,0.2)",strokecolor:"rgba(255, 0, 0,1)",strokewidth:2,strokeradius:5,text:""}}static getDefaultPolygonStyle(){return{Font:"12px Microsoft YaHei",FontColor:"#8B4513",FontStrokeColor:"#fff",FontStrokeWidth:2,FontoffsetX:0,FontoffsetY:0,fillcolor:"rgba(255, 255, 255,0.2)",strokecolor:"rgba(255, 255, 0,1)",strokewidth:2,strokeradius:5,text:""}}static getTipStyle(){return new Gi({text:new zi({font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.8)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})})}static getIconStyle(t){for(let r in t)""===t[r]&&delete t[r];let e=Object.assign({},pm.getDefaultPointStyle(),t);return new Gi({text:new zi({font:e.Font,text:e.text,offsetX:e.FontoffsetX,offsetY:e.FontoffsetY,fill:new Tn({color:fm.CheckIsColor(e.FontColor)}),stroke:new kn({color:fm.CheckIsColor(e.FontStrokeColor),width:e.FontStrokeWidth})}),image:new ms(e.imageOption)})}static getPointStyle(t){for(let r in t)""===t[r].toString()&&delete t[r];let e=Object.assign({},pm.getDefaultPointStyle(),t);return new Gi({text:new zi({font:e.Font,text:e.text,offsetX:e.FontoffsetX,offsetY:e.FontoffsetY,fill:new Tn({color:fm.CheckIsColor(e.FontColor)}),stroke:new kn({color:fm.CheckIsColor(e.FontStrokeColor),width:e.FontStrokeWidth})}),image:new ki({scale:e.scale,radius:e.radius,fill:new Tn({color:fm.CheckIsColor(e.fillcolor)}),stroke:new kn({color:fm.CheckIsColor(e.strokecolor),width:e.strokewidth})})})}static getPolylineStyle(t){for(let r in t)""===t[r].toString()&&delete t[r];let e=Object.assign({},pm.getDefaulLineStyle(),t);switch(e.strokeStyle){case"STYLE_DASH":e.strokelineDash=[15,10];break;case"STYLE_SOLID":e.strokelineDash=null;break;case"STYLE_DOT":e.strokelineDash=[2,5];break;case"STYLE_DASHDOT":e.strokelineDash=[2,10,15,10]}return new Gi({stroke:new kn({color:e.strokecolor,width:e.strokewidth,lineDash:e.strokelineDash}),text:new zi({text:e.text,font:e.Font,fill:new Tn({color:fm.CheckIsColor(e.FontColor)}),stroke:new kn({color:fm.CheckIsColor(e.FontStrokeColor),width:e.FontStrokeWidth})})})}static getTrackLineStyle(t,e){t.getGeometry();let r=[new Gi({stroke:new kn({color:"#2E8B57",width:10})})];t.getGeometry().getLength();let n=Math.ceil(t.getGeometry().getLength()/e/100),i=[];for(let o=0;o<=n;o++){let e=o/n+.01;e>1&&(e-=1);let r=new W(new rn(t.getGeometry().getCoordinateAt(e)));i.push(r)}return t.getGeometry().forEachSegment(((t,e)=>{i.forEach((n=>{let i=new On([t,e]),o=n.getGeometry().getFirstCoordinate(),s=i.getClosestPoint(o);if(Math.abs(s[0]-o[0])<1&&Math.abs(s[1]-o[1])<1){new Image(117,71).src="../../public/image/linearrow.png";let i=e[0]-t[0],o=e[1]-t[1],s=Math.atan(i/o);s=o>0?s:Math.PI+s,r.push(new Gi({geometry:n.getGeometry(),image:new ms({src:"../../public/image/linearrow.png",anchor:[.75,.5],scale:1,rotateWithView:!1,color:"white",rotation:-s})}))}}))})),r}static getPolygonStyle(t){for(let r in t)""===t[r].toString()&&delete t[r];let e=Object.assign({},pm.getDefaultPolygonStyle(),t);switch(e.strokeStyle){case"STYLE_DASH":e.strokelineDash=[15,10];break;case"STYLE_SOLID":e.strokelineDash=null;break;case"STYLE_DOT":e.strokelineDash=[2,5];break;case"STYLE_DASHDOT":e.strokelineDash=[2,10,15,10]}return new Gi({stroke:new kn({color:fm.CheckIsColor(e.strokecolor),width:e.strokewidth,lineDash:e.strokelineDash}),fill:new Tn({color:fm.CheckIsColor(e.fillcolor)}),text:new zi({text:e.text,font:e.Font,fill:new Tn({color:fm.CheckIsColor(e.FontColor)}),stroke:new kn({color:fm.CheckIsColor(e.FontStrokeColor),width:e.FontStrokeWidth})})})}static getBufferStyleStyle(t){for(let r in t)""===t[r].toString()&&delete t[r];let e=Object.assign({},pm.getDefaultBufferStyleStyle(),t);return new Gi({stroke:new kn({color:fm.CheckIsColor(e.strokecolor),width:e.strokewidth,lineDash:[10,10]}),fill:new Tn({color:fm.CheckIsColor(e.fillcolor)}),text:new zi({text:e.text,font:e.Font,fill:new Tn({color:fm.CheckIsColor(e.FontColor)}),stroke:new kn({color:fm.CheckIsColor(e.FontStrokeColor),width:e.FontStrokeWidth})})})}static getEditPolygonStyle(){return[new Gi({stroke:new kn({color:"rgba(0, 153, 255,1)",width:3}),fill:new Tn({color:"rgba(255, 255, 255,0.3)"}),text:new zi({text:"",font:"12px Microsoft YaHei",fill:new Tn({color:"#000"}),stroke:new kn({color:"#fff",width:2})})}),new Gi({image:new ki({radius:3,fill:new Tn({color:"rgba(255, 255, 255,1)"}),stroke:new kn({color:"red",width:2})}),geometry:function(t){var e,r;if(t){let n;return n=t.getGeometry().getType()===Wy.Line?null==(e=t.getGeometry())?void 0:e.getCoordinates():null==(r=t.getGeometry())?void 0:r.getCoordinates()[0],new Fu(n)}}})]}static getEditPointStyle(t){return new Gi({image:new ki({radius:5,stroke:new kn({color:"rgba(255, 255,255, 0.7)"}),fill:new Tn({color:"rgba(0, 255, 255, 0.8)"})}),text:new zi({text:"拖动点修改图形,点击空白处完成",font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.7)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})})}static getRandomColor(){return"#"+Math.random().toString(16).substring(2,6).toUpperCase()}static _getStyle(t){const e={};switch(t){case"Point":case"MultiPoint":e.Point=new Gi({text:new zi({font:pm.option.Point.Font,text:"",offsetX:pm.option.Point.FontoffsetX,offsetY:pm.option.Point.FontoffsetY,fill:new Tn({color:pm.option.Point.FontColor}),stroke:new kn({color:pm.option.Point.FontStrokeColor,width:pm.option.Point.FontStrokeWidth})}),image:new ki({scale:pm.option.Point.scale,radius:pm.option.Point.radius,fill:new Tn({color:pm.option.Point.fillcolor}),stroke:new kn({color:pm.option.Point.strokecolor,width:pm.option.Point.strokewidth})})});break;case"LineString":case"MultiLineString":e.LineString=new Gi({stroke:new kn({color:pm.option.LineString.strokecolor,width:pm.option.LineString.strokewidth}),text:new zi({text:"",font:pm.option.LineString.Font,fill:new Tn({color:pm.option.LineString.FontColor}),stroke:new kn({color:pm.option.LineString.FontStrokeColor,width:pm.option.LineString.FontStrokeWidth})})});break;case"Polygon":case"MultiPolygon":e.Polygon=new Gi({stroke:new kn({color:pm.option.Polygon.strokecolor,width:pm.option.Polygon.strokewidth}),fill:new Tn({color:pm.option.Polygon.fillcolor}),text:new zi({text:"",font:pm.option.Polygon.Font,fill:new Tn({color:pm.option.Polygon.FontColor}),stroke:new kn({color:pm.option.Polygon.FontStrokeColor,width:pm.option.Polygon.FontStrokeWidth})})})}return e[t]}static setHighlightStyle(t){const e=t.getGeometry().getType();let r=pm.getStyle(e,{radius:8,strokewidth:2,strokecolor:"rgba(0, 255, 0,1)"});try{t.get("name")&&r.getText()&&r.getText().setText(t.get("name"))}catch(UW){}return r}static getFeaturesDefaultStyle(t,e,r){let n,i,o,s=t.getProperties(),a={};switch(t.getGeometry().getType()){case"Point":case"MultiPoint":i=pm.getDefaultPointStyle(),a.fillcolor=""!==s.style.fillcolor?s.style.fillcolor:i.fillcolor,a.strokecolor=""!==s.style.strokecolor?s.style.strokecolor:i.strokecolor,a.strokewidth=""!==s.style.strokewidth?s.style.strokewidth:i.strokewidth,a.radius=""!==s.style.radius?s.style.radius/2:i.radius,s.style.src&&""!==s.style.src&&(a.imageOption={src:s.style.src});break;case"LineString":case"MultiLineString":n=pm.getDefaulLineStyle(),a=Object.assign({},n,s.style);break;case"Polygon":case"MultiPolygon":o=pm.getDefaultPolygonStyle(),a.fillcolor=""!==s.style.fillcolor?s.style.fillcolor:o.fillcolor,a.strokecolor=""!==s.style.strokecolor?s.style.strokecolor:o.strokecolor,a.strokewidth=""!==s.style.strokewidth?s.style.strokewidth:o.strokewidth}t.set("style",a)}};let dm=pm;r(dm,"option"),r(dm,"StylesList"),r(dm,"stroke",new kn({color:"black",width:2})),r(dm,"fill",new Tn({color:"red"})),r(dm,"image",new ki({radius:5,stroke:new kn({color:"red",width:1})}));var gm=6371008.8,ym={centimeters:100*gm,centimetres:100*gm,degrees:gm/111325,feet:3.28084*gm,inches:39.37*gm,kilometers:gm/1e3,kilometres:gm/1e3,meters:gm,metres:gm,miles:gm/1609.344,millimeters:1e3*gm,millimetres:1e3*gm,nauticalmiles:gm/1852,radians:1,yards:1.0936*gm},mm={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/gm,yards:1.0936133},vm={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 _m(t,e,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function wm(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!km(t[0])||!km(t[1]))throw new Error("coordinates must contain numbers");return _m({type:"Point",coordinates:t},e,r)}function bm(t,e,r){void 0===r&&(r={});for(var n=0,i=t;n<i.length;n++){var o=i[n];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return _m({type:"Polygon",coordinates:t},e,r)}function xm(t,e,r){if(void 0===r&&(r={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return _m({type:"LineString",coordinates:t},e,r)}function Cm(t,e){void 0===e&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function Em(t,e,r){return void 0===r&&(r={}),_m({type:"MultiLineString",coordinates:t},e,r)}function Sm(t,e,r){return void 0===r&&(r={}),_m({type:"MultiPoint",coordinates:t},e,r)}function Bm(t,e,r){return void 0===r&&(r={}),_m({type:"MultiPolygon",coordinates:t},e,r)}function Im(t,e,r){return void 0===r&&(r={}),_m({type:"GeometryCollection",geometries:t},e,r)}function Tm(t,e){void 0===e&&(e="kilometers");var r=ym[e];if(!r)throw new Error(e+" units is invalid");return t*r}function Pm(t,e){void 0===e&&(e="kilometers");var r=ym[e];if(!r)throw new Error(e+" units is invalid");return t/r}function Fm(t,e){return Lm(Pm(t,e))}function Lm(t){return t%(2*Math.PI)*180/Math.PI}function Mm(t){return t%360*Math.PI/180}function Om(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return Tm(Pm(t,e),r)}function km(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function Nm(t){return!!t&&t.constructor===Object}const Rm=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:vm,bearingToAzimuth:function(t){var e=t%360;return e<0&&(e+=360),e},convertArea:function(t,e,r){if(void 0===e&&(e="meters"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("area must be a positive number");var n=vm[e];if(!n)throw new Error("invalid original units");var i=vm[r];if(!i)throw new Error("invalid final units");return t/n*i},convertLength:Om,degreesToRadians:Mm,earthRadius:gm,factors:ym,feature:_m,featureCollection:Cm,geometry:function(t,e,r){switch(t){case"Point":return wm(e).geometry;case"LineString":return xm(e).geometry;case"Polygon":return bm(e).geometry;case"MultiPoint":return Sm(e).geometry;case"MultiLineString":return Em(e).geometry;case"MultiPolygon":return Bm(e).geometry;default:throw new Error(t+" is invalid")}},geometryCollection:Im,isNumber:km,isObject:Nm,lengthToDegrees:Fm,lengthToRadians:Pm,lineString:xm,lineStrings:function(t,e,r){return void 0===r&&(r={}),Cm(t.map((function(t){return xm(t,e)})),r)},multiLineString:Em,multiPoint:Sm,multiPolygon:Bm,point:wm,points:function(t,e,r){return void 0===r&&(r={}),Cm(t.map((function(t){return wm(t,e)})),r)},polygon:bm,polygons:function(t,e,r){return void 0===r&&(r={}),Cm(t.map((function(t){return bm(t,e)})),r)},radiansToDegrees:Lm,radiansToLength:Tm,round:function(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r},unitsFactors:mm,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(!km(t))throw new Error("bbox must only contain numbers")}))},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")}},Symbol.toStringTag,{value:"Module"}));function Um(t,e,r){if(null!==t)for(var n,i,o,s,a,l,u,h,c=0,A=0,f=t.type,p="FeatureCollection"===f,d="Feature"===f,g=p?t.features.length:1,y=0;y<g;y++){a=(h=!!(u=p?t.features[y].geometry:d?t.geometry:t)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var m=0;m<a;m++){var v=0,_=0;if(null!==(s=h?u.geometries[m]:u)){l=s.coordinates;var w=s.type;switch(c=!r||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":if(!1===e(l,A,y,v,_))return!1;A++,v++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===e(l[n],A,y,v,_))return!1;A++,"MultiPoint"===w&&v++}"LineString"===w&&v++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(i=0;i<l[n].length-c;i++){if(!1===e(l[n][i],A,y,v,_))return!1;A++}"MultiLineString"===w&&v++,"Polygon"===w&&_++}"Polygon"===w&&v++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(_=0,i=0;i<l[n].length;i++){for(o=0;o<l[n][i].length-c;o++){if(!1===e(l[n][i][o],A,y,v,_))return!1;A++}_++}v++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(!1===Um(s.geometries[n],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Dm(t,e){var r;switch(t.type){case"FeatureCollection":for(r=0;r<t.features.length&&!1!==e(t.features[r].properties,r);r++);break;case"Feature":e(t.properties,0)}}function Qm(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var r=0;r<t.features.length&&!1!==e(t.features[r],r);r++);}function Gm(t,e,r){var n=r;return Qm(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n}function jm(t){var e=[];return Um(t,(function(t){e.push(t)})),e}function Hm(t,e){var r,n,i,o,s,a,l,u,h,c,A=0,f="FeatureCollection"===t.type,p="Feature"===t.type,d=f?t.features.length:1;for(r=0;r<d;r++){for(a=f?t.features[r].geometry:p?t.geometry:t,u=f?t.features[r].properties:p?t.properties:{},h=f?t.features[r].bbox:p?t.bbox:void 0,c=f?t.features[r].id:p?t.id:void 0,s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=l?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,A,u,h,c))return!1;break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===e(o.geometries[n],A,u,h,c))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,A,u,h,c))return!1;A++}}function zm(t,e,r){var n=r;return Hm(t,(function(t,i,o,s,a){n=0===i&&void 0===r?t:e(n,t,i,o,s,a)})),n}function Vm(t,e){Hm(t,(function(t,r,n,i,o){var s,a=null===t?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==e(_m(t,n,{bbox:i,id:o}),r,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var l=0;l<t.coordinates.length;l++){var u=t.coordinates[l];if(!1===e(_m({type:s,coordinates:u},n),r,l))return!1}}))}function Km(t,e){Vm(t,(function(t,r,n){var i=0;if(t.geometry){var o=t.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var s,a=0,l=0,u=0;return!1!==Um(t,(function(o,h,c,A,f){if(void 0===s||r>a||A>l||f>u)return s=o,a=r,l=A,u=f,void(i=0);var p=xm([s,o],t.properties);if(!1===e(p,r,n,f,i))return!1;i++,s=o}))&&void 0}}}))}function qm(t,e,r){var n=r,i=!1;return Km(t,(function(t,o,s,a,l){n=!1===i&&void 0===r?t:e(n,t,o,s,a,l),i=!0})),n}function Wm(t,e){if(!t)throw new Error("geojson is required");Vm(t,(function(t,r,n){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,r,n,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===e(xm(o[s],t.properties),r,n,s))return!1}}}))}function Xm(t,e,r){var n=r;return Wm(t,(function(t,i,o,s){n=0===i&&void 0===r?t:e(n,t,i,o,s)})),n}const Ym=Object.freeze(Object.defineProperty({__proto__:null,coordAll:jm,coordEach:Um,coordReduce:function(t,e,r,n){var i=r;return Um(t,(function(t,n,o,s,a){i=0===n&&void 0===r?t:e(i,t,n,o,s,a)}),n),i},featureEach:Qm,featureReduce:Gm,findPoint:function(t,e){if(!Nm(e=e||{}))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),a=a||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":a=a||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var l=r.coordinates;switch(r.type){case"Point":return wm(l,a,e);case"MultiPoint":return i<0&&(i=l.length+i),wm(l[i],a,e);case"LineString":return s<0&&(s=l.length+s),wm(l[s],a,e);case"Polygon":return o<0&&(o=l.length+o),s<0&&(s=l[o].length+s),wm(l[o][s],a,e);case"MultiLineString":return i<0&&(i=l.length+i),s<0&&(s=l[i].length+s),wm(l[i][s],a,e);case"MultiPolygon":return i<0&&(i=l.length+i),o<0&&(o=l[i].length+o),s<0&&(s=l[i][o].length-s),wm(l[i][o][s],a,e)}throw new Error("geojson is invalid")},findSegment:function(t,e){if(!Nm(e=e||{}))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),a=a||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":a=a||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var l=r.coordinates;switch(r.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=l.length+s-1),xm([l[s],l[s+1]],a,e);case"Polygon":return o<0&&(o=l.length+o),s<0&&(s=l[o].length+s-1),xm([l[o][s],l[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=l.length+i),s<0&&(s=l[i].length+s-1),xm([l[i][s],l[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=l.length+i),o<0&&(o=l[i].length+o),s<0&&(s=l[i][o].length-s-1),xm([l[i][o][s],l[i][o][s+1]],a,e)}throw new Error("geojson is invalid")},flattenEach:Vm,flattenReduce:function(t,e,r){var n=r;return Vm(t,(function(t,i,o){n=0===i&&0===o&&void 0===r?t:e(n,t,i,o)})),n},geomEach:Hm,geomReduce:zm,lineEach:Wm,lineReduce:Xm,propEach:Dm,propReduce:function(t,e,r){var n=r;return Dm(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n},segmentEach:Km,segmentReduce:qm},Symbol.toStringTag,{value:"Module"}));function Zm(t){var e=[1/0,1/0,-1/0,-1/0];return Um(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}Zm.default=Zm;const Jm=Object.freeze(Object.defineProperty({__proto__:null,default:Zm},Symbol.toStringTag,{value:"Module"}));function $m(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 tv(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 ev(t,e,r){if(!t)throw new Error("No featureCollection passed");if(!r)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+r+", FeatureCollection required");for(var n=0,i=t.features;n<i.length;n++){var o=i[n];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+o.geometry.type)}}function rv(t){return"Feature"===t.type?t.geometry:t}function nv(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}
20
+ e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,l=(1<<a)-1,u=l>>1,h=-7,c=r?i-1:0,A=r?-1:1,f=t[e+c];for(c+=A,o=f&(1<<-h)-1,f>>=-h,h+=a;h>0;o=256*o+t[e+c],c+=A,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+c],c+=A,h-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),o-=u}return(f?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,l,u=8*o-i-1,h=(1<<u)-1,c=h>>1,A=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+c>=1?A/l:A*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(e*l-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[r+f]=255&s,f+=p,s/=256,u-=8);t[r+f-p]|=128*d}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){(function(t){var n=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,n,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,n,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(n,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(11),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(1))},function(t,e,r){(function(t,e){!function(t,r){if(!t.setImmediate){var n,i,o,s,a,l=1,u={},h=!1,c=t.document,A=Object.getPrototypeOf&&Object.getPrototypeOf(t);A=A&&A.setTimeout?A:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick((function(){p(t)}))}:function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&p(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),n=function(e){t.postMessage(s+e,"*")}):t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){p(t.data)},n=function(t){o.port2.postMessage(t)}):c&&"onreadystatechange"in c.createElement("script")?(i=c.documentElement,n=function(t){var e=c.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):n=function(t){setTimeout(p,0,t)},A.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r<e.length;r++)e[r]=arguments[r+1];var i={callback:t,args:e};return u[l]=i,n(l),l++},A.clearImmediate=f}function f(t){delete u[t]}function p(t){if(h)setTimeout(p,0,t);else{var e=u[t];if(e){h=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(r,n)}}(e)}finally{f(t),h=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,r(1),r(3))},function(t,e){function r(t){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}r.keys=function(){return[]},r.resolve=r,t.exports=r,r.id=12},function(t,e,r){function n(t){this.options=t||{locator:{}}}function i(){this.cdata=!1}function o(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function s(t,e,r){return"string"==typeof t?t.substr(e,r):t.length>=e+r||e?new java.lang.String(t,e,r)+"":t}function a(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}n.prototype.parseFromString=function(t,e){var r=this.options,n=new h,o=r.domBuilder||new i,s=r.errorHandler,a=r.locator,u=r.xmlns||{},c=/\/x?html?$/.test(e),A=c?l.entityMap:{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return a&&o.setDocumentLocator(a),n.errorHandler=function(t,e,r){if(!t){if(e instanceof i)return e;t=e}var n={},o=t instanceof Function;function s(e){var i=t[e];!i&&o&&(i=2==t.length?function(r){t(e,r)}:t),n[e]=i&&function(t){i("[xmldom "+e+"]\t"+t+function(t){if(t)return"\n@"+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}(r))}||function(){}}return r=r||{},s("warning"),s("error"),s("fatalError"),n}(s,o,a),n.domBuilder=r.domBuilder||o,c&&(u[""]="http://www.w3.org/1999/xhtml"),u.xml=u.xml||"http://www.w3.org/XML/1998/namespace",t&&"string"==typeof t?n.parse(t,u,A):n.errorHandler.error("invalid doc source"),o.doc},i.prototype={startDocument:function(){this.doc=(new A).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,r,n){var i=this.doc,s=i.createElementNS(t,r||e),l=n.length;a(this,s),this.currentElement=s,this.locator&&o(this.locator,s);for(var u=0;u<l;u++){t=n.getURI(u);var h=n.getValue(u),c=(r=n.getQName(u),i.createAttributeNS(t,r));this.locator&&o(n.getLocator(u),c),c.value=c.nodeValue=h,s.setAttributeNode(c)}},endElement:function(t,e,r){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var r=this.doc.createProcessingInstruction(t,e);this.locator&&o(this.locator,r),a(this,r)},ignorableWhitespace:function(t,e,r){},characters:function(t,e,r){if(t=s.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(t);else n=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(t)&&this.doc.appendChild(n),this.locator&&o(this.locator,n)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){(this.locator=t)&&(t.lineNumber=0)},comment:function(t,e,r){t=s.apply(this,arguments);var n=this.doc.createComment(t);this.locator&&o(this.locator,n),a(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,r){var n=this.doc.implementation;if(n&&n.createDocumentType){var i=n.createDocumentType(t,e,r);this.locator&&o(this.locator,i),a(this,i)}},warning:function(t){},error:function(t){},fatalError:function(t){throw new c(t,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(t){i.prototype[t]=function(){return null}}));var l=r(14),u=r(15),h=u.XMLReader,c=u.ParseError,A=e.DOMImplementation=r(4).DOMImplementation;e.XMLSerializer=r(4).XMLSerializer,e.DOMParser=n,e.__DOMHandler=i},function(t,e){e.entityMap={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}},function(t,e){var r=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,n=new RegExp("[\\-\\.0-9"+r.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+r.source+n.source+"*(?::"+r.source+n.source+"*)?$"),o=0,s=1,a=2,l=3,u=4,h=5,c=6,A=7;function f(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,f)}function p(){}function d(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function g(t,e,r,n,i,f){function p(t,e,n){t in r.attributeNames&&f.fatalError("Attribute "+t+" redefined"),r.addValue(t,e,n)}for(var d,g=++e,y=o;;){var m=t.charAt(g);switch(m){case"=":if(y===s)d=t.slice(e,g),y=l;else{if(y!==a)throw new Error("attribute equal must after attrName");y=l}break;case"'":case'"':if(y===l||y===s){if(y===s&&(f.warning('attribute value must after "="'),d=t.slice(e,g)),e=g+1,!((g=t.indexOf(m,e))>0))throw new Error("attribute value no end '"+m+"' match");p(d,v=t.slice(e,g).replace(/&#?\w+;/g,i),e-1),y=h}else{if(y!=u)throw new Error('attribute value must after "="');p(d,v=t.slice(e,g).replace(/&#?\w+;/g,i),e),f.warning('attribute "'+d+'" missed start quot('+m+")!!"),e=g+1,y=h}break;case"/":switch(y){case o:r.setTagName(t.slice(e,g));case h:case c:case A:y=A,r.closed=!0;case u:case s:case a:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return f.error("unexpected end of input"),y==o&&r.setTagName(t.slice(e,g)),g;case">":switch(y){case o:r.setTagName(t.slice(e,g));case h:case c:case A:break;case u:case s:"/"===(v=t.slice(e,g)).slice(-1)&&(r.closed=!0,v=v.slice(0,-1));case a:y===a&&(v=d),y==u?(f.warning('attribute "'+v+'" missed quot(")!'),p(d,v.replace(/&#?\w+;/g,i),e)):("http://www.w3.org/1999/xhtml"===n[""]&&v.match(/^(?:disabled|checked|selected)$/i)||f.warning('attribute "'+v+'" missed value!! "'+v+'" instead!!'),p(v,v,e));break;case l:throw new Error("attribute value missed!!")}return g;case"€":m=" ";default:if(m<=" ")switch(y){case o:r.setTagName(t.slice(e,g)),y=c;break;case s:d=t.slice(e,g),y=a;break;case u:var v=t.slice(e,g).replace(/&#?\w+;/g,i);f.warning('attribute "'+v+'" missed quot(")!!'),p(d,v,e);case h:y=c}else switch(y){case a:r.tagName,"http://www.w3.org/1999/xhtml"===n[""]&&d.match(/^(?:disabled|checked|selected)$/i)||f.warning('attribute "'+d+'" missed value!! "'+d+'" instead2!!'),p(d,d,e),e=g,y=s;break;case h:f.warning('attribute space is required"'+d+'"!!');case c:y=s,e=g;break;case l:y=u,e=g;break;case A:throw new Error("elements closed character '/' and '>' must be connected to")}}g++}}function y(t,e,r){for(var n=t.tagName,i=null,o=t.length;o--;){var s=t[o],a=s.qName,l=s.value;if((A=a.indexOf(":"))>0)var u=s.prefix=a.slice(0,A),h=a.slice(A+1),c="xmlns"===u&&h;else h=a,u=null,c="xmlns"===a&&"";s.localName=h,!1!==c&&(null==i&&(i={},_(r,r={})),r[c]=i[c]=l,s.uri="http://www.w3.org/2000/xmlns/",e.startPrefixMapping(c,l))}for(o=t.length;o--;)(u=(s=t[o]).prefix)&&("xml"===u&&(s.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==u&&(s.uri=r[u||""]));var A;(A=n.indexOf(":"))>0?(u=t.prefix=n.slice(0,A),h=t.localName=n.slice(A+1)):(u=null,h=t.localName=n);var f=t.uri=r[u||""];if(e.startElement(f,h,n,t),!t.closed)return t.currentNSMap=r,t.localNSMap=i,!0;if(e.endElement(f,h,n),i)for(u in i)e.endPrefixMapping(u)}function m(t,e,r,n,i){if(/^(?:script|textarea)$/i.test(r)){var o=t.indexOf("</"+r+">",e),s=t.substring(e+1,o);if(/[&<]/.test(s))return/^script$/i.test(r)?(i.characters(s,0,s.length),o):(s=s.replace(/&#?\w+;/g,n),i.characters(s,0,s.length),o)}return e+1}function v(t,e,r,n){var i=n[r];return null==i&&((i=t.lastIndexOf("</"+r+">"))<e&&(i=t.lastIndexOf("</"+r)),n[r]=i),i<e}function _(t,e){for(var r in t)e[r]=t[r]}function w(t,e,r,n){if("-"===t.charAt(e+2))return"-"===t.charAt(e+3)?(i=t.indexOf("--\x3e",e+4))>e?(r.comment(t,e+4,i-e-4),i+3):(n.error("Unclosed comment"),-1):-1;if("CDATA["==t.substr(e+3,6)){var i=t.indexOf("]]>",e+9);return r.startCDATA(),r.characters(t,e+9,i-e-9),r.endCDATA(),i+3}var o=function(t,e){var r,n=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=e,i.exec(t);r=i.exec(t);)if(n.push(r),r[1])return n}(t,e),s=o.length;if(s>1&&/!doctype/i.test(o[0][0])){var a=o[1][0],l=!1,u=!1;s>3&&(/^public$/i.test(o[2][0])?(l=o[3][0],u=s>4&&o[4][0]):/^system$/i.test(o[2][0])&&(u=o[3][0]));var h=o[s-1];return r.startDTD(a,l,u),r.endDTD(),h.index+h[0].length}return-1}function b(t,e,r){var n=t.indexOf("?>",e);if(n){var i=t.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return i?(i[0].length,r.processingInstruction(i[1],i[2]),n+2):-1}return-1}function x(){this.attributeNames={}}f.prototype=new Error,f.prototype.name=f.name,p.prototype={parse:function(t,e,r){var n=this.domBuilder;n.startDocument(),_(e,e={}),function(t,e,r,n,i){function o(t){var e=t.slice(1,-1);return e in r?r[e]:"#"===e.charAt(0)?function(t){if(t>65535){var e=55296+((t-=65536)>>10),r=56320+(1023&t);return String.fromCharCode(e,r)}return String.fromCharCode(t)}(parseInt(e.substr(1).replace("x","0x"))):(i.error("entity not found:"+t),t)}function s(e){if(e>_){var r=t.substring(_,e).replace(/&#?\w+;/g,o);c&&a(_),n.characters(r,0,e-_),_=e}}function a(e,r){for(;e>=u&&(r=h.exec(t));)l=r.index,u=l+r[0].length,c.lineNumber++;c.columnNumber=e-l+1}for(var l=0,u=0,h=/.*(?:\r\n?|\n)|.*$/g,c=n.locator,A=[{currentNSMap:e}],p={},_=0;;){try{var C=t.indexOf("<",_);if(C<0){if(!t.substr(_).match(/^\s*$/)){var E=n.doc,S=E.createTextNode(t.substr(_));E.appendChild(S),n.currentElement=S}return}switch(C>_&&s(C),t.charAt(C+1)){case"/":var B=t.indexOf(">",C+3),I=t.substring(C+2,B),T=A.pop();B<0?(I=t.substring(C+2).replace(/[\s<].*/,""),i.error("end tag name: "+I+" is not complete:"+T.tagName),B=C+1+I.length):I.match(/\s</)&&(I=I.replace(/[\s<].*/,""),i.error("end tag name: "+I+" maybe not complete"),B=C+1+I.length);var P=T.localNSMap,F=T.tagName==I;if(F||T.tagName&&T.tagName.toLowerCase()==I.toLowerCase()){if(n.endElement(T.uri,T.localName,I),P)for(var L in P)n.endPrefixMapping(L);F||i.fatalError("end tag name: "+I+" is not match the current start tagName:"+T.tagName)}else A.push(T);B++;break;case"?":c&&a(C),B=b(t,C,n);break;case"!":c&&a(C),B=w(t,C,n,i);break;default:c&&a(C);var M=new x,O=A[A.length-1].currentNSMap,k=(B=g(t,C,M,O,o,i),M.length);if(!M.closed&&v(t,B,M.tagName,p)&&(M.closed=!0,r.nbsp||i.warning("unclosed xml attribute")),c&&k){for(var N=d(c,{}),R=0;R<k;R++){var U=M[R];a(U.offset),U.locator=d(c,{})}n.locator=N,y(M,n,O)&&A.push(M),n.locator=c}else y(M,n,O)&&A.push(M);"http://www.w3.org/1999/xhtml"!==M.uri||M.closed?B++:B=m(t,B,M.tagName,o,n)}}catch(UW){if(UW instanceof f)throw UW;i.error("element parse error: "+UW),B=-1}B>_?_=B:s(Math.max(C,_)+1)}}(t,e,r,n,this.errorHandler),n.endDocument()}},x.prototype={setTagName:function(t){if(!i.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,r){if(!i.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:r}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},e.XMLReader=p,e.ParseError=f},function(t,e,r){r.r(e),r.d(e,"toKml",(function(){return A})),r.d(e,"toGeoJSON",(function(){return g}));var n=r(5),i=r(0);function o(t,e){return function(r){if(!r.properties||!s.valid(r.geometry))return"";var n=s.any(r.geometry);if(!n)return"";var i="",o="";if(t.simplestyle){var a=function(t){var e="";return t["marker-symbol"]&&(e=e+"ms"+t["marker-symbol"]),t["marker-color"]&&(e=e+"mc"+t["marker-color"].replace("#","")),t["marker-size"]&&(e=e+"ms"+t["marker-size"]),t.stroke&&(e=e+"s"+t.stroke.replace("#","")),t["stroke-width"]&&(e=e+"sw"+t["stroke-width"].toString().replace(".","")),t["stroke-opacity"]&&(e=e+"mo"+t["stroke-opacity"].toString().replace(".","")),t.fill&&(e=e+"f"+t.fill.replace("#","")),t["fill-opacity"]&&(e=e+"fo"+t["fill-opacity"].toString().replace(".","")),e}(r.properties);a&&(s.isPoint(r.geometry)&&function(t){return!!(t["marker-size"]||t["marker-symbol"]||t["marker-color"])}(r.properties)?(-1===e.indexOf(a)&&(i=function(t,e){return c("Style",c("IconStyle",c("Icon",c("href",function(t){return t["marker-symbol"]}(t))))+c("hotSpot","",[["xunits","fraction"],["yunits","fraction"],["x",.5],["y",.5]]),[["id",e]])}(r.properties,a),e.push(a)),o=c("styleUrl","#"+a)):(s.isPolygon(r.geometry)||s.isLine(r.geometry))&&function(t){for(var e in t)if({stroke:!0,"stroke-opacity":!0,"stroke-width":!0,fill:!0,"fill-opacity":!0}[e])return!0}(r.properties)&&(-1===e.indexOf(a)&&(i=function(t,e){var r=c("LineStyle",[c("color",l(t.stroke,t["stroke-opacity"])||"ff555555")+c("width",void 0===t["stroke-width"]?2:t["stroke-width"])]),n="";return(t.fill||t["fill-opacity"])&&(n=c("PolyStyle",[c("color",l(t.fill,t["fill-opacity"])||"88555555")])),c("Style",r+n,[["id",e]])}(r.properties,a),e.push(a)),o=c("styleUrl","#"+a)))}return i+c("Placemark",function(t,e){return t[e.name]?c("name",u(t[e.name])):""}(r.properties,t)+function(t,e){return t[e.description]?c("description",u(t[e.description])):""}(r.properties,t)+function(t){var e,r=[];for(var n in t){var i=t[n];e=i,"[object Object]"===Object.prototype.toString.call(e)?r.push('<Data name ="'.concat(n,'"><value>').concat(JSON.stringify(i),"</value></Data>")):r.push('<Data name ="'.concat(n,'"><value>').concat(i,"</value></Data>"))}return c("ExtendedData",r.join(""))}(r.properties)+function(t,e){return t[e.timestamp]?c("TimeStamp",c("when",u(t[e.timestamp]))):""}(r.properties,t)+n+o)}}var s={Point:function(t){return c("Point",c("coordinates",t.coordinates.join(",")))},LineString:function(t){return c("LineString",c("coordinates",a(t.coordinates)))},Polygon:function(t){if(!t.coordinates.length)return"";var e=t.coordinates[0],r=t.coordinates.slice(1),n=c("outerBoundaryIs",c("LinearRing",c("coordinates",a(e)))),i=r.map((function(t){return c("innerBoundaryIs",c("LinearRing",c("coordinates",a(t))))})).join("");return c("Polygon",n+i)},MultiPoint:function(t){return t.coordinates.length?c("MultiGeometry",t.coordinates.map((function(t){return s.Point({coordinates:t})})).join("")):""},MultiPolygon:function(t){return t.coordinates.length?c("MultiGeometry",t.coordinates.map((function(t){return s.Polygon({coordinates:t})})).join("")):""},MultiLineString:function(t){return t.coordinates.length?c("MultiGeometry",t.coordinates.map((function(t){return s.LineString({coordinates:t})})).join("")):""},GeometryCollection:function(t){return c("MultiGeometry",t.geometries.map(s.any).join(""))},valid:function(t){return t&&t.type&&(t.coordinates||"GeometryCollection"===t.type&&t.geometries&&t.geometries.every(s.valid))},any:function(t){return s[t.type]?s[t.type](t):""},isPoint:function(t){return"Point"===t.type||"MultiPoint"===t.type},isPolygon:function(t){return"Polygon"===t.type||"MultiPolygon"===t.type},isLine:function(t){return"LineString"===t.type||"MultiLineString"===t.type}};function a(t){return t.map((function(t){return t.join(",")})).join(" ")}function l(t,e){if("string"!=typeof t)return"";if(3===(t=t.replace("#","").toLowerCase()).length)t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2];else if(6!==t.length)return"";var r=t[0]+t[1],n=t[2]+t[3],i=t[4]+t[5],o="ff";return"number"==typeof e&&e>=0&&e<=1&&((o=(255*e).toString(16)).indexOf(".")>-1&&(o=o.substr(0,o.indexOf("."))),o.length<2&&(o="0"+o)),o+i+n+r}function u(t){return t?t.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):""}var h={">":"&gt;","<":"&lt;","'":"&apos;",'"':"&quot;","&":"&amp;"};function c(t,e,r){return(Array.isArray(e)||"string"==typeof e)&&(r=e,e={}),Array.isArray(r)&&(r="\n"+r.map((function(t){return" "+t})).join("\n")+"\n"),"<"+t+function(t){return Object.keys(t).length?" "+Object.keys(t).map((function(e){return e+'="'+function(t,e){var r;if(null!=t)return e=(e||"").replace(/[^&"<>\']/g,""),r="([&\"<>'])".replace(new RegExp("["+e+"]","g"),""),t.replace(new RegExp(r,"g"),(function(t,e){return h[e]}))}(t[e])+'"'})).join(" "):""}(e)+">"+r+"</"+t+">"}function A(t,e){return t.features&&t.features.forEach((function(t){if(t.properties){var e=t.properties.style;if(e){if(e.image)return t.properties["marker-symbol"]=e.image,void(e.outlineColor&&(t.properties["marker-color"]=e.outlineColor));var r,n,i;e.color&&(t.properties.fill=e.color,e.opacity&&(t.properties["fill-opacity"]=e.opacity)),e.outlineColor&&(t.properties.stroke=e.outlineColor,t.properties["stroke-width"]=null!==(r=e.outlineWidth)&&void 0!==r?r:1,t.properties["stroke-opacity"]=null!==(n=null!==(i=e.outlineOpacity)&&void 0!==i?i:e.opacity)&&void 0!==n?n:1)}}})),function(t,e){return'<?xml version="1.0" encoding="UTF-8"?>'+c("kml",c("Document",function(t){return void 0!==t.documentName?c("name",t.documentName):""}(e=e||{documentName:void 0,documentDescription:void 0,name:"name",description:"description",simplestyle:!1,timestamp:"timestamp"})+function(t){return void 0!==t.documentDescription?c("description",t.documentDescription):""}(e)+function(t,e){if(!t.type)return"";var r=[];switch(t.type){case"FeatureCollection":return t.features?t.features.map(o(e,r)).join(""):"";case"Feature":return o(e,r)(t);default:return o(e,r)({type:"Feature",geometry:t,properties:{}})}}(t,e)),[["xmlns","http://www.opengis.net/kml/2.2"]])}(t,e)}var f=function(t){return(new DOMParser).parseFromString(t,"text/xml")},p=function(t){return t.split(".").pop()},d=function(t){return(new n).loadAsync(t).then((function(t){var e=null;return t.forEach((function(t,r){"kml"===p(t)&&null===e&&(e=r.async("string").then(f))})),e||Promise.reject("No kml file found")}))};function g(t){if(!t)return Promise.reject("参数不能为空");if("string"==typeof(o=t)&&o.constructor==String){var e=p(t);if("kml"===e)return Cesium.Resource.fetchXML(t).then((function(t){return Object(i.a)(t)}));if("kmz"===e)return Cesium.Resource.fetchBlob(t).then((function(t){return d(t)})).then((function(t){return Object(i.a)(t)}));var r=Object(i.a)(f(t));return Promise.resolve(r)}if(t.getRootNode){var n=Object(i.a)(t);return Promise.resolve(n)}return d(t).then((function(t){return Object(i.a)(t)}));var o}}])},am.exports=um(),window.ol&&!ol.ext&&(ol.ext={});var cm=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t};window.ol&&(ol.inherits||(ol.inherits=cm)),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),window.Element&&!Element.prototype.remove&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)});var Am=function(t){var e;t||(t={});var r=this.canvas_=document.createElement("canvas"),n=(Number(t.scale)>0?Number(t.scale):1)*at||at,i=r.getContext("2d");if(t.image){var o;t.image.load();var s=t.image.getImage();if(s.width)r.width=Math.round(s.width*n),r.height=Math.round(s.height*n),i.globalAlpha="number"==typeof t.opacity?t.opacity:1,i.drawImage(s,0,0,s.width,s.height,0,0,r.width,r.height),e=i.createPattern(r,"repeat");else{var a=this;e=[0,0,0,0],s.onload=function(){r.width=Math.round(s.width*n),r.height=Math.round(s.height*n),i.globalAlpha="number"==typeof t.opacity?t.opacity:1,i.drawImage(s,0,0,s.width,s.height,0,0,r.width,r.height),e=i.createPattern(r,"repeat"),a.setColor(e)}}}else{var l=this.getPattern_(t);if(r.width=Math.round(l.width*n),r.height=Math.round(l.height*n),i.beginPath(),t.fill&&(i.fillStyle=jn(t.fill.getColor()),i.fillRect(0,0,r.width,r.height)),i.scale(n,n),i.lineCap="round",i.lineWidth=l.stroke||1,i.fillStyle=jn(t.color||"#000"),i.strokeStyle=jn(t.color||"#000"),l.circles)for(o=0;o<l.circles.length;o++){var u=l.circles[o];i.beginPath(),i.arc(u[0],u[1],u[2],0,2*Math.PI),l.fill&&i.fill(),l.stroke&&i.stroke()}if(l.repeat||(l.repeat=[[0,0]]),l.char&&(i.font=l.font||l.width+"px Arial",i.textAlign="center",i.textBaseline="middle",l.angle?(i.fillText(l.char,l.width/4,l.height/4),i.fillText(l.char,5*l.width/4,5*l.height/4),i.fillText(l.char,l.width/4,5*l.height/4),i.fillText(l.char,5*l.width/4,l.height/4),i.fillText(l.char,3*l.width/4,3*l.height/4),i.fillText(l.char,-l.width/4,-l.height/4),i.fillText(l.char,3*l.width/4,-l.height/4),i.fillText(l.char,-l.width/4,3*l.height/4)):i.fillText(l.char,l.width/2,l.height/2)),l.lines)for(o=0;o<l.lines.length;o++)for(var h=0;h<l.repeat.length;h++){var c=l.lines[o];i.beginPath(),i.moveTo(c[0]+l.repeat[h][0],c[1]+l.repeat[h][1]);for(var A=2;A<c.length;A+=2)i.lineTo(c[A]+l.repeat[h][0],c[A+1]+l.repeat[h][1]);l.fill&&i.fill(),l.stroke&&i.stroke(),i.save(),i.strokeStyle="red",i.strokeWidth=.1,i.restore()}if(e=i.createPattern(r,"repeat"),t.offset){var f=t.offset;if("number"==typeof f&&(f=[f,f]),f instanceof Array){var p=Math.round(f[0]*n),d=Math.round(f[1]*n);i.scale(1/n,1/n),i.clearRect(0,0,r.width,r.height),i.translate(p,d),i.fillStyle=e,i.fillRect(-p,-d,r.width,r.height),e=i.createPattern(r,"repeat")}}}Tn.call(this,{color:e})};cm(Am,Tn),Am.prototype.clone=function(){var t=Tn.prototype.clone.call(this);return t.canvas_=this.canvas_,t},Am.prototype.getImage=function(){return this.canvas_},Am.prototype.getPattern_=function(t){var e,r=Am.prototype.patterns[t.pattern]||Am.prototype.patterns.dot,n=Math.round(t.spacing)||10;switch(t.pattern){case"dot":case"circle":e=0===t.size?0:t.size/2||2,t.angle?(n=r.width=r.height=Math.round(1.4*n),r.circles=[[n/4,n/4,e],[3*n/4,3*n/4,e]],"circle"==t.pattern&&(r.circles=r.circles.concat([[n/4+n,n/4,e],[n/4,n/4+n,e],[3*n/4-n,3*n/4,e],[3*n/4,3*n/4-n,e],[n/4+n,n/4+n,e],[3*n/4-n,3*n/4-n,e]]))):(r.width=r.height=n,r.circles=[[n/2,n/2,e]],"circle"==t.pattern&&(r.circles=r.circles.concat([[n/2+n,n/2,e],[n/2-n,n/2,e],[n/2,n/2+n,e],[n/2,n/2-n,e],[n/2+n,n/2+n,e],[n/2+n,n/2-n,e],[n/2-n,n/2+n,e],[n/2-n,n/2-n,e]])));break;case"tile":case"square":e=0===t.size?0:t.size/2||2,t.angle?(r.width=r.height=n,r.lines=[[n/2-e,n/2,n/2,n/2-e,n/2+e,n/2,n/2,n/2+e,n/2-e,n/2]]):(r.width=r.height=n,r.lines=[[n/2-e,n/2-e,n/2+e,n/2-e,n/2+e,n/2+e,n/2-e,n/2+e,n/2-e,n/2-e]]),"square"==t.pattern&&(r.repeat=[[0,0],[0,n],[n,0],[0,-n],[-n,0],[-n,-n],[n,n],[-n,n],[n,-n]]);break;case"cross":t.angle&&(t.angle=45);case"hatch":var i=Math.round(((t.angle||0)-90)%360);i>180&&(i-=360),i*=Math.PI/180;var o=Math.cos(i),s=Math.sin(i);if(Math.abs(s)<1e-4)r.width=r.height=n,r.lines=[[0,.5,n,.5]],r.repeat=[[0,0],[0,n]];else if(Math.abs(o)<1e-4)r.width=r.height=n,r.lines=[[.5,0,.5,n]],r.repeat=[[0,0],[n,0]],"cross"==t.pattern&&(r.lines.push([0,.5,n,.5]),r.repeat.push([0,n]));else{var a=r.width=Math.round(Math.abs(n/s))||1,l=r.height=Math.round(Math.abs(n/o))||1;"cross"==t.pattern?(r.lines=[[-a,-l,2*a,2*l],[2*a,-l,-a,2*l]],r.repeat=[[0,0]]):o*s>0?(r.lines=[[-a,-l,2*a,2*l]],r.repeat=[[0,0],[a,0],[0,l]]):(r.lines=[[2*a,-l,-a,2*l]],r.repeat=[[0,0],[-a,0],[0,l]])}r.stroke=0===t.size?0:t.size||4}return r},Am.addPattern=function(t,e){e||(e={}),Am.prototype.patterns[t||e.char]={width:e.width||e.size||10,height:e.height||e.size||10,font:e.font,char:e.char,circles:e.circles,lines:e.lines,repeat:e.repeat,stroke:e.stroke,angle:e.angle,fill:e.fill}},Am.prototype.patterns={hatch:{width:5,height:5,lines:[[0,2.5,5,2.5]],stroke:1},cross:{width:7,height:7,lines:[[0,3,10,3],[3,0,3,10]],stroke:1},dot:{width:8,height:8,circles:[[5,5,2]],stroke:!1,fill:!0},circle:{width:10,height:10,circles:[[5,5,2]],stroke:1,fill:!1},square:{width:10,height:10,lines:[[3,3,3,8,8,8,8,3,3,3]],stroke:1,fill:!1},tile:{width:10,height:10,lines:[[3,3,3,8,8,8,8,3,3,3]],fill:!0},woven:{width:12,height:12,lines:[[3,3,9,9],[0,12,3,9],[9,3,12,0],[-1,1,1,-1],[13,11,11,13]],stroke:1},crosses:{width:8,height:8,lines:[[2,2,6,6],[2,6,6,2]],stroke:1},caps:{width:8,height:8,lines:[[2,6,4,2,6,6]],stroke:1},nylon:{width:20,height:20,lines:[[1,6,1,1,6,1],[6,11,11,11,11,6],[11,16,11,21,16,21],[16,11,21,11,21,16]],repeat:[[0,0],[-20,0],[0,-20]],stroke:1},hexagon:{width:20,height:12,lines:[[0,10,4,4,10,4,14,10,10,16,4,16,0,10]],stroke:1,repeat:[[0,0],[10,6],[10,-6],[-10,-6]]},cemetry:{width:15,height:19,lines:[[0,3.5,7,3.5],[3.5,0,3.5,10]],stroke:1,repeat:[[0,0],[7,9]]},sand:{width:20,height:20,circles:[[1,2,1],[9,3,1],[2,16,1],[7,8,1],[6,14,1],[4,19,1],[14,2,1],[12,10,1],[14,18,1],[18,8,1],[18,14,1]],fill:1},conglomerate:{width:60,height:40,circles:[[2,4,1],[17,3,1],[26,18,1],[12,17,1],[5,17,2],[28,11,2]],lines:[[7,5,6,7,9,9,11,8,11,6,9,5,7,5],[16,10,15,13,16,14,19,15,21,13,22,9,20,8,19,8,16,10],[24,6,26,7,27,5,26,4,24,4,24,6]],repeat:[[30,0],[-15,20],[15,20],[45,20]],stroke:1},conglomerate2:{width:60,height:40,circles:[[2,4,1],[17,3,1],[26,18,1],[12,17,1],[5,17,2],[28,11,2]],lines:[[7,5,6,7,9,9,11,8,11,6,9,5,7,5],[16,10,15,13,16,14,19,15,21,13,22,9,20,8,19,8,16,10],[24,6,26,7,27,5,26,4,24,4,24,6]],repeat:[[30,0],[-15,20],[15,20],[45,20]],fill:1},gravel:{width:15,height:10,circles:[[4,2,1],[5,9,1],[1,7,1]],lines:[[7,5,6,6,7,7,8,7,9,7,10,5,9,4,7,5],[11,2,14,4,14,1,12,1,11,2]],stroke:1},brick:{width:18,height:16,lines:[[0,1,18,1],[0,10,18,10],[6,1,6,10],[12,10,12,18],[12,0,12,1]],stroke:1},dolomite:{width:20,height:16,lines:[[0,1,20,1],[0,9,20,9],[1,9,6,1],[11,9,14,16],[14,0,14.4,1]],stroke:1},coal:{width:20,height:16,lines:[[1,5,7,1,7,7],[11,10,12,5,18,9],[5,10,2,15,9,15],[15,16,15,13,20,16],[15,0,15,2,20,0]],fill:1},breccia:{width:20,height:16,lines:[[1,5,7,1,7,7,1,5],[11,10,12,5,18,9,11,10],[5,10,2,15,9,15,5,10],[15,16,15,13,22,18],[15,0,15,2,20,0]],stroke:1},clay:{width:20,height:20,lines:[[0,0,3,11,0,20],[11,0,10,3,13,13,11,20],[0,0,10,3,20,0],[0,12,3,11,13,13,20,12]],stroke:1},flooded:{width:15,height:10,lines:[[0,1,10,1],[0,6,5,6],[10,6,15,6]],stroke:1},chaos:{width:40,height:40,lines:[[40,2,40,0,38,0,40,2],[4,0,3,2,2,5,0,0,0,3,2,7,5,6,7,7,8,10,9,12,9,13,9,14,8,14,6,15,2,15,0,20,0,22,2,20,5,19,8,15,10,14,11,12.25,10,12,10,10,12,9,13,7,12,6,13,4,16,7,17,4,20,0,18,0,15,3,14,2,14,0,12,1,11,0,10,1,11,4,10,7,9,8,8,5,6,4,5,3,5,1,5,0,4,0],[7,1,7,3,8,3,8,2,7,1],[4,3,5,5,4,5,4,3],[34,5,33,7,38,10,38,8,36,5,34,5],[27,0,23,2,21,8,30,0,27,0],[25,8,26,12,26,16,22.71875,15.375,20,13,18,15,17,18,13,22,17,21,19,22,21,20,19,18,22,17,30,25,26,26,24,28,21.75,33.34375,20,36,18,40,20,40,24,37,25,32,27,31,26,38,27,37,30,32,32,35,36,37,38,40,38,39,40,40,37,36,34,32,37,31,36,29,33,27,34,24,39,21,40,21,40,16,37,20,31,22,32,25,27,20,29,15,30,20,32,20,34,18,33,12,31,11,29,14,26,9,25,8],[39,24,37,26,40,28,39,24],[13,15,9,19,14,18,13,15],[18,23,14,27,16,27,17,25,20,26,18,23],[6,24,2,26,1,28,2,30,5,28,12,30,16,32,18,30,15,30,12,28,9,25,7,27,6,24],[29,27,32,28,33,31,30,29,27,28,29,27],[5,35,1,33,3,36,13,38,15,35,10,36,5,35]],fill:1},grass:{width:27,height:22,lines:[[0,10.5,13,10.5],[2.5,10,1.5,7],[4.5,10,4.5,5,3.5,4],[7,10,7.5,6,8.5,3],[10,10,11,6]],repeat:[[0,0],[14,10]],stroke:1},swamp:{width:24,height:23,lines:[[0,10.5,9.5,10.5],[2.5,10,2.5,7],[4.5,10,4.5,4],[6.5,10,6.5,6],[3,12.5,7,12.5]],repeat:[[0,0],[14,10]],stroke:1},reed:{width:26,height:23,lines:[[2.5,10,2,7],[4.5,10,4.2,4],[6.5,10,6.8,4],[8.5,10,9,6],[3.7,4,3.7,2.5],[4.7,4,4.7,2.5],[6.3,4,6.3,2.5],[7.3,4,7.3,2.5]],circles:[[4.2,2.5,.5],[18.2,12.5,.5],[6.8,2.5,.5],[20.8,12.5,.5],[9,6,.5],[23,16,.5]],repeat:[[0,0],[14,10]],stroke:1},wave:{width:10,height:8,lines:[[0,0,5,4,10,0]],stroke:1},vine:{width:13,height:13,lines:[[3,0,3,6],[9,7,9,13]],stroke:1},forest:{width:55,height:30,circles:[[7,7,3.5],[20,20,1.5],[42,22,3.5],[35,5,1.5]],stroke:1},forest2:{width:55,height:30,circles:[[7,7,3.5],[20,20,1.5],[42,22,3.5],[35,5,1.5]],fill:1,stroke:1},scrub:{width:26,height:20,lines:[[1,4,4,8,6,4]],circles:[[20,13,1.5]],stroke:1},tree:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78]],repeat:[[3,1],[18,16]],stroke:1},tree2:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78,4.95,10.61,7.78,10.61]],repeat:[[3,1],[18,16]],fill:1,stroke:1},pine:{width:30,height:30,lines:[[5.66,11.31,2.83,11.31,2.83,8.49,0,8.49,2.83,0,5.66,8.49,2.83,8.49]],repeat:[[3,1],[18,16]],stroke:1},pine2:{width:30,height:30,lines:[[5.66,11.31,2.83,11.31,2.83,8.49,0,8.49,2.83,0,5.66,8.49,2.83,8.49,2.83,11.31,5.66,11.31]],repeat:[[3,1],[18,16]],fill:1,stroke:1},mixtree:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78,4.95,10.61,7.78,10.61],[23.66,27.31,20.83,27.31,20.83,24.49,18,24.49,20.83,16,23.66,24.49,20.83,24.49,20.83,27.31,23.66,27.31]],repeat:[[3,1]],stroke:1},mixtree2:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78,4.95,10.61,7.78,10.61],[23.66,27.31,20.83,27.31,20.83,24.49,18,24.49,20.83,16,23.66,24.49,20.83,24.49,20.83,27.31,23.66,27.31]],repeat:[[3,1]],fill:1,stroke:1},pines:{width:22,height:20,lines:[[1,4,3.5,1,6,4],[1,8,3.5,5,6,8],[3.5,1,3.5,11],[12,14.5,14.5,14,17,14.5],[12,18,17,18],[14.5,12,14.5,18]],repeat:[[2,1]],stroke:1},rock:{width:20,height:20,lines:[[1,0,1,9],[4,0,4,9],[7,0,7,9],[10,1,19,1],[10,4,19,4],[10,7,19,7],[0,11,9,11],[0,14,9,14],[0,17,9,17],[12,10,12,19],[15,10,15,19],[18,10,18,19]],repeat:[[.5,.5]],stroke:1},rocks:{width:20,height:20,lines:[[5,0,3,0,5,4,4,6,0,3,0,5,3,6,5,9,3.75,10,2.5,10,0,9,0,10,4,11,5,14,4,15,0,13,0,13,0,13,0,14,0,14,5,16,5,18,3,19,0,19,-.25,19.9375,5,20,10,19,10,20,11,20,12,19,14,20,15,20,17,19,20,20,20,19,19,16,20,15,20,11,20,10,19,8,20,5,20,0,19,0,20,2,19,4,17,4,16,3,15,0,14,0,15,4,11,5,10,4,11,0,10,0,9,4,6,5,5,0],[18,5,19,6,18,10,16,10,14,9,16,5,18,5],[5,6,9,5,10,6,10,9,6,10,5,6],[14,5,14,8,13,9,12,9,11,7,12,5,14,5],[5,11,8,10,9,11,10,14,6,15,6,15,5,11],[13,10,14,11,15,14,15,14,15,14,11,15,10,11,11,10,13,10],[15,12,16,11,19,11,19,15,16,14,16,14,15,12],[6,16,9,15,10,18,5,19,6,16],[10,16,14,16,14,18,13,19,11,18,10,16],[15,15,18,16,18,18,16,19,15,18,15,15]],stroke:1}};class fm{static uuid15(){return fm.uuid(15,16)}static CheckIsColor(t){return CSS.supports("color",t)?t:"rgba(0, 0, 0, 0.8)"}static getDefaultImageFillStyle(){let t=[],e=new Am;for(let r in e.patterns){let e=new Am({pattern:r});t.push({title:r,image:e.getImage().toDataURL()})}return t}static saveToShp(t,e){}static toGeoJSON(t){return(new nf).writeFeaturesObject(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static formatStr(t,e){if(0===arguments.length)return null;let r=arguments[0];for(let n=1;n<arguments.length;n++){let t=new RegExp("\\{"+(n-1)+"\\}","gm");r=r.replace(t,arguments[n])}return r}static randomString(t){t=t||32;let e="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz",r=e.length,n="";for(let i=0;i<t;i++)n+=e.charAt(Math.floor(Math.random()*r));return n.toLowerCase()}static uuid(t,e){let r,n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=[];if(e=e||n.length,t)for(r=0;r<t;r++)i[r]=n[0|Math.random()*e];else{let t;for(i[8]=i[13]=i[18]=i[23]="-",i[14]="4",r=0;r<36;r++)i[r]||(t=0|16*Math.random(),i[r]=n[19===r?3&t|8:t])}return i.join("")}static format(t,e){if("object"==typeof e){for(let r in e)if(void 0!==e[r]){let n=new RegExp("({"+r+"})","g");t=t.replace(n,e[r])}}else for(let r=0;r<e.length;r++)if(void 0!==e[r]){let n=new RegExp("({["+r+"]})","g");t=t.replace(n,e[r])}return t}static getQueryString(t){return new URL(window.location.href).searchParams.get(t)}static ConvertKmlToJson(t,e){hm.toGeoJSON(t).then((t=>{e(t)}))}static saveTokml(t,e){let r=hm.toKml(t,{name:"标绘数据",documentName:"标绘数据文件",documentDescription:"标绘数据 by 幻景科技",simplestyle:!0});fm.downloadFile(e,r)}static saveJSON(t,e){if(!t)return void alert("保存的数据为空");e||(e="json.json"),"object"==typeof t&&(t=JSON.stringify(t,void 0,4));let r=new Blob([t],{type:"text/json"}),n=document.createEvent("MouseEvents"),i=document.createElement("a");i.download=e,i.href=window.URL.createObjectURL(r),i.dataset.downloadurl=["text/json",i.download,i.href].join(":"),n.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),i.dispatchEvent(n)}static downloadFile(t,e){const r=new Blob([e]),n=document.createElement("a");n.download=t,n.href=URL.createObjectURL(r),document.body.appendChild(n),n.click(),document.body.removeChild(n)}static randomHexColor(){return"#"+Math.random().toString(16).substring(2,6).toUpperCase()}static randomRgbColor(t=1){return fm.hexToRgba(fm.randomHexColor(),t)}static rgbToHex(t){let e,r,n,i,o=t.replace(/\s+/g,"").match(/rgba?\((\d{1,3}),(\d{1,3}),(\d{1,3})(,([.\d]+))?\)/);return o?(e=(+o[1]).toString(16),e=1===e.length?"0"+e:e,r=(+o[2]).toString(16),r=1===r.length?"0"+r:r,n=(+o[3]).toString(16),n=1===n.length?"0"+n:n,i=+(o[5]?o[5]:1),{hex:"#"+e+r+n,alpha:i}):{hex:t,alpha:1}}static hexToRgba(t,e){let r=t.toLowerCase();if(r&&/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(r)){if(4===r.length){let t="#";for(let e=1;e<4;e+=1)t+=r.slice(e,e+1).concat(r.slice(e,e+1));r=t}let t=[];for(let e=1;e<7;e+=2)t.push(parseInt("0x"+r.slice(e,e+2)));return"rgba("+t.join(",")+","+e+")"}return r}}const pm=class{constructor(t){r(this,"overlayStyle"),r(this,"StylesList",{highlightStyle:new Gi({stroke:new kn({color:"rgba(0, 255, 0,1)",width:5}),fill:new Tn({color:"rgba(0, 255, 0,0.0)"}),text:new zi({text:"",font:"12px Calibri,sans-serif",fill:new Tn({color:"#000"}),stroke:new kn({color:"#f00",width:3})}),image:new ki({radius:5,fill:new Tn({color:"rgba(0, 255, 0,1)"}),stroke:new kn({color:"rgba(255, 255, 255,1)",width:2})})}),point:new Gi({text:new zi({font:pm.option.Point.Font,text:"",offsetX:pm.option.Point.FontoffsetX,offsetY:pm.option.Point.FontoffsetY,fill:new Tn({color:pm.option.Point.FontColor}),stroke:new kn({color:pm.option.Point.FontStrokeColor,width:pm.option.Point.FontStrokeWidth})}),image:new ki({scale:pm.option.Point.scale,radius:pm.option.Point.radius,fill:new Tn({color:pm.option.Point.fillcolor}),stroke:new kn({color:pm.option.Point.strokecolor,width:pm.option.Point.strokewidth})})}),polyline:new Gi({stroke:new kn({color:pm.option.LineString.strokecolor,width:pm.option.LineString.strokewidth}),text:new zi({text:"",font:pm.option.LineString.Font,fill:new Tn({color:pm.option.LineString.FontColor}),stroke:new kn({color:pm.option.LineString.FontStrokeColor,width:pm.option.LineString.FontStrokeWidth})})}),polygon:new Gi({stroke:new kn({color:pm.option.Polygon.strokecolor,width:pm.option.Polygon.strokewidth}),fill:new Tn({color:pm.option.Polygon.fillcolor}),text:new zi({text:"",font:pm.option.Polygon.Font,fill:new Tn({color:pm.option.Polygon.FontColor}),stroke:new kn({color:pm.option.Polygon.FontStrokeColor,width:pm.option.Polygon.FontStrokeWidth})})}),bufferStyle:new Gi({stroke:new kn({color:pm.option.bufferStyle.strokecolor,width:pm.option.bufferStyle.strokewidth,lineDash:[10,10]}),fill:new Tn({color:pm.option.bufferStyle.fillcolor}),text:new zi({text:"",font:pm.option.bufferStyle.Font,fill:new Tn({color:pm.option.bufferStyle.FontColor}),stroke:new kn({color:pm.option.bufferStyle.FontStrokeColor,width:pm.option.bufferStyle.FontStrokeWidth})})}),overlapStyle:new Gi({stroke:new kn({color:pm.option.overlapStyle.strokecolor,width:pm.option.overlapStyle.strokewidth}),fill:new Tn({color:pm.option.overlapStyle.fillcolor}),text:new zi({text:"",font:pm.option.overlapStyle.Font,fill:new Tn({color:pm.option.overlapStyle.FontColor}),stroke:new kn({color:pm.option.overlapStyle.FontStrokeColor,width:pm.option.overlapStyle.FontStrokeWidth})}),image:new ki({radius:5,fill:new Tn({color:pm.option.overlapStyle.fillcolor}),stroke:new kn({color:pm.option.overlapStyle.strokecolor,width:pm.option.overlapStyle.strokewidth})}),zIndex:1/0}),MultiLineString:new Gi({stroke:new kn({color:"green",width:1})}),MultiPoint:new Gi({image:pm.image}),MultiPolygon:new Gi({stroke:new kn({color:"yellow",width:1}),fill:new Tn({color:"rgba(255, 255, 0, 0.1)"})}),Circle:new Gi({stroke:new kn({color:pm.option.Polygon.strokecolor,width:pm.option.Polygon.strokewidth}),fill:new Tn({color:pm.option.Polygon.fillcolor})}),square:new Gi({image:new Mi({fill:pm.fill,stroke:pm.stroke,points:4,radius:10,angle:Math.PI/4})}),triangle:new Gi({image:new Mi({fill:pm.fill,stroke:pm.stroke,points:3,radius:10,rotation:Math.PI/4,angle:0})}),star:new Gi({image:new Mi({fill:pm.fill,stroke:pm.stroke,points:5,radius:10,radius2:4,angle:0})}),cross:new Gi({image:new Mi({fill:pm.fill,stroke:pm.stroke,points:4,radius:10,radius2:0,angle:0})}),x:new Gi({image:new Mi({fill:pm.fill,stroke:pm.stroke,points:4,radius:10,radius2:0,angle:Math.PI/4})}),GeometryCollection:new Gi({fill:new Tn({color:"rgba(255, 255, 255, 0.1)"}),stroke:new kn({color:"rgba(255, 255, 0, 1)",width:3}),image:new ki({radius:5,stroke:new kn({color:"rgba(255, 0,0, 1)",width:2}),fill:new Tn({color:"rgba(255, 255, 0, 1)"})})})}),r(this,"option",{overlapStyle:{Font:"12px Microsoft YaHei",FontColor:"#8B4513",FontStrokeColor:"#fff",FontStrokeWidth:2,FontoffsetX:0,FontoffsetY:0,fillcolor:"rgba(255, 255, 255,0.5)",strokecolor:"blue",strokewidth:3,strokeradius:5}}),this.overlayStyle=function(){const t={};return t.Polygon=[new Gi({fill:new Tn({color:[255,255,255,.5]})}),new Gi({stroke:new kn({color:[255,255,255,1],width:5})}),new Gi({stroke:new kn({color:[0,153,255,1],width:3})}),new Gi({image:new ki({radius:3,fill:new Tn({color:"red"})})})],t.MultiPolygon=t.Polygon,t.LineString=[new Gi({stroke:new kn({color:[255,255,255,1],width:5})}),new Gi({stroke:new kn({color:[0,153,255,1],width:3})})],t.MultiLineString=t.LineString,t.Point=[new Gi({image:new ki({radius:7,fill:new Tn({color:[0,153,255,1]}),stroke:new kn({color:[255,255,255,.75],width:1.5})}),zIndex:1e5})],t.MultiPoint=t.Point,t.GeometryCollection=t.Polygon.concat(t.Point),function(e,r){return t[e.getGeometry().getType()]}}()}static getStyle(t,e){let r;switch(t){case Wy.Point:r=(null==e?void 0:e.imageOption)?pm.getIconStyle(e):pm.getPointStyle(e);break;case Wy.Line:r=pm.getPolylineStyle(e);break;case Wy.Polygon:case Wy.MultiPolygon:case Wy.Rectangle:case Wy.Circle:r=pm.getPolygonStyle(e);break;case Wy.GeometryCollection:r=new Gi({fill:new Tn({color:"rgba(255, 255, 255, 0.1)"}),stroke:new kn({color:"rgba(255, 255, 0, 1)",width:3}),image:new ki({radius:5,stroke:new kn({color:"rgba(255, 0,0, 1)",width:2}),fill:new Tn({color:"rgba(255, 255, 0, 1)"})})})}return r}static getDefaultPointStyle(){return{Font:"12px Microsoft YaHei",FontColor:"#8B4513",FontStrokeColor:"#fff",FontStrokeWidth:2,FontoffsetX:0,FontoffsetY:-10,fillcolor:"rgba(0, 153, 255,1)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1,radius:3,scale:1,text:""}}static getDefaulLineStyle(){return{Font:"12px Microsoft YaHei",FontColor:"#8B4513",FontStrokeColor:"#fff",FontStrokeWidth:2,FontoffsetX:0,FontoffsetY:10,fillcolor:"rgba(255, 255, 0,1)",strokecolor:"rgba(255, 255, 0,1)",strokewidth:2,strokeradius:5,strokelineDash:null,strokelineCap:"round",strokelineJoin:"round",text:""}}static getDefaultBufferStyleStyle(){return{Font:"12px Microsoft YaHei",FontColor:"#8B4513",FontStrokeColor:"#fff",FontStrokeWidth:2,FontoffsetX:0,FontoffsetY:0,fillcolor:"rgba(255, 255, 255,0.2)",strokecolor:"rgba(255, 0, 0,1)",strokewidth:2,strokeradius:5,text:""}}static getDefaultPolygonStyle(){return{Font:"12px Microsoft YaHei",FontColor:"#8B4513",FontStrokeColor:"#fff",FontStrokeWidth:2,FontoffsetX:0,FontoffsetY:0,fillcolor:"rgba(255, 255, 255,0.2)",strokecolor:"rgba(255, 255, 0,1)",strokewidth:2,strokeradius:5,text:""}}static getTipStyle(){return new Gi({text:new zi({font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.8)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})})}static getIconStyle(t){for(let r in t)""===t[r]&&delete t[r];let e=Object.assign({},pm.getDefaultPointStyle(),t);return new Gi({text:new zi({font:e.Font,text:e.text,offsetX:e.FontoffsetX,offsetY:e.FontoffsetY,fill:new Tn({color:fm.CheckIsColor(e.FontColor)}),stroke:new kn({color:fm.CheckIsColor(e.FontStrokeColor),width:e.FontStrokeWidth})}),image:new ms(e.imageOption)})}static getPointStyle(t){for(let n in t)""===t[n].toString()&&delete t[n];let e,r=Object.assign({},pm.getDefaultPointStyle(),t);switch(r.GraphicStyle){case"STYLE_TRIANGLE":e=new Mi({scale:r.scale,radius:r.radius,points:3,angle:Math.PI,displacement:[0,10],fill:new Tn({color:fm.CheckIsColor(r.fillcolor)}),stroke:new kn({color:fm.CheckIsColor(r.strokecolor),width:r.strokewidth})});break;case"STYLE_SQUARE":e=new Mi({scale:r.scale,radius:r.radius,points:4,angle:Math.PI/4,fill:new Tn({color:fm.CheckIsColor(r.fillcolor)}),stroke:new kn({color:fm.CheckIsColor(r.strokecolor),width:r.strokewidth})});break;default:e=new ki({scale:r.scale,radius:r.radius,fill:new Tn({color:fm.CheckIsColor(r.fillcolor)}),stroke:new kn({color:fm.CheckIsColor(r.strokecolor),width:r.strokewidth})})}return new Gi({text:new zi({font:r.Font,text:r.text,offsetX:r.FontoffsetX,offsetY:r.FontoffsetY,fill:new Tn({color:fm.CheckIsColor(r.FontColor)}),stroke:new kn({color:fm.CheckIsColor(r.FontStrokeColor),width:r.FontStrokeWidth})}),image:e})}static getPolylineStyle(t){for(let r in t)""===t[r].toString()&&delete t[r];let e=Object.assign({},pm.getDefaulLineStyle(),t);switch(e.GraphicStyle){case"STYLE_DASH":e.strokelineDash=[15,10];break;case"STYLE_SOLID":e.strokelineDash=null;break;case"STYLE_DOT":e.strokelineDash=[2,5];break;case"STYLE_DASHDOT":e.strokelineDash=[2,10,15,10]}return new Gi({stroke:new kn({color:e.strokecolor,width:e.strokewidth,lineDash:e.strokelineDash}),text:new zi({text:e.text,font:e.Font,fill:new Tn({color:fm.CheckIsColor(e.FontColor)}),stroke:new kn({color:fm.CheckIsColor(e.FontStrokeColor),width:e.FontStrokeWidth})})})}static getTrackLineStyle(t,e){t.getGeometry();let r=[new Gi({stroke:new kn({color:"#2E8B57",width:10})})];t.getGeometry().getLength();let n=Math.ceil(t.getGeometry().getLength()/e/100),i=[];for(let o=0;o<=n;o++){let e=o/n+.01;e>1&&(e-=1);let r=new W(new rn(t.getGeometry().getCoordinateAt(e)));i.push(r)}return t.getGeometry().forEachSegment(((t,e)=>{i.forEach((n=>{let i=new On([t,e]),o=n.getGeometry().getFirstCoordinate(),s=i.getClosestPoint(o);if(Math.abs(s[0]-o[0])<1&&Math.abs(s[1]-o[1])<1){new Image(117,71).src="../../public/image/linearrow.png";let i=e[0]-t[0],o=e[1]-t[1],s=Math.atan(i/o);s=o>0?s:Math.PI+s,r.push(new Gi({geometry:n.getGeometry(),image:new ms({src:"../../public/image/linearrow.png",anchor:[.75,.5],scale:1,rotateWithView:!1,color:"white",rotation:-s})}))}}))})),r}static getPolygonStyle(t){for(let r in t)""===t[r].toString()&&delete t[r];let e=Object.assign({},pm.getDefaultPolygonStyle(),t);switch(e.strokeStyle){case"STYLE_DASH":e.strokelineDash=[15,10];break;case"STYLE_SOLID":e.strokelineDash=null;break;case"STYLE_DOT":e.strokelineDash=[2,5];break;case"STYLE_DASHDOT":e.strokelineDash=[2,10,15,10]}return new Gi({stroke:new kn({color:fm.CheckIsColor(e.strokecolor),width:e.strokewidth,lineDash:e.strokelineDash}),fill:new Tn({color:fm.CheckIsColor(e.fillcolor)}),text:new zi({text:e.text,font:e.Font,fill:new Tn({color:fm.CheckIsColor(e.FontColor)}),stroke:new kn({color:fm.CheckIsColor(e.FontStrokeColor),width:e.FontStrokeWidth})})})}static getBufferStyleStyle(t){for(let r in t)""===t[r].toString()&&delete t[r];let e=Object.assign({},pm.getDefaultBufferStyleStyle(),t);return new Gi({stroke:new kn({color:fm.CheckIsColor(e.strokecolor),width:e.strokewidth,lineDash:[10,10]}),fill:new Tn({color:fm.CheckIsColor(e.fillcolor)}),text:new zi({text:e.text,font:e.Font,fill:new Tn({color:fm.CheckIsColor(e.FontColor)}),stroke:new kn({color:fm.CheckIsColor(e.FontStrokeColor),width:e.FontStrokeWidth})})})}static getEditPolygonStyle(){return[new Gi({stroke:new kn({color:"rgba(0, 153, 255,1)",width:3}),fill:new Tn({color:"rgba(255, 255, 255,0.3)"}),text:new zi({text:"",font:"12px Microsoft YaHei",fill:new Tn({color:"#000"}),stroke:new kn({color:"#fff",width:2})})}),new Gi({image:new ki({radius:3,fill:new Tn({color:"rgba(255, 255, 255,1)"}),stroke:new kn({color:"red",width:2})}),geometry:function(t){var e,r;if(t){let n;return n=t.getGeometry().getType()===Wy.Line?null==(e=t.getGeometry())?void 0:e.getCoordinates():null==(r=t.getGeometry())?void 0:r.getCoordinates()[0],new Fu(n)}}})]}static getEditPointStyle(t){return new Gi({image:new ki({radius:5,stroke:new kn({color:"rgba(255, 255,255, 0.7)"}),fill:new Tn({color:"rgba(0, 255, 255, 0.8)"})}),text:new zi({text:"拖动点修改图形,点击空白处完成",font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.7)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})})}static getRandomColor(){return"#"+Math.random().toString(16).substring(2,6).toUpperCase()}static _getStyle(t){const e={};switch(t){case"Point":case"MultiPoint":e.Point=new Gi({text:new zi({font:pm.option.Point.Font,text:"",offsetX:pm.option.Point.FontoffsetX,offsetY:pm.option.Point.FontoffsetY,fill:new Tn({color:pm.option.Point.FontColor}),stroke:new kn({color:pm.option.Point.FontStrokeColor,width:pm.option.Point.FontStrokeWidth})}),image:new ki({scale:pm.option.Point.scale,radius:pm.option.Point.radius,fill:new Tn({color:pm.option.Point.fillcolor}),stroke:new kn({color:pm.option.Point.strokecolor,width:pm.option.Point.strokewidth})})});break;case"LineString":case"MultiLineString":e.LineString=new Gi({stroke:new kn({color:pm.option.LineString.strokecolor,width:pm.option.LineString.strokewidth}),text:new zi({text:"",font:pm.option.LineString.Font,fill:new Tn({color:pm.option.LineString.FontColor}),stroke:new kn({color:pm.option.LineString.FontStrokeColor,width:pm.option.LineString.FontStrokeWidth})})});break;case"Polygon":case"MultiPolygon":e.Polygon=new Gi({stroke:new kn({color:pm.option.Polygon.strokecolor,width:pm.option.Polygon.strokewidth}),fill:new Tn({color:pm.option.Polygon.fillcolor}),text:new zi({text:"",font:pm.option.Polygon.Font,fill:new Tn({color:pm.option.Polygon.FontColor}),stroke:new kn({color:pm.option.Polygon.FontStrokeColor,width:pm.option.Polygon.FontStrokeWidth})})})}return e[t]}static setHighlightStyle(t){const e=t.getGeometry().getType();let r=pm.getStyle(e,{radius:8,strokewidth:2,strokecolor:"rgba(0, 255, 0,1)"});try{t.get("name")&&r.getText()&&r.getText().setText(t.get("name"))}catch(UW){}return r}static getFeaturesDefaultStyle(t,e,r){let n,i,o,s=t.getProperties(),a={};switch(t.getGeometry().getType()){case"Point":case"MultiPoint":i=pm.getDefaultPointStyle(),a.fillcolor=""!==s.style.fillcolor?s.style.fillcolor:i.fillcolor,a.strokecolor=""!==s.style.strokecolor?s.style.strokecolor:i.strokecolor,a.strokewidth=""!==s.style.strokewidth?s.style.strokewidth:i.strokewidth,a.radius=""!==s.style.radius?s.style.radius/2:i.radius,s.style.src&&""!==s.style.src&&(a.imageOption={src:s.style.src});break;case"LineString":case"MultiLineString":n=pm.getDefaulLineStyle(),a=Object.assign({},n,s.style);break;case"Polygon":case"MultiPolygon":o=pm.getDefaultPolygonStyle(),a.fillcolor=""!==s.style.fillcolor?s.style.fillcolor:o.fillcolor,a.strokecolor=""!==s.style.strokecolor?s.style.strokecolor:o.strokecolor,a.strokewidth=""!==s.style.strokewidth?s.style.strokewidth:o.strokewidth}t.set("style",a)}};let dm=pm;r(dm,"option"),r(dm,"StylesList"),r(dm,"stroke",new kn({color:"black",width:2})),r(dm,"fill",new Tn({color:"red"})),r(dm,"image",new ki({radius:5,stroke:new kn({color:"red",width:1})}));var gm=6371008.8,ym={centimeters:100*gm,centimetres:100*gm,degrees:gm/111325,feet:3.28084*gm,inches:39.37*gm,kilometers:gm/1e3,kilometres:gm/1e3,meters:gm,metres:gm,miles:gm/1609.344,millimeters:1e3*gm,millimetres:1e3*gm,nauticalmiles:gm/1852,radians:1,yards:1.0936*gm},mm={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/gm,yards:1.0936133},vm={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 _m(t,e,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function wm(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!km(t[0])||!km(t[1]))throw new Error("coordinates must contain numbers");return _m({type:"Point",coordinates:t},e,r)}function bm(t,e,r){void 0===r&&(r={});for(var n=0,i=t;n<i.length;n++){var o=i[n];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return _m({type:"Polygon",coordinates:t},e,r)}function xm(t,e,r){if(void 0===r&&(r={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return _m({type:"LineString",coordinates:t},e,r)}function Cm(t,e){void 0===e&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function Em(t,e,r){return void 0===r&&(r={}),_m({type:"MultiLineString",coordinates:t},e,r)}function Sm(t,e,r){return void 0===r&&(r={}),_m({type:"MultiPoint",coordinates:t},e,r)}function Bm(t,e,r){return void 0===r&&(r={}),_m({type:"MultiPolygon",coordinates:t},e,r)}function Im(t,e,r){return void 0===r&&(r={}),_m({type:"GeometryCollection",geometries:t},e,r)}function Tm(t,e){void 0===e&&(e="kilometers");var r=ym[e];if(!r)throw new Error(e+" units is invalid");return t*r}function Pm(t,e){void 0===e&&(e="kilometers");var r=ym[e];if(!r)throw new Error(e+" units is invalid");return t/r}function Fm(t,e){return Lm(Pm(t,e))}function Lm(t){return t%(2*Math.PI)*180/Math.PI}function Mm(t){return t%360*Math.PI/180}function Om(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return Tm(Pm(t,e),r)}function km(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function Nm(t){return!!t&&t.constructor===Object}const Rm=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:vm,bearingToAzimuth:function(t){var e=t%360;return e<0&&(e+=360),e},convertArea:function(t,e,r){if(void 0===e&&(e="meters"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("area must be a positive number");var n=vm[e];if(!n)throw new Error("invalid original units");var i=vm[r];if(!i)throw new Error("invalid final units");return t/n*i},convertLength:Om,degreesToRadians:Mm,earthRadius:gm,factors:ym,feature:_m,featureCollection:Cm,geometry:function(t,e,r){switch(t){case"Point":return wm(e).geometry;case"LineString":return xm(e).geometry;case"Polygon":return bm(e).geometry;case"MultiPoint":return Sm(e).geometry;case"MultiLineString":return Em(e).geometry;case"MultiPolygon":return Bm(e).geometry;default:throw new Error(t+" is invalid")}},geometryCollection:Im,isNumber:km,isObject:Nm,lengthToDegrees:Fm,lengthToRadians:Pm,lineString:xm,lineStrings:function(t,e,r){return void 0===r&&(r={}),Cm(t.map((function(t){return xm(t,e)})),r)},multiLineString:Em,multiPoint:Sm,multiPolygon:Bm,point:wm,points:function(t,e,r){return void 0===r&&(r={}),Cm(t.map((function(t){return wm(t,e)})),r)},polygon:bm,polygons:function(t,e,r){return void 0===r&&(r={}),Cm(t.map((function(t){return bm(t,e)})),r)},radiansToDegrees:Lm,radiansToLength:Tm,round:function(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r},unitsFactors:mm,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(!km(t))throw new Error("bbox must only contain numbers")}))},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")}},Symbol.toStringTag,{value:"Module"}));function Um(t,e,r){if(null!==t)for(var n,i,o,s,a,l,u,h,c=0,A=0,f=t.type,p="FeatureCollection"===f,d="Feature"===f,g=p?t.features.length:1,y=0;y<g;y++){a=(h=!!(u=p?t.features[y].geometry:d?t.geometry:t)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var m=0;m<a;m++){var v=0,_=0;if(null!==(s=h?u.geometries[m]:u)){l=s.coordinates;var w=s.type;switch(c=!r||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":if(!1===e(l,A,y,v,_))return!1;A++,v++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===e(l[n],A,y,v,_))return!1;A++,"MultiPoint"===w&&v++}"LineString"===w&&v++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(i=0;i<l[n].length-c;i++){if(!1===e(l[n][i],A,y,v,_))return!1;A++}"MultiLineString"===w&&v++,"Polygon"===w&&_++}"Polygon"===w&&v++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(_=0,i=0;i<l[n].length;i++){for(o=0;o<l[n][i].length-c;o++){if(!1===e(l[n][i][o],A,y,v,_))return!1;A++}_++}v++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(!1===Um(s.geometries[n],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Dm(t,e){var r;switch(t.type){case"FeatureCollection":for(r=0;r<t.features.length&&!1!==e(t.features[r].properties,r);r++);break;case"Feature":e(t.properties,0)}}function Qm(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var r=0;r<t.features.length&&!1!==e(t.features[r],r);r++);}function Gm(t,e,r){var n=r;return Qm(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n}function jm(t){var e=[];return Um(t,(function(t){e.push(t)})),e}function Hm(t,e){var r,n,i,o,s,a,l,u,h,c,A=0,f="FeatureCollection"===t.type,p="Feature"===t.type,d=f?t.features.length:1;for(r=0;r<d;r++){for(a=f?t.features[r].geometry:p?t.geometry:t,u=f?t.features[r].properties:p?t.properties:{},h=f?t.features[r].bbox:p?t.bbox:void 0,c=f?t.features[r].id:p?t.id:void 0,s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=l?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,A,u,h,c))return!1;break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===e(o.geometries[n],A,u,h,c))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,A,u,h,c))return!1;A++}}function zm(t,e,r){var n=r;return Hm(t,(function(t,i,o,s,a){n=0===i&&void 0===r?t:e(n,t,i,o,s,a)})),n}function Vm(t,e){Hm(t,(function(t,r,n,i,o){var s,a=null===t?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==e(_m(t,n,{bbox:i,id:o}),r,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var l=0;l<t.coordinates.length;l++){var u=t.coordinates[l];if(!1===e(_m({type:s,coordinates:u},n),r,l))return!1}}))}function Km(t,e){Vm(t,(function(t,r,n){var i=0;if(t.geometry){var o=t.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var s,a=0,l=0,u=0;return!1!==Um(t,(function(o,h,c,A,f){if(void 0===s||r>a||A>l||f>u)return s=o,a=r,l=A,u=f,void(i=0);var p=xm([s,o],t.properties);if(!1===e(p,r,n,f,i))return!1;i++,s=o}))&&void 0}}}))}function qm(t,e,r){var n=r,i=!1;return Km(t,(function(t,o,s,a,l){n=!1===i&&void 0===r?t:e(n,t,o,s,a,l),i=!0})),n}function Wm(t,e){if(!t)throw new Error("geojson is required");Vm(t,(function(t,r,n){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,r,n,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===e(xm(o[s],t.properties),r,n,s))return!1}}}))}function Xm(t,e,r){var n=r;return Wm(t,(function(t,i,o,s){n=0===i&&void 0===r?t:e(n,t,i,o,s)})),n}const Ym=Object.freeze(Object.defineProperty({__proto__:null,coordAll:jm,coordEach:Um,coordReduce:function(t,e,r,n){var i=r;return Um(t,(function(t,n,o,s,a){i=0===n&&void 0===r?t:e(i,t,n,o,s,a)}),n),i},featureEach:Qm,featureReduce:Gm,findPoint:function(t,e){if(!Nm(e=e||{}))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),a=a||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":a=a||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var l=r.coordinates;switch(r.type){case"Point":return wm(l,a,e);case"MultiPoint":return i<0&&(i=l.length+i),wm(l[i],a,e);case"LineString":return s<0&&(s=l.length+s),wm(l[s],a,e);case"Polygon":return o<0&&(o=l.length+o),s<0&&(s=l[o].length+s),wm(l[o][s],a,e);case"MultiLineString":return i<0&&(i=l.length+i),s<0&&(s=l[i].length+s),wm(l[i][s],a,e);case"MultiPolygon":return i<0&&(i=l.length+i),o<0&&(o=l[i].length+o),s<0&&(s=l[i][o].length-s),wm(l[i][o][s],a,e)}throw new Error("geojson is invalid")},findSegment:function(t,e){if(!Nm(e=e||{}))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),a=a||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":a=a||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var l=r.coordinates;switch(r.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=l.length+s-1),xm([l[s],l[s+1]],a,e);case"Polygon":return o<0&&(o=l.length+o),s<0&&(s=l[o].length+s-1),xm([l[o][s],l[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=l.length+i),s<0&&(s=l[i].length+s-1),xm([l[i][s],l[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=l.length+i),o<0&&(o=l[i].length+o),s<0&&(s=l[i][o].length-s-1),xm([l[i][o][s],l[i][o][s+1]],a,e)}throw new Error("geojson is invalid")},flattenEach:Vm,flattenReduce:function(t,e,r){var n=r;return Vm(t,(function(t,i,o){n=0===i&&0===o&&void 0===r?t:e(n,t,i,o)})),n},geomEach:Hm,geomReduce:zm,lineEach:Wm,lineReduce:Xm,propEach:Dm,propReduce:function(t,e,r){var n=r;return Dm(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n},segmentEach:Km,segmentReduce:qm},Symbol.toStringTag,{value:"Module"}));function Zm(t){var e=[1/0,1/0,-1/0,-1/0];return Um(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}Zm.default=Zm;const Jm=Object.freeze(Object.defineProperty({__proto__:null,default:Zm},Symbol.toStringTag,{value:"Module"}));function $m(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 tv(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 ev(t,e,r){if(!t)throw new Error("No featureCollection passed");if(!r)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+r+", FeatureCollection required");for(var n=0,i=t.features;n<i.length;n++){var o=i[n];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+o.geometry.type)}}function rv(t){return"Feature"===t.type?t.geometry:t}function nv(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}
21
21
  /*
22
22
  object-assign
23
23
  (c) Sindre Sorhus
@@ -82,7 +82,7 @@ var Ax={successCallback:null,verbose:!1,polygons:!1},fx={};function px(t,e,r,n){
82
82
 
83
83
  See the Apache Version 2.0 License for specific language governing permissions
84
84
  and limitations under the License.
85
- ***************************************************************************** */var ME=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function OE(t,e){return t>e?1:t<e?-1:0}function kE(t,e,r){for(var n=new ME(null,null),i=n,o=n;;){var s=r(t,e.key);if(s<0){if(null===e.left)break;if(r(t,e.left.key)<0){var a=e.left;if(e.left=a.right,a.right=e,null===(e=a).left)break}o.left=e,o=e,e=e.left}else{if(!(s>0))break;if(null===e.right)break;if(r(t,e.right.key)>0&&(a=e.right,e.right=a.left,a.left=e,null===(e=a).right))break;i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=n.right,e.right=n.left,e}function NE(t,e,r,n){var i=new ME(t,e);if(null===r)return i.left=i.right=null,i;var o=n(t,(r=kE(t,r,n)).key);return o<0?(i.left=r.left,i.right=r,r.left=null):o>=0&&(i.right=r.right,i.left=r,r.right=null),i}function RE(t,e,r){var n=null,i=null;if(e){var o=r((e=kE(t,e,r)).key,t);0===o?(n=e.left,i=e.right):o<0?(i=e.right,e.right=null,n=e):(n=e.left,e.left=null,i=e)}return{left:n,right:i}}function UE(t,e,r,n,i){if(t){n(e+(r?"└── ":"├── ")+i(t)+"\n");var o=e+(r?" ":"│ ");t.left&&UE(t.left,o,!1,n,i),t.right&&UE(t.right,o,!0,n,i)}}var DE=function(){function t(t){void 0===t&&(t=OE),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=NE(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var r=new ME(t,e);null===this._root&&(r.left=r.right=null,this._size++,this._root=r);var n=this._comparator,i=kE(t,this._root,n),o=n(t,i.key);return 0===o?this._root=i:(o<0?(r.left=i.left,r.right=i,i.left=null):o>0&&(r.right=i.right,r.left=i,i.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,r){var n;return null===e?null:0===r(t,(e=kE(t,e,r)).key)?(null===e.left?n=e.right:(n=kE(t,e.left,r)).right=e.right,this._size--,n):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=kE(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return e;e=n<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=kE(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return!0;e=n<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var r=this._root,n=[],i=!1;!i;)null!==r?(n.push(r),r=r.left):0!==n.length?(r=n.pop(),t.call(e,r),r=r.right):i=!0;return this},t.prototype.range=function(t,e,r,n){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&r.call(n,s))return this;s=s.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var r=e.key;return t.push(r)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var r=e.data;return t.push(r)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,r=!1,n=0,i=[];!r;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),n===t)return e;n++,e=e.right}else r=!0;return null},t.prototype.next=function(t){var e=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?(r=e,e=e.left):e=e.right}return r},t.prototype.prev=function(t){var e=this._root,r=null;if(null!==t.left){for(r=t.left;r.right;)r=r.right;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?e=e.left:(r=e,e=e.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){for(var e=t,r=[],n=!1,i=new ME(null,null),o=i;!n;)e?(r.push(e),e=e.left):r.length>0?e=(e=o=o.next=r.pop()).right:n=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,r){void 0===e&&(e=[]),void 0===r&&(r=!1);var n=t.length,i=this._comparator;if(r&&jE(t,e,0,n-1,i),null===this._root)this._root=QE(t,e,0,n),this._size=n;else{var o=function(t,e,r){for(var n=new ME(null,null),i=n,o=t,s=e;null!==o&&null!==s;)r(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;return null!==o?i.next=o:null!==s&&(i.next=s),n.next}(this.toList(),function(t,e){for(var r=new ME(null,null),n=r,i=0;i<t.length;i++)n=n.next=new ME(t[i],e[i]);return n.next=null,r.next}(t,e),i);n=this._size+n,this._root=GE({head:o},0,n)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return UE(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,r){var n=this._comparator,i=RE(t,this._root,n),o=i.left,s=i.right;n(t,e)<0?s=NE(e,r,s,n):o=NE(e,r,o,n),this._root=function(t,e,r){return null===e?t:(null===t||((e=kE(t.key,e,r)).left=t),e)}(o,s,n)},t.prototype.split=function(t){return RE(t,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var t;return function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).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(UW){o=[6,UW],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,(function(e){switch(e.label){case 0:t=this.minNode(),e.label=1;case 1:return t?[4,t]:[3,3];case 2:return e.sent(),t=this.next(t),[3,1];case 3:return[2]}}))},t}();function QE(t,e,r,n){var i=n-r;if(i>0){var o=r+Math.floor(i/2),s=t[o],a=e[o],l=new ME(s,a);return l.left=QE(t,e,r,o),l.right=QE(t,e,o+1,n),l}return null}function GE(t,e,r){var n=r-e;if(n>0){var i=e+Math.floor(n/2),o=GE(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=GE(t,i+1,r),s}return null}function jE(t,e,r,n,i){if(!(r>=n)){for(var o=t[r+n>>1],s=r-1,a=n+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var l=t[s];t[s]=t[a],t[a]=l,l=e[s],e[s]=e[a],e[a]=l}jE(t,e,r,a,i),jE(t,e,a+1,n,i)}}function HE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function zE(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function VE(t,e,r){return e&&zE(t.prototype,e),r&&zE(t,r),t}var KE=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},qE=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var r=t.ll.x<e.ll.x?e.ll.x:t.ll.x,n=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:r,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:n,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},WE=Number.EPSILON;void 0===WE&&(WE=Math.pow(2,-52));var XE=WE*WE,YE=function(t,e){if(-WE<t&&t<WE&&-WE<e&&e<WE)return 0;var r=t-e;return r*r<XE*t*e?0:t<e?-1:1},ZE=function(){function t(){HE(this,t),this.reset()}return VE(t,[{key:"reset",value:function(){this.xRounder=new JE,this.yRounder=new JE}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),t}(),JE=function(){function t(){HE(this,t),this.tree=new DE,this.round(0)}return VE(t,[{key:"round",value:function(t){var e=this.tree.add(t),r=this.tree.prev(e);if(null!==r&&0===YE(e.key,r.key))return this.tree.remove(t),r.key;var n=this.tree.next(e);return null!==n&&0===YE(e.key,n.key)?(this.tree.remove(t),n.key):t}}]),t}(),$E=new ZE,tS=function(t,e){return t.x*e.y-t.y*e.x},eS=function(t,e){return t.x*e.x+t.y*e.y},rS=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y},o=tS(n,i);return YE(o,0)},nS=function(t){return Math.sqrt(eS(t,t))},iS=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y};return eS(i,n)/nS(i)/nS(n)},oS=function(t,e,r){return 0===e.y?null:{x:t.x+e.x/e.y*(r-t.y),y:r}},sS=function(t,e,r){return 0===e.x?null:{x:r,y:t.y+e.y/e.x*(r-t.x)}},aS=function(){function t(e,r){HE(this,t),void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return VE(t,null,[{key:"compare",value:function(e,r){var n=t.comparePoints(e.point,r.point);return 0!==n?n:(e.point!==r.point&&e.link(r),e.isLeft!==r.isLeft?e.isLeft?1:-1:uS.compare(e.segment,r.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),VE(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,r=0,n=e.length;r<n;r++){var i=e[r];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var r=this.point.events[e];if(void 0===r.segment.consumedBy)for(var n=e+1;n<t;n++){var i=this.point.events[n];void 0===i.consumedBy&&r.otherSE.point.events===i.otherSE.point.events&&r.segment.consume(i.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,r=this.point.events.length;e<r;e++){var n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,r=new Map,n=function(n){var i,o,s,a,l,u=n.otherSE;r.set(n,{sine:(i=e.point,o=t.point,s=u.point,a={x:o.x-i.x,y:o.y-i.y},l={x:s.x-i.x,y:s.y-i.y},tS(l,a)/nS(l)/nS(a)),cosine:iS(e.point,t.point,u.point)})};return function(t,e){r.has(t)||n(t),r.has(e)||n(e);var i=r.get(t),o=i.sine,s=i.cosine,a=r.get(e),l=a.sine,u=a.cosine;return o>=0&&l>=0?s<u?1:s>u?-1:0:o<0&&l<0?s<u?-1:s>u?1:0:l<o?-1:l>o?1:0}}}]),t}(),lS=0,uS=function(){function t(e,r,n,i){HE(this,t),this.id=++lS,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=n,this.windings=i}return VE(t,null,[{key:"compare",value:function(t,e){var r=t.leftSE.point.x,n=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<r)return 1;if(i<n)return-1;var s=t.leftSE.point.y,a=e.leftSE.point.y,l=t.rightSE.point.y,u=e.rightSE.point.y;if(r<n){if(a<s&&a<l)return 1;if(a>s&&a>l)return-1;var h=t.comparePoint(e.leftSE.point);if(h<0)return 1;if(h>0)return-1;var c=e.comparePoint(t.rightSE.point);return 0!==c?c:-1}if(r>n){if(s<a&&s<u)return-1;if(s>a&&s>u)return 1;var A=e.comparePoint(t.leftSE.point);if(0!==A)return A;var f=t.comparePoint(e.rightSE.point);return f<0?1:f>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){var p=e.comparePoint(t.rightSE.point);if(0!==p)return p}if(i>o){var d=t.comparePoint(e.rightSE.point);if(d<0)return 1;if(d>0)return-1}if(i!==o){var g=l-s,y=i-r,m=u-a,v=o-n;if(g>y&&m<v)return 1;if(g<y&&m>v)return-1}return i>o?1:i<o||l<u?-1:l>u?1:t.id<e.id?-1:t.id>e.id?1:0}}]),VE(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,r=this.rightSE.point,n=this.vector();if(e.x===r.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/n.y,o=e.x+i*n.x;if(t.x===o)return 0;var s=(t.x-e.x)/n.x,a=e.y+s*n.y;return t.y===a?0:t.y<a?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),r=t.bbox(),n=qE(e,r);if(null===n)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,l=KE(e,s)&&0===this.comparePoint(s),u=KE(r,i)&&0===t.comparePoint(i),h=KE(e,a)&&0===this.comparePoint(a),c=KE(r,o)&&0===t.comparePoint(o);if(u&&l)return c&&!h?o:!c&&h?a:null;if(u)return h&&i.x===a.x&&i.y===a.y?null:i;if(l)return c&&o.x===s.x&&o.y===s.y?null:s;if(c&&h)return null;if(c)return o;if(h)return a;var A=function(t,e,r,n){if(0===e.x)return sS(r,n,t.x);if(0===n.x)return sS(t,e,r.x);if(0===e.y)return oS(r,n,t.y);if(0===n.y)return oS(t,e,r.y);var i=tS(e,n);if(0==i)return null;var o={x:r.x-t.x,y:r.y-t.y},s=tS(o,e)/i,a=tS(o,n)/i;return{x:(t.x+a*e.x+(r.x+s*n.x))/2,y:(t.y+a*e.y+(r.y+s*n.y))/2}}(i,this.vector(),s,t.vector());return null===A?null:KE(n,A)?$E.round(A.x,A.y):null}},{key:"split",value:function(e){var r=[],n=void 0!==e.events,i=new aS(e,!0),o=new aS(e,!1),s=this.rightSE;this.replaceRightSE(o),r.push(o),r.push(i);var a=new t(i,s,this.rings.slice(),this.windings.slice());return aS.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),aS.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,r=this.windings.length;e<r;e++)this.windings[e]*=-1}},{key:"consume",value:function(e){for(var r=this,n=e;r.consumedBy;)r=r.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var i=t.compare(r,n);if(0!==i){if(i>0){var o=r;r=n,n=o}if(r.prev===n){var s=r;r=n,n=s}for(var a=0,l=n.rings.length;a<l;a++){var u=n.rings[a],h=n.windings[a],c=r.rings.indexOf(u);-1===c?(r.rings.push(u),r.windings.push(h)):r.windings[c]+=h}n.rings=null,n.windings=null,n.consumedBy=r,n.leftSE.consumedBy=r.leftSE,n.rightSE.consumedBy=r.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,r=this._afterState.windings,n=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],a=this.windings[i],l=e.indexOf(s);-1===l?(e.push(s),r.push(a)):r[l]+=a}for(var u=[],h=[],c=0,A=e.length;c<A;c++)if(0!==r[c]){var f=e[c],p=f.poly;if(-1===h.indexOf(p))if(f.isExterior)u.push(p);else{-1===h.indexOf(p)&&h.push(p);var d=u.indexOf(f.poly);-1!==d&&u.splice(d,1)}}for(var g=0,y=u.length;g<y;g++){var m=u[g].multiPoly;-1===n.indexOf(m)&&n.push(m)}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(vS.type){case"union":var r=0===t.length,n=0===e.length;this._isInResult=r!==n;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===vS.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(vS.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,r,n){var i,o,s,a=aS.comparePoints(e,r);if(a<0)i=e,o=r,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=r,o=e,s=-1}return new t(new aS(i,!0),new aS(o,!1),[n],[s])}}]),t}(),hS=function(){function t(e,r,n){if(HE(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=n,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=$E.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 l=$E.round(e[s][0],e[s][1]);l.x===o.x&&l.y===o.y||(this.segments.push(uS.fromRing(o,l,this)),l.x<this.bbox.ll.x&&(this.bbox.ll.x=l.x),l.y<this.bbox.ll.y&&(this.bbox.ll.y=l.y),l.x>this.bbox.ur.x&&(this.bbox.ur.x=l.x),l.y>this.bbox.ur.y&&(this.bbox.ur.y=l.y),o=l)}i.x===o.x&&i.y===o.y||this.segments.push(uS.fromRing(o,i,this))}return VE(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.segments.length;e<r;e++){var n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}]),t}(),cS=function(){function t(e,r){if(HE(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new hS(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var n=1,i=e.length;n<i;n++){var o=new hS(e[n],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}return VE(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,r=this.interiorRings.length;e<r;e++)for(var n=this.interiorRings[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),AS=function(){function t(e,r){if(HE(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(s){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var n=0,i=e.length;n<i;n++){var o=new cS(e[n],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}return VE(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++)for(var n=this.polys[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),fS=function(){function t(e){HE(this,t),this.events=e;for(var r=0,n=e.length;r<n;r++)e[r].segment.ringOut=this;this.poly=null}return VE(t,null,[{key:"factory",value:function(e){for(var r=[],n=0,i=e.length;n<i;n++){var o=e[n];if(o.isInResult()&&!o.ringOut){for(var s=null,a=o.leftSE,l=o.rightSE,u=[a],h=a.point,c=[];s=a,a=l,u.push(a),a.point!==h;)for(;;){var A=a.getAvailableLinkedEvents();if(0===A.length){var f=u[0].point,p=u[u.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(f.x,",")+" ".concat(f.y,"]. Last matching segment found ends at")+" [".concat(p.x,", ").concat(p.y,"]."))}if(1===A.length){l=A[0].otherSE;break}for(var d=null,g=0,y=c.length;g<y;g++)if(c[g].point===a.point){d=g;break}if(null===d){c.push({index:u.length,point:a.point});var m=a.getLeftmostComparator(s);l=A.sort(m)[0].otherSE;break}var v=c.splice(d)[0],_=u.splice(v.index);_.unshift(_[0].otherSE),r.push(new t(_.reverse()))}r.push(new t(u))}}return r}}]),VE(t,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],r=1,n=this.events.length-1;r<n;r++){var i=this.events[r].point,o=this.events[r+1].point;0!==rS(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],a=e[1];0===rS(s,t,a)&&e.shift(),e.push(e[0]);for(var l=this.isExteriorRing()?1:-1,u=this.isExteriorRing()?0:e.length-1,h=this.isExteriorRing()?e.length:-1,c=[],A=u;A!=h;A+=l)c.push([e[A].x,e[A].y]);return c}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,r=this.events.length;e<r;e++){var n=this.events[e];aS.compare(t,n)>0&&(t=n)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),pS=function(){function t(e){HE(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return VE(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,r=this.interiorRings.length;e<r;e++){var n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}]),t}(),dS=function(){function t(e){HE(this,t),this.rings=e,this.polys=this._composePolys(e)}return VE(t,[{key:"getGeom",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++){var n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}},{key:"_composePolys",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];if(!i.poly)if(i.isExteriorRing())e.push(new pS(i));else{var o=i.enclosingRing();o.poly||e.push(new pS(o)),o.poly.addInterior(i)}}return e}}]),t}(),gS=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:uS.compare;HE(this,t),this.queue=e,this.tree=new DE(r),this.segments=[]}return VE(t,[{key:"process",value:function(t){var e=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),r;var n=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!n)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=n,o=n,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){var l=null;if(s){var u=s.getIntersection(e);if(null!==u&&(e.isAnEndpoint(u)||(l=u),!s.isAnEndpoint(u)))for(var h=this._splitSafely(s,u),c=0,A=h.length;c<A;c++)r.push(h[c])}var f=null;if(a){var p=a.getIntersection(e);if(null!==p&&(e.isAnEndpoint(p)||(f=p),!a.isAnEndpoint(p)))for(var d=this._splitSafely(a,p),g=0,y=d.length;g<y;g++)r.push(d[g])}if(null!==l||null!==f){var m;m=null===l?f:null===f||aS.comparePoints(l,f)<=0?l:f,this.queue.remove(e.rightSE),r.push(e.rightSE);for(var v=e.split(m),_=0,w=v.length;_<w;_++)r.push(v[_])}r.length>0?(this.tree.remove(e),r.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){var b=s.getIntersection(a);if(null!==b){if(!s.isAnEndpoint(b))for(var x=this._splitSafely(s,b),C=0,E=x.length;C<E;C++)r.push(x[C]);if(!a.isAnEndpoint(b))for(var S=this._splitSafely(a,b),B=0,I=S.length;B<I;B++)r.push(S[B])}}this.tree.remove(e)}return r}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var r=t.rightSE;this.queue.remove(r);var n=t.split(e);return n.push(r),void 0===t.consumedBy&&this.tree.insert(t),n}}]),t}(),yS="undefined"!=typeof process&&{}.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,mS="undefined"!=typeof process&&{}.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,vS=new(function(){function t(){HE(this,t)}return VE(t,[{key:"run",value:function(t,e,r){vS.type=t,$E.reset();for(var n=[new AS(e,!0)],i=0,o=r.length;i<o;i++)n.push(new AS(r[i],!1));if(vS.numMultiPolys=n.length,"difference"===vS.type)for(var s=n[0],a=1;a<n.length;)null!==qE(n[a].bbox,s.bbox)?a++:n.splice(a,1);if("intersection"===vS.type)for(var l=0,u=n.length;l<u;l++)for(var h=n[l],c=l+1,A=n.length;c<A;c++)if(null===qE(h.bbox,n[c].bbox))return[];for(var f=new DE(aS.compare),p=0,d=n.length;p<d;p++)for(var g=n[p].getSweepEvents(),y=0,m=g.length;y<m;y++)if(f.insert(g[y]),f.size>yS)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var v=new gS(f),_=f.size,w=f.pop();w;){var b=w.key;if(f.size===_){var x=b.segment;throw new Error("Unable to pop() ".concat(b.isLeft?"left":"right"," SweepEvent ")+"[".concat(b.point.x,", ").concat(b.point.y,"] from segment #").concat(x.id," ")+"[".concat(x.leftSE.point.x,", ").concat(x.leftSE.point.y,"] -> ")+"[".concat(x.rightSE.point.x,", ").concat(x.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(f.size>yS)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(v.segments.length>mS)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var C=v.process(b),E=0,S=C.length;E<S;E++){var B=C[E];void 0===B.consumedBy&&f.insert(B)}_=f.size,w=f.pop()}$E.reset();var I=fS.factory(v.segments);return new dS(I).getGeom()}}]),t}()),_S={union:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return vS.run("union",t,r)},intersection:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return vS.run("intersection",t,r)},xor:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return vS.run("xor",t,r)},difference:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return vS.run("difference",t,r)}};const wS=_S;"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(null==this)throw new TypeError(this+" is not an object");var e=Object(this),r=Math.max(Math.min(e.length,9007199254740991),0)||0,n=1 in arguments&&parseInt(Number(arguments[1]),10)||0;n=n<0?Math.max(r+n,0):Math.min(n,r);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:r;for(i=i<0?Math.max(r+arguments[2],0):Math.min(i,r);n<i;)e[n]=t,++n;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var bS=function(){};bS.prototype.interfaces_=function(){return[]},bS.prototype.getClass=function(){return bS},bS.prototype.equalsWithTolerance=function(t,e,r){return Math.abs(t-e)<=r};var xS=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),CS=function(){},ES={MAX_VALUE:{configurable:!0}};CS.isNaN=function(t){return Number.isNaN(t)},CS.doubleToLongBits=function(t){return t},CS.longBitsToDouble=function(t){return t},CS.isInfinite=function(t){return!Number.isFinite(t)},ES.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(CS,ES);var SS=function(){},BS=function(){},IS=function(){};function TS(){}var PS=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])},FS={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};PS.prototype.setOrdinate=function(t,e){switch(t){case PS.X:this.x=e;break;case PS.Y:this.y=e;break;case PS.Z:this.z=e;break;default:throw new xS("Invalid ordinate index: "+t)}},PS.prototype.equals2D=function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!bS.equalsWithTolerance(this.x,e.x,r)&&!!bS.equalsWithTolerance(this.y,e.y,r)}},PS.prototype.getOrdinate=function(t){switch(t){case PS.X:return this.x;case PS.Y:return this.y;case PS.Z:return this.z}throw new xS("Invalid ordinate index: "+t)},PS.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||CS.isNaN(this.z))&&CS.isNaN(t.z)},PS.prototype.equals=function(t){return t instanceof PS&&this.equals2D(t)},PS.prototype.equalInZ=function(t,e){return bS.equalsWithTolerance(this.z,t.z,e)},PS.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},PS.prototype.clone=function(){},PS.prototype.copy=function(){return new PS(this)},PS.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},PS.prototype.distance3D=function(t){var e=this.x-t.x,r=this.y-t.y,n=this.z-t.z;return Math.sqrt(e*e+r*r+n*n)},PS.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},PS.prototype.hashCode=function(){var t=17;return 37*(t=37*t+PS.hashCode(this.x))+PS.hashCode(this.y)},PS.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},PS.prototype.interfaces_=function(){return[SS,BS,TS]},PS.prototype.getClass=function(){return PS},PS.hashCode=function(){if(1===arguments.length){var t=arguments[0],e=CS.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}},FS.DimensionalComparator.get=function(){return LS},FS.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},FS.NULL_ORDINATE.get=function(){return CS.NaN},FS.X.get=function(){return 0},FS.Y.get=function(){return 1},FS.Z.get=function(){return 2},Object.defineProperties(PS,FS);var LS=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 xS("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};LS.prototype.compare=function(t,e){var r=t,n=e,i=LS.compare(r.x,n.x);if(0!==i)return i;var o=LS.compare(r.y,n.y);return 0!==o?o:this._dimensionsToTest<=2?0:LS.compare(r.z,n.z)},LS.prototype.interfaces_=function(){return[IS]},LS.prototype.getClass=function(){return LS},LS.compare=function(t,e){return t<e?-1:t>e?1:CS.isNaN(t)?CS.isNaN(e)?0:-1:CS.isNaN(e)?1:0};var MS=function(){};MS.prototype.create=function(){},MS.prototype.interfaces_=function(){return[]},MS.prototype.getClass=function(){return MS};var OS=function(){},kS={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};OS.prototype.interfaces_=function(){return[]},OS.prototype.getClass=function(){return OS},OS.toLocationSymbol=function(t){switch(t){case OS.EXTERIOR:return"e";case OS.BOUNDARY:return"b";case OS.INTERIOR:return"i";case OS.NONE:return"-"}throw new xS("Unknown location value: "+t)},kS.INTERIOR.get=function(){return 0},kS.BOUNDARY.get=function(){return 1},kS.EXTERIOR.get=function(){return 2},kS.NONE.get=function(){return-1},Object.defineProperties(OS,kS);var NS=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},RS=function(){},US={LOG_10:{configurable:!0}};RS.prototype.interfaces_=function(){return[]},RS.prototype.getClass=function(){return RS},RS.log10=function(t){var e=Math.log(t);return CS.isInfinite(e)||CS.isNaN(e)?e:e/RS.LOG_10},RS.min=function(t,e,r,n){var i=t;return e<i&&(i=e),r<i&&(i=r),n<i&&(i=n),i},RS.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],r=arguments[2];return t<e?e:t>r?r:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var n=arguments[0],i=arguments[1],o=arguments[2];return n<i?i:n>o?o:n}},RS.wrap=function(t,e){return t<0?e- -t%e:t%e},RS.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[0];return t>r&&(r=t),e>r&&(r=e),r}if(4===arguments.length){var n=arguments[1],i=arguments[2],o=arguments[3],s=arguments[0];return n>s&&(s=n),i>s&&(s=i),o>s&&(s=o),s}},RS.average=function(t,e){return(t+e)/2},US.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(RS,US);var DS=function(t){this.str=t};DS.prototype.append=function(t){this.str+=t},DS.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},DS.prototype.toString=function(t){return this.str};var QS=function(t){this.value=t};QS.prototype.intValue=function(){return this.value},QS.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},QS.isNaN=function(t){return Number.isNaN(t)};var GS=function(){};GS.isWhitespace=function(t){return t<=32&&t>=0||127===t},GS.toUpperCase=function(t){return t.toUpperCase()};var jS=function t(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length)if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}else"string"==typeof arguments[0]&&t.call(this,t.parse(arguments[0]));else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n,i)}},HS={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}};jS.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},jS.prototype.extractSignificantDigits=function(t,e){var r=this.abs(),n=jS.magnitude(r._hi),i=jS.TEN.pow(n);(r=r.divide(i)).gt(jS.TEN)?(r=r.divide(jS.TEN),n+=1):r.lt(jS.ONE)&&(r=r.multiply(jS.TEN),n-=1);for(var o=n+1,s=new DS,a=jS.MAX_PRINT_DIGITS-1,l=0;l<=a;l++){t&&l===o&&s.append(".");var u=Math.trunc(r._hi);if(u<0)break;var h=!1,c=0;u>9?(h=!0,c="9"):c="0"+u,s.append(c),r=r.subtract(jS.valueOf(u)).multiply(jS.TEN),h&&r.selfAdd(jS.TEN);var A=!0,f=jS.magnitude(r._hi);if(f<0&&Math.abs(f)>=a-l&&(A=!1),!A)break}return e[0]=n,s.toString()},jS.prototype.sqr=function(){return this.multiply(this)},jS.prototype.doubleValue=function(){return this._hi+this._lo},jS.prototype.subtract=function(){if(arguments[0]instanceof jS){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},jS.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},jS.prototype.isZero=function(){return 0===this._hi&&0===this._lo},jS.prototype.selfSubtract=function(){if(arguments[0]instanceof jS){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)}},jS.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},jS.prototype.min=function(t){return this.le(t)?this:t},jS.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof jS){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var r,n,i,o,s=arguments[0],a=arguments[1],l=null,u=null,h=null,c=null;return i=this._hi/s,c=(l=(h=jS.SPLIT*i)-(l=h-i))*(u=(c=jS.SPLIT*s)-(u=c-s))-(o=i*s)+l*(n=s-u)+(r=i-l)*u+r*n,c=i+(h=(this._hi-o-c+this._lo-i*a)/s),this._hi=c,this._lo=i-c+h,this}},jS.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},jS.prototype.divide=function(){if(arguments[0]instanceof jS){var t,e,r,n,i=arguments[0],o=null,s=null,a=null,l=null;return t=(r=this._hi/i._hi)-(o=(a=jS.SPLIT*r)-(o=a-r)),l=o*(s=(l=jS.SPLIT*i._hi)-(s=l-i._hi))-(n=r*i._hi)+o*(e=i._hi-s)+t*s+t*e,a=(this._hi-n-l+this._lo-r*i._lo)/i._hi,new jS(l=r+a,r-l+a)}if("number"==typeof arguments[0]){var u=arguments[0];return CS.isNaN(u)?jS.createNaN():jS.copy(this).selfDivide(u,0)}},jS.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},jS.prototype.pow=function(t){if(0===t)return jS.valueOf(1);var e=new jS(this),r=jS.valueOf(1),n=Math.abs(t);if(n>1)for(;n>0;)n%2==1&&r.selfMultiply(e),(n/=2)>0&&(e=e.sqr());else r=e;return t<0?r.reciprocal():r},jS.prototype.ceil=function(){if(this.isNaN())return jS.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new jS(t,e)},jS.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},jS.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},jS.prototype.setValue=function(){if(arguments[0]instanceof jS){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},jS.prototype.max=function(t){return this.ge(t)?this:t},jS.prototype.sqrt=function(){if(this.isZero())return jS.valueOf(0);if(this.isNegative())return jS.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,r=jS.valueOf(e),n=this.subtract(r.sqr())._hi*(.5*t);return r.add(n)},jS.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof jS){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,r,n,i,o,s=arguments[0],a=null;return a=(n=this._hi+s)-(i=n-this._hi),r=(o=(a=s-i+(this._hi-a))+this._lo)+(n-(e=n+o)),this._hi=e+r,this._lo=r+(e-this._hi),this}}else if(2===arguments.length){var l,u,h,c,A=arguments[0],f=arguments[1],p=null,d=null,g=null;h=this._hi+A,u=this._lo+f,d=h-(g=h-this._hi),p=u-(c=u-this._lo);var y=(l=h+(g=(d=A-g+(this._hi-d))+u))+(g=(p=f-c+(this._lo-p))+(g+(h-l))),m=g+(l-y);return this._hi=y,this._lo=m,this}},jS.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof jS){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var r,n,i=arguments[0],o=arguments[1],s=null,a=null,l=null,u=null;s=(l=jS.SPLIT*this._hi)-this._hi,u=jS.SPLIT*i,s=l-s,r=this._hi-s,a=u-i;var h=(l=this._hi*i)+(u=s*(a=u-a)-l+s*(n=i-a)+r*a+r*n+(this._hi*o+this._lo*i)),c=u+(s=l-h);return this._hi=h,this._lo=c,this}},jS.prototype.selfSqr=function(){return this.selfMultiply(this)},jS.prototype.floor=function(){if(this.isNaN())return jS.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new jS(t,e)},jS.prototype.negate=function(){return this.isNaN()?this:new jS(-this._hi,-this._lo)},jS.prototype.clone=function(){},jS.prototype.multiply=function(){if(arguments[0]instanceof jS){var t=arguments[0];return t.isNaN()?jS.createNaN():jS.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return CS.isNaN(e)?jS.createNaN():jS.copy(this).selfMultiply(e,0)}},jS.prototype.isNaN=function(){return CS.isNaN(this._hi)},jS.prototype.intValue=function(){return Math.trunc(this._hi)},jS.prototype.toString=function(){var t=jS.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},jS.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!0,e),n=e[0]+1,i=r;if("."===r.charAt(0))i="0"+r;else if(n<0)i="0."+jS.stringOfChar("0",-n)+r;else if(-1===r.indexOf(".")){var o=n-r.length;i=r+jS.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},jS.prototype.reciprocal=function(){var t,e,r,n,i=null,o=null,s=null,a=null;t=(r=1/this._hi)-(i=(s=jS.SPLIT*r)-(i=s-r)),o=(a=jS.SPLIT*this._hi)-this._hi;var l=r+(s=(1-(n=r*this._hi)-(a=i*(o=a-o)-n+i*(e=this._hi-o)+t*o+t*e)-r*this._lo)/this._hi);return new jS(l,r-l+s)},jS.prototype.toSciNotation=function(){if(this.isZero())return jS.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!1,e),n=jS.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===r.charAt(0))throw new Error("Found leading zero: "+r);var i="";r.length>1&&(i=r.substring(1));var o=r.charAt(0)+"."+i;return this.isNegative()?"-"+o+n:o+n},jS.prototype.abs=function(){return this.isNaN()?jS.NaN:this.isNegative()?this.negate():new jS(this)},jS.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},jS.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},jS.prototype.add=function(){if(arguments[0]instanceof jS){var t=arguments[0];return jS.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return jS.copy(this).selfAdd(e)}},jS.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 jS){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._hi=r,this._lo=n}},jS.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},jS.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},jS.prototype.trunc=function(){return this.isNaN()?jS.NaN:this.isPositive()?this.floor():this.ceil()},jS.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},jS.prototype.interfaces_=function(){return[TS,SS,BS]},jS.prototype.getClass=function(){return jS},jS.sqr=function(t){return jS.valueOf(t).selfMultiply(t)},jS.valueOf=function(){if("string"==typeof arguments[0]){var t=arguments[0];return jS.parse(t)}if("number"==typeof arguments[0])return new jS(arguments[0])},jS.sqrt=function(t){return jS.valueOf(t).sqrt()},jS.parse=function(t){for(var e=0,r=t.length;GS.isWhitespace(t.charAt(e));)e++;var n=!1;if(e<r){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(n=!0))}for(var o=new jS,s=0,a=0,l=0;!(e>=r);){var u=t.charAt(e);if(e++,GS.isDigit(u)){var h=u-"0";o.selfMultiply(jS.TEN),o.selfAdd(h),s++}else{if("."!==u){if("e"===u||"E"===u){var c=t.substring(e);try{l=QS.parseInt(c)}catch(g){throw g instanceof Error?new Error("Invalid exponent "+c+" in string "+t):g}break}throw new Error("Unexpected character '"+u+"' at position "+e+" in string "+t)}a=s}}var A=o,f=s-a-l;if(0===f)A=o;else if(f>0){var p=jS.TEN.pow(f);A=o.divide(p)}else if(f<0){var d=jS.TEN.pow(-f);A=o.multiply(d)}return n?A.negate():A},jS.createNaN=function(){return new jS(CS.NaN,CS.NaN)},jS.copy=function(t){return new jS(t)},jS.magnitude=function(t){var e=Math.abs(t),r=Math.log(e)/Math.log(10),n=Math.trunc(Math.floor(r));return 10*Math.pow(10,n)<=e&&(n+=1),n},jS.stringOfChar=function(t,e){for(var r=new DS,n=0;n<e;n++)r.append(t);return r.toString()},HS.PI.get=function(){return new jS(3.141592653589793,12246467991473532e-32)},HS.TWO_PI.get=function(){return new jS(6.283185307179586,24492935982947064e-32)},HS.PI_2.get=function(){return new jS(1.5707963267948966,6123233995736766e-32)},HS.E.get=function(){return new jS(2.718281828459045,14456468917292502e-32)},HS.NaN.get=function(){return new jS(CS.NaN,CS.NaN)},HS.EPS.get=function(){return 123259516440783e-46},HS.SPLIT.get=function(){return 134217729},HS.MAX_PRINT_DIGITS.get=function(){return 32},HS.TEN.get=function(){return jS.valueOf(10)},HS.ONE.get=function(){return jS.valueOf(1)},HS.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},HS.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(jS,HS);var zS=function(){},VS={DP_SAFE_EPSILON:{configurable:!0}};zS.prototype.interfaces_=function(){return[]},zS.prototype.getClass=function(){return zS},zS.orientationIndex=function(t,e,r){var n=zS.orientationIndexFilter(t,e,r);if(n<=1)return n;var i=jS.valueOf(e.x).selfAdd(-t.x),o=jS.valueOf(e.y).selfAdd(-t.y),s=jS.valueOf(r.x).selfAdd(-e.x),a=jS.valueOf(r.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},zS.signOfDet2x2=function(t,e,r,n){return t.multiply(n).selfSubtract(e.multiply(r)).signum()},zS.intersection=function(t,e,r,n){var i=jS.valueOf(n.y).selfSubtract(r.y).selfMultiply(jS.valueOf(e.x).selfSubtract(t.x)),o=jS.valueOf(n.x).selfSubtract(r.x).selfMultiply(jS.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=jS.valueOf(n.x).selfSubtract(r.x).selfMultiply(jS.valueOf(t.y).selfSubtract(r.y)),l=jS.valueOf(n.y).selfSubtract(r.y).selfMultiply(jS.valueOf(t.x).selfSubtract(r.x)),u=a.subtract(l).selfDivide(s).doubleValue(),h=jS.valueOf(t.x).selfAdd(jS.valueOf(e.x).selfSubtract(t.x).selfMultiply(u)).doubleValue(),c=jS.valueOf(e.x).selfSubtract(t.x).selfMultiply(jS.valueOf(t.y).selfSubtract(r.y)),A=jS.valueOf(e.y).selfSubtract(t.y).selfMultiply(jS.valueOf(t.x).selfSubtract(r.x)),f=c.subtract(A).selfDivide(s).doubleValue(),p=jS.valueOf(r.y).selfAdd(jS.valueOf(n.y).selfSubtract(r.y).selfMultiply(f)).doubleValue();return new PS(h,p)},zS.orientationIndexFilter=function(t,e,r){var n=null,i=(t.x-r.x)*(e.y-r.y),o=(t.y-r.y)*(e.x-r.x),s=i-o;if(i>0){if(o<=0)return zS.signum(s);n=i+o}else{if(!(i<0))return zS.signum(s);if(o>=0)return zS.signum(s);n=-i-o}var a=zS.DP_SAFE_EPSILON*n;return s>=a||-s>=a?zS.signum(s):2},zS.signum=function(t){return t>0?1:t<0?-1:0},VS.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(zS,VS);var KS=function(){},qS={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};qS.X.get=function(){return 0},qS.Y.get=function(){return 1},qS.Z.get=function(){return 2},qS.M.get=function(){return 3},KS.prototype.setOrdinate=function(t,e,r){},KS.prototype.size=function(){},KS.prototype.getOrdinate=function(t,e){},KS.prototype.getCoordinate=function(){},KS.prototype.getCoordinateCopy=function(t){},KS.prototype.getDimension=function(){},KS.prototype.getX=function(t){},KS.prototype.clone=function(){},KS.prototype.expandEnvelope=function(t){},KS.prototype.copy=function(){},KS.prototype.getY=function(t){},KS.prototype.toCoordinateArray=function(){},KS.prototype.interfaces_=function(){return[BS]},KS.prototype.getClass=function(){return KS},Object.defineProperties(KS,qS);var WS=function(){},XS=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}(WS),YS=function(){};YS.arraycopy=function(t,e,r,n,i){for(var o=0,s=e;s<e+i;s++)r[n+o]=t[s],o++},YS.getProperty=function(t){return{"line.separator":"\n"}[t]};var ZS=function t(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this.x=r,this.y=n,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof PS&&arguments[1]instanceof PS){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 l=arguments[0],u=arguments[1],h=arguments[2];this.x=l,this.y=u,this.w=h}else if(4===arguments.length){var c=arguments[0],A=arguments[1],f=arguments[2],p=arguments[3],d=c.y-A.y,g=A.x-c.x,y=c.x*A.y-A.x*c.y,m=f.y-p.y,v=p.x-f.x,_=f.x*p.y-p.x*f.y;this.x=g*_-v*y,this.y=m*y-d*_,this.w=d*v-m*g}};ZS.prototype.getY=function(){var t=this.y/this.w;if(CS.isNaN(t)||CS.isInfinite(t))throw new XS;return t},ZS.prototype.getX=function(){var t=this.x/this.w;if(CS.isNaN(t)||CS.isInfinite(t))throw new XS;return t},ZS.prototype.getCoordinate=function(){var t=new PS;return t.x=this.getX(),t.y=this.getY(),t},ZS.prototype.interfaces_=function(){return[]},ZS.prototype.getClass=function(){return ZS},ZS.intersection=function(t,e,r,n){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=r.y-n.y,l=n.x-r.x,u=r.x*n.y-n.x*r.y,h=i*l-a*o,c=(o*u-l*s)/h,A=(a*s-i*u)/h;if(CS.isNaN(c)||CS.isInfinite(c)||CS.isNaN(A)||CS.isInfinite(A))throw new XS;return new PS(c,A)};var JS=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 PS){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],l=arguments[3];this.init(o,s,a,l)}},$S={serialVersionUID:{configurable:!0}};JS.prototype.getArea=function(){return this.getWidth()*this.getHeight()},JS.prototype.equals=function(t){if(!(t instanceof JS))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()},JS.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new JS;var e=this._minx>t._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny,n=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new JS(e,n,r,i)},JS.prototype.isNull=function(){return this._maxx<this._minx},JS.prototype.getMaxX=function(){return this._maxx},JS.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof PS){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof JS){var e=arguments[0];return!this.isNull()&&!e.isNull()&&e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&r>=this._minx&&r<=this._maxx&&n>=this._miny&&n<=this._maxy}},JS.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof JS){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 PS){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&!(r>this._maxx||r<this._minx||n>this._maxy||n<this._miny)}},JS.prototype.getMinY=function(){return this._miny},JS.prototype.getMinX=function(){return this._minx},JS.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof PS){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof JS){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=n,this._maxy=n):(r<this._minx&&(this._minx=r),r>this._maxx&&(this._maxx=r),n<this._miny&&(this._miny=n),n>this._maxy&&(this._maxy=n))}},JS.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},JS.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},JS.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},JS.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},JS.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},JS.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},JS.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},JS.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},JS.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},JS.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof JS){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof PS){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.covers(r,n)}},JS.prototype.centre=function(){return this.isNull()?null:new PS((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},JS.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof PS){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof JS){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.init(r.x,n.x,r.y,n.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];i<o?(this._minx=i,this._maxx=o):(this._minx=o,this._maxx=i),s<a?(this._miny=s,this._maxy=a):(this._miny=a,this._maxy=s)}},JS.prototype.getMaxY=function(){return this._maxy},JS.prototype.distance=function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var r=0;return this._maxy<t._miny?r=t._miny-this._maxy:this._miny>t._maxy&&(r=this._miny-t._maxy),0===e?r:0===r?e:Math.sqrt(e*e+r*r)},JS.prototype.hashCode=function(){var t=17;return 37*(t=37*(t=37*(t=37*t+PS.hashCode(this._minx))+PS.hashCode(this._maxx))+PS.hashCode(this._miny))+PS.hashCode(this._maxy)},JS.prototype.interfaces_=function(){return[SS,TS]},JS.prototype.getClass=function(){return JS},JS.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2];return r.x>=(t.x<e.x?t.x:e.x)&&r.x<=(t.x>e.x?t.x:e.x)&&r.y>=(t.y<e.y?t.y:e.y)&&r.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),l=Math.max(o.x,s.x),u=Math.min(n.x,i.x),h=Math.max(n.x,i.x);return!(u>l||h<a||(a=Math.min(o.y,s.y),l=Math.max(o.y,s.y),u=Math.min(n.y,i.y),h=Math.max(n.y,i.y),u>l||h<a))}},$S.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(JS,$S);var tB={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*$/},eB=function(t){this.geometryFactory=t||new GI};eB.prototype.read=function(t){var e,r,n;t=t.replace(/[\n\r]/g," ");var i=tB.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=tB.emptyTypeStr.exec(t))[2]=void 0),i&&(r=i[1].toLowerCase(),n=i[2],nB[r]&&(e=nB[r].apply(this,[n]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},eB.prototype.write=function(t){return this.extractGeometry(t)},eB.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!rB[e])return null;var r=e.toUpperCase();return t.isEmpty()?r+" EMPTY":r+"("+rB[e].apply(this,[t])+")"};var rB={coordinate:function(t){return t.x+" "+t.y},point:function(t){return rB.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+rB.point.apply(this,[t._geometries[r]])+")");return e.join(",")},linestring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(rB.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},linearring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(rB.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},multilinestring:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+rB.linestring.apply(this,[t._geometries[r]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+rB.linestring.apply(this,[t._shell])+")");for(var r=0,n=t._holes.length;r<n;++r)e.push("("+rB.linestring.apply(this,[t._holes[r]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+rB.polygon.apply(this,[t._geometries[r]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push(this.extractGeometry(t._geometries[r]));return e.join(",")}},nB={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(tB.spaces);return this.geometryFactory.createPoint(new PS(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPoint();for(var r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(tB.trimParens,"$1"),n.push(nB.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(n)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(tB.spaces),n.push(new PS(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(n)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(tB.spaces),n.push(new PS(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(n)},multilinestring:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiLineString();for(var r=t.trim().split(tB.parenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(tB.trimParens,"$1"),n.push(nB.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(n)},polygon:function(t){var e,r,n;if(void 0===t)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(tB.parenComma),s=[],a=0,l=o.length;a<l;++a)e=o[a].replace(tB.trimParens,"$1"),r=nB.linestring.apply(this,[e]),n=this.geometryFactory.createLinearRing(r._points),0===a?i=n:s.push(n);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var r=t.trim().split(tB.doubleParenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(tB.trimParens,"$1"),n.push(nB.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(n)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),r=[],n=0,i=e.length;n<i;++n)r.push(this.read(e[n]));return this.geometryFactory.createGeometryCollection(r)}},iB=function(t){this.parser=new eB(t)};iB.prototype.write=function(t){return this.parser.write(t)},iB.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var oB=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),sB=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}(oB),aB=function(){};aB.prototype.interfaces_=function(){return[]},aB.prototype.getClass=function(){return aB},aB.shouldNeverReachHere=function(){if(0===arguments.length)aB.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new sB("Should never reach here"+(null!==t?": "+t:""))}},aB.isTrue=function(){var t,e;if(1===arguments.length)t=arguments[0],aB.isTrue(t,null);else if(2===arguments.length&&(e=arguments[1],!(t=arguments[0])))throw null===e?new sB:new sB(e)},aB.equals=function(){var t,e,r;if(2===arguments.length)t=arguments[0],e=arguments[1],aB.equals(t,e,null);else if(3===arguments.length&&(t=arguments[0],r=arguments[2],!(e=arguments[1]).equals(t)))throw new sB("Expected "+t+" but encountered "+e+(null!==r?": "+r:""))};var lB=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 PS,this._intPt[1]=new PS,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},uB={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};lB.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},lB.prototype.getTopologySummary=function(){var t=new DS;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},lB.prototype.computeIntersection=function(t,e,r,n){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=r,this._inputLines[1][1]=n,this._result=this.computeIntersect(t,e,r,n)},lB.prototype.getIntersectionNum=function(){return this._result},lB.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)}},lB.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},lB.prototype.setPrecisionModel=function(t){this._precisionModel=t},lB.prototype.isInteriorIntersection=function(){var t=this;if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var e=arguments[0],r=0;r<this._result;r++)if(!t._intPt[r].equals2D(t._inputLines[e][0])&&!t._intPt[r].equals2D(t._inputLines[e][1]))return!0;return!1}},lB.prototype.getIntersection=function(t){return this._intPt[t]},lB.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},lB.prototype.hasIntersection=function(){return this._result!==lB.NO_INTERSECTION},lB.prototype.getEdgeDistance=function(t,e){return lB.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},lB.prototype.isCollinear=function(){return this._result===lB.COLLINEAR_INTERSECTION},lB.prototype.toString=function(){return iB.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+iB.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},lB.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},lB.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},lB.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},lB.prototype.interfaces_=function(){return[]},lB.prototype.getClass=function(){return lB},lB.computeEdgeDistance=function(t,e,r){var n=Math.abs(r.x-e.x),i=Math.abs(r.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(r))o=n>i?n:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=n>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return aB.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},lB.nonRobustComputeEdgeDistance=function(t,e,r){var n=t.x-e.x,i=t.y-e.y,o=Math.sqrt(n*n+i*i);return aB.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},uB.DONT_INTERSECT.get=function(){return 0},uB.DO_INTERSECT.get=function(){return 1},uB.COLLINEAR.get=function(){return 2},uB.NO_INTERSECTION.get=function(){return 0},uB.POINT_INTERSECTION.get=function(){return 1},uB.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(lB,uB);var hB=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 JS(this._inputLines[0][0],this._inputLines[0][1]),r=new JS(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&r.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],r=arguments[1],n=arguments[2];if(this._isProper=!1,JS.intersects(r,n,e)&&0===fB.orientationIndex(r,n,e)&&0===fB.orientationIndex(n,r,e))return this._isProper=!0,(e.equals(r)||e.equals(n))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,r,n,i){i.x=this.smallestInAbsValue(t.x,e.x,r.x,n.x),i.y=this.smallestInAbsValue(t.y,e.y,r.y,n.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,r,n,i){var o=null;try{o=ZS.intersection(t,r,n,i)}catch(UW){if(!(UW instanceof XS))throw UW;o=e.nearestEndpoint(t,r,n,i)}return o},e.prototype.intersection=function(t,r,n,i){var o=this.intersectionWithNormalization(t,r,n,i);return this.isInSegmentEnvelopes(o)||(o=new PS(e.nearestEndpoint(t,r,n,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,r,n){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(r)<o&&(i=r,o=Math.abs(r)),Math.abs(n)<o&&(i=n),i},e.prototype.checkDD=function(t,e,r,n,i){var o=zS.intersection(t,e,r,n),s=this.isInSegmentEnvelopes(o);YS.out.println("DD in env = "+s+" --------------------- "+o),i.distance(o)>1e-4&&YS.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,r,n){var i=new PS(t),o=new PS(e),s=new PS(r),a=new PS(n),l=new PS;this.normalizeToEnvCentre(i,o,s,a,l);var u=this.safeHCoordinateIntersection(i,o,s,a);return u.x+=l.x,u.y+=l.y,u},e.prototype.computeCollinearIntersection=function(e,r,n,i){var o=JS.intersects(e,r,n),s=JS.intersects(e,r,i),a=JS.intersects(n,i,e),l=JS.intersects(n,i,r);return o&&s?(this._intPt[0]=n,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&l?(this._intPt[0]=e,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||s||l?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&l?(this._intPt[0]=n,this._intPt[1]=r,!n.equals(r)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||l?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&l?(this._intPt[0]=i,this._intPt[1]=r,!i.equals(r)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,r,n,i){var o=t.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,l=t.y>e.y?t.y:e.y,u=r.x<n.x?r.x:n.x,h=r.y<n.y?r.y:n.y,c=r.x>n.x?r.x:n.x,A=r.y>n.y?r.y:n.y,f=((o>u?o:u)+(a<c?a:c))/2,p=((s>h?s:h)+(l<A?l:A))/2;i.x=f,i.y=p,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.computeIntersect=function(e,r,n,i){if(this._isProper=!1,!JS.intersects(e,r,n,i))return t.NO_INTERSECTION;var o=fB.orientationIndex(e,r,n),s=fB.orientationIndex(e,r,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=fB.orientationIndex(n,i,e),l=fB.orientationIndex(n,i,r);return a>0&&l>0||a<0&&l<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===l?this.computeCollinearIntersection(e,r,n,i):(0===o||0===s||0===a||0===l?(this._isProper=!1,e.equals2D(n)||e.equals2D(i)?this._intPt[0]=e:r.equals2D(n)||r.equals2D(i)?this._intPt[0]=r:0===o?this._intPt[0]=new PS(n):0===s?this._intPt[0]=new PS(i):0===a?this._intPt[0]=new PS(e):0===l&&(this._intPt[0]=new PS(r))):(this._isProper=!0,this._intPt[0]=this.intersection(e,r,n,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,r,n){var i=t,o=fB.distancePointLine(t,r,n),s=fB.distancePointLine(e,r,n);return s<o&&(o=s,i=e),(s=fB.distancePointLine(r,t,e))<o&&(o=s,i=r),(s=fB.distancePointLine(n,t,e))<o&&(o=s,i=n),i},e}(lB),cB=function(){};cB.prototype.interfaces_=function(){return[]},cB.prototype.getClass=function(){return cB},cB.orientationIndex=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=r.x-e.x,s=r.y-e.y;return cB.signOfDet2x2(n,i,o,s)},cB.signOfDet2x2=function(t,e,r,n){var i=null,o=null,s=null;if(i=1,0===t||0===n)return 0===e||0===r?0:e>0?r>0?-i:i:r>0?i:-i;if(0===e||0===r)return n>0?t>0?i:-i:t>0?-i:i;if(e>0?n>0?e<=n||(i=-i,o=t,t=r,r=o,o=e,e=n,n=o):e<=-n?(i=-i,r=-r,n=-n):(o=t,t=-r,r=o,o=e,e=-n,n=o):n>0?-e<=n?(i=-i,t=-t,e=-e):(o=-t,t=r,r=o,o=-e,e=n,n=o):e>=n?(t=-t,e=-e,r=-r,n=-n):(i=-i,o=-t,t=-r,r=o,o=-e,e=-n,n=o),t>0){if(!(r>0))return i;if(!(t<=r))return i}else{if(r>0)return-i;if(!(t>=r))return-i;i=-i,t=-t,r=-r}for(;;){if((n-=(s=Math.floor(r/t))*e)<0)return-i;if(n>e)return i;if(t>(r-=s*t)+r){if(e<n+n)return i}else{if(e>n+n)return-i;r=t-r,n=e-n,i=-i}if(0===n)return 0===r?0:-i;if(0===r)return i;if((e-=(s=Math.floor(t/r))*n)<0)return i;if(e>n)return-i;if(r>(t-=s*r)+t){if(n<e+e)return-i}else{if(n>e+e)return i;t=r-t,e=n-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var AB=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};AB.prototype.countSegment=function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var r=t.x,n=e.x;return r>n&&(r=e.x,n=t.x),this._p.x>=r&&this._p.x<=n&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,l=cB.signOfDet2x2(i,o,s,a);if(0===l)return this._isPointOnSegment=!0,null;a<o&&(l=-l),l>0&&this._crossingCount++}},AB.prototype.isPointInPolygon=function(){return this.getLocation()!==OS.EXTERIOR},AB.prototype.getLocation=function(){return this._isPointOnSegment?OS.BOUNDARY:this._crossingCount%2==1?OS.INTERIOR:OS.EXTERIOR},AB.prototype.isOnSegment=function(){return this._isPointOnSegment},AB.prototype.interfaces_=function(){return[]},AB.prototype.getClass=function(){return AB},AB.locatePointInRing=function(){if(arguments[0]instanceof PS&&NS(arguments[1],KS)){for(var t=arguments[1],e=new AB(arguments[0]),r=new PS,n=new PS,i=1;i<t.size();i++)if(t.getCoordinate(i,r),t.getCoordinate(i-1,n),e.countSegment(r,n),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof PS&&arguments[1]instanceof Array){for(var o=arguments[1],s=new AB(arguments[0]),a=1;a<o.length;a++){var l=o[a],u=o[a-1];if(s.countSegment(l,u),s.isOnSegment())return s.getLocation()}return s.getLocation()}};var fB=function(){},pB={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};fB.prototype.interfaces_=function(){return[]},fB.prototype.getClass=function(){return fB},fB.orientationIndex=function(t,e,r){return zS.orientationIndex(t,e,r)},fB.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,r=t[0].x,n=1;n<t.length-1;n++){var i=t[n].x-r,o=t[n+1].y;e+=i*(t[n-1].y-o)}return e/2}if(NS(arguments[0],KS)){var s=arguments[0],a=s.size();if(a<3)return 0;var l=new PS,u=new PS,h=new PS;s.getCoordinate(0,u),s.getCoordinate(1,h);var c=u.x;h.x-=c;for(var A=0,f=1;f<a-1;f++)l.y=u.y,u.x=h.x,u.y=h.y,s.getCoordinate(f+1,h),h.x-=c,A+=u.x*(l.y-h.y);return A/2}},fB.distanceLineLine=function(t,e,r,n){if(t.equals(e))return fB.distancePointLine(t,r,n);if(r.equals(n))return fB.distancePointLine(n,t,e);var i=!1;if(JS.intersects(t,e,r,n)){var o=(e.x-t.x)*(n.y-r.y)-(e.y-t.y)*(n.x-r.x);if(0===o)i=!0;else{var s=(t.y-r.y)*(n.x-r.x)-(t.x-r.x)*(n.y-r.y),a=((t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y))/o,l=s/o;(l<0||l>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?RS.min(fB.distancePointLine(t,r,n),fB.distancePointLine(e,r,n),fB.distancePointLine(r,t,e),fB.distancePointLine(n,t,e)):0},fB.isPointInRing=function(t,e){return fB.locatePointInRing(t,e)!==OS.EXTERIOR},fB.computeLength=function(t){var e=t.size();if(e<=1)return 0;var r=0,n=new PS;t.getCoordinate(0,n);for(var i=n.x,o=n.y,s=1;s<e;s++){t.getCoordinate(s,n);var a=n.x,l=n.y,u=a-i,h=l-o;r+=Math.sqrt(u*u+h*h),i=a,o=l}return r},fB.isCCW=function(t){var e=t.length-1;if(e<3)throw new xS("Ring has fewer than 4 points, so orientation cannot be determined");for(var r=t[0],n=0,i=1;i<=e;i++){var o=t[i];o.y>r.y&&(r=o,n=i)}var s=n;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(r)&&s!==n);var a=n;do{a=(a+1)%e}while(t[a].equals2D(r)&&a!==n);var l=t[s],u=t[a];if(l.equals2D(r)||u.equals2D(r)||l.equals2D(u))return!1;var h=fB.computeOrientation(l,r,u);return 0===h?l.x>u.x:h>0},fB.locatePointInRing=function(t,e){return AB.locatePointInRing(t,e)},fB.distancePointLinePerpendicular=function(t,e,r){var n=(r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y),i=((e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y))/n;return Math.abs(i)*Math.sqrt(n)},fB.computeOrientation=function(t,e,r){return fB.orientationIndex(t,e,r)},fB.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new xS("Line array must contain at least one vertex");for(var r=t.distance(e[0]),n=0;n<e.length-1;n++){var i=fB.distancePointLine(t,e[n],e[n+1]);i<r&&(r=i)}return r}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var l=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),u=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/l;if(u<=0)return o.distance(s);if(u>=1)return o.distance(a);var h=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/l;return Math.abs(h)*Math.sqrt(l)}},fB.isOnLine=function(t,e){for(var r=new hB,n=1;n<e.length;n++){var i=e[n-1],o=e[n];if(r.computeIntersection(t,i,o),r.hasIntersection())return!0}return!1},pB.CLOCKWISE.get=function(){return-1},pB.RIGHT.get=function(){return fB.CLOCKWISE},pB.COUNTERCLOCKWISE.get=function(){return 1},pB.LEFT.get=function(){return fB.COUNTERCLOCKWISE},pB.COLLINEAR.get=function(){return 0},pB.STRAIGHT.get=function(){return fB.COLLINEAR},Object.defineProperties(fB,pB);var dB=function(){};dB.prototype.filter=function(t){},dB.prototype.interfaces_=function(){return[]},dB.prototype.getClass=function(){return dB};var gB=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},yB={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}};gB.prototype.isGeometryCollection=function(){return this.getSortIndex()===gB.SORTINDEX_GEOMETRYCOLLECTION},gB.prototype.getFactory=function(){return this._factory},gB.prototype.getGeometryN=function(t){return this},gB.prototype.getArea=function(){return 0},gB.prototype.isRectangle=function(){return!1},gB.prototype.equals=function(){if(arguments[0]instanceof gB){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof gB))return!1;var r=e;return this.equalsExact(r)}},gB.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},gB.prototype.geometryChanged=function(){this.apply(gB.geometryChangedFilter)},gB.prototype.geometryChangedAction=function(){this._envelope=null},gB.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},gB.prototype.getLength=function(){return 0},gB.prototype.getNumGeometries=function(){return 1},gB.prototype.compareTo=function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.getSortIndex()!==r.getSortIndex()?this.getSortIndex()-r.getSortIndex():this.isEmpty()&&r.isEmpty()?0:this.isEmpty()?-1:r.isEmpty()?1:this.compareToSameClass(r,n)}},gB.prototype.getUserData=function(){return this._userData},gB.prototype.getSRID=function(){return this._SRID},gB.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},gB.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===gB.SORTINDEX_GEOMETRYCOLLECTION)throw new xS("This method does not support GeometryCollection arguments")},gB.prototype.equal=function(t,e,r){return 0===r?t.equals(e):t.distance(e)<=r},gB.prototype.norm=function(){var t=this.copy();return t.normalize(),t},gB.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},gB.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new JS(this._envelope)},gB.prototype.setSRID=function(t){this._SRID=t},gB.prototype.setUserData=function(t){this._userData=t},gB.prototype.compare=function(t,e){for(var r=t.iterator(),n=e.iterator();r.hasNext()&&n.hasNext();){var i=r.next(),o=n.next(),s=i.compareTo(o);if(0!==s)return s}return r.hasNext()?1:n.hasNext()?-1:0},gB.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},gB.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===gB.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===gB.SORTINDEX_MULTIPOINT||this.getSortIndex()===gB.SORTINDEX_MULTILINESTRING||this.getSortIndex()===gB.SORTINDEX_MULTIPOLYGON},gB.prototype.interfaces_=function(){return[BS,SS,TS]},gB.prototype.getClass=function(){return gB},gB.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},gB.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},yB.serialVersionUID.get=function(){return 0x799ea46522854c00},yB.SORTINDEX_POINT.get=function(){return 0},yB.SORTINDEX_MULTIPOINT.get=function(){return 1},yB.SORTINDEX_LINESTRING.get=function(){return 2},yB.SORTINDEX_LINEARRING.get=function(){return 3},yB.SORTINDEX_MULTILINESTRING.get=function(){return 4},yB.SORTINDEX_POLYGON.get=function(){return 5},yB.SORTINDEX_MULTIPOLYGON.get=function(){return 6},yB.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},yB.geometryChangedFilter.get=function(){return mB},Object.defineProperties(gB,yB);var mB=function(){};mB.interfaces_=function(){return[dB]},mB.filter=function(t){t.geometryChangedAction()};var vB=function(){};vB.prototype.filter=function(t){},vB.prototype.interfaces_=function(){return[]},vB.prototype.getClass=function(){return vB};var _B=function(){},wB={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}};_B.prototype.isInBoundary=function(t){},_B.prototype.interfaces_=function(){return[]},_B.prototype.getClass=function(){return _B},wB.Mod2BoundaryNodeRule.get=function(){return bB},wB.EndPointBoundaryNodeRule.get=function(){return xB},wB.MultiValentEndPointBoundaryNodeRule.get=function(){return CB},wB.MonoValentEndPointBoundaryNodeRule.get=function(){return EB},wB.MOD2_BOUNDARY_RULE.get=function(){return new bB},wB.ENDPOINT_BOUNDARY_RULE.get=function(){return new xB},wB.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new CB},wB.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new EB},wB.OGC_SFS_BOUNDARY_RULE.get=function(){return _B.MOD2_BOUNDARY_RULE},Object.defineProperties(_B,wB);var bB=function(){};bB.prototype.isInBoundary=function(t){return t%2==1},bB.prototype.interfaces_=function(){return[_B]},bB.prototype.getClass=function(){return bB};var xB=function(){};xB.prototype.isInBoundary=function(t){return t>0},xB.prototype.interfaces_=function(){return[_B]},xB.prototype.getClass=function(){return xB};var CB=function(){};CB.prototype.isInBoundary=function(t){return t>1},CB.prototype.interfaces_=function(){return[_B]},CB.prototype.getClass=function(){return CB};var EB=function(){};EB.prototype.isInBoundary=function(t){return 1===t},EB.prototype.interfaces_=function(){return[_B]},EB.prototype.getClass=function(){return EB};var SB=function(){};function BB(t){this.message=t||""}SB.prototype.add=function(){},SB.prototype.addAll=function(){},SB.prototype.isEmpty=function(){},SB.prototype.iterator=function(){},SB.prototype.size=function(){},SB.prototype.toArray=function(){},SB.prototype.remove=function(){},BB.prototype=new Error,BB.prototype.name="IndexOutOfBoundsException";var IB=function(){};IB.prototype.hasNext=function(){},IB.prototype.next=function(){},IB.prototype.remove=function(){};var TB=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}(SB);function PB(t){this.message=t||""}PB.prototype=new Error,PB.prototype.name="NoSuchElementException";var FB=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof SB&&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,SB]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var r=this.array_[t];return this.array_[t]=e,r},e.prototype.iterator=function(){return new LB(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new BB;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,r=0,n=this.array_.length;r<n;r++)if(this.array_[r]===t){this.array_.splice(r,1),e=!0;break}return e},e}(TB),LB=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 PB;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}(IB),MB=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.ensureCapacity(r.length),this.add(r,n)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={coordArrayType:{configurable:!0}};return r.coordArrayType.get=function(){return new Array(0).fill(null)},e.prototype.getCoordinate=function(t){return this.get(t)},e.prototype.addAll=function(){if(2===arguments.length){for(var e=arguments[1],r=!1,n=arguments[0].iterator();n.hasNext();)this.add(n.next(),e),r=!0;return r}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),r=0;r<this.size();r++)e.add(r,this.get(r).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){var e=this;if(1===arguments.length){var r=arguments[0];t.prototype.add.call(this,r)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1];return this.add(n,i,!0),!0}if(arguments[0]instanceof PS&&"boolean"==typeof arguments[1]){var o=arguments[0];if(!arguments[1]&&this.size()>=1&&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 l=arguments[0],u=arguments[1];if(arguments[2])for(var h=0;h<l.length;h++)e.add(l[h],u);else for(var c=l.length-1;c>=0;c--)e.add(l[c],u);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof PS){var A=arguments[0],f=arguments[1];if(!arguments[2]){var p=this.size();if(p>0){if(A>0&&this.get(A-1).equals2D(f))return null;if(A<p&&this.get(A).equals2D(f))return null}}t.prototype.add.call(this,A,f)}}else if(4===arguments.length){var d=arguments[0],g=arguments[1],y=arguments[2],m=arguments[3],v=1;y>m&&(v=-1);for(var _=y;_!==m;_+=v)e.add(d[_],g);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new PS(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,r),e}(FB),OB=function(){},kB={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};kB.ForwardComparator.get=function(){return NB},kB.BidirectionalComparator.get=function(){return RB},kB.coordArrayType.get=function(){return new Array(0).fill(null)},OB.prototype.interfaces_=function(){return[]},OB.prototype.getClass=function(){return OB},OB.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))},OB.ptNotInList=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(OB.indexOf(n,e)<0)return n}return null},OB.scroll=function(t,e){var r=OB.indexOf(e,t);if(r<0)return null;var n=new Array(t.length).fill(null);YS.arraycopy(t,r,n,0,t.length-r),YS.arraycopy(t,0,n,t.length-r,r),YS.arraycopy(n,0,t,0,t.length)},OB.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(!t[r].equals(e[r]))return!1;return!0}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];if(n===i)return!0;if(null===n||null===i)return!1;if(n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(0!==o.compare(n[s],i[s]))return!1;return!0}},OB.intersection=function(t,e){for(var r=new MB,n=0;n<t.length;n++)e.intersects(t[n])&&r.add(t[n],!0);return r.toCoordinateArray()},OB.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},OB.removeRepeatedPoints=function(t){return OB.hasRepeatedPoints(t)?new MB(t,!1).toCoordinateArray():t},OB.reverse=function(t){for(var e=t.length-1,r=Math.trunc(e/2),n=0;n<=r;n++){var i=t[n];t[n]=t[e-n],t[e-n]=i}},OB.removeNull=function(t){for(var e=0,r=0;r<t.length;r++)null!==t[r]&&e++;var n=new Array(e).fill(null);if(0===e)return n;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(n[i++]=t[o]);return n},OB.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),r=0;r<t.length;r++)e[r]=new PS(t[r]);return e}if(5===arguments.length)for(var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],l=0;l<a;l++)o[s+l]=new PS(n[i+l])},OB.isEqualReversed=function(t,e){for(var r=0;r<t.length;r++){var n=t[r],i=e[t.length-r-1];if(0!==n.compareTo(i))return!1}return!0},OB.envelope=function(t){for(var e=new JS,r=0;r<t.length;r++)e.expandToInclude(t[r]);return e},OB.toCoordinateArray=function(t){return t.toArray(OB.coordArrayType)},OB.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},OB.indexOf=function(t,e){for(var r=0;r<e.length;r++)if(t.equals(e[r]))return r;return-1},OB.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var r=t.length-1-e,n=t[e].compareTo(t[r]);if(0!==n)return n}return 1},OB.compare=function(t,e){for(var r=0;r<t.length&&r<e.length;){var n=t[r].compareTo(e[r]);if(0!==n)return n;r++}return r<e.length?-1:r<t.length?1:0},OB.minCoordinate=function(t){for(var e=null,r=0;r<t.length;r++)(null===e||e.compareTo(t[r])>0)&&(e=t[r]);return e},OB.extract=function(t,e,r){e=RS.clamp(e,0,t.length);var n=(r=RS.clamp(r,-1,t.length))-e+1;r<0&&(n=0),e>=t.length&&(n=0),r<e&&(n=0);var i=new Array(n).fill(null);if(0===n)return i;for(var o=0,s=e;s<=r;s++)i[o++]=t[s];return i},Object.defineProperties(OB,kB);var NB=function(){};NB.prototype.compare=function(t,e){var r=t,n=e;return OB.compare(r,n)},NB.prototype.interfaces_=function(){return[IS]},NB.prototype.getClass=function(){return NB};var RB=function(){};RB.prototype.compare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;var i=OB.compare(r,n);return OB.isEqualReversed(r,n)?0:i},RB.prototype.OLDcompare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;for(var i=OB.increasingDirection(r),o=OB.increasingDirection(n),s=i>0?0:r.length-1,a=o>0?0:r.length-1,l=0;l<r.length;l++){var u=r[s].compareTo(n[a]);if(0!==u)return u;s+=i,a+=o}return 0},RB.prototype.interfaces_=function(){return[IS]},RB.prototype.getClass=function(){return RB};var UB=function(){};UB.prototype.get=function(){},UB.prototype.put=function(){},UB.prototype.size=function(){},UB.prototype.values=function(){},UB.prototype.entrySet=function(){};var DB=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}(UB);function QB(t){this.message=t||""}function GB(){}QB.prototype=new Error,QB.prototype.name="OperationNotSupported",GB.prototype=new SB,GB.prototype.contains=function(){};var jB=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof SB&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++)if(this.array_[e]===t)return!0;return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new HB(this)},e}(GB),HB=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 PB;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new QB},e}(IB),zB=0;function VB(t){return null===t?zB:t.color}function KB(t){return null===t?null:t.parent}function qB(t,e){null!==t&&(t.color=e)}function WB(t){return null===t?null:t.left}function XB(t){return null===t?null:t.right}function YB(){this.root_=null,this.size_=0}YB.prototype=new DB,YB.prototype.get=function(t){for(var e=this.root_;null!==e;){var r=t.compareTo(e.key);if(r<0)e=e.left;else{if(!(r>0))return e.value;e=e.right}}return null},YB.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:zB,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var r,n,i=this.root_;do{if(r=i,(n=t.compareTo(i.key))<0)i=i.left;else{if(!(n>0)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var s={key:t,left:null,right:null,value:e,parent:r,color:zB,getValue:function(){return this.value},getKey:function(){return this.key}};return n<0?r.left=s:r.right=s,this.fixAfterInsertion(s),this.size_++,null},YB.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(KB(t)===WB(KB(KB(t)))){var r=XB(KB(KB(t)));1===VB(r)?(qB(KB(t),zB),qB(r,zB),qB(KB(KB(t)),1),t=KB(KB(t))):(t===XB(KB(t))&&(t=KB(t),e.rotateLeft(t)),qB(KB(t),zB),qB(KB(KB(t)),1),e.rotateRight(KB(KB(t))))}else{var n=WB(KB(KB(t)));1===VB(n)?(qB(KB(t),zB),qB(n,zB),qB(KB(KB(t)),1),t=KB(KB(t))):(t===WB(KB(t))&&(t=KB(t),e.rotateRight(t)),qB(KB(t),zB),qB(KB(KB(t)),1),e.rotateLeft(KB(KB(t))))}this.root_.color=zB},YB.prototype.values=function(){var t=new FB,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=YB.successor(e));)t.add(e.value);return t},YB.prototype.entrySet=function(){var t=new jB,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=YB.successor(e));)t.add(e);return t},YB.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}},YB.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}},YB.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},YB.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}for(var r=t.parent,n=t;null!==r&&n===r.right;)n=r,r=r.parent;return r},YB.prototype.size=function(){return this.size_};var ZB=function(){};function JB(){}function $B(){this.array_=[],arguments[0]instanceof SB&&this.addAll(arguments[0])}ZB.prototype.interfaces_=function(){return[]},ZB.prototype.getClass=function(){return ZB},JB.prototype=new GB,$B.prototype=new JB,$B.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++)if(0===this.array_[e].compareTo(t))return!0;return!1},$B.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,r=this.array_.length;e<r;e++)if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0;return this.array_.push(t),!0},$B.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},$B.prototype.remove=function(t){throw new QB},$B.prototype.size=function(){return this.array_.length},$B.prototype.isEmpty=function(){return 0===this.array_.length},$B.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},$B.prototype.iterator=function(){return new tI(this)};var tI=function(t){this.treeSet_=t,this.position_=0};tI.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new PB;return this.treeSet_.array_[this.position_++]},tI.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},tI.prototype.remove=function(){throw new QB};var eI=function(){};eI.sort=function(){var t,e,r,n,i=arguments[0];if(1===arguments.length)n=function(t,e){return t.compareTo(e)},i.sort(n);else if(2===arguments.length)r=arguments[1],n=function(t,e){return r.compare(t,e)},i.sort(n);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),r=arguments[3],n=function(t,e){return r.compare(t,e)},e.sort(n),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},eI.asList=function(t){for(var e=new FB,r=0,n=t.length;r<n;r++)e.add(t[r]);return e};var rI=function(){},nI={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}};nI.P.get=function(){return 0},nI.L.get=function(){return 1},nI.A.get=function(){return 2},nI.FALSE.get=function(){return-1},nI.TRUE.get=function(){return-2},nI.DONTCARE.get=function(){return-3},nI.SYM_FALSE.get=function(){return"F"},nI.SYM_TRUE.get=function(){return"T"},nI.SYM_DONTCARE.get=function(){return"*"},nI.SYM_P.get=function(){return"0"},nI.SYM_L.get=function(){return"1"},nI.SYM_A.get=function(){return"2"},rI.prototype.interfaces_=function(){return[]},rI.prototype.getClass=function(){return rI},rI.toDimensionSymbol=function(t){switch(t){case rI.FALSE:return rI.SYM_FALSE;case rI.TRUE:return rI.SYM_TRUE;case rI.DONTCARE:return rI.SYM_DONTCARE;case rI.P:return rI.SYM_P;case rI.L:return rI.SYM_L;case rI.A:return rI.SYM_A}throw new xS("Unknown dimension value: "+t)},rI.toDimensionValue=function(t){switch(GS.toUpperCase(t)){case rI.SYM_FALSE:return rI.FALSE;case rI.SYM_TRUE:return rI.TRUE;case rI.SYM_DONTCARE:return rI.DONTCARE;case rI.SYM_P:return rI.P;case rI.SYM_L:return rI.L;case rI.SYM_A:return rI.A}throw new xS("Unknown dimension symbol: "+t)},Object.defineProperties(rI,nI);var iI=function(){};iI.prototype.filter=function(t){},iI.prototype.interfaces_=function(){return[]},iI.prototype.getClass=function(){return iI};var oI=function(){};oI.prototype.filter=function(t,e){},oI.prototype.isDone=function(){},oI.prototype.isGeometryChanged=function(){},oI.prototype.interfaces_=function(){return[]},oI.prototype.getClass=function(){return oI};var sI=function(t){function e(e,r){if(t.call(this,r),this._geometries=e||[],t.hasNullElements(this._geometries))throw new xS("geometries must not contain null elements")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new JS,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries[t]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=0;r<this._geometries.length;r++)for(var n=this._geometries[r].getCoordinates(),i=0;i<n.length;i++)t[++e]=n[i];return t},e.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._geometries.length!==n._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(n._geometries[i],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();eI.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=rI.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=rI.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new $B(eI.asList(this._geometries)),r=new $B(eI.asList(t._geometries));return this.compare(e,r)}if(2===arguments.length){for(var n=arguments[1],i=arguments[0],o=this.getNumGeometries(),s=i.getNumGeometries(),a=0;a<o&&a<s;){var l=this.getGeometryN(a),u=i.getGeometryN(a),h=l.compareToSameClass(u,n);if(0!==h)return h;a++}return a<o?1:a<s?-1:0}},e.prototype.apply=function(){var t=this;if(NS(arguments[0],vB))for(var e=arguments[0],r=0;r<this._geometries.length;r++)t._geometries[r].apply(e);else if(NS(arguments[0],oI)){var n=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(t._geometries[i].apply(n),!n.isDone());i++);n.isGeometryChanged()&&this.geometryChanged()}else if(NS(arguments[0],iI)){var o=arguments[0];o.filter(this);for(var s=0;s<this._geometries.length;s++)t._geometries[s].apply(o)}else if(NS(arguments[0],dB)){var a=arguments[0];a.filter(this);for(var l=0;l<this._geometries.length;l++)t._geometries[l].apply(a)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),aB.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var r=0;r<this._geometries.length;r++)e._geometries[r]=this._geometries[r].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,r),e}(gB),aI=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return gB.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?rI.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[t-1-r]=this._geometries[r].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new lI(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[ZB]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,r),e}(sI),lI=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=_B.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._geom=r,this._geomFact=r.getFactory(),this._bnRule=n}};lI.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)},lI.prototype.getBoundary=function(){return this._geom instanceof vI?this.boundaryLineString(this._geom):this._geom instanceof aI?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},lI.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()])},lI.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},lI.prototype.computeBoundaryCoordinates=function(t){var e=this,r=new FB;this._endpointMap=new YB;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);0!==i.getNumPoints()&&(e.addEndpoint(i.getCoordinateN(0)),e.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var o=this._endpointMap.entrySet().iterator();o.hasNext();){var s=o.next(),a=s.getValue().count;e._bnRule.isInBoundary(a)&&r.add(s.getKey())}return OB.toCoordinateArray(r)},lI.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new uI,this._endpointMap.put(t,e)),e.count++},lI.prototype.interfaces_=function(){return[]},lI.prototype.getClass=function(){return lI},lI.getBoundary=function(){return 1===arguments.length?new lI(arguments[0]).getBoundary():2===arguments.length?new lI(arguments[0],arguments[1]).getBoundary():void 0};var uI=function(){this.count=null};function hI(){}function cI(){}uI.prototype.interfaces_=function(){return[]},uI.prototype.getClass=function(){return uI};var AI=function(){};function fI(){}function pI(){}function dI(){}var gI=function(){},yI={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};gI.prototype.interfaces_=function(){return[]},gI.prototype.getClass=function(){return gI},gI.chars=function(t,e){for(var r=new Array(e).fill(null),n=0;n<e;n++)r[n]=t;return String(r)},gI.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new fI,r=new hI;return t.printStackTrace(r),e.toString()}if(2===arguments.length){var n=arguments[0],i=arguments[1],o="";new cI(gI.getStackTrace(n));for(var s=new dI,a=0;a<i;a++)try{o+=s.readLine()+gI.NEWLINE}catch(UW){if(!(UW instanceof pI))throw UW;aB.shouldNeverReachHere()}return o}},gI.split=function(t,e){for(var r=e.length,n=new FB,i=""+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);n.add(s),o=(i=i.substring(o+r)).indexOf(e)}i.length>0&&n.add(i);for(var a=new Array(n.size()).fill(null),l=0;l<a.length;l++)a[l]=n.get(l);return a},gI.toString=function(){if(1===arguments.length){var t=arguments[0];return gI.SIMPLE_ORDINATE_FORMAT.format(t)}},gI.spaces=function(t){return gI.chars(" ",t)},yI.NEWLINE.get=function(){return YS.getProperty("line.separator")},yI.SIMPLE_ORDINATE_FORMAT.get=function(){return new AI},Object.defineProperties(gI,yI);var mI=function(){};mI.prototype.interfaces_=function(){return[]},mI.prototype.getClass=function(){return mI},mI.copyCoord=function(t,e,r,n){for(var i=Math.min(t.getDimension(),r.getDimension()),o=0;o<i;o++)r.setOrdinate(n,o,t.getOrdinate(e,o))},mI.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&t.getOrdinate(0,KS.X)===t.getOrdinate(e-1,KS.X)&&t.getOrdinate(0,KS.Y)===t.getOrdinate(e-1,KS.Y)},mI.isEqual=function(t,e){var r=t.size();if(r!==e.size())return!1;for(var n=Math.min(t.getDimension(),e.getDimension()),i=0;i<r;i++)for(var o=0;o<n;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(!(t.getOrdinate(i,o)===e.getOrdinate(i,o)||CS.isNaN(s)&&CS.isNaN(a)))return!1}return!0},mI.extend=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();if(mI.copy(e,0,n,0,i),i>0)for(var o=i;o<r;o++)mI.copy(e,i-1,n,o,1);return n},mI.reverse=function(t){for(var e=t.size()-1,r=Math.trunc(e/2),n=0;n<=r;n++)mI.swap(t,n,e-n)},mI.swap=function(t,e,r){if(e===r)return null;for(var n=0;n<t.getDimension();n++){var i=t.getOrdinate(e,n);t.setOrdinate(e,n,t.getOrdinate(r,n)),t.setOrdinate(r,n,i)}},mI.copy=function(t,e,r,n,i){for(var o=0;o<i;o++)mI.copyCoord(t,e+o,r,n+o)},mI.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var r=t.getDimension(),n=new DS;n.append("(");for(var i=0;i<e;i++){i>0&&n.append(" ");for(var o=0;o<r;o++)o>0&&n.append(","),n.append(gI.toString(t.getOrdinate(i,o)))}return n.append(")"),n.toString()}},mI.ensureValidRing=function(t,e){var r=e.size();return 0===r?e:r<=3?mI.createClosedRing(t,e,4):e.getOrdinate(0,KS.X)===e.getOrdinate(r-1,KS.X)&&e.getOrdinate(0,KS.Y)===e.getOrdinate(r-1,KS.Y)?e:mI.createClosedRing(t,e,r+1)},mI.createClosedRing=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();mI.copy(e,0,n,0,i);for(var o=i;o<r;o++)mI.copy(e,0,n,o,1);return n};var vI=function(t){function e(e,r){t.call(this,r),this._points=null,this.init(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new JS:this._points.expandEnvelope(new JS)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._points.size()!==n._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),n._points.getCoordinate(i),r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=this,e=0;e<Math.trunc(this._points.size()/2);e++){var r=t._points.size()-1-e;if(!t._points.getCoordinate(e).equals(t._points.getCoordinate(r)))return t._points.getCoordinate(e).compareTo(t._points.getCoordinate(r))>0&&mI.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?rI.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 fB.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return mI.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,r=0;e<this._points.size()&&r<t._points.size();){var n=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(r));if(0!==n)return n;e++,r++}return e<this._points.size()?1:r<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(NS(arguments[0],vB))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(NS(arguments[0],oI)){var r=arguments[0];if(0===this._points.size())return null;for(var n=0;n<this._points.size()&&(r.filter(this._points,n),!r.isDone());n++);r.isGeometryChanged()&&this.geometryChanged()}else(NS(arguments[0],iI)||NS(arguments[0],dB))&&arguments[0].filter(this)},e.prototype.getBoundary=function(){return new lI(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 xS("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[ZB]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,r),e}(gB),_I=function(){};_I.prototype.interfaces_=function(){return[]},_I.prototype.getClass=function(){return _I};var wI=function(t){function e(e,r){t.call(this,r),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new JS;var t=new JS;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),r))}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){},e.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},e.prototype.getBoundaryDimension=function(){return rI.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(NS(arguments[0],vB)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(NS(arguments[0],oI)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else(NS(arguments[0],iI)||NS(arguments[0],dB))&&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([])),aB.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[_I]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,r),e}(gB),bI=function(){};bI.prototype.interfaces_=function(){return[]},bI.prototype.getClass=function(){return bI};var xI=function(t){function e(e,r,n){if(t.call(this,n),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===r&&(r=[]),t.hasNullElements(r))throw new xS("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(r))throw new xS("shell is empty but holes are not");this._shell=e,this._holes=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},e.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},e.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=this._shell.getCoordinates(),n=0;n<r.length;n++)t[++e]=r[n];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(fB.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(fB.signedArea(this._holes[e].getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),r=0;r<5;r++){var n=t.getX(r);if(n!==e.getMinX()&&n!==e.getMaxX())return!1;var i=t.getY(r);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var l=t.getX(a),u=t.getY(a);if(l!==o==(u!==s))return!1;o=l,s=u}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e,i=this._shell,o=n._shell;if(!i.equalsExact(o,r))return!1;if(this._holes.length!==n._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(n._holes[s],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);eI.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(e.isEmpty())return null;var n=new Array(e.getCoordinates().length-1).fill(null);YS.arraycopy(e.getCoordinates(),0,n,0,n.length);var i=OB.minCoordinate(e.getCoordinates());OB.scroll(n,i),YS.arraycopy(n,0,e.getCoordinates(),0,n.length),e.getCoordinates()[n.length]=n[0],fB.isCCW(e.getCoordinates())===r&&OB.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,r=t._shell;return e.compareToSameClass(r)}if(2===arguments.length){var n=arguments[1],i=arguments[0],o=this._shell,s=i._shell,a=o.compareToSameClass(s,n);if(0!==a)return a;for(var l=this.getNumInteriorRing(),u=i.getNumInteriorRing(),h=0;h<l&&h<u;){var c=this.getInteriorRingN(h),A=i.getInteriorRingN(h),f=c.compareToSameClass(A,n);if(0!==f)return f;h++}return h<l?1:h<u?-1:0}},e.prototype.apply=function(t){var e=this;if(NS(t,vB)){this._shell.apply(t);for(var r=0;r<this._holes.length;r++)e._holes[r].apply(t)}else if(NS(t,oI)){if(this._shell.apply(t),!t.isDone())for(var n=0;n<this._holes.length&&(e._holes[n].apply(t),!t.isDone());n++);t.isGeometryChanged()&&this.geometryChanged()}else if(NS(t,iI))t.filter(this);else if(NS(t,dB)){t.filter(this),this._shell.apply(t);for(var i=0;i<this._holes.length;i++)e._holes[i].apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var r=0;r<this._holes.length;r++)e._holes[r]=this._holes[r].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),r=new Array(this._holes.length).fill(null),n=0;n<r.length;n++)r[n]=this._holes[n].copy();return new e(t,r,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes[t]},e.prototype.interfaces_=function(){return[bI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,r),e}(gB),CI=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return gB.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(1===arguments.length){var e=arguments[0];return this._geometries[e].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return rI.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.getGeometryType=function(){return"MultiPoint"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[_I]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,r),e}(sI),EI=function(t){function e(e,r){e instanceof PS&&r instanceof GI&&(e=r.getCoordinateSequenceFactory().create(e)),t.call(this,e,r),this.validateConstruction()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return gB.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return rI.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return mI.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new xS("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new xS("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.MINIMUM_VALID_SIZE.get=function(){return 4},r.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,r),e}(vI),SI=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return gB.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new FB,e=0;e<this._geometries.length;e++)for(var r=this._geometries[e].getBoundary(),n=0;n<r.getNumGeometries();n++)t.add(r.getGeometryN(n));var i=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(i))},e.prototype.getGeometryType=function(){return"MultiPolygon"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[bI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,r),e}(sI),BI=function(t){this._factory=t||null,this._isUserDataCopied=!1},II={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};BI.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},BI.prototype.edit=function(t,e){if(null===t)return null;var r=this.editInternal(t,e);return this._isUserDataCopied&&r.setUserData(t.getUserData()),r},BI.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof sI?this.editGeometryCollection(t,e):t instanceof xI?this.editPolygon(t,e):t instanceof wI||t instanceof vI?e.edit(t,this._factory):(aB.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},BI.prototype.editGeometryCollection=function(t,e){for(var r=e.edit(t,this._factory),n=new FB,i=0;i<r.getNumGeometries();i++){var o=this.edit(r.getGeometryN(i),e);null===o||o.isEmpty()||n.add(o)}return r.getClass()===CI?this._factory.createMultiPoint(n.toArray([])):r.getClass()===aI?this._factory.createMultiLineString(n.toArray([])):r.getClass()===SI?this._factory.createMultiPolygon(n.toArray([])):this._factory.createGeometryCollection(n.toArray([]))},BI.prototype.editPolygon=function(t,e){var r=e.edit(t,this._factory);if(null===r&&(r=this._factory.createPolygon(null)),r.isEmpty())return r;var n=this.edit(r.getExteriorRing(),e);if(null===n||n.isEmpty())return this._factory.createPolygon();for(var i=new FB,o=0;o<r.getNumInteriorRing();o++){var s=this.edit(r.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(n,i.toArray([]))},BI.prototype.interfaces_=function(){return[]},BI.prototype.getClass=function(){return BI},BI.GeometryEditorOperation=function(){},II.NoOpGeometryOperation.get=function(){return TI},II.CoordinateOperation.get=function(){return PI},II.CoordinateSequenceOperation.get=function(){return FI},Object.defineProperties(BI,II);var TI=function(){};TI.prototype.edit=function(t,e){return t},TI.prototype.interfaces_=function(){return[BI.GeometryEditorOperation]},TI.prototype.getClass=function(){return TI};var PI=function(){};PI.prototype.edit=function(t,e){var r=this.editCoordinates(t.getCoordinates(),t);return null===r?t:t instanceof EI?e.createLinearRing(r):t instanceof vI?e.createLineString(r):t instanceof wI?r.length>0?e.createPoint(r[0]):e.createPoint():t},PI.prototype.interfaces_=function(){return[BI.GeometryEditorOperation]},PI.prototype.getClass=function(){return PI};var FI=function(){};FI.prototype.edit=function(t,e){return t instanceof EI?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof vI?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof wI?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},FI.prototype.interfaces_=function(){return[BI.GeometryEditorOperation]},FI.prototype.getClass=function(){return FI};var LI=function(){var t=this;if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var r=0;r<e;r++)t._coordinates[r]=new PS}else if(NS(arguments[0],KS)){var n=arguments[0];if(null===n)return this._coordinates=new Array(0).fill(null),null;this._dimension=n.getDimension(),this._coordinates=new Array(n.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)t._coordinates[i]=n.getCoordinateCopy(i)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],s=arguments[1];this._coordinates=o,this._dimension=s,null===o&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var a=arguments[0],l=arguments[1];this._coordinates=new Array(a).fill(null),this._dimension=l;for(var u=0;u<a;u++)t._coordinates[u]=new PS}},MI={serialVersionUID:{configurable:!0}};LI.prototype.setOrdinate=function(t,e,r){switch(e){case KS.X:this._coordinates[t].x=r;break;case KS.Y:this._coordinates[t].y=r;break;case KS.Z:this._coordinates[t].z=r;break;default:throw new xS("invalid ordinateIndex")}},LI.prototype.size=function(){return this._coordinates.length},LI.prototype.getOrdinate=function(t,e){switch(e){case KS.X:return this._coordinates[t].x;case KS.Y:return this._coordinates[t].y;case KS.Z:return this._coordinates[t].z}return CS.NaN},LI.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],r=arguments[1];r.x=this._coordinates[e].x,r.y=this._coordinates[e].y,r.z=this._coordinates[e].z}},LI.prototype.getCoordinateCopy=function(t){return new PS(this._coordinates[t])},LI.prototype.getDimension=function(){return this._dimension},LI.prototype.getX=function(t){return this._coordinates[t].x},LI.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 LI(t,this._dimension)},LI.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},LI.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 LI(t,this._dimension)},LI.prototype.toString=function(){if(this._coordinates.length>0){var t=new DS(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"()"},LI.prototype.getY=function(t){return this._coordinates[t].y},LI.prototype.toCoordinateArray=function(){return this._coordinates},LI.prototype.interfaces_=function(){return[KS,TS]},LI.prototype.getClass=function(){return LI},MI.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(LI,MI);var OI=function(){},kI={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};OI.prototype.readResolve=function(){return OI.instance()},OI.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array)return new LI(arguments[0]);if(NS(arguments[0],KS))return new LI(arguments[0])}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new LI(t):new LI(t,e)}},OI.prototype.interfaces_=function(){return[MS,TS]},OI.prototype.getClass=function(){return OI},OI.instance=function(){return OI.instanceObject},kI.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},kI.instanceObject.get=function(){return new OI},Object.defineProperties(OI,kI);var NI=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 FB,e=this.map_.values(),r=e.next();!r.done;)t.add(r.value),r=e.next();return t},e.prototype.entrySet=function(){var t=new jB;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(UB),RI=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 DI){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var r=arguments[0];this._modelType=t.FIXED,this.setScale(r)}else if(arguments[0]instanceof t){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}},UI={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};RI.prototype.equals=function(t){if(!(t instanceof RI))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},RI.prototype.compareTo=function(t){var e=t,r=this.getMaximumSignificantDigits(),n=e.getMaximumSignificantDigits();return new QS(r).compareTo(new QS(n))},RI.prototype.getScale=function(){return this._scale},RI.prototype.isFloating=function(){return this._modelType===RI.FLOATING||this._modelType===RI.FLOATING_SINGLE},RI.prototype.getType=function(){return this._modelType},RI.prototype.toString=function(){var t="UNKNOWN";return this._modelType===RI.FLOATING?t="Floating":this._modelType===RI.FLOATING_SINGLE?t="Floating-Single":this._modelType===RI.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},RI.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return CS.isNaN(t)||this._modelType===RI.FLOATING_SINGLE?t:this._modelType===RI.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof PS){var e=arguments[0];if(this._modelType===RI.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},RI.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===RI.FLOATING?t=16:this._modelType===RI.FLOATING_SINGLE?t=6:this._modelType===RI.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},RI.prototype.setScale=function(t){this._scale=Math.abs(t)},RI.prototype.interfaces_=function(){return[TS,SS]},RI.prototype.getClass=function(){return RI},RI.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},UI.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},UI.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(RI,UI);var DI=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},QI={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};DI.prototype.readResolve=function(){return DI.nameToTypeMap.get(this._name)},DI.prototype.toString=function(){return this._name},DI.prototype.interfaces_=function(){return[TS]},DI.prototype.getClass=function(){return DI},QI.serialVersionUID.get=function(){return-552860263173159e4},QI.nameToTypeMap.get=function(){return new NI},Object.defineProperties(DI,QI),RI.Type=DI,RI.FIXED=new DI("FIXED"),RI.FLOATING=new DI("FLOATING"),RI.FLOATING_SINGLE=new DI("FLOATING SINGLE");var GI=function t(){this._precisionModel=new RI,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?NS(arguments[0],MS)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof RI&&(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]))},jI={serialVersionUID:{configurable:!0}};GI.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new PS(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new PS(t.getMinX(),t.getMinY()),new PS(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new PS(t.getMinX(),t.getMinY()),new PS(t.getMinX(),t.getMaxY()),new PS(t.getMaxX(),t.getMaxY()),new PS(t.getMaxX(),t.getMinY()),new PS(t.getMinX(),t.getMinY())]),null)},GI.prototype.createLineString=function(t){return t?t instanceof Array?new vI(this.getCoordinateSequenceFactory().create(t),this):NS(t,KS)?new vI(t,this):void 0:new vI(this.getCoordinateSequenceFactory().create([]),this)},GI.prototype.createMultiLineString=function(){return 0===arguments.length?new aI(null,this):1===arguments.length?new aI(arguments[0],this):void 0},GI.prototype.buildGeometry=function(t){for(var e=null,r=!1,n=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(r=!0),o.isGeometryCollectionOrDerived()&&(n=!0)}if(null===e)return this.createGeometryCollection();if(r||n)return this.createGeometryCollection(GI.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof xI)return this.createMultiPolygon(GI.toPolygonArray(t));if(a instanceof vI)return this.createMultiLineString(GI.toLineStringArray(t));if(a instanceof wI)return this.createMultiPoint(GI.toPointArray(t));aB.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},GI.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},GI.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof PS){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(NS(arguments[0],KS))return new wI(arguments[0],this)}},GI.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},GI.prototype.createPolygon=function(){if(0===arguments.length)return new xI(null,null,this);if(1===arguments.length){if(NS(arguments[0],KS)){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 EI){var r=arguments[0];return this.createPolygon(r,null)}}else if(2===arguments.length)return new xI(arguments[0],arguments[1],this)},GI.prototype.getSRID=function(){return this._SRID},GI.prototype.createGeometryCollection=function(){return 0===arguments.length?new sI(null,this):1===arguments.length?new sI(arguments[0],this):void 0},GI.prototype.createGeometry=function(t){return new BI(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},GI.prototype.getPrecisionModel=function(){return this._precisionModel},GI.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(NS(arguments[0],KS))return new EI(arguments[0],this)}},GI.prototype.createMultiPolygon=function(){return 0===arguments.length?new SI(null,this):1===arguments.length?new SI(arguments[0],this):void 0},GI.prototype.createMultiPoint=function(){if(0===arguments.length)return new CI(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new CI(arguments[0],this);if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(NS(arguments[0],KS)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(e.size()).fill(null),n=0;n<e.size();n++){var i=this.getCoordinateSequenceFactory().create(1,e.getDimension());mI.copy(e,n,i,0,1),r[n]=this.createPoint(i)}return this.createMultiPoint(r)}}},GI.prototype.interfaces_=function(){return[TS]},GI.prototype.getClass=function(){return GI},GI.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.getDefaultCoordinateSequenceFactory=function(){return OI.instance()},GI.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},jI.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(GI,jI);var HI=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],zI=function(t){this.geometryFactory=t||new GI};zI.prototype.read=function(t){var e,r=(e="string"==typeof t?JSON.parse(t):t).type;if(!VI[r])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==HI.indexOf(r)?VI[r].apply(this,[e.coordinates]):"GeometryCollection"===r?VI[r].apply(this,[e.geometries]):VI[r].apply(this,[e])},zI.prototype.write=function(t){var e=t.getGeometryType();if(!KI[e])throw new Error("Geometry is not supported");return KI[e].apply(this,[t])};var VI={Feature:function(t){var e={};for(var r in t)e[r]=t[r];if(t.geometry){var n=t.geometry.type;if(!VI[n])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=VI.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var r=0;r<t.features.length;++r)e.features.push(this.read(t.features[r]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(new PS(n[0],n[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new PS(t[0],t[1]),new PS(t[2],t[1]),new PS(t[2],t[3]),new PS(t[0],t[3]),new PS(t[0],t[1])])},Point:function(t){var e=new PS(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],r=0;r<t.length;++r)e.push(VI.Point.apply(this,[t[r]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=VI.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],r=0;r<t.length;++r)e.push(VI.LineString.apply(this,[t[r]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=VI.coordinates.apply(this,[t[0]]),r=this.geometryFactory.createLinearRing(e),n=[],i=1;i<t.length;++i){var o=t[i],s=VI.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);n.push(a)}return this.geometryFactory.createPolygon(r,n)},MultiPolygon:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(VI.Polygon.apply(this,[n]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(this.read(n))}return this.geometryFactory.createGeometryCollection(e)}},KI={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:KI.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=KI.Point.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],r=t.getCoordinates(),n=0;n<r.length;++n){var i=r[n];e.push(KI.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=KI.LineString.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],r=KI.LineString.apply(this,[t._shell]);e.push(r.coordinates);for(var n=0;n<t._holes.length;++n){var i=t._holes[n],o=KI.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=KI.Polygon.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=n.getGeometryType();e.push(KI[i].apply(this,[n]))}return{type:"GeometryCollection",geometries:e}}},qI=function(t){this.geometryFactory=t||new GI,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new zI(this.geometryFactory)};qI.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===RI.FIXED&&this.reducePrecision(e),e},qI.prototype.reducePrecision=function(t){var e,r;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,r=t.points.length;e<r;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,r=t.geometries.length;e<r;e++)this.reducePrecision(t.geometries[e])};var WI=function(){this.parser=new zI(this.geometryFactory)};WI.prototype.write=function(t){return this.parser.write(t)};var XI=function(){},YI={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function ZI(t){this.message=t||""}function JI(){this.array_=[]}XI.prototype.interfaces_=function(){return[]},XI.prototype.getClass=function(){return XI},XI.opposite=function(t){return t===XI.LEFT?XI.RIGHT:t===XI.RIGHT?XI.LEFT:t},YI.ON.get=function(){return 0},YI.LEFT.get=function(){return 1},YI.RIGHT.get=function(){return 2},Object.defineProperties(XI,YI),ZI.prototype=new Error,ZI.prototype.name="EmptyStackException",JI.prototype=new TB,JI.prototype.add=function(t){return this.array_.push(t),!0},JI.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},JI.prototype.push=function(t){return this.array_.push(t),t},JI.prototype.pop=function(t){if(0===this.array_.length)throw new ZI;return this.array_.pop()},JI.prototype.peek=function(){if(0===this.array_.length)throw new ZI;return this.array_[this.array_.length-1]},JI.prototype.empty=function(){return 0===this.array_.length},JI.prototype.isEmpty=function(){return this.empty()},JI.prototype.search=function(t){return this.array_.indexOf(t)},JI.prototype.size=function(){return this.array_.length},JI.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t};var $I=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};$I.prototype.getCoordinate=function(){return this._minCoord},$I.prototype.getRightmostSide=function(t,e){var r=this.getRightmostSideOfSegment(t,e);return r<0&&(r=this.getRightmostSideOfSegment(t,e-1)),r<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),r},$I.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();aB.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],r=t[this._minIndex+1],n=fB.computeOrientation(this._minCoord,r,e),i=!1;(e.y<this._minCoord.y&&r.y<this._minCoord.y&&n===fB.COUNTERCLOCKWISE||e.y>this._minCoord.y&&r.y>this._minCoord.y&&n===fB.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},$I.prototype.getRightmostSideOfSegment=function(t,e){var r=t.getEdge().getCoordinates();if(e<0||e+1>=r.length)return-1;if(r[e].y===r[e+1].y)return-1;var n=XI.LEFT;return r[e].y<r[e+1].y&&(n=XI.RIGHT),n},$I.prototype.getEdge=function(){return this._orientedDe},$I.prototype.checkForRightmostCoordinate=function(t){for(var e=this,r=t.getEdge().getCoordinates(),n=0;n<r.length-1;n++)(null===e._minCoord||r[n].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=n,e._minCoord=r[n])},$I.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)},$I.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();r.isForward()&&this.checkForRightmostCoordinate(r)}aB.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)===XI.LEFT&&(this._orientedDe=this._minDe.getSym())},$I.prototype.interfaces_=function(){return[]},$I.prototype.getClass=function(){return $I};var tT=function(t){function e(r,n){t.call(this,e.msgWithCoord(r,n)),this.pt=n?new PS(n):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},e}(oB),eT=function(){this.array_=[]};eT.prototype.addLast=function(t){this.array_.push(t)},eT.prototype.removeFirst=function(){return this.array_.shift()},eT.prototype.isEmpty=function(){return 0===this.array_.length};var rT=function(){this._finder=null,this._dirEdgeList=new FB,this._nodes=new FB,this._rightMostCoord=null,this._env=null,this._finder=new $I};rT.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},rT.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},rT.prototype.computeNodeDepth=function(t){for(var e=null,r=t.getEdges().iterator();r.hasNext();){var n=r.next();if(n.isVisited()||n.getSym().isVisited()){e=n;break}}if(null===e)throw new tT("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)}},rT.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(XI.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},rT.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},rT.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(XI.RIGHT)>=1&&e.getDepth(XI.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},rT.prototype.computeDepths=function(t){var e=new jB,r=new eT,n=t.getNode();for(r.addLast(n),e.add(n),t.setVisited(!0);!r.isEmpty();){var i=r.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(r.addLast(a),e.add(a))}}}},rT.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},rT.prototype.getEnvelope=function(){if(null===this._env){for(var t=new JS,e=this._dirEdgeList.iterator();e.hasNext();)for(var r=e.next().getEdge().getCoordinates(),n=0;n<r.length-1;n++)t.expandToInclude(r[n]);this._env=t}return this._env},rT.prototype.addReachable=function(t){var e=new JI;for(e.add(t);!e.empty();){var r=e.pop();this.add(r,e)}},rT.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(XI.LEFT,t.getDepth(XI.RIGHT)),e.setDepth(XI.RIGHT,t.getDepth(XI.LEFT))},rT.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var r=t.getEdges().iterator();r.hasNext();){var n=r.next();this._dirEdgeList.add(n);var i=n.getSym().getNode();i.isVisited()||e.push(i)}},rT.prototype.getNodes=function(){return this._nodes},rT.prototype.getDirectedEdges=function(){return this._dirEdgeList},rT.prototype.interfaces_=function(){return[SS]},rT.prototype.getClass=function(){return rT};var nT=function t(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var r=arguments[0];this.init(1),this.location[XI.ON]=r}else if(arguments[0]instanceof t){var n=arguments[0];if(this.init(n.location.length),null!==n)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.init(3),this.location[XI.ON]=o,this.location[XI.LEFT]=s,this.location[XI.RIGHT]=a}};nT.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},nT.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==OS.NONE)return!1;return!0},nT.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===OS.NONE&&(this.location[e]=t)},nT.prototype.isLine=function(){return 1===this.location.length},nT.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[XI.ON]=this.location[XI.ON],e[XI.LEFT]=OS.NONE,e[XI.RIGHT]=OS.NONE,this.location=e}for(var r=0;r<this.location.length;r++)this.location[r]===OS.NONE&&r<t.location.length&&(this.location[r]=t.location[r])},nT.prototype.getLocations=function(){return this.location},nT.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[XI.LEFT];this.location[XI.LEFT]=this.location[XI.RIGHT],this.location[XI.RIGHT]=t},nT.prototype.toString=function(){var t=new DS;return this.location.length>1&&t.append(OS.toLocationSymbol(this.location[XI.LEFT])),t.append(OS.toLocationSymbol(this.location[XI.ON])),this.location.length>1&&t.append(OS.toLocationSymbol(this.location[XI.RIGHT])),t.toString()},nT.prototype.setLocations=function(t,e,r){this.location[XI.ON]=t,this.location[XI.LEFT]=e,this.location[XI.RIGHT]=r},nT.prototype.get=function(t){return t<this.location.length?this.location[t]:OS.NONE},nT.prototype.isArea=function(){return this.location.length>1},nT.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===OS.NONE)return!0;return!1},nT.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(XI.ON,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.location[e]=r}},nT.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(OS.NONE)},nT.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},nT.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},nT.prototype.interfaces_=function(){return[]},nT.prototype.getClass=function(){return nT};var iT=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 nT(e),this.elt[1]=new nT(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.elt[0]=new nT(r.elt[0]),this.elt[1]=new nT(r.elt[1])}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.elt[0]=new nT(OS.NONE),this.elt[1]=new nT(OS.NONE),this.elt[n].setLocation(i)}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new nT(o,s,a),this.elt[1]=new nT(o,s,a)}else if(4===arguments.length){var l=arguments[0],u=arguments[1],h=arguments[2],c=arguments[3];this.elt[0]=new nT(OS.NONE,OS.NONE,OS.NONE),this.elt[1]=new nT(OS.NONE,OS.NONE,OS.NONE),this.elt[l].setLocations(u,h,c)}};iT.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},iT.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},iT.prototype.isNull=function(t){return this.elt[t].isNull()},iT.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.elt[e].setAllLocationsIfNull(r)}},iT.prototype.isLine=function(t){return this.elt[t].isLine()},iT.prototype.merge=function(t){for(var e=this,r=0;r<2;r++)null===e.elt[r]&&null!==t.elt[r]?e.elt[r]=new nT(t.elt[r]):e.elt[r].merge(t.elt[r])},iT.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},iT.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(XI.ON)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return this.elt[e].get(r)}},iT.prototype.toString=function(){var t=new DS;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()},iT.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()}},iT.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},iT.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(XI.ON,e)}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this.elt[r].setLocation(n,i)}},iT.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},iT.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},iT.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new nT(this.elt[t].location[0]))},iT.prototype.interfaces_=function(){return[]},iT.prototype.getClass=function(){return iT},iT.toLineLabel=function(t){for(var e=new iT(OS.NONE),r=0;r<2;r++)e.setLocation(r,t.getLocation(r));return e};var oT=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new FB,this._pts=new FB,this._label=new iT(OS.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new FB,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};oT.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=fB.isCCW(this._ring.getCoordinates())},oT.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},oT.prototype.computePoints=function(t){var e=this;this._startDe=t;var r=t,n=!0;do{if(null===r)throw new tT("Found null DirectedEdge");if(r.getEdgeRing()===e)throw new tT("Directed Edge visited twice during ring-building at "+r.getCoordinate());e._edges.add(r);var i=r.getLabel();aB.isTrue(i.isArea()),e.mergeLabel(i),e.addPoints(r.getEdge(),r.isForward(),n),n=!1,e.setEdgeRing(r,e),r=e.getNext(r)}while(r!==this._startDe)},oT.prototype.getLinearRing=function(){return this._ring},oT.prototype.getCoordinate=function(t){return this._pts.get(t)},oT.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var r=e.getNode().getEdges().getOutgoingDegree(t);r>t._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},oT.prototype.addPoints=function(t,e,r){var n=t.getCoordinates();if(e){var i=1;r&&(i=0);for(var o=i;o<n.length;o++)this._pts.add(n[o])}else{var s=n.length-2;r&&(s=n.length-1);for(var a=s;a>=0;a--)this._pts.add(n[a])}},oT.prototype.isHole=function(){return this._isHole},oT.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},oT.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!fB.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();)if(r.next().containsPoint(t))return!1;return!0},oT.prototype.addHole=function(t){this._holes.add(t)},oT.prototype.isShell=function(){return null===this._shell},oT.prototype.getLabel=function(){return this._label},oT.prototype.getEdges=function(){return this._edges},oT.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},oT.prototype.getShell=function(){return this._shell},oT.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[1],r=arguments[0].getLocation(e,XI.RIGHT);if(r===OS.NONE)return null;if(this._label.getLocation(e)===OS.NONE)return this._label.setLocation(e,r),null}},oT.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},oT.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),r=0;r<this._holes.size();r++)e[r]=this._holes.get(r).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},oT.prototype.interfaces_=function(){return[]},oT.prototype.getClass=function(){return oT};var sT=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},e.prototype.getNext=function(t){return t.getNextMin()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(oT),aT=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new FB,e=this._startDe;do{if(null===e.getMinEdgeRing()){var r=new sT(e,this._geometryFactory);t.add(r)}e=e.getNext()}while(e!==this._startDe);return t},e.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},e.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)},e.prototype.getNext=function(t){return t.getNext()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(oT),lT=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}};lT.prototype.setVisited=function(t){this._isVisited=t},lT.prototype.setInResult=function(t){this._isInResult=t},lT.prototype.isCovered=function(){return this._isCovered},lT.prototype.isCoveredSet=function(){return this._isCoveredSet},lT.prototype.setLabel=function(t){this._label=t},lT.prototype.getLabel=function(){return this._label},lT.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},lT.prototype.updateIM=function(t){aB.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},lT.prototype.isInResult=function(){return this._isInResult},lT.prototype.isVisited=function(){return this._isVisited},lT.prototype.interfaces_=function(){return[]},lT.prototype.getClass=function(){return lT};var uT=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],r=arguments[1];this._coord=e,this._edges=r,this._label=new iT(0,OS.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();)if(t.next().getEdge().isInResult())return!0;return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var r=OS.NONE;if(r=this._label.getLocation(e),!t.isNull(e)){var n=t.getLocation(e);r!==OS.BOUNDARY&&(r=n)}return r},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],r=arguments[1];null===this._label?this._label=new iT(e,r):this._label.setLocation(e,r)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof iT)for(var n=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(n,i);t._label.getLocation(i)===OS.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=OS.NONE;null!==this._label&&(e=this._label.getLocation(t));var r=null;switch(e){case OS.BOUNDARY:r=OS.INTERIOR;break;case OS.INTERIOR:default:r=OS.BOUNDARY}this._label.setLocation(t,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(lT),hT=function(){this.nodeMap=new YB,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};hT.prototype.find=function(t){return this.nodeMap.get(t)},hT.prototype.addNode=function(){if(arguments[0]instanceof PS){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 uT){var r=arguments[0],n=this.nodeMap.get(r.getCoordinate());return null===n?(this.nodeMap.put(r.getCoordinate(),r),r):(n.mergeLabel(r),n)}},hT.prototype.print=function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)},hT.prototype.iterator=function(){return this.nodeMap.values().iterator()},hT.prototype.values=function(){return this.nodeMap.values()},hT.prototype.getBoundaryNodes=function(t){for(var e=new FB,r=this.iterator();r.hasNext();){var n=r.next();n.getLabel().getLocation(t)===OS.BOUNDARY&&e.add(n)}return e},hT.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},hT.prototype.interfaces_=function(){return[]},hT.prototype.getClass=function(){return hT};var cT=function(){},AT={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};cT.prototype.interfaces_=function(){return[]},cT.prototype.getClass=function(){return cT},cT.isNorthern=function(t){return t===cT.NE||t===cT.NW},cT.isOpposite=function(t,e){return t!==e&&2==(t-e+4)%4},cT.commonHalfPlane=function(t,e){if(t===e)return t;if(2==(t-e+4)%4)return-1;var r=t<e?t:e;return 0===r&&3===(t>e?t:e)?3:r},cT.isInHalfPlane=function(t,e){return e===cT.SE?t===cT.SE||t===cT.SW:t===e||t===e+1},cT.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 xS("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?cT.NE:cT.SE:e>=0?cT.NW:cT.SW}if(arguments[0]instanceof PS&&arguments[1]instanceof PS){var r=arguments[0],n=arguments[1];if(n.x===r.x&&n.y===r.y)throw new xS("Cannot compute the quadrant for two identical points "+r);return n.x>=r.x?n.y>=r.y?cT.NE:cT.SE:n.y>=r.y?cT.NW:cT.SW}},AT.NE.get=function(){return 0},AT.NW.get=function(){return 1},AT.SW.get=function(){return 2},AT.SE.get=function(){return 3},Object.defineProperties(cT,AT);var fT=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._edge=e,this.init(r,n),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=i,this.init(o,s),this._label=a}};fT.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:fB.computeOrientation(t._p0,t._p1,this._p1)},fT.prototype.getDy=function(){return this._dy},fT.prototype.getCoordinate=function(){return this._p0},fT.prototype.setNode=function(t){this._node=t},fT.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),r=this.getClass().getName(),n=r.lastIndexOf("."),i=r.substring(n+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},fT.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},fT.prototype.getDirectedCoordinate=function(){return this._p1},fT.prototype.getDx=function(){return this._dx},fT.prototype.getLabel=function(){return this._label},fT.prototype.getEdge=function(){return this._edge},fT.prototype.getQuadrant=function(){return this._quadrant},fT.prototype.getNode=function(){return this._node},fT.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),r=e.lastIndexOf(".");return" "+e.substring(r+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},fT.prototype.computeLabel=function(t){},fT.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=cT.quadrant(this._dx,this._dy),aB.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},fT.prototype.interfaces_=function(){return[SS]},fT.prototype.getClass=function(){return fT};var pT=function(t){function e(){var e=arguments[0],r=arguments[1];if(t.call(this,e),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=r,r)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var n=e.getNumPoints()-1;this.init(e.getCoordinate(n),e.getCoordinate(n-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth[t]},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new iT(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 tT("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=this,e=!0,r=0;r<2;r++)t._label.isArea(r)&&t._label.getLocation(r,XI.LEFT)===OS.INTERIOR&&t._label.getLocation(r,XI.RIGHT)===OS.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[XI.LEFT]+"/"+this._depth[XI.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,OS.EXTERIOR),r=!this._label.isArea(1)||this._label.allPositionsEqual(1,OS.EXTERIOR);return t&&e&&r},e.prototype.setEdgeRing=function(t){this._edgeRing=t},e.prototype.getMinEdgeRing=function(){return this._minEdgeRing},e.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},e.prototype.setInResult=function(t){this._isInResult=t},e.prototype.getSym=function(){return this._sym},e.prototype.isForward=function(){return this._isForward},e.prototype.getEdge=function(){return this._edge},e.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},e.prototype.setSym=function(t){this._sym=t},e.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},e.prototype.setEdgeDepths=function(t,e){var r=this.getEdge().getDepthDelta();this._isForward||(r=-r);var n=1;t===XI.LEFT&&(n=-1);var i=XI.opposite(t),o=e+r*n;this.setDepth(t,e),this.setDepth(i,o)},e.prototype.getEdgeRing=function(){return this._edgeRing},e.prototype.isInResult=function(){return this._isInResult},e.prototype.setNext=function(t){this._next=t},e.prototype.isVisited=function(){return this._isVisited},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.depthFactor=function(t,e){return t===OS.EXTERIOR&&e===OS.INTERIOR?1:t===OS.INTERIOR&&e===OS.EXTERIOR?-1:0},e}(fT),dT=function(){};dT.prototype.createNode=function(t){return new uT(t,null)},dT.prototype.interfaces_=function(){return[]},dT.prototype.getClass=function(){return dT};var gT=function(){if(this._edges=new FB,this._nodes=null,this._edgeEndList=new FB,0===arguments.length)this._nodes=new hT(new dT);else if(1===arguments.length){var t=arguments[0];this._nodes=new hT(t)}};gT.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var r=this._edges.get(e);r.print(t),r.eiList.print(t)}},gT.prototype.find=function(t){return this._nodes.find(t)},gT.prototype.addNode=function(){if(arguments[0]instanceof uT){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof PS){var e=arguments[0];return this._nodes.addNode(e)}},gT.prototype.getNodeIterator=function(){return this._nodes.iterator()},gT.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},gT.prototype.debugPrintln=function(t){YS.out.println(t)},gT.prototype.isBoundaryNode=function(t,e){var r=this._nodes.find(e);if(null===r)return!1;var n=r.getLabel();return null!==n&&n.getLocation(t)===OS.BOUNDARY},gT.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},gT.prototype.matchInSameDirection=function(t,e,r,n){return!!t.equals(r)&&fB.computeOrientation(t,e,n)===fB.COLLINEAR&&cT.quadrant(t,e)===cT.quadrant(r,n)},gT.prototype.getEdgeEnds=function(){return this._edgeEndList},gT.prototype.debugPrint=function(t){YS.out.print(t)},gT.prototype.getEdgeIterator=function(){return this._edges.iterator()},gT.prototype.findEdgeInSameDirection=function(t,e){for(var r=this,n=0;n<this._edges.size();n++){var i=r._edges.get(n),o=i.getCoordinates();if(r.matchInSameDirection(t,e,o[0],o[1]))return i;if(r.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return i}return null},gT.prototype.insertEdge=function(t){this._edges.add(t)},gT.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var r=e.next();if(r.getEdge()===t)return r}return null},gT.prototype.addEdges=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next();e._edges.add(n);var i=new pT(n,!0),o=new pT(n,!1);i.setSym(o),o.setSym(i),e.add(i),e.add(o)}},gT.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},gT.prototype.getNodes=function(){return this._nodes.values()},gT.prototype.findEdge=function(t,e){for(var r=0;r<this._edges.size();r++){var n=this._edges.get(r),i=n.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return n}return null},gT.prototype.interfaces_=function(){return[]},gT.prototype.getClass=function(){return gT},gT.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()};var yT=function(){this._geometryFactory=null,this._shellList=new FB;var t=arguments[0];this._geometryFactory=t};yT.prototype.sortShellsAndHoles=function(t,e,r){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()?r.add(i):e.add(i)}},yT.prototype.computePolygons=function(t){for(var e=new FB,r=t.iterator();r.hasNext();){var n=r.next().toPolygon(this._geometryFactory);e.add(n)}return e},yT.prototype.placeFreeHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(null===n.getShell()){var i=this.findEdgeRingContaining(n,t);if(null===i)throw new tT("unable to assign hole to a shell",n.getCoordinate(0));n.setShell(i)}}},yT.prototype.buildMinimalEdgeRings=function(t,e,r){for(var n=new FB,i=t.iterator();i.hasNext();){var o=i.next();if(o.getMaxNodeDegree()>2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):r.addAll(s)}else n.add(o)}return n},yT.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();)if(e.next().containsPoint(t))return!0;return!1},yT.prototype.buildMaximalEdgeRings=function(t){for(var e=new FB,r=t.iterator();r.hasNext();){var n=r.next();if(n.isInResult()&&n.getLabel().isArea()&&null===n.getEdgeRing()){var i=new aT(n,this._geometryFactory);e.add(i),i.setInResult()}}return e},yT.prototype.placePolygonHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();n.isHole()&&n.setShell(t)}},yT.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},yT.prototype.findEdgeRingContaining=function(t,e){for(var r=t.getLinearRing(),n=r.getEnvelopeInternal(),i=r.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var l=a.next(),u=l.getLinearRing(),h=u.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var c=!1;h.contains(n)&&fB.isPointInRing(i,u.getCoordinates())&&(c=!0),c&&(null===o||s.contains(h))&&(o=l)}return o},yT.prototype.findShell=function(t){for(var e=0,r=null,n=t.iterator();n.hasNext();){var i=n.next();i.isHole()||(r=i,e++)}return aB.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),r},yT.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],r=arguments[1];gT.linkResultDirectedEdges(r);var n=this.buildMaximalEdgeRings(e),i=new FB,o=this.buildMinimalEdgeRings(n,this._shellList,i);this.sortShellsAndHoles(o,this._shellList,i),this.placeFreeHoles(this._shellList,i)}},yT.prototype.interfaces_=function(){return[]},yT.prototype.getClass=function(){return yT};var mT=function(){};mT.prototype.getBounds=function(){},mT.prototype.interfaces_=function(){return[]},mT.prototype.getClass=function(){return mT};var vT=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};vT.prototype.getItem=function(){return this._item},vT.prototype.getBounds=function(){return this._bounds},vT.prototype.interfaces_=function(){return[mT,TS]},vT.prototype.getClass=function(){return vT};var _T=function(){this._size=null,this._items=null,this._size=0,this._items=new FB,this._items.add(null)};_T.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},_T.prototype.size=function(){return this._size},_T.prototype.reorder=function(t){for(var e=this,r=null,n=this._items.get(t);2*t<=this._size&&((r=2*t)!==e._size&&e._items.get(r+1).compareTo(e._items.get(r))<0&&r++,e._items.get(r).compareTo(n)<0);t=r)e._items.set(t,e._items.get(r));this._items.set(t,n)},_T.prototype.clear=function(){this._size=0,this._items.clear()},_T.prototype.isEmpty=function(){return 0===this._size},_T.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)},_T.prototype.interfaces_=function(){return[]},_T.prototype.getClass=function(){return _T};var wT=function(){};wT.prototype.visitItem=function(t){},wT.prototype.interfaces_=function(){return[]},wT.prototype.getClass=function(){return wT};var bT=function(){};bT.prototype.insert=function(t,e){},bT.prototype.remove=function(t,e){},bT.prototype.query=function(){},bT.prototype.interfaces_=function(){return[]},bT.prototype.getClass=function(){return bT};var xT=function(){if(this._childBoundables=new FB,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},CT={serialVersionUID:{configurable:!0}};xT.prototype.getLevel=function(){return this._level},xT.prototype.size=function(){return this._childBoundables.size()},xT.prototype.getChildBoundables=function(){return this._childBoundables},xT.prototype.addChildBoundable=function(t){aB.isTrue(null===this._bounds),this._childBoundables.add(t)},xT.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},xT.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},xT.prototype.interfaces_=function(){return[mT,TS]},xT.prototype.getClass=function(){return xT},CT.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(xT,CT);var ET=function(){};ET.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},ET.min=function(t){return ET.sort(t),t.get(0)},ET.sort=function(t,e){var r=t.toArray();e?eI.sort(r,e):eI.sort(r);for(var n=t.iterator(),i=0,o=r.length;i<o;i++)n.next(),n.set(r[i])},ET.singletonList=function(t){var e=new FB;return e.add(t),e};var ST=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],r=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=r,this._distance=this.distance()};ST.prototype.expandToQueue=function(t,e){var r=ST.isComposite(this._boundable1),n=ST.isComposite(this._boundable2);if(r&&n)return ST.area(this._boundable1)>ST.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(r)return this.expand(this._boundable1,this._boundable2,t,e),null;if(n)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new xS("neither boundable is composite")},ST.prototype.isLeaves=function(){return!(ST.isComposite(this._boundable1)||ST.isComposite(this._boundable2))},ST.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},ST.prototype.expand=function(t,e,r,n){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new ST(o,e,this._itemDistance);s.getDistance()<n&&r.add(s)}},ST.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},ST.prototype.getDistance=function(){return this._distance},ST.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},ST.prototype.interfaces_=function(){return[SS]},ST.prototype.getClass=function(){return ST},ST.area=function(t){return t.getBounds().getArea()},ST.isComposite=function(t){return t instanceof xT};var BT=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new FB,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var r=arguments[0];aB.isTrue(r>1,"Node capacity must be greater than 1"),this._nodeCapacity=r}},IT={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};BT.prototype.getNodeCapacity=function(){return this._nodeCapacity},BT.prototype.lastNode=function(t){return t.get(t.size()-1)},BT.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();r instanceof xT?t+=this.size(r):r instanceof vT&&(t+=1)}return t}},BT.prototype.removeItem=function(t,e){for(var r=null,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof vT&&i.getItem()===e&&(r=i)}return null!==r&&(t.getChildBoundables().remove(r),!0)},BT.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new FB:t}if(1===arguments.length){for(var e=arguments[0],r=new FB,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof xT){var o=this.itemsTree(i);null!==o&&r.add(o)}else i instanceof vT?r.add(i.getItem()):aB.shouldNeverReachHere()}return r.size()<=0?null:r}},BT.prototype.insert=function(t,e){aB.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new vT(t,e))},BT.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new FB;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];if(aB.isTrue(r>-2),n.getLevel()===r)return i.add(n),null;for(var o=n.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof xT?this.boundablesAtLevel(r,s,i):(aB.isTrue(s instanceof vT),-1===r&&i.add(s))}return null}},BT.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var r=new FB;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,r),r}if(2===arguments.length){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i)}else if(3===arguments.length)if(NS(arguments[2],wT)&&arguments[0]instanceof Object&&arguments[1]instanceof xT)for(var o=arguments[0],s=arguments[2],a=arguments[1].getChildBoundables(),l=0;l<a.size();l++){var u=a.get(l);t.getIntersectsOp().intersects(u.getBounds(),o)&&(u instanceof xT?t.query(o,u,s):u instanceof vT?s.visitItem(u.getItem()):aB.shouldNeverReachHere())}else if(NS(arguments[2],TB)&&arguments[0]instanceof Object&&arguments[1]instanceof xT)for(var h=arguments[0],c=arguments[2],A=arguments[1].getChildBoundables(),f=0;f<A.size();f++){var p=A.get(f);t.getIntersectsOp().intersects(p.getBounds(),h)&&(p instanceof xT?t.query(h,p,c):p instanceof vT?c.add(p.getItem()):aB.shouldNeverReachHere())}},BT.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},BT.prototype.getRoot=function(){return this.build(),this._root},BT.prototype.remove=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=this.removeItem(n,i);if(o)return!0;for(var s=null,a=n.getChildBoundables().iterator();a.hasNext();){var l=a.next();if(this.getIntersectsOp().intersects(l.getBounds(),r)&&l instanceof xT&&(o=this.remove(r,l,i))){s=l;break}}return null!==s&&s.getChildBoundables().isEmpty()&&n.getChildBoundables().remove(s),o}},BT.prototype.createHigherLevels=function(t,e){aB.isTrue(!t.isEmpty());var r=this.createParentBoundables(t,e+1);return 1===r.size()?r.get(0):this.createHigherLevels(r,e+1)},BT.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();if(r instanceof xT){var n=this.depth(r);n>t&&(t=n)}}return t+1}},BT.prototype.createParentBoundables=function(t,e){var r=this;aB.isTrue(!t.isEmpty());var n=new FB;n.add(this.createNode(e));var i=new FB(t);ET.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var s=o.next();r.lastNode(n).getChildBoundables().size()===r.getNodeCapacity()&&n.add(r.createNode(e)),r.lastNode(n).addChildBoundable(s)}return n},BT.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},BT.prototype.interfaces_=function(){return[TS]},BT.prototype.getClass=function(){return BT},BT.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},IT.IntersectsOp.get=function(){return TT},IT.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},IT.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(BT,IT);var TT=function(){},PT=function(){};PT.prototype.distance=function(t,e){},PT.prototype.interfaces_=function(){return[]},PT.prototype.getClass=function(){return PT};var FT=function(t){function e(r){r=r||e.DEFAULT_NODE_CAPACITY,t.call(this,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return e.prototype.createParentBoundablesFromVerticalSlices=function(t,e){aB.isTrue(t.length>0);for(var r=new FB,n=0;n<t.length;n++)r.addAll(this.createParentBoundablesFromVerticalSlice(t[n],e));return r},e.prototype.createNode=function(t){return new LT(t)},e.prototype.size=function(){return 0===arguments.length?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},e.prototype.insert=function(){if(2!==arguments.length)return t.prototype.insert.apply(this,arguments);var e=arguments[0],r=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,r)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.prototype.verticalSlices=function(t,e){for(var r=Math.trunc(Math.ceil(t.size()/e)),n=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){n[o]=new FB;for(var s=0;i.hasNext()&&s<r;){var a=i.next();n[o].add(a),s++}}return n},e.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var r=arguments[0],n=arguments[1];t.prototype.query.call(this,r,n)}else if(3===arguments.length)if(NS(arguments[2],wT)&&arguments[0]instanceof Object&&arguments[1]instanceof xT){var i=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,i,o,s)}else if(NS(arguments[2],TB)&&arguments[0]instanceof Object&&arguments[1]instanceof xT){var a=arguments[0],l=arguments[1],u=arguments[2];t.prototype.query.call(this,a,l,u)}},e.prototype.getComparator=function(){return e.yComparator},e.prototype.createParentBoundablesFromVerticalSlice=function(e,r){return t.prototype.createParentBoundables.call(this,e,r)},e.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return t.prototype.remove.call(this,e,r)}return t.prototype.remove.apply(this,arguments)},e.prototype.depth=function(){return 0===arguments.length?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},e.prototype.createParentBoundables=function(t,r){aB.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new FB(t);ET.sort(i,e.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(n))));return this.createParentBoundablesFromVerticalSlices(o,r)},e.prototype.nearestNeighbour=function(){if(1===arguments.length){if(NS(arguments[0],PT)){var t=arguments[0],r=new ST(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(r)}if(arguments[0]instanceof ST){var n=arguments[0];return this.nearestNeighbour(n,CS.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof e&&NS(arguments[1],PT)){var i=arguments[0],o=arguments[1],s=new ST(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof ST&&"number"==typeof arguments[1]){var a=arguments[0],l=arguments[1],u=null,h=new _T;for(h.add(a);!h.isEmpty()&&l>0;){var c=h.poll(),A=c.getDistance();if(A>=l)break;c.isLeaves()?(l=A,u=c):c.expandToQueue(h,l)}return[u.getBoundable(0).getItem(),u.getBoundable(1).getItem()]}}else if(3===arguments.length){var f=arguments[2],p=new vT(arguments[0],arguments[1]),d=new ST(this.getRoot(),p,f);return this.nearestNeighbour(d)[0]}},e.prototype.interfaces_=function(){return[bT,TS]},e.prototype.getClass=function(){return e},e.centreX=function(t){return e.avg(t.getMinX(),t.getMaxX())},e.avg=function(t,e){return(t+e)/2},e.centreY=function(t){return e.avg(t.getMinY(),t.getMaxY())},r.STRtreeNode.get=function(){return LT},r.serialVersionUID.get=function(){return 0x39920f7d5f261e0},r.xComparator.get=function(){return{interfaces_:function(){return[IS]},compare:function(r,n){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(n.getBounds()))}}},r.yComparator.get=function(){return{interfaces_:function(){return[IS]},compare:function(r,n){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(n.getBounds()))}}},r.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},r.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,r),e}(BT),LT=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var r=e.next();null===t?t=new JS(r.getBounds()):t.expandToInclude(r.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(xT),MT=function(){};MT.prototype.interfaces_=function(){return[]},MT.prototype.getClass=function(){return MT},MT.relativeSign=function(t,e){return t<e?-1:t>e?1:0},MT.compare=function(t,e,r){if(e.equals2D(r))return 0;var n=MT.relativeSign(e.x,r.x),i=MT.relativeSign(e.y,r.y);switch(t){case 0:return MT.compareValue(n,i);case 1:return MT.compareValue(i,n);case 2:return MT.compareValue(i,-n);case 3:return MT.compareValue(-n,i);case 4:return MT.compareValue(-n,-i);case 5:return MT.compareValue(-i,-n);case 6:return MT.compareValue(-i,n);case 7:return MT.compareValue(n,-i)}return aB.shouldNeverReachHere("invalid octant value"),0},MT.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var OT=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._segString=t,this.coord=new PS(e),this.segmentIndex=r,this._segmentOctant=n,this._isInterior=!e.equals2D(t.getCoordinate(r))};OT.prototype.getCoordinate=function(){return this.coord},OT.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},OT.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:MT.compare(this._segmentOctant,this.coord,e.coord)},OT.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},OT.prototype.isInterior=function(){return this._isInterior},OT.prototype.interfaces_=function(){return[SS]},OT.prototype.getClass=function(){return OT};var kT=function(){this._nodeMap=new YB,this._edge=null;var t=arguments[0];this._edge=t};kT.prototype.getSplitCoordinates=function(){var t=new MB;this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next();this.addEdgeCoordinates(r,n,t),r=n}return t.toCoordinateArray()},kT.prototype.addCollapsedNodes=function(){var t=new FB;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var r=e.next().intValue();this.add(this._edge.getCoordinate(r),r)}},kT.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},kT.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var r=this._edge.getCoordinate(e),n=this._edge.getCoordinate(e+2);r.equals2D(n)&&t.add(new QS(e+1))}},kT.prototype.addEdgeCoordinates=function(t,e,r){var n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);r.add(new PS(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)r.add(this._edge.getCoordinate(o));i&&r.add(new PS(e.coord))},kT.prototype.iterator=function(){return this._nodeMap.values().iterator()},kT.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},kT.prototype.findCollapseIndex=function(t,e,r){if(!t.coord.equals2D(e.coord))return!1;var n=e.segmentIndex-t.segmentIndex;return e.isInterior()||n--,1===n&&(r[0]=t.segmentIndex+1,!0)},kT.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),r=this.iterator(),n=r.next();r.hasNext();){var i=r.next();this.findCollapseIndex(n,i,e)&&t.add(new QS(e[0])),n=i}},kT.prototype.getEdge=function(){return this._edge},kT.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},kT.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new PS(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new PS(e.coord)),new DT(o,this._edge.getData())},kT.prototype.add=function(t,e){var r=new OT(this._edge,t,e,this._edge.getSegmentOctant(e)),n=this._nodeMap.get(r);return null!==n?(aB.isTrue(n.coord.equals2D(t),"Found equal nodes with different coordinates"),n):(this._nodeMap.put(r,r),r)},kT.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),r=t.get(0).getCoordinate(0);if(!r.equals2D(e[0]))throw new oB("bad split edge start point at "+r);var n=t.get(t.size()-1).getCoordinates(),i=n[n.length-1];if(!i.equals2D(e[e.length-1]))throw new oB("bad split edge end point at "+i)},kT.prototype.interfaces_=function(){return[]},kT.prototype.getClass=function(){return kT};var NT=function(){};NT.prototype.interfaces_=function(){return[]},NT.prototype.getClass=function(){return NT},NT.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 xS("Cannot compute the octant for point ( "+t+", "+e+" )");var r=Math.abs(t),n=Math.abs(e);return t>=0?e>=0?r>=n?0:1:r>=n?7:6:e>=0?r>=n?3:2:r>=n?4:5}if(arguments[0]instanceof PS&&arguments[1]instanceof PS){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new xS("Cannot compute the octant for two identical points "+i);return NT.octant(s,a)}};var RT=function(){};RT.prototype.getCoordinates=function(){},RT.prototype.size=function(){},RT.prototype.getCoordinate=function(t){},RT.prototype.isClosed=function(){},RT.prototype.setData=function(t){},RT.prototype.getData=function(){},RT.prototype.interfaces_=function(){return[]},RT.prototype.getClass=function(){return RT};var UT=function(){};UT.prototype.addIntersection=function(t,e){},UT.prototype.interfaces_=function(){return[RT]},UT.prototype.getClass=function(){return UT};var DT=function(){this._nodeList=new kT(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};DT.prototype.getCoordinates=function(){return this._pts},DT.prototype.size=function(){return this._pts.length},DT.prototype.getCoordinate=function(t){return this._pts[t]},DT.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},DT.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},DT.prototype.setData=function(t){this._data=t},DT.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:NT.octant(t,e)},DT.prototype.getData=function(){return this._data},DT.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var r=arguments[1],n=arguments[3],i=new PS(arguments[0].getIntersection(n));this.addIntersection(i,r)}},DT.prototype.toString=function(){return iB.toLineString(new LI(this._pts))},DT.prototype.getNodeList=function(){return this._nodeList},DT.prototype.addIntersectionNode=function(t,e){var r=e,n=r+1;if(n<this._pts.length){var i=this._pts[n];t.equals2D(i)&&(r=n)}return this._nodeList.add(t,r)},DT.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},DT.prototype.interfaces_=function(){return[UT]},DT.prototype.getClass=function(){return DT},DT.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new FB;return DT.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();)n.next().getNodeList().addSplitEdges(r)};var QT=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new PS,this.p1=new PS;else if(1===arguments.length){var t=arguments[0];this.p0=new PS(t.p0),this.p1=new PS(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=arguments[3];this.p0=new PS(e,r),this.p1=new PS(n,i)}},GT={serialVersionUID:{configurable:!0}};QT.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},QT.prototype.orientationIndex=function(){if(arguments[0]instanceof QT){var t=arguments[0],e=fB.orientationIndex(this.p0,this.p1,t.p0),r=fB.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&r>=0||e<=0&&r<=0?Math.max(e,r):0}if(arguments[0]instanceof PS){var n=arguments[0];return fB.orientationIndex(this.p0,this.p1,n)}},QT.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},QT.prototype.isVertical=function(){return this.p0.x===this.p1.x},QT.prototype.equals=function(t){if(!(t instanceof QT))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},QT.prototype.intersection=function(t){var e=new hB;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},QT.prototype.project=function(){if(arguments[0]instanceof PS){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new PS(t);var e=this.projectionFactor(t),r=new PS;return r.x=this.p0.x+e*(this.p1.x-this.p0.x),r.y=this.p0.y+e*(this.p1.y-this.p0.y),r}if(arguments[0]instanceof QT){var n=arguments[0],i=this.projectionFactor(n.p0),o=this.projectionFactor(n.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(n.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(n.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new QT(s,a)}},QT.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},QT.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},QT.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},QT.prototype.distancePerpendicular=function(t){return fB.distancePointLinePerpendicular(t,this.p0,this.p1)},QT.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},QT.prototype.midPoint=function(){return QT.midPoint(this.p0,this.p1)},QT.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,r=this.p1.y-this.p0.y,n=e*e+r*r;return n<=0?CS.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*r)/n},QT.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var r=new Array(2).fill(null),n=CS.MAX_VALUE,i=null,o=this.closestPoint(t.p0);n=o.distance(t.p0),r[0]=o,r[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<n&&(n=i,r[0]=s,r[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<n&&(n=i,r[0]=this.p0,r[1]=a);var l=t.closestPoint(this.p1);return(i=l.distance(this.p1))<n&&(n=i,r[0]=this.p1,r[1]=l),r},QT.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},QT.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},QT.prototype.getLength=function(){return this.p0.distance(this.p1)},QT.prototype.compareTo=function(t){var e=t,r=this.p0.compareTo(e.p0);return 0!==r?r:this.p1.compareTo(e.p1)},QT.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},QT.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)},QT.prototype.lineIntersection=function(t){try{return ZS.intersection(this.p0,this.p1,t.p0,t.p1)}catch(e){if(!(e instanceof XS))throw e}return null},QT.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},QT.prototype.pointAlongOffset=function(t,e){var r=this.p0.x+t*(this.p1.x-this.p0.x),n=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,s=Math.sqrt(i*i+o*o),a=0,l=0;if(0!==e){if(s<=0)throw new Error("Cannot compute offset from zero-length line segment");a=e*i/s,l=e*o/s}return new PS(r-l,n+a)},QT.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=r.x,this.p1.y=r.y}},QT.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||CS.isNaN(e))&&(e=1),e},QT.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},QT.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},QT.prototype.distance=function(){if(arguments[0]instanceof QT){var t=arguments[0];return fB.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof PS){var e=arguments[0];return fB.distancePointLine(e,this.p0,this.p1)}},QT.prototype.pointAlong=function(t){var e=new PS;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},QT.prototype.hashCode=function(){var t=CS.doubleToLongBits(this.p0.x);t^=31*CS.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),r=CS.doubleToLongBits(this.p1.x);return r^=31*CS.doubleToLongBits(this.p1.y),e^Math.trunc(r)^Math.trunc(r>>32)},QT.prototype.interfaces_=function(){return[SS,TS]},QT.prototype.getClass=function(){return QT},QT.midPoint=function(t,e){return new PS((t.x+e.x)/2,(t.y+e.y)/2)},GT.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(QT,GT);var jT=function(){this.tempEnv1=new JS,this.tempEnv2=new JS,this._overlapSeg1=new QT,this._overlapSeg2=new QT};jT.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},jT.prototype.interfaces_=function(){return[]},jT.prototype.getClass=function(){return jT};var HT=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._pts=t,this._start=e,this._end=r,this._context=n};HT.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},HT.prototype.computeSelect=function(t,e,r,n){var i=this._pts[e],o=this._pts[r];if(n.tempEnv1.init(i,o),r-e==1)return n.select(this,e),null;if(!t.intersects(n.tempEnv1))return null;var s=Math.trunc((e+r)/2);e<s&&this.computeSelect(t,e,s,n),s<r&&this.computeSelect(t,s,r,n)},HT.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,r=this._start;r<=this._end;r++)t[e++]=this._pts[r];return t},HT.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},HT.prototype.setId=function(t){this._id=t},HT.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},HT.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new JS(t,e)}return this._env},HT.prototype.getEndIndex=function(){return this._end},HT.prototype.getStartIndex=function(){return this._start},HT.prototype.getContext=function(){return this._context},HT.prototype.getId=function(){return this._id},HT.prototype.computeOverlapsInternal=function(t,e,r,n,i,o){var s=this._pts[t],a=this._pts[e],l=r._pts[n],u=r._pts[i];if(e-t==1&&i-n==1)return o.overlap(this,t,r,n),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(l,u),!o.tempEnv1.intersects(o.tempEnv2))return null;var h=Math.trunc((t+e)/2),c=Math.trunc((n+i)/2);t<h&&(n<c&&this.computeOverlapsInternal(t,h,r,n,c,o),c<i&&this.computeOverlapsInternal(t,h,r,c,i,o)),h<e&&(n<c&&this.computeOverlapsInternal(h,e,r,n,c,o),c<i&&this.computeOverlapsInternal(h,e,r,c,i,o))},HT.prototype.interfaces_=function(){return[]},HT.prototype.getClass=function(){return HT};var zT=function(){};zT.prototype.interfaces_=function(){return[]},zT.prototype.getClass=function(){return zT},zT.getChainStartIndices=function(t){var e=0,r=new FB;r.add(new QS(e));do{var n=zT.findChainEnd(t,e);r.add(new QS(n)),e=n}while(e<t.length-1);return zT.toIntArray(r)},zT.findChainEnd=function(t,e){for(var r=e;r<t.length-1&&t[r].equals2D(t[r+1]);)r++;if(r>=t.length-1)return t.length-1;for(var n=cT.quadrant(t[r],t[r+1]),i=e+1;i<t.length&&(t[i-1].equals2D(t[i])||cT.quadrant(t[i-1],t[i])===n);)i++;return i-1},zT.getChains=function(){if(1===arguments.length){var t=arguments[0];return zT.getChains(t,null)}if(2===arguments.length){for(var e=arguments[0],r=arguments[1],n=new FB,i=zT.getChainStartIndices(e),o=0;o<i.length-1;o++){var s=new HT(e,i[o],i[o+1],r);n.add(s)}return n}},zT.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var VT=function(){};VT.prototype.computeNodes=function(t){},VT.prototype.getNodedSubstrings=function(){},VT.prototype.interfaces_=function(){return[]},VT.prototype.getClass=function(){return VT};var KT=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};KT.prototype.setSegmentIntersector=function(t){this._segInt=t},KT.prototype.interfaces_=function(){return[VT]},KT.prototype.getClass=function(){return KT};var qT=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new FB,this._index=new FT,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return DT.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=this,r=zT.getChains(t.getCoordinates(),t).iterator();r.hasNext();){var n=r.next();n.setId(e._idCounter++),e._index.insert(n.getEnvelope(),n),e._monoChains.add(n)}},e.prototype.computeNodes=function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},e.prototype.intersectChains=function(){for(var t=this,e=new WT(this._segInt),r=this._monoChains.iterator();r.hasNext();)for(var n=r.next(),i=t._index.query(n.getEnvelope()).iterator();i.hasNext();){var o=i.next();if(o.getId()>n.getId()&&(n.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.SegmentOverlapAction.get=function(){return WT},Object.defineProperties(e,r),e}(KT),WT=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[1],r=arguments[2],n=arguments[3],i=arguments[0].getContext(),o=r.getContext();this._si.processIntersections(i,e,o,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(jT),XT=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(n)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},YT={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}};XT.prototype.getEndCapStyle=function(){return this._endCapStyle},XT.prototype.isSingleSided=function(){return this._isSingleSided},XT.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=XT.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=XT.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==XT.JOIN_ROUND&&(this._quadrantSegments=XT.DEFAULT_QUADRANT_SEGMENTS)},XT.prototype.getJoinStyle=function(){return this._joinStyle},XT.prototype.setJoinStyle=function(t){this._joinStyle=t},XT.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},XT.prototype.getSimplifyFactor=function(){return this._simplifyFactor},XT.prototype.getQuadrantSegments=function(){return this._quadrantSegments},XT.prototype.setEndCapStyle=function(t){this._endCapStyle=t},XT.prototype.getMitreLimit=function(){return this._mitreLimit},XT.prototype.setMitreLimit=function(t){this._mitreLimit=t},XT.prototype.setSingleSided=function(t){this._isSingleSided=t},XT.prototype.interfaces_=function(){return[]},XT.prototype.getClass=function(){return XT},XT.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},YT.CAP_ROUND.get=function(){return 1},YT.CAP_FLAT.get=function(){return 2},YT.CAP_SQUARE.get=function(){return 3},YT.JOIN_ROUND.get=function(){return 1},YT.JOIN_MITRE.get=function(){return 2},YT.JOIN_BEVEL.get=function(){return 3},YT.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},YT.DEFAULT_MITRE_LIMIT.get=function(){return 5},YT.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(XT,YT);var ZT=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=fB.COUNTERCLOCKWISE,this._inputLine=t||null},JT={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};ZT.prototype.isDeletable=function(t,e,r,n){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[r];return!!this.isConcave(i,o,s)&&!!this.isShallow(i,o,s,n)&&this.isShallowSampled(i,o,t,r,n)},ZT.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,r=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(r),i=!1;n<this._inputLine.length;){var o=!1;t.isDeletable(e,r,n,t._distanceTol)&&(t._isDeleted[r]=ZT.DELETE,o=!0,i=!0),e=o?n:r,r=t.findNextNonDeletedIndex(e),n=t.findNextNonDeletedIndex(r)}return i},ZT.prototype.isShallowConcavity=function(t,e,r,n){return fB.computeOrientation(t,e,r)===this._angleOrientation&&fB.distancePointLine(e,t,r)<n},ZT.prototype.isShallowSampled=function(t,e,r,n,i){var o=Math.trunc((n-r)/ZT.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=r;s<n;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},ZT.prototype.isConcave=function(t,e,r){return fB.computeOrientation(t,e,r)===this._angleOrientation},ZT.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=fB.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},ZT.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===ZT.DELETE;)e++;return e},ZT.prototype.isShallow=function(t,e,r,n){return fB.distancePointLine(e,t,r)<n},ZT.prototype.collapseLine=function(){for(var t=new MB,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==ZT.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},ZT.prototype.interfaces_=function(){return[]},ZT.prototype.getClass=function(){return ZT},ZT.simplify=function(t,e){return new ZT(t).simplify(e)},JT.INIT.get=function(){return 0},JT.DELETE.get=function(){return 1},JT.KEEP.get=function(){return 1},JT.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(ZT,JT);var $T=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new FB},tP={COORDINATE_ARRAY_TYPE:{configurable:!0}};$T.prototype.getCoordinates=function(){return this._ptList.toArray($T.COORDINATE_ARRAY_TYPE)},$T.prototype.setPrecisionModel=function(t){this._precisionModel=t},$T.prototype.addPt=function(t){var e=new PS(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},$T.prototype.revere=function(){},$T.prototype.addPts=function(t,e){if(e)for(var r=0;r<t.length;r++)this.addPt(t[r]);else for(var n=t.length-1;n>=0;n--)this.addPt(t[n])},$T.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},$T.prototype.toString=function(){return(new GI).createLineString(this.getCoordinates()).toString()},$T.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new PS(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},$T.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},$T.prototype.interfaces_=function(){return[]},$T.prototype.getClass=function(){return $T},tP.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties($T,tP);var eP=function(){},rP={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};eP.prototype.interfaces_=function(){return[]},eP.prototype.getClass=function(){return eP},eP.toDegrees=function(t){return 180*t/Math.PI},eP.normalize=function(t){for(;t>Math.PI;)t-=eP.PI_TIMES_2;for(;t<=-Math.PI;)t+=eP.PI_TIMES_2;return t},eP.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],r=arguments[1],n=r.x-e.x,i=r.y-e.y;return Math.atan2(i,n)}},eP.isAcute=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)>0},eP.isObtuse=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)<0},eP.interiorAngle=function(t,e,r){var n=eP.angle(e,t),i=eP.angle(e,r);return Math.abs(i-n)},eP.normalizePositive=function(t){if(t<0){for(;t<0;)t+=eP.PI_TIMES_2;t>=eP.PI_TIMES_2&&(t=0)}else{for(;t>=eP.PI_TIMES_2;)t-=eP.PI_TIMES_2;t<0&&(t=0)}return t},eP.angleBetween=function(t,e,r){var n=eP.angle(e,t),i=eP.angle(e,r);return eP.diff(n,i)},eP.diff=function(t,e){var r=null;return(r=t<e?e-t:t-e)>Math.PI&&(r=2*Math.PI-r),r},eP.toRadians=function(t){return t*Math.PI/180},eP.getTurn=function(t,e){var r=Math.sin(e-t);return r>0?eP.COUNTERCLOCKWISE:r<0?eP.CLOCKWISE:eP.NONE},eP.angleBetweenOriented=function(t,e,r){var n=eP.angle(e,t),i=eP.angle(e,r)-n;return i<=-Math.PI?i+eP.PI_TIMES_2:i>Math.PI?i-eP.PI_TIMES_2:i},rP.PI_TIMES_2.get=function(){return 2*Math.PI},rP.PI_OVER_2.get=function(){return Math.PI/2},rP.PI_OVER_4.get=function(){return Math.PI/4},rP.COUNTERCLOCKWISE.get=function(){return fB.COUNTERCLOCKWISE},rP.CLOCKWISE.get=function(){return fB.CLOCKWISE},rP.NONE.get=function(){return fB.COLLINEAR},Object.defineProperties(eP,rP);var nP=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 QT,this._seg1=new QT,this._offset0=new QT,this._offset1=new QT,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._precisionModel=e,this._bufParams=r,this._li=new hB,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===XT.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},iP={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}};nP.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var r=fB.computeOrientation(this._s0,this._s1,this._s2),n=r===fB.CLOCKWISE&&this._side===XI.LEFT||r===fB.COUNTERCLOCKWISE&&this._side===XI.RIGHT;0===r?this.addCollinear(e):n?this.addOutsideTurn(r,e):this.addInsideTurn(r,e)},nP.prototype.addLineEndCap=function(t,e){var r=new QT(t,e),n=new QT;this.computeOffsetSegment(r,XI.LEFT,this._distance,n);var i=new QT;this.computeOffsetSegment(r,XI.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 XT.CAP_ROUND:this._segList.addPt(n.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,fB.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case XT.CAP_FLAT:this._segList.addPt(n.p1),this._segList.addPt(i.p1);break;case XT.CAP_SQUARE:var l=new PS;l.x=Math.abs(this._distance)*Math.cos(a),l.y=Math.abs(this._distance)*Math.sin(a);var u=new PS(n.p1.x+l.x,n.p1.y+l.y),h=new PS(i.p1.x+l.x,i.p1.y+l.y);this._segList.addPt(u),this._segList.addPt(h)}},nP.prototype.getCoordinates=function(){return this._segList.getCoordinates()},nP.prototype.addMitreJoin=function(t,e,r,n){var i=!0,o=null;try{o=ZS.intersection(e.p0,e.p1,r.p0,r.p1),(n<=0?1:o.distance(t)/Math.abs(n))>this._bufParams.getMitreLimit()&&(i=!1)}catch(s){if(!(s instanceof XS))throw s;o=new PS(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,r,n,this._bufParams.getMitreLimit())},nP.prototype.addFilletCorner=function(t,e,r,n,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),l=r.x-t.x,u=r.y-t.y,h=Math.atan2(u,l);n===fB.CLOCKWISE?a<=h&&(a+=2*Math.PI):a>=h&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,h,n,i),this._segList.addPt(r)},nP.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*nP.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===XT.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===XT.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))},nP.prototype.createSquare=function(t){this._segList.addPt(new PS(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new PS(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new PS(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new PS(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},nP.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},nP.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},nP.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},nP.prototype.initSideSegments=function(t,e,r){this._s1=t,this._s2=e,this._side=r,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,r,this._distance,this._offset1)},nP.prototype.addLimitedMitreJoin=function(t,e,r,n){var i=this._seg0.p1,o=eP.angle(i,this._seg0.p0),s=eP.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=eP.normalize(o+s),l=eP.normalize(a+Math.PI),u=n*r,h=r-u*Math.abs(Math.sin(s)),c=i.x+u*Math.cos(l),A=i.y+u*Math.sin(l),f=new PS(c,A),p=new QT(i,f),d=p.pointAlongOffset(1,h),g=p.pointAlongOffset(1,-h);this._side===XI.LEFT?(this._segList.addPt(d),this._segList.addPt(g)):(this._segList.addPt(g),this._segList.addPt(d))},nP.prototype.computeOffsetSegment=function(t,e,r,n){var i=e===XI.LEFT?1:-1,o=t.p1.x-t.p0.x,s=t.p1.y-t.p0.y,a=Math.sqrt(o*o+s*s),l=i*r*o/a,u=i*r*s/a;n.p0.x=t.p0.x-u,n.p0.y=t.p0.y+l,n.p1.x=t.p1.x-u,n.p1.y=t.p1.y+l},nP.prototype.addFilletArc=function(t,e,r,n,i){var o=n===fB.CLOCKWISE?-1:1,s=Math.abs(e-r),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var l=s/a,u=0,h=new PS;u<s;){var c=e+o*u;h.x=t.x+i*Math.cos(c),h.y=t.y+i*Math.sin(c),this._segList.addPt(h),u+=l}},nP.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*nP.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var r=new PS((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r);var n=new PS((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},nP.prototype.createCircle=function(t){var e=new PS(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},nP.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},nP.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new $T,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*nP.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},nP.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===XT.JOIN_BEVEL||this._bufParams.getJoinStyle()===XT.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,fB.CLOCKWISE,this._distance))},nP.prototype.closeRing=function(){this._segList.closeRing()},nP.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},nP.prototype.interfaces_=function(){return[]},nP.prototype.getClass=function(){return nP},iP.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},iP.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},iP.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},iP.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(nP,iP);var oP=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};oP.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var r=e<0,n=Math.abs(e),i=this.getSegGen(n);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,r,i);var o=i.getCoordinates();return r&&OB.reverse(o),o},oP.prototype.computeSingleSidedBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){r.addSegments(t,!0);var i=ZT.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],XI.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{r.addSegments(t,!1);var a=ZT.simplify(t,n),l=a.length-1;r.initSideSegments(a[0],a[1],XI.LEFT),r.addFirstSegment();for(var u=2;u<=l;u++)r.addNextSegment(a[u],!0)}r.addLastSegment(),r.closeRing()},oP.prototype.computeRingBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);e===XI.RIGHT&&(n=-n);var i=ZT.simplify(t,n),o=i.length-1;r.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;r.addNextSegment(i[s],a)}r.closeRing()},oP.prototype.computeLineBufferCurve=function(t,e){var r=this.simplifyTolerance(this._distance),n=ZT.simplify(t,r),i=n.length-1;e.initSideSegments(n[0],n[1],XI.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(n[o],!0);e.addLastSegment(),e.addLineEndCap(n[i-1],n[i]);var s=ZT.simplify(t,-r),a=s.length-1;e.initSideSegments(s[a],s[a-1],XI.LEFT);for(var l=a-2;l>=0;l--)e.addNextSegment(s[l],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},oP.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case XT.CAP_ROUND:e.createCircle(t);break;case XT.CAP_SQUARE:e.createSquare(t)}},oP.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var r=Math.abs(e),n=this.getSegGen(r);if(t.length<=1)this.computePointCurve(t[0],n);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,n)}else this.computeLineBufferCurve(t,n);return n.getCoordinates()},oP.prototype.getBufferParameters=function(){return this._bufParams},oP.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},oP.prototype.getRingCurve=function(t,e,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(0===r)return oP.copyCoordinates(t);var n=this.getSegGen(r);return this.computeRingBufferCurve(t,e,n),n.getCoordinates()},oP.prototype.computeOffsetCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){var i=ZT.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],XI.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{var a=ZT.simplify(t,n),l=a.length-1;r.initSideSegments(a[0],a[1],XI.LEFT),r.addFirstSegment();for(var u=2;u<=l;u++)r.addNextSegment(a[u],!0)}r.addLastSegment()},oP.prototype.getSegGen=function(t){return new nP(this._precisionModel,this._bufParams,t)},oP.prototype.interfaces_=function(){return[]},oP.prototype.getClass=function(){return oP},oP.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),r=0;r<e.length;r++)e[r]=new PS(t[r]);return e};var sP=function(){this._subgraphs=null,this._seg=new QT,this._cga=new fB;var t=arguments[0];this._subgraphs=t},aP={DepthSegment:{configurable:!0}};sP.prototype.findStabbedSegments=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=new FB,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),o=i.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),r)}return r}if(3===arguments.length)if(NS(arguments[2],TB)&&arguments[0]instanceof PS&&arguments[1]instanceof pT){for(var s=arguments[0],a=arguments[1],l=arguments[2],u=a.getEdge().getCoordinates(),h=0;h<u.length-1;h++)if(t._seg.p0=u[h],t._seg.p1=u[h+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||fB.computeOrientation(t._seg.p0,t._seg.p1,s)===fB.RIGHT)){var c=a.getDepth(XI.LEFT);t._seg.p0.equals(u[h])||(c=a.getDepth(XI.RIGHT));var A=new lP(t._seg,c);l.add(A)}}else if(NS(arguments[2],TB)&&arguments[0]instanceof PS&&NS(arguments[1],TB))for(var f=arguments[0],p=arguments[2],d=arguments[1].iterator();d.hasNext();){var g=d.next();g.isForward()&&t.findStabbedSegments(f,g,p)}},sP.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:ET.min(e)._leftDepth},sP.prototype.interfaces_=function(){return[]},sP.prototype.getClass=function(){return sP},aP.DepthSegment.get=function(){return lP},Object.defineProperties(sP,aP);var lP=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new QT(t),this._leftDepth=e};lP.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var r=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==r||0!=(r=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?r:this._upwardSeg.compareTo(e._upwardSeg)},lP.prototype.compareX=function(t,e){var r=t.p0.compareTo(e.p0);return 0!==r?r:t.p1.compareTo(e.p1)},lP.prototype.toString=function(){return this._upwardSeg.toString()},lP.prototype.interfaces_=function(){return[SS]},lP.prototype.getClass=function(){return lP};var uP=function(t,e,r){this.p0=t||null,this.p1=e||null,this.p2=r||null};uP.prototype.area=function(){return uP.area(this.p0,this.p1,this.p2)},uP.prototype.signedArea=function(){return uP.signedArea(this.p0,this.p1,this.p2)},uP.prototype.interpolateZ=function(t){if(null===t)throw new xS("Supplied point is null.");return uP.interpolateZ(t,this.p0,this.p1,this.p2)},uP.prototype.longestSideLength=function(){return uP.longestSideLength(this.p0,this.p1,this.p2)},uP.prototype.isAcute=function(){return uP.isAcute(this.p0,this.p1,this.p2)},uP.prototype.circumcentre=function(){return uP.circumcentre(this.p0,this.p1,this.p2)},uP.prototype.area3D=function(){return uP.area3D(this.p0,this.p1,this.p2)},uP.prototype.centroid=function(){return uP.centroid(this.p0,this.p1,this.p2)},uP.prototype.inCentre=function(){return uP.inCentre(this.p0,this.p1,this.p2)},uP.prototype.interfaces_=function(){return[]},uP.prototype.getClass=function(){return uP},uP.area=function(t,e,r){return Math.abs(((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2)},uP.signedArea=function(t,e,r){return((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2},uP.det=function(t,e,r,n){return t*n-e*r},uP.interpolateZ=function(t,e,r,n){var i=e.x,o=e.y,s=r.x-i,a=n.x-i,l=r.y-o,u=n.y-o,h=s*u-a*l,c=t.x-i,A=t.y-o,f=(u*c-a*A)/h,p=(-l*c+s*A)/h;return e.z+f*(r.z-e.z)+p*(n.z-e.z)},uP.longestSideLength=function(t,e,r){var n=t.distance(e),i=e.distance(r),o=r.distance(t),s=n;return i>s&&(s=i),o>s&&(s=o),s},uP.isAcute=function(t,e,r){return!!eP.isAcute(t,e,r)&&!!eP.isAcute(e,r,t)&&!!eP.isAcute(r,t,e)},uP.circumcentre=function(t,e,r){var n=r.x,i=r.y,o=t.x-n,s=t.y-i,a=e.x-n,l=e.y-i,u=2*uP.det(o,s,a,l),h=uP.det(s,o*o+s*s,l,a*a+l*l),c=uP.det(o,o*o+s*s,a,a*a+l*l);return new PS(n-h/u,i+c/u)},uP.perpendicularBisector=function(t,e){var r=e.x-t.x,n=e.y-t.y,i=new ZS(t.x+r/2,t.y+n/2,1),o=new ZS(t.x-n+r/2,t.y+r+n/2,1);return new ZS(i,o)},uP.angleBisector=function(t,e,r){var n=e.distance(t),i=n/(n+e.distance(r)),o=r.x-t.x,s=r.y-t.y;return new PS(t.x+i*o,t.y+i*s)},uP.area3D=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=r.x-t.x,a=r.y-t.y,l=r.z-t.z,u=i*l-o*a,h=o*s-n*l,c=n*a-i*s,A=u*u+h*h+c*c;return Math.sqrt(A)/2},uP.centroid=function(t,e,r){var n=(t.x+e.x+r.x)/3,i=(t.y+e.y+r.y)/3;return new PS(n,i)},uP.inCentre=function(t,e,r){var n=e.distance(r),i=t.distance(r),o=t.distance(e),s=n+i+o,a=(n*t.x+i*e.x+o*r.x)/s,l=(n*t.y+i*e.y+o*r.y)/s;return new PS(a,l)};var hP=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new FB;var t=arguments[0],e=arguments[1],r=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=r};hP.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,OS.EXTERIOR,OS.INTERIOR)},hP.prototype.addPolygon=function(t){var e=this,r=this._distance,n=XI.LEFT;this._distance<0&&(r=-this._distance,n=XI.RIGHT);var i=t.getExteriorRing(),o=OB.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,r,n,OS.EXTERIOR,OS.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var a=t.getInteriorRingN(s),l=OB.removeRepeatedPoints(a.getCoordinates());e._distance>0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(l,r,XI.opposite(n),OS.INTERIOR,OS.EXTERIOR)}},hP.prototype.isTriangleErodedCompletely=function(t,e){var r=new uP(t[0],t[1],t[2]),n=r.inCentre();return fB.distancePointLine(n,r.p0,r.p1)<Math.abs(e)},hP.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=OB.removeRepeatedPoints(t.getCoordinates()),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,OS.EXTERIOR,OS.INTERIOR)},hP.prototype.addCurve=function(t,e,r){if(null===t||t.length<2)return null;var n=new DT(t,new iT(0,OS.BOUNDARY,e,r));this._curveList.add(n)},hP.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},hP.prototype.addPolygonRing=function(t,e,r,n,i){if(0===e&&t.length<EI.MINIMUM_VALID_SIZE)return null;var o=n,s=i;t.length>=EI.MINIMUM_VALID_SIZE&&fB.isCCW(t)&&(o=i,s=n,r=XI.opposite(r));var a=this._curveBuilder.getRingCurve(t,r,e);this.addCurve(a,o,s)},hP.prototype.add=function(t){if(t.isEmpty())return null;t instanceof xI?this.addPolygon(t):t instanceof vI?this.addLineString(t):t instanceof wI?this.addPoint(t):(t instanceof CI||t instanceof aI||t instanceof SI||t instanceof sI)&&this.addCollection(t)},hP.prototype.isErodedCompletely=function(t,e){var r=t.getCoordinates();if(r.length<4)return e<0;if(4===r.length)return this.isTriangleErodedCompletely(r,e);var n=t.getEnvelopeInternal(),i=Math.min(n.getHeight(),n.getWidth());return e<0&&2*Math.abs(e)>i},hP.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},hP.prototype.interfaces_=function(){return[]},hP.prototype.getClass=function(){return hP};var cP=function(){};cP.prototype.locate=function(t){},cP.prototype.interfaces_=function(){return[]},cP.prototype.getClass=function(){return cP};var AP=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()};AP.prototype.next=function(){if(this._atStart)return this._atStart=!1,AP.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 PB;var t=this._parent.getGeometryN(this._index++);return t instanceof sI?(this._subcollectionIterator=new AP(t),this._subcollectionIterator.next()):t},AP.prototype.remove=function(){throw new Error(this.getClass().getName())},AP.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)},AP.prototype.interfaces_=function(){return[IB]},AP.prototype.getClass=function(){return AP},AP.isAtomic=function(t){return!(t instanceof sI)};var fP=function(){this._geom=null;var t=arguments[0];this._geom=t};fP.prototype.locate=function(t){return fP.locate(t,this._geom)},fP.prototype.interfaces_=function(){return[cP]},fP.prototype.getClass=function(){return fP},fP.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&fB.isPointInRing(t,e.getCoordinates())},fP.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var r=e.getExteriorRing();if(!fP.isPointInRing(t,r))return!1;for(var n=0;n<e.getNumInteriorRing();n++){var i=e.getInteriorRingN(n);if(fP.isPointInRing(t,i))return!1}return!0},fP.containsPoint=function(t,e){if(e instanceof xI)return fP.containsPointInPolygon(t,e);if(e instanceof sI)for(var r=new AP(e);r.hasNext();){var n=r.next();if(n!==e&&fP.containsPoint(t,n))return!0}return!1},fP.locate=function(t,e){return e.isEmpty()?OS.EXTERIOR:fP.containsPoint(t,e)?OS.INTERIOR:OS.EXTERIOR};var pP=function(){this._edgeMap=new YB,this._edgeList=null,this._ptInAreaLocation=[OS.NONE,OS.NONE]};pP.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),r=e-1;return 0===e&&(r=this._edgeList.size()-1),this._edgeList.get(r)},pP.prototype.propagateSideLabels=function(t){for(var e=OS.NONE,r=this.iterator();r.hasNext();){var n=r.next().getLabel();n.isArea(t)&&n.getLocation(t,XI.LEFT)!==OS.NONE&&(e=n.getLocation(t,XI.LEFT))}if(e===OS.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,XI.ON)===OS.NONE&&a.setLocation(t,XI.ON,i),a.isArea(t)){var l=a.getLocation(t,XI.LEFT),u=a.getLocation(t,XI.RIGHT);if(u!==OS.NONE){if(u!==i)throw new tT("side location conflict",s.getCoordinate());l===OS.NONE&&aB.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=l}else aB.isTrue(a.getLocation(t,XI.LEFT)===OS.NONE,"found single null side"),a.setLocation(t,XI.RIGHT,i),a.setLocation(t,XI.LEFT,i)}}},pP.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},pP.prototype.print=function(t){YS.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)},pP.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},pP.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var r=e.size()-1,n=e.get(r).getLabel().getLocation(t,XI.LEFT);aB.isTrue(n!==OS.NONE,"Found unlabelled area edge");for(var i=n,o=this.iterator();o.hasNext();){var s=o.next().getLabel();aB.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,XI.LEFT),l=s.getLocation(t,XI.RIGHT);if(a===l)return!1;if(l!==i)return!1;i=a}return!0},pP.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},pP.prototype.iterator=function(){return this.getEdges().iterator()},pP.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new FB(this._edgeMap.values())),this._edgeList},pP.prototype.getLocation=function(t,e,r){return this._ptInAreaLocation[t]===OS.NONE&&(this._ptInAreaLocation[t]=fP.locate(e,r[t].getGeometry())),this._ptInAreaLocation[t]},pP.prototype.toString=function(){var t=new DS;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var r=e.next();t.append(r),t.append("\n")}return t.toString()},pP.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)},pP.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],r=this.iterator();r.hasNext();)for(var n=r.next().getLabel(),i=0;i<2;i++)n.isLine(i)&&n.getLocation(i)===OS.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),l=0;l<2;l++)if(a.isAnyNull(l)){var u=OS.NONE;if(e[l])u=OS.EXTERIOR;else{var h=s.getCoordinate();u=this.getLocation(l,h,t)}a.setAllLocationsIfNull(l,u)}},pP.prototype.getDegree=function(){return this._edgeMap.size()},pP.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},pP.prototype.interfaces_=function(){return[]},pP.prototype.getClass=function(){return pP};var dP=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){var t=this;this.getResultAreaEdges();for(var e=null,r=null,n=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var o=t._resultAreaEdgeList.get(i),s=o.getSym();if(o.getLabel().isArea())switch(null===e&&o.isInResult()&&(e=o),n){case t._SCANNING_FOR_INCOMING:if(!s.isInResult())continue;r=s,n=t._LINKING_TO_OUTGOING;break;case t._LINKING_TO_OUTGOING:if(!o.isInResult())continue;r.setNext(o),n=t._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===e)throw new tT("no outgoing dirEdge found",this.getCoordinate());aB.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),r.setNext(e)}},e.prototype.insert=function(t){var e=t;this.insertEdgeEnd(e,e)},e.prototype.getRightmostEdge=function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var r=t.get(0);if(1===e)return r;var n=t.get(e-1),i=r.getQuadrant(),o=n.getQuadrant();return cT.isNorthern(i)&&cT.isNorthern(o)?r:cT.isNorthern(i)||cT.isNorthern(o)?0!==r.getDy()?r:0!==n.getDy()?n:(aB.shouldNeverReachHere("found two horizontal edges incident on node"),null):n},e.prototype.print=function(t){YS.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var r=e.next();t.print("out "),r.print(t),t.println(),t.print("in "),r.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new FB;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},e.prototype.updateLabelling=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next().getLabel();r.setAllLocationsIfNull(0,t.getLocation(0)),r.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,r=this._edgeList.size()-1;r>=0;r--){var n=this._edgeList.get(r),i=n.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=n}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),r=t.getDepth(XI.LEFT),n=t.getDepth(XI.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),r);if(this.computeDepths(0,e,i)!==n)throw new tT("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 l=this._edgeList.get(a);l.setEdgeDepths(XI.RIGHT,s),s=l.getDepth(XI.LEFT)}return s}},e.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},e.prototype.linkMinimalDirectedEdges=function(t){for(var e=this,r=null,n=null,i=this._SCANNING_FOR_INCOMING,o=this._resultAreaEdgeList.size()-1;o>=0;o--){var s=e._resultAreaEdgeList.get(o),a=s.getSym();switch(null===r&&s.getEdgeRing()===t&&(r=s),i){case e._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;n=a,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;n.setNextMin(s),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(aB.isTrue(null!==r,"found null for first outgoing dirEdge"),aB.isTrue(r.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(r))},e.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();)e.next().isInResult()&&t++;return t}if(1===arguments.length){for(var r=arguments[0],n=0,i=this.iterator();i.hasNext();)i.next().getEdgeRing()===r&&n++;return n}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=OS.NONE,e=this.iterator();e.hasNext();){var r=e.next(),n=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){t=OS.INTERIOR;break}if(n.isInResult()){t=OS.EXTERIOR;break}}}if(t===OS.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===OS.INTERIOR):(s.isInResult()&&(i=OS.EXTERIOR),a.isInResult()&&(i=OS.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new iT(OS.NONE);for(var r=this.iterator();r.hasNext();)for(var n=r.next().getEdge().getLabel(),i=0;i<2;i++){var o=n.getLocation(i);o!==OS.INTERIOR&&o!==OS.BOUNDARY||this._label.setLocation(i,OS.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(pP),gP=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 uT(t,new dP)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(dT),yP=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};yP.prototype.compareTo=function(t){var e=t;return yP.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},yP.prototype.interfaces_=function(){return[SS]},yP.prototype.getClass=function(){return yP},yP.orientation=function(t){return 1===OB.increasingDirection(t)},yP.compareOriented=function(t,e,r,n){for(var i=e?1:-1,o=n?1:-1,s=e?t.length:-1,a=n?r.length:-1,l=e?0:t.length-1,u=n?0:r.length-1;;){var h=t[l].compareTo(r[u]);if(0!==h)return h;var c=(l+=i)===s,A=(u+=o)===a;if(c&&!A)return-1;if(!c&&A)return 1;if(c&&A)return 0}};var mP=function(){this._edges=new FB,this._ocaMap=new YB};mP.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var r=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var n=r.getCoordinates(),i=0;i<n.length;i++)i>0&&t.print(","),t.print(n[i].x+" "+n[i].y);t.println(")")}t.print(") ")},mP.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},mP.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},mP.prototype.iterator=function(){return this._edges.iterator()},mP.prototype.getEdges=function(){return this._edges},mP.prototype.get=function(t){return this._edges.get(t)},mP.prototype.findEqualEdge=function(t){var e=new yP(t.getCoordinates());return this._ocaMap.get(e)},mP.prototype.add=function(t){this._edges.add(t);var e=new yP(t.getCoordinates());this._ocaMap.put(e,t)},mP.prototype.interfaces_=function(){return[]},mP.prototype.getClass=function(){return mP};var vP=function(){};vP.prototype.processIntersections=function(t,e,r,n){},vP.prototype.isDone=function(){},vP.prototype.interfaces_=function(){return[]},vP.prototype.getClass=function(){return vP};var _P=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};_P.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(_P.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},_P.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},_P.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},_P.prototype.getLineIntersector=function(){return this._li},_P.prototype.hasProperIntersection=function(){return this._hasProper},_P.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},_P.prototype.hasIntersection=function(){return this._hasIntersection},_P.prototype.isDone=function(){return!1},_P.prototype.hasInteriorIntersection=function(){return this._hasInterior},_P.prototype.interfaces_=function(){return[vP]},_P.prototype.getClass=function(){return _P},_P.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var wP=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],r=arguments[2];this.coord=new PS(t),this.segmentIndex=e,this.dist=r};wP.prototype.getSegmentIndex=function(){return this.segmentIndex},wP.prototype.getCoordinate=function(){return this.coord},wP.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},wP.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},wP.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},wP.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},wP.prototype.getDistance=function(){return this.dist},wP.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},wP.prototype.interfaces_=function(){return[SS]},wP.prototype.getClass=function(){return wP};var bP=function(){this._nodeMap=new YB,this.edge=null;var t=arguments[0];this.edge=t};bP.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},bP.prototype.iterator=function(){return this._nodeMap.values().iterator()},bP.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},bP.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)},bP.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new PS(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 BP(o,new iT(this.edge._label))},bP.prototype.add=function(t,e,r){var n=new wP(t,e,r),i=this._nodeMap.get(n);return null!==i?i:(this._nodeMap.put(n,n),n)},bP.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1},bP.prototype.interfaces_=function(){return[]},bP.prototype.getClass=function(){return bP};var xP=function(){};xP.prototype.getChainStartIndices=function(t){var e=0,r=new FB;r.add(new QS(e));do{var n=this.findChainEnd(t,e);r.add(new QS(n)),e=n}while(e<t.length-1);return xP.toIntArray(r)},xP.prototype.findChainEnd=function(t,e){for(var r=cT.quadrant(t[e],t[e+1]),n=e+1;n<t.length&&cT.quadrant(t[n-1],t[n])===r;)n++;return n-1},xP.prototype.interfaces_=function(){return[]},xP.prototype.getClass=function(){return xP},xP.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var CP=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new JS,this.env2=new JS;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new xP;this.startIndex=e.getChainStartIndices(this.pts)};CP.prototype.getCoordinates=function(){return this.pts},CP.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e>r?e:r},CP.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e<r?e:r},CP.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[r],e.startIndex[r+1],n)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],l=arguments[4],u=arguments[5],h=this.pts[i],c=this.pts[o],A=s.pts[a],f=s.pts[l];if(o-i==1&&l-a==1)return u.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(h,c),this.env2.init(A,f),!this.env1.intersects(this.env2))return null;var p=Math.trunc((i+o)/2),d=Math.trunc((a+l)/2);i<p&&(a<d&&this.computeIntersectsForChain(i,p,s,a,d,u),d<l&&this.computeIntersectsForChain(i,p,s,d,l,u)),p<o&&(a<d&&this.computeIntersectsForChain(p,o,s,a,d,u),d<l&&this.computeIntersectsForChain(p,o,s,d,l,u))}},CP.prototype.getStartIndexes=function(){return this.startIndex},CP.prototype.computeIntersects=function(t,e){for(var r=0;r<this.startIndex.length-1;r++)for(var n=0;n<t.startIndex.length-1;n++)this.computeIntersectsForChain(r,t,n,e)},CP.prototype.interfaces_=function(){return[]},CP.prototype.getClass=function(){return CP};var EP=function t(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var e=0;e<2;e++)for(var r=0;r<3;r++)this._depth[e][r]=t.NULL_VALUE},SP={NULL_VALUE:{configurable:!0}};EP.prototype.getDepth=function(t,e){return this._depth[t][e]},EP.prototype.setDepth=function(t,e,r){this._depth[t][e]=r},EP.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]!==EP.NULL_VALUE)return!1;return!0}if(1===arguments.length){var r=arguments[0];return this._depth[r][1]===EP.NULL_VALUE}if(2===arguments.length){var n=arguments[0],i=arguments[1];return this._depth[n][i]===EP.NULL_VALUE}},EP.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var r=t._depth[e][1];t._depth[e][2]<r&&(r=t._depth[e][2]),r<0&&(r=0);for(var n=1;n<3;n++){var i=0;t._depth[e][n]>r&&(i=1),t._depth[e][n]=i}}},EP.prototype.getDelta=function(t){return this._depth[t][XI.RIGHT]-this._depth[t][XI.LEFT]},EP.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?OS.EXTERIOR:OS.INTERIOR},EP.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},EP.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],r=0;r<2;r++)for(var n=1;n<3;n++){var i=e.getLocation(r,n);i!==OS.EXTERIOR&&i!==OS.INTERIOR||(t.isNull(r,n)?t._depth[r][n]=EP.depthAtLocation(i):t._depth[r][n]+=EP.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],s=arguments[1];arguments[2]===OS.INTERIOR&&this._depth[o][s]++}},EP.prototype.interfaces_=function(){return[]},EP.prototype.getClass=function(){return EP},EP.depthAtLocation=function(t){return t===OS.EXTERIOR?0:t===OS.INTERIOR?1:EP.NULL_VALUE},SP.NULL_VALUE.get=function(){return-1},Object.defineProperties(EP,SP);var BP=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new bP(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new EP,this._depthDelta=0,1===arguments.length){var r=arguments[0];e.call(this,r,null)}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.pts=n,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new e(t,iT.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var r=t;if(this.pts.length!==r.pts.length)return!1;for(var n=!0,i=!0,o=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(r.pts[s])||(n=!1),this.pts[s].equals2D(r.pts[--o])||(i=!1),!n&&!i)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new CP(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new JS;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,r,n){var i=new PS(t.getIntersection(n)),o=e,s=t.getEdgeDistance(r,n),a=o+1;if(a<this.pts.length){var l=this.pts[a];i.equals2D(l)&&(o=a,s=0)}this.eiList.add(i,o,s)},e.prototype.toString=function(){var t=new DS;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments[0],r=arguments[1];r.setAtLeastIfValid(e.getLocation(0,XI.ON),e.getLocation(1,XI.ON),1),e.isArea()&&(r.setAtLeastIfValid(e.getLocation(0,XI.LEFT),e.getLocation(1,XI.LEFT),2),r.setAtLeastIfValid(e.getLocation(0,XI.RIGHT),e.getLocation(1,XI.RIGHT),2))},e}(lT),IP=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new mP,this._bufParams=t||null};IP.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},IP.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new iT(t.getLabel())).flip(),r.merge(n);var i=IP.depthDelta(n),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(IP.depthDelta(t.getLabel()))},IP.prototype.buildSubgraphs=function(t,e){for(var r=new FB,n=t.iterator();n.hasNext();){var i=n.next(),o=i.getRightmostCoordinate(),s=new sP(r).getDepth(o);i.computeDepth(s),i.findResultEdges(),r.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},IP.prototype.createSubgraphs=function(t){for(var e=new FB,r=t.getNodes().iterator();r.hasNext();){var n=r.next();if(!n.isVisited()){var i=new rT;i.create(n),e.add(i)}}return ET.sort(e,ET.reverseOrder()),e},IP.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},IP.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new qT,r=new hB;return r.setPrecisionModel(t),e.setSegmentIntersector(new _P(r)),e},IP.prototype.buffer=function(t,e){var r=this._workingPrecisionModel;null===r&&(r=t.getPrecisionModel()),this._geomFact=t.getFactory();var n=new oP(r,this._bufParams),i=new hP(t,e,n).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,r),this._graph=new gT(new gP),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new yT(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},IP.prototype.computeNodedEdges=function(t,e){var r=this.getNoder(e);r.computeNodes(t);for(var n=r.getNodedSubstrings().iterator();n.hasNext();){var i=n.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=i.getData(),a=new BP(i.getCoordinates(),new iT(s));this.insertUniqueEdge(a)}}},IP.prototype.setNoder=function(t){this._workingNoder=t},IP.prototype.interfaces_=function(){return[]},IP.prototype.getClass=function(){return IP},IP.depthDelta=function(t){var e=t.getLocation(0,XI.LEFT),r=t.getLocation(0,XI.RIGHT);return e===OS.INTERIOR&&r===OS.EXTERIOR?1:e===OS.EXTERIOR&&r===OS.INTERIOR?-1:0},IP.convertSegStrings=function(t){for(var e=new GI,r=new FB;t.hasNext();){var n=t.next(),i=e.createLineString(n.getCoordinates());r.add(i)}return e.buildGeometry(r)};var TP=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=arguments[3];this._noder=r,this._scaleFactor=n,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};TP.prototype.rescale=function(){var t=this;if(NS(arguments[0],SB))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.rescale(r.getCoordinates())}else if(arguments[0]instanceof Array){for(var n=arguments[0],i=0;i<n.length;i++)n[i].x=n[i].x/t._scaleFactor+t._offsetX,n[i].y=n[i].y/t._scaleFactor+t._offsetY;2===n.length&&n[0].equals2D(n[1])&&YS.out.println(n)}},TP.prototype.scale=function(){var t=this;if(NS(arguments[0],SB)){for(var e=arguments[0],r=new FB,n=e.iterator();n.hasNext();){var i=n.next();r.add(new DT(t.scale(i.getCoordinates()),i.getData()))}return r}if(arguments[0]instanceof Array){for(var o=arguments[0],s=new Array(o.length).fill(null),a=0;a<o.length;a++)s[a]=new PS(Math.round((o[a].x-t._offsetX)*t._scaleFactor),Math.round((o[a].y-t._offsetY)*t._scaleFactor),o[a].z);return OB.removeRepeatedPoints(s)}},TP.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},TP.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},TP.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},TP.prototype.interfaces_=function(){return[VT]},TP.prototype.getClass=function(){return TP};var PP=function(){this._li=new hB,this._segStrings=null;var t=arguments[0];this._segStrings=t},FP={fact:{configurable:!0}};PP.prototype.checkEndPtVertexIntersections=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();){var r=e.next().getCoordinates();t.checkEndPtVertexIntersections(r[0],t._segStrings),t.checkEndPtVertexIntersections(r[r.length-1],t._segStrings)}else if(2===arguments.length)for(var n=arguments[0],i=arguments[1].iterator();i.hasNext();)for(var o=i.next().getCoordinates(),s=1;s<o.length-1;s++)if(o[s].equals(n))throw new oB("found endpt/interior pt intersection at index "+s+" :pt "+n)},PP.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),r=this._segStrings.iterator();r.hasNext();){var n=r.next();this.checkInteriorIntersections(e,n)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=i.getCoordinates(),a=o.getCoordinates(),l=0;l<s.length-1;l++)for(var u=0;u<a.length-1;u++)this.checkInteriorIntersections(i,l,o,u);else if(4===arguments.length){var h=arguments[0],c=arguments[1],A=arguments[2],f=arguments[3];if(h===A&&c===f)return null;var p=h.getCoordinates()[c],d=h.getCoordinates()[c+1],g=A.getCoordinates()[f],y=A.getCoordinates()[f+1];if(this._li.computeIntersection(p,d,g,y),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,p,d)||this.hasInteriorIntersection(this._li,g,y)))throw new oB("found non-noded intersection at "+p+"-"+d+" and "+g+"-"+y)}},PP.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},PP.prototype.checkCollapses=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1===arguments.length)for(var r=arguments[0].getCoordinates(),n=0;n<r.length-2;n++)this.checkCollapse(r[n],r[n+1],r[n+2])},PP.prototype.hasInteriorIntersection=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++){var i=t.getIntersection(n);if(!i.equals(e)&&!i.equals(r))return!0}return!1},PP.prototype.checkCollapse=function(t,e,r){if(t.equals(r))throw new oB("found non-noded collapse at "+PP.fact.createLineString([t,e,r]))},PP.prototype.interfaces_=function(){return[]},PP.prototype.getClass=function(){return PP},FP.fact.get=function(){return new GI},Object.defineProperties(PP,FP);var LP=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],r=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=r,e<=0)throw new xS("Scale factor must be non-zero");1!==e&&(this._pt=new PS(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new PS,this._p1Scaled=new PS),this.initCorners(this._pt)},MP={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};LP.prototype.intersectsScaled=function(t,e){var r=Math.min(t.x,e.x),n=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<r||this._minx>n||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return aB.isTrue(!(s&&a),"Found bad envelope test"),a},LP.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 PS(this._maxx,this._maxy),this._corner[1]=new PS(this._minx,this._maxy),this._corner[2]=new PS(this._minx,this._miny),this._corner[3]=new PS(this._maxx,this._miny)},LP.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))},LP.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},LP.prototype.getCoordinate=function(){return this._originalPt},LP.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},LP.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=LP.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new JS(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},LP.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()))))},LP.prototype.intersectsToleranceSquare=function(t,e){var r=!1,n=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper()||r&&n||t.equals(this._pt)||e.equals(this._pt)))))},LP.prototype.addSnappedNode=function(t,e){var r=t.getCoordinate(e),n=t.getCoordinate(e+1);return!!this.intersects(r,n)&&(t.addIntersection(this.getCoordinate(),e),!0)},LP.prototype.interfaces_=function(){return[]},LP.prototype.getClass=function(){return LP},MP.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(LP,MP);var OP=function(){this.tempEnv1=new JS,this.selectedSegment=new QT};OP.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)}},OP.prototype.interfaces_=function(){return[]},OP.prototype.getClass=function(){return OP};var kP=function(){this._index=null;var t=arguments[0];this._index=t},NP={HotPixelSnapAction:{configurable:!0}};kP.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=e.getSafeEnvelope(),o=new RP(e,r,n);return this._index.query(i,{interfaces_:function(){return[wT]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},kP.prototype.interfaces_=function(){return[]},kP.prototype.getClass=function(){return kP},NP.HotPixelSnapAction.get=function(){return RP},Object.defineProperties(kP,NP);var RP=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._hotPixel=e,this._parentEdge=r,this._hotPixelVertexIndex=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments[1],r=arguments[0].getContext();if(null!==this._parentEdge&&r===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(OP),UP=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new FB};UP.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];if(this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var l=0;l<this._li.getIntersectionNum();l++)this._interiorIntersections.add(this._li.getIntersection(l));t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1)}},UP.prototype.isDone=function(){return!1},UP.prototype.getInteriorIntersections=function(){return this._interiorIntersections},UP.prototype.interfaces_=function(){return[vP]},UP.prototype.getClass=function(){return UP};var DP=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 hB,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};DP.prototype.checkCorrectness=function(t){var e=DT.getNodedSubstrings(t),r=new PP(e);try{r.checkValid()}catch(n){if(!(n instanceof WS))throw n;n.printStackTrace()}},DP.prototype.getNodedSubstrings=function(){return DT.getNodedSubstrings(this._nodedSegStrings)},DP.prototype.snapRound=function(t,e){var r=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(r),this.computeVertexSnaps(t)},DP.prototype.findInteriorIntersections=function(t,e){var r=new UP(e);return this._noder.setSegmentIntersector(r),this._noder.computeNodes(t),r.getInteriorIntersections()},DP.prototype.computeVertexSnaps=function(){var t=this;if(NS(arguments[0],SB))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.computeVertexSnaps(r)}else if(arguments[0]instanceof DT)for(var n=arguments[0],i=n.getCoordinates(),o=0;o<i.length;o++){var s=new LP(i[o],t._scaleFactor,t._li);t._pointSnapper.snap(s,n,o)&&n.addIntersection(i[o],o)}},DP.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new qT,this._pointSnapper=new kP(this._noder.getIndex()),this.snapRound(t,this._li)},DP.prototype.computeIntersectionSnaps=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next(),i=new LP(n,e._scaleFactor,e._li);e._pointSnapper.snap(i)}},DP.prototype.interfaces_=function(){return[VT]},DP.prototype.getClass=function(){return DP};var QP=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new XT,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._argGeom=e,this._bufParams=r}},GP={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};QP.prototype.bufferFixedPrecision=function(t){var e=new TP(new DP(new RI(1)),t.getScale()),r=new IP(this._bufParams);r.setWorkingPrecisionModel(t),r.setNoder(e),this._resultGeometry=r.buffer(this._argGeom,this._distance)},QP.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=QP.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(o){if(!(o instanceof tT))throw o;t._saveException=o}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var r=arguments[0],n=QP.precisionScaleFactor(this._argGeom,this._distance,r),i=new RI(n);this.bufferFixedPrecision(i)}},QP.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===RI.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},QP.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},QP.prototype.bufferOriginalPrecision=function(){try{var t=new IP(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(!(e instanceof oB))throw e;this._saveException=e}},QP.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},QP.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},QP.prototype.interfaces_=function(){return[]},QP.prototype.getClass=function(){return QP},QP.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new QP(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof gB&&"number"==typeof arguments[1]){var e=arguments[1],r=arguments[2],n=new QP(arguments[0]);return n.setQuadrantSegments(r),n.getResultGeometry(e)}if(arguments[2]instanceof XT&&arguments[0]instanceof gB&&"number"==typeof arguments[1]){var i=arguments[1];return new QP(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],s=arguments[2],a=arguments[3],l=new QP(arguments[0]);return l.setQuadrantSegments(s),l.setEndCapStyle(a),l.getResultGeometry(o)}},QP.precisionScaleFactor=function(t,e,r){var n=t.getEnvelopeInternal(),i=RS.max(Math.abs(n.getMaxX()),Math.abs(n.getMaxY()),Math.abs(n.getMinX()),Math.abs(n.getMinY()))+2*(e>0?e:0),o=r-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},GP.CAP_ROUND.get=function(){return XT.CAP_ROUND},GP.CAP_BUTT.get=function(){return XT.CAP_FLAT},GP.CAP_FLAT.get=function(){return XT.CAP_FLAT},GP.CAP_SQUARE.get=function(){return XT.CAP_SQUARE},GP.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(QP,GP);var jP=function(){this._pt=[new PS,new PS],this._distance=CS.NaN,this._isNull=!0};jP.prototype.getCoordinates=function(){return this._pt},jP.prototype.getCoordinate=function(t){return this._pt[t]},jP.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},jP.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},jP.prototype.getDistance=function(){return this._distance},jP.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},jP.prototype.interfaces_=function(){return[]},jP.prototype.getClass=function(){return jP};var HP=function(){};HP.prototype.interfaces_=function(){return[]},HP.prototype.getClass=function(){return HP},HP.computeDistance=function(){if(arguments[2]instanceof jP&&arguments[0]instanceof vI&&arguments[1]instanceof PS)for(var t=arguments[1],e=arguments[2],r=arguments[0].getCoordinates(),n=new QT,i=0;i<r.length-1;i++){n.setCoordinates(r[i],r[i+1]);var o=n.closestPoint(t);e.setMinimum(o,t)}else if(arguments[2]instanceof jP&&arguments[0]instanceof xI&&arguments[1]instanceof PS){var s=arguments[0],a=arguments[1],l=arguments[2];HP.computeDistance(s.getExteriorRing(),a,l);for(var u=0;u<s.getNumInteriorRing();u++)HP.computeDistance(s.getInteriorRingN(u),a,l)}else if(arguments[2]instanceof jP&&arguments[0]instanceof gB&&arguments[1]instanceof PS){var h=arguments[0],c=arguments[1],A=arguments[2];if(h instanceof vI)HP.computeDistance(h,c,A);else if(h instanceof xI)HP.computeDistance(h,c,A);else if(h instanceof sI)for(var f=h,p=0;p<f.getNumGeometries();p++){var d=f.getGeometryN(p);HP.computeDistance(d,c,A)}else A.setMinimum(h.getCoordinate(),c)}else if(arguments[2]instanceof jP&&arguments[0]instanceof QT&&arguments[1]instanceof PS){var g=arguments[1],y=arguments[2],m=arguments[0].closestPoint(g);y.setMinimum(m,g)}};var zP=function(t){this._maxPtDist=new jP,this._inputGeom=t||null},VP={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};zP.prototype.computeMaxMidpointDistance=function(t){var e=new qP(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},zP.prototype.computeMaxVertexDistance=function(t){var e=new KP(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},zP.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},zP.prototype.getDistancePoints=function(){return this._maxPtDist},zP.prototype.interfaces_=function(){return[]},zP.prototype.getClass=function(){return zP},VP.MaxPointDistanceFilter.get=function(){return KP},VP.MaxMidpointDistanceFilter.get=function(){return qP},Object.defineProperties(zP,VP);var KP=function(t){this._maxPtDist=new jP,this._minPtDist=new jP,this._geom=t||null};KP.prototype.filter=function(t){this._minPtDist.initialize(),HP.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},KP.prototype.getMaxPointDistance=function(){return this._maxPtDist},KP.prototype.interfaces_=function(){return[vB]},KP.prototype.getClass=function(){return KP};var qP=function(t){this._maxPtDist=new jP,this._minPtDist=new jP,this._geom=t||null};qP.prototype.filter=function(t,e){if(0===e)return null;var r=t.getCoordinate(e-1),n=t.getCoordinate(e),i=new PS((r.x+n.x)/2,(r.y+n.y)/2);this._minPtDist.initialize(),HP.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},qP.prototype.isDone=function(){return!1},qP.prototype.isGeometryChanged=function(){return!1},qP.prototype.getMaxPointDistance=function(){return this._maxPtDist},qP.prototype.interfaces_=function(){return[oI]},qP.prototype.getClass=function(){return qP};var WP=function(t){this._comps=t||null};WP.prototype.filter=function(t){t instanceof xI&&this._comps.add(t)},WP.prototype.interfaces_=function(){return[iI]},WP.prototype.getClass=function(){return WP},WP.getPolygons=function(){if(1===arguments.length){var t=arguments[0];return WP.getPolygons(t,new FB)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e instanceof xI?r.add(e):e instanceof sI&&e.apply(new WP(r)),r}};var XP=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._lines=e,this._isForcedToLineString=r}};XP.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof EI){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof vI&&this._lines.add(t)},XP.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},XP.prototype.interfaces_=function(){return[dB]},XP.prototype.getClass=function(){return XP},XP.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(XP.getLines(t))}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().buildGeometry(XP.getLines(e,r))}},XP.getLines=function(){if(1===arguments.length){var t=arguments[0];return XP.getLines(t,!1)}if(2===arguments.length){if(NS(arguments[0],SB)&&NS(arguments[1],SB)){for(var e=arguments[1],r=arguments[0].iterator();r.hasNext();){var n=r.next();XP.getLines(n,e)}return e}if(arguments[0]instanceof gB&&"boolean"==typeof arguments[1]){var i=arguments[0],o=arguments[1],s=new FB;return i.apply(new XP(s,o)),s}if(arguments[0]instanceof gB&&NS(arguments[1],SB)){var a=arguments[0],l=arguments[1];return a instanceof vI?l.add(a):a.apply(new XP(l)),l}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&NS(arguments[0],SB)&&NS(arguments[1],SB)){for(var u=arguments[1],h=arguments[2],c=arguments[0].iterator();c.hasNext();){var A=c.next();XP.getLines(A,u,h)}return u}if("boolean"==typeof arguments[2]&&arguments[0]instanceof gB&&NS(arguments[1],SB)){var f=arguments[1],p=arguments[2];return arguments[0].apply(new XP(f,p)),f}}};var YP=function(){if(this._boundaryRule=_B.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 xS("Rule must be non-null");this._boundaryRule=t}};YP.prototype.locateInternal=function(){if(arguments[0]instanceof PS&&arguments[1]instanceof xI){var t=arguments[0],e=arguments[1];if(e.isEmpty())return OS.EXTERIOR;var r=e.getExteriorRing(),n=this.locateInPolygonRing(t,r);if(n===OS.EXTERIOR)return OS.EXTERIOR;if(n===OS.BOUNDARY)return OS.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===OS.INTERIOR)return OS.EXTERIOR;if(s===OS.BOUNDARY)return OS.BOUNDARY}return OS.INTERIOR}if(arguments[0]instanceof PS&&arguments[1]instanceof vI){var a=arguments[0],l=arguments[1];if(!l.getEnvelopeInternal().intersects(a))return OS.EXTERIOR;var u=l.getCoordinates();return l.isClosed()||!a.equals(u[0])&&!a.equals(u[u.length-1])?fB.isOnLine(a,u)?OS.INTERIOR:OS.EXTERIOR:OS.BOUNDARY}if(arguments[0]instanceof PS&&arguments[1]instanceof wI){var h=arguments[0];return arguments[1].getCoordinate().equals2D(h)?OS.INTERIOR:OS.EXTERIOR}},YP.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?fB.locatePointInRing(t,e.getCoordinates()):OS.EXTERIOR},YP.prototype.intersects=function(t,e){return this.locate(t,e)!==OS.EXTERIOR},YP.prototype.updateLocationInfo=function(t){t===OS.INTERIOR&&(this._isIn=!0),t===OS.BOUNDARY&&this._numBoundaries++},YP.prototype.computeLocation=function(t,e){var r=this;if(e instanceof wI&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof vI)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof xI)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof aI)for(var n=e,i=0;i<n.getNumGeometries();i++){var o=n.getGeometryN(i);r.updateLocationInfo(r.locateInternal(t,o))}else if(e instanceof SI)for(var s=e,a=0;a<s.getNumGeometries();a++){var l=s.getGeometryN(a);r.updateLocationInfo(r.locateInternal(t,l))}else if(e instanceof sI)for(var u=new AP(e);u.hasNext();){var h=u.next();h!==e&&r.computeLocation(t,h)}},YP.prototype.locate=function(t,e){return e.isEmpty()?OS.EXTERIOR:e instanceof vI||e instanceof xI?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?OS.BOUNDARY:this._numBoundaries>0||this._isIn?OS.INTERIOR:OS.EXTERIOR)},YP.prototype.interfaces_=function(){return[]},YP.prototype.getClass=function(){return YP};var ZP=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length)t.call(this,arguments[0],t.INSIDE_AREA,arguments[1]);else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._component=e,this._segIndex=r,this._pt=n}},JP={INSIDE_AREA:{configurable:!0}};ZP.prototype.isInsideArea=function(){return this._segIndex===ZP.INSIDE_AREA},ZP.prototype.getCoordinate=function(){return this._pt},ZP.prototype.getGeometryComponent=function(){return this._component},ZP.prototype.getSegmentIndex=function(){return this._segIndex},ZP.prototype.interfaces_=function(){return[]},ZP.prototype.getClass=function(){return ZP},JP.INSIDE_AREA.get=function(){return-1},Object.defineProperties(ZP,JP);var $P=function(t){this._pts=t||null};$P.prototype.filter=function(t){t instanceof wI&&this._pts.add(t)},$P.prototype.interfaces_=function(){return[iI]},$P.prototype.getClass=function(){return $P},$P.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof wI?ET.singletonList(t):$P.getPoints(t,new FB)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e instanceof wI?r.add(e):e instanceof sI&&e.apply(new $P(r)),r}};var tF=function(){this._locations=null;var t=arguments[0];this._locations=t};tF.prototype.filter=function(t){(t instanceof wI||t instanceof vI||t instanceof xI)&&this._locations.add(new ZP(t,0,t.getCoordinate()))},tF.prototype.interfaces_=function(){return[iI]},tF.prototype.getClass=function(){return tF},tF.getLocations=function(t){var e=new FB;return t.apply(new tF(e)),e};var eF=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new YP,this._minDistanceLocation=null,this._minDistance=CS.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=n,this._terminateDistance=i}};eF.prototype.computeContainmentDistance=function(){var t=this;if(0===arguments.length){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1],i=1-r,o=WP.getPolygons(this._geom[r]);if(o.size()>0){var s=tF.getLocations(this._geom[i]);if(this.computeContainmentDistance(s,o,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=n[0],this._minDistanceLocation[r]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&NS(arguments[0],TB)&&NS(arguments[1],TB)){for(var a=arguments[0],l=arguments[1],u=arguments[2],h=0;h<a.size();h++)for(var c=a.get(h),A=0;A<l.size();A++)if(t.computeContainmentDistance(c,l.get(A),u),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof ZP&&arguments[1]instanceof xI){var f=arguments[0],p=arguments[1],d=arguments[2],g=f.getCoordinate();if(OS.EXTERIOR!==this._ptLocator.locate(g,p))return this._minDistance=0,d[0]=f,d[1]=new ZP(p,g),null}},eF.prototype.computeMinDistanceLinesPoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},eF.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=XP.getLines(this._geom[0]),r=XP.getLines(this._geom[1]),n=$P.getPoints(this._geom[0]),i=$P.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,r,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(r,n,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(n,i,t),void this.updateMinDistance(t,!1))))},eF.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},eF.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])},eF.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},eF.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 vI&&arguments[1]instanceof wI){var e=arguments[0],r=arguments[1],n=arguments[2];if(e.getEnvelopeInternal().distance(r.getEnvelopeInternal())>this._minDistance)return null;for(var i=e.getCoordinates(),o=r.getCoordinate(),s=0;s<i.length-1;s++){var a=fB.distancePointLine(o,i[s],i[s+1]);if(a<t._minDistance){t._minDistance=a;var l=new QT(i[s],i[s+1]).closestPoint(o);n[0]=new ZP(e,s,l),n[1]=new ZP(r,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof vI&&arguments[1]instanceof vI){var u=arguments[0],h=arguments[1],c=arguments[2];if(u.getEnvelopeInternal().distance(h.getEnvelopeInternal())>this._minDistance)return null;for(var A=u.getCoordinates(),f=h.getCoordinates(),p=0;p<A.length-1;p++)for(var d=0;d<f.length-1;d++){var g=fB.distanceLineLine(A[p],A[p+1],f[d],f[d+1]);if(g<t._minDistance){t._minDistance=g;var y=new QT(A[p],A[p+1]),m=new QT(f[d],f[d+1]),v=y.closestPoints(m);c[0]=new ZP(u,p,v[0]),c[1]=new ZP(h,d,v[1])}if(t._minDistance<=t._terminateDistance)return null}}},eF.prototype.computeMinDistancePoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s),l=o.getCoordinate().distance(a.getCoordinate());if(l<n._minDistance&&(n._minDistance=l,r[0]=new ZP(o,0,o.getCoordinate()),r[1]=new ZP(a,0,a.getCoordinate())),n._minDistance<=n._terminateDistance)return null}},eF.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new xS("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},eF.prototype.computeMinDistanceLines=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},eF.prototype.interfaces_=function(){return[]},eF.prototype.getClass=function(){return eF},eF.distance=function(t,e){return new eF(t,e).distance()},eF.isWithinDistance=function(t,e,r){return new eF(t,e,r).distance()<=r},eF.nearestPoints=function(t,e){return new eF(t,e).nearestPoints()};var rF=function(){this._pt=[new PS,new PS],this._distance=CS.NaN,this._isNull=!0};rF.prototype.getCoordinates=function(){return this._pt},rF.prototype.getCoordinate=function(t){return this._pt[t]},rF.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},rF.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},rF.prototype.toString=function(){return iB.toLineString(this._pt[0],this._pt[1])},rF.prototype.getDistance=function(){return this._distance},rF.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},rF.prototype.interfaces_=function(){return[]},rF.prototype.getClass=function(){return rF};var nF=function(){};nF.prototype.interfaces_=function(){return[]},nF.prototype.getClass=function(){return nF},nF.computeDistance=function(){if(arguments[2]instanceof rF&&arguments[0]instanceof vI&&arguments[1]instanceof PS)for(var t=arguments[0],e=arguments[1],r=arguments[2],n=new QT,i=t.getCoordinates(),o=0;o<i.length-1;o++){n.setCoordinates(i[o],i[o+1]);var s=n.closestPoint(e);r.setMinimum(s,e)}else if(arguments[2]instanceof rF&&arguments[0]instanceof xI&&arguments[1]instanceof PS){var a=arguments[0],l=arguments[1],u=arguments[2];nF.computeDistance(a.getExteriorRing(),l,u);for(var h=0;h<a.getNumInteriorRing();h++)nF.computeDistance(a.getInteriorRingN(h),l,u)}else if(arguments[2]instanceof rF&&arguments[0]instanceof gB&&arguments[1]instanceof PS){var c=arguments[0],A=arguments[1],f=arguments[2];if(c instanceof vI)nF.computeDistance(c,A,f);else if(c instanceof xI)nF.computeDistance(c,A,f);else if(c instanceof sI)for(var p=c,d=0;d<p.getNumGeometries();d++){var g=p.getGeometryN(d);nF.computeDistance(g,A,f)}else f.setMinimum(c.getCoordinate(),A)}else if(arguments[2]instanceof rF&&arguments[0]instanceof QT&&arguments[1]instanceof PS){var y=arguments[1],m=arguments[2],v=arguments[0].closestPoint(y);m.setMinimum(v,y)}};var iF=function(){this._g0=null,this._g1=null,this._ptDist=new rF,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},oF={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};iF.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},iF.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new xS("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},iF.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},iF.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},iF.prototype.computeOrientedDistance=function(t,e,r){var n=new sF(e);if(t.apply(n),r.setMaximum(n.getMaxPointDistance()),this._densifyFrac>0){var i=new aF(e,this._densifyFrac);t.apply(i),r.setMaximum(i.getMaxPointDistance())}},iF.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},iF.prototype.interfaces_=function(){return[]},iF.prototype.getClass=function(){return iF},iF.distance=function(){if(2===arguments.length)return new iF(arguments[0],arguments[1]).distance();if(3===arguments.length){var t=arguments[2],e=new iF(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},oF.MaxPointDistanceFilter.get=function(){return sF},oF.MaxDensifiedByFractionDistanceFilter.get=function(){return aF},Object.defineProperties(iF,oF);var sF=function(){this._maxPtDist=new rF,this._minPtDist=new rF,this._euclideanDist=new nF,this._geom=null;var t=arguments[0];this._geom=t};sF.prototype.filter=function(t){this._minPtDist.initialize(),nF.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},sF.prototype.getMaxPointDistance=function(){return this._maxPtDist},sF.prototype.interfaces_=function(){return[vB]},sF.prototype.getClass=function(){return sF};var aF=function(){this._maxPtDist=new rF,this._minPtDist=new rF,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};aF.prototype.filter=function(t,e){var r=this;if(0===e)return null;for(var n=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-n.x)/this._numSubSegs,s=(i.y-n.y)/this._numSubSegs,a=0;a<this._numSubSegs;a++){var l=n.x+a*o,u=n.y+a*s,h=new PS(l,u);r._minPtDist.initialize(),nF.computeDistance(r._geom,h,r._minPtDist),r._maxPtDist.setMaximum(r._minPtDist)}},aF.prototype.isDone=function(){return!1},aF.prototype.isGeometryChanged=function(){return!1},aF.prototype.getMaxPointDistance=function(){return this._maxPtDist},aF.prototype.interfaces_=function(){return[oI]},aF.prototype.getClass=function(){return aF};var lF=function(t,e,r){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=r||null},uF={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};lF.prototype.checkMaximumDistance=function(t,e,r){var n=new iF(e,t);if(n.setDensifyFraction(.25),this._maxDistanceFound=n.orientedDistance(),this._maxDistanceFound>r){this._isValid=!1;var i=n.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+iB.toLineString(i[0],i[1])+")"}},lF.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=lF.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(),lF.VERBOSE&&YS.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},lF.prototype.checkNegativeValid=function(){if(!(this._input instanceof xI||this._input instanceof SI||this._input instanceof sI))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)},lF.prototype.getErrorIndicator=function(){return this._errorIndicator},lF.prototype.checkMinimumDistance=function(t,e,r){var n=new eF(t,e,r);if(this._minDistanceFound=n.distance(),this._minDistanceFound<r){this._isValid=!1;var i=n.nearestPoints();this._errorLocation=n.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+iB.toLineString(i[0],i[1])+" )"}},lF.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)},lF.prototype.getErrorLocation=function(){return this._errorLocation},lF.prototype.getPolygonLines=function(t){for(var e=new FB,r=new XP(e),n=WP.getPolygons(t).iterator();n.hasNext();)n.next().apply(r);return t.getFactory().buildGeometry(e)},lF.prototype.getErrorMessage=function(){return this._errMsg},lF.prototype.interfaces_=function(){return[]},lF.prototype.getClass=function(){return lF},uF.VERBOSE.get=function(){return!1},uF.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(lF,uF);var hF=function(t,e,r){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=r||null},cF={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};hF.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},hF.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*hF.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new JS(this._input.getEnvelopeInternal());e.expandBy(this._distance);var r=new JS(this._result.getEnvelopeInternal());r.expandBy(t),r.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(r)),this.report("Envelope")},hF.prototype.checkDistance=function(){var t=new lF(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")},hF.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")},hF.prototype.checkPolygonal=function(){this._result instanceof xI||this._result instanceof SI||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},hF.prototype.getErrorIndicator=function(){return this._errorIndicator},hF.prototype.getErrorLocation=function(){return this._errorLocation},hF.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"))},hF.prototype.report=function(t){if(!hF.VERBOSE)return null;YS.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},hF.prototype.getErrorMessage=function(){return this._errorMsg},hF.prototype.interfaces_=function(){return[]},hF.prototype.getClass=function(){return hF},hF.isValidMsg=function(t,e,r){var n=new hF(t,e,r);return n.isValid()?null:n.getErrorMessage()},hF.isValid=function(t,e,r){return!!new hF(t,e,r).isValid()},cF.VERBOSE.get=function(){return!1},cF.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(hF,cF);var AF=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};AF.prototype.getCoordinates=function(){return this._pts},AF.prototype.size=function(){return this._pts.length},AF.prototype.getCoordinate=function(t){return this._pts[t]},AF.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},AF.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:NT.octant(this.getCoordinate(t),this.getCoordinate(t+1))},AF.prototype.setData=function(t){this._data=t},AF.prototype.getData=function(){return this._data},AF.prototype.toString=function(){return iB.toLineString(new LI(this._pts))},AF.prototype.interfaces_=function(){return[RT]},AF.prototype.getClass=function(){return AF};var fF=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new FB,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};fF.prototype.getInteriorIntersection=function(){return this._interiorIntersection},fF.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},fF.prototype.getIntersectionSegments=function(){return this._intSegments},fF.prototype.count=function(){return this._intersectionCount},fF.prototype.getIntersections=function(){return this._intersections},fF.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},fF.prototype.setKeepIntersections=function(t){this._keepIntersections=t},fF.prototype.processIntersections=function(t,e,r,n){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===r&&e===n)return null;if(this._isCheckEndSegmentsOnly&&!this.isEndSegment(t,e)&&!this.isEndSegment(r,n))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},fF.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},fF.prototype.hasIntersection=function(){return null!==this._interiorIntersection},fF.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},fF.prototype.interfaces_=function(){return[vP]},fF.prototype.getClass=function(){return fF},fF.createAllIntersectionsFinder=function(t){var e=new fF(t);return e.setFindAllIntersections(!0),e},fF.createAnyIntersectionFinder=function(t){return new fF(t)},fF.createIntersectionCounter=function(t){var e=new fF(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var pF=function(){this._li=new hB,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};pF.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},pF.prototype.getIntersections=function(){return this._segInt.getIntersections()},pF.prototype.isValid=function(){return this.execute(),this._isValid},pF.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},pF.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new fF(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new qT;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},pF.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new tT(this.getErrorMessage(),this._segInt.getInteriorIntersection())},pF.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+iB.toLineString(t[0],t[1])+" and "+iB.toLineString(t[2],t[3])},pF.prototype.interfaces_=function(){return[]},pF.prototype.getClass=function(){return pF},pF.computeIntersections=function(t){var e=new pF(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var dF=function t(){this._nv=null;var e=arguments[0];this._nv=new pF(t.toSegmentStrings(e))};dF.prototype.checkValid=function(){this._nv.checkValid()},dF.prototype.interfaces_=function(){return[]},dF.prototype.getClass=function(){return dF},dF.toSegmentStrings=function(t){for(var e=new FB,r=t.iterator();r.hasNext();){var n=r.next();e.add(new AF(n.getCoordinates(),n))}return e},dF.checkValid=function(t){new dF(t).checkValid()};var gF=function(t){this._mapOp=t};gF.prototype.map=function(t){for(var e=new FB,r=0;r<t.getNumGeometries();r++){var n=this._mapOp.map(t.getGeometryN(r));n.isEmpty()||e.add(n)}return t.getFactory().createGeometryCollection(GI.toGeometryArray(e))},gF.prototype.interfaces_=function(){return[]},gF.prototype.getClass=function(){return gF},gF.map=function(t,e){return new gF(e).map(t)};var yF=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new FB,this._resultLineList=new FB;var t=arguments[0],e=arguments[1],r=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=r};yF.prototype.collectLines=function(t){for(var e=this,r=this._op.getGraph().getEdgeEnds().iterator();r.hasNext();){var n=r.next();e.collectLineEdge(n,t,e._lineEdgesList),e.collectBoundaryTouchEdge(n,t,e._lineEdgesList)}},yF.prototype.labelIsolatedLine=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,r)},yF.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},yF.prototype.collectLineEdge=function(t,e,r){var n=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!ZF.isResultOfOp(n,e)||i.isCovered()||(r.add(i),t.setVisitedEdge(!0)))},yF.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();)t.next().getEdges().findCoveredLineEdges();for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var r=e.next(),n=r.getEdge();if(r.isLineEdge()&&!n.isCoveredSet()){var i=this._op.isCoveredByA(r.getCoordinate());n.setCovered(i)}}},yF.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next(),n=r.getLabel();r.isIsolated()&&(n.isNull(0)?this.labelIsolatedLine(r,0):this.labelIsolatedLine(r,1))}},yF.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var r=e.next(),n=this._geometryFactory.createLineString(r.getCoordinates());this._resultLineList.add(n),r.setInResult(!0)}},yF.prototype.collectBoundaryTouchEdge=function(t,e,r){var n=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(aB.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(ZF.isResultOfOp(n,e)&&e===ZF.INTERSECTION&&(r.add(t.getEdge()),t.setVisitedEdge(!0))))},yF.prototype.interfaces_=function(){return[]},yF.prototype.getClass=function(){return yF};var mF=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new FB;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};mF.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var r=this._geometryFactory.createPoint(e);this._resultPointList.add(r)}},mF.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var r=e.next();if(!(r.isInResult()||r.isIncidentEdgeInResult()||0!==r.getEdges().getDegree()&&t!==ZF.INTERSECTION)){var n=r.getLabel();ZF.isResultOfOp(n,t)&&this.filterCoveredNodeToPoint(r)}}},mF.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},mF.prototype.interfaces_=function(){return[]},mF.prototype.getClass=function(){return mF};var vF=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};vF.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},vF.prototype.transformPolygon=function(t,e){var r=!0,n=this.transformLinearRing(t.getExteriorRing(),t);null!==n&&n instanceof EI&&!n.isEmpty()||(r=!1);for(var i=new FB,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof EI||(r=!1),i.add(s))}if(r)return this._factory.createPolygon(n,i.toArray([]));var a=new FB;return null!==n&&a.add(n),a.addAll(i),this._factory.buildGeometry(a)},vF.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},vF.prototype.getInputGeometry=function(){return this._inputGeom},vF.prototype.transformMultiLineString=function(t,e){for(var r=new FB,n=0;n<t.getNumGeometries();n++){var i=this.transformLineString(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},vF.prototype.transformCoordinates=function(t,e){return this.copy(t)},vF.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},vF.prototype.transformMultiPoint=function(t,e){for(var r=new FB,n=0;n<t.getNumGeometries();n++){var i=this.transformPoint(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},vF.prototype.transformMultiPolygon=function(t,e){for(var r=new FB,n=0;n<t.getNumGeometries();n++){var i=this.transformPolygon(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},vF.prototype.copy=function(t){return t.copy()},vF.prototype.transformGeometryCollection=function(t,e){for(var r=new FB,n=0;n<t.getNumGeometries();n++){var i=this.transform(t.getGeometryN(n));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||r.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(GI.toGeometryArray(r)):this._factory.buildGeometry(r)},vF.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof wI)return this.transformPoint(t,null);if(t instanceof CI)return this.transformMultiPoint(t,null);if(t instanceof EI)return this.transformLinearRing(t,null);if(t instanceof vI)return this.transformLineString(t,null);if(t instanceof aI)return this.transformMultiLineString(t,null);if(t instanceof xI)return this.transformPolygon(t,null);if(t instanceof SI)return this.transformMultiPolygon(t,null);if(t instanceof sI)return this.transformGeometryCollection(t,null);throw new xS("Unknown Geometry subtype: "+t.getClass().getName())},vF.prototype.transformLinearRing=function(t,e){var r=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===r)return this._factory.createLinearRing(null);var n=r.size();return n>0&&n<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)},vF.prototype.interfaces_=function(){return[]},vF.prototype.getClass=function(){return vF};var _F=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new QT,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof vI&&"number"==typeof arguments[1]){var e=arguments[1];t.call(this,arguments[0].getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=n}};_F.prototype.snapVertices=function(t,e){for(var r=this._isClosed?t.size()-1:t.size(),n=0;n<r;n++){var i=t.get(n),o=this.findSnapForVertex(i,e);null!==o&&(t.set(n,new PS(o)),0===n&&this._isClosed&&t.set(t.size()-1,new PS(o)))}},_F.prototype.findSnapForVertex=function(t,e){for(var r=0;r<e.length;r++){if(t.equals2D(e[r]))return null;if(t.distance(e[r])<this._snapTolerance)return e[r]}return null},_F.prototype.snapTo=function(t){var e=new MB(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},_F.prototype.snapSegments=function(t,e){if(0===e.length)return null;var r=e.length;e[0].equals2D(e[e.length-1])&&(r=e.length-1);for(var n=0;n<r;n++){var i=e[n],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new PS(i),!1)}},_F.prototype.findSegmentIndexToSnap=function(t,e){for(var r=this,n=CS.MAX_VALUE,i=-1,o=0;o<e.size()-1;o++){if(r._seg.p0=e.get(o),r._seg.p1=e.get(o+1),r._seg.p0.equals2D(t)||r._seg.p1.equals2D(t)){if(r._allowSnappingToSourceVertices)continue;return-1}var s=r._seg.distance(t);s<r._snapTolerance&&s<n&&(n=s,i=o)}return i},_F.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},_F.prototype.interfaces_=function(){return[]},_F.prototype.getClass=function(){return _F},_F.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var wF=function(t){this._srcGeom=t||null},bF={SNAP_PRECISION_FACTOR:{configurable:!0}};wF.prototype.snapTo=function(t,e){var r=this.extractTargetCoordinates(t);return new xF(e,r).transform(this._srcGeom)},wF.prototype.snapToSelf=function(t,e){var r=this.extractTargetCoordinates(this._srcGeom),n=new xF(t,r,!0).transform(this._srcGeom),i=n;return e&&NS(i,bI)&&(i=n.buffer(0)),i},wF.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},wF.prototype.extractTargetCoordinates=function(t){for(var e=new $B,r=t.getCoordinates(),n=0;n<r.length;n++)e.add(r[n]);return e.toArray(new Array(0).fill(null))},wF.prototype.computeMinimumSegmentLength=function(t){for(var e=CS.MAX_VALUE,r=0;r<t.length-1;r++){var n=t[r].distance(t[r+1]);n<e&&(e=n)}return e},wF.prototype.interfaces_=function(){return[]},wF.prototype.getClass=function(){return wF},wF.snap=function(t,e,r){var n=new Array(2).fill(null),i=new wF(t);n[0]=i.snapTo(e,r);var o=new wF(e);return n[1]=o.snapTo(n[0],r),n},wF.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=wF.computeSizeBasedSnapTolerance(t),r=t.getPrecisionModel();if(r.getType()===RI.FIXED){var n=1/r.getScale()*2/1.415;n>e&&(e=n)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(wF.computeOverlaySnapTolerance(i),wF.computeOverlaySnapTolerance(o))}},wF.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*wF.SNAP_PRECISION_FACTOR},wF.snapToSelf=function(t,e,r){return new wF(t).snapToSelf(e,r)},bF.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(wF,bF);var xF=function(t){function e(e,r,n){t.call(this),this._snapTolerance=e||null,this._snapPts=r||null,this._isSelfSnap=void 0!==n&&n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var r=new _F(t,this._snapTolerance);return r.setAllowSnappingToSourceVertices(this._isSelfSnap),r.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var r=t.toCoordinateArray(),n=this.snapLine(r,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(vF),CF=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};CF.prototype.getCommon=function(){return CS.longBitsToDouble(this._commonBits)},CF.prototype.add=function(t){var e=CS.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=CF.signExpBits(this._commonBits),this._isFirst=!1,null):CF.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=CF.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=CF.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},CF.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=CS.longBitsToDouble(t),r="0000000000000000000000000000000000000000000000000000000000000000"+CS.toBinaryString(t),n=r.substring(r.length-64);return n.substring(0,1)+" "+n.substring(1,12)+"(exp) "+n.substring(12)+" [ "+e+" ]"}},CF.prototype.interfaces_=function(){return[]},CF.prototype.getClass=function(){return CF},CF.getBit=function(t,e){return 0!=(t&1<<e)?1:0},CF.signExpBits=function(t){return t>>52},CF.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},CF.numCommonMostSigMantissaBits=function(t,e){for(var r=0,n=52;n>=0;n--){if(CF.getBit(t,n)!==CF.getBit(e,n))return r;r++}return 52};var EF=function(){this._commonCoord=null,this._ccFilter=new BF},SF={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};EF.prototype.addCommonBits=function(t){var e=new IF(this._commonCoord);t.apply(e),t.geometryChanged()},EF.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new PS(this._commonCoord);e.x=-e.x,e.y=-e.y;var r=new IF(e);return t.apply(r),t.geometryChanged(),t},EF.prototype.getCommonCoordinate=function(){return this._commonCoord},EF.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},EF.prototype.interfaces_=function(){return[]},EF.prototype.getClass=function(){return EF},SF.CommonCoordinateFilter.get=function(){return BF},SF.Translater.get=function(){return IF},Object.defineProperties(EF,SF);var BF=function(){this._commonBitsX=new CF,this._commonBitsY=new CF};BF.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},BF.prototype.getCommonCoordinate=function(){return new PS(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},BF.prototype.interfaces_=function(){return[vB]},BF.prototype.getClass=function(){return BF};var IF=function(){this.trans=null;var t=arguments[0];this.trans=t};IF.prototype.filter=function(t,e){var r=t.getOrdinate(e,0)+this.trans.x,n=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,r),t.setOrdinate(e,1,n)},IF.prototype.isDone=function(){return!1},IF.prototype.isGeometryChanged=function(){return!0},IF.prototype.interfaces_=function(){return[oI]},IF.prototype.getClass=function(){return IF};var TF=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()};TF.prototype.selfSnap=function(t){return new wF(t).snapTo(t,this._snapTolerance)},TF.prototype.removeCommonBits=function(t){this._cbr=new EF,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},TF.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},TF.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),r=ZF.overlayOp(e[0],e[1],t);return this.prepareResult(r)},TF.prototype.checkValid=function(t){t.isValid()||YS.out.println("Snapped geometry is invalid")},TF.prototype.computeSnapTolerance=function(){this._snapTolerance=wF.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},TF.prototype.snap=function(t){var e=this.removeCommonBits(t);return wF.snap(e[0],e[1],this._snapTolerance)},TF.prototype.interfaces_=function(){return[]},TF.prototype.getClass=function(){return TF},TF.overlayOp=function(t,e,r){return new TF(t,e).getResultGeometry(r)},TF.union=function(t,e){return TF.overlayOp(t,e,ZF.UNION)},TF.intersection=function(t,e){return TF.overlayOp(t,e,ZF.INTERSECTION)},TF.symDifference=function(t,e){return TF.overlayOp(t,e,ZF.SYMDIFFERENCE)},TF.difference=function(t,e){return TF.overlayOp(t,e,ZF.DIFFERENCE)};var PF=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};PF.prototype.getResultGeometry=function(t){var e=null,r=!1,n=null;try{e=ZF.overlayOp(this._geom[0],this._geom[1],t),r=!0}catch(i){if(!(i instanceof oB))throw i;n=i}if(!r)try{e=TF.overlayOp(this._geom[0],this._geom[1],t)}catch(i){throw i instanceof oB?n:i}return e},PF.prototype.interfaces_=function(){return[]},PF.prototype.getClass=function(){return PF},PF.overlayOp=function(t,e,r){return new PF(t,e).getResultGeometry(r)},PF.union=function(t,e){return PF.overlayOp(t,e,ZF.UNION)},PF.intersection=function(t,e){return PF.overlayOp(t,e,ZF.INTERSECTION)},PF.symDifference=function(t,e){return PF.overlayOp(t,e,ZF.SYMDIFFERENCE)},PF.difference=function(t,e){return PF.overlayOp(t,e,ZF.DIFFERENCE)};var FF=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};FF.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},FF.prototype.interfaces_=function(){return[]},FF.prototype.getClass=function(){return FF};var LF=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],r=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=r}else if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=n,this._xValue=i,this._obj=o}},MF={INSERT:{configurable:!0},DELETE:{configurable:!0}};LF.prototype.isDelete=function(){return this._eventType===LF.DELETE},LF.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},LF.prototype.getObject=function(){return this._obj},LF.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},LF.prototype.getInsertEvent=function(){return this._insertEvent},LF.prototype.isInsert=function(){return this._eventType===LF.INSERT},LF.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},LF.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},LF.prototype.interfaces_=function(){return[SS]},LF.prototype.getClass=function(){return LF},MF.INSERT.get=function(){return 1},MF.DELETE.get=function(){return 2},Object.defineProperties(LF,MF);var OF=function(){};OF.prototype.interfaces_=function(){return[]},OF.prototype.getClass=function(){return OF};var kF=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],r=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=r};kF.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(kF.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},kF.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},kF.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},kF.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},kF.prototype.isBoundaryPointInternal=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next().getCoordinate();if(t.isIntersection(n))return!0}return!1},kF.prototype.hasProperIntersection=function(){return this._hasProper},kF.prototype.hasIntersection=function(){return this._hasIntersection},kF.prototype.isDone=function(){return this._isDone},kF.prototype.isBoundaryPoint=function(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))},kF.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},kF.prototype.addIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},kF.prototype.interfaces_=function(){return[]},kF.prototype.getClass=function(){return kF},kF.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var NF=function(t){function e(){t.call(this),this.events=new FB,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){ET.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var r=this.events.get(e);if(r.isInsert()&&this.processOverlaps(e,r.getDeleteEventIndex(),r,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof kF&&NS(arguments[0],TB)&&NS(arguments[1],TB)){var n=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(n,n),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&NS(arguments[0],TB)&&arguments[1]instanceof kF){var s=arguments[0],a=arguments[1];arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)}},e.prototype.addEdge=function(t,e){for(var r=t.getMonotoneChainEdge(),n=r.getStartIndexes(),i=0;i<n.length-1;i++){var o=new FF(r,i),s=new LF(e,r.getMinX(i),o);this.events.add(s),this.events.add(new LF(r.getMaxX(i),s))}},e.prototype.processOverlaps=function(t,e,r,n){for(var i=r.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();r.isSameLabel(s)||(i.computeIntersections(a,n),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){var i=n.next();this.addEdge(i,r)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(OF),RF=function(){this._min=CS.POSITIVE_INFINITY,this._max=CS.NEGATIVE_INFINITY},UF={NodeComparator:{configurable:!0}};RF.prototype.getMin=function(){return this._min},RF.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},RF.prototype.getMax=function(){return this._max},RF.prototype.toString=function(){return iB.toLineString(new PS(this._min,0),new PS(this._max,0))},RF.prototype.interfaces_=function(){return[]},RF.prototype.getClass=function(){return RF},UF.NodeComparator.get=function(){return DF},Object.defineProperties(RF,UF);var DF=function(){};DF.prototype.compare=function(t,e){var r=t,n=e,i=(r._min+r._max)/2,o=(n._min+n._max)/2;return i<o?-1:i>o?1:0},DF.prototype.interfaces_=function(){return[IS]},DF.prototype.getClass=function(){return DF};var QF=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],r=arguments[1],n=arguments[2];this._min=e,this._max=r,this._item=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;r.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(RF),GF=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],r=arguments[1];this._node1=e,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,r),null!==this._node2&&this._node2.query(t,e,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(RF),jF=function(){this._leaves=new FB,this._root=null,this._level=0};jF.prototype.buildTree=function(){ET.sort(this._leaves,new RF.NodeComparator);for(var t=this._leaves,e=null,r=new FB;;){if(this.buildLevel(t,r),1===r.size())return r.get(0);e=t,t=r,r=e}},jF.prototype.insert=function(t,e,r){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new QF(t,e,r))},jF.prototype.query=function(t,e,r){this.init(),this._root.query(t,e,r)},jF.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},jF.prototype.printNode=function(t){YS.out.println(iB.toLineString(new PS(t._min,this._level),new PS(t._max,this._level)))},jF.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},jF.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var r=0;r<t.size();r+=2){var n=t.get(r);if(null===(r+1<t.size()?t.get(r):null))e.add(n);else{var i=new GF(t.get(r),t.get(r+1));e.add(i)}}},jF.prototype.interfaces_=function(){return[]},jF.prototype.getClass=function(){return jF};var HF=function(){this._items=new FB};HF.prototype.visitItem=function(t){this._items.add(t)},HF.prototype.getItems=function(){return this._items},HF.prototype.interfaces_=function(){return[wT]},HF.prototype.getClass=function(){return HF};var zF=function(){this._index=null;var t=arguments[0];if(!NS(t,bI))throw new xS("Argument must be Polygonal");this._index=new qF(t)},VF={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};zF.prototype.locate=function(t){var e=new AB(t),r=new KF(e);return this._index.query(t.y,t.y,r),e.getLocation()},zF.prototype.interfaces_=function(){return[cP]},zF.prototype.getClass=function(){return zF},VF.SegmentVisitor.get=function(){return KF},VF.IntervalIndexedGeometry.get=function(){return qF},Object.defineProperties(zF,VF);var KF=function(){this._counter=null;var t=arguments[0];this._counter=t};KF.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},KF.prototype.interfaces_=function(){return[wT]},KF.prototype.getClass=function(){return KF};var qF=function(){this._index=new jF;var t=arguments[0];this.init(t)};qF.prototype.init=function(t){for(var e=XP.getLines(t).iterator();e.hasNext();){var r=e.next().getCoordinates();this.addLine(r)}},qF.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var r=new QT(t[e-1],t[e]),n=Math.min(r.p0.y,r.p1.y),i=Math.max(r.p0.y,r.p1.y);this._index.insert(n,i,r)}},qF.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new HF;return this._index.query(t,e,r),r.getItems()}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._index.query(n,i,o)}},qF.prototype.interfaces_=function(){return[]},qF.prototype.getClass=function(){return qF};var WF=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new NI,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new YP,2===arguments.length){var e=arguments[0],r=arguments[1],n=_B.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=r,this._boundaryNodeRule=n,null!==r&&this.add(r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];this._argIndex=i,this._parentGeom=o,this._boundaryNodeRule=s,null!==o&&this.add(o)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertBoundaryPoint=function(t,r){var n=this._nodes.addNode(r).getLabel(),i=1;OS.NONE,n.getLocation(t,XI.ON)===OS.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);n.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var r=arguments[1],n=arguments[2],i=new kF(arguments[0],!0,!1);i.setIsDoneIfProperInt(n);var o=this.createEdgeSetIntersector(),s=this._parentGeom instanceof EI||this._parentGeom instanceof xI||this._parentGeom instanceof SI,a=r||!s;return o.computeIntersections(this._edges,i,a),this.addSelfIntersectionNodes(this._argIndex),i}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();)e.next().eiList.addSplitEdges(t)},e.prototype.computeEdgeIntersections=function(t,e,r){var n=new kF(e,r,!0);return n.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,n),n},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof wI){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,OS.INTERIOR)}else if(arguments[0]instanceof PS){var e=arguments[0];this.insertPoint(this._argIndex,e,OS.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),OS.EXTERIOR,OS.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var r=t.getInteriorRingN(e);this.addPolygonRing(r,OS.INTERIOR,OS.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],OS.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],OS.BOUNDARY)},e.prototype.addLineString=function(t){var e=OB.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var r=new BP(e,new iT(this._argIndex,OS.INTERIOR));this._lineEdgeMap.put(t,r),this.insertEdge(r),aB.isTrue(e.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),r=0,n=t.iterator();n.hasNext();){var i=n.next();e[r++]=i.getCoordinate().copy()}return e},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,r){if(this.isBoundaryNode(t,e))return null;r===OS.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,r)},e.prototype.addPolygonRing=function(t,e,r){if(t.isEmpty())return null;var n=OB.removeRepeatedPoints(t.getCoordinates());if(n.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=n[0],null;var i=e,o=r;fB.isCCW(n)&&(i=r,o=e);var s=new BP(n,new iT(this._argIndex,OS.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,n[0],OS.BOUNDARY)},e.prototype.insertPoint=function(t,e,r){var n=this._nodes.addNode(e),i=n.getLabel();null===i?n._label=new iT(t,r):i.setLocation(t,r)},e.prototype.createEdgeSetIntersector=function(){return new NF},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var r=e.next(),n=r.getLabel().getLocation(t),i=r.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,n)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof SI&&(this._useBoundaryDeterminationRule=!1),e instanceof xI)this.addPolygon(e);else if(e instanceof vI)this.addLineString(e);else if(e instanceof wI)this.addPoint(e);else if(e instanceof CI)this.addCollection(e);else if(e instanceof aI)this.addCollection(e);else if(e instanceof SI)this.addCollection(e);else{if(!(e instanceof sI))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},e.prototype.locate=function(t){return NS(this._parentGeom,bI)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new zF(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)?OS.BOUNDARY:OS.INTERIOR},e}(gT),XF=function(){if(this._li=new hB,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 WF(0,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1],n=_B.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new WF(0,e,n),this._arg[1]=new WF(1,r,n)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new WF(0,i,s),this._arg[1]=new WF(1,o,s)}};XF.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},XF.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},XF.prototype.interfaces_=function(){return[]},XF.prototype.getClass=function(){return XF};var YF=function(){};YF.prototype.interfaces_=function(){return[]},YF.prototype.getClass=function(){return YF},YF.map=function(){if(arguments[0]instanceof gB&&NS(arguments[1],YF.MapOp)){for(var t=arguments[0],e=arguments[1],r=new FB,n=0;n<t.getNumGeometries();n++){var i=e.map(t.getGeometryN(n));null!==i&&r.add(i)}return t.getFactory().buildGeometry(r)}if(NS(arguments[0],SB)&&NS(arguments[1],YF.MapOp)){for(var o=arguments[0],s=arguments[1],a=new FB,l=o.iterator();l.hasNext();){var u=l.next(),h=s.map(u);null!==h&&a.add(h)}return a}},YF.MapOp=function(){};var ZF=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r),this._ptLocator=new YP,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new mP,this._resultPolyList=new FB,this._resultLineList=new FB,this._resultPointList=new FB,this._graph=new gT(new gP),this._geomFact=e.getFactory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new iT(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(r),i.add(n),r.merge(n)}else this._edgeList.add(t)},e.prototype.getGraph=function(){return this._graph},e.prototype.cancelDuplicateResultEdges=function(){for(var t=this._graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),r=e.getSym();e.isInResult()&&r.isInResult()&&(e.setInResult(!1),r.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,r,n,i){var o=new FB;return o.addAll(t),o.addAll(r),o.addAll(n),o.isEmpty()?e.createEmptyResult(i,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().mergeSymLabels()},e.prototype.isCovered=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(this._ptLocator.locate(t,n)!==OS.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new FB,e=this._edgeList.iterator();e.hasNext();){var r=e.next();r.isCollapsed()&&(e.remove(),t.add(r.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getEdges().getLabel();e.getLabel().merge(r)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();this.insertUniqueEdge(r)}},e.prototype.computeOverlay=function(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var e=new FB;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),dF.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var r=new yT(this._geomFact);r.add(this._graph),this._resultPolyList=r.getPolygons();var n=new yF(this,this._geomFact,this._ptLocator);this._resultLineList=n.build(t);var i=new mF(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},e.prototype.labelIncompleteNode=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,r)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var r=e.next();this._graph.addNode(r.getCoordinate()).setLabel(t,r.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var r=this._graph.getEdgeEnds().iterator();r.hasNext();){var n=r.next(),i=n.getLabel();i.isArea()&&!n.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,XI.RIGHT),i.getLocation(1,XI.RIGHT),t)&&n.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),r=e.getLabel(),n=e.getDepth();if(!n.isNull()){n.normalize();for(var i=0;i<2;i++)r.isNull(i)||!r.isArea()||n.isNull(i)||(0===n.getDelta(i)?r.toLine(i):(aB.isTrue(!n.isNull(i,XI.LEFT),"depth of LEFT side has not been initialized"),r.setLocation(i,XI.LEFT,n.getLocation(i,XI.LEFT)),aB.isTrue(!n.isNull(i,XI.RIGHT),"depth of RIGHT side has not been initialized"),r.setLocation(i,XI.RIGHT,n.getLocation(i,XI.RIGHT))))}}},e.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},e.prototype.labelIncompleteNodes=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getLabel();e.isIsolated()&&(r.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(r)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(XF);ZF.overlayOp=function(t,e,r){return new ZF(t,e).getResultGeometry(r)},ZF.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return ZF.createEmptyResult(ZF.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var r=e;return gF.map(t,{interfaces_:function(){return[YF.MapOp]},map:function(t){return t.intersection(r)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),PF.overlayOp(t,e,ZF.INTERSECTION)},ZF.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ZF.createEmptyResult(ZF.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),PF.overlayOp(t,e,ZF.SYMDIFFERENCE)},ZF.resultDimension=function(t,e,r){var n=e.getDimension(),i=r.getDimension(),o=-1;switch(t){case ZF.INTERSECTION:o=Math.min(n,i);break;case ZF.UNION:o=Math.max(n,i);break;case ZF.DIFFERENCE:o=n;break;case ZF.SYMDIFFERENCE:o=Math.max(n,i)}return o},ZF.createEmptyResult=function(t,e,r,n){var i=null;switch(ZF.resultDimension(t,e,r)){case-1:i=n.createGeometryCollection(new Array(0).fill(null));break;case 0:i=n.createPoint();break;case 1:i=n.createLineString();break;case 2:i=n.createPolygon()}return i},ZF.difference=function(t,e){return t.isEmpty()?ZF.createEmptyResult(ZF.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),PF.overlayOp(t,e,ZF.DIFFERENCE))},ZF.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=t.getLocation(0),n=t.getLocation(1);return ZF.isResultOfOp(r,n,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];switch(i===OS.BOUNDARY&&(i=OS.INTERIOR),o===OS.BOUNDARY&&(o=OS.INTERIOR),s){case ZF.INTERSECTION:return i===OS.INTERIOR&&o===OS.INTERIOR;case ZF.UNION:return i===OS.INTERIOR||o===OS.INTERIOR;case ZF.DIFFERENCE:return i===OS.INTERIOR&&o!==OS.INTERIOR;case ZF.SYMDIFFERENCE:return i===OS.INTERIOR&&o!==OS.INTERIOR||i!==OS.INTERIOR&&o===OS.INTERIOR}return!1}},ZF.INTERSECTION=1,ZF.UNION=2,ZF.DIFFERENCE=3,ZF.SYMDIFFERENCE=4;var JF=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new YP,this._seg=new QT;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};JF.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,r=0;r<this._linework.getNumGeometries();r++)for(var n=e._linework.getGeometryN(r).getCoordinateSequence(),i=0;i<n.size()-1;i++)if(n.getCoordinate(i,e._seg.p0),n.getCoordinate(i+1,e._seg.p1),e._seg.distance(t)<=e._boundaryDistanceTolerance)return!0;return!1},JF.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?OS.BOUNDARY:this._ptLocator.locate(t,this._g)},JF.prototype.extractLinework=function(t){var e=new $F;t.apply(e);var r=e.getLinework(),n=GI.toLineStringArray(r);return t.getFactory().createMultiLineString(n)},JF.prototype.interfaces_=function(){return[]},JF.prototype.getClass=function(){return JF};var $F=function(){this._linework=null,this._linework=new FB};$F.prototype.getLinework=function(){return this._linework},$F.prototype.filter=function(t){if(t instanceof xI){var e=t;this._linework.add(e.getExteriorRing());for(var r=0;r<e.getNumInteriorRing();r++)this._linework.add(e.getInteriorRingN(r))}},$F.prototype.interfaces_=function(){return[iI]},$F.prototype.getClass=function(){return $F};var tL=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};tL.prototype.extractPoints=function(t,e,r){for(var n=t.getCoordinates(),i=0;i<n.length-1;i++)this.computeOffsetPoints(n[i],n[i+1],e,r)},tL.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},tL.prototype.getPoints=function(t){for(var e=new FB,r=XP.getLines(this._g).iterator();r.hasNext();){var n=r.next();this.extractPoints(n,t,e)}return e},tL.prototype.computeOffsetPoints=function(t,e,r,n){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),a=r*i/s,l=r*o/s,u=(e.x+t.x)/2,h=(e.y+t.y)/2;if(this._doLeft){var c=new PS(u-l,h+a);n.add(c)}if(this._doRight){var A=new PS(u+l,h-a);n.add(A)}},tL.prototype.interfaces_=function(){return[]},tL.prototype.getClass=function(){return tL};var eL=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 FB;var e=arguments[0],r=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,r),this._geom=[e,r,n],this._locFinder=[new JF(this._geom[0],this._boundaryDistanceTolerance),new JF(this._geom[1],this._boundaryDistanceTolerance),new JF(this._geom[2],this._boundaryDistanceTolerance)]},rL={TOLERANCE:{configurable:!0}};eL.prototype.reportResult=function(t,e,r){YS.out.println("Overlay result invalid - A:"+OS.toLocationSymbol(e[0])+" B:"+OS.toLocationSymbol(e[1])+" expected:"+(r?"i":"e")+" actual:"+OS.toLocationSymbol(e[2]))},eL.prototype.isValid=function(t){return this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]),this.checkValid(t)},eL.prototype.checkValid=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=0;r<this._testCoords.size();r++){var n=t._testCoords.get(r);if(!t.checkValid(e,n))return t._invalidLocation=n,!1}return!0}if(2===arguments.length){var i=arguments[0],o=arguments[1];return this._location[0]=this._locFinder[0].getLocation(o),this._location[1]=this._locFinder[1].getLocation(o),this._location[2]=this._locFinder[2].getLocation(o),!!eL.hasLocation(this._location,OS.BOUNDARY)||this.isValidResult(i,this._location)}},eL.prototype.addTestPts=function(t){var e=new tL(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},eL.prototype.isValidResult=function(t,e){var r=ZF.isResultOfOp(e[0],e[1],t),n=!(r^e[2]===OS.INTERIOR);return n||this.reportResult(t,e,r),n},eL.prototype.getInvalidLocation=function(){return this._invalidLocation},eL.prototype.interfaces_=function(){return[]},eL.prototype.getClass=function(){return eL},eL.hasLocation=function(t,e){for(var r=0;r<3;r++)if(t[r]===e)return!0;return!1},eL.computeBoundaryDistanceTolerance=function(t,e){return Math.min(wF.computeSizeBasedSnapTolerance(t),wF.computeSizeBasedSnapTolerance(e))},eL.isValid=function(t,e,r,n){return new eL(t,e,n).isValid(r)},rL.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(eL,rL);var nL=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};nL.prototype.extractElements=function(t,e){if(null===t)return null;for(var r=0;r<t.getNumGeometries();r++){var n=t.getGeometryN(r);this._skipEmpty&&n.isEmpty()||e.add(n)}},nL.prototype.combine=function(){for(var t=new FB,e=this._inputGeoms.iterator();e.hasNext();){var r=e.next();this.extractElements(r,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},nL.prototype.interfaces_=function(){return[]},nL.prototype.getClass=function(){return nL},nL.combine=function(){if(1===arguments.length)return new nL(arguments[0]).combine();if(2===arguments.length){var t=arguments[0],e=arguments[1];return new nL(nL.createList(t,e)).combine()}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];return new nL(nL.createList(r,n,i)).combine()}},nL.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},nL.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new FB;return r.add(t),r.add(e),r}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=new FB;return s.add(n),s.add(i),s.add(o),s}};var iL=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new FB)},oL={STRTREE_NODE_CAPACITY:{configurable:!0}};iL.prototype.reduceToGeometries=function(t){for(var e=new FB,r=t.iterator();r.hasNext();){var n=r.next(),i=null;NS(n,TB)?i=this.unionTree(n):n instanceof gB&&(i=n),e.add(i)}return e},iL.prototype.extractByEnvelope=function(t,e,r){for(var n=new FB,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?n.add(o):r.add(o)}return this._geomFactory.buildGeometry(n)},iL.prototype.unionOptimized=function(t,e){var r=t.getEnvelopeInternal(),n=e.getEnvelopeInternal();if(!r.intersects(n))return nL.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=r.intersection(n);return this.unionUsingEnvelopeIntersection(t,e,i)},iL.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 FT(iL.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var r=e.next();t.insert(r.getEnvelopeInternal(),r)}this._inputPolys=null;var n=t.itemsTree();return this.unionTree(n)},iL.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];if(n-r<=1){var i=iL.getGeometry(e,r);return this.unionSafe(i,null)}if(n-r==2)return this.unionSafe(iL.getGeometry(e,r),iL.getGeometry(e,r+1));var o=Math.trunc((n+r)/2),s=this.binaryUnion(e,r,o),a=this.binaryUnion(e,o,n);return this.unionSafe(s,a)}},iL.prototype.repeatedUnion=function(t){for(var e=null,r=t.iterator();r.hasNext();){var n=r.next();e=null===e?n.copy():e.union(n)}return e},iL.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},iL.prototype.unionActual=function(t,e){return iL.restrictToPolygons(t.union(e))},iL.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},iL.prototype.unionUsingEnvelopeIntersection=function(t,e,r){var n=new FB,i=this.extractByEnvelope(r,t,n),o=this.extractByEnvelope(r,e,n),s=this.unionActual(i,o);return n.add(s),nL.combine(n)},iL.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().createGeometryCollection([e,r]).buffer(0)}},iL.prototype.interfaces_=function(){return[]},iL.prototype.getClass=function(){return iL},iL.restrictToPolygons=function(t){if(NS(t,bI))return t;var e=WP.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(GI.toPolygonArray(e))},iL.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},iL.union=function(t){return new iL(t).union()},oL.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(iL,oL);var sL=function(){};function aL(){return new lL}function lL(){this.reset()}sL.prototype.interfaces_=function(){return[]},sL.prototype.getClass=function(){return sL},sL.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ZF.createEmptyResult(ZF.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),PF.overlayOp(t,e,ZF.UNION)},lL.prototype={constructor:lL,reset:function(){this.s=this.t=0},add:function(t){hL(uL,t,this.t),hL(this,uL.s,this.s),this.s?this.t+=uL.t:this.s=uL.t},valueOf:function(){return this.s}};var uL=new lL;function hL(t,e,r){var n=t.s=e+r,i=n-e,o=n-i;t.t=e-o+(r-i)}var cL=1e-6,AL=Math.PI,fL=AL/2,pL=AL/4,dL=2*AL,gL=180/AL,yL=AL/180,mL=Math.abs,vL=Math.atan,_L=Math.atan2,wL=Math.cos,bL=Math.sin,xL=Math.sqrt;function CL(t){return t>1?0:t<-1?AL:Math.acos(t)}function EL(t){return t>1?fL:t<-1?-fL:Math.asin(t)}function SL(){}function BL(t,e){t&&FL.hasOwnProperty(t.type)&&FL[t.type](t,e)}var IL,TL,PL={Feature:function(t,e){BL(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)BL(r[n].geometry,e)}},FL={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){LL(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)LL(r[n],e,0)},Polygon:function(t,e){ML(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)ML(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)BL(r[n],e)}};function LL(t,e,r){var n,i=-1,o=t.length-r;for(e.lineStart();++i<o;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function ML(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)LL(t[r],e,1);e.polygonEnd()}function OL(t){return[_L(t[1],t[0]),EL(t[2])]}function kL(t){var e=t[0],r=t[1],n=wL(r);return[n*wL(e),n*bL(e),bL(r)]}function NL(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function RL(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 UL(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function DL(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function QL(t){var e=xL(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function GL(t,e){function r(r,n){return r=t(r,n),e(r[0],r[1])}return t.invert&&e.invert&&(r.invert=function(r,n){return(r=e.invert(r,n))&&t.invert(r[0],r[1])}),r}function jL(t,e){return[t>AL?t-dL:t<-AL?t+dL:t,e]}function HL(t){return function(e,r){return[(e+=t)>AL?e-dL:e<-AL?e+dL:e,r]}}function zL(t){var e=HL(t);return e.invert=HL(-t),e}function VL(t,e){var r=wL(t),n=bL(t),i=wL(e),o=bL(e);function s(t,e){var s=wL(e),a=wL(t)*s,l=bL(t)*s,u=bL(e),h=u*r+a*n;return[_L(l*i-h*o,a*r-u*n),EL(h*i+l*o)]}return s.invert=function(t,e){var s=wL(e),a=wL(t)*s,l=bL(t)*s,u=bL(e),h=u*i-l*o;return[_L(l*i+u*o,a*r+h*n),EL(h*r-a*n)]},s}function KL(t,e){(e=kL(e))[0]-=t,QL(e);var r=CL(-e[1]);return((-e[2]<0?-r:r)+dL-cL)%dL}function qL(){var t,e=[];return{point:function(e,r){t.push([e,r])},lineStart:function(){e.push(t=[])},lineEnd:SL,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function WL(t,e){return mL(t[0]-e[0])<cL&&mL(t[1]-e[1])<cL}function XL(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function YL(t,e,r,n,i){var o,s,a=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,r,n=t[0],s=t[e];if(WL(n,s)){for(i.lineStart(),o=0;o<e;++o)i.point((n=t[o])[0],n[1]);i.lineEnd()}else a.push(r=new XL(n,t,null,!0)),l.push(r.o=new XL(n,null,r,!1)),a.push(r=new XL(s,t,null,!1)),l.push(r.o=new XL(s,null,r,!0))}})),a.length){for(l.sort(e),ZL(a),ZL(l),o=0,s=l.length;o<s;++o)l[o].e=r=!r;for(var u,h,c=a[0];;){for(var A=c,f=!0;A.v;)if((A=A.n)===c)return;u=A.z,i.lineStart();do{if(A.v=A.o.v=!0,A.e){if(f)for(o=0,s=u.length;o<s;++o)i.point((h=u[o])[0],h[1]);else n(A.x,A.n.x,1,i);A=A.n}else{if(f)for(u=A.p.z,o=u.length-1;o>=0;--o)i.point((h=u[o])[0],h[1]);else n(A.x,A.p.x,-1,i);A=A.p}u=(A=A.o).z,f=!f}while(!A.v);i.lineEnd()}}}function ZL(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}function JL(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function $L(t){for(var e,r,n,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(r=new Array(s);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--s]=n[e];return r}aL(),aL(),aL(),jL.invert=jL,1===(IL=JL).length&&(TL=IL,IL=function(t,e){return JL(TL(t),e)});var tM=1e9,eM=-tM,rM=aL();function nM(t){return t}aL(),aL(),aL();var iM=1/0,oM=iM,sM=-iM,aM=sM,lM={point:function(t,e){t<iM&&(iM=t),t>sM&&(sM=t),e<oM&&(oM=e),e>aM&&(aM=e)},lineStart:SL,lineEnd:SL,polygonStart:SL,polygonEnd:SL,result:function(){var t=[[iM,oM],[sM,aM]];return sM=aM=-(oM=iM=1/0),t}};function uM(t,e,r,n){return function(i,o){var s,a,l,u=e(o),h=i.invert(n[0],n[1]),c=qL(),A=e(c),f=!1,p={point:d,lineStart:y,lineEnd:m,polygonStart:function(){p.point=v,p.lineStart=_,p.lineEnd=w,a=[],s=[]},polygonEnd:function(){p.point=d,p.lineStart=y,p.lineEnd=m,a=$L(a);var t=function(t,e){var r=e[0],n=e[1],i=[bL(r),-wL(r),0],o=0,s=0;rM.reset();for(var a=0,l=t.length;a<l;++a)if(h=(u=t[a]).length)for(var u,h,c=u[h-1],A=c[0],f=c[1]/2+pL,p=bL(f),d=wL(f),g=0;g<h;++g,A=m,p=_,d=w,c=y){var y=u[g],m=y[0],v=y[1]/2+pL,_=bL(v),w=wL(v),b=m-A,x=b>=0?1:-1,C=x*b,E=C>AL,S=p*_;if(rM.add(_L(S*x*bL(C),d*w+S*wL(C))),o+=E?b+x*dL:b,E^A>=r^m>=r){var B=RL(kL(c),kL(y));QL(B);var I=RL(i,B);QL(I);var T=(E^b>=0?-1:1)*EL(I[2]);(n>T||n===T&&(B[0]||B[1]))&&(s+=E^b>=0?1:-1)}}return(o<-cL||o<cL&&rM<-cL)^1&s}(s,h);a.length?(f||(o.polygonStart(),f=!0),YL(a,cM,t,r,o)):t&&(f||(o.polygonStart(),f=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),f&&(o.polygonEnd(),f=!1),a=s=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function d(e,r){var n=i(e,r);t(e=n[0],r=n[1])&&o.point(e,r)}function g(t,e){var r=i(t,e);u.point(r[0],r[1])}function y(){p.point=g,u.lineStart()}function m(){p.point=d,u.lineEnd()}function v(t,e){l.push([t,e]);var r=i(t,e);A.point(r[0],r[1])}function _(){A.lineStart(),l=[]}function w(){v(l[0][0],l[0][1]),A.lineEnd();var t,e,r,n,i=A.clean(),u=c.result(),h=u.length;if(l.pop(),s.push(l),l=null,h)if(1&i){if((e=(r=u[0]).length-1)>0){for(f||(o.polygonStart(),f=!0),o.lineStart(),t=0;t<e;++t)o.point((n=r[t])[0],n[1]);o.lineEnd()}}else h>1&&2&i&&u.push(u.pop().concat(u.shift())),a.push(u.filter(hM))}return p}}function hM(t){return t.length>1}function cM(t,e){return((t=t.x)[0]<0?t[1]-fL-cL:fL-t[1])-((e=e.x)[0]<0?e[1]-fL-cL:fL-e[1])}aL();const AM=uM((function(){return!0}),(function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?AL:-AL,l=mL(o-r);mL(l-AL)<cL?(t.point(r,n=(n+s)/2>0?fL:-fL),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(o,n),e=0):i!==a&&l>=AL&&(mL(r-i)<cL&&(r-=i*cL),mL(o-a)<cL&&(o-=a*cL),n=function(t,e,r,n){var i,o,s=bL(t-r);return mL(s)>cL?vL((bL(e)*(o=wL(n))*bL(r)-bL(n)*(i=wL(e))*bL(t))/(i*o*s)):(e+n)/2}(r,n,o,s),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),e=0),t.point(r=o,n=s),i=a},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var i;if(null==t)i=r*fL,n.point(-AL,i),n.point(0,i),n.point(AL,i),n.point(AL,0),n.point(AL,-i),n.point(0,-i),n.point(-AL,-i),n.point(-AL,0),n.point(-AL,i);else if(mL(t[0]-e[0])>cL){var o=t[0]<e[0]?AL:-AL;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(e[0],e[1])}),[-AL,-fL]);function fM(t){return function(e){var r=new pM;for(var n in t)r[n]=t[n];return r.stream=e,r}}function pM(){}function dM(t,e,r){var n=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),function(t,e){t&&PL.hasOwnProperty(t.type)?PL[t.type](t,e):BL(t,e)}(r,t.stream(lM));var s=lM.result(),a=Math.min(n/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),l=+e[0][0]+(n-a*(s[1][0]+s[0][0]))/2,u=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([l,u])}pM.prototype={constructor:pM,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 gM=16,yM=wL(30*yL);function mM(t,e){return+e?function(t,e){function r(n,i,o,s,a,l,u,h,c,A,f,p,d,g){var y=u-n,m=h-i,v=y*y+m*m;if(v>4*e&&d--){var _=s+A,w=a+f,b=l+p,x=xL(_*_+w*w+b*b),C=EL(b/=x),E=mL(mL(b)-1)<cL||mL(o-c)<cL?(o+c)/2:_L(w,_),S=t(E,C),B=S[0],I=S[1],T=B-n,P=I-i,F=m*T-y*P;(F*F/v>e||mL((y*T+m*P)/v-.5)>.3||s*A+a*f+l*p<yM)&&(r(n,i,o,s,a,l,B,I,E,_/=x,w/=x,b,d,g),g.point(B,I),r(B,I,E,_,w,b,u,h,c,A,f,p,d,g))}}return function(e){var n,i,o,s,a,l,u,h,c,A,f,p,d={point:g,lineStart:y,lineEnd:v,polygonStart:function(){e.polygonStart(),d.lineStart=_},polygonEnd:function(){e.polygonEnd(),d.lineStart=y}};function g(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){h=NaN,d.point=m,e.lineStart()}function m(n,i){var o=kL([n,i]),s=t(n,i);r(h,c,u,A,f,p,h=s[0],c=s[1],u=n,A=o[0],f=o[1],p=o[2],gM,e),e.point(h,c)}function v(){d.point=g,e.lineEnd()}function _(){y(),d.point=w,d.lineEnd=b}function w(t,e){m(n=t,e),i=h,o=c,s=A,a=f,l=p,d.point=m}function b(){r(h,c,u,A,f,p,i,o,n,s,a,l,gM,e),d.lineEnd=v,v()}return d}}(t,e):function(t){return fM({point:function(e,r){e=t(e,r),this.stream.point(e[0],e[1])}})}(t)}var vM=fM({point:function(t,e){this.stream.point(t*yL,e*yL)}});function _M(t){return function(e,r){var n=wL(e),i=wL(r),o=t(n*i);return[o*i*bL(e),o*bL(r)]}}function wM(t){return function(e,r){var n=xL(e*e+r*r),i=t(n),o=bL(i),s=wL(i);return[_L(e*o,n*s),EL(n&&r*o/n)]}}_M((function(t){return xL(2/(1+t))})).invert=wM((function(t){return 2*EL(t/2)}));var bM=_M((function(t){return(t=CL(t))&&t/bL(t)}));function xM(t,e){return[t,e]}function CM(t,e,r){var n=(r=r||{}).units||"kilometers",i=r.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof r)throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return Hm(t,(function(t){var r=EM(t,e,n,i);r&&o.push(r)})),Cm(o);case"FeatureCollection":return Qm(t,(function(t){var r=EM(t,e,n,i);r&&Qm(r,(function(t){t&&o.push(t)}))})),Cm(o)}return EM(t,e,n,i)}function EM(t,e,r,n){var i=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var s=[];return Hm(t,(function(t){var i=EM(t,e,r,n);i&&s.push(i)})),Cm(s)}var a=function(t){var e,r=Jv(t).geometry.coordinates,n=[-r[0],-r[1]];return(e=bM,function(t){var e,r,n,i,o,s,a,l,u,h,c=150,A=480,f=250,p=0,d=0,g=0,y=0,m=0,v=null,_=AM,w=null,b=nM,x=.5,C=mM(B,x);function E(t){return[(t=o(t[0]*yL,t[1]*yL))[0]*c+r,n-t[1]*c]}function S(t){return(t=o.invert((t[0]-r)/c,(n-t[1])/c))&&[t[0]*gL,t[1]*gL]}function B(t,i){return[(t=e(t,i))[0]*c+r,n-t[1]*c]}function I(){o=GL(i=function(t,e,r){return(t%=dL)?e||r?GL(zL(t),VL(e,r)):zL(t):e||r?VL(e,r):jL}(g,y,m),e);var t=e(p,d);return r=A-t[0]*c,n=f+t[1]*c,T()}function T(){return u=h=null,E}return E.stream=function(t){return u&&h===t?u:u=vM(_(i,C(b(h=t))))},E.clipAngle=function(t){return arguments.length?(_=+t?function(t,e){var r=wL(t),n=r>0,i=mL(r)>cL;function o(t,e){return wL(t)*wL(e)>r}function s(t,e,n){var i=[1,0,0],o=RL(kL(t),kL(e)),s=NL(o,o),a=o[0],l=s-a*a;if(!l)return!n&&t;var u=r*s/l,h=-r*a/l,c=RL(i,o),A=DL(i,u);UL(A,DL(o,h));var f=c,p=NL(A,f),d=NL(f,f),g=p*p-d*(NL(A,A)-1);if(!(g<0)){var y=xL(g),m=DL(f,(-p-y)/d);if(UL(m,A),m=OL(m),!n)return m;var v,_=t[0],w=e[0],b=t[1],x=e[1];w<_&&(v=_,_=w,w=v);var C=w-_,E=mL(C-AL)<cL;if(!E&&x<b&&(v=b,b=x,x=v),E||C<cL?E?b+x>0^m[1]<(mL(m[0]-_)<cL?b:x):b<=m[1]&&m[1]<=x:C>AL^(_<=m[0]&&m[0]<=w)){var S=DL(f,(-p+y)/d);return UL(S,A),[m,OL(S)]}}}function a(e,r){var i=n?t:AL-t,o=0;return e<-i?o|=1:e>i&&(o|=2),r<-i?o|=4:r>i&&(o|=8),o}return uM(o,(function(t){var e,r,l,u,h;return{lineStart:function(){u=l=!1,h=1},point:function(c,A){var f,p=[c,A],d=o(c,A),g=n?d?0:a(c,A):d?a(c+(c<0?AL:-AL),A):0;if(!e&&(u=l=d)&&t.lineStart(),d!==l&&(!(f=s(e,p))||WL(e,f)||WL(p,f))&&(p[0]+=cL,p[1]+=cL,d=o(p[0],p[1])),d!==l)h=0,d?(t.lineStart(),f=s(p,e),t.point(f[0],f[1])):(f=s(e,p),t.point(f[0],f[1]),t.lineEnd()),e=f;else if(i&&e&&n^d){var y;g&r||!(y=s(p,e,!0))||(h=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!d||e&&WL(e,p)||t.point(p[0],p[1]),e=p,l=d,r=g},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return h|(u&&l)<<1}}}),(function(r,n,i,o){!function(t,e,r,n,i,o){if(r){var s=wL(e),a=bL(e),l=n*r;null==i?(i=e+n*dL,o=e-l/2):(i=KL(s,i),o=KL(s,o),(n>0?i<o:i>o)&&(i+=n*dL));for(var u,h=i;n>0?h>o:h<o;h-=l)u=OL([s,-a*wL(h),-a*bL(h)]),t.point(u[0],u[1])}}(o,t,e,i,r,n)}),n?[0,-t]:[-AL,t-AL])}(v=t*yL,6*yL):(v=null,AM),T()):v*gL},E.clipExtent=function(t){return arguments.length?(b=null==t?(w=s=a=l=null,nM):function(t,e,r,n){function i(i,o){return t<=i&&i<=r&&e<=o&&o<=n}function o(i,o,a,u){var h=0,c=0;if(null==i||(h=s(i,a))!==(c=s(o,a))||l(i,o)<0^a>0)do{u.point(0===h||3===h?t:r,h>1?n:e)}while((h=(h+a+4)%4)!==c);else u.point(o[0],o[1])}function s(n,i){return mL(n[0]-t)<cL?i>0?0:3:mL(n[0]-r)<cL?i>0?2:1:mL(n[1]-e)<cL?i>0?1:0:i>0?3:2}function a(t,e){return l(t.x,e.x)}function l(t,e){var r=s(t,1),n=s(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){var l,u,h,c,A,f,p,d,g,y,m,v=s,_=qL(),w={point:b,lineStart:function(){w.point=x,u&&u.push(h=[]),y=!0,g=!1,p=d=NaN},lineEnd:function(){l&&(x(c,A),f&&g&&_.rejoin(),l.push(_.result())),w.point=b,g&&v.lineEnd()},polygonStart:function(){v=_,l=[],u=[],m=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=u.length;r<i;++r)for(var o,s,a=u[r],l=1,h=a.length,c=a[0],A=c[0],f=c[1];l<h;++l)o=A,s=f,A=(c=a[l])[0],f=c[1],s<=n?f>n&&(A-o)*(n-s)>(f-s)*(t-o)&&++e:f<=n&&(A-o)*(n-s)<(f-s)*(t-o)&&--e;return e}(),r=m&&e,i=(l=$L(l)).length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&YL(l,a,e,o,s),s.polygonEnd()),v=s,l=u=h=null}};function b(t,e){i(t,e)&&v.point(t,e)}function x(o,s){var a=i(o,s);if(u&&h.push([o,s]),y)c=o,A=s,f=a,y=!1,a&&(v.lineStart(),v.point(o,s));else if(a&&g)v.point(o,s);else{var l=[p=Math.max(eM,Math.min(tM,p)),d=Math.max(eM,Math.min(tM,d))],_=[o=Math.max(eM,Math.min(tM,o)),s=Math.max(eM,Math.min(tM,s))];!function(t,e,r,n,i,o){var s,a=t[0],l=t[1],u=0,h=1,c=e[0]-a,A=e[1]-l;if(s=r-a,c||!(s>0)){if(s/=c,c<0){if(s<u)return;s<h&&(h=s)}else if(c>0){if(s>h)return;s>u&&(u=s)}if(s=i-a,c||!(s<0)){if(s/=c,c<0){if(s>h)return;s>u&&(u=s)}else if(c>0){if(s<u)return;s<h&&(h=s)}if(s=n-l,A||!(s>0)){if(s/=A,A<0){if(s<u)return;s<h&&(h=s)}else if(A>0){if(s>h)return;s>u&&(u=s)}if(s=o-l,A||!(s<0)){if(s/=A,A<0){if(s>h)return;s>u&&(u=s)}else if(A>0){if(s<u)return;s<h&&(h=s)}return u>0&&(t[0]=a+u*c,t[1]=l+u*A),h<1&&(e[0]=a+h*c,e[1]=l+h*A),!0}}}}}(l,_,t,e,r,n)?a&&(v.lineStart(),v.point(o,s),m=!1):(g||(v.lineStart(),v.point(l[0],l[1])),v.point(_[0],_[1]),a||v.lineEnd(),m=!1)}p=o,d=s,g=a}return w}}(w=+t[0][0],s=+t[0][1],a=+t[1][0],l=+t[1][1]),T()):null==w?null:[[w,s],[a,l]]},E.scale=function(t){return arguments.length?(c=+t,I()):c},E.translate=function(t){return arguments.length?(A=+t[0],f=+t[1],I()):[A,f]},E.center=function(t){return arguments.length?(p=t[0]%360*yL,d=t[1]%360*yL,I()):[p*gL,d*gL]},E.rotate=function(t){return arguments.length?(g=t[0]%360*yL,y=t[1]%360*yL,m=t.length>2?t[2]%360*yL:0,I()):[g*gL,y*gL,m*gL]},E.precision=function(t){return arguments.length?(C=mM(B,x=t*t),T()):xL(x)},E.fitExtent=function(t,e){return dM(E,t,e)},E.fitSize=function(t,e){return function(t,e,r){return dM(t,[[0,0],e],r)}(E,t,e)},function(){return e=t.apply(this,arguments),E.invert=e.invert&&S,I()}}((function(){return e}))()).scale(79.4188).clipAngle(179.999).rotate(n).scale(gm)}(o),l={type:o.type,coordinates:BM(o.coordinates,a)},u=(new qI).read(l),h=Tm(Pm(e,r),"meters"),c=QP.bufferOp(u,h,n);if(!SM((c=(new WI).write(c)).coordinates))return _m({type:c.type,coordinates:IM(c.coordinates,a)},i)}function SM(t){return Array.isArray(t[0])?SM(t[0]):isNaN(t[0])}function BM(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return BM(t,e)}))}function IM(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return IM(t,e)}))}function TM(t,e,r){void 0===r&&(r={});var n=rv(t),i=rv(e),o=wS.union(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?bm(o[0],r.properties):Bm(o,r.properties)}function PM(t,e,r){void 0===r&&(r={});var n=rv(t),i=rv(e),o=wS.intersection(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?bm(o[0],r.properties):Bm(o,r.properties)}function FM(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var l=t[0]+e*i[a],u=t[1]+r*o[a];s.push([l,u])}return s.push(s[0].slice()),bm([s],n)}function LM(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var l=[];l.push(t),l.push([t[0]+e*i[a],t[1]+r*o[a]]),l.push([t[0]+e*i[(a+1)%6],t[1]+r*o[(a+1)%6]]),l.push(t),s.push(bm([l],n))}return s}function MM(t,e){var r,n,i=function(t){return bm(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}(e),o=null;return"FeatureCollection"===t.type?(n=2===(r=t).features.length?wS.union(r.features[0].geometry.coordinates,r.features[1].geometry.coordinates):wS.union.apply(wS,r.features.map((function(t){return t.geometry.coordinates}))),o=OM(n)):o=OM(wS.union(t.geometry.coordinates)),o.geometry.coordinates.forEach((function(t){i.geometry.coordinates.push(t[0])})),i}function OM(t){return Bm(t)}bM.invert=wM((function(t){return t})),xM.invert=xM;const kM=class{static sector(t,e,r,n){let i=function(t,e,r,n,i){if(!Nm(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(null==r)throw new Error("bearing1 is required");if(null==n)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if("object"!=typeof i)throw new Error("options must be an object");if(ux(r)===ux(n))return Yv(t,e,i);var s=tv(t),a=function(t,e,r,n,i){void 0===i&&(i={});var o=i.steps||64,s=O_(r),a=O_(n),l=Array.isArray(t)||"Feature"!==t.type?{}:t.properties;if(s===a)return xm(Yv(t,e,i).geometry.coordinates[0],l);for(var u=s,h=s<a?a:a+360,c=u,A=[],f=0;c<h;)A.push(Xv(t,e,c,i).geometry.coordinates),c=u+360*++f/o;return c>h&&A.push(Xv(t,e,h,i).geometry.coordinates),xm(A,l)}(t,e,r,n,i),l=[[s]];return Um(a,(function(t){l[0].push(t)})),l[0].push(s),bm(l,o)}(t,e/1e3,r,n);return kM.to3857(i)}static nearestPoint(t,e){let r=function(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var r,n=1/0,i=0;return Qm(e,(function(e,r){var o=fv(t,e);o<n&&(i=r,n=o)})),(r=vv(e.features[i])).properties.featureIndex=i,r.properties.distanceToPoint=n,r}(kM.featureTo4326(t),kM.featuresTo4326(e));return kM.to3857(r)}static bezierSpline(t,e){let r;r=t instanceof W?kM.featureTo4326(t):t;let n=function(t,e){void 0===e&&(e={});for(var r=e.resolution||1e4,n=e.sharpness||.85,i=[],o=rv(t).coordinates.map((function(t){return{x:t[0],y:t[1]}})),s=new Wv({duration:r,points:o,sharpness:n}),a=function(t){var e=s.pos(t);Math.floor(t/100)%2==0&&i.push([e.x,e.y])},l=0;l<s.duration;l+=10)a(l);return a(s.duration),xm(i,e.properties)}(r,e);return kM.to3857(n)}static pointsWithinPolygon(t,e){let r,n=kM.featuresTo4326(t);"Circle"===e.getGeometry().getType()?(e.setGeometry(xn(e.getGeometry(),128)),r=kM.featureTo4326(e)):r=kM.featureTo4326(e);let i=(o=r,s=[],Qm(n,(function(t){var e=!1;if("Point"===t.geometry.type)Hm(o,(function(r){cv(t,r)&&(e=!0)})),e&&s.push(t);else{if("MultiPoint"!==t.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var r=[];Hm(o,(function(n){Um(t,(function(t){cv(t,n)&&(e=!0,r.push(t))}))})),e&&s.push(Sm(r))}})),Cm(s));var o,s;return kM.to3857_featureList(i)}static lineOffset(t,e=1){let r=function(t,e,r){if(!Nm(r=r||{}))throw new Error("options is invalid");var n=r.units;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");var i=nv(t),o=t.properties;switch(i){case"LineString":return vC(t,e,n);case"MultiLineString":var s=[];return Vm(t,(function(t){s.push(vC(t,e,n).geometry.coordinates)})),Em(s,o);default:throw new Error("geometry "+i+" is not supported")}}(kM.featureTo4326(t),e/=1e3,{units:"kilometers"});return kM.to3857(r)}static nearestPointOnLine(t,e){let r=kM.featureTo4326(t),n=p_(kM.featureTo4326(e),r,{units:"kilometers"});return kM.to3857(n)}static nearestPointOnLines(t,e){let r=kM.featureTo4326(t),n=p_(kM.featuresTo4326(e),r,{units:"kilometers"});return kM.to3857(n)}static booleanOverlap(t,e){return RC(kM.featureTo4326(t),kM.featureTo4326(e))}static booleanPointInPolygon(t,e){return cv(kM.featureTo4326(t),kM.featureTo4326(e))}static buffer(t,e=5){e/=1e3;let r=CM(kM.featureTo4326(t),e,{units:"kilometers"});return kM.to3857(r)}static difference(t,e){new nf;let r=kM.featureTo4326(t),n=(o=kM.featureTo4326(e),s=rv(i=r),a=rv(o),l=i.properties||{},0===(u=wS.difference(s.coordinates,a.coordinates)).length?null:1===u.length?bm(u[0],l):Bm(u,l));var i,o,s,a,l,u;return kM.to3857(n)}static intersect(t,e){let r=PM(kM.featureTo4326(t),kM.featureTo4326(e));return kM.to3857(r)}static booleanContains(t,e){try{let r,n,i,o=[],s=new nf;n="Circle"===t.getGeometry().getType()?xn(t.getGeometry(),128):t.getGeometry();let a=s.writeGeometryObject(n);return e.forEach((e=>{if(t!==e){i="Circle"===e.getGeometry().getType()?xn(e.getGeometry(),128):e.getGeometry();let t=s.writeGeometryObject(i);if(CC(a,t))r=s.readFeature(t),r.setProperties(e.getProperties()),o.push(r);else if("Point"!==i.getType()&&"LineString"!==i.getType()&&RC(a,t)){let n=PM(a,t);r=s.readFeature(n);let l=e.getProperties();l.name=e.get("name")+"重叠区域",l.重叠对象=e.get("name"),l.重叠面积=this.formatArea(i),r.setProperties(l),o.push(r)}}})),o}catch(UW){}}static createPolygon(t,e,r,n){let i,o=[],s=kM.featuresTo4326(e),a=function(t,e){void 0===e&&(e={});var r=e.maxEdge||1/0,n=function(t){var e=[],r={};return Qm(t,(function(t){if(t.geometry){var n=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(r,n)||(e.push(t),r[n]=!0)}})),Cm(e)}(t),i=dv(n);if(i.features=i.features.filter((function(t){var n=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],s=fv(n,i,e),a=fv(i,o,e),l=fv(n,o,e);return s<=r&&a<=r&&l<=r})),i.features.length<1)return null;var o=Hv(i);return 1===o.coordinates.length&&(o.coordinates=o.coordinates[0],o.type="Polygon"),_m(o)}(s),l={bbox:Zm(a)};switch(t){case Jy.voronoi:i=function(t,e){if(!Nm(e=e||{}))throw new Error("options is invalid");var r=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(r))throw new Error("bbox is invalid");return ev(t,"Point","points"),Cm(function(){var t=KC,e=qC,r=null;function n(n){return new BE(n.map((function(r,i){var o=[Math.round(t(r,i,n)/CE)*CE,Math.round(e(r,i,n)/CE)*CE];return o.index=i,o.data=r,o})),r)}return n.polygons=function(t){return n(t).polygons()},n.links=function(t){return n(t).links()},n.triangles=function(t){return n(t).triangles()},n.x=function(e){return arguments.length?(t="function"==typeof e?e:VC(+e),n):t},n.y=function(t){return arguments.length?(e="function"==typeof t?t:VC(+t),n):e},n.extent=function(t){return arguments.length?(r=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],n):r&&[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},n.size=function(t){return arguments.length?(r=null==t?null:[[0,0],[+t[0],+t[1]]],n):r&&[r[1][0]-r[0][0],r[1][1]-r[0][1]]},n}().x((function(t){return t.geometry.coordinates[0]})).y((function(t){return t.geometry.coordinates[1]})).extent([[r[0],r[1]],[r[2],r[3]]]).polygons(t.features).map(IE))}(s,l);break;case Jy.tin:i=dv(s,"z");break;case Jy.convex:kM.to3857(a)}return i.features.forEach(((t,e)=>{let i=kM.to3857(t);i.setStyle(new Gi({stroke:new kn({color:r||dm.getRandomColor(),width:5}),fill:new Tn({color:n||dm.getRandomColor()})})),i.setProperties({uuid:fm.uuid15(),name:"第"+e+"个"}),o.push(i)})),o}static createGrid(t,e={box:[0,0,0,0],cellSide:50}){let r=[];e.cellSide=e.cellSide/1e3;let n,i={units:"kilometers"};switch(t){case Zy.point:n=function(t,e,r){void 0===r&&(r={}),r.mask&&!r.units&&(r.units="kilometers");for(var n=[],i=t[0],o=t[1],s=t[2],a=t[3],l=e/fv([i,o],[s,o],r)*(s-i),u=e/fv([i,o],[i,a],r)*(a-o),h=s-i,c=a-o,A=Math.floor(h/l),f=(c-Math.floor(c/u)*u)/2,p=i+(h-A*l)/2;p<=s;){for(var d=o+f;d<=a;){var g=wm([p,d],r.properties);r.mask?S_(g,r.mask)&&n.push(g):n.push(g),d+=u}p+=l}return Cm(n)}(e.box,e.cellSide,i);break;case Zy.hex:n=function(t,e,r){void 0===r&&(r={});var n=JSON.stringify(r.properties||{}),i=t[0],o=t[1],s=t[2],a=t[3],l=(o+a)/2,u=(i+s)/2,h=2*e/fv([i,l],[s,l],r)*(s-i),c=2*e/fv([u,o],[u,a],r)*(a-o),A=h/2,f=2*A,p=Math.sqrt(3)/2*c,d=s-i,g=a-o,y=3/4*f,m=p,v=(d-f)/(f-A/2),_=Math.floor(v),w=(_*y-A/2-d)/2-A/2+y/2,b=Math.floor((g-p)/p),x=(g-b*p)/2,C=b*p-g>p/2;C&&(x-=p/4);for(var E=[],S=[],B=0;B<6;B++){var I=2*Math.PI/6*B;E.push(Math.cos(I)),S.push(Math.sin(I))}for(var T=[],P=0;P<=_;P++)for(var F=0;F<=b;F++){var L=P%2==1;if(!(0===F&&L||0===F&&C)){var M=P*y+i-w,O=F*m+o+x;if(L&&(O-=p/2),!0===r.triangles)LM([M,O],h/2,c/2,JSON.parse(n),E,S).forEach((function(t){r.mask?PM(r.mask,t)&&T.push(t):T.push(t)}));else{var k=FM([M,O],h/2,c/2,JSON.parse(n),E,S);r.mask?PM(r.mask,k)&&T.push(k):T.push(k)}}}return Cm(T)}(e.box,e.cellSide,i);break;case Zy.square:void 0===(s=i)&&(s={}),n=function(t,e,r,n){void 0===n&&(n={});for(var i=[],o=t[0],s=t[1],a=t[2],l=t[3],u=e/fv([o,s],[a,s],n)*(a-o),h=r/fv([o,s],[o,l],n)*(l-s),c=a-o,A=l-s,f=Math.floor(c/u),p=Math.floor(A/h),d=(A-p*h)/2,g=o+(c-f*u)/2,y=0;y<f;y++){for(var m=s+d,v=0;v<p;v++){var _=bm([[[g,m],[g,m+h],[g+u,m+h],[g+u,m],[g,m]]],n.properties);n.mask?UC(n.mask,_)&&i.push(_):i.push(_),m+=h}g+=u}return Cm(i)}(e.box,o=e.cellSide,o,s);break;case Zy.triangle:n=function(t,e,r){void 0===r&&(r={});for(var n=[],i=e/fv([t[0],t[1]],[t[2],t[1]],r)*(t[2]-t[0]),o=e/fv([t[0],t[1]],[t[0],t[3]],r)*(t[3]-t[1]),s=0,a=t[0];a<=t[2];){for(var l=0,u=t[1];u<=t[3];){var h=null,c=null;s%2==0&&l%2==0?(h=bm([[[a,u],[a,u+o],[a+i,u],[a,u]]],r.properties),c=bm([[[a,u+o],[a+i,u+o],[a+i,u],[a,u+o]]],r.properties)):s%2==0&&l%2==1?(h=bm([[[a,u],[a+i,u+o],[a+i,u],[a,u]]],r.properties),c=bm([[[a,u],[a,u+o],[a+i,u+o],[a,u]]],r.properties)):l%2==0&&s%2==1?(h=bm([[[a,u],[a,u+o],[a+i,u+o],[a,u]]],r.properties),c=bm([[[a,u],[a+i,u+o],[a+i,u],[a,u]]],r.properties)):l%2==1&&s%2==1&&(h=bm([[[a,u],[a,u+o],[a+i,u],[a,u]]],r.properties),c=bm([[[a,u+o],[a+i,u+o],[a+i,u],[a,u+o]]],r.properties)),r.mask?(PM(r.mask,h)&&n.push(h),PM(r.mask,c)&&n.push(c)):(n.push(h),n.push(c)),u+=o,l++}s++,a+=i}return Cm(n)}(e.box,e.cellSide,i)}var o,s;return n.features.forEach(((t,e)=>{let n=kM.to3857(t);n.setProperties({uuid:fm.uuid15(),name:"第"+e+"个"}),r.push(n)})),r}static isobands(t,e,r){const n=cC(t,e,{zProperty:r});return kM.to3857_featureList(n)}static isolines(t,e,r){const n=cC(t,e,{zProperty:r});return kM.to3857_featureList(n)}static randomPolygons(t,e=.0111,r=100){let n=[],i=Math.round(10*Math.random());return i=i<3?3:i,function(t,e){void 0===e&&(e={}),null==t&&(t=1),km(e.num_vertices)&&void 0!==e.num_vertices||(e.num_vertices=10),km(e.max_radial_length)&&void 0!==e.max_radial_length||(e.max_radial_length=10);for(var r=[],n=function(t){var n,i=[],o=TE(Array(e.num_vertices+1)).map(Math.random);o.forEach((function(t,e,r){r[e]=e>0?t+r[e-1]:t})),o.forEach((function(t){t=2*t*Math.PI/o[o.length-1];var r=Math.random();i.push([r*(e.max_radial_length||10)*Math.sin(t),r*(e.max_radial_length||10)*Math.cos(t)])})),i[i.length-1]=i[0],i=i.map((n=PE(e.bbox),function(t){return[t[0]+n[0],t[1]+n[1]]})),r.push(bm([i]))},i=0;i<t;i++)n();return Cm(r)}(r,{bbox:pr(t,"EPSG:3857","EPSG:4326"),num_vertices:i,max_radial_length:e}).features.forEach(((t,e)=>{let r=kM.to3857(t);r.setProperties({style:{fillcolor:dm.getRandomColor(),strokecolor:dm.getRandomColor(),strokewidth:2},uuid:fm.uuid15(),name:"第"+e+"个"}),n.push(r)})),n}static randomPolylines(t,e=.0111,r=100){let n=[],i=Math.round(10*Math.random());i=i<3?3:i;let o=function(t,e){if(void 0===e&&(e={}),!Nm(e=e||{}))throw new Error("options is invalid");var r=e.bbox,n=e.num_vertices,i=e.max_length,o=e.max_rotation;null==t&&(t=1),(!km(n)||void 0===n||n<2)&&(n=10),km(i)&&void 0!==i||(i=1e-4),km(o)&&void 0!==o||(o=Math.PI/8);for(var s=[],a=0;a<t;a++){for(var l=[PE(r)],u=0;u<n-1;u++){var h=(0===u?2*Math.random()*Math.PI:Math.tan((l[u][1]-l[u-1][1])/(l[u][0]-l[u-1][0])))+(Math.random()-.5)*o*2,c=Math.random()*i;l.push([l[u][0]+c*Math.cos(h),l[u][1]+c*Math.sin(h)])}s.push(xm(l))}return Cm(s)}(r,{bbox:pr(t,"EPSG:3857","EPSG:4326"),num_vertices:i,max_length:e});return o.features.forEach(((t,e)=>{let r=kM.to3857(t);r.setProperties({style:{fillcolor:dm.getRandomColor(),strokecolor:dm.getRandomColor(),strokewidth:2},uuid:fm.uuid15(),name:"第"+e+"个"}),n.push(r)})),n}static randomPoints(t,e=100){let r=[];return function(t,e){void 0===e&&(e={}),null==t&&(t=1);for(var r=[],n=0;n<t;n++)r.push(wm(PE(e.bbox)));return Cm(r)}(e,{bbox:pr(t,"EPSG:3857","EPSG:4326")}).features.forEach(((t,e)=>{let n=kM.to3857(t);n.setProperties({style:{fillcolor:dm.getRandomColor(),strokecolor:dm.getRandomColor(),strokewidth:2,radius:8},uuid:fm.uuid15(),name:"第"+e+"个"}),r.push(n)})),r}static formatArea(t,e=!1){const r=Ye(t);if(e)return r;{let t;return t=r>1e5?Math.round(r/1e6*100)/100+" km²":Math.round(100*r)/100+" m²",t}}static transTo3857(t){return pr(t,"EPSG:4326","EPSG:3857")}static transExtentTo4326(t){return pr(t,"EPSG:3857","EPSG:4326")}static getFeatureExtent(t){return t.getGeometry().getExtent()}static getFeatureCoord(t){return t.getGeometry().getCoordinates()}static randomLatLng(t){function e(t,e){return Math.floor(Math.random()*(e-t+1)+t)}let r,n=_m({type:"Polygon",coordinates:[[[114.02709960937501,22.59372606392931],[113.59313964843751,23.03929774776974],[113.48327636718751,22.253512814974744],[110.24230957031251,21.401933838235188],[107.88574218750001,22.522705703482472],[105.27099609375,23.664650731631625],[104.0625,22.998851594142923],[99.93164062500001,22.471954507739227],[98.85498046875001,25.025884063244828],[99.84375,29.065772888415406],[92.57080078125001,28.65203063036226],[85.53955078125001,29.219302076779456],[80.61767578125001,31.690781806136822],[79.69482421875,34.903952965590065],[75.49804687500001,37.26530995561875],[74.95971679687501,39.45316112807394],[81.82617187500001,42.74701217318067],[81.5185546875,44.25306865928177],[84.04541015625001,46.042735653846506],[87.72583007812501,48.026672195436014],[90.5712890625,45.10454630976873],[96.45996093750001,42.32606244456202],[105.71044921875001,41.19518982948959],[112.0166015625,42.84375132629023],[117.02636718750001,45.73685954736049],[120.60791015625,46.55886030311719],[117.83935546875001,48.922499263758255],[122.65136718750001,53.10721669189343],[127.13378906250001,49.53946900793534],[130.97900390625003,47.368594345213374],[134.45068359375003,48.019324184801185],[131.11083984375003,45.521743896993634],[130.51757812500003,43.197167282501276],[126.46362304687501,41.89409955811395],[121.94824218750001,39.26628442213066],[122.54150390625001,40.55554790286314],[121.70654296875001,41.19518982948959],[119.46533203125001,39.985538414809746],[118.64135742187501,39.206718844918505],[117.52075195312501,39.342794408952386],[117.43286132812501,38.41055825094609],[118.56445312500001,37.59682400108367],[119.080810546875,36.96744946416934],[120.81665039062501,37.326488613342086],[122.40966796875001,37.22158045838649],[120.05859375000001,36.35052700542766],[118.88305664062501,35.10193405724608],[120.47607421875001,33.422272258866045],[120.66284179687501,31.784216884487385],[121.81640625000001,30.996445897426373],[120.36621093750001,30.477082932837682],[121.28906250000001,29.19053283229458],[120.30029296875001,27.31321389856826],[119.102783203125,26.52956523826758],[118.45458984375001,24.9163314045991],[116.71875000000001,23.805449612314625],[115.04882812500001,22.84707068783908],[114.02709960937501,22.59372606392931]]]});t?(n=t,r=Zm(n)):r=Zm(t);let i=0,o=0,s=!0;try{do{i=e(1e6*r[0],1e6*r[2])/1e6,o=e(1e6*r[1],1e6*r[3])/1e6,s=cv(wm([i,o]),n)}while(!s);return{lnglat:[i,o],box:this.transTo3857(r)}}catch(UW){}}static shortestPath(t,e,r){let n,i=kM.featureTo4326(t),o=kM.featureTo4326(e);r&&(n={obstacles:kM.featuresTo4326(r.obstacles)});let s=function(t,e,r){if(!Nm(r=r||{}))throw new Error("options is invalid");var n=r.resolution,i=r.minDistance,o=r.obstacles||Cm([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(n&&!km(n)||n<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var s=$m(t),a=$m(e);switch(t=wm(s),e=wm(a),nv(o)){case"FeatureCollection":if(0===o.features.length)return xm([s,a]);break;case"Polygon":o=Cm([_m(rv(o))]);break;default:throw new Error("invalid obstacles")}var l=o;l.features.push(t),l.features.push(e);var u=Zm(function(t,e,r){if(!Nm(r=r||{}))throw new Error("options is invalid");var n=r.origin,i=r.mutate;if(!t)throw new Error("geojson required");var o=Array.isArray(n)||"object"==typeof n;return!0!==i&&(t=vv(t)),"FeatureCollection"!==t.type||o?gC(t,1.15,n):(Qm(t,(function(e,r){t.features[r]=gC(e,1.15,n)})),t)}(function(t,e){void 0===e&&(e={});var r=Number(t[0]),n=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(6===t.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var s=[r,n];return bm([[s,[i,n],[i,o],[r,o],s]],e.properties,{bbox:t,id:e.id})}(Zm(l))));n||(n=fv([u[0],u[1]],[u[2],u[1]],r)/100),l.features.pop(),l.features.pop();for(var h=u[0],c=u[1],A=u[2],f=u[3],p=n/fv([h,c],[A,c],r)*(A-h),d=n/fv([h,c],[h,f],r)*(f-c),g=A-h,y=f-c,m=Math.floor(g/p),v=Math.floor(y/d),_=(g-m*p)/2,w=[],b=[],x=[],C=[],E=1/0,S=1/0,B=f-(y-v*d)/2,I=0;B>=c;){for(var T=[],P=[],F=h+_,L=0;F<=A;){var M=wm([F,B]),O=zC(M,o);T.push(O?0:1),P.push(F+"|"+B);var k=fv(M,t);!O&&k<E&&(E=k,x={x:L,y:I});var N=fv(M,e);!O&&N<S&&(S=N,C={x:L,y:I}),F+=p,L++}b.push(T),w.push(P),B-=d,I++}var R=new GC(b,{diagonal:!0}),U=R.grid[x.y][x.x],D=R.grid[C.y][C.x],Q=QC.search(R,U,D),G=[s];return Q.forEach((function(t){var e=w[t.x][t.y].split("|");G.push([+e[0],+e[1]])})),G.push(a),function(t,e){void 0===e&&(e={});var r="object"==typeof e?e.mutate:e;if(!t)throw new Error("geojson is required");var n=nv(t),i=[];switch(n){case"LineString":i=zv(t);break;case"MultiLineString":case"Polygon":tv(t).forEach((function(t){i.push(zv(t))}));break;case"MultiPolygon":tv(t).forEach((function(t){var e=[];t.forEach((function(t){e.push(zv(t))})),i.push(e)}));break;case"Point":return t;case"MultiPoint":var o={};tv(t).forEach((function(t){var e=t.join("-");Object.prototype.hasOwnProperty.call(o,e)||(i.push(t),o[e]=!0)}));break;default:throw new Error(n+" geometry not supported")}return t.coordinates?!0===r?(t.coordinates=i,t):{type:n,coordinates:i}:!0===r?(t.geometry.coordinates=i,t):_m({type:n,coordinates:i},t.properties,{bbox:t.bbox,id:t.id})}(xm(G))}(i,o,n);return kM.to3857(s)}static lineMerger(t,e=1){let r=kM.featuresTo4326(t),n=[];r.features.forEach((t=>{let e=tv(t);if(xm(e),n.length>0)e[e.length-1][0]===n[n.length-1][0]&&e[e.length-1][1]===n[n.length-1][1]&&(e=e.reverse()),n[n.length-1][0]===e[0][0]&&n[n.length-1][1]===e[0][1]&&e.splice(0,1);else if(r.features.length>1){let t=tv(r.features[1]),n=A_(xm([e[0],e[e.length-1]]),xm([t[0],t[t.length-1]]));n.features[0].geometry.coordinates[0]===e[0][0]&&n.features[0].geometry.coordinates[1]===e[0][1]&&(e=e.reverse())}e.forEach((t=>{n.push(t)}))}));let i=xm(n);return{line:kM.to3857(i),nodeData:kM.lineAttr(n),coordinates:kM.along(n,e)}}static along(t,e){let r=xm(t);e/=1e3;let n=[];n.push(r.geometry.coordinates[0]);const i=w_(r,{units:"kilometers"});for(let o=1;o<=i/e;o++){const t=__(r,o*e,{units:"kilometers"});n.push(t.geometry.coordinates)}return n.push(r.geometry.coordinates[r.geometry.coordinates.length-1]),n}static lineAttr(t){let e=[];for(let r=0;r<t.length;r++){let n={coordIndex:0,distance:0,bearing:0,coords:[]};n.coordIndex=r,r+1<t.length?n.distance=1e3*fv(t[r],t[r+1],{units:"kilometers"}):n.distance=0,n.coords=t[r],e.push(n)}return e}static movePointContain(t,e){let r=new nf,n=xn(t.getGeometry(),128),i=r.writeGeometryObject(n,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"}),o={coordIndex:-1,distance:0,bearing:0,coords:[]};for(let s=0;s<e.length-1;s++)cv(wm(e[s].coords),i)&&(o=e[s]);return o}static arrayDup(t){let e=new Map;return t.forEach((t=>{e.set(JSON.stringify(t),t)})),Array.from(e.values())}static decoratePath(t,e){let r=function(t,e,r){if(!Nm(r=r||{}))throw new Error("options is invalid");var n=r.units,i=r.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return Vm(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,r,n){var i=w_(t,{units:r});if(i<=e)return n(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++)n(x_(t,e*s,e*(s+1),{units:r}))}(t,e,n,(function(t){o.push(t)}))})),Cm(o)}(xm(kM.arrayDup(t)),e,{units:"meters"});return kM.arrayDup(r.features.filter((t=>"Feature"===t.type)).map((t=>t.geometry.coordinates)).flat())}static lineSlice(t,e,r){let n=b_(kM.featureTo4326(t),kM.featureTo4326(e),kM.featureTo4326(r));return kM.to3857(n)}static booleanPointOnLine(t,e){let r=kM.featureTo4326(t),n=kM.featureTo4326(e);return C_($m(r),n)}static booleanCrosses(t,e){return function(t,e){var r=rv(t),n=rv(e),i=r.type,o=n.type;switch(i){case"MultiPoint":switch(o){case"LineString":return BC(r,n);case"Polygon":return TC(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return BC(n,r);case"LineString":return function(t,e){if(A_(t,e).features.length>0)for(var r=0;r<t.coordinates.length-1;r++)for(var n=0;n<e.coordinates.length-1;n++){var i=!0;if(0!==n&&n!==e.coordinates.length-2||(i=!1),PC(t.coordinates[r],t.coordinates[r+1],e.coordinates[n],i))return!0}return!1}(r,n);case"Polygon":return IC(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return TC(n,r);case"LineString":return IC(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}(kM.featureTo4326(t),kM.featureTo4326(e))}static lineIntersect(t,e){let r=kM.featureTo4326(t),n=kM.featureTo4326(e);return kM.to3857_featureList(A_(r,n))}static lineSplit(t,e){let r=kM.featureTo4326(t),n=kM.featureTo4326(e);return kM.to3857(T_(r,n))}static lineCrossesSplit(t,e,r){const n=Sm([]);if(e.length>=1){const i=[];e.forEach((t=>{const e=kM.featureTo4326(t),r=d_(e);r.features.length>0&&r.features.forEach((t=>{n.geometry.coordinates.push(t.geometry.coordinates)}));const o=jm(e);i.push(o)}));const o=d_(Em(i));o.features.length>0&&o.features.forEach((t=>{n.geometry.coordinates.push(t.geometry.coordinates)}));for(let t=0;t<e.length;t++){const i=kM.featureTo4326(e[t]),o=T_(i,n);o.features.length>0&&(e[t].set("classname","del"),o.features.forEach((t=>{r(t,i.properties)})))}t.removeFeatures("del")}}static lineErase(t,e,r,n,i){const o=CM(wm(e),r,{units:"kilometers"});n.forEach((e=>{const r=kM.featureTo4326(e);if(CC(o,r))t.removeFeature(e);else if(!_C(o,r)){Zm(o);const n=T_(r,o);n.features.length>0&&(t.removeFeature(e),n.features.forEach((t=>{if(!CC(o,t)){let r=e.getProperties();e.getGeometry()&&delete r[e.getGeometryName()],i(t,r)}})))}}))}static featureToJson(t){return(new nf).writeFeatureObject(t)}static featureTo4326(t){return(new nf).writeFeatureObject(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static featuresTo4326(t){return(new nf).writeFeaturesObject(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static getCenter(t){return zt(t instanceof W?t.getGeometry().getExtent():t.getExtent())}static to3857(t){return(new nf).readFeature(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static to3857_featureList(t){return(new nf).readFeatures(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static lineClipPolygon(t,e,r,n){e.forEach((e=>{try{const n=kM.geoUtil.polygonClipByLine(kM.featureTo4326(e),kM.featureTo4326(t));r(n)}catch(i){n(i)}}))}static formatJsonTo3857(t){let e;return e=t.crs?"EPSG:3857"===t.crs.properties.name?(new nf).readFeatures(t):"EPSG:4326"===t.crs.properties.name?(new nf).readFeatures(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"}):(new nf).readFeatures(t,{dataProjection:t.crs.properties.name,featureProjection:"EPSG:3857"}):(new nf).readFeatures(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"}),e}};let NM=kM;r(NM,"geoUtil",{unionPolygon:function(t){let e=t[0];for(let r=0;r<t.length;r++)e=TM(e,t[r]);return e},polygonClipByLine:function(t,e){if("Polygon"!==t.geometry.type){if("MultiPolygon"===t.geometry.type){const r=this.multiPolygon2polygons(t);let n=null,i=-1;if(r.forEach((function(t,r){if(2===A_(k_(t),e).features.length){if(n)throw new Error("MultiPolygon只能有一个多边形与切割线存在交点");n=t,i=r}})),-1!==i)return r.splice(i,1),Cm(r.concat(this.polygonClipByLine(n,e).features));throw new Error("MultiPolygon与切割线无交点")}throw new Error("输入的多边形类型为错误")}{const r=k_(t);if("LineString"===r.geometry.type)return this._singlePolygonClip(r,e);if("MultiLineString"===r.geometry.type)return this._multiPolygonClip(r,e)}},_singlePolygonClip:function(t,e){const r=A_(t,e);if(2!==r.features.length)throw new Error("切割线与多边形交点应该为2个,当前交点个数为"+r.features.length);const n=e.geometry.coordinates.length,i=wm(e.geometry.coordinates[0]),o=wm(e.geometry.coordinates[n-1]),s=bm([t.geometry.coordinates]);if(cv(i,s)||cv(o,s))throw new Error("切割线起点或终点不能在 裁剪多边形内部");const a=b_(r.features[0],r.features[1],t),l=b_(r.features[0],r.features[1],e),u=this.connectLine(a,l);u.geometry.coordinates.push(u.geometry.coordinates[0]);const h=U_(u),c=[];if(this.isOnLine(wm(t.geometry.coordinates[0]),a))for(let p=0;p<t.geometry.coordinates.length;p++){const e=t.geometry.coordinates[p];this.isOnLine(wm(e),a)||c.push(e)}else{let e=0,r=!1;for(let n=0;n<t.geometry.coordinates.length;n++){const i=t.geometry.coordinates[n];this.isOnLine(wm(i),a)?r=!0:r?c.push(i):e++}for(let n=0;n<e;n++)c.push(t.geometry.coordinates[n])}const A=xm(c),f=this.connectLine(A,l);return f.geometry.coordinates.push(f.geometry.coordinates[0]),Cm([h,U_(f)])},_multiPolygonClip:function(t,e){let r;const n=[];for(let o=0;o<t.geometry.coordinates.length;o++){const i=xm(t.geometry.coordinates[o]);if(cx(i)){if(r)throw new Error("出现了两个外部多边形无法处理");r=i}else{if(A_(i,e).features.length>0)throw new Error("切割线不能与内环有交点");n.push(i)}}const i=this._singlePolygonClip(r,e);for(let o=0;o<i.features.length;o++)for(let t=0;t<n.length;t++)cv(wm(n[t].geometry.coordinates[0]),i.features[o])&&(i.features[o]=MM(i.features[o],U_(n[t])));return i},connectLine:function(t,e){const r=e.geometry.coordinates.length,n=t.geometry.coordinates[0],i=e.geometry.coordinates[0],o=e.geometry.coordinates[r-1],s=[];for(let a=0;a<t.geometry.coordinates.length;a++){const e=t.geometry.coordinates[a];s.push(e)}fv(n,i)<fv(n,o)&&(e.geometry.coordinates=e.geometry.coordinates.reverse());for(let a=0;a<e.geometry.coordinates.length;a++){const t=e.geometry.coordinates[a];s.push(t)}return xm(s)},isOnLine:function(t,e){for(let r=0;r<e.geometry.coordinates.length;r++){const n=e.geometry.coordinates[r];if(t.geometry.coordinates[0]===n[0]&&t.geometry.coordinates[1]===n[1])return!0}return!1},getIntersectPoints:function(t,e){return A_(t,e)},multiPolygon2polygons:function(t){if("MultiPolygon"!==t.geometry.type)return;const e=[];return t.geometry.coordinates.forEach((t=>{const r={type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[]}};r.geometry.coordinates=t,e.push(r)})),e},polygons2MultiPolygon:function(t){const e={type:"FeatureCollection",features:[{geometry:{coordinates:[],type:"MultiPolygon"},type:"Feature",properties:{}}]};return t.features.forEach((t=>{"Polygon"===t.geometry.type?e.features[0].geometry.coordinates.push(t.geometry.coordinates):t.geometry.coordinates.forEach((t=>{e.features[0].geometry.coordinates.push(t)}))})),e}});const RM=class{static isArray(t){return Array.isArray?Array.isArray(t):"[object Array]"===RM.objToString.call(t)}static isFunction(t){return"function"==typeof t}static isString(t){return"string"==typeof t}static isStringSafe(t){return"[object String]"===RM.objToString.call(t)}static isNumber(t){return"number"==typeof t}static isObject(t){let e=typeof t;return"function"===e||!!t&&"object"===e}static isBuiltInObject(t){return!!RM.BUILTIN_OBJECT[RM.objToString.call(t)]}static isTypedArray(t){return!!RM.TYPED_ARRAY[RM.objToString.call(t)]}static isDom(t){return"object"==typeof t&&"number"==typeof t.nodeType&&"object"==typeof t.ownerDocument}static isGradientObject(t){return null!==t.colorStops}static isImagePatternObject(t){return null!==t.image}static isRegExp(t){return"[object RegExp]"===RM.objToString.call(t)}static isPrimitive(t){return t[RM.primitiveKey]}};let UM=RM;r(UM,"BUILTIN_OBJECT",{"[object Function]":!0,"[object RegExp]":!0,"[object Date]":!0,"[object Error]":!0,"[object CanvasGradient]":!0,"[object CanvasPattern]":!0,"[object Image]":!0,"[object Canvas]":!0}),r(UM,"TYPED_ARRAY",{"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}),r(UM,"primitiveKey","__ec_primitive__"),r(UM,"objToString",Object.prototype.toString);const DM=class{static merge(t,e,r){if(!UM.isObject(e)||!UM.isObject(t))return r?DM.clone(e):t;for(let n in e)if(e.hasOwnProperty(n)&&n!==DM.protoKey){let i=t[n],o=e[n];!UM.isObject(o)||!UM.isObject(i)||UM.isArray(o)||UM.isArray(i)||UM.isDom(o)||UM.isDom(i)||UM.isBuiltInObject(o)||UM.isBuiltInObject(i)||UM.isPrimitive(o)||UM.isPrimitive(i)?!r&&n in t||(t[n]=DM.clone(e[n])):DM.merge(i,o,r)}return t}static clone(t){if(null===t||"object"!=typeof t)return t;let e=t,r=UM.objToString.call(t);if("[object Array]"===r){if(!UM.isPrimitive(t)){e=[];for(let r=0,n=t.length;r<n;r++)e[r]=DM.clone(t[r])}}else if(UM.TYPED_ARRAY[r]){if(!UM.isPrimitive(t)){let r=t.constructor;if(r.from)e=r.from(t);else{e=new r(t.length);for(let r=0,n=t.length;r<n;r++)e[r]=DM.clone(t[r])}}}else if(!UM.BUILTIN_OBJECT[r]&&!UM.isPrimitive(t)&&!UM.isDom(t)){e={};for(let r in t)t.hasOwnProperty(r)&&r!==DM.protoKey&&(e[r]=DM.clone(t[r]))}return e}};let QM=DM;function GM(t){let e,r="";for(e in t)t[e]&&String(t[e])&&(r+=`&${e}=${t[e]}`);return r&&(r="?"+r.slice(1)),r}r(QM,"protoKey","__proto__");const jM=Object.freeze(Object.defineProperty({__proto__:null,SecondToHHMMSS:function(t){let e=parseInt(t),r=0,n=0;e>60&&(r=Math.floor(e/60),e=Math.floor(e%60),r>60&&(n=Math.floor(r/60),r=Math.floor(r%60)));let i=Math.floor(e)+"秒";return r>0&&(i=Math.floor(r)+"分"+i),n>0&&(i=Math.floor(n)+"小时"+i),i},ToDegree:function(t=0,e=0,r=0,n=6){return(t+e/60+r/3600).toFixed(n=n>6?6:n)},ToDegreeMinuteSecond:function(t){let e;if(e="number"==typeof t?String(t):t,void 0===e||""===e)return{degree:0,minute:0,second:0};let r=e.indexOf("."),n=r<0?e:e.substring(0,r),i="0",o="0";return r>0&&(i="0"+e.substring(r),i=60*parseFloat(i)+"",r=i.indexOf("."),r>0&&(o="0"+i.substring(r),i=i.substring(0,r),o=60*parseFloat(o)+"",r=o.indexOf("."),o=o.substring(0,r+4),o=parseFloat(o).toFixed(2))),{degree:parseInt(n),minute:parseInt(i),second:parseFloat(o)}},formatDistance:function(t){let e="";return e=t?t>=1e3?(t/1e3).toFixed(2)+"公里":t+"米":"0米",e},paramsToUrl:GM},Symbol.toStringTag,{value:"Module"}));function HM(t){return async function(t){return(await fetch(t,{method:"GET",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer"})).json()}(t)}const zM=Object.freeze(Object.defineProperty({__proto__:null,fetchJson:HM,format:jM,isutil:UM,json:QM},Symbol.toStringTag,{value:"Module"}));var VM=function(t){var e,r;t||(t={});var n=this.canvas_=document.createElement("canvas"),i=(Number(t.scale)>0?Number(t.scale):1)*at||at,o=n.getContext("2d");if(t.image){t.image.load();var s=t.image.getImage();if(s.width)n.width=Math.round(s.width*i),n.height=Math.round(s.height*i),o.globalAlpha="number"==typeof t.opacity?t.opacity:1,o.drawImage(s,0,0,s.width,s.height,0,0,n.width,n.height),e=o.createPattern(n,"repeat");else{var a=this;e=[0,0,0,0],s.onload=function(){n.width=Math.round(s.width*i),n.height=Math.round(s.height*i),o.globalAlpha="number"==typeof t.opacity?t.opacity:1,o.drawImage(s,0,0,s.width,s.height,0,0,n.width,n.height),e=o.createPattern(n,"repeat"),a.setColor(e)}}}else{var l=this.getPattern_(t);if(n.width=Math.round(l.width*i),n.height=Math.round(l.height*i),o.beginPath(),t.fill&&(o.fillStyle=jn(t.fill.getColor()),o.fillRect(0,0,n.width,n.height)),o.scale(i,i),o.lineCap="round",o.lineWidth=l.stroke||1,o.fillStyle=jn(t.color||"#000"),o.strokeStyle=jn(t.color||"#000"),l.circles)for(r=0;r<l.circles.length;r++){var u=l.circles[r];o.beginPath(),o.arc(u[0],u[1],u[2],0,2*Math.PI),l.fill&&o.fill(),l.stroke&&o.stroke()}if(l.repeat||(l.repeat=[[0,0]]),l.char&&(o.font=l.font||l.width+"px Arial",o.textAlign="center",o.textBaseline="middle",l.angle?(o.fillText(l.char,l.width/4,l.height/4),o.fillText(l.char,5*l.width/4,5*l.height/4),o.fillText(l.char,l.width/4,5*l.height/4),o.fillText(l.char,5*l.width/4,l.height/4),o.fillText(l.char,3*l.width/4,3*l.height/4),o.fillText(l.char,-l.width/4,-l.height/4),o.fillText(l.char,3*l.width/4,-l.height/4),o.fillText(l.char,-l.width/4,3*l.height/4)):o.fillText(l.char,l.width/2,l.height/2)),l.lines)for(r=0;r<l.lines.length;r++)for(var h=0;h<l.repeat.length;h++){var c=l.lines[r];o.beginPath(),o.moveTo(c[0]+l.repeat[h][0],c[1]+l.repeat[h][1]);for(var A=2;A<c.length;A+=2)o.lineTo(c[A]+l.repeat[h][0],c[A+1]+l.repeat[h][1]);l.fill&&o.fill(),l.stroke&&o.stroke(),o.save(),o.strokeStyle="red",o.strokeWidth=.1,o.restore()}if(e=o.createPattern(n,"repeat"),t.offset){var f=t.offset;if("number"==typeof f&&(f=[f,f]),f instanceof Array){var p=Math.round(f[0]*i),d=Math.round(f[1]*i);o.scale(1/i,1/i),o.clearRect(0,0,n.width,n.height),o.translate(p,d),o.fillStyle=e,o.fillRect(-p,-d,n.width,n.height),e=o.createPattern(n,"repeat")}}}t.color=e,kn.call(this,t)};cm(VM,kn),VM.prototype.clone=function(){var t=Tn.prototype.clone.call(this);return t.canvas_=this.canvas_,t},VM.prototype.getImage=function(){return this.canvas_},VM.prototype.getPattern_=function(t){var e,r=Am.prototype.patterns[t.pattern]||Am.prototype.patterns.dot,n=Math.round(t.spacing)||10;switch(t.pattern){case"dot":case"circle":e=0===t.size?0:t.size/2||2,t.angle?(n=r.width=r.height=Math.round(1.4*n),r.circles=[[n/4,n/4,e],[3*n/4,3*n/4,e]],"circle"==t.pattern&&(r.circles=r.circles.concat([[n/4+n,n/4,e],[n/4,n/4+n,e],[3*n/4-n,3*n/4,e],[3*n/4,3*n/4-n,e],[n/4+n,n/4+n,e],[3*n/4-n,3*n/4-n,e]]))):(r.width=r.height=n,r.circles=[[n/2,n/2,e]],"circle"==t.pattern&&(r.circles=r.circles.concat([[n/2+n,n/2,e],[n/2-n,n/2,e],[n/2,n/2+n,e],[n/2,n/2-n,e],[n/2+n,n/2+n,e],[n/2+n,n/2-n,e],[n/2-n,n/2+n,e],[n/2-n,n/2-n,e]])));break;case"tile":case"square":e=0===t.size?0:t.size/2||2,t.angle?(r.width=r.height=n,r.lines=[[n/2-e,n/2,n/2,n/2-e,n/2+e,n/2,n/2,n/2+e,n/2-e,n/2]]):(r.width=r.height=n,r.lines=[[n/2-e,n/2-e,n/2+e,n/2-e,n/2+e,n/2+e,n/2-e,n/2+e,n/2-e,n/2-e]]),"square"==t.pattern&&(r.repeat=[[0,0],[0,n],[n,0],[0,-n],[-n,0],[-n,-n],[n,n],[-n,n],[n,-n]]);break;case"cross":t.angle&&(t.angle=45);case"hatch":var i=Math.round(((t.angle||0)-90)%360);i>180&&(i-=360),i*=Math.PI/180;var o=Math.cos(i),s=Math.sin(i);if(Math.abs(s)<1e-4)r.width=r.height=n,r.lines=[[0,.5,n,.5]],r.repeat=[[0,0],[0,n]];else if(Math.abs(o)<1e-4)r.width=r.height=n,r.lines=[[.5,0,.5,n]],r.repeat=[[0,0],[n,0]],"cross"==t.pattern&&(r.lines.push([0,.5,n,.5]),r.repeat.push([0,n]));else{var a=r.width=Math.round(Math.abs(n/s))||1,l=r.height=Math.round(Math.abs(n/o))||1;"cross"==t.pattern?(r.lines=[[-a,-l,2*a,2*l],[2*a,-l,-a,2*l]],r.repeat=[[0,0]]):o*s>0?(r.lines=[[-a,-l,2*a,2*l]],r.repeat=[[0,0],[a,0],[0,l]]):(r.lines=[[2*a,-l,-a,2*l]],r.repeat=[[0,0],[-a,0],[0,l]])}r.stroke=0===t.size?0:t.size||4}return r};class KM{constructor(){r(this,"data"),r(this,"pi"),r(this,"x_pi"),r(this,"a"),r(this,"ee"),_y(),wy(kd),this.data=[],this.data.push({dh:13,wkid:4502}),this.data.push({dh:14,wkid:4503}),this.data.push({dh:15,wkid:4504}),this.data.push({dh:16,wkid:4505}),this.data.push({dh:17,wkid:4506}),this.data.push({dh:18,wkid:4507}),this.data.push({dh:19,wkid:4508}),this.data.push({dh:20,wkid:4509}),this.data.push({dh:21,wkid:4510}),this.data.push({dh:22,wkid:4511}),this.data.push({dh:23,wkid:4512}),this.data.push({dh:75,wkid:4534}),this.data.push({dh:78,wkid:4535}),this.data.push({dh:81,wkid:4536}),this.data.push({dh:84,wkid:4537}),this.data.push({dh:87,wkid:4538}),this.data.push({dh:90,wkid:4539}),this.data.push({dh:93,wkid:4540}),this.data.push({dh:96,wkid:4541}),this.data.push({dh:99,wkid:4542}),this.data.push({dh:102,wkid:4543}),this.data.push({dh:105,wkid:4544}),this.data.push({dh:108,wkid:4545}),this.data.push({dh:111,wkid:4546}),this.data.push({dh:114,wkid:4547}),this.data.push({dh:117,wkid:4548}),this.data.push({dh:120,wkid:4549}),this.data.push({dh:123,wkid:4550}),this.data.push({dh:126,wkid:4551}),this.data.push({dh:129,wkid:4552}),this.data.push({dh:132,wkid:4553}),this.data.push({dh:135,wkid:4554}),this.pi=3.141592653589793,this.x_pi=52.35987755982988,this.a=6378245,this.ee=.006693421622965943}ConvertToMapCoord(t,e){return{Coord3857:this.ConvertCoordinatesTo3857(t,e),Coord4326:this.ConvertCoordinatesTo4326(t,e)}}ConvertCoordinatesTo3857(t,e){return-1===t.toUpperCase().indexOf("EPSG:")&&(t="EPSG:"+t),kd(t,"EPSG:3857",e)}ConvertCoordinatesTo4326(t,e){return-1===t.toUpperCase().indexOf("EPSG:")&&(t="EPSG:"+t),kd(t,"EPSG:4326",e)}formatJsonTo3857(t){let e;return e="EPSG:3857"===t.crs.properties.name?(new nf).readFeatures(t):"EPSG:4326"===t.crs.properties.name?(new nf).readFeatures(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"}):(new nf).readFeatures(t,{dataProjection:t.crs.properties.name,featureProjection:"EPSG:3857"}),e}formatJsonTo4326Json(t){let e,r=new nf;return e="EPSG:4326"===t.crs.properties.name?r.readFeatures(t):"EPSG:3857"===t.crs.properties.name?r.readFeatures(t,{dataProjection:"EPSG:3857",featureProjection:"EPSG:4326"}):r.readFeatures(t,{dataProjection:t.crs.properties.name,featureProjection:"EPSG:4326"}),r.writeFeaturesObject(e)}formatJsonToPoint(t){let e=this.formatJsonTo3857(t),r=[];return e.forEach((t=>{switch(t.getGeometry().getType()){case"Polygon":r.push(new W({geometry:t.getGeometry().getInteriorPoint(),properties:t.getProperties().properties}));break;case"Point":r.push(t)}})),r}LnglatToCGCS2000(t,e,r=3){let n,i;return n=3===r?3*parseInt(((t+1.5)/3).toString()):6*parseInt(((t+6)/6).toString())-3,this.data.forEach((t=>{t.dh!==n||(i=t.wkid)})),i?kd("EPSG:4326","EPSG:"+i,[t,e]):[0,0]}ConvertWebMercatorToCGCS2000(t,e,r=3){let n=ur([t,e]);return this.LnglatToCGCS2000(n[0],n[1],r)}webMktToLngLat(t){return ur(t)}lngLatToWebMkt(t){return lr(t)}transformLat(t,e){let r=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.pi)+20*Math.sin(2*t*this.pi))/3,r+=2*(20*Math.sin(e*this.pi)+40*Math.sin(e/3*this.pi))/3,r+=2*(160*Math.sin(e/12*this.pi)+320*Math.sin(e*this.pi/30))/3,r}transformLon(t,e){let r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.pi)+20*Math.sin(2*t*this.pi))/3,r+=2*(20*Math.sin(t*this.pi)+40*Math.sin(t/3*this.pi))/3,r+=2*(150*Math.sin(t/12*this.pi)+300*Math.sin(t/30*this.pi))/3,r}transform(t,e){if(this.outOfChina(t,e))return[t,e];let r=this.transformLat(e-105,t-35),n=this.transformLon(e-105,t-35),i=t/180*this.pi,o=Math.sin(i);o=1-this.ee*o*o;let s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.pi),n=180*n/(this.a/s*Math.cos(i)*this.pi),[t+r,e+n]}outOfChina(t,e){return e<72.004||e>137.8347||t<.8293||t>55.8271}wgs84ToGcj02(t,e){if(this.outOfChina(t,e))return{lat:t,lon:e};let r=this.transformLat(e-105,t-35),n=this.transformLon(e-105,t-35),i=t/180*this.pi,o=Math.sin(i);o=1-this.ee*o*o;let s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.pi),n=180*n/(this.a/s*Math.cos(i)*this.pi),{mgLat:t+r,mgLon:e+n}}gcj02ToWgs84(t,e){let r=this.transform(t,e),n=2*e-r[1];return{latitude:2*t-r[0],lontitude:n}}gcj02ToBd09(t,e){let r=e,n=t,i=Math.sqrt(r*r+n*n)+2e-5*Math.sin(n*this.x_pi),o=Math.atan2(n,r)+3e-6*Math.cos(r*this.x_pi),s=i*Math.cos(o)+.0065;return{tempLat:i*Math.sin(o)+.006,tempLon:s}}bd09ToGcj02(t,e){let r=e-.0065,n=t-.006,i=Math.sqrt(r*r+n*n)-2e-5*Math.sin(n*this.x_pi),o=Math.atan2(n,r)-3e-6*Math.cos(r*this.x_pi),s=i*Math.cos(o);return{tempLat:i*Math.sin(o),tempLon:s}}wgs84ToBd09(t,e){let r=this.wgs84ToGcj02(t,e);return this.gcj02ToBd09(r[0],r[1])}bd09_To_gps84(t,e){let r=this.bd09ToGcj02(t,e),n=this.gcj02ToWgs84(r[0],r[1]);return n[0]=n[0].toFixed(6),n[1]=n[1].toFixed(6),n}}class qM extends W{constructor(t){super(),r(this,"option"),r(this,"Proj"),this.option={graphicType:"baseGraphic",lnglat:[0,0],dataWkID:Yy.EPSG3857,tooltipOption:{offset:[0,0]},popupOption:{offset:[0,0]},style:{text:{font:"14px Microsoft YaHei",text:"",fill:{color:"#8B4513"},stroke:{color:"rgba(255, 255, 255,1)",width:2},backgroundFill:{color:"rgba(255, 255, 255, 0.0)"},backgroundStroke:{color:"rgba(0, 0, 0, 0.0)",width:2},padding:[3,3,3,3],offsetX:0,offsetY:-10,textBaseline:"bottom"},image:{scale:1,radius:5,fill:{color:"rgba(255, 0, 0,1)"},stroke:{color:"rgba(255, 255, 0,1)",width:1}},stroke:{color:"rgba(255, 255, 0,1)",width:2,lineDash:null,pattern:void 0,image:void 0,ratio:1,patternColor:"rgba(0, 0, 0,1)",offset:0,scale:1,size:5,spacing:10,angle:0},fill:{patternColor:"rgba(0, 0, 0,1)",color:"rgba(255, 255, 255,0.2)",pattern:void 0,image:void 0,ratio:1,offset:0,scale:1,size:5,spacing:10,angle:0},imageOption:{},zIndex:999,radius:0,startAngle:0,stopAngle:0,rotation:0},attribute:null},this.option=QM.merge(this.option,t,!0),this.Proj=new KM,this.setStyle(new Gi({zIndex:this.option.style.zIndex}))}setAttribute(t){let e=QM.merge(this.getProperties(),t,!0);this.setProperties(e)}toGeoJSON(){return(new nf).writeGeometryObject(this.getGeometry(),{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}bindPopup(t,e={offset:[0,0]}){this.option.popupInfo=t,this.option.popupOption=e}bindTooltip(t,e={offset:[0,0]}){this.option.tooltipInfo=t,this.option.tooltipOption=e}isPopupBind(){return!!this.option.popupInfo}isTooltipBind(){return!!this.option.tooltipInfo}openPopup(t,e){t&&(this.option.popupInfo=t),e&&(this.option.popupOption=e),this.dispatchEvent({type:"graphicPopopOpen",data:this.option.popupInfo,option:this.option.popupOption})}closePopup(){this.dispatchEvent({type:"graphicPopopClose",data:this.option.popupInfo})}openTooltip(t,e){t&&(this.option.tooltipInfo=t),e&&(this.option.tooltipOption=e),this.dispatchEvent({type:"graphicTooltipOpen",data:this.option.tooltipInfo,option:this.option.tooltipOption})}chaikin_copy(t,e){return t[0]=e[0],t[1]=e[1],t}chaikin_smooth_line(t,e=[]){Array.isArray(e)||(e=[]),t.length>0&&e.push(this.chaikin_copy([0,0],t[0]));for(let r=0;r<t.length-1;r++){let n=t[r],i=t[r+1],o=n[0],s=n[1],a=i[0],l=i[1],u=[.75*o+.25*a,.75*s+.25*l],h=[.25*o+.75*a,.25*s+.75*l];e.push(u),e.push(h)}return t.length>1&&e.push(this.chaikin_copy([0,0],t[t.length-1])),e}chaikin_smooth_polygon(t,e=[]){Array.isArray(e)||(e=[]);for(let r=0;r<t.length-1;r++){let n=t[r],i=t[r+1],o=n[0],s=n[1],a=i[0],l=i[1],u=[.75*o+.25*a,.75*s+.25*l],h=[.25*o+.75*a,.25*s+.75*l];e.push(u),e.push(h)}return e.push(e[0]),e}smoothFunc(t,e=5,r=!0){let n=Math.min(Math.max(e||5,1),10);for(;n>0;)t=r?this.chaikin_smooth_line(t):this.chaikin_smooth_polygon(t),n--;return t}setSmooth(t=5,e=!0){if(e){let r=this.getGeometry(),n=r.getCoordinates();r.setCoordinates(this.smoothFunc(n,t,e))}else{let r=this.getGeometry(),n=r.getCoordinates()[0];r.setCoordinates([this.smoothFunc(n,t,e)])}}setTextStyle(t){var e;t=QM.merge(this.option.style.text,t,!0);let r=new zi({text:t.text,font:t.font,fill:new Tn({color:t.fill.color}),stroke:new kn({color:t.stroke.color,width:t.stroke.width}),backgroundFill:new Tn({color:t.backgroundFill.color}),backgroundStroke:new kn({color:t.backgroundStroke.color,width:t.backgroundStroke.width}),padding:t.padding,textBaseline:t.textBaseline,offsetX:t.offsetX,offsetY:t.offsetY});null==(e=this.getStyle())||e.setText(r),this.option.style.text=t}setTrianglePointStyle(t){var e;t=QM.merge(this.option.style.image,t,!0);let r=new Mi({scale:t.scale,radius:t.radius,points:3,angle:Math.PI,displacement:[0,10],fill:new Tn({color:t.fill.color}),stroke:new kn({color:t.stroke.color,width:t.stroke.width})});null==(e=this.getStyle())||e.setImage(r),this.option.style.image=t}setCirclePointStyle(t){var e;t=QM.merge(this.option.style.image,t,!0);let r=new ki({scale:t.scale,radius:t.radius,fill:new Tn({color:t.fill.color}),stroke:new kn({color:t.stroke.color,width:t.stroke.width})});null==(e=this.getStyle())||e.setImage(r),this.option.style.image=t}setStrokeSimpleStyle(t){t=QM.merge(this.option.style.stroke,t,!0);let e=new kn({color:t.color,width:t.width,lineDash:t.lineDash});this.getStyle().setStroke(e),this.option.style.stroke=t}setStrokePatternStyle(t){t=QM.merge(this.option.style.stroke,t,!0);let e=new VM({pattern:t.pattern,image:t.image?new ms({src:t.image}):void 0,ratio:t.ratio,color:t.patternColor,offset:t.offset,scale:t.scale,fill:new Tn({color:t.color}),size:t.size,spacing:t.spacing,angle:t.angle,width:t.width,lineDash:t.lineDash});this.getStyle().setStroke(e),this.option.style.stroke=t}setFillColor(t){var e;null==(e=this.getStyle())||e.setFill(new Tn({color:t})),this.option.style.fill.color=t}setFillPatternStyle(t){t=QM.merge(this.option.style.fill,t,!0);let e=new Am({pattern:t.pattern,image:void 0,ratio:t.ratio,color:t.patternColor,offset:t.offset,scale:t.scale,size:t.size,spacing:t.spacing,angle:t.angle,fill:new Tn({color:t.color})});this.getStyle().setFill(e),this.option.style.fill=t}setFillImageStyle(t){this.option.style.fill.image=t;const e=document.createElement("canvas").getContext("2d"),r=new Image;r.src=t,r.onload=()=>{this.getStyle().setFill(new Tn({color:e.createPattern(r,"repeat")}))}}setZIndex(t){this.option.style.zIndex=t,this.getStyle().setZIndex(t)}getCoordinates(t="3857"){let e=this.getGeometry().clone();return"4326"===t&&e.transform("EPSG:3857","EPSG:4326"),e.getCoordinates()}getGraphicJson(t="3857"){let e=this.getProperties();return this.getGeometry()&&delete e[this.getGeometryName()],{type:this.option.graphicType,lnglat:this.getCoordinates(t),dataWkID:t,style:this.option.style,attribute:e}}}class WM extends qM{constructor(t){let e;if(super(t),this.option.graphicType="PointGraphic",this.option=QM.merge(this.option,t,!0),0!==this.option.lnglat[0])switch(this.option.dataWkID){case Yy.EPSG4326:this.setGeometry(new rn(lr(this.option.lnglat)));break;case Yy.EPSG3857:this.setGeometry(new rn(this.option.lnglat));break;case Yy.BAIDU:e=this.Proj.bd09_To_gps84(this.option.lnglat[0],this.option.lnglat[1]),this.setGeometry(new rn([e.lontitude,e.latitude]));break;case Yy.GCJ02:e=this.Proj.gcj02ToWgs84(this.option.lnglat[0],this.option.lnglat[1]),this.setGeometry(new rn([e.lontitude,e.latitude]));break;case Yy.CGCS2000_GK_CM_6:break;default:this.setGeometry(new rn(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,this.option.lnglat)))}this.option.attribute&&this.setProperties(this.option.attribute),this.setTextStyle(this.option.style.text),this.option.style.image.scale>0&&this.setCirclePointStyle(this.option.style.image)}setCoordinates(t,e,r=Yy.EPSG4326){let n=this.getGeometry();this.option.dataWkID===Yy.EPSG4326?n.setCoordinates(lr([t,e])):this.option.dataWkID===Yy.EPSG3857?n.setCoordinates([t,e]):n.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}}class XM extends qM{constructor(t){let e;if(super(t),this.option.graphicType="ImagePointGraphic",0!==this.option.lnglat[0])switch(this.option.dataWkID){case Yy.EPSG4326:this.setGeometry(new rn(lr(t.lnglat)));break;case Yy.EPSG3857:this.setGeometry(new rn(t.lnglat));break;case Yy.BAIDU:e=this.Proj.bd09_To_gps84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new rn([e.lontitude,e.latitude]));break;case Yy.GCJ02:e=this.Proj.gcj02ToWgs84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new rn([e.lontitude,e.latitude]));break;default:this.setGeometry(new rn(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,t.lnglat)))}if(this.option.attribute&&this.setProperties(this.option.attribute),"gif"===this.option.style.imageOption.type){const t=gifler(this.option.style.imageOption.src);let e=document.createElement("canvas");t.frames(e,((t,e)=>{this.getStyle()||this.setStyle(new Gi({image:new ms({img:t.canvas,imgSize:[e.width,e.height],opacity:.8})})),t.clearRect(0,0,e.width,e.height),t.drawImage(e.buffer,e.x,e.y),this.option.style.imageOption.maprender()}),!0)}else this.setTextStyle(this.option.style.text),this.setPointIconStyle(this.option.style.imageOption)}setPointIconStyle(t){this.option.style.imageOption=t;let e=new ms(this.option.style.imageOption);e.load(),this.getStyle().setImage(e)}setCoordinates(t,e,r=Yy.EPSG4326){let n=this.getGeometry();this.option.dataWkID===Yy.EPSG4326?n.setCoordinates(lr([t,e])):this.option.dataWkID===Yy.EPSG3857?n.setCoordinates([t,e]):n.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}setRotation(t){this.getStyle().getImage().setRotation(t),this.changed()}}class YM extends qM{constructor(t){super(t),this.option.graphicType="LineGraphic",0!==this.option.lnglat[0]&&this.setCoordinates(this.option.lnglat,this.option.dataWkID),this.option.attribute&&this.setProperties(this.option.attribute),this.option.style.stroke.image||this.option.style.stroke.pattern?this.setStrokePatternStyle(this.option.style.stroke):this.setStrokeSimpleStyle(this.option.style.stroke)}getGraphicJson(t="3857"){let e;e=this.option.style.stroke.image||this.option.style.stroke.pattern?{pattern:this.option.style.stroke.pattern,image:this.option.style.stroke.image,ratio:this.option.style.stroke.ratio,patternColor:this.option.style.stroke.patternColor,offset:this.option.style.stroke.offset,scale:this.option.style.stroke.scale,color:this.option.style.stroke.color,size:this.option.style.stroke.size,spacing:this.option.style.stroke.spacing,angle:this.option.style.stroke.angle,width:this.option.style.stroke.width,lineDash:this.option.style.stroke.lineDash}:{color:this.option.style.stroke.color,width:this.option.style.stroke.width,lineDash:this.option.style.stroke.lineDash};let r=this.getProperties();return this.getGeometry()&&delete r[this.getGeometryName()],{type:"LineGraphic",lnglat:this.getCoordinates(t),dataWkID:t,style:{stroke:e,text:this.option.style.text},attribute:r}}setCoordinates(t,e="4326"){switch(this.option.lnglat=t,this.option.dataWkID=e,e){case Yy.EPSG4326:this.setGeometry(new On(this.option.lnglat).transform("EPSG:4326","EPSG:3857"));break;case Yy.EPSG3857:this.setGeometry(new On(this.option.lnglat));break;case Yy.BAIDU:this.option.lnglat.forEach(((t,e)=>{let r=this.Proj.bd09_To_gps84(t[0],t[1]);this.option.lnglat[e]=[r.lontitude,r.latitude]})),this.setGeometry(new On(this.option.lnglat));break;case Yy.GCJ02:this.option.lnglat.forEach(((t,e)=>{let r=this.Proj.gcj02ToWgs84(t[0],t[1]);this.option.lnglat[e]=[r.lontitude,r.latitude]})),this.setGeometry(new On(this.option.lnglat));break;default:this.option.lnglat.forEach(((t,e)=>{this.option.lnglat[e]=this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,t)})),this.setGeometry(new On(this.option.lnglat))}}lineStyle(){let t=[];for(let e=0;e<10;e++)t.push(new Gi({stroke:new kn({color:[0,255,255,1/(10-e)],width:2*(10-e)-1}),fill:new Tn({color:"rgba(0, 0, 255, 0.05)"})}));return t}}class ZM extends qM{constructor(t){if(super(t),this.option.graphicType="PolygonGraphic",0!==this.option.lnglat[0])switch(this.option.dataWkID){case Yy.EPSG4326:this.setGeometry(new wn(this.option.lnglat).transform("EPSG:4326","EPSG:3857"));break;case Yy.EPSG3857:this.setGeometry(new wn(this.option.lnglat));break;case Yy.BAIDU:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.bd09_To_gps84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new wn(this.option.lnglat));break;case Yy.GCJ02:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.gcj02ToWgs84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new wn(this.option.lnglat));break;default:this.option.lnglat.forEach((t=>{t.forEach(((e,r)=>{t[r]=this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,e)}))})),this.setGeometry(new wn(this.option.lnglat))}this.option.attribute&&this.setProperties(this.option.attribute),this.setPolygonStyle(this.option.style)}setPolygonStyle(t){t.stroke.pattern?this.setStrokePatternStyle(t.stroke):this.setStrokeSimpleStyle(t.stroke),t.fill.pattern?this.setFillPatternStyle(t.fill):t.fill.image?this.setFillImageStyle(t.fill.image):this.setFillColor(t.fill.color),this.setTextStyle(t.text)}setCoordinates(t,e=Yy.EPSG4326){switch(this.option.lnglat=t,this.option.dataWkID=e,this.option.dataWkID){case Yy.EPSG4326:this.setGeometry(new wn(this.option.lnglat).transform("EPSG:4326","EPSG:3857"));break;case Yy.EPSG3857:this.setGeometry(new wn(this.option.lnglat));break;case Yy.BAIDU:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.bd09_To_gps84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new wn(this.option.lnglat));break;case Yy.GCJ02:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.gcj02ToWgs84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new wn(this.option.lnglat));break;default:this.option.lnglat.forEach((t=>{t.forEach(((e,r)=>{t[r]=this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,e)}))})),this.setGeometry(new wn(this.option.lnglat))}}setGeometryFromExtent(t){this.setGeometry(bn(t))}}const JM=Object.freeze(Object.defineProperty({__proto__:null,CurveGraphic:class extends qM{constructor(t){super(t),this.option.graphicType="CurveGraphic",0!==this.option.lnglat[0]&&this.setCoordinates(this.option.lnglat,this.option.dataWkID),this.option.attribute&&this.setProperties(this.option.attribute),this.setStrokeSimpleStyle(this.option.style.stroke),this.setFillColor(this.option.style.fill.color),this.setTextStyle(this.option.style.text)}setAngle(t,e){this.option.dataWkID===Yy.EPSG4326?this.setGeometry(this.createRegularPolygonCurve(this.option.lnglat,this.option.style.radius,t,e,this.option.style.rotation)):this.option.dataWkID===Yy.EPSG3857?this.setGeometry(this.createRegularPolygonCurve(ur(this.option.lnglat),this.option.style.radius,t,e,this.option.style.rotation)):this.setGeometry(this.createRegularPolygonCurve(this.Proj.ConvertCoordinatesTo4326(this.option.dataWkID,this.option.lnglat),this.option.style.radius,t,e,this.option.style.rotation))}setCoordinates(t,e="4326"){switch(this.option.lnglat=t,this.option.dataWkID=e,this.option.dataWkID){case Yy.EPSG4326:this.setGeometry(this.createRegularPolygonCurve(this.option.lnglat,this.option.style.radius,this.option.style.startAngle,this.option.style.stopAngle,this.option.style.rotation));break;case Yy.EPSG3857:this.setGeometry(this.createRegularPolygonCurve(ur(this.option.lnglat),this.option.style.radius,this.option.style.startAngle,this.option.style.stopAngle,this.option.style.rotation));break;case Yy.BAIDU:case Yy.GCJ02:break;default:this.setGeometry(this.createRegularPolygonCurve(this.Proj.ConvertCoordinatesTo4326(this.option.dataWkID,this.option.lnglat),this.option.style.radius,this.option.style.startAngle,this.option.style.stopAngle,this.option.style.rotation))}}createRegularPolygonCurve(t,e,r,n,i){let o=NM.sector(t,e,r,n).getGeometry();return o.rotate(i,lr(t)),o}},DivGraphic:class extends fl{constructor(t){let e,n=fm.uuid15(),i=document.createElement("div");if(i.setAttribute("id",n),super({id:n,element:i}),r(this,"option"),r(this,"Proj"),r(this,"handlers"),r(this,"elementDiv"),this.handlers={},this.elementDiv=i,this.option={html:"<div></div>",positioning:om.bottomleft,hashMove:!1,enabledRightMenu:!0,enabledPopup:!1,enabledTooltip:!1,contextmenu:[{text:"开始编辑对象",icon:"img/marker.png",callback:t=>{"开始编辑对象"===this.option.contextmenu[0].text?(this.option.contextmenu[0].text="停止编辑对象",this.startEdit()):(this.option.contextmenu[0].text="开始编辑对象",this.endEdit())}},{text:"删除对象",icon:"img/marker.png",callback:t=>{this.remove()}}],attribute:{}},this.option=QM.merge(this.option,t,!0),this.Proj=new KM,this.elementDiv.innerHTML=this.option.html,this.setPositioning(this.option.positioning),0!==this.option.coordinate[0])switch(this.option.dataWkID){case Yy.EPSG4326:this.setPosition(lr(this.option.coordinate));break;case Yy.EPSG3857:this.setPosition(this.option.coordinate);break;case Yy.BAIDU:e=this.Proj.bd09_To_gps84(this.option.coordinate[0],this.option.coordinate[1]),this.setPosition([e.lontitude,e.latitude]);break;case Yy.GCJ02:e=this.Proj.gcj02ToWgs84(this.option.coordinate[0],this.option.coordinate[1]),this.setPosition([e.lontitude,e.latitude]);break;case Yy.CGCS2000_GK_CM_6:break;default:this.setPosition(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,this.option.coordinate))}this._bindPoupEvent(),this.on(jy.onFeatureContextmenu,(t=>{this._setFeatureContextmenu(t.data.contextmenu)})),this.element.addEventListener("mousedown",(t=>{this.option.hashMove?(this.set("isDragging",!0),this.set("dragStart",[t.x,t.y])):(0===t.button&&this.option.enabledPopup&&this.openPopup(),this.trigger(jy.onClick,t))}));let o=!1;this.element.addEventListener("mousemove",(t=>{o||this.option.enabledTooltip&&(this.showTooltip(),o=!0)})),this.element.addEventListener("mouseout",(t=>{o=!1,this.option.enabledTooltip&&this.closeTooltip()})),this.on("change:element",(t=>{})),this.on("change:position",(t=>{this.trigger(jy.onChangePosition,{oldVal:t.oldValue,newVal:t.target.getPosition()})})),this.on("change:map",(t=>{void 0===t.oldValue&&(this.getMap().on("pointermove",(t=>{if(this.option.hashMove&&this.get("isDragging")){let e=this.get("dragStart"),r=this.getMap().getCoordinateFromPixel(e),n=t.coordinate,i=r[0]-n[0],o=r[1]-n[1],s=[this.getPosition()[0]-i,this.getPosition()[1]-o];this.setPosition(s),this.set("dragStart",t.pixel)}})),this.getMap().getViewport().addEventListener("mouseup",(t=>{this.option.hashMove&&this.set("isDragging",!1)})))}))}_setFeatureContextmenu(t){this.option.enabledRightMenu&&(t.clear(),this.option.contextmenu.length>0&&t.extend(this.option.contextmenu))}show(){this.element.classList.remove("mirage-hide")}hide(){this.element.classList.add("mirage-hide")}startEdit(){this.element.classList.add("mirage-edit-marker-selected"),this.option.hashMove=!0,this.trigger(jy.onEditStart,{})}endEdit(){this.element.classList.remove("mirage-edit-marker-selected"),this.option.hashMove=!1,this.set("isDragging",!1),this.trigger(jy.onEditEnd,{})}remove(){this.trigger(jy.onFeatureDeleted,{}),this.getMap().removeOverlay(this)}setCoordinates(t,e,r=Yy.EPSG4326){this.option.coordinate=[t,e],this.option.dataWkID===Yy.EPSG4326?this.setPosition(lr([t,e])):this.option.dataWkID===Yy.EPSG3857?this.setPosition([t,e]):this.setPosition(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}unbindContextmenu(){this.option.enabledRightMenu=!1}appendContextmenu(t){t.forEach((t=>{this.option.contextmenu.push(t)}))}bindPopup(t,e={offset:[0,0]}){this.option.enabledPopup=!0,this.option.popupInfo=t,this.option.popupOption=e}unbindPopup(){this.option.enabledPopup=!1,this.closePopup()}openPopup(){if(this.option.enabledPopup&&this.option.popupInfo){let t="";if("string"==typeof this.option.popupInfo?t=this.option.popupInfo:this.option.popupInfo.forEach((e=>{e.dataType===this.option.attribute.dataType&&e.showContent.forEach((e=>{e.type?t+=e.html:t+=e.name+":"+this.option.attribute[e.field]+"<br>"}))})),""!==t){let e=this.getPosition(),r=document.getElementById("popup-content");r&&(r.innerHTML=t),this.getMap().getOverlayById("popup").setPosition(e),this.getMap().getOverlayById("popup").setOffset(this.option.popupOption.offset),this.trigger(jy.onFeaturePopupOpen,{element:document.getElementById("popup-content"),data:this.option.attribute})}}}closePopup(t){this.getMap().getOverlayById("popup").setPosition(void 0),this.trigger(jy.onFeaturePopupClose,{element:document.getElementById("popup-content"),data:t})}_bindPoupEvent(){let t=document.getElementById("popup-closer");t&&(t.onclick=()=>{this.closePopup()})}bindTooltip(t,e={offset:[0,0]}){this.option.enabledTooltip=!0,this.option.tooltipInfo=t,this.option.tooltipOption=e}unbindTooltip(){this.option.enabledTooltip=!1,this.closeTooltip()}showTooltip(){if(this.option.enabledTooltip&&this.option.tooltipInfo){let t="";if("string"==typeof this.option.tooltipInfo?t=this.option.tooltipInfo:this.option.tooltipInfo.forEach((e=>{e.dataType===this.option.attribute.dataType&&e.showContent.forEach((e=>{e.type?t+=e.html:t+=e.name+":"+this.option.attribute[e.field]+"<br>"}))})),""!==t){let e=this.getPosition(),r=document.getElementById("tooltip-content");r&&(r.innerHTML=t),this.getMap().getOverlayById("tooltip").setPosition(e),this.getMap().getOverlayById("tooltip").setOffset(this.option.tooltipOption.offset),this.trigger(jy.onFeatureTooltipOpen,{element:document.getElementById("tooltip-content"),data:this.option.attribute})}}}closeTooltip(){this.getMap().getOverlayById("tooltip").setPosition(void 0),this.trigger(jy.onFeatureTooltiClose,{element:document.getElementById("tooltip-content"),data:""})}_on(t,e){return this.handlers[t]||(this.handlers[t]=[]),this.handlers[t].push(e),this}off(t,e){let r=this.handlers[t];for(let n=0;n<r.length;n++)if(r[n]===e){r.splice(n,1);break}return this}onec(t,e,r){let n=this;return this._on(t,(function i(){n.off(t,i),e.apply(r||n,arguments)})),this}trigger(t,e){this.handlers.hasOwnProperty(t)&&this.handlers[t].forEach((t=>{t.call(this,e)}))}},ImagePointGraphic:XM,LabelGraphic:class extends qM{constructor(t){let e;if(super(t),this.option.graphicType="LabelGraphic",0!==this.option.lnglat[0])switch(this.option.dataWkID){case Yy.EPSG4326:this.setGeometry(new rn(lr(t.lnglat)));break;case Yy.EPSG3857:this.setGeometry(new rn(t.lnglat));break;case Yy.BAIDU:e=this.Proj.bd09_To_gps84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new rn([e.lontitude,e.latitude]));break;case Yy.GCJ02:e=this.Proj.gcj02ToWgs84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new rn([e.lontitude,e.latitude]));break;default:this.setGeometry(new rn(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,t.lnglat)))}this.option.attribute&&this.setProperties(this.option.attribute),this.setStyle(new Gi({zIndex:this.option.style.zIndex})),this.setTextStyle(this.option.style.text),this.option.style.image.scale>0&&this.setTrianglePointStyle(this.option.style.image)}setCoordinates(t,e,r=Yy.EPSG4326){let n=this.getGeometry();this.option.dataWkID===Yy.EPSG4326?n.setCoordinates(lr([t,e])):this.option.dataWkID===Yy.EPSG3857?n.setCoordinates([t,e]):n.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}},LineGraphic:YM,PointGraphic:WM,PolygonGraphic:ZM},Symbol.toStringTag,{value:"Module"}));class $M extends Ky{constructor(t,e){super(t,e),r(this,"_graphicLayerSelect"),r(this,"selectFeature"),r(this,"_modify"),r(this,"_translate"),r(this,"_snap"),r(this,"_source"),r(this,"_draw"),r(this,"_tipPoint");let n={autoPointSize:!1,enabledRightMenu:!1,enabledPopup:!1,enabledTooltip:!1,imageRatio:5,zIndex:500,contextmenu:[{classname:"menudisabled",text:"操作",icon:"img/marker.png",items:[{text:"移动",icon:"img/marker.png",callback:t=>{this.startMove()}},{classname:"menudisabled",text:"编辑",icon:"img/marker.png",callback:t=>{this.startEdit()}},{text:"删除",icon:"img/marker.png",callback:t=>{this._source.removeFeature(this.selectFeature)}}]},{text:"保存为kml",icon:"img/marker.png",callback:t=>{fm.saveTokml(NM.featureTo4326(this.selectFeature),"文件.kml")}}],hashEdit:!1,hashMove:!1,hashSelect:!0,declutter:!1};this.option=Object.assign({},n,this.option),this._source=new Ks({wrapX:!1}),this._source.on("featuresloadstart",(t=>{this.trigger(jy.onLoadStart,t)})),this._source.on("featuresloadend",(t=>{this.trigger(jy.onFeaturesLoad,t)})),this._source.on("featuresloaderror",(t=>{this.trigger(jy.onLoadError,t)})),this._source.on("removefeature",(t=>{t.feature&&this.trigger(jy.onFeatureDeleted,t.feature.getProperties())})),this._source.on("addfeature",(t=>{t.feature&&(t.feature.on("mousemove",(t=>{t.target.get("editstate")||("function"==typeof t.target.isTooltipBind&&t.target.isTooltipBind()?t.target.openTooltip():(this.showTooltip(t.target),this.trigger(jy.onFeatureMousemove,{data:t.target})))})),t.feature.on("mouseout",(t=>{this.closeTooltip(),this.trigger(jy.onFeatureMouseout,{data:t.target})})),t.feature.on("graphicPopopOpen",(t=>{this.showPopup(t.target,t.data,t.option)})),t.feature.on("graphicPopopClose",(t=>{this.closePopup(t.target)})),t.feature.on("graphicTooltipOpen",(t=>{this._showTooltip2(t.target,t.data,t.option)})))})),this._on(jy.onFeatureSelected,(t=>{this.showTooltip(t.target),this.trigger(jy.onFeatureMousemove,t)})),this._bindPoupEvent()}initSelect(){var t,e,r,n;this._graphicLayerSelect=new nh({layers:[this.layer],condition:jl,style:t=>{const e=t.getGeometry().getType();let r;return r=dm.getStyle(e,{fillcolor:"rgba(0,191,255,0.1)",strokewidth:5,strokecolor:"rgba(0,191,255,1)"}),r},filter:function(t,e){if(e)return"ClusterImageLayer"!==e.get("layertype")&&!!t.get("editallows")}}),this._modify=new Ju({features:this._graphicLayerSelect.getFeatures(),snapToPointer:!0,style:dm.getEditPointStyle});const i=this._modify.getOverlay().getSource();this.layer instanceof da?this._snap=new ah({source:this.layer.getLayers[0].getSource(),pixelTolerance:10}):this._snap=new ah({source:this.layer.getSource(),pixelTolerance:10}),this._graphicLayerSelect.on("select",(t=>{t.selected[0]?t.selected[0].set("editstate",!0):t.deselected[0].set("editstate",!1)})),i.on(["addfeature","removefeature"],(function(t){})),this._modify.on("modifystart",(t=>{let e=t.target.features_.array_[0];this.trigger(jy.onEditModifyStart,{data:e})})),this._modify.on("modifyend",(t=>{let e=t.target.features_.array_[0];this.trigger(jy.onEditModifyEnd,{data:e})})),this._modify.on("change:active",(t=>{let e=t.target.features_.array_[0];t.target.get("active")?(this.trigger(jy.onEditStart,{data:e}),t.target.features_.forEach((function(t){if(t.set("editstate",!0),(t.getGeometry().getType()===Wy.Polygon||t.getGeometry().getType()===Wy.Line)&&t.getStyle()[0]!==dm.getEditPolygonStyle()[0])return t.setStyle(dm.getEditPolygonStyle()),void(t.getStyle()[0].text_.text_=t.get("name"))}))):(this.selectFeature&&this.selectFeature.set("editstate",!1),this.trigger(jy.onEditEnd,{data:e}))})),this._translate=new hh({layers:[this.layer]}),this._translate.on("translateend",(t=>{this.trigger(jy.onFeatureMoved,t.features.getArray()[0].getProperties())})),this._graphicLayerSelect.setActive(!0),this._translate.setActive(!1),this._modify.setActive(!1),null==(t=this._map)||t.addInteraction(this._graphicLayerSelect),null==(e=this._map)||e.addInteraction(this._modify),null==(r=this._map)||r.addInteraction(this._snap),null==(n=this._map)||n.addInteraction(this._translate),this.option.hashMove&&this._translate.setActive(!0)}setSelectState(t=!0){this.option.hashSelect=t,this._graphicLayerSelect.setActive(t)}startMove(){this.option.hashMove=!0,this._translate.setActive(!0)}endMove(){this.option.hashMove=!1,this._translate.setActive(!1)}startEdit(){this.option.hashEdit=!0,this._graphicLayerSelect.setActive(!1),this._modify.setActive(!0)}endEdit(){this.option.hashEdit=!1,this._graphicLayerSelect.setActive(!1),this._modify.setActive(!1)}bindContextmenu(t){this.option.enabledRightMenu=!0,t&&(this.option.contextmenu=t)}unbindContextmenu(){this.option.enabledRightMenu=!1}appendContextmenu(t){t.forEach((t=>{this.option.contextmenu.push(t)}))}_setFeatureContextmenu(t,e){this.option.enabledRightMenu&&(e.clear(),this.selectFeature=t,this.option.contextmenu.forEach((e=>{e.data={SelectedFeature:t}})),this.option.contextmenu.length>0&&e.extend(this.option.contextmenu))}showTitle(t,e,r="name"){new Promise((()=>{this.layer.getSource().getFeatures().forEach((n=>{let i=n.getProperties();if(t===i.dataType)try{n.getStyle().getText().setText(e?n.get(r):"")}catch(UW){}})),this.layer.changed()}))}showTitleByClassname(t,e,r="name"){this.layer.getSource().forEachFeature((n=>{let i=n.getProperties();t===i.dataType&&(n.getStyle().getText().setText(e?n.get(r):""),n.changed())}))}showTitleByField(t,e,r,n="name"){this.layer.getSource().forEachFeature((i=>{let o=i.getProperties()[t];e===o&&(i.getStyle().getText().setText(r?i.get(n):""),i.changed())}))}_bindPoupEvent(){let t=document.getElementById("popup-closer");t&&(t.onclick=()=>{this.closePopup()})}bindPopup(t,e={offset:[0,0]}){this.option.enabledPopup=!0,t&&(this.option.popupInfo=t),this.option.popupOption=e}unbindPopup(){this.option.enabledPopup=!1,this.closePopup()}openPopup(t,e,r={offset:[0,0]}){if(e&&(this.option.popupInfo=e),this.option.enabledPopup&&this.option.popupInfo){let e="";if("string"==typeof this.option.popupInfo)e=this.option.popupInfo;else{let r=t.getProperties();this.option.popupInfo.forEach((t=>{t.dataType===r.dataType&&t.showContent.forEach((t=>{t.type?e+=t.html:e+=t.name+":"+r[t.field]+"<br>"}))}))}""!==e&&this.showPopup(t,e,r)}}showPopup(t,e,r){var n,i;let o=zt(t.getGeometry().getExtent()),s=document.getElementById("popup-content");s&&(s.innerHTML=e),null==(n=this._map)||n.getOverlayById("popup").setPosition(o),null==(i=this._map)||i.getOverlayById("popup").setOffset(r.offset),this.trigger(jy.onFeaturePopupOpen,{element:document.getElementById("popup-content"),data:t})}closePopup(t){var e;null==(e=this._map)||e.getOverlayById("popup").setPosition(void 0),this.trigger(jy.onFeaturePopupClose,{element:document.getElementById("popup-content"),data:t})}bindTooltip(t,e={offset:[0,0]}){this.option.enabledTooltip=!0,t&&(this.option.tooltipInfo=t),this.option.tooltipOption=e}unbindTooltip(){this.option.enabledTooltip=!1,this.closeTooltip()}showTooltip(t){if(this.option.enabledTooltip&&this.option.tooltipInfo){let e="";if("string"==typeof this.option.tooltipInfo)e=this.option.tooltipInfo;else{let r=t.getProperties();this.option.tooltipInfo.forEach((t=>{t.dataType===r.dataType&&t.showContent.forEach((t=>{t.type?e+=t.html:e+=t.name+":"+r[t.field]+"<br>"}))}))}""!==e&&this._showTooltip2(t,e,this.option.tooltipOption)}}_showTooltip2(t,e,r){var n,i;let o=zt(t.getGeometry().getExtent()),s=document.getElementById("tooltip-content");s&&(s.innerHTML=e),null==(n=this._map)||n.getOverlayById("tooltip").setPosition(o),null==(i=this._map)||i.getOverlayById("tooltip").setOffset(r.offset),this.trigger(jy.onFeatureTooltipOpen,{element:document.getElementById("tooltip-content"),data:t})}closeTooltip(){var t;null==(t=this._map)||t.getOverlayById("tooltip").setPosition(void 0),this.trigger(jy.onFeatureTooltiClose,{element:document.getElementById("tooltip-content"),data:""})}addGeoJson(t,e){this.addFeatures(t,this.formatJsonTo3857(e))}addGeoJsonPoint(t,e){this.addFeatures(t,this.formatJsonToPoint(e))}convertGeoJsontoFeatures(t){return this.formatJsonTo3857(t)}addFeatures(t,e,r,n){this.trigger(jy.onLoadStart,t),e.forEach((e=>{let i=this._getFeatureAttribute(t),o=QM.merge(e.getProperties(),i,!1);r&&(o=QM.merge(o,r,!0)),e.setProperties(o),e.set("classname",t);let s=e.getStyle();if(s||(s=e.get("style")?dm.getStyle(e.getGeometry().getType(),e.get("style")):dm.getStyle(e.getGeometry().getType(),{}),e.setStyle(s)),n){let t=n(e.getProperties());s=dm.getStyle(e.getGeometry().getType(),t)}"探方"!==e.get("dataType")&&"新增探方"!==e.get("dataType")||e.get("name")&&s.getText()&&s.getText().setText(e.get("name")+"\n"+e.get("负责人"))})),this._source.addFeatures(e),this._source.changed()}_getFeatureAttribute(t="default"){return{classname:t,uuid:fm.uuid15(),editallows:!0,editstate:!1,movestate:!0,featuretype:qy.vector,dataType:""}}addFeature(t,e,r,n){this.trigger(jy.onLoadStart,t);let i=this._getFeatureAttribute(t),o=QM.merge(e.getProperties(),i,!1);r&&(o=QM.merge(o,r,!0)),e.setProperties(o),e.set("classname",t);let s=e.getStyle();if(!s){let t=e.get("style");if(t){if(s=dm.getStyle(e.getGeometry().getType(),t),n){let t=n(e.getProperties());s=dm.getStyle(e.getGeometry().getType(),t)}e.setStyle(s)}}this._source.addFeature(e)}setFeaturesAttribute(t){this._source.getFeatures().forEach((e=>{if(t){let r=QM.merge(e.getProperties(),t,!0);e.setProperties(r)}}))}setFeaturesAttributeByClassName(t,e){this.getFeaturesByClassName(t).forEach((t=>{if(e){let r=QM.merge(t.getProperties(),e,!0);t.setProperties(r)}}))}setFeatureAttribute(t,e){let r=this.getFeatureByUid(t);if(e){let t=QM.merge(r.getProperties(),e,!0);r.setProperties(t)}}getFeaturesAll(){return this._source.getFeatures()}getFeaturesByFieldName(t,e){let r=[];return this._source.getFeatures().forEach((n=>{n.get(t)===e&&r.push(n)})),r}getFeaturesByClassName(t){let e=[];return this._source.getFeatures().forEach((r=>{r.get("classname")===t&&e.push(r)})),e}getFeatures(t){let e=[];return this._source.getFeatures().forEach((r=>{r.get("name")===t&&e.push(r)})),e}getFeature(t){let e=null;return this._source.getFeatures().forEach((r=>{r.get("name")!==t||(e=r)})),e}getFeatureByUid(t){let e=null;return this._source.getFeatures().forEach((r=>{r.get("uuid")!==t||(e=r)})),e}removeFeature(t){"string"==typeof t?this._source.getFeatures().forEach((e=>{e.get("uuid")===t&&this._source.removeFeature(e)})):this._source.removeFeature(t)}removeFeatures(t){this._source.getFeatures().forEach((e=>{try{e.get("classname").replaceAll(" ","")===t.replaceAll(" ","")&&this._source.removeFeature(e)}catch(UW){}}))}removeFeaturesByJson(t){this._source.getFeatures().forEach((e=>{let r=0;for(let n=0;n<t.name.length;n++)try{e.get(t.name[n].replace(/\s*/g,"")).replace(/\s*/g,"")===t.value[n].replace(/\s*/g,"")&&r++}catch(UW){}r===t.name.length&&this._source.removeFeature(e)}))}replaceField(t){let e;if(/\{[^}]+\}/g.test(t)){let r=/\{(.*?)\}/g;return e=t.match(r)[0].replace("{","").replace("}",""),e}return t}setSymbol(t,e){this._source.getFeatures().forEach((r=>{let n=dm.getStyle(r.getGeometry().getType(),t);if(t.text){let e=this.replaceField(t.text);e!==t.text&&n.getText().setText(r.getProperties()[e])}if(e){let t=e(r.getProperties());n=dm.getStyle(r.getGeometry().getType(),t)}r.setStyle(n)}))}setSymbolLevelColor(t){let e=[],r=0,n=0;void 0!==t.autolevel&&null!==t.autolevel||(t.autolevel=!0);let i=[{maxnum:0,fillcolor:"rgba(255,255,255,0.1)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.2)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.4)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.6)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.8)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,1)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1}];if(t.levelColor&&(i=t.levelColor),t.autolevel){let o=i.length;this._source.getFeatures().forEach((r=>{let n=r.get(t.attributeName);n&&e.push(parseInt(n))})),r=Math.max(...e),n=r/o,i.forEach(((t,e)=>{t.maxnum=n*e}))}return i.sort((function(t,e){return e.maxnum-t.maxnum})),this._source.getFeatures().forEach((e=>{if(e.get("classname")===t.classname){let r=e.get(t.attributeName);if(r)if(0===parseInt(r)){let t=dm.getStyle(e.getGeometry().getType(),{fillcolor:"rgba(255,255,255,0)",strokecolor:"rgba(255,255,255,0.1)",strokewidth:.1});e.setStyle(t)}else for(let t=0;t<i.length;t++)if(parseFloat(r)>i[t].maxnum){let r=dm.getStyle(e.getGeometry().getType(),{fillcolor:i[t].fillcolor,strokecolor:i[t].strokecolor,strokewidth:i[t].strokewidth});e.setStyle(r);break}}})),i}setSymbolByClassname(t,e,r){this._source.getFeatures().forEach((n=>{if(n.get("classname")===t){let t=dm.getStyle(n.getGeometry().getType(),e);if(e.text){let r=this.replaceField(e.text);r!==e.text&&t.getText().setText(n.getProperties()[r])}if(r){let e=r(n.getProperties());t=dm.getStyle(n.getGeometry().getType(),e)}n.setStyle(t)}}))}setSymbolByFeatures(t,e,r){t.forEach((t=>{let n=dm.getStyle(t.getGeometry().getType(),e);if(e.text){let r=this.replaceField(e.text);r!==e.text&&n.getText().setText(t.getProperties()[r])}if(r){let e=r(t.getProperties());n=dm.getStyle(t.getGeometry().getType(),e)}t.setStyle(n),t.changed()}))}setSymbolByStyleClass(t){this._source.getFeatures().forEach((e=>{t.forEach((t=>{if(e.get(t.className)===t.classValue){let r=dm.getStyle(e.getGeometry().getType(),t.style);if(t.style.text){let n=this.replaceField(t.style.text);n!==t.style.text&&r.getText().setText(e.getProperties()[n])}e.setStyle(r)}}))}))}setClassSymbol(t,e){this._source.getFeatures().forEach((r=>{r.get("classname")===t&&e.forEach((t=>{if(r.get(t.className)===t.classValue){let e=dm.getStyle(r.getGeometry().getType(),t.style);if(t.style.text){let n=this.replaceField(t.style.text);n!==t.style.text&&e.getText().setText(r.getProperties()[n])}r.setStyle(e)}}))}))}setFeaturesTileByJson(t,e){this._source.getFeatures().forEach((r=>{let n=r.get("featureStyle");r.get("dataType")===t&&(e&&r.get("name")?"探方"===r.get("dataType")?n.getText()&&n.getText().setText(r.get("name")+"\n"+r.get("负责人")):n.getText()&&n.getText().setText(r.get("name")):n.getText()&&n.getText().setText(""))}))}clear(){this._source.clear()}startDraw(t){var e;let r=t.type;t.attribute=Object.assign(this._getFeatureAttribute(),t.attribute),t.geometryFunction=null,t.type===Wy.Rectangle&&(r=Wy.Circle,t.geometryFunction=function(t,e,r){var n=xt([t[0],t[t.length-1]].map((function(t){return wr(t)}))),i=[[jt(n),Ht(n),Zt(n),Yt(n),jt(n)]],o=e;return o?o.setCoordinates(i):o=new wn(i),o}),t.style=t.style?t.style:{};const n=t.type===Wy.Circle||t.type===Wy.Rectangle?"移动到所需位置,单击结束绘制":"单击继续绘制,双击结束绘制"+(t.type===Wy.Polygon?"多边形":"线"),i="点击任意位置开始绘制";let o=i;this._draw=new Gu({type:r,geometryFunction:t.geometryFunction,freehand:t.freehand||!1,style:e=>{const r=e.getGeometry(),n=null==r?void 0:r.getType();let i=null;if(i=[dm.getStyle(t.type,t.style)],o&&"Point"===n&&!this._modify.getOverlay().getSource().getFeatures().length){this._tipPoint=r;let t=dm.getTipStyle();t.getText().setText(o),i.push(t)}return i}}),null==(e=this._map)||e.addInteraction(this._draw),this._draw.on("drawstart",(t=>{o=n,this.trigger(jy.onDrawStart,t)})),this._draw.on("drawend",(e=>{var r,n;o=i,null==(r=this._draw)||r.setActive(!1),null==(n=this._map)||n.removeInteraction(this._draw),setTimeout((()=>{this.changeGraphicData(t,e.feature)}),100)}))}changeGraphicData(t,e){for(let i in t.style)""===t.style[i].toString()&&delete t.style[i];let r,n;switch(t.type){case Wy.Circle:n=Object.assign({},dm.getDefaultPolygonStyle(),t.style),r=new ZM({lnglat:xn(e.getGeometry(),128).getCoordinates(),dataWkID:Yy.EPSG3857,style:{stroke:{color:n.strokecolor,width:n.strokewidth,lineDash:n.strokelineDash},fill:{color:n.fillcolor}},attribute:t.attribute});break;case Wy.Polygon:case Wy.Rectangle:n=Object.assign({},dm.getDefaultPolygonStyle(),t.style),r=new ZM({lnglat:e.getGeometry().getCoordinates(),dataWkID:Yy.EPSG3857,style:{stroke:{color:n.strokecolor,width:n.strokewidth,lineDash:n.strokelineDash},fill:{color:n.fillcolor}},attribute:t.attribute});break;case Wy.Line:n=Object.assign({},dm.getDefaulLineStyle(),t.style),r=new YM({lnglat:e.getGeometry().getCoordinates(),dataWkID:Yy.EPSG3857,style:{stroke:{color:n.strokecolor,width:n.strokewidth,lineDash:n.strokelineDash}},attribute:t.attribute});break;case Wy.Point:n=Object.assign({},dm.getDefaultPointStyle(),t.style),r=n.imageOption?new XM({lnglat:e.getGeometry().getCoordinates(),dataWkID:Yy.EPSG3857,style:{text:{font:n.Font,text:n.text,fill:{color:n.FontColor},stroke:{color:n.FontStrokeColor,width:n.FontStrokeWidth}},imageOption:n.imageOption,zIndex:999},attribute:Object.assign({},t.attribute,{movestate:!1,editallows:!1})}):new WM({lnglat:e.getGeometry().getCoordinates(),dataWkID:Yy.EPSG3857,style:{text:{font:n.Font,text:n.text,fill:{color:n.FontColor},stroke:{color:n.FontStrokeColor,width:n.FontStrokeWidth}},image:{scale:n.scale,radius:n.radius,fill:{color:n.fillcolor},stroke:{color:n.strokecolor,width:n.strokewidth}},zIndex:999},attribute:Object.assign({},t.attribute,{movestate:!1,editallows:!1})})}t.attribute.classname?this.addFeature(t.attribute.classname,r):this.addFeature("temp",r),t.success&&t.success(r),this.trigger(jy.onDrawEnd,r)}appendTo(t){var e;this._map=t,this.layer&&(null==(e=this._map)||e.addLayer(this.layer),this.isAdded=!0),this.initSelect(),this._map.on("singleclick",(t=>{var e;if(this.option.hashSelect){this._modify.setActive(!1),this._graphicLayerSelect.setActive(!0);const r=null==(e=this._map)?void 0:e.forEachFeatureAtPixel(t.pixel,(function(t,e){return{feature:t,layer:e}}));r&&r.feature}})),this.trigger("appendToEnd",{})}toGeoJSON(){return(new nf).writeFeaturesObject(this.layer.getSource().getFeatures(),{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}}class tO extends $M{constructor(t,e){super(t,e),new Gi({fill:new Tn({color:"#eeeeee"})}),this.layertype="GraphicImageLayer",this.layer=new gf({imageRatio:this.option.imageRatio,source:this._source,zIndex:this.option.zIndex,declutter:this.option.declutter}),this.layer.set("layerid",t),this.layer.on(this.EventType.featureType.onFeatureContextmenu,(t=>{this._setFeatureContextmenu(t.data.feature,t.data.contextmenu)})),this.layer.on("sourceready",(t=>{this.trigger(jy.onLoadEnd,t)})),this._on("onClickTolayer",(t=>{"function"==typeof t.isPopupBind&&t.isPopupBind()?t.openPopup():this.option.enabledPopup&&this.openPopup(t,this.option.popupInfo,this.option.popupOption)}))}}var eO=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const rO=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;void 0!==n.interpolate&&(i=n.interpolate);var o=void 0!==n.projection?n.projection:"EPSG:3857",s=void 0!==n.tileGrid?n.tileGrid:NA({extent:UA(o),maxResolution:n.maxResolution,maxZoom:n.maxZoom,minZoom:n.minZoom,tileSize:n.tileSize});return(r=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,interpolate:i,opaque:n.opaque,projection:o,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileGrid:s,tileLoadFunction:n.tileLoadFunction,tilePixelRatio:n.tilePixelRatio,tileUrlFunction:n.tileUrlFunction,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition,attributionsCollapsible:n.attributionsCollapsible,zDirection:n.zDirection})||this).gutter_=void 0!==n.gutter?n.gutter:0,r}return eO(e,t),e.prototype.getGutter=function(){return this.gutter_},e}(lf);var nO=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const iO=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,wrapX:e.wrapX})||this;return r.resolution=void 0,r.distance=void 0!==e.distance?e.distance:20,r.minDistance=e.minDistance||0,r.interpolationRatio=0,r.features=[],r.geometryFunction=e.geometryFunction||function(t){var e=t.getGeometry();return K("Point"==e.getType(),10),e},r.createCustomCluster_=e.createCluster,r.source=null,r.boundRefresh_=r.refresh.bind(r),r.updateDistance(r.distance,r.minDistance),r.setSource(e.source||null),r}return nO(e,t),e.prototype.clear=function(e){this.features.length=0,t.prototype.clear.call(this,e)},e.prototype.getDistance=function(){return this.distance},e.prototype.getSource=function(){return this.source},e.prototype.loadFeatures=function(t,e,r){this.source.loadFeatures(t,e,r),e!==this.resolution&&(this.resolution=e,this.refresh())},e.prototype.setDistance=function(t){this.updateDistance(t,this.minDistance)},e.prototype.setMinDistance=function(t){this.updateDistance(this.distance,t)},e.prototype.getMinDistance=function(){return this.minDistance},e.prototype.setSource=function(t){this.source&&this.source.removeEventListener(P.CHANGE,this.boundRefresh_),this.source=t,t&&t.addEventListener(P.CHANGE,this.boundRefresh_),this.refresh()},e.prototype.refresh=function(){this.clear(),this.cluster(),this.addFeatures(this.features)},e.prototype.updateDistance=function(t,e){var r=0===t?0:Math.min(e,t)/t,n=t!==this.distance||this.interpolationRatio!==r;this.distance=t,this.minDistance=e,this.interpolationRatio=r,n&&this.refresh()},e.prototype.cluster=function(){if(void 0!==this.resolution&&this.source)for(var t=[1/0,1/0,-1/0,-1/0],e=this.distance*this.resolution,r=this.source.getFeatures(),n={},i=0,o=r.length;i<o;i++){var a=r[i];if(!(s(a)in n)){var l=this.geometryFunction(a);if(l){Mt(l.getCoordinates(),t),Ct(t,e,t);var u=this.source.getFeaturesInExtent(t).filter((function(t){var e=s(t);return!(e in n)&&(n[e]=!0,!0)}));this.features.push(this.createCluster(u,t))}}}},e.prototype.createCluster=function(t,e){for(var r=[0,0],n=t.length-1;n>=0;--n){var i=this.geometryFunction(t[n]);i?ke(r,i.getCoordinates()):t.splice(n,1)}Qe(r,1/t.length);var o=zt(e),s=this.interpolationRatio,a=new rn([r[0]*(1-s)+o[0]*s,r[1]*(1-s)+o[1]*s]);return this.createCustomCluster_?this.createCustomCluster_(a,t):new W({geometry:a,features:t})},e}(Ks);var oO=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const sO=function(t){function e(e){var r=this,n=void 0===e.projection?"EPSG:3857":e.projection,i=e.tileGrid;if(void 0===i&&n&&(i=NA({extent:UA(n),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize})),(r=t.call(this,{cacheSize:.1,attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:n,tileGrid:i,opaque:e.opaque,state:e.state,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate})||this).gutter_=void 0!==e.gutter?e.gutter:0,r.tileSize_=e.tileSize?Un(e.tileSize):null,!r.tileSize_&&e.tilePixelRatio&&i){var o=Un(i.getTileSize(0));r.tileSize_=[o[0]*e.tilePixelRatio,o[1]*e.tilePixelRatio]}return r.tileSizes_=null,r.tileLoadingKeys_={},r.loader_=e.loader,r.handleTileChange_=r.handleTileChange_.bind(r),r.bandCount=void 0===e.bandCount?4:e.bandCount,r}return oO(e,t),e.prototype.setTileSizes=function(t){this.tileSizes_=t},e.prototype.getTileSize=function(t){if(this.tileSizes_)return this.tileSizes_[t];if(this.tileSize_)return this.tileSize_;var e=this.getTileGrid();return e?Un(e.getTileSize(t)):[256,256]},e.prototype.getGutterForProjection=function(t){return this.gutter_},e.prototype.setLoader=function(t){this.loader_=t},e.prototype.getTile=function(t,e,r,n,i){var o=this.getTileSize(t),s=yh(t,e,r);if(this.tileCache.containsKey(s))return this.tileCache.get(s);var a=this.loader_,l=x({tileCoord:[t,e,r],loader:function(){return n=function(){return a(t,e,r)},function(){var t;try{t=n()}catch(e){return Promise.reject(e)}return t instanceof Promise?t:Promise.resolve(t)}();var n},size:o},this.tileOptions),u=new wf(l);return u.key=this.getKey(),u.addEventListener(P.CHANGE,this.handleTileChange_),this.tileCache.set(s,u),u},e.prototype.handleTileChange_=function(t){var e,r=t.target,n=s(r),i=r.getState();i==Xs.LOADING?(this.tileLoadingKeys_[n]=!0,e=LA):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],e=i==Xs.ERROR?OA:i==Xs.LOADED?MA:void 0),e&&this.dispatchEvent(new GA(e,r))},e}(jA);function aO(t){return(e,...r)=>uO(t,e,r)}function lO(t,e){return aO(fO(t,e).get)}const{apply:uO,construct:hO,defineProperty:cO,get:AO,getOwnPropertyDescriptor:fO,getPrototypeOf:pO,has:dO,ownKeys:gO,set:yO,setPrototypeOf:mO}=Reflect,{iterator:vO,species:_O,toStringTag:wO,for:bO}=Symbol,xO=Object,{create:CO,defineProperty:EO,freeze:SO,is:BO}=xO,IO=Array.prototype[vO],TO=aO(IO),PO=ArrayBuffer;lO(PO.prototype,"byteLength");const FO="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:null;FO&&lO(FO.prototype,"byteLength");const LO=pO(Uint8Array);LO.from;const MO=LO.prototype;MO[vO],aO(MO.keys),aO(MO.values),aO(MO.entries),aO(MO.set),aO(MO.reverse),aO(MO.fill),aO(MO.copyWithin),aO(MO.sort),aO(MO.slice),aO(MO.subarray),lO(MO,"buffer"),lO(MO,"byteOffset"),lO(MO,"length"),lO(MO,wO);const OO=Uint32Array,kO=Float32Array,NO=pO([][vO]()),RO=aO(NO.next),UO=aO(function*(){}().next),DO=pO(NO),QO=aO(DataView.prototype.getUint16),GO=WeakMap,jO=GO.prototype,HO=aO(jO.get),zO=aO(jO.set),VO=new GO,KO=CO(null,{next:{value:function(){const t=HO(VO,this);return RO(t)}},[vO]:{value:function(){return this}}}),qO=new GO,WO=CO(DO,{next:{value:function(){const t=HO(qO,this);return UO(t)},writable:!0,configurable:!0}});for(const ol of gO(NO))"next"!==ol&&EO(WO,ol,fO(NO,ol));const XO=new PO(4),YO=new kO(XO),ZO=new OO(XO),JO=new OO(512),$O=new OO(512);for(let ol=0;ol<256;++ol){const t=ol-127;t<-27?(JO[ol]=0,JO[256|ol]=32768,$O[ol]=24,$O[256|ol]=24):t<-14?(JO[ol]=1024>>-t-14,JO[256|ol]=1024>>-t-14|32768,$O[ol]=-t-1,$O[256|ol]=-t-1):t<=15?(JO[ol]=t+15<<10,JO[256|ol]=t+15<<10|32768,$O[ol]=13,$O[256|ol]=13):t<128?(JO[ol]=31744,JO[256|ol]=64512,$O[ol]=24,$O[256|ol]=24):(JO[ol]=31744,JO[256|ol]=64512,$O[ol]=13,$O[256|ol]=13)}const tk=new OO(2048),ek=new OO(64),rk=new OO(64);for(let ol=1;ol<1024;++ol){let t=ol<<13,e=0;for(;0==(8388608&t);)t<<=1,e-=8388608;t&=-8388609,e+=947912704,tk[ol]=t|e}for(let ol=1024;ol<2048;++ol)tk[ol]=939524096+(ol-1024<<13);for(let ol=1;ol<31;++ol)ek[ol]=ol<<23;ek[31]=1199570944,ek[32]=2147483648;for(let ol=33;ol<63;++ol)ek[ol]=2147483648+(ol-32<<23);ek[63]=3347054592;for(let ol=1;ol<64;++ol)32!==ol&&(rk[ol]=1024);function nk(t,e,...r){return function(t){const e=t>>10;return ZO[0]=tk[rk[e]+(1023&t)]+ek[e],YO[0]}(QO(t,e,...function(t){if(t[vO]===IO&&NO.next===RO)return t;const e=CO(KO);return zO(VO,e,TO(t)),e}(r)))}var ik={};function ok(t,e,r){r&&r.debug;const n="object"==typeof t?t.outer:t,i=new RegExp(`${e}\\="([^"]*)"`).exec(n);if(i)return i[1]}({get exports(){return ik},set exports(t){ik=t}}).exports=ok,ik.default=ok;var sk={},ak={get exports(){return sk},set exports(t){sk=t}},lk={},uk={get exports(){return lk},set exports(t){lk=t}},hk={};function ck(t,e,r){const n=new RegExp(e).exec(t.slice(r));return n?r+n.index:-1}({get exports(){return hk},set exports(t){hk=t}}).exports=ck,hk.default=ck;var Ak={};function fk(t,e,r){const n=new RegExp(e).exec(t.slice(r));return n?r+n.index+n[0].length-1:-1}({get exports(){return Ak},set exports(t){Ak=t}}).exports=fk,Ak.default=fk;var pk={};function dk(t,e){const r=new RegExp(e,"g"),n=t.match(r);return n?n.length:0}({get exports(){return pk},set exports(t){pk=t}}).exports=dk,pk.default=dk;const gk=hk,yk=Ak,mk=pk;function vk(t,e,r){r&&r.debug;const n=!(r&&!1===typeof r.nested),i=r&&r.startIndex||0,o=gk(t,`<${e}[ >/]`,i);if(-1===o)return;const s=t.slice(o+e.length);let a=yk(s,"^[^<]*[ /]>",0);const l=-1!==a&&"/"===s[a-1];if(!1===l)if(n){let t=0,r=1,n=0;for(;-1!==(a=yk(s,"[ /]"+e+">",t));){const i=s.substring(t,a+1);if(r+=mk(i,"<"+e),n+=mk(i,"/"+e+">"),n>=r)break;t=a}}else a=yk(s,"[ /]"+e+">",0);const u=o+e.length+a+1;if(-1===u)return;const h=t.slice(o,u);let c;return c=l?null:h.slice(h.indexOf(">")+1,h.lastIndexOf("<")),{inner:c,outer:h,start:o,end:u}}uk.exports=vk,lk.default=vk;const _k=lk;function wk(t,e,r){const n=[],i=r&&r.debug||!1,o=!r||"boolean"!=typeof r.nested||r.nested;let s,a=r&&r.startIndex||0;for(;s=_k(t,e,{debug:i,startIndex:a});)a=o?s.start+1+e.length:s.end,n.push(s);return n}ak.exports=wk,sk.default=wk;const bk={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},xk={};for(const ol in bk)bk.hasOwnProperty(ol)&&(xk[bk[ol]]=parseInt(ol,10));const Ck=[xk.BitsPerSample,xk.ExtraSamples,xk.SampleFormat,xk.StripByteCounts,xk.StripOffsets,xk.StripRowCounts,xk.TileByteCounts,xk.TileOffsets,xk.SubIFDs],Ek={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},Sk={};for(const ol in Ek)Ek.hasOwnProperty(ol)&&(Sk[Ek[ol]]=parseInt(ol,10));const Bk={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"},Ik=new Map;function Tk(t,e){Array.isArray(t)||(t=[t]),t.forEach((t=>Ik.set(t,e)))}async function Pk(t){const e=Ik.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);return new(await e())(t)}function Fk(t,e,r,n=1){return new(Object.getPrototypeOf(t).constructor)(e*r*n)}function Lk(t,e,r){return(1-r)*t+r*e}function Mk(t,e,r){let n=0;for(let i=e;i<r;++i)n+=t[i];return n}function Ok(t,e,r){switch(t){case 1:if(e<=8)return new Uint8Array(r);if(e<=16)return new Uint16Array(r);if(e<=32)return new Uint32Array(r);break;case 2:if(8===e)return new Int8Array(r);if(16===e)return new Int16Array(r);if(32===e)return new Int32Array(r);break;case 3:switch(e){case 16:case 32:return new Float32Array(r);case 64:return new Float64Array(r)}}throw Error("Unsupported data format/bitsPerSample")}Tk([void 0,1],(()=>Promise.resolve().then((()=>rAt)).then((t=>t.default)))),Tk(5,(()=>Promise.resolve().then((()=>sAt)).then((t=>t.default)))),Tk(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),Tk(7,(()=>Promise.resolve().then((()=>_At)).then((t=>t.default)))),Tk([8,32946],(()=>Promise.resolve().then((()=>Idt)).then((t=>t.default)))),Tk(32773,(()=>Promise.resolve().then((()=>Tdt)).then((t=>t.default)))),Tk(34887,(()=>Promise.resolve().then((()=>Fdt)).then((t=>t.default)))),Tk(50001,(()=>Promise.resolve().then((()=>Ldt)).then((t=>t.default))));const kk=class{constructor(t,e,r,n,i,o){this.fileDirectory=t,this.geoKeys=e,this.dataView=r,this.littleEndian=n,this.tiles=i?{}:null,this.isTiled=!t.StripOffsets;const s=t.PlanarConfiguration;if(this.planarConfiguration=void 0===s?1:s,1!==this.planarConfiguration&&2!==this.planarConfiguration)throw new Error("Invalid planar configuration.");this.source=o}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return void 0!==this.fileDirectory.SamplesPerPixel?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:void 0!==this.fileDirectory.RowsPerStrip?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(t){return this.isTiled||(t+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-t*this.getTileHeight()}getBytesPerPixel(){let t=0;for(let e=0;e<this.fileDirectory.BitsPerSample.length;++e)t+=this.getSampleByteSize(e);return t}getSampleByteSize(t){if(t>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${t} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[t]/8)}getReaderForSample(t){const e=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1,r=this.fileDirectory.BitsPerSample[t];switch(e){case 1:if(r<=8)return DataView.prototype.getUint8;if(r<=16)return DataView.prototype.getUint16;if(r<=32)return DataView.prototype.getUint32;break;case 2:if(r<=8)return DataView.prototype.getInt8;if(r<=16)return DataView.prototype.getInt16;if(r<=32)return DataView.prototype.getInt32;break;case 3:switch(r){case 16:return function(t,e){return nk(this,t,e)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(t=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1}getBitsPerSample(t=0){return this.fileDirectory.BitsPerSample[t]}getArrayForSample(t,e){return Ok(this.getSampleFormat(t),this.getBitsPerSample(t),e)}async getTileOrStrip(t,e,r,n,i){const o=Math.ceil(this.getWidth()/this.getTileWidth()),s=Math.ceil(this.getHeight()/this.getTileHeight());let a;const{tiles:l}=this;let u,h;1===this.planarConfiguration?a=e*o+t:2===this.planarConfiguration&&(a=r*o*s+e*o+t),this.isTiled?(u=this.fileDirectory.TileOffsets[a],h=this.fileDirectory.TileByteCounts[a]):(u=this.fileDirectory.StripOffsets[a],h=this.fileDirectory.StripByteCounts[a]);const c=(await this.source.fetch([{offset:u,length:h}],i))[0];let A;return null!==l&&l[a]?A=l[a]:(A=(async()=>{let t=await n.decode(this.fileDirectory,c);const r=this.getSampleFormat(),i=this.getBitsPerSample();return function(t,e){return(1!==t&&2!==t||!(e<=32)||e%8!=0)&&(3!==t||16!==e&&32!==e&&64!==e)}(r,i)&&(t=function(t,e,r,n,i,o,s){const a=new DataView(t),l=2===r?1:n,u=Ok(e,i,2===r?s*o:s*o*n),h=parseInt("1".repeat(i),2);if(1===e){let t;t=1===r?n*i:i;let e=o*t;0!=(7&e)&&(e=e+7&-8);for(let r=0;r<s;++r){const t=r*e;for(let e=0;e<o;++e){const n=t+e*l*i;for(let t=0;t<l;++t){const s=n+t*i,c=(r*o+e)*l+t,A=Math.floor(s/8),f=s%8;if(f+i<=8)u[c]=a.getUint8(A)>>8-i-f&h;else if(f+i<=16)u[c]=a.getUint16(A)>>16-i-f&h;else if(f+i<=24){const t=a.getUint16(A)<<8|a.getUint8(A+2);u[c]=t>>24-i-f&h}else u[c]=a.getUint32(A)>>32-i-f&h}}}}return u.buffer}(t,r,this.planarConfiguration,this.getSamplesPerPixel(),i,this.getTileWidth(),this.getBlockHeight(e))),t})(),null!==l&&(l[a]=A)),{x:t,y:e,sample:r,data:await A}}async _readRaster(t,e,r,n,i,o,s,a,l){const u=this.getTileWidth(),h=this.getTileHeight(),c=this.getWidth(),A=this.getHeight(),f=Math.max(Math.floor(t[0]/u),0),p=Math.min(Math.ceil(t[2]/u),Math.ceil(c/u)),d=Math.max(Math.floor(t[1]/h),0),g=Math.min(Math.ceil(t[3]/h),Math.ceil(A/h)),y=t[2]-t[0];let m=this.getBytesPerPixel();const v=[],_=[];for(let x=0;x<e.length;++x)1===this.planarConfiguration?v.push(Mk(this.fileDirectory.BitsPerSample,0,e[x])/8):v.push(0),_.push(this.getReaderForSample(e[x]));const w=[],{littleEndian:b}=this;for(let x=d;x<g;++x)for(let o=f;o<p;++o)for(let s=0;s<e.length;++s){const a=s,f=e[s];2===this.planarConfiguration&&(m=this.getSampleByteSize(s));const p=this.getTileOrStrip(o,x,f,i,l);w.push(p),p.then((i=>{const o=i.data,s=new DataView(o),l=this.getBlockHeight(i.y),f=i.y*h,p=i.x*u,d=f+l,g=(i.x+1)*u,w=_[a],x=Math.min(l,l-(d-t[3]),A-f),C=Math.min(u,u-(g-t[2]),c-p);for(let h=Math.max(0,t[1]-f);h<x;++h)for(let i=Math.max(0,t[0]-p);i<C;++i){const o=(h*u+i)*m,l=w.call(s,o+v[a],b);let c;n?(c=(h+f-t[1])*y*e.length+(i+p-t[0])*e.length+a,r[c]=l):(c=(h+f-t[1])*y+i+p-t[0],r[a][c]=l)}}))}if(await Promise.all(w),o&&t[2]-t[0]!==o||s&&t[3]-t[1]!==s){let i;return i=n?function(t,e,r,n,i,o,s="nearest"){switch(s.toLowerCase()){case"nearest":return function(t,e,r,n,i,o){const s=e/n,a=r/i,l=Fk(t,n,i,o);for(let u=0;u<i;++u){const i=Math.min(Math.round(a*u),r-1);for(let r=0;r<n;++r){const a=Math.min(Math.round(s*r),e-1);for(let s=0;s<o;++s){const h=t[i*e*o+a*o+s];l[u*n*o+r*o+s]=h}}}return l}(t,e,r,n,i,o);case"bilinear":case"linear":return function(t,e,r,n,i,o){const s=e/n,a=r/i,l=Fk(t,n,i,o);for(let u=0;u<i;++u){const i=a*u,h=Math.floor(i),c=Math.min(Math.ceil(i),r-1);for(let r=0;r<n;++r){const a=s*r,A=a%1,f=Math.floor(a),p=Math.min(Math.ceil(a),e-1);for(let s=0;s<o;++s){const a=t[h*e*o+f*o+s],d=t[h*e*o+p*o+s],g=t[c*e*o+f*o+s],y=t[c*e*o+p*o+s],m=Lk(Lk(a,d,A),Lk(g,y,A),i%1);l[u*n*o+r*o+s]=m}}}return l}(t,e,r,n,i,o);default:throw new Error(`Unsupported resampling method: '${s}'`)}}(r,t[2]-t[0],t[3]-t[1],o,s,e.length,a):function(t,e,r,n,i,o="nearest"){switch(o.toLowerCase()){case"nearest":return function(t,e,r,n,i){const o=e/n,s=r/i;return t.map((t=>{const a=Fk(t,n,i);for(let l=0;l<i;++l){const i=Math.min(Math.round(s*l),r-1);for(let r=0;r<n;++r){const s=Math.min(Math.round(o*r),e-1),u=t[i*e+s];a[l*n+r]=u}}return a}))}(t,e,r,n,i);case"bilinear":case"linear":return function(t,e,r,n,i){const o=e/n,s=r/i;return t.map((t=>{const a=Fk(t,n,i);for(let l=0;l<i;++l){const i=s*l,u=Math.floor(i),h=Math.min(Math.ceil(i),r-1);for(let r=0;r<n;++r){const s=o*r,c=s%1,A=Math.floor(s),f=Math.min(Math.ceil(s),e-1),p=t[u*e+A],d=t[u*e+f],g=t[h*e+A],y=t[h*e+f],m=Lk(Lk(p,d,c),Lk(g,y,c),i%1);a[l*n+r]=m}}return a}))}(t,e,r,n,i);default:throw new Error(`Unsupported resampling method: '${o}'`)}}(r,t[2]-t[0],t[3]-t[1],o,s,a),i.width=o,i.height=s,i}return r.width=o||t[2]-t[0],r.height=s||t[3]-t[1],r}async readRasters({window:t,samples:e=[],interleave:r,pool:n=null,width:i,height:o,resampleMethod:s,fillValue:a,signal:l}={}){const u=t||[0,0,this.getWidth(),this.getHeight()];if(u[0]>u[2]||u[1]>u[3])throw new Error("Invalid subsets");const h=(u[2]-u[0])*(u[3]-u[1]),c=this.getSamplesPerPixel();if(e&&e.length){for(let p=0;p<e.length;++p)if(e[p]>=c)return Promise.reject(new RangeError(`Invalid sample index '${e[p]}'.`))}else for(let p=0;p<c;++p)e.push(p);let A;if(r)A=Ok(this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,Math.max.apply(null,this.fileDirectory.BitsPerSample),h*e.length),a&&A.fill(a);else{A=[];for(let t=0;t<e.length;++t){const r=this.getArrayForSample(e[t],h);Array.isArray(a)&&t<a.length?r.fill(a[t]):a&&!Array.isArray(a)&&r.fill(a),A.push(r)}}const f=n||await Pk(this.fileDirectory);return await this._readRaster(u,e,A,r,f,i,o,s,l)}async readRGB({window:t,interleave:e=!0,pool:r=null,width:n,height:i,resampleMethod:o,enableAlpha:s=!1,signal:a}={}){const l=t||[0,0,this.getWidth(),this.getHeight()];if(l[0]>l[2]||l[1]>l[3])throw new Error("Invalid subsets");const u=this.fileDirectory.PhotometricInterpretation;if(2===u){let l=[0,1,2];if(0!==this.fileDirectory.ExtraSamples&&s){l=[];for(let t=0;t<this.fileDirectory.BitsPerSample.length;t+=1)l.push(t)}return this.readRasters({window:t,interleave:e,samples:l,pool:r,width:n,height:i,resampleMethod:o,signal:a})}let h;switch(u){case 0:case 1:case 3:h=[0];break;case 5:h=[0,1,2,3];break;case 6:case 8:h=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const c={window:l,interleave:!0,samples:h,pool:r,width:n,height:i,resampleMethod:o,signal:a},{fileDirectory:A}=this,f=await this.readRasters(c),p=2**this.fileDirectory.BitsPerSample[0];let d;switch(u){case 0:d=function(t,e){const{width:r,height:n}=t,i=new Uint8Array(r*n*3);let o;for(let s=0,a=0;s<t.length;++s,a+=3)o=256-t[s]/e*256,i[a]=o,i[a+1]=o,i[a+2]=o;return i}(f,p);break;case 1:d=function(t,e){const{width:r,height:n}=t,i=new Uint8Array(r*n*3);let o;for(let s=0,a=0;s<t.length;++s,a+=3)o=t[s]/e*256,i[a]=o,i[a+1]=o,i[a+2]=o;return i}(f,p);break;case 3:d=function(t,e){const{width:r,height:n}=t,i=new Uint8Array(r*n*3),o=e.length/3,s=e.length/3*2;for(let a=0,l=0;a<t.length;++a,l+=3){const r=t[a];i[l]=e[r]/65536*256,i[l+1]=e[r+o]/65536*256,i[l+2]=e[r+s]/65536*256}return i}(f,A.ColorMap);break;case 5:d=function(t){const{width:e,height:r}=t,n=new Uint8Array(e*r*3);for(let i=0,o=0;i<t.length;i+=4,o+=3){const e=t[i],r=t[i+1],s=t[i+2],a=t[i+3];n[o]=(255-e)/256*255*((255-a)/256),n[o+1]=(255-r)/256*255*((255-a)/256),n[o+2]=(255-s)/256*255*((255-a)/256)}return n}(f);break;case 6:d=function(t){const{width:e,height:r}=t,n=new Uint8ClampedArray(e*r*3);for(let i=0,o=0;i<t.length;i+=3,o+=3){const e=t[i],r=t[i+1],s=t[i+2];n[o]=e+1.402*(s-128),n[o+1]=e-.34414*(r-128)-.71414*(s-128),n[o+2]=e+1.772*(r-128)}return n}(f);break;case 8:d=function(t){const{width:e,height:r}=t,n=new Uint8Array(e*r*3);for(let i=0,o=0;i<t.length;i+=3,o+=3){let e,r,s,a=(t[i+0]+16)/116,l=(t[i+1]<<24>>24)/500+a,u=a-(t[i+2]<<24>>24)/200;l=.95047*(l*l*l>.008856?l*l*l:(l-16/116)/7.787),a=1*(a*a*a>.008856?a*a*a:(a-16/116)/7.787),u=1.08883*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),e=3.2406*l+-1.5372*a+-.4986*u,r=-.9689*l+1.8758*a+.0415*u,s=.0557*l+-.204*a+1.057*u,e=e>.0031308?1.055*e**(1/2.4)-.055:12.92*e,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,n[o]=255*Math.max(0,Math.min(1,e)),n[o+1]=255*Math.max(0,Math.min(1,r)),n[o+2]=255*Math.max(0,Math.min(1,s))}return n}(f);break;default:throw new Error("Unsupported photometric interpretation.")}if(!e){const t=new Uint8Array(d.length/3),e=new Uint8Array(d.length/3),r=new Uint8Array(d.length/3);for(let n=0,i=0;n<d.length;n+=3,++i)t[i]=d[n],e[i]=d[n+1],r[i]=d[n+2];d=[t,e,r]}return d.width=f.width,d.height=f.height,d}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const t=[];for(let e=0;e<this.fileDirectory.ModelTiepoint.length;e+=6)t.push({i:this.fileDirectory.ModelTiepoint[e],j:this.fileDirectory.ModelTiepoint[e+1],k:this.fileDirectory.ModelTiepoint[e+2],x:this.fileDirectory.ModelTiepoint[e+3],y:this.fileDirectory.ModelTiepoint[e+4],z:this.fileDirectory.ModelTiepoint[e+5]});return t}getGDALMetadata(t=null){const e={};if(!this.fileDirectory.GDAL_METADATA)return null;const r=this.fileDirectory.GDAL_METADATA;let n=sk(r,"Item");n=null===t?n.filter((t=>void 0===ik(t,"sample"))):n.filter((e=>Number(ik(e,"sample"))===t));for(let i=0;i<n.length;++i){const t=n[i];e[ik(t,"name")]=t.inner}return e}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const t=this.fileDirectory.GDAL_NODATA;return Number(t.substring(0,t.length-1))}getOrigin(){const t=this.fileDirectory.ModelTiepoint,e=this.fileDirectory.ModelTransformation;if(t&&6===t.length)return[t[3],t[4],t[5]];if(e)return[e[3],e[7],e[11]];throw new Error("The image does not have an affine transformation.")}getResolution(t=null){const e=this.fileDirectory.ModelPixelScale,r=this.fileDirectory.ModelTransformation;if(e)return[e[0],-e[1],e[2]];if(r)return[r[0],r[5],r[10]];if(t){const[e,r,n]=t.getResolution();return[e*t.getWidth()/this.getWidth(),r*t.getHeight()/this.getHeight(),n*t.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return 1===this.geoKeys.GTRasterTypeGeoKey}getBoundingBox(){const t=this.getOrigin(),e=this.getResolution(),r=t[0],n=t[1],i=r+e[0]*this.getWidth(),o=n+e[1]*this.getHeight();return[Math.min(r,i),Math.min(n,o),Math.max(r,i),Math.max(n,o)]}};class Nk{constructor(t){this._dataView=new DataView(t)}get buffer(){return this._dataView.buffer}getUint64(t,e){const r=this.getUint32(t,e),n=this.getUint32(t+4,e);let i;if(e){if(i=r+2**32*n,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}if(i=2**32*r+n,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}getInt64(t,e){let r=0;const n=(128&this._dataView.getUint8(t+(e?7:0)))>0;let i=!0;for(let o=0;o<8;o++){let s=this._dataView.getUint8(t+(e?o:7-o));n&&(i?0!==s&&(s=255&~(s-1),i=!1):s=255&~s),r+=s*256**o}return n&&(r=-r),r}getUint8(t,e){return this._dataView.getUint8(t,e)}getInt8(t,e){return this._dataView.getInt8(t,e)}getUint16(t,e){return this._dataView.getUint16(t,e)}getInt16(t,e){return this._dataView.getInt16(t,e)}getUint32(t,e){return this._dataView.getUint32(t,e)}getInt32(t,e){return this._dataView.getInt32(t,e)}getFloat16(t,e){return nk(this._dataView,t,e)}getFloat32(t,e){return this._dataView.getFloat32(t,e)}getFloat64(t,e){return this._dataView.getFloat64(t,e)}}class Rk{constructor(t,e,r,n){this._dataView=new DataView(t),this._sliceOffset=e,this._littleEndian=r,this._bigTiff=n}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(t,e){return this.sliceOffset<=t&&this.sliceTop>=t+e}readUint8(t){return this._dataView.getUint8(t-this._sliceOffset,this._littleEndian)}readInt8(t){return this._dataView.getInt8(t-this._sliceOffset,this._littleEndian)}readUint16(t){return this._dataView.getUint16(t-this._sliceOffset,this._littleEndian)}readInt16(t){return this._dataView.getInt16(t-this._sliceOffset,this._littleEndian)}readUint32(t){return this._dataView.getUint32(t-this._sliceOffset,this._littleEndian)}readInt32(t){return this._dataView.getInt32(t-this._sliceOffset,this._littleEndian)}readFloat32(t){return this._dataView.getFloat32(t-this._sliceOffset,this._littleEndian)}readFloat64(t){return this._dataView.getFloat64(t-this._sliceOffset,this._littleEndian)}readUint64(t){const e=this.readUint32(t),r=this.readUint32(t+4);let n;if(this._littleEndian){if(n=e+2**32*r,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}if(n=2**32*e+r,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}readInt64(t){let e=0;const r=(128&this._dataView.getUint8(t+(this._littleEndian?7:0)))>0;let n=!0;for(let i=0;i<8;i++){let o=this._dataView.getUint8(t+(this._littleEndian?i:7-i));r&&(n?0!==o&&(o=255&~(o-1),n=!1):o=255&~o),e+=o*256**i}return r&&(e=-e),e}readOffset(t){return this._bigTiff?this.readUint64(t):this.readUint32(t)}}const Uk="undefined"!=typeof navigator&&navigator.hardwareConcurrency||2,Dk=class{constructor(t=Uk,e){this.workers=null,this._awaitingDecoder=null,this.size=t,this.messageId=0,t&&(this._awaitingDecoder=e?Promise.resolve(e):new Promise((t=>{Promise.resolve().then((()=>Odt)).then((e=>{t(e.create)}))})),this._awaitingDecoder.then((e=>{this._awaitingDecoder=null,this.workers=[];for(let r=0;r<t;r++)this.workers.push({worker:e(),idle:!0})})))}async decode(t,e){return this._awaitingDecoder&&await this._awaitingDecoder,0===this.size?Pk(t).then((r=>r.decode(t,e))):new Promise((r=>{const n=this.workers.find((t=>t.idle))||this.workers[Math.floor(Math.random()*this.size)];n.idle=!1;const i=this.messageId++,o=t=>{t.data.id===i&&(n.idle=!0,r(t.data.decoded),n.worker.removeEventListener("message",o))};n.worker.addEventListener("message",o),n.worker.postMessage({fileDirectory:t,buffer:e,id:i},[e])}))}destroy(){this.workers&&(this.workers.forEach((t=>{t.worker.terminate()})),this.workers=null)}},Qk="\r\n\r\n";function Gk(t){if(void 0!==Object.fromEntries)return Object.fromEntries(t);const e={};for(const[r,n]of t)e[r.toLowerCase()]=n;return e}function jk(t){return Gk(t.split("\r\n").map((t=>{const e=t.split(":").map((t=>t.trim()));return e[0]=e[0].toLowerCase(),e})))}function Hk(t){let e,r,n;return t&&([,e,r,n]=t.match(/bytes (\d+)-(\d+)\/(\d+)/),e=parseInt(e,10),r=parseInt(r,10),n=parseInt(n,10)),{start:e,end:r,total:n}}class zk{async fetch(t,e=undefined){return Promise.all(t.map((t=>this.fetchSlice(t,e))))}async fetchSlice(t){throw new Error(`fetching of slice ${t} not possible, not implemented`)}get fileSize(){return null}async close(){}}var Vk,Kk,qk=Wk;function Wk(t){var e=this;if(e instanceof Wk||(e=new Wk),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var r=0,n=arguments.length;r<n;r++)e.push(arguments[r]);return e}function Xk(t,e,r,n){if(!(this instanceof Xk))return new Xk(t,e,r,n);this.list=n,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}Wk.Node=Xk,Wk.create=Wk,Wk.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,r=t.prev;return e&&(e.prev=r),r&&(r.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=r),t.list.length--,t.next=null,t.prev=null,t.list=null,e},Wk.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},Wk.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}},Wk.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)n=arguments[t],(r=this).tail=new Xk(n,r.tail,null,r),r.head||(r.head=r.tail),r.length++;var r,n;return this.length},Wk.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)n=arguments[t],(r=this).head=new Xk(n,null,r.head,r),r.tail||(r.tail=r.head),r.length++;var r,n;return this.length},Wk.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},Wk.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},Wk.prototype.forEach=function(t,e){e=e||this;for(var r=this.head,n=0;null!==r;n++)t.call(e,r.value,n,this),r=r.next},Wk.prototype.forEachReverse=function(t,e){e=e||this;for(var r=this.tail,n=this.length-1;null!==r;n--)t.call(e,r.value,n,this),r=r.prev},Wk.prototype.get=function(t){for(var e=0,r=this.head;null!==r&&e<t;e++)r=r.next;if(e===t&&null!==r)return r.value},Wk.prototype.getReverse=function(t){for(var e=0,r=this.tail;null!==r&&e<t;e++)r=r.prev;if(e===t&&null!==r)return r.value},Wk.prototype.map=function(t,e){e=e||this;for(var r=new Wk,n=this.head;null!==n;)r.push(t.call(e,n.value,this)),n=n.next;return r},Wk.prototype.mapReverse=function(t,e){e=e||this;for(var r=new Wk,n=this.tail;null!==n;)r.push(t.call(e,n.value,this)),n=n.prev;return r},Wk.prototype.reduce=function(t,e){var r,n=this.head;if(arguments.length>1)r=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var i=0;null!==n;i++)r=t(r,n.value,i),n=n.next;return r},Wk.prototype.reduceReverse=function(t,e){var r,n=this.tail;if(arguments.length>1)r=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var i=this.length-1;null!==n;i--)r=t(r,n.value,i),n=n.prev;return r},Wk.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;null!==r;e++)t[e]=r.value,r=r.next;return t},Wk.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;null!==r;e++)t[e]=r.value,r=r.prev;return t},Wk.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new Wk;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=0,i=this.head;null!==i&&n<t;n++)i=i.next;for(;null!==i&&n<e;n++,i=i.next)r.push(i.value);return r},Wk.prototype.sliceReverse=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new Wk;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=this.length,i=this.tail;null!==i&&n>e;n--)i=i.prev;for(;null!==i&&n>t;n--,i=i.prev)r.push(i.value);return r},Wk.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,i=this.head;null!==i&&n<t;n++)i=i.next;var o,s,a,l,u=[];for(n=0;i&&n<e;n++)u.push(i.value),i=this.removeNode(i);for(null===i&&(i=this.tail),i!==this.head&&i!==this.tail&&(i=i.prev),n=0;n<r.length;n++)o=this,s=i,a=r[n],void 0,null===(l=s===o.head?new Xk(a,null,s,o):new Xk(a,s,s.next,o)).next&&(o.tail=l),null===l.prev&&(o.head=l),o.length++,i=l;return u},Wk.prototype.reverse=function(){for(var t=this.head,e=this.tail,r=t;null!==r;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=e,this.tail=t,this};try{(Kk?Vk:(Kk=1,Vk=function(t){t.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}))(Wk)}catch(yxt){}const Yk=qk,Zk=Symbol("max"),Jk=Symbol("length"),$k=Symbol("lengthCalculator"),tN=Symbol("allowStale"),eN=Symbol("maxAge"),rN=Symbol("dispose"),nN=Symbol("noDisposeOnSet"),iN=Symbol("lruList"),oN=Symbol("cache"),sN=Symbol("updateAgeOnGet"),aN=()=>1,lN=(t,e,r)=>{const n=t[oN].get(e);if(n){const e=n.value;if(uN(t,e)){if(cN(t,n),!t[tN])return}else r&&(t[sN]&&(n.value.now=Date.now()),t[iN].unshiftNode(n));return e.value}},uN=(t,e)=>{if(!e||!e.maxAge&&!t[eN])return!1;const r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[eN]&&r>t[eN]},hN=t=>{if(t[Jk]>t[Zk])for(let e=t[iN].tail;t[Jk]>t[Zk]&&null!==e;){const r=e.prev;cN(t,e),e=r}},cN=(t,e)=>{if(e){const r=e.value;t[rN]&&t[rN](r.key,r.value),t[Jk]-=r.length,t[oN].delete(r.key),t[iN].removeNode(e)}};class AN{constructor(t,e,r,n,i){this.key=t,this.value=e,this.length=r,this.now=n,this.maxAge=i||0}}const fN=(t,e,r,n)=>{let i=r.value;uN(t,i)&&(cN(t,r),t[tN]||(i=void 0)),i&&e.call(n,i.value,i.key,t)};function pN(t,e){const r=Array.isArray(t)?t:Array.from(t),n=Array.isArray(e)?e:Array.from(e);return r.map(((t,e)=>[t,n[e]]))}class dN extends Error{constructor(t){super(t),Error.captureStackTrace&&Error.captureStackTrace(this,dN),this.name="AbortError"}}class gN extends Error{constructor(t,e){super(e),this.errors=t,this.message=e,this.name="AggregateError"}}const yN=gN;class mN{constructor(t,e,r=null){this.offset=t,this.length=e,this.data=r}get top(){return this.offset+this.length}}class vN{constructor(t,e,r){this.offset=t,this.length=e,this.blockIds=r}}class _N extends zk{constructor(t,{blockSize:e=65536,cacheSize:r=100}={}){super(),this.source=t,this.blockSize=e,this.blockCache=new class{constructor(t){if("number"==typeof t&&(t={max:t}),t||(t={}),t.max&&("number"!=typeof t.max||t.max<0))throw new TypeError("max must be a non-negative number");this[Zk]=t.max||1/0;const e=t.length||aN;if(this[$k]="function"!=typeof e?aN:e,this[tN]=t.stale||!1,t.maxAge&&"number"!=typeof t.maxAge)throw new TypeError("maxAge must be a number");this[eN]=t.maxAge||0,this[rN]=t.dispose,this[nN]=t.noDisposeOnSet||!1,this[sN]=t.updateAgeOnGet||!1,this.reset()}set max(t){if("number"!=typeof t||t<0)throw new TypeError("max must be a non-negative number");this[Zk]=t||1/0,hN(this)}get max(){return this[Zk]}set allowStale(t){this[tN]=!!t}get allowStale(){return this[tN]}set maxAge(t){if("number"!=typeof t)throw new TypeError("maxAge must be a non-negative number");this[eN]=t,hN(this)}get maxAge(){return this[eN]}set lengthCalculator(t){"function"!=typeof t&&(t=aN),t!==this[$k]&&(this[$k]=t,this[Jk]=0,this[iN].forEach((t=>{t.length=this[$k](t.value,t.key),this[Jk]+=t.length}))),hN(this)}get lengthCalculator(){return this[$k]}get length(){return this[Jk]}get itemCount(){return this[iN].length}rforEach(t,e){e=e||this;for(let r=this[iN].tail;null!==r;){const n=r.prev;fN(this,t,r,e),r=n}}forEach(t,e){e=e||this;for(let r=this[iN].head;null!==r;){const n=r.next;fN(this,t,r,e),r=n}}keys(){return this[iN].toArray().map((t=>t.key))}values(){return this[iN].toArray().map((t=>t.value))}reset(){this[rN]&&this[iN]&&this[iN].length&&this[iN].forEach((t=>this[rN](t.key,t.value))),this[oN]=new Map,this[iN]=new Yk,this[Jk]=0}dump(){return this[iN].map((t=>!uN(this,t)&&{k:t.key,v:t.value,e:t.now+(t.maxAge||0)})).toArray().filter((t=>t))}dumpLru(){return this[iN]}set(t,e,r){if((r=r||this[eN])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,i=this[$k](e,t);if(this[oN].has(t)){if(i>this[Zk])return cN(this,this[oN].get(t)),!1;const o=this[oN].get(t).value;return this[rN]&&(this[nN]||this[rN](t,o.value)),o.now=n,o.maxAge=r,o.value=e,this[Jk]+=i-o.length,o.length=i,this.get(t),hN(this),!0}const o=new AN(t,e,i,n,r);return o.length>this[Zk]?(this[rN]&&this[rN](t,e),!1):(this[Jk]+=o.length,this[iN].unshift(o),this[oN].set(t,this[iN].head),hN(this),!0)}has(t){if(!this[oN].has(t))return!1;const e=this[oN].get(t).value;return!uN(this,e)}get(t){return lN(this,t,!0)}peek(t){return lN(this,t,!1)}pop(){const t=this[iN].tail;return t?(cN(this,t),t.value):null}del(t){cN(this,this[oN].get(t))}load(t){this.reset();const e=Date.now();for(let r=t.length-1;r>=0;r--){const n=t[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const t=i-e;t>0&&this.set(n.k,n.v,t)}}}prune(){this[oN].forEach(((t,e)=>lN(this,e,!1)))}}({max:r}),this.blockRequests=new Map,this.blockIdsToFetch=new Set}get fileSize(){return this.source.fileSize}async fetch(t,e){const r=new Map,n=new Map,i=new Set;for(const{offset:l,length:u}of t){let t=l+u;const{fileSize:e}=this;null!==e&&(t=Math.min(t,e));for(let o=Math.floor(l/this.blockSize)*this.blockSize;o<t;o+=this.blockSize){const t=Math.floor(o/this.blockSize);this.blockCache.has(t)?r.set(t,this.blockCache.get(t)):this.blockRequests.has(t)?n.set(t,this.blockRequests.get(t)):(this.blockIdsToFetch.has(t)||this.blockIdsToFetch.add(t),i.add(t))}}await async function(t){return new Promise((t=>setTimeout(t,void 0)))}(),this.fetchBlocks(e);for(const l of i){const t=this.blockRequests.get(l),e=this.blockCache.get(l);if(t)n.set(l,t);else{if(!e)throw new Error(`Block ${l} is not in the block requests`);r.set(l,e)}}let o=await Promise.allSettled(Array.from(n.values()));if(o.some((t=>"rejected"===t.status))){const t=new Set;for(const[r,i]of pN(n.keys(),o)){const{rejected:n,reason:o}=i;n&&"AbortError"===o.name&&o.signal!==e&&(this.blockIdsToFetch.add(r),t.add(r))}if(this.blockIdsToFetch.length>0){this.fetchBlocks(e);for(const e of t){const t=this.blockRequests.get(e);if(!t)throw new Error(`Block ${e} is not in the block requests`);n.set(e,t)}o=await Promise.allSettled(Array.from(n.values()))}}if(o.some((t=>"rejected"===t.status))){if(e&&e.aborted)throw new dN("Request was aborted");throw new yN(o.filter((t=>"rejected"===t.status)).map((t=>t.reason)),"Request failed")}const s=o.map((t=>t.value)),a=new Map(pN(Array.from(n.keys()),s));for(const[l,u]of r)a.set(l,u);return this.readSliceData(t,a)}fetchBlocks(t){if(this.blockIdsToFetch.size>0){const e=this.groupBlocks(this.blockIdsToFetch),r=this.source.fetch(e,t);for(let n=0;n<e.length;++n){const i=e[n];for(const e of i.blockIds){const i=(async()=>{try{const t=(await r)[n],i=e*this.blockSize,o=i-t.offset,s=Math.min(o+this.blockSize,t.data.byteLength),a=t.data.slice(o,s),l=new mN(i,a.byteLength,a);return this.blockCache.set(e,l),l}catch(i){throw"AbortError"===i.name&&(i.signal=t),i}finally{this.blockRequests.delete(e)}})();this.blockRequests.set(e,i)}}this.blockIdsToFetch.clear()}}groupBlocks(t){const e=Array.from(t).sort(((t,e)=>t-e));if(0===e.length)return[];let r=[],n=null;const i=[];for(const o of e)null===n||n+1===o?(r.push(o),n=o):(i.push(new vN(r[0]*this.blockSize,r.length*this.blockSize,r)),r=[o],n=o);return i.push(new vN(r[0]*this.blockSize,r.length*this.blockSize,r)),i}readSliceData(t,e){return t.map((t=>{const r=t.offset+t.length,n=Math.floor(t.offset/this.blockSize),i=Math.floor((t.offset+t.length)/this.blockSize),o=new ArrayBuffer(t.length),s=new Uint8Array(o);for(let a=n;a<=i;++a){const n=e.get(a),i=n.offset-t.offset;let o,l=0,u=0;i<0?l=-i:i>0&&(u=i),o=n.top-r<0?n.length-l:r-n.offset-l;const h=new Uint8Array(n.data,l,o);s.set(h,u)}return o}))}}class wN{get ok(){return this.status>=200&&this.status<=299}get status(){throw new Error("not implemented")}getHeader(t){throw new Error("not implemented")}async getData(){throw new Error("not implemented")}}class bN{constructor(t){this.url=t}async request({headers:t,credentials:e,signal:r}={}){throw new Error("request is not implemented")}}class xN extends wN{constructor(t){super(),this.response=t}get status(){return this.response.status}getHeader(t){return this.response.headers.get(t)}async getData(){return this.response.arrayBuffer?await this.response.arrayBuffer():(await this.response.buffer()).buffer}}class CN extends bN{constructor(t,e){super(t),this.credentials=e}async request({headers:t,credentials:e,signal:r}={}){const n=await fetch(this.url,{headers:t,credentials:e,signal:r});return new xN(n)}}class EN extends wN{constructor(t,e){super(),this.xhr=t,this.data=e}get status(){return this.xhr.status}getHeader(t){return this.xhr.getResponseHeader(t)}async getData(){return this.data}}class SN extends bN{constructRequest(t,e){return new Promise(((r,n)=>{const i=new XMLHttpRequest;i.open("GET",this.url),i.responseType="arraybuffer";for(const[e,o]of Object.entries(t))i.setRequestHeader(e,o);i.onload=()=>{const t=i.response;r(new EN(i,t))},i.onerror=n,i.onabort=()=>n(new dN("Request aborted")),i.send(),e&&(e.aborted&&i.abort(),e.addEventListener("abort",(()=>i.abort())))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}const BN={},IN=Object.freeze(Object.defineProperty({__proto__:null,default:BN},Symbol.toStringTag,{value:"Module"}));class TN extends wN{constructor(t,e){super(),this.response=t,this.dataPromise=e}get status(){return this.response.statusCode}getHeader(t){return this.response.headers[t]}async getData(){return await this.dataPromise}}class PN extends bN{constructor(t){super(t),this.parsedUrl=BN.parse(this.url),this.httpApi=(this.parsedUrl.protocol,BN)}constructRequest(t,e){return new Promise(((r,n)=>{const i=this.httpApi.get({...this.parsedUrl,headers:t},(t=>{const e=new Promise((e=>{const r=[];t.on("data",(t=>{r.push(t)})),t.on("end",(()=>{const t=Buffer.concat(r).buffer;e(t)})),t.on("error",n)}));r(new TN(t,e))}));i.on("error",n),e&&(e.aborted&&i.destroy(new dN("Request aborted")),e.addEventListener("abort",(()=>i.destroy(new dN("Request aborted")))))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}class FN extends zk{constructor(t,e,r,n){super(),this.client=t,this.headers=e,this.maxRanges=r,this.allowFullFile=n,this._fileSize=null}async fetch(t,e){return this.maxRanges>=t.length?this.fetchSlices(t,e):(this.maxRanges>0&&t.length,Promise.all(t.map((t=>this.fetchSlice(t,e)))))}async fetchSlices(t,e){const r=await this.client.request({headers:{...this.headers,Range:`bytes=${t.map((({offset:t,length:e})=>`${t}-${t+e}`)).join(",")}`},signal:e});if(r.ok){if(206===r.status){const{type:n,params:i}=function(t){const[e,...r]=t.split(";").map((t=>t.trim()));return{type:e,params:Gk(r.map((t=>t.split("="))))}}(r.getHeader("content-type"));if("multipart/byteranges"===n){const t=function(t,e){let r=null;const n=new TextDecoder("ascii"),i=[],o=`--${e}`,s=`${o}--`;for(let a=0;a<10;++a)n.decode(new Uint8Array(t,a,o.length))===o&&(r=a);if(null===r)throw new Error("Could not find initial boundary");for(;r<t.byteLength;){const e=n.decode(new Uint8Array(t,r,Math.min(o.length+1024,t.byteLength-r)));if(0===e.length||e.startsWith(s))break;if(!e.startsWith(o))throw new Error("Part does not start with boundary");const a=e.substr(o.length+2);if(0===a.length)break;const l=a.indexOf(Qk),u=jk(a.substr(0,l)),{start:h,end:c,total:A}=Hk(u["content-range"]),f=r+o.length+l+Qk.length,p=parseInt(c,10)+1-parseInt(h,10);i.push({headers:u,data:t.slice(f,f+p),offset:h,length:p,fileSize:A}),r=f+p+4}return i}(await r.getData(),i.boundary);return this._fileSize=t[0].fileSize||null,t}const o=await r.getData(),{start:s,end:a,total:l}=Hk(r.getHeader("content-range"));this._fileSize=l||null;const u=[{data:o,offset:s,length:a-s}];if(t.length>1){const r=await Promise.all(t.slice(1).map((t=>this.fetchSlice(t,e))));return u.concat(r)}return u}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await r.getData();return this._fileSize=t.byteLength,[{data:t,offset:0,length:t.byteLength}]}}throw new Error("Error fetching data.")}async fetchSlice(t,e){const{offset:r,length:n}=t,i=await this.client.request({headers:{...this.headers,Range:`bytes=${r}-${r+n}`},signal:e});if(i.ok){if(206===i.status){const t=await i.getData(),{total:e}=Hk(i.getHeader("content-range"));return this._fileSize=e||null,{data:t,offset:r,length:n}}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await i.getData();return this._fileSize=t.byteLength,{data:t,offset:0,length:t.byteLength}}}throw new Error("Error fetching data.")}get fileSize(){return this._fileSize}}function LN(t,{blockSize:e,cacheSize:r}){return null===e?t:new _N(t,e,r)}function MN(t,{forceXHR:e=!1,...r}={}){return"function"!=typeof fetch||e?"undefined"!=typeof XMLHttpRequest?function(t,{headers:e={},maxRanges:r=0,allowFullFile:n=!1,...i}={}){const o=new SN(t);return LN(new FN(o,e,r,n),i)}(t,r):function(t,{headers:e={},maxRanges:r=0,allowFullFile:n=!1,...i}={}){const o=new PN(t);return LN(new FN(o,e,r,n),i)}(t,r):function(t,{headers:e={},credentials:r,maxRanges:n=0,allowFullFile:i=!1,...o}={}){const s=new CN(t,r);return LN(new FN(s,e,n,i),o)}(t,r)}class ON extends zk{constructor(t){super(),this.file=t}async fetchSlice(t,e){return new Promise(((r,n)=>{const i=this.file.slice(t.offset,t.offset+t.length),o=new FileReader;o.onload=t=>r(t.target.result),o.onerror=n,o.onabort=n,o.readAsArrayBuffer(i),e&&e.addEventListener("abort",(()=>o.abort()))}))}}function kN(t){switch(t){case Sk.BYTE:case Sk.ASCII:case Sk.SBYTE:case Sk.UNDEFINED:return 1;case Sk.SHORT:case Sk.SSHORT:return 2;case Sk.LONG:case Sk.SLONG:case Sk.FLOAT:case Sk.IFD:return 4;case Sk.RATIONAL:case Sk.SRATIONAL:case Sk.DOUBLE:case Sk.LONG8:case Sk.SLONG8:case Sk.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function NN(t,e,r,n){let i=null,o=null;const s=kN(e);switch(e){case Sk.BYTE:case Sk.ASCII:case Sk.UNDEFINED:i=new Uint8Array(r),o=t.readUint8;break;case Sk.SBYTE:i=new Int8Array(r),o=t.readInt8;break;case Sk.SHORT:i=new Uint16Array(r),o=t.readUint16;break;case Sk.SSHORT:i=new Int16Array(r),o=t.readInt16;break;case Sk.LONG:case Sk.IFD:i=new Uint32Array(r),o=t.readUint32;break;case Sk.SLONG:i=new Int32Array(r),o=t.readInt32;break;case Sk.LONG8:case Sk.IFD8:i=new Array(r),o=t.readUint64;break;case Sk.SLONG8:i=new Array(r),o=t.readInt64;break;case Sk.RATIONAL:i=new Uint32Array(2*r),o=t.readUint32;break;case Sk.SRATIONAL:i=new Int32Array(2*r),o=t.readInt32;break;case Sk.FLOAT:i=new Float32Array(r),o=t.readFloat32;break;case Sk.DOUBLE:i=new Float64Array(r),o=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e!==Sk.RATIONAL&&e!==Sk.SRATIONAL)for(let a=0;a<r;++a)i[a]=o.call(t,n+a*s);else for(let a=0;a<r;a+=2)i[a]=o.call(t,n+a*s),i[a+1]=o.call(t,n+(a*s+4));return e===Sk.ASCII?new TextDecoder("utf-8").decode(i):i}class RN{constructor(t,e,r){this.fileDirectory=t,this.geoKeyDirectory=e,this.nextIFDByteOffset=r}}class UN extends Error{constructor(t){super(`No image at index ${t}`),this.index=t}}class DN{async readRasters(t={}){const{window:e,width:r,height:n}=t;let{resX:i,resY:o,bbox:s}=t;const a=await this.getImage();let l=a;const u=await this.getImageCount(),h=a.getBoundingBox();if(e&&s)throw new Error('Both "bbox" and "window" passed.');if(r||n){if(e){const[t,r]=a.getOrigin(),[n,i]=a.getResolution();s=[t+e[0]*n,r+e[1]*i,t+e[2]*n,r+e[3]*i]}const t=s||h;if(r){if(i)throw new Error("Both width and resX passed");i=(t[2]-t[0])/r}if(n){if(o)throw new Error("Both width and resY passed");o=(t[3]-t[1])/n}}if(i||o){const t=[];for(let e=0;e<u;++e){const r=await this.getImage(e),{SubfileType:n,NewSubfileType:i}=r.fileDirectory;(0===e||2===n||1&i)&&t.push(r)}t.sort(((t,e)=>t.getWidth()-e.getWidth()));for(let e=0;e<t.length;++e){const r=t[e],n=(h[2]-h[0])/r.getWidth(),s=(h[3]-h[1])/r.getHeight();if(l=r,i&&i>n||o&&o>s)break}}let c=e;if(s){const[t,e]=a.getOrigin(),[r,n]=l.getResolution(a);c=[Math.round((s[0]-t)/r),Math.round((s[1]-e)/n),Math.round((s[2]-t)/r),Math.round((s[3]-e)/n)],c=[Math.min(c[0],c[2]),Math.min(c[1],c[3]),Math.max(c[0],c[2]),Math.max(c[1],c[3])]}return l.readRasters({...t,window:c})}}let QN=class t extends DN{constructor(t,e,r,n,i={}){super(),this.source=t,this.littleEndian=e,this.bigTiff=r,this.firstIFDOffset=n,this.cache=i.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(t,e){const r=this.bigTiff?4048:1024;return new Rk((await this.source.fetch([{offset:t,length:void 0!==e?e:r}]))[0],t,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(t){const e=this.bigTiff?20:12,r=this.bigTiff?8:2;let n=await this.getSlice(t);const i=this.bigTiff?n.readUint64(t):n.readUint16(t),o=i*e+(this.bigTiff?16:6);n.covers(t,o)||(n=await this.getSlice(t,o));const s={};let a=t+(this.bigTiff?8:2);for(let h=0;h<i;a+=e,++h){const t=n.readUint16(a),e=n.readUint16(a+2),r=this.bigTiff?n.readUint64(a+4):n.readUint32(a+4);let i,o;const l=kN(e),u=a+(this.bigTiff?12:8);if(l*r<=(this.bigTiff?8:4))i=NN(n,e,r,u);else{const t=n.readOffset(u),o=kN(e)*r;i=n.covers(t,o)?NN(n,e,r,t):NN(await this.getSlice(t,o),e,r,t)}o=1===r&&-1===Ck.indexOf(t)&&e!==Sk.RATIONAL&&e!==Sk.SRATIONAL?i[0]:i,s[bk[t]]=o}const l=function(t){const e=t.GeoKeyDirectory;if(!e)return null;const r={};for(let n=4;n<=4*e[3];n+=4){const i=Bk[e[n]],o=e[n+1]?bk[e[n+1]]:null,s=e[n+2],a=e[n+3];let l=null;if(o){if(l=t[o],null==l)throw new Error(`Could not get value of geoKey '${i}'.`);"string"==typeof l?l=l.substring(a,a+s-1):l.subarray&&(l=l.subarray(a,a+s),1===s&&(l=l[0]))}else l=a;r[i]=l}return r}(s),u=n.readOffset(t+r+e*i);return new RN(s,l,u)}async requestIFD(t){if(this.ifdRequests[t])return this.ifdRequests[t];if(0===t)return this.ifdRequests[t]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[t];if(!this.ifdRequests[t-1])try{this.ifdRequests[t-1]=this.requestIFD(t-1)}catch(UW){if(UW instanceof UN)throw new UN(t);throw UW}return this.ifdRequests[t]=(async()=>{const e=await this.ifdRequests[t-1];if(0===e.nextIFDByteOffset)throw new UN(t);return this.parseFileDirectoryAt(e.nextIFDByteOffset)})(),this.ifdRequests[t]}async getImage(t=0){const e=await this.requestIFD(t);return new kk(e.fileDirectory,e.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let t=0,e=!0;for(;e;)try{await this.requestIFD(t),++t}catch(UW){if(!(UW instanceof UN))throw UW;e=!1}return t}async getGhostValues(){const t=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const e="GDAL_STRUCTURAL_METADATA_SIZE=",r=e.length+100;let n=await this.getSlice(t,r);if(e===NN(n,Sk.ASCII,e.length,t)){const e=NN(n,Sk.ASCII,r,t).split("\n")[0],i=Number(e.split("=")[1].split(" ")[0])+e.length;i>r&&(n=await this.getSlice(t,i));const o=NN(n,Sk.ASCII,i,t);this.ghostValues={},o.split("\n").filter((t=>t.length>0)).map((t=>t.split("="))).forEach((([t,e])=>{this.ghostValues[t]=e}))}return this.ghostValues}static async fromSource(e,r,n){const i=(await e.fetch([{offset:0,length:1024}],n))[0],o=new Nk(i),s=o.getUint16(0,0);let a;if(18761===s)a=!0;else{if(19789!==s)throw new TypeError("Invalid byte order value.");a=!1}const l=o.getUint16(2,a);let u;if(42===l)u=!1;else{if(43!==l)throw new TypeError("Invalid magic number.");if(u=!0,8!==o.getUint16(4,a))throw new Error("Unsupported offset byte-size.")}const h=u?o.getUint64(8,a):o.getUint32(4,a);return new t(e,a,u,h,r)}close(){return"function"==typeof this.source.close&&this.source.close()}};class GN extends DN{constructor(t,e){super(),this.mainFile=t,this.overviewFiles=e,this.imageFiles=[t].concat(e),this.fileDirectoriesPerFile=null,this.fileDirectoriesPerFileParsing=null,this.imageCount=null}async parseFileDirectoriesPerFile(){const t=[this.mainFile.parseFileDirectoryAt(this.mainFile.firstIFDOffset)].concat(this.overviewFiles.map((t=>t.parseFileDirectoryAt(t.firstIFDOffset))));return this.fileDirectoriesPerFile=await Promise.all(t),this.fileDirectoriesPerFile}async getImage(t=0){await this.getImageCount(),await this.parseFileDirectoriesPerFile();let e=0,r=0;for(let n=0;n<this.imageFiles.length;n++){const i=this.imageFiles[n];for(let o=0;o<this.imageCounts[n];o++){if(t===e){const t=await i.requestIFD(r);return new kk(t.fileDirectory,t.geoKeyDirectory,i.dataView,i.littleEndian,i.cache,i.source)}e++,r++}r=0}throw new RangeError("Invalid image index")}async getImageCount(){if(null!==this.imageCount)return this.imageCount;const t=[this.mainFile.getImageCount()].concat(this.overviewFiles.map((t=>t.getImageCount())));return this.imageCounts=await Promise.all(t),this.imageCount=this.imageCounts.reduce(((t,e)=>t+e),0),this.imageCount}}var jN,HN=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zN="STATISTICS_MAXIMUM",VN="STATISTICS_MINIMUM";function KN(t){try{return t.getBoundingBox()}catch(r){var e=t.fileDirectory;return[0,0,e.ImageWidth,e.ImageLength]}}function qN(t){try{return t.getOrigin().slice(0,2)}catch(e){return[0,t.fileDirectory.ImageLength]}}function WN(t,e){try{return t.getResolution(e)}catch(r){return[e.fileDirectory.ImageWidth/t.fileDirectory.ImageWidth,e.fileDirectory.ImageHeight/t.fileDirectory.ImageHeight]}}function XN(t){var e,r,n,i=t.geoKeys;return i?i.ProjectedCSTypeGeoKey?((r=rr(e="EPSG:"+i.ProjectedCSTypeGeoKey))||(n=J(i.ProjLinearUnitsGeoKey))&&(r=new oe({code:e,units:n})),r):i.GeographicTypeGeoKey?((r=rr(e="EPSG:"+i.GeographicTypeGeoKey))||(n=J(i.GeogAngularUnitsGeoKey))&&(r=new oe({code:e,units:n})),r):null:null}function YN(t){return t.getImageCount().then((function(e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t.getImage(n);return Promise.all(r)}))}function ZN(t,e){var r;return r=t.blob?async function(t,e){return QN.fromSource(new ON(t),void 0)}(t.blob):t.overviews?async function(t,e=[],r={},n){const i=await QN.fromSource(MN(t,r),n),o=await Promise.all(e.map((t=>QN.fromSource(MN(t,r)))));return new GN(i,o)}(t.url,t.overviews,e):async function(t,e={},r){return QN.fromSource(MN(t,e),r)}(t.url,e),r.then(YN)}function JN(t,e,r,n,i){if(Array.isArray(t)){var o=t.length;if(!Array.isArray(e)||o!=e.length){var s=new Error(n);throw i(s),s}for(var a=0;a<o;++a)JN(t[a],e[a],r,n,i)}else if(Math.abs(t-e)>r*t)throw new Error(n)}function $N(t){return t instanceof Int8Array?127:t instanceof Uint8Array||t instanceof Uint8ClampedArray?255:t instanceof Int16Array?32767:t instanceof Uint16Array?65535:t instanceof Int32Array?2147483647:t instanceof Uint32Array?4294967295:t instanceof Float32Array?34e37:255}var tR=function(t){function e(e){var r=t.call(this,{state:"loading",tileGrid:null,projection:null,opaque:e.opaque,transition:e.transition,interpolate:!1!==e.interpolate,wrapX:e.wrapX})||this;r.sourceInfo_=e.sources;var n=r.sourceInfo_.length;r.sourceOptions_=e.sourceOptions,r.sourceImagery_=new Array(n),r.resolutionFactors_=new Array(n),r.samplesPerPixel_,r.nodataValues_,r.metadata_,r.normalize_=!1!==e.normalize,r.addAlpha_=!1,r.error_=null,r.readMethod_=e.convertToRGB?"readRGB":"readRasters",r.setKey(r.sourceInfo_.map((function(t){return t.url})).join(","));for(var i=r,o=new Array(n),s=0;s<n;++s)o[s]=ZN(r.sourceInfo_[s],r.sourceOptions_);return Promise.all(o).then((function(t){i.configure_(t)})).catch((function(t){i.error_=t,i.setState("error")})),r}return HN(e,t),e.prototype.getError=function(){return this.error_},e.prototype.configure_=function(t){for(var e,r,n,i,o,s=new Array(t.length),a=new Array(t.length),l=new Array(t.length),u=0,h=t.length,c=function(h){var c=t[h],f=c.length,p=void 0,d=void 0,g=new Array(f),y=new Array(f),m=new Array(f);a[h]=new Array(f),l[h]=new Array(f);for(var v=0;v<f;++v){var _=c[v],w=_.getGDALNoData();l[h][v]=_.getGDALMetadata(0),a[h][v]=w;var b=A.sourceInfo_[h].bands;s[h]=b?b.length:_.getSamplesPerPixel();var x=f-(v+1);p||(p=KN(_)),d||(d=qN(_));var C=WN(_,c[0]);m[x]=C[0];var E=[_.getTileWidth(),_.getTileHeight()];g[x]=E;var S=C[0]/Math.abs(C[1]);y[x]=[E[0],E[1]/S]}if(e?Xt(e,p,e):e=p,r){var B="Origin mismatch for source ".concat(h,", got [").concat(d,"] but expected [").concat(r,"]");JN(r,d,0,B,A.viewRejector)}else r=d;if(o){o.length-u>m.length&&(u=o.length-m.length);var I=o[o.length-1]/m[m.length-1];A.resolutionFactors_[h]=I;var T=m.map((function(t){return t*I}));B="Resolution mismatch for source ".concat(h,", got [").concat(T,"] but expected [").concat(o,"]"),JN(o.slice(u,o.length),T,.02,B,A.viewRejector)}else o=m,A.resolutionFactors_[h]=1;n?JN(n.slice(u,n.length),y,.01,"Tile size mismatch for source ".concat(h),A.viewRejector):n=y,i?JN(i.slice(u,i.length),g,0,"Tile size mismatch for source ".concat(h),A.viewRejector):i=g,A.sourceImagery_[h]=c.reverse()},A=this,f=0;f<h;++f)c(f);for(var p=0,d=this.sourceImagery_.length;p<d;++p)for(var g=this.sourceImagery_[p];g.length<o.length;)g.unshift(void 0);if(!this.getProjection()){var y=t[0];for(p=y.length-1;p>=0;--p){var m=XN(y[p]);if(m){this.projection=m;break}}}this.samplesPerPixel_=s,this.nodataValues_=a,this.metadata_=l;t:for(f=0;f<h;++f){if(void 0!==this.sourceInfo_[f].nodata){this.addAlpha_=!0;break}var v=a[f],_=this.sourceInfo_[f].bands;if(_){for(p=0;p<_.length;++p)if(null!==v[_[p]-1]){this.addAlpha_=!0;break t}}else for(var w=0;w<v.length;++w)if(null!==v[w]){this.addAlpha_=!0;break t}}var b=this.addAlpha_?1:0;this.bandCount=s.reduce((function(t,e){return t+e}),0)+b;var x=new FA({extent:e,minZoom:u,origin:r,resolutions:o,tileSizes:n});this.tileGrid=x,this.setTileSizes(i),this.setLoader(this.loadTile_.bind(this)),this.setState("ready"),this.viewResolver({projection:this.projection,resolutions:o,center:_r(zt(e),this.projection),extent:br(e,this.projection),zoom:0})},e.prototype.loadTile_=function(t,e,r){for(var n=this.getTileSize(t),i=this.sourceImagery_.length,o=new Array(i),s=this.addAlpha_,a=this.bandCount,l=this.samplesPerPixel_,u=this.nodataValues_,h=this.sourceInfo_,c=function(i){var s,a=h[i],l=A.resolutionFactors_[i],c=[Math.round(e*(n[0]*l)),Math.round(r*(n[1]*l)),Math.round((e+1)*(n[0]*l)),Math.round((r+1)*(n[1]*l))],f=A.sourceImagery_[i][t],p=void 0;a.bands&&(p=a.bands.map((function(t){return t-1}))),s="nodata"in a&&null!==a.nodata?a.nodata:p?p.map((function(t){return u[i][t]})):u[i],o[i]=f[A.readMethod_]({window:c,width:n[0],height:n[1],samples:p,fillValue:s,pool:(jN||(jN=new Dk),jN),interleave:!1})},A=this,f=0;f<i;++f)c(f);var p=n[0]*n[1],d=p*a,g=this.normalize_,y=this.metadata_;return Promise.all(o).then((function(t){var e;e=g?new Uint8Array(d):new Float32Array(d);for(var r,n=0,o=0;o<p;++o){for(var a=s,c=0;c<i;++c){var A=h[c],f=A.min,m=A.max,v=void 0,_=void 0;if(g){var w=y[c][0];void 0===f&&(f=w&&VN in w?parseFloat(w[VN]):(r=t[c][0])instanceof Int8Array?-128:r instanceof Int16Array?-32768:r instanceof Int32Array?-2147483648:r instanceof Float32Array?12e-39:0),void 0===m&&(m=w&&zN in w?parseFloat(w[zN]):$N(t[c][0])),_=-f*(v=255/(m-f))}for(var b=0;b<l[c];++b){var x,C=t[c][b][o];if(x=g?se(v*C+_,0,255):C,s){var E,S=A.nodata;if(void 0===S)E=A.bands?A.bands[b]-1:b,S=u[c][E];var B=isNaN(S);(!B&&C!==S||B&&!isNaN(C))&&(a=!1,e[n]=x)}else e[n]=x;n++}}s&&(a||(e[n]=255),n++)}return e})).catch((function(t){throw t}))},e}(sO);tR.prototype.getView;const eR=tR;var rR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const nR=function(t){function e(e,r,n,i,o,s,a){var l=this,u=e.getExtent(),h=r.getExtent(),c=h?Xt(n,h):n,A=fA(e,r,zt(c),i),f=new lA(e,r,c,u,A*gc,i),p=s(f.calculateSourceExtent(),A,o),d=p?Nn.IDLE:Nn.EMPTY,g=p?p.getPixelRatio():1;return(l=t.call(this,n,i,g,d)||this).targetProj_=r,l.maxSourceExtent_=u,l.triangulation_=f,l.targetResolution_=i,l.targetExtent_=n,l.sourceImage_=p,l.sourcePixelRatio_=g,l.interpolate_=a,l.canvas_=null,l.sourceListenerKey_=null,l}return rR(e,t),e.prototype.disposeInternal=function(){this.state==Nn.LOADING&&this.unlistenSource_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.getProjection=function(){return this.targetProj_},e.prototype.reproject_=function(){var t=this.sourceImage_.getState();if(t==Nn.LOADED){var e=Jt(this.targetExtent_)/this.targetResolution_,r=Wt(this.targetExtent_)/this.targetResolution_;this.canvas_=pA(e,r,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_)}this.state=t,this.changed()},e.prototype.load=function(){if(this.state==Nn.IDLE){this.state=Nn.LOADING,this.changed();var t=this.sourceImage_.getState();t==Nn.LOADED||t==Nn.ERROR?this.reproject_():(this.sourceListenerKey_=F(this.sourceImage_,P.CHANGE,(function(t){var e=this.sourceImage_.getState();e!=Nn.LOADED&&e!=Nn.ERROR||(this.unlistenSource_(),this.reproject_())}),this),this.sourceImage_.load())}},e.prototype.unlistenSource_=function(){M(this.sourceListenerKey_),this.sourceListenerKey_=null},e}(us);var iR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),oR=function(t){function e(e,r){var n=t.call(this,e)||this;return n.image=r,n}return iR(e,t),e}(c);function sR(t,e){t.getImage().src=e}const aR=function(t){function e(e){var r=this,n=void 0===e.imageSmoothing||e.imageSmoothing;return void 0!==e.interpolate&&(n=e.interpolate),(r=t.call(this,{attributions:e.attributions,projection:e.projection,state:e.state,interpolate:n})||this).on,r.once,r.un,r.resolutions_=void 0!==e.resolutions?e.resolutions:null,r.reprojectedImage_=null,r.reprojectedRevision_=0,r}return iR(e,t),e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.findNearestResolution=function(t){if(this.resolutions_){var e=g(this.resolutions_,t,0);t=this.resolutions_[e]}return t},e.prototype.getImage=function(t,e,r,n){var i=this.getProjection();if(i&&n&&!hr(i,n)){if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&hr(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&kt(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new nR(i,n,t,e,r,function(t,e,r){return this.getImageInternal(t,e,r,i)}.bind(this),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}return i&&(n=i),this.getImageInternal(t,e,r,n)},e.prototype.getImageInternal=function(t,e,r,n){return i()},e.prototype.handleImageChange=function(t){var e,r=t.target;switch(r.getState()){case Nn.LOADING:this.loading=!0,e="imageloadstart";break;case Nn.LOADED:this.loading=!1,e="imageloadend";break;case Nn.ERROR:this.loading=!1,e="imageloaderror";break;default:return}this.hasListener(e)&&this.dispatchEvent(new oR(e,r))},e}(Us);function lR(t,e){var r=[];Object.keys(e).forEach((function(t){null!==e[t]&&void 0!==e[t]&&r.push(t+"="+encodeURIComponent(e[t]))}));var n=r.join("&");return(t=-1===(t=t.replace(/[?&]$/,"")).indexOf("?")?t+"?":t+"&")+n}var uR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const hR=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;return void 0!==n.interpolate&&(i=n.interpolate),(r=t.call(this,{attributions:n.attributions,interpolate:i,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.hidpi_=void 0===n.hidpi||n.hidpi,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:sR,r.params_=n.params||{},r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return uR(e,t),e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),r=this.hidpi_?r:1;var i=this.image_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&It(i.getExtent(),t))return i;var o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};x(o,this.params_);var s=((t=t.slice())[0]+t[2])/2,a=(t[1]+t[3])/2;if(1!=this.ratio_){var l=this.ratio_*Jt(t)/2,u=this.ratio_*Wt(t)/2;t[0]=s-l,t[1]=a-u,t[2]=s+l,t[3]=a+u}var h=e/r,c=Math.ceil(Jt(t)/h),A=Math.ceil(Wt(t)/h);t[0]=s-h*c/2,t[2]=s+h*c/2,t[1]=a-h*A/2,t[3]=a+h*A/2,this.imageSize_[0]=c,this.imageSize_[1]=A;var f=this.getRequestUrl_(t,this.imageSize_,r,n,o);return this.image_=new cs(t,e,r,f,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(P.CHANGE,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){var o=n.getCode().split(/:(?=\d+$)/).pop();i.SIZE=e[0]+","+e[1],i.BBOX=t.join(","),i.BBOXSR=o,i.IMAGESR=o,i.DPI=Math.round(90*r);var s=this.url_,a=s.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return a==s&&K(!1,50),lR(a,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){x(this.params_,t),this.image_=null,this.changed()},e}(aR);var cR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const AR=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;return void 0!==n.interpolate&&(i=n.interpolate),(r=t.call(this,{attributions:n.attributions,interpolate:i,projection:n.projection,resolutions:n.resolutions,state:n.state})||this).canvasFunction_=n.canvasFunction,r.canvas_=null,r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return cR(e,t),e.prototype.getImageInternal=function(t,e,r,n){e=this.findNearestResolution(e);var i=this.canvas_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&It(i.getExtent(),t))return i;ee(t=t.slice(),this.ratio_);var o=[Jt(t)/e*r,Wt(t)/e*r],s=this.canvasFunction_.call(this,t,e,r,o,n);return s&&(i=new Ws(t,e,r,s)),this.canvas_=i,this.renderedRevision_=this.getRevision(),i},e}(aR);var fR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const pR=function(t){function e(e){var r=this,n=void 0!==e.crossOrigin?e.crossOrigin:null,i=void 0!==e.imageLoadFunction?e.imageLoadFunction:sR,o=void 0===e.imageSmoothing||e.imageSmoothing;return void 0!==e.interpolate&&(o=e.interpolate),(r=t.call(this,{attributions:e.attributions,interpolate:o,projection:rr(e.projection)})||this).url_=e.url,r.imageExtent_=e.imageExtent,r.image_=new cs(r.imageExtent_,void 0,1,r.url_,n,i),r.imageSize_=e.imageSize?e.imageSize:null,r.image_.addEventListener(P.CHANGE,r.handleImageChange.bind(r)),r}return fR(e,t),e.prototype.getImageExtent=function(){return this.imageExtent_},e.prototype.getImageInternal=function(t,e,r,n){return $t(t,this.image_.getExtent())?this.image_:null},e.prototype.getUrl=function(){return this.url_},e.prototype.handleImageChange=function(e){if(this.image_.getState()==Nn.LOADED){var r=this.image_.getExtent(),n=this.image_.getImage(),i=void 0,o=void 0;this.imageSize_?(i=this.imageSize_[0],o=this.imageSize_[1]):(i=n.width,o=n.height);var s=Jt(r),a=Wt(r),l=s/i,u=a/o,h=i,c=o;if(l>u?h=Math.round(s/u):c=Math.round(a/l),h!==i||c!==o){var A=Zn(h,c);this.getInterpolate()||x(A,yc);var f=A.canvas;A.drawImage(n,0,0,i,o,0,0,f.width,f.height),this.image_.setImage(f)}}t.prototype.handleImageChange.call(this,e)},e}(aR);var dR="1.3.0",gR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),yR=[101,101];const mR=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;return void 0!==n.interpolate&&(i=n.interpolate),(r=t.call(this,{attributions:n.attributions,interpolate:i,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:sR,r.params_=n.params||{},r.v13_=!0,r.updateV13_(),r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return gR(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){if(void 0!==this.url_){var i=rr(r),o=this.getProjection();o&&o!==i&&(e=fA(o,i,t,e),t=fr(t,i,o));var s=Kt(t,e,0,yR),a={SERVICE:"WMS",VERSION:dR,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};x(a,this.params_,n);var l=ge((t[0]-s[0])/e,4),u=ge((s[3]-t[1])/e,4);return a[this.v13_?"I":"X"]=l,a[this.v13_?"J":"Y"]=u,this.getRequestUrl_(s,yR,1,o||i,a)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.url_){var r={SERVICE:"WMS",VERSION:dR,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(Array.isArray(n)&&1!==n.length)return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i/28e-5}return x(r,e),lR(this.url_,r)}},e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),1==r||this.hidpi_&&void 0!==this.serverType_||(r=1);var i=e/r,o=zt(t),s=Kt(o,i,0,[ye(Jt(t)/i,4),ye(Wt(t)/i,4)]),a=Kt(o,i,0,[ye(this.ratio_*Jt(t)/i,4),ye(this.ratio_*Wt(t)/i,4)]),l=this.image_;if(l&&this.renderedRevision_==this.getRevision()&&l.getResolution()==e&&l.getPixelRatio()==r&&It(l.getExtent(),s))return l;var u={SERVICE:"WMS",VERSION:dR,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};x(u,this.params_),this.imageSize_[0]=de(Jt(a)/i,4),this.imageSize_[1]=de(Wt(a)/i,4);var h=this.getRequestUrl_(a,this.imageSize_,r,n,u);return this.image_=new cs(a,e,r,h,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(P.CHANGE,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){if(K(void 0!==this.url_,9),i[this.v13_?"CRS":"SRS"]=n.getCode(),"STYLES"in this.params_||(i.STYLES=""),1!=r)switch(this.serverType_){case"geoserver":var o=90*r+.5|0;"FORMAT_OPTIONS"in i?i.FORMAT_OPTIONS+=";dpi:"+o:i.FORMAT_OPTIONS="dpi:"+o;break;case"mapserver":i.MAP_RESOLUTION=90*r;break;case"carmentaserver":case"qgis":i.DPI=90*r;break;default:K(!1,8)}i.WIDTH=e[0],i.HEIGHT=e[1];var s,a=n.getAxisOrientation();return s=this.v13_&&"ne"==a.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,i.BBOX=s.join(","),lR(this.url_,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){x(this.params_,t),this.updateV13_(),this.image_=null,this.changed()},e.prototype.updateV13_=function(){var t=this.params_.VERSION||dR;this.v13_=function(t,e){for(var r=(""+t).split("."),n="1.3".split("."),i=0;i<Math.max(r.length,n.length);i++){var o=parseInt(r[i]||"0",10),s=parseInt(n[i]||"0",10);if(o>s)return 1;if(s>o)return-1}return 0}(t)>=0},e}(aR);var vR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const _R=function(t){function e(e){var r=t.call(this,{extent:e.extent,origin:e.origin,origins:e.origins,resolutions:e.resolutions,tileSize:e.tileSize,tileSizes:e.tileSizes,sizes:e.sizes})||this;return r.matrixIds_=e.matrixIds,r}return vR(e,t),e.prototype.getMatrixId=function(t){return this.matrixIds_[t]},e.prototype.getMatrixIds=function(){return this.matrixIds_},e}(FA);var wR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const bR=function(t){function e(e){var r=this,n=void 0===e.imageSmoothing||e.imageSmoothing;void 0!==e.interpolate&&(n=e.interpolate);var i=void 0!==e.requestEncoding?e.requestEncoding:"KVP",o=e.tileGrid,s=e.urls;return void 0===s&&void 0!==e.url&&(s=VA(e.url)),(r=t.call(this,{attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:n,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:o,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,urls:s,wrapX:void 0!==e.wrapX&&e.wrapX,transition:e.transition,zDirection:e.zDirection})||this).version_=void 0!==e.version?e.version:"1.0.0",r.format_=void 0!==e.format?e.format:"image/jpeg",r.dimensions_=void 0!==e.dimensions?e.dimensions:{},r.layer_=e.layer,r.matrixSet_=e.matrixSet,r.style_=e.style,r.requestEncoding_=i,r.setKey(r.getKeyForDimensions_()),s&&s.length>0&&(r.tileUrlFunction=zA(s.map(r.createFromWMTSTemplate.bind(r)))),r}return wR(e,t),e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(zA(t.map(this.createFromWMTSTemplate.bind(this))),e)},e.prototype.getDimensions=function(){return this.dimensions_},e.prototype.getFormat=function(){return this.format_},e.prototype.getLayer=function(){return this.layer_},e.prototype.getMatrixSet=function(){return this.matrixSet_},e.prototype.getRequestEncoding=function(){return this.requestEncoding_},e.prototype.getStyle=function(){return this.style_},e.prototype.getVersion=function(){return this.version_},e.prototype.getKeyForDimensions_=function(){var t=0,e=[];for(var r in this.dimensions_)e[t++]=r+"-"+this.dimensions_[r];return e.join("/")},e.prototype.updateDimensions=function(t){x(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())},e.prototype.createFromWMTSTemplate=function(t){var e=this.requestEncoding_,r={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};"KVP"==e&&x(r,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t="KVP"==e?lR(t,r):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in r?r[e.toLowerCase()]:t}));var n=this.tileGrid,i=this.dimensions_;return function(r,o,s){if(r){var a={TileMatrix:n.getMatrixId(r[0]),TileCol:r[1],TileRow:r[2]};x(a,i);var l=t;return"KVP"==e?lR(l,a):l.replace(/\{(\w+?)\}/g,(function(t,e){return a[e]}))}}},e}(lf);class xR extends by{constructor(t){super(),r(this,"_map"),r(this,"segmentStyles"),r(this,"clearPrevious"),r(this,"showSegments"),r(this,"_tipPoint"),r(this,"_draw"),r(this,"isdraw"),r(this,"_source"),r(this,"layer"),r(this,"style"),r(this,"labelStyle"),r(this,"tipStyle"),r(this,"modifyStyle"),r(this,"segmentStyle"),r(this,"_modify"),this._map=t,this.segmentStyles=[],this.clearPrevious=!1,this.showSegments=!0,this._tipPoint=void 0,this.isdraw=!1,this._source=new Ks,this.layer=new Ms({source:this._source,zIndex:1e3,style:t=>this.styleFunction(t,this.showSegments,null,null)}),this.style=new Gi({fill:new Tn({color:"rgba(255, 255, 255, 0.2)"}),stroke:new kn({color:"rgba(255, 255, 0, 1)",lineDash:[10,10],width:2}),image:new ki({radius:5,stroke:new kn({color:"rgba(0, 0, 0, 1)"}),fill:new Tn({color:"rgba(255, 255, 255, 0.2)"})})}),this.labelStyle=new Gi({text:new zi({font:"14px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 1)"}),padding:[3,3,3,3],textBaseline:"bottom",offsetY:-15}),image:new Mi({radius:8,points:3,angle:Math.PI,displacement:[0,10],fill:new Tn({color:"rgba(0, 0, 0, 1)"})})}),this.tipStyle=new Gi({text:new zi({font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.8)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.modifyStyle=new Gi({image:new ki({radius:5,stroke:new kn({color:"rgba(255, 255,255, 0.7)"}),fill:new Tn({color:"rgba(0, 255, 255, 0.8)"})}),text:new zi({text:"拖动点修改图形",font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.7)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.segmentStyle=new Gi({text:new zi({font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.8)"}),padding:[2,2,2,2],textBaseline:"bottom",offsetY:-12}),image:new Mi({radius:6,points:3,angle:Math.PI,displacement:[0,8],fill:new Tn({color:"rgba(0, 0, 0, 0.8)"})})}),this._modify=new Ju({source:this._source,style:this.modifyStyle}),this._map.addLayer(this.layer),this._map.addInteraction(this._modify)}getSource(){return this._source}clear(){this._source.clear()}formatLength(t){const e=We(t);let r;return r=e>1e3?Math.round(e/1e3*100)/100+" km":Math.round(100*e)/100+" m",r}formatArea(t){const e=Ye(t);let r;return r=e>1e5?Math.round(e/1e6*100)/100+" km²":Math.round(100*e)/100+" m²",r}styleFunction(t,e,r,n){this.segmentStyles=[this.segmentStyle];const i=[this.style],o=t.getGeometry(),s=o.getType();let a,l,u;if(r&&r!==s||("Polygon"===s?(a=o.getInteriorPoint(),l=this.formatArea(o),u=new On(o.getCoordinates()[0])):"LineString"===s&&(a=new rn(o.getLastCoordinate()),l=this.formatLength(o),u=o)),e&&u){let t=0;u.forEachSegment(((e,r)=>{const n=new On([e,r]),o=this.formatLength(n);this.segmentStyles.length-1<t&&this.segmentStyles.push(this.segmentStyle.clone());const s=new rn(n.getCoordinateAt(.5));this.segmentStyles[t].setGeometry(s),this.segmentStyles[t].getText().setText(o),i.push(this.segmentStyles[t]),t++}))}return l&&(this.labelStyle.setGeometry(a),this.labelStyle.getText().setText(l),i.push(this.labelStyle)),n&&"Point"===s&&!this._modify.getOverlay().getSource().getFeatures().length&&(this._tipPoint=o,this.tipStyle.getText().setText(n),i.push(this.tipStyle)),i}stopMeasure(){this._draw.setActive(!1),this._map.removeInteraction(this._draw),this.isdraw=!1}addInteraction(t){if(this.isdraw)return;this.isdraw=!0;const e="单击继续绘制,双击结束绘制"+("Polygon"===t?"多边形":"线"),r="点击任意位置";let n=r;this._draw=new Gu({source:this._source,type:t,style:e=>this.styleFunction(e,!0,t,n)}),this._draw.on("drawstart",(t=>{this.clearPrevious&&this._source.clear(),this._modify.setActive(!1),n=e,this.trigger(jy.onDrawStart,t)})),this._draw.on("drawend",(t=>{this.isdraw=!1,this._modify.setActive(!0),n=r,t.feature.setProperties({featuretype:qy.Measure}),this.trigger(jy.onDrawEnd,t)})),this._modify.setActive(!0),this._map.addInteraction(this._draw)}}var CR=function(t){D.call(this,t),this._listener=[],t&&!1===t.active?this.set("active",!1):this.set("active",!0)};cm(CR,D),CR.prototype.setActive=function(t){this.set("active",!0===t)},CR.prototype.getActive=function(){return this.get("active")},function(){function t(t){this.get("active")&&t.context&&this.precompose(t)}function e(t){this.get("active")&&t.context&&this.postcompose(t)}function r(){if(this.renderSync)try{this.renderSync()}catch(UW){}else this.changed()}function n(n){this.filters_||(this.filters_=[]),this.filters_.push(n),n.addToLayer&&n.addToLayer(this),n.precompose&&n._listener.push({listener:this.on(["precompose","prerender"],t.bind(n)),target:this}),n.postcompose&&n._listener.push({listener:this.on(["postcompose","postrender"],e.bind(n)),target:this}),n._listener.push({listener:n.on("propertychange",r.bind(this)),target:this}),r.call(this)}function i(t){var e;if(this.filters_||(this.filters_=[]),t){for(e=this.filters_.length-1;e>=0;e--)this.filters_[e]===t&&this.filters_.splice(e,1);for(e=t._listener.length-1;e>=0;e--)t._listener[e].target===this&&(t.removeFromLayer&&t.removeFromLayer(this),N(t._listener[e].listener),t._listener.splice(e,1));r.call(this)}else this.filters_.forEach(function(t){this.removeFilter(t)}.bind(this))}fh.prototype.addFilter=function(t){n.call(this,t)},fh.prototype.removeFilter=function(t){i.call(this,t)},fh.prototype.getFilters=function(){return this.filters_||[]},qi.prototype.addFilter=function(t){n.call(this,t)},qi.prototype.removeFilter=function(t){i.call(this,t)},qi.prototype.getFilters=function(){return this.filters_||[]}}();var ER=function(t){if(CR.call(this,t=t||{}),t.feature)switch(t.feature.getGeometry().getType()){case"Polygon":case"MultiPolygon":this.feature_=t.feature}this.set("inner",t.inner),this.fillColor_=t.fill&&jn(t.fill.getColor())||"rgba(0,0,0,0.2)"};cm(ER,CR),ER.prototype.drawFeaturePath_=function(t,e){var r,n=t.context,i=n.canvas,o=t.frameState.pixelRatio;if(t.frameState.coordinateToPixelTransform){var s=t.frameState.coordinateToPixelTransform;if(t.inversePixelTransform){var a=t.inversePixelTransform;r=function(t){return[(t=[t[0]*s[0]+t[1]*s[1]+s[4],t[0]*s[2]+t[1]*s[3]+s[5]])[0]*a[0]-t[1]*a[1]+a[4],-t[0]*a[2]+t[1]*a[3]+a[5]]}}else r=function(t){return[(t[0]*s[0]+t[1]*s[1]+s[4])*o,(t[0]*s[2]+t[1]*s[3]+s[5])*o]}}else s=t.frameState.coordinateToPixelMatrix,r=function(t){return[(t[0]*s[0]+t[1]*s[1]+s[12])*o,(t[0]*s[4]+t[1]*s[5]+s[13])*o]};var l=this.feature_.getGeometry().getCoordinates();function u(t){for(var e=0;e<l.length;e++)for(var i=l[e],o=0;o<i.length;o++){var s=r([i[o][0][0]+t,i[o][0][1]]);n.moveTo(s[0],s[1]);for(var a=1;a<i[o].length;a++)s=r([i[o][a][0]+t,i[o][a][1]]),n.lineTo(s[0],s[1])}}if("Polygon"===this.feature_.getGeometry().getType()&&(l=[l]),n.beginPath(),e&&(n.moveTo(0,0),n.lineTo(i.width,0),n.lineTo(i.width,i.height),n.lineTo(0,i.height),n.lineTo(0,0)),this.get("wrapX")){var h=t.frameState.viewState.projection.getExtent(),c=h[2]-h[0],A=t.frameState.extent,f=this.feature_.getGeometry().getExtent(),p=f[2]-f[1],d=Math.floor((A[0]+p-h[0])/c),g=Math.floor((A[2]-p-h[2])/c)+1;d>g&&([d,g]=[g,d]);for(var y=d;y<=g;y++)u(y*c)}else u(0)},ER.prototype.postcompose=function(t){if(this.feature_){var e=t.context;e.save(),this.drawFeaturePath_(t,!this.get("inner")),e.fillStyle=this.fillColor_,e.fill("evenodd"),e.restore()}};var SR=function(t){CR.call(this,t=t||{}),this.set("blur",t.blur||8),this.set("intensity",t.intensity||.8)};cm(SR,CR),SR.prototype.precompose=function(){},SR.prototype.postcompose=function(t){var e=t.context,r=e.canvas,n=r.width,i=r.height,o=document.createElement("canvas");o.width=n,o.height=i;var s=o.getContext("2d");s.filter="grayscale(1) invert(1) blur("+this.get("blur")+"px)",s.drawImage(r,0,0),e.save(),this.get("color")?(e.globalCompositeOperation="darken",e.globalAlpha=.3,e.drawImage(r,0,0)):(e.filter="grayscale(1)",e.drawImage(r,0,0)),e.globalCompositeOperation="color-dodge",e.globalAlpha=this.get("intensity"),e.drawImage(o,0,0),e.restore()};var BR=function(t){CR.call(this,t),this.setFilter(t)};cm(BR,CR),BR.prototype.setFilter=function(t){switch(t=t||{}){case"grayscale":t={operation:"hue",color:[0,0,0],value:1};break;case"invert":t={operation:"difference",color:[255,255,255],value:1};break;case"sepia":t={operation:"color",color:[153,102,51],value:.6}}var e,r=t.color?qn(t.color):[t.red,t.green,t.blue,t.value];switch(this.set("color",jn(r)),this.set("value",t.value||1),this.set("preserveAlpha",t.preserveAlpha),t.operation){case"hue":case"difference":case"color-dodge":case"enhance":this.set("operation",t.operation);break;case"saturation":e=255*(t.value||0),this.set("color",jn([0,0,e,e||1])),this.set("operation",t.operation);break;case"luminosity":e=255*(t.value||0),this.set("color",jn([e,e,e,255])),this.set("operation","hard-light");break;case"contrast":e=255*(t.value||0),this.set("color",jn([e,e,e,255])),this.set("operation","soft-light");break;default:this.set("operation","color"),this.setValue(t.value||1)}},BR.prototype.setValue=function(t){this.set("value",t);var e=qn(this.get("color"));e[3]=t,this.set("color",jn(e))},BR.prototype.setColor=function(t){(t=qn(t))&&(t[3]=this.get("value"),this.set("color",jn(t)))},BR.prototype.precompose=function(){},BR.prototype.postcompose=function(t){var e,r,n=t.context,i=n.canvas;if(n.save(),"enhance"==this.get("operation")){var o=this.get("value");if(o){var s=i.width,a=i.height;this.get("preserveAlpha")?((e=document.createElement("CANVAS")).width=i.width,e.height=i.height,(r=e.getContext("2d")).drawImage(i,0,0,s,a),r.globalCompositeOperation="color-burn",r.globalAlpha=o,r.drawImage(e,0,0,s,a),r.drawImage(e,0,0,s,a),r.drawImage(e,0,0,s,a),n.globalCompositeOperation="source-in",n.drawImage(e,0,0)):(n.globalCompositeOperation="color-burn",n.globalAlpha=o,n.drawImage(i,0,0,s,a),n.drawImage(i,0,0,s,a),n.drawImage(i,0,0,s,a))}}else this.get("preserveAlpha")?((e=document.createElement("CANVAS")).width=i.width,e.height=i.height,(r=e.getContext("2d")).drawImage(i,0,0),r.globalCompositeOperation=this.get("operation"),r.fillStyle=this.get("color"),r.fillRect(0,0,i.width,i.height),n.globalCompositeOperation="source-in",n.drawImage(e,0,0)):(n.globalCompositeOperation=this.get("operation"),n.fillStyle=this.get("color"),n.fillRect(0,0,i.width,i.height));n.restore()};var IR=function(t){CR.call(this,t),this._svg={}};cm(IR,CR),IR.prototype.addSVGFilter=function(t){t.getId&&(t="#"+t.getId()),this._svg[t]=1,this.dispatchEvent({type:"propertychange",key:"svg",oldValue:this._svg})},IR.prototype.removeSVGFilter=function(t){t.getId&&(t="#"+t.getId()),delete this._svg[t],this.dispatchEvent({type:"propertychange",key:"svg",oldValue:this._svg})},IR.prototype.precompose=function(){},IR.prototype.postcompose=function(t){var e=[];for(var r in void 0!==this.get("url")&&e.push("url("+this.get("url")+")"),this._svg)e.push("url("+r+")");void 0!==this.get("blur")&&e.push("blur("+this.get("blur")+"px)"),void 0!==this.get("brightness")&&e.push("brightness("+this.get("brightness")+"%)"),void 0!==this.get("contrast")&&e.push("contrast("+this.get("contrast")+"%)"),void 0!==this.get("shadow")&&e.push("drop-shadow("+this.get("shadow")[0]+"px "+this.get("shadow")[1]+"px "+(this.get("shadowBlur")||0)+"px "+this.get("shadowColor")+")"),void 0!==this.get("grayscale")&&e.push("grayscale("+this.get("grayscale")+"%)"),void 0!==this.get("sepia")&&e.push("sepia("+this.get("sepia")+"%)"),void 0!==this.get("hueRotate")&&e.push("hue-rotate("+this.get("hueRotate")+"deg)"),void 0!==this.get("invert")&&e.push("invert("+this.get("invert")+"%)"),void 0!==this.get("saturate")&&e.push("saturate("+this.get("saturate")+"%)"),(e=e.join(" "))&&(t.context.save(),t.context.filter=e,t.context.drawImage(t.context.canvas,0,0),t.context.restore())};var TR=function(t){"string"==typeof t&&(t={feoperation:t}),t&&t.feoperation&&(D.call(this),this._name=t.feoperation,this.element=document.createElementNS(this.NS,this._name),this.setProperties(t),t.operations instanceof Array&&this.appendChild(t.operations))};cm(TR,D),TR.prototype.NS="http://www.w3.org/2000/svg",TR.prototype.getName=function(){return this._name},TR.prototype.set=function(t,e){/^feoperation$|^operations$/.test(t)||(D.prototype.set.call(this,t,e),this.element.setAttribute(t,e))},TR.prototype.setProperties=function(t){for(var e in t=t||{})this.set(e,t[e])},TR.prototype.geElement=function(){return this.element},TR.prototype.appendChild=function(t){t instanceof Array?t.forEach(function(t){this.appendChild(t)}.bind(this)):(t instanceof TR||(t=new TR(t)),this.element.appendChild(t.geElement()))};var PR=function(t){t=t||{},D.call(this),PR.prototype.svg||(PR.prototype.svg=document.createElementNS(this.NS,"svg"),PR.prototype.svg.setAttribute("version","1.1"),PR.prototype.svg.setAttribute("width",0),PR.prototype.svg.setAttribute("height",0),PR.prototype.svg.style.position="absolute",document.body.appendChild(PR.prototype.svg)),this.element=document.createElementNS(this.NS,"filter"),this._id=t.id||"_ol_SVGFilter_"+PR.prototype._id++,this.element.setAttribute("id",this._id),t.color&&this.element.setAttribute("color-interpolation-filters",t.color),t.operation&&this.addOperation(t.operation),PR.prototype.svg.appendChild(this.element)};cm(PR,D),PR.prototype.NS="http://www.w3.org/2000/svg",PR.prototype.svg=null,PR.prototype._id=0,PR.prototype.getId=function(){return this._id},PR.prototype.remove=function(){this.element.remove()},PR.prototype.addOperation=function(t){t instanceof Array?t.forEach(function(t){this.addOperation(t)}.bind(this)):(t instanceof TR||(t=new TR(t)),this.element.appendChild(t.geElement()))},PR.prototype.grayscale=function(t){this.addOperation({feoperation:"feColorMatrix",type:"saturate",values:t||0})},PR.prototype.luminanceToAlpha=function(t){t=t||{},this.addOperation({feoperation:"feColorMatrix",type:"luminanceToAlpha"}),t.gamma&&this.addOperation({feoperation:"feComponentTransfer",operations:[{feoperation:"feFuncA",type:"gamma",amplitude:t.gamma,exponent:1,offset:0}]})},PR.prototype.applyTo=function(t){var e=document.createElement("CANVAS");return e.width=t.naturalWidth||t.width,e.height=t.naturalHeight||t.height,e.getContext("2d").filter="url(#"+this.getId()+")",e.getContext("2d").drawImage(t,0,0),e};class FR extends Ky{constructor(t,e){super(t,e),r(this,"mask"),r(this,"pencil"),r(this,"colorize"),r(this,"canvasFilter"),r(this,"emboss"),r(this,"embossFilter"),r(this,"erode"),r(this,"erodeFilter"),r(this,"paperFilter"),r(this,"mImageExtent"),this.layerclass="tilelayer",this.mImageExtent=null,this.option={zIndex:900,projection:"EPSG:3857",url:"",ImageExtent:null,ImageExtentWKID:Yy.EPSG3857,opacity:1},this.option=Object.assign({},this.option,e),this.option.ImageExtent&&(this.mImageExtent=[this.option.ImageExtent.xmin,this.option.ImageExtent.ymin,this.option.ImageExtent.xmax,this.option.ImageExtent.ymax],this.option.ImageExtentWKID===Yy.EPSG4326&&(this.mImageExtent=pr(this.mImageExtent,"EPSG:4326","EPSG:3857")))}setOpacity(t){this.layer.setOpacity(t)}appendTo(t){t.addLayer(this.layer),this.isAdded=!0}addFilter(t){let e={feature:null,wrapX:!0,inner:!1,color:"rgba(255, 255, 255, 0.8)"};e=Object.assign({},e,t),this.mask=new ER({feature:e.feature,wrapX:e.wrapX,inner:e.inner,fill:new Tn({color:e.color})}),this.mask.set("active",!0),this.layer instanceof da?this.layer.getLayers().forEach((t=>{t.addFilter(this.mask)})):this.layer.addFilter(this.mask)}removeMaskFilter(){this.layer instanceof da?this.layer.getLayers().forEach((t=>{t.removeFilter(this.mask)})):this.layer.removeFilter(this.mask)}addPencilSketchFilter(){this.pencil=new SR,this.layer instanceof da?this.layer.getLayers().forEach((t=>{t.addFilter(this.pencil)})):this.layer.addFilter(this.pencil)}removePencilSketchFilter(){this.layer instanceof da?this.layer.getLayers().forEach((t=>{t.removeFilter(this.pencil)})):this.layer.removeFilter(this.pencil)}setPencilSketchFilter(t,e){this.pencil.set(t,e)}addColorizeFilter(t=!1){this.colorize=new BR;let e=new BR({operation:"enhance",value:1});this.layer instanceof da?this.layer.getLayers().forEach((r=>{t&&r.addFilter(e),r.addFilter(this.colorize)})):(t&&this.layer.addFilter(e),this.layer.addFilter(this.colorize))}removeColorizeFilter(){this.layer instanceof da?this.layer.getLayers().forEach((t=>{t.removeFilter(this.colorize)})):this.layer.removeFilter(this.colorize)}setColorizeFilter(t){switch(t.type){case tm.grayscale:case tm.invert:case tm.sepia:this.colorize.setFilter(t.type);break;default:this.colorize.setFilter({operation:t.type,red:Number(t.red),green:Number(t.green),blue:Number(t.blue),value:Number(t.value)})}}addCanvasFilter(){this.canvasFilter=new IR,this.erode=new TR({feoperation:"feMorphology",operator:"erode",radius:1}),this.emboss=new TR("feConvolveMatrix"),this.embossFilter=new PR({operation:this.emboss}),this.erodeFilter=new PR({operation:this.erode}),this.layer instanceof da?this.layer.getLayers().forEach((t=>{t.addFilter(this.canvasFilter)})):this.layer.addFilter(this.canvasFilter)}removeCanvasFilter(){this.layer instanceof da?this.layer.getLayers().forEach((t=>{t.removeFilter(this.canvasFilter)})):this.layer.removeFilter(this.canvasFilter)}setCanvasFilter(t,e){switch(t){case em.emboss:0===e?this.canvasFilter.removeSVGFilter(this.embossFilter):(this.emboss.set("kernelMatrix",[e,e,-e,e,1,-e,e,-e,-e]),this.canvasFilter.addSVGFilter(this.embossFilter));break;case em.erode:0===e?this.canvasFilter.removeSVGFilter(this.erodeFilter):(this.erode.set("radius",e),this.canvasFilter.addSVGFilter(this.erodeFilter));break;case em.paper:break;default:this.canvasFilter.set(t,e)}}}class LR extends FR{constructor(t,e){super(t,e),this.layerid=t,this.layertype="TileXyzLayer";let r=this;this.layerSource=new rO({tileUrlFunction:function(t,n,i){let o="C"+r.padLeft(t[1],8,16),s="R"+r.padLeft(t[2],8,16),a="L"+r.padLeft(t[0],2,10);return e.url.replace("{x}",o).replace("{y}",s).replace("{z}",a)}}),this.layer=new Af({zIndex:e.zIndex,source:this.layerSource}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(this.mImageExtent),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}padLeft(t,e,r){let n=t.toString(r||10);return(new Array(e).join("0")+n).slice(-e)}}class MR extends FR{constructor(t,e){super(t,e),this.layertype="ArcGisMapServerLayer",this.layerSource=new hR(e),this.layer=new bc({source:this.layerSource}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(this.mImageExtent),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}}var OR={},kR={get exports(){return OR},set exports(t){OR=t}},NR={},RR={get exports(){return NR},set exports(t){NR=t}};const UR=Ji(IN);var DR;function QR(){return DR||(DR=1,function(t,e){var r;t.exports=(r=r||function(t,e){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==Zi&&Zi.crypto&&(r=Zi.crypto),!r)try{r=UR}catch(d){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(d){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(d){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),o={},s=o.lib={},a=s.Base={extend:function(t){var e=i(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},l=s.WordArray=a.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||h).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var s=r[o>>>2]>>>24-o%4*8&255;e[n+o>>>2]|=s<<24-(n+o)%4*8}else for(var a=0;a<i;a+=4)e[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r<t;r+=4)e.push(n());return new l.init(e,t)}}),u=o.enc={},h=u.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var o=e[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new l.init(r,e/2)}},c=u.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var o=e[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new l.init(r,e)}},A=u.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(UW){throw new Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},f=s.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=A.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r,n=this._data,i=n.words,o=n.sigBytes,s=this.blockSize,a=o/(4*s),u=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,h=t.min(4*u,o);if(u){for(var c=0;c<u;c+=s)this._doProcessBlock(i,c);r=i.splice(0,u),n.sigBytes-=h}return new l.init(r,h)},clone:function(){var t=a.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});s.Hasher=f.extend({cfg:a.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new p.HMAC.init(t,r).finalize(e)}}});var p=o.algo={};return o}(Math),r)}(RR)),NR}var GR,jR={},HR={get exports(){return jR},set exports(t){jR=t}};var zR,VR,KR,qR,WR={},XR={get exports(){return WR},set exports(t){WR=t}},YR={},ZR={get exports(){return YR},set exports(t){YR=t}},JR={},$R={get exports(){return JR},set exports(t){JR=t}},tU={},eU={get exports(){return tU},set exports(t){tU=t}};function rU(){return qR||(qR=1,function(t,e){var r,n,i,o,s,a,l,u;t.exports=(u=QR(),VR||(VR=1,function(t,e){var r,n,i,o,s,a,l,u;t.exports=(n=(r=u=QR()).lib,i=n.WordArray,o=n.Hasher,s=r.algo,a=[],l=s.SHA1=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],l=r[4],u=0;u<80;u++){if(u<16)a[u]=0|t[e+u];else{var h=a[u-3]^a[u-8]^a[u-14]^a[u-16];a[u]=h<<1|h>>>31}var c=(n<<5|n>>>27)+l+a[u];c+=u<20?1518500249+(i&o|~i&s):u<40?1859775393+(i^o^s):u<60?(i&o|i&s|o&s)-1894007588:(i^o^s)-899497514,l=s,s=o,o=i<<30|i>>>2,i=n,n=c}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+l|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),e[15+(n+64>>>9<<4)]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}}),r.SHA1=o._createHelper(l),r.HmacSHA1=o._createHmacHelper(l),u.SHA1)}($R)),KR||(KR=1,function(t,e){var r,n,i;t.exports=(n=(r=QR()).lib.Base,i=r.enc.Utf8,void(r.algo.HMAC=n.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=i.parse(e));var r=t.blockSize,n=4*r;e.sigBytes>n&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),s=this._iKey=e.clone(),a=o.words,l=s.words,u=0;u<r;u++)a[u]^=1549556828,l[u]^=909522486;o.sigBytes=s.sigBytes=n,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,r=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(r))}})))}(eU)),i=(n=(r=u).lib).Base,o=n.WordArray,a=(s=r.algo).MD5,l=s.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var r,n=this.cfg,i=n.hasher.create(),s=o.create(),a=s.words,l=n.keySize,u=n.iterations;a.length<l;){r&&i.update(r),r=i.update(t).finalize(e),i.reset();for(var h=1;h<u;h++)r=i.finalize(r),i.reset();s.concat(r)}return s.sigBytes=4*l,s}}),r.EvpKDF=function(t,e,r){return l.create(r).compute(t,e)},u.EvpKDF)}(ZR)),YR}var nU,iU={},oU={get exports(){return iU},set exports(t){iU=t}};!function(t,e){var r;t.exports=(r=QR(),GR||(GR=1,function(t,e){var r,n,i;t.exports=(r=QR(),i=(n=r).lib.WordArray,n.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp();for(var i=[],o=0;o<r;o+=3)for(var s=(e[o>>>2]>>>24-o%4*8&255)<<16|(e[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|e[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<r;a++)i.push(n.charAt(s>>>6*(3-a)&63));var l=n.charAt(64);if(l)for(;i.length%4;)i.push(l);return i.join("")},parse:function(t){var e=t.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var o=0;o<r.length;o++)n[r.charCodeAt(o)]=o}var s=r.charAt(64);if(s){var a=t.indexOf(s);-1!==a&&(e=a)}return function(t,e,r){for(var n=[],o=0,s=0;s<e;s++)if(s%4){var a=r[t.charCodeAt(s-1)]<<s%4*2|r[t.charCodeAt(s)]>>>6-s%4*2;n[o>>>2]|=a<<24-o%4*8,o++}return i.create(n,o)}(t,e,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},r.enc.Base64)}(HR)),zR||(zR=1,function(t,e){var r;t.exports=(r=QR(),function(t){var e=r,n=e.lib,i=n.WordArray,o=n.Hasher,s=e.algo,a=[];!function(){for(var e=0;e<64;e++)a[e]=4294967296*t.abs(t.sin(e+1))|0}();var l=s.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var n=e+r,i=t[n];t[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,s=t[e+0],l=t[e+1],f=t[e+2],p=t[e+3],d=t[e+4],g=t[e+5],y=t[e+6],m=t[e+7],v=t[e+8],_=t[e+9],w=t[e+10],b=t[e+11],x=t[e+12],C=t[e+13],E=t[e+14],S=t[e+15],B=o[0],I=o[1],T=o[2],P=o[3];B=u(B,I,T,P,s,7,a[0]),P=u(P,B,I,T,l,12,a[1]),T=u(T,P,B,I,f,17,a[2]),I=u(I,T,P,B,p,22,a[3]),B=u(B,I,T,P,d,7,a[4]),P=u(P,B,I,T,g,12,a[5]),T=u(T,P,B,I,y,17,a[6]),I=u(I,T,P,B,m,22,a[7]),B=u(B,I,T,P,v,7,a[8]),P=u(P,B,I,T,_,12,a[9]),T=u(T,P,B,I,w,17,a[10]),I=u(I,T,P,B,b,22,a[11]),B=u(B,I,T,P,x,7,a[12]),P=u(P,B,I,T,C,12,a[13]),T=u(T,P,B,I,E,17,a[14]),B=h(B,I=u(I,T,P,B,S,22,a[15]),T,P,l,5,a[16]),P=h(P,B,I,T,y,9,a[17]),T=h(T,P,B,I,b,14,a[18]),I=h(I,T,P,B,s,20,a[19]),B=h(B,I,T,P,g,5,a[20]),P=h(P,B,I,T,w,9,a[21]),T=h(T,P,B,I,S,14,a[22]),I=h(I,T,P,B,d,20,a[23]),B=h(B,I,T,P,_,5,a[24]),P=h(P,B,I,T,E,9,a[25]),T=h(T,P,B,I,p,14,a[26]),I=h(I,T,P,B,v,20,a[27]),B=h(B,I,T,P,C,5,a[28]),P=h(P,B,I,T,f,9,a[29]),T=h(T,P,B,I,m,14,a[30]),B=c(B,I=h(I,T,P,B,x,20,a[31]),T,P,g,4,a[32]),P=c(P,B,I,T,v,11,a[33]),T=c(T,P,B,I,b,16,a[34]),I=c(I,T,P,B,E,23,a[35]),B=c(B,I,T,P,l,4,a[36]),P=c(P,B,I,T,d,11,a[37]),T=c(T,P,B,I,m,16,a[38]),I=c(I,T,P,B,w,23,a[39]),B=c(B,I,T,P,C,4,a[40]),P=c(P,B,I,T,s,11,a[41]),T=c(T,P,B,I,p,16,a[42]),I=c(I,T,P,B,y,23,a[43]),B=c(B,I,T,P,_,4,a[44]),P=c(P,B,I,T,x,11,a[45]),T=c(T,P,B,I,S,16,a[46]),B=A(B,I=c(I,T,P,B,f,23,a[47]),T,P,s,6,a[48]),P=A(P,B,I,T,m,10,a[49]),T=A(T,P,B,I,E,15,a[50]),I=A(I,T,P,B,g,21,a[51]),B=A(B,I,T,P,x,6,a[52]),P=A(P,B,I,T,p,10,a[53]),T=A(T,P,B,I,w,15,a[54]),I=A(I,T,P,B,l,21,a[55]),B=A(B,I,T,P,v,6,a[56]),P=A(P,B,I,T,S,10,a[57]),T=A(T,P,B,I,y,15,a[58]),I=A(I,T,P,B,C,21,a[59]),B=A(B,I,T,P,d,6,a[60]),P=A(P,B,I,T,b,10,a[61]),T=A(T,P,B,I,f,15,a[62]),I=A(I,T,P,B,_,21,a[63]),o[0]=o[0]+B|0,o[1]=o[1]+I|0,o[2]=o[2]+T|0,o[3]=o[3]+P|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var o=t.floor(n/4294967296),s=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),e.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,l=a.words,u=0;u<4;u++){var h=l[u];l[u]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return a},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});function u(t,e,r,n,i,o,s){var a=t+(e&r|~e&n)+i+s;return(a<<o|a>>>32-o)+e}function h(t,e,r,n,i,o,s){var a=t+(e&n|r&~n)+i+s;return(a<<o|a>>>32-o)+e}function c(t,e,r,n,i,o,s){var a=t+(e^r^n)+i+s;return(a<<o|a>>>32-o)+e}function A(t,e,r,n,i,o,s){var a=t+(r^(e|~n))+i+s;return(a<<o|a>>>32-o)+e}e.MD5=o._createHelper(l),e.HmacMD5=o._createHmacHelper(l)}(Math),r.MD5)}(XR)),rU(),nU||(nU=1,function(t,e){var r;t.exports=(r=QR(),rU(),void(r.lib.Cipher||function(t){var e=r,n=e.lib,i=n.Base,o=n.WordArray,s=n.BufferedBlockAlgorithm,a=e.enc;a.Utf8;var l=a.Base64,u=e.algo.EvpKDF,h=n.Cipher=s.extend({cfg:i.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?v:y}return function(e){return{encrypt:function(r,n,i){return t(n).encrypt(e,r,n,i)},decrypt:function(r,n,i){return t(n).decrypt(e,r,n,i)}}}}()});n.StreamCipher=h.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var c=e.mode={},A=n.BlockCipherMode=i.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),f=c.CBC=function(){var e=A.extend();function r(e,r,n){var i,o=this._iv;o?(i=o,this._iv=t):i=this._prevBlock;for(var s=0;s<n;s++)e[r+s]^=i[s]}return e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize;r.call(this,t,e,i),n.encryptBlock(t,e),this._prevBlock=t.slice(e,e+i)}}),e.Decryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,o=t.slice(e,e+i);n.decryptBlock(t,e),r.call(this,t,e,i),this._prevBlock=o}}),e}(),p=(e.pad={}).Pkcs7={pad:function(t,e){for(var r=4*e,n=r-t.sigBytes%r,i=n<<24|n<<16|n<<8|n,s=[],a=0;a<n;a+=4)s.push(i);var l=o.create(s,n);t.concat(l)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}};n.BlockCipher=h.extend({cfg:h.cfg.extend({mode:f,padding:p}),reset:function(){var t;h.reset.call(this);var e=this.cfg,r=e.iv,n=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=n.createEncryptor:(t=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,r&&r.words):(this._mode=t.call(n,this,r&&r.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4});var d=n.CipherParams=i.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),g=(e.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,r=t.salt;return(r?o.create([1398893684,1701076831]).concat(r).concat(e):e).toString(l)},parse:function(t){var e,r=l.parse(t),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(e=o.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),d.create({ciphertext:r,salt:e})}},y=n.SerializableCipher=i.extend({cfg:i.extend({format:g}),encrypt:function(t,e,r,n){n=this.cfg.extend(n);var i=t.createEncryptor(r,n),o=i.finalize(e),s=i.cfg;return d.create({ciphertext:o,key:r,iv:s.iv,algorithm:t,mode:s.mode,padding:s.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(r,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),m=(e.kdf={}).OpenSSL={execute:function(t,e,r,n){n||(n=o.random(8));var i=u.create({keySize:e+r}).compute(t,n),s=o.create(i.words.slice(e),4*r);return i.sigBytes=4*e,d.create({key:i,iv:s,salt:n})}},v=n.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:m}),encrypt:function(t,e,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,t.keySize,t.ivSize);n.iv=i.iv;var o=y.encrypt.call(this,t,e,i.key,n);return o.mixIn(i),o},decrypt:function(t,e,r,n){n=this.cfg.extend(n),e=this._parse(e,n.format);var i=n.kdf.execute(r,t.keySize,t.ivSize,e.salt);return n.iv=i.iv,y.decrypt.call(this,t,e,i.key,n)}})}()))}(oU)),function(){var t=r,e=t.lib,n=e.WordArray,i=e.BlockCipher,o=t.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],c=o.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],r=0;r<56;r++){var n=s[r]-1;e[r]=t[n>>>5]>>>31-n%32&1}for(var i=this._subKeys=[],o=0;o<16;o++){var u=i[o]=[],h=l[o];for(r=0;r<24;r++)u[r/6|0]|=e[(a[r]-1+h)%28]<<31-r%6,u[4+(r/6|0)]|=e[28+(a[r+24]-1+h)%28]<<31-r%6;for(u[0]=u[0]<<1|u[0]>>>31,r=1;r<7;r++)u[r]=u[r]>>>4*(r-1)+3;u[7]=u[7]<<5|u[7]>>>27}var c=this._invSubKeys=[];for(r=0;r<16;r++)c[r]=i[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,r){this._lBlock=t[e],this._rBlock=t[e+1],A.call(this,4,252645135),A.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),A.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],o=this._lBlock,s=this._rBlock,a=0,l=0;l<8;l++)a|=u[l][((s^i[l])&h[l])>>>0];this._lBlock=s,this._rBlock=o^a}var c=this._lBlock;this._lBlock=this._rBlock,this._rBlock=c,A.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),A.call(this,16,65535),A.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function A(t,e){var r=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=r,this._lBlock^=r<<t}function f(t,e){var r=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<<t}t.DES=i._createHelper(c);var p=o.TripleDES=i.extend({_doReset:function(){var t=this._key.words;if(2!==t.length&&4!==t.length&&t.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var e=t.slice(0,2),r=t.length<4?t.slice(0,2):t.slice(2,4),i=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=c.createEncryptor(n.create(e)),this._des2=c.createEncryptor(n.create(r)),this._des3=c.createEncryptor(n.create(i))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=i._createHelper(p)}(),r.TripleDES)}(kR);var sU={};!function(t,e){t.exports=QR().enc.Utf8}({get exports(){return sU},set exports(t){sU=t}});const aU=n({__proto__:null,default:sU},[sU]);class lU{getMessage(){}scanApk(t,e){let r=!1;try{let n=JSON.parse(this.Decrypt1(t)),i="";if(n.EndUser&&n.version&&parseInt(n.version.split(".")[0])<=parseInt(e.split(".")[0])&&(r=!0),r){let t=this.getVersionsInfo2(n.EndUser,e);i="%c"+t.name+"%c \n\n"+t.version+"\n"+t.Copyright}else{let t=this.getVersionsInfo(e);i="%c"+t.name+"%c \n\n"+t.version+"\n"+t.Copyright+"\n\n"+t.ContactUs}return r}catch{let t=this.getVersionsInfo(e);return t.name,t.version,t.Copyright,t.ContactUs,!1}}getVersionsInfo(t){return{name:"Mirage2D平台",Copyright:'版权声明:\n 1. Mirage2D版权完全属于 "西安唐远信息科技有限公司".\n 2. Mirage2D软件包,任何人或组织在遵守下列条件的前提下可以永久免费使用:\n 1)不进行任何形式的破解和裁剪,程序包完整引用;\n 2)保留对此版权信息在控制台输出. \n 我们保留对此版权信息的最终解释权.',expirationDate:" 2024-03-29",Author:"xd",EndUser:"授权信息:西安唐远信息科技有限公司",version:"版 本 号:"+t,ContactUs:"联系方式:20276704@qq.com"}}getVersionsInfo2(t,e){return{name:t,version:"版 本 号:"+e,Copyright:'版权声明:\n 1. 当前平台版本属于"'+t+'"独自所有.\n 2. 其中Mirage2D版权完全属于"西安唐远信息科技有限公司"所有,已授权"'+t+'"永久使用Mirage2D当前版本.'}}Encrypt1(t){return OR.encrypt(t,"apple3D").toString()}Decrypt1(t){return OR.decrypt(t,"apple3D").toString(aU)}}class uU extends xy{constructor(){super(),r(this,"_map"),r(this,"contextmenuitems"),r(this,"contextmenu"),r(this,"EventType"),this._map=null,this.contextmenuitems=[],this.contextmenu=null,this.EventType=Vy}initContextmenu(){this.contextmenu=new Gy({id:"contextmenu",width:150,defaultItems:!0,items:this.contextmenuitems}),this.contextmenu&&(this.contextmenu.set("id","contextmenu"),this._map&&(this._map.addControl(this.contextmenu),this.contextmenu.on("beforeopen",(t=>{if(this._map){let e=this._map.forEachFeatureAtPixel(t.pixel,(function(t,e){return t}));this.contextmenu.clear(),e?void 0!==e.get("featuretype")&&"量测图层"!==e.get("featuretype")||this.contextmenu.extend([{text:"定位到",icon:"img/marker.png",callback:t=>{this._map&&this._map.getView().setCenter(t.data.Center)},data:{Center:t.coordinate}}]):this.contextmenuitems.forEach((e=>{e.data={e:t}}))}})),this.contextmenu.on("open",(t=>{if(this._map){t.coordinate;let e=!1;if(this._map.getOverlays().forEach((r=>{let n=r.getElement();if(n&&"none"!==n.style.display){let i=t.pixel,o=n.getBoundingClientRect();o.left<=i[0]&&i[0]<=o.right&&o.top<=i[1]&&i[1]<=o.bottom&&(e=!0,r.dispatchEvent({type:this.EventType.featureType.onFeatureContextmenu,data:{contextmenu:this.contextmenu}}))}})),!e){let e=this._map.forEachFeatureAtPixel(t.pixel,(function(t,e){return{feature:t,layer:e}}));e?e.layer&&e.layer.dispatchEvent({type:this.EventType.featureType.onFeatureContextmenu,data:{feature:e.feature,layer:e.layer,contextmenu:this.contextmenu}}):this.trigger(this.EventType.XMapEventType.onMapContextmenu,t)}}}))))}}class hU extends FR{constructor(t,e){super(t,e),r(this,"projection"),this.layertype="TileXyzLayer",this.projection=this.option.projection,"GCJ02"===e.chinaCRS&&this.setGCJ02(),this.layerSource=new rO({url:e.url,crossOrigin:"Anonymous",projection:this.projection}),this.layer=new Af({zIndex:e.zIndex,source:this.layerSource,useInterimTilesOnError:!1}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(pr(this.mImageExtent,"EPSG:4326","EPSG:3857")),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}setGCJ02(){const t=new oe({code:"GCJ02",extent:[-20037508.342789244,-20037508.342789244,20037508.342789244,20037508.342789244],units:"m"});this.projection=t,er(t);let e=function(t){return function(e,r,n){let i,o=e.length,s=n||2;i=r||(2!==s?e.slice():new Array(o));for(let a=0;a<o;a+=s)t(e,i,a);return i}},r={},n=Math.PI,i=6378245,o=.006693421622965943;function s(t,e){let r=function(t,e){let r=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*n)+20*Math.sin(2*t*n))/3,r+=2*(20*Math.sin(e*n)+40*Math.sin(e/3*n))/3,r+=2*(160*Math.sin(e/12*n)+320*Math.sin(e*n/30))/3,r}(t-105,e-35),s=function(t,e){let r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*n)+20*Math.sin(2*t*n))/3,r+=2*(20*Math.sin(t*n)+40*Math.sin(t/3*n))/3,r+=2*(150*Math.sin(t/12*n)+300*Math.sin(t/30*n))/3,r}(t-105,e-35),a=e/180*n,l=Math.sin(a);l=1-o*l*l;let u=Math.sqrt(l);return r=180*r/(i*(1-o)/(l*u)*n),s=180*s/(i/u*Math.cos(a)*n),[s,r]}function a(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271}r.toWGS84=e((function(t,e,r){let n=t[r],i=t[r+1];if(!a(n,i)){let t=s(n,i);n-=t[0],i-=t[1]}e[r]=n,e[r+1]=i})),r.fromWGS84=e((function(t,e,r){let n=t[r],i=t[r+1];if(!a(n,i)){let t=s(n,i);n+=t[0],i+=t[1]}e[r]=n,e[r+1]=i}));let l={},u=6378137,h=Math.PI/180;l.forward=e((function(t,e,r){let n=Math.max(Math.min(85.0511287798,t[r+1]),-85.0511287798),i=Math.sin(n*h);e[r]=u*t[r]*h,e[r+1]=u*Math.log((1+i)/(1-i))/2})),l.inverse=e((function(t,e,r){e[r]=t[r]/u/h,e[r+1]=(2*Math.atan(Math.exp(t[r+1]/u))-Math.PI/2)/h}));let c={ll2gmerc:function(t,e,n){let i=r.fromWGS84(t,e,n);return c.ll2smerc(i,i,n)},gmerc2ll:function(t,e,n){let i=c.smerc2ll(t,t,n);return r.toWGS84(i,e,n)},smerc2gmerc:function(t,e,n){let i=c.smerc2ll(t,t,n);return i=r.fromWGS84(i,i,n),c.ll2smerc(i,i,n)},gmerc2smerc:function(t,e,n){let i=c.smerc2ll(t,t,n);return i=r.toWGS84(i,i,n),c.ll2smerc(i,i,n)}};c.ll2smerc=l.forward,c.smerc2ll=l.inverse,ar("EPSG:4326",t,c.ll2gmerc,c.gmerc2ll),ar("EPSG:3857",t,c.smerc2gmerc,c.gmerc2smerc)}}class cU extends hU{constructor(t,e){super(t,e),this.layertype="TileTencentLayer",this.layerSource.setTileUrlFunction((function(t){let r=e.url,n=t[1],i=(1<<t[0])-t[2]-1,o=t[0],s=t[1]>>4,a=(1<<t[0])-t[2]-1>>4;if(e.subdomains&&r.indexOf("{s}")>0){let t=e.subdomains.split(",");r=r.replace("{s}",t[Math.floor(Math.random()*t.length)])}return r.replaceAll("{x}",n.toString()).replace("{ry}",i.toString()).replace("{z}",o.toString()).replace("{sx}",s.toString()).replace("{sy}",a.toString())}))}}var AU={},fU={},pU={},dU=function(t){return function(e,r,n){var i,o=e.length,s=n||2;i=r||(2!==s?e.slice():new Array(o));for(var a=0;a<o;a+=s)t(e,i,a);return i}},gU=dU,yU=[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],mU=[75,60,45,30,15,0],vU=[[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]],_U=[[-.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]];function wU(t,e,r,n){var i=t[r],o=t[r+1],s=n[0]+n[1]*Math.abs(i),a=Math.abs(o)/n[9],l=n[2]+n[3]*a+n[4]*a*a+n[5]*a*a*a+n[6]*a*a*a*a+n[7]*a*a*a*a*a+n[8]*a*a*a*a*a*a;e[r]=s*(i<0?-1:1),e[r+1]=l*(o<0?-1:1)}pU.forward=gU((function(t,e,r){var n,i,o=function(t,e,r){for(;t>180;)t-=360;for(;t<-180;)t+=360;return t}(t[r]),s=(n=t[r+1],n=Math.max(n,-74),Math.min(n,74)),a=null;for(i=0;i<mU.length;++i)if(s>=mU[i]){a=_U[i];break}if(null===a)for(i=mU.length-1;i>=0;--i)if(s<=-mU[i]){a=_U[i];break}e[r]=o,e[r+1]=s,wU(e,e,r,a)})),pU.inverse=gU((function(t,e,r){for(var n=Math.abs(t[r+1]),i=null,o=0;o<yU.length;o++)if(n>=yU[o]){i=vU[o];break}wU(t,e,r,i)}));var bU={},xU=dU,CU=6378137,EU=85.0511287798,SU=Math.PI/180;bU.forward=xU((function(t,e,r){var n=Math.max(Math.min(EU,t[r+1]),-EU),i=Math.sin(n*SU);e[r]=CU*t[r]*SU,e[r+1]=CU*Math.log((1+i)/(1-i))/2})),bU.inverse=xU((function(t,e,r){e[r]=t[r]/CU/SU,e[r+1]=(2*Math.atan(Math.exp(t[r+1]/CU))-Math.PI/2)/SU})),fU.baiduMercator=pU,fU.sphericalMercator=bU;var BU={},IU={},TU={},PU=dU,FU=Math.PI,LU=6378245,MU=.006693421622965943;function OU(t,e){var r,n,i,o=(i=2*(r=t-105)-100+3*(n=e-35)+.2*n*n+.1*r*n+.2*Math.sqrt(Math.abs(r)),i+=2*(20*Math.sin(6*r*FU)+20*Math.sin(2*r*FU))/3,i+=2*(20*Math.sin(n*FU)+40*Math.sin(n/3*FU))/3,i+=2*(160*Math.sin(n/12*FU)+320*Math.sin(n*FU/30))/3),s=function(t,e){var r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*FU)+20*Math.sin(2*t*FU))/3,(r+=2*(20*Math.sin(t*FU)+40*Math.sin(t/3*FU))/3)+2*(150*Math.sin(t/12*FU)+300*Math.sin(t/30*FU))/3}(t-105,e-35),a=e/180*FU,l=Math.sin(a);l=1-MU*l*l;var u=Math.sqrt(l);return o=180*o/(LU*(1-MU)/(l*u)*FU),[s=180*s/(LU/u*Math.cos(a)*FU),o]}function kU(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271}TU.toWGS84=PU((function(t,e,r){var n=t[r],i=t[r+1];if(!kU(n,i)){var o=OU(n,i);n-=o[0],i-=o[1]}e[r]=n,e[r+1]=i})),TU.fromWGS84=PU((function(t,e,r){var n=t[r],i=t[r+1];if(!kU(n,i)){var o=OU(n,i);n+=o[0],i+=o[1]}e[r]=n,e[r+1]=i}));var NU=dU,RU=TU,UU=3e3*Math.PI/180,DU=IU.toGCJ02=NU((function(t,e,r){var n=t[r]-.0065,i=t[r+1]-.006,o=Math.sqrt(n*n+i*i)-2e-5*Math.sin(i*UU),s=Math.atan2(i,n)-3e-6*Math.cos(n*UU);return e[r]=o*Math.cos(s),e[r+1]=o*Math.sin(s),e})),QU=IU.fromGCJ02=NU((function(t,e,r){var n=t[r],i=t[r+1],o=Math.sqrt(n*n+i*i)+2e-5*Math.sin(i*UU),s=Math.atan2(i,n)+3e-6*Math.cos(n*UU);return e[r]=o*Math.cos(s)+.0065,e[r+1]=o*Math.sin(s)+.006,e}));IU.toWGS84=function(t,e,r){var n=DU(t,e,r);return RU.toWGS84(n,n,r)},IU.fromWGS84=function(t,e,r){var n=RU.fromWGS84(t,e,r);return QU(n,n,r)},BU.bd09=IU,BU.gcj02=TU;var GU=fU,jU=BU;AU.smerc2bmerc=function(t,e,r){var n=GU.sphericalMercator.inverse(t,e,r);return n=jU.bd09.fromWGS84(n,n,r),GU.baiduMercator.forward(n,n,r)},AU.bmerc2smerc=function(t,e,r){var n=GU.baiduMercator.inverse(t,e,r);return n=jU.bd09.toWGS84(n,n,r),GU.sphericalMercator.forward(n,n,r)},AU.bmerc2ll=function(t,e,r){var n=GU.baiduMercator.inverse(t,e,r);return jU.bd09.toWGS84(n,n,r)},AU.ll2bmerc=function(t,e,r){var n=jU.bd09.fromWGS84(t,e,r);return GU.baiduMercator.forward(n,n,r)},AU.ll2smerc=GU.sphericalMercator.forward,AU.smerc2ll=GU.sphericalMercator.inverse,AU.datum=jU,AU.projection=GU;class HU extends FR{constructor(t,e){super(t,e),this.layertype="TileBaiDuLayer";let r=[-20037725.11268234,-19994619.55417086,20037725.11268234,19994619.55417086],n=new oe({code:"baidu",extent:re(r,AU.ll2bmerc),units:"m"});er(n),ar("EPSG:4326",n,AU.ll2bmerc,AU.bmerc2ll),ar("EPSG:3857",n,AU.smerc2bmerc,AU.bmerc2smerc);let i=new Array(19);for(let s=0;s<19;++s)i[s]=Math.pow(2,18-s);let o=new FA({resolutions:i,origin:[0,0],extent:re(r,AU.ll2bmerc),tileSize:[256,256]});this.layerSource=new lf({projection:"baidu",tileGrid:o,tileUrlFunction:function(t,r,n){let i=e.url;if(e.subdomains&&i.indexOf("{s}")>0){let t=e.subdomains.split(",");i=i.replace("{s}",t[Math.floor(Math.random()*t.length)])}let o=t[0],s=t[1],a=-1-t[2];return i.replaceAll("{z}",o.toString()).replaceAll("{x}",s.toString()).replaceAll("{y}",a.toString())}}),this.layer=new Af({zIndex:e.zIndex,source:this.layerSource,useInterimTilesOnError:!1}),this.layer.set("layerid",t)}}class zU extends FR{constructor(t,e){super(t,e),this.layertype="TileGroupLayer";let r=[];e.layers.forEach((t=>{"xyz"===t.type?r.push(new hU(t.name,t).layer):"tencent"===t.type?r.push(new cU(t.name,t).layer):"baidu"===t.type&&r.push(new HU(t.name,t).layer)})),this.layer=new da({layers:r}),this.layer.set("layerid",t)}}class VU extends FR{constructor(t,e){super(t,e),this.layertype="imageLayer",this.layerSource=new pR({url:this.option.url,projection:this.option.projection,imageExtent:this.mImageExtent}),this.layer=new bc({source:this.layerSource,opacity:this.option.opacity}),this.layer.set("layerid",t),this.layerSource.on("tileloadstart",(function(t){})),this.layerSource.on("tileloadend",(function(t){})),this.layerSource.on("tileloaderror",(function(t){}))}}
85
+ ***************************************************************************** */var ME=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function OE(t,e){return t>e?1:t<e?-1:0}function kE(t,e,r){for(var n=new ME(null,null),i=n,o=n;;){var s=r(t,e.key);if(s<0){if(null===e.left)break;if(r(t,e.left.key)<0){var a=e.left;if(e.left=a.right,a.right=e,null===(e=a).left)break}o.left=e,o=e,e=e.left}else{if(!(s>0))break;if(null===e.right)break;if(r(t,e.right.key)>0&&(a=e.right,e.right=a.left,a.left=e,null===(e=a).right))break;i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=n.right,e.right=n.left,e}function NE(t,e,r,n){var i=new ME(t,e);if(null===r)return i.left=i.right=null,i;var o=n(t,(r=kE(t,r,n)).key);return o<0?(i.left=r.left,i.right=r,r.left=null):o>=0&&(i.right=r.right,i.left=r,r.right=null),i}function RE(t,e,r){var n=null,i=null;if(e){var o=r((e=kE(t,e,r)).key,t);0===o?(n=e.left,i=e.right):o<0?(i=e.right,e.right=null,n=e):(n=e.left,e.left=null,i=e)}return{left:n,right:i}}function UE(t,e,r,n,i){if(t){n(e+(r?"└── ":"├── ")+i(t)+"\n");var o=e+(r?" ":"│ ");t.left&&UE(t.left,o,!1,n,i),t.right&&UE(t.right,o,!0,n,i)}}var DE=function(){function t(t){void 0===t&&(t=OE),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=NE(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var r=new ME(t,e);null===this._root&&(r.left=r.right=null,this._size++,this._root=r);var n=this._comparator,i=kE(t,this._root,n),o=n(t,i.key);return 0===o?this._root=i:(o<0?(r.left=i.left,r.right=i,i.left=null):o>0&&(r.right=i.right,r.left=i,i.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,r){var n;return null===e?null:0===r(t,(e=kE(t,e,r)).key)?(null===e.left?n=e.right:(n=kE(t,e.left,r)).right=e.right,this._size--,n):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=kE(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return e;e=n<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=kE(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return!0;e=n<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var r=this._root,n=[],i=!1;!i;)null!==r?(n.push(r),r=r.left):0!==n.length?(r=n.pop(),t.call(e,r),r=r.right):i=!0;return this},t.prototype.range=function(t,e,r,n){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&r.call(n,s))return this;s=s.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var r=e.key;return t.push(r)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var r=e.data;return t.push(r)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,r=!1,n=0,i=[];!r;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),n===t)return e;n++,e=e.right}else r=!0;return null},t.prototype.next=function(t){var e=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?(r=e,e=e.left):e=e.right}return r},t.prototype.prev=function(t){var e=this._root,r=null;if(null!==t.left){for(r=t.left;r.right;)r=r.right;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?e=e.left:(r=e,e=e.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){for(var e=t,r=[],n=!1,i=new ME(null,null),o=i;!n;)e?(r.push(e),e=e.left):r.length>0?e=(e=o=o.next=r.pop()).right:n=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,r){void 0===e&&(e=[]),void 0===r&&(r=!1);var n=t.length,i=this._comparator;if(r&&jE(t,e,0,n-1,i),null===this._root)this._root=QE(t,e,0,n),this._size=n;else{var o=function(t,e,r){for(var n=new ME(null,null),i=n,o=t,s=e;null!==o&&null!==s;)r(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;return null!==o?i.next=o:null!==s&&(i.next=s),n.next}(this.toList(),function(t,e){for(var r=new ME(null,null),n=r,i=0;i<t.length;i++)n=n.next=new ME(t[i],e[i]);return n.next=null,r.next}(t,e),i);n=this._size+n,this._root=GE({head:o},0,n)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return UE(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,r){var n=this._comparator,i=RE(t,this._root,n),o=i.left,s=i.right;n(t,e)<0?s=NE(e,r,s,n):o=NE(e,r,o,n),this._root=function(t,e,r){return null===e?t:(null===t||((e=kE(t.key,e,r)).left=t),e)}(o,s,n)},t.prototype.split=function(t){return RE(t,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var t;return function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).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(UW){o=[6,UW],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,(function(e){switch(e.label){case 0:t=this.minNode(),e.label=1;case 1:return t?[4,t]:[3,3];case 2:return e.sent(),t=this.next(t),[3,1];case 3:return[2]}}))},t}();function QE(t,e,r,n){var i=n-r;if(i>0){var o=r+Math.floor(i/2),s=t[o],a=e[o],l=new ME(s,a);return l.left=QE(t,e,r,o),l.right=QE(t,e,o+1,n),l}return null}function GE(t,e,r){var n=r-e;if(n>0){var i=e+Math.floor(n/2),o=GE(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=GE(t,i+1,r),s}return null}function jE(t,e,r,n,i){if(!(r>=n)){for(var o=t[r+n>>1],s=r-1,a=n+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var l=t[s];t[s]=t[a],t[a]=l,l=e[s],e[s]=e[a],e[a]=l}jE(t,e,r,a,i),jE(t,e,a+1,n,i)}}function HE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function zE(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function VE(t,e,r){return e&&zE(t.prototype,e),r&&zE(t,r),t}var KE=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},qE=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var r=t.ll.x<e.ll.x?e.ll.x:t.ll.x,n=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:r,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:n,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},WE=Number.EPSILON;void 0===WE&&(WE=Math.pow(2,-52));var XE=WE*WE,YE=function(t,e){if(-WE<t&&t<WE&&-WE<e&&e<WE)return 0;var r=t-e;return r*r<XE*t*e?0:t<e?-1:1},ZE=function(){function t(){HE(this,t),this.reset()}return VE(t,[{key:"reset",value:function(){this.xRounder=new JE,this.yRounder=new JE}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),t}(),JE=function(){function t(){HE(this,t),this.tree=new DE,this.round(0)}return VE(t,[{key:"round",value:function(t){var e=this.tree.add(t),r=this.tree.prev(e);if(null!==r&&0===YE(e.key,r.key))return this.tree.remove(t),r.key;var n=this.tree.next(e);return null!==n&&0===YE(e.key,n.key)?(this.tree.remove(t),n.key):t}}]),t}(),$E=new ZE,tS=function(t,e){return t.x*e.y-t.y*e.x},eS=function(t,e){return t.x*e.x+t.y*e.y},rS=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y},o=tS(n,i);return YE(o,0)},nS=function(t){return Math.sqrt(eS(t,t))},iS=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y};return eS(i,n)/nS(i)/nS(n)},oS=function(t,e,r){return 0===e.y?null:{x:t.x+e.x/e.y*(r-t.y),y:r}},sS=function(t,e,r){return 0===e.x?null:{x:r,y:t.y+e.y/e.x*(r-t.x)}},aS=function(){function t(e,r){HE(this,t),void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return VE(t,null,[{key:"compare",value:function(e,r){var n=t.comparePoints(e.point,r.point);return 0!==n?n:(e.point!==r.point&&e.link(r),e.isLeft!==r.isLeft?e.isLeft?1:-1:uS.compare(e.segment,r.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),VE(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,r=0,n=e.length;r<n;r++){var i=e[r];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var r=this.point.events[e];if(void 0===r.segment.consumedBy)for(var n=e+1;n<t;n++){var i=this.point.events[n];void 0===i.consumedBy&&r.otherSE.point.events===i.otherSE.point.events&&r.segment.consume(i.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,r=this.point.events.length;e<r;e++){var n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,r=new Map,n=function(n){var i,o,s,a,l,u=n.otherSE;r.set(n,{sine:(i=e.point,o=t.point,s=u.point,a={x:o.x-i.x,y:o.y-i.y},l={x:s.x-i.x,y:s.y-i.y},tS(l,a)/nS(l)/nS(a)),cosine:iS(e.point,t.point,u.point)})};return function(t,e){r.has(t)||n(t),r.has(e)||n(e);var i=r.get(t),o=i.sine,s=i.cosine,a=r.get(e),l=a.sine,u=a.cosine;return o>=0&&l>=0?s<u?1:s>u?-1:0:o<0&&l<0?s<u?-1:s>u?1:0:l<o?-1:l>o?1:0}}}]),t}(),lS=0,uS=function(){function t(e,r,n,i){HE(this,t),this.id=++lS,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=n,this.windings=i}return VE(t,null,[{key:"compare",value:function(t,e){var r=t.leftSE.point.x,n=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<r)return 1;if(i<n)return-1;var s=t.leftSE.point.y,a=e.leftSE.point.y,l=t.rightSE.point.y,u=e.rightSE.point.y;if(r<n){if(a<s&&a<l)return 1;if(a>s&&a>l)return-1;var h=t.comparePoint(e.leftSE.point);if(h<0)return 1;if(h>0)return-1;var c=e.comparePoint(t.rightSE.point);return 0!==c?c:-1}if(r>n){if(s<a&&s<u)return-1;if(s>a&&s>u)return 1;var A=e.comparePoint(t.leftSE.point);if(0!==A)return A;var f=t.comparePoint(e.rightSE.point);return f<0?1:f>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){var p=e.comparePoint(t.rightSE.point);if(0!==p)return p}if(i>o){var d=t.comparePoint(e.rightSE.point);if(d<0)return 1;if(d>0)return-1}if(i!==o){var g=l-s,y=i-r,m=u-a,v=o-n;if(g>y&&m<v)return 1;if(g<y&&m>v)return-1}return i>o?1:i<o||l<u?-1:l>u?1:t.id<e.id?-1:t.id>e.id?1:0}}]),VE(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,r=this.rightSE.point,n=this.vector();if(e.x===r.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/n.y,o=e.x+i*n.x;if(t.x===o)return 0;var s=(t.x-e.x)/n.x,a=e.y+s*n.y;return t.y===a?0:t.y<a?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),r=t.bbox(),n=qE(e,r);if(null===n)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,l=KE(e,s)&&0===this.comparePoint(s),u=KE(r,i)&&0===t.comparePoint(i),h=KE(e,a)&&0===this.comparePoint(a),c=KE(r,o)&&0===t.comparePoint(o);if(u&&l)return c&&!h?o:!c&&h?a:null;if(u)return h&&i.x===a.x&&i.y===a.y?null:i;if(l)return c&&o.x===s.x&&o.y===s.y?null:s;if(c&&h)return null;if(c)return o;if(h)return a;var A=function(t,e,r,n){if(0===e.x)return sS(r,n,t.x);if(0===n.x)return sS(t,e,r.x);if(0===e.y)return oS(r,n,t.y);if(0===n.y)return oS(t,e,r.y);var i=tS(e,n);if(0==i)return null;var o={x:r.x-t.x,y:r.y-t.y},s=tS(o,e)/i,a=tS(o,n)/i;return{x:(t.x+a*e.x+(r.x+s*n.x))/2,y:(t.y+a*e.y+(r.y+s*n.y))/2}}(i,this.vector(),s,t.vector());return null===A?null:KE(n,A)?$E.round(A.x,A.y):null}},{key:"split",value:function(e){var r=[],n=void 0!==e.events,i=new aS(e,!0),o=new aS(e,!1),s=this.rightSE;this.replaceRightSE(o),r.push(o),r.push(i);var a=new t(i,s,this.rings.slice(),this.windings.slice());return aS.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),aS.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,r=this.windings.length;e<r;e++)this.windings[e]*=-1}},{key:"consume",value:function(e){for(var r=this,n=e;r.consumedBy;)r=r.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var i=t.compare(r,n);if(0!==i){if(i>0){var o=r;r=n,n=o}if(r.prev===n){var s=r;r=n,n=s}for(var a=0,l=n.rings.length;a<l;a++){var u=n.rings[a],h=n.windings[a],c=r.rings.indexOf(u);-1===c?(r.rings.push(u),r.windings.push(h)):r.windings[c]+=h}n.rings=null,n.windings=null,n.consumedBy=r,n.leftSE.consumedBy=r.leftSE,n.rightSE.consumedBy=r.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,r=this._afterState.windings,n=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],a=this.windings[i],l=e.indexOf(s);-1===l?(e.push(s),r.push(a)):r[l]+=a}for(var u=[],h=[],c=0,A=e.length;c<A;c++)if(0!==r[c]){var f=e[c],p=f.poly;if(-1===h.indexOf(p))if(f.isExterior)u.push(p);else{-1===h.indexOf(p)&&h.push(p);var d=u.indexOf(f.poly);-1!==d&&u.splice(d,1)}}for(var g=0,y=u.length;g<y;g++){var m=u[g].multiPoly;-1===n.indexOf(m)&&n.push(m)}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(vS.type){case"union":var r=0===t.length,n=0===e.length;this._isInResult=r!==n;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===vS.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(vS.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,r,n){var i,o,s,a=aS.comparePoints(e,r);if(a<0)i=e,o=r,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=r,o=e,s=-1}return new t(new aS(i,!0),new aS(o,!1),[n],[s])}}]),t}(),hS=function(){function t(e,r,n){if(HE(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=n,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=$E.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 l=$E.round(e[s][0],e[s][1]);l.x===o.x&&l.y===o.y||(this.segments.push(uS.fromRing(o,l,this)),l.x<this.bbox.ll.x&&(this.bbox.ll.x=l.x),l.y<this.bbox.ll.y&&(this.bbox.ll.y=l.y),l.x>this.bbox.ur.x&&(this.bbox.ur.x=l.x),l.y>this.bbox.ur.y&&(this.bbox.ur.y=l.y),o=l)}i.x===o.x&&i.y===o.y||this.segments.push(uS.fromRing(o,i,this))}return VE(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.segments.length;e<r;e++){var n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}]),t}(),cS=function(){function t(e,r){if(HE(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new hS(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var n=1,i=e.length;n<i;n++){var o=new hS(e[n],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}return VE(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,r=this.interiorRings.length;e<r;e++)for(var n=this.interiorRings[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),AS=function(){function t(e,r){if(HE(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(s){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var n=0,i=e.length;n<i;n++){var o=new cS(e[n],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}return VE(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++)for(var n=this.polys[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),fS=function(){function t(e){HE(this,t),this.events=e;for(var r=0,n=e.length;r<n;r++)e[r].segment.ringOut=this;this.poly=null}return VE(t,null,[{key:"factory",value:function(e){for(var r=[],n=0,i=e.length;n<i;n++){var o=e[n];if(o.isInResult()&&!o.ringOut){for(var s=null,a=o.leftSE,l=o.rightSE,u=[a],h=a.point,c=[];s=a,a=l,u.push(a),a.point!==h;)for(;;){var A=a.getAvailableLinkedEvents();if(0===A.length){var f=u[0].point,p=u[u.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(f.x,",")+" ".concat(f.y,"]. Last matching segment found ends at")+" [".concat(p.x,", ").concat(p.y,"]."))}if(1===A.length){l=A[0].otherSE;break}for(var d=null,g=0,y=c.length;g<y;g++)if(c[g].point===a.point){d=g;break}if(null===d){c.push({index:u.length,point:a.point});var m=a.getLeftmostComparator(s);l=A.sort(m)[0].otherSE;break}var v=c.splice(d)[0],_=u.splice(v.index);_.unshift(_[0].otherSE),r.push(new t(_.reverse()))}r.push(new t(u))}}return r}}]),VE(t,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],r=1,n=this.events.length-1;r<n;r++){var i=this.events[r].point,o=this.events[r+1].point;0!==rS(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],a=e[1];0===rS(s,t,a)&&e.shift(),e.push(e[0]);for(var l=this.isExteriorRing()?1:-1,u=this.isExteriorRing()?0:e.length-1,h=this.isExteriorRing()?e.length:-1,c=[],A=u;A!=h;A+=l)c.push([e[A].x,e[A].y]);return c}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,r=this.events.length;e<r;e++){var n=this.events[e];aS.compare(t,n)>0&&(t=n)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),pS=function(){function t(e){HE(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return VE(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,r=this.interiorRings.length;e<r;e++){var n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}]),t}(),dS=function(){function t(e){HE(this,t),this.rings=e,this.polys=this._composePolys(e)}return VE(t,[{key:"getGeom",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++){var n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}},{key:"_composePolys",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];if(!i.poly)if(i.isExteriorRing())e.push(new pS(i));else{var o=i.enclosingRing();o.poly||e.push(new pS(o)),o.poly.addInterior(i)}}return e}}]),t}(),gS=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:uS.compare;HE(this,t),this.queue=e,this.tree=new DE(r),this.segments=[]}return VE(t,[{key:"process",value:function(t){var e=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),r;var n=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!n)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=n,o=n,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){var l=null;if(s){var u=s.getIntersection(e);if(null!==u&&(e.isAnEndpoint(u)||(l=u),!s.isAnEndpoint(u)))for(var h=this._splitSafely(s,u),c=0,A=h.length;c<A;c++)r.push(h[c])}var f=null;if(a){var p=a.getIntersection(e);if(null!==p&&(e.isAnEndpoint(p)||(f=p),!a.isAnEndpoint(p)))for(var d=this._splitSafely(a,p),g=0,y=d.length;g<y;g++)r.push(d[g])}if(null!==l||null!==f){var m;m=null===l?f:null===f||aS.comparePoints(l,f)<=0?l:f,this.queue.remove(e.rightSE),r.push(e.rightSE);for(var v=e.split(m),_=0,w=v.length;_<w;_++)r.push(v[_])}r.length>0?(this.tree.remove(e),r.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){var b=s.getIntersection(a);if(null!==b){if(!s.isAnEndpoint(b))for(var x=this._splitSafely(s,b),C=0,E=x.length;C<E;C++)r.push(x[C]);if(!a.isAnEndpoint(b))for(var S=this._splitSafely(a,b),B=0,I=S.length;B<I;B++)r.push(S[B])}}this.tree.remove(e)}return r}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var r=t.rightSE;this.queue.remove(r);var n=t.split(e);return n.push(r),void 0===t.consumedBy&&this.tree.insert(t),n}}]),t}(),yS="undefined"!=typeof process&&{}.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,mS="undefined"!=typeof process&&{}.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,vS=new(function(){function t(){HE(this,t)}return VE(t,[{key:"run",value:function(t,e,r){vS.type=t,$E.reset();for(var n=[new AS(e,!0)],i=0,o=r.length;i<o;i++)n.push(new AS(r[i],!1));if(vS.numMultiPolys=n.length,"difference"===vS.type)for(var s=n[0],a=1;a<n.length;)null!==qE(n[a].bbox,s.bbox)?a++:n.splice(a,1);if("intersection"===vS.type)for(var l=0,u=n.length;l<u;l++)for(var h=n[l],c=l+1,A=n.length;c<A;c++)if(null===qE(h.bbox,n[c].bbox))return[];for(var f=new DE(aS.compare),p=0,d=n.length;p<d;p++)for(var g=n[p].getSweepEvents(),y=0,m=g.length;y<m;y++)if(f.insert(g[y]),f.size>yS)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var v=new gS(f),_=f.size,w=f.pop();w;){var b=w.key;if(f.size===_){var x=b.segment;throw new Error("Unable to pop() ".concat(b.isLeft?"left":"right"," SweepEvent ")+"[".concat(b.point.x,", ").concat(b.point.y,"] from segment #").concat(x.id," ")+"[".concat(x.leftSE.point.x,", ").concat(x.leftSE.point.y,"] -> ")+"[".concat(x.rightSE.point.x,", ").concat(x.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(f.size>yS)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(v.segments.length>mS)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var C=v.process(b),E=0,S=C.length;E<S;E++){var B=C[E];void 0===B.consumedBy&&f.insert(B)}_=f.size,w=f.pop()}$E.reset();var I=fS.factory(v.segments);return new dS(I).getGeom()}}]),t}()),_S={union:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return vS.run("union",t,r)},intersection:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return vS.run("intersection",t,r)},xor:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return vS.run("xor",t,r)},difference:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return vS.run("difference",t,r)}};const wS=_S;"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(null==this)throw new TypeError(this+" is not an object");var e=Object(this),r=Math.max(Math.min(e.length,9007199254740991),0)||0,n=1 in arguments&&parseInt(Number(arguments[1]),10)||0;n=n<0?Math.max(r+n,0):Math.min(n,r);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:r;for(i=i<0?Math.max(r+arguments[2],0):Math.min(i,r);n<i;)e[n]=t,++n;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var bS=function(){};bS.prototype.interfaces_=function(){return[]},bS.prototype.getClass=function(){return bS},bS.prototype.equalsWithTolerance=function(t,e,r){return Math.abs(t-e)<=r};var xS=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),CS=function(){},ES={MAX_VALUE:{configurable:!0}};CS.isNaN=function(t){return Number.isNaN(t)},CS.doubleToLongBits=function(t){return t},CS.longBitsToDouble=function(t){return t},CS.isInfinite=function(t){return!Number.isFinite(t)},ES.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(CS,ES);var SS=function(){},BS=function(){},IS=function(){};function TS(){}var PS=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])},FS={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};PS.prototype.setOrdinate=function(t,e){switch(t){case PS.X:this.x=e;break;case PS.Y:this.y=e;break;case PS.Z:this.z=e;break;default:throw new xS("Invalid ordinate index: "+t)}},PS.prototype.equals2D=function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!bS.equalsWithTolerance(this.x,e.x,r)&&!!bS.equalsWithTolerance(this.y,e.y,r)}},PS.prototype.getOrdinate=function(t){switch(t){case PS.X:return this.x;case PS.Y:return this.y;case PS.Z:return this.z}throw new xS("Invalid ordinate index: "+t)},PS.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||CS.isNaN(this.z))&&CS.isNaN(t.z)},PS.prototype.equals=function(t){return t instanceof PS&&this.equals2D(t)},PS.prototype.equalInZ=function(t,e){return bS.equalsWithTolerance(this.z,t.z,e)},PS.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},PS.prototype.clone=function(){},PS.prototype.copy=function(){return new PS(this)},PS.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},PS.prototype.distance3D=function(t){var e=this.x-t.x,r=this.y-t.y,n=this.z-t.z;return Math.sqrt(e*e+r*r+n*n)},PS.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},PS.prototype.hashCode=function(){var t=17;return 37*(t=37*t+PS.hashCode(this.x))+PS.hashCode(this.y)},PS.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},PS.prototype.interfaces_=function(){return[SS,BS,TS]},PS.prototype.getClass=function(){return PS},PS.hashCode=function(){if(1===arguments.length){var t=arguments[0],e=CS.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}},FS.DimensionalComparator.get=function(){return LS},FS.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},FS.NULL_ORDINATE.get=function(){return CS.NaN},FS.X.get=function(){return 0},FS.Y.get=function(){return 1},FS.Z.get=function(){return 2},Object.defineProperties(PS,FS);var LS=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 xS("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};LS.prototype.compare=function(t,e){var r=t,n=e,i=LS.compare(r.x,n.x);if(0!==i)return i;var o=LS.compare(r.y,n.y);return 0!==o?o:this._dimensionsToTest<=2?0:LS.compare(r.z,n.z)},LS.prototype.interfaces_=function(){return[IS]},LS.prototype.getClass=function(){return LS},LS.compare=function(t,e){return t<e?-1:t>e?1:CS.isNaN(t)?CS.isNaN(e)?0:-1:CS.isNaN(e)?1:0};var MS=function(){};MS.prototype.create=function(){},MS.prototype.interfaces_=function(){return[]},MS.prototype.getClass=function(){return MS};var OS=function(){},kS={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};OS.prototype.interfaces_=function(){return[]},OS.prototype.getClass=function(){return OS},OS.toLocationSymbol=function(t){switch(t){case OS.EXTERIOR:return"e";case OS.BOUNDARY:return"b";case OS.INTERIOR:return"i";case OS.NONE:return"-"}throw new xS("Unknown location value: "+t)},kS.INTERIOR.get=function(){return 0},kS.BOUNDARY.get=function(){return 1},kS.EXTERIOR.get=function(){return 2},kS.NONE.get=function(){return-1},Object.defineProperties(OS,kS);var NS=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},RS=function(){},US={LOG_10:{configurable:!0}};RS.prototype.interfaces_=function(){return[]},RS.prototype.getClass=function(){return RS},RS.log10=function(t){var e=Math.log(t);return CS.isInfinite(e)||CS.isNaN(e)?e:e/RS.LOG_10},RS.min=function(t,e,r,n){var i=t;return e<i&&(i=e),r<i&&(i=r),n<i&&(i=n),i},RS.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],r=arguments[2];return t<e?e:t>r?r:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var n=arguments[0],i=arguments[1],o=arguments[2];return n<i?i:n>o?o:n}},RS.wrap=function(t,e){return t<0?e- -t%e:t%e},RS.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[0];return t>r&&(r=t),e>r&&(r=e),r}if(4===arguments.length){var n=arguments[1],i=arguments[2],o=arguments[3],s=arguments[0];return n>s&&(s=n),i>s&&(s=i),o>s&&(s=o),s}},RS.average=function(t,e){return(t+e)/2},US.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(RS,US);var DS=function(t){this.str=t};DS.prototype.append=function(t){this.str+=t},DS.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},DS.prototype.toString=function(t){return this.str};var QS=function(t){this.value=t};QS.prototype.intValue=function(){return this.value},QS.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},QS.isNaN=function(t){return Number.isNaN(t)};var GS=function(){};GS.isWhitespace=function(t){return t<=32&&t>=0||127===t},GS.toUpperCase=function(t){return t.toUpperCase()};var jS=function t(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length)if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}else"string"==typeof arguments[0]&&t.call(this,t.parse(arguments[0]));else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n,i)}},HS={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}};jS.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},jS.prototype.extractSignificantDigits=function(t,e){var r=this.abs(),n=jS.magnitude(r._hi),i=jS.TEN.pow(n);(r=r.divide(i)).gt(jS.TEN)?(r=r.divide(jS.TEN),n+=1):r.lt(jS.ONE)&&(r=r.multiply(jS.TEN),n-=1);for(var o=n+1,s=new DS,a=jS.MAX_PRINT_DIGITS-1,l=0;l<=a;l++){t&&l===o&&s.append(".");var u=Math.trunc(r._hi);if(u<0)break;var h=!1,c=0;u>9?(h=!0,c="9"):c="0"+u,s.append(c),r=r.subtract(jS.valueOf(u)).multiply(jS.TEN),h&&r.selfAdd(jS.TEN);var A=!0,f=jS.magnitude(r._hi);if(f<0&&Math.abs(f)>=a-l&&(A=!1),!A)break}return e[0]=n,s.toString()},jS.prototype.sqr=function(){return this.multiply(this)},jS.prototype.doubleValue=function(){return this._hi+this._lo},jS.prototype.subtract=function(){if(arguments[0]instanceof jS){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},jS.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},jS.prototype.isZero=function(){return 0===this._hi&&0===this._lo},jS.prototype.selfSubtract=function(){if(arguments[0]instanceof jS){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)}},jS.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},jS.prototype.min=function(t){return this.le(t)?this:t},jS.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof jS){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var r,n,i,o,s=arguments[0],a=arguments[1],l=null,u=null,h=null,c=null;return i=this._hi/s,c=(l=(h=jS.SPLIT*i)-(l=h-i))*(u=(c=jS.SPLIT*s)-(u=c-s))-(o=i*s)+l*(n=s-u)+(r=i-l)*u+r*n,c=i+(h=(this._hi-o-c+this._lo-i*a)/s),this._hi=c,this._lo=i-c+h,this}},jS.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},jS.prototype.divide=function(){if(arguments[0]instanceof jS){var t,e,r,n,i=arguments[0],o=null,s=null,a=null,l=null;return t=(r=this._hi/i._hi)-(o=(a=jS.SPLIT*r)-(o=a-r)),l=o*(s=(l=jS.SPLIT*i._hi)-(s=l-i._hi))-(n=r*i._hi)+o*(e=i._hi-s)+t*s+t*e,a=(this._hi-n-l+this._lo-r*i._lo)/i._hi,new jS(l=r+a,r-l+a)}if("number"==typeof arguments[0]){var u=arguments[0];return CS.isNaN(u)?jS.createNaN():jS.copy(this).selfDivide(u,0)}},jS.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},jS.prototype.pow=function(t){if(0===t)return jS.valueOf(1);var e=new jS(this),r=jS.valueOf(1),n=Math.abs(t);if(n>1)for(;n>0;)n%2==1&&r.selfMultiply(e),(n/=2)>0&&(e=e.sqr());else r=e;return t<0?r.reciprocal():r},jS.prototype.ceil=function(){if(this.isNaN())return jS.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new jS(t,e)},jS.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},jS.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},jS.prototype.setValue=function(){if(arguments[0]instanceof jS){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},jS.prototype.max=function(t){return this.ge(t)?this:t},jS.prototype.sqrt=function(){if(this.isZero())return jS.valueOf(0);if(this.isNegative())return jS.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,r=jS.valueOf(e),n=this.subtract(r.sqr())._hi*(.5*t);return r.add(n)},jS.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof jS){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,r,n,i,o,s=arguments[0],a=null;return a=(n=this._hi+s)-(i=n-this._hi),r=(o=(a=s-i+(this._hi-a))+this._lo)+(n-(e=n+o)),this._hi=e+r,this._lo=r+(e-this._hi),this}}else if(2===arguments.length){var l,u,h,c,A=arguments[0],f=arguments[1],p=null,d=null,g=null;h=this._hi+A,u=this._lo+f,d=h-(g=h-this._hi),p=u-(c=u-this._lo);var y=(l=h+(g=(d=A-g+(this._hi-d))+u))+(g=(p=f-c+(this._lo-p))+(g+(h-l))),m=g+(l-y);return this._hi=y,this._lo=m,this}},jS.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof jS){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var r,n,i=arguments[0],o=arguments[1],s=null,a=null,l=null,u=null;s=(l=jS.SPLIT*this._hi)-this._hi,u=jS.SPLIT*i,s=l-s,r=this._hi-s,a=u-i;var h=(l=this._hi*i)+(u=s*(a=u-a)-l+s*(n=i-a)+r*a+r*n+(this._hi*o+this._lo*i)),c=u+(s=l-h);return this._hi=h,this._lo=c,this}},jS.prototype.selfSqr=function(){return this.selfMultiply(this)},jS.prototype.floor=function(){if(this.isNaN())return jS.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new jS(t,e)},jS.prototype.negate=function(){return this.isNaN()?this:new jS(-this._hi,-this._lo)},jS.prototype.clone=function(){},jS.prototype.multiply=function(){if(arguments[0]instanceof jS){var t=arguments[0];return t.isNaN()?jS.createNaN():jS.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return CS.isNaN(e)?jS.createNaN():jS.copy(this).selfMultiply(e,0)}},jS.prototype.isNaN=function(){return CS.isNaN(this._hi)},jS.prototype.intValue=function(){return Math.trunc(this._hi)},jS.prototype.toString=function(){var t=jS.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},jS.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!0,e),n=e[0]+1,i=r;if("."===r.charAt(0))i="0"+r;else if(n<0)i="0."+jS.stringOfChar("0",-n)+r;else if(-1===r.indexOf(".")){var o=n-r.length;i=r+jS.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},jS.prototype.reciprocal=function(){var t,e,r,n,i=null,o=null,s=null,a=null;t=(r=1/this._hi)-(i=(s=jS.SPLIT*r)-(i=s-r)),o=(a=jS.SPLIT*this._hi)-this._hi;var l=r+(s=(1-(n=r*this._hi)-(a=i*(o=a-o)-n+i*(e=this._hi-o)+t*o+t*e)-r*this._lo)/this._hi);return new jS(l,r-l+s)},jS.prototype.toSciNotation=function(){if(this.isZero())return jS.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!1,e),n=jS.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===r.charAt(0))throw new Error("Found leading zero: "+r);var i="";r.length>1&&(i=r.substring(1));var o=r.charAt(0)+"."+i;return this.isNegative()?"-"+o+n:o+n},jS.prototype.abs=function(){return this.isNaN()?jS.NaN:this.isNegative()?this.negate():new jS(this)},jS.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},jS.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},jS.prototype.add=function(){if(arguments[0]instanceof jS){var t=arguments[0];return jS.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return jS.copy(this).selfAdd(e)}},jS.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 jS){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._hi=r,this._lo=n}},jS.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},jS.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},jS.prototype.trunc=function(){return this.isNaN()?jS.NaN:this.isPositive()?this.floor():this.ceil()},jS.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},jS.prototype.interfaces_=function(){return[TS,SS,BS]},jS.prototype.getClass=function(){return jS},jS.sqr=function(t){return jS.valueOf(t).selfMultiply(t)},jS.valueOf=function(){if("string"==typeof arguments[0]){var t=arguments[0];return jS.parse(t)}if("number"==typeof arguments[0])return new jS(arguments[0])},jS.sqrt=function(t){return jS.valueOf(t).sqrt()},jS.parse=function(t){for(var e=0,r=t.length;GS.isWhitespace(t.charAt(e));)e++;var n=!1;if(e<r){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(n=!0))}for(var o=new jS,s=0,a=0,l=0;!(e>=r);){var u=t.charAt(e);if(e++,GS.isDigit(u)){var h=u-"0";o.selfMultiply(jS.TEN),o.selfAdd(h),s++}else{if("."!==u){if("e"===u||"E"===u){var c=t.substring(e);try{l=QS.parseInt(c)}catch(g){throw g instanceof Error?new Error("Invalid exponent "+c+" in string "+t):g}break}throw new Error("Unexpected character '"+u+"' at position "+e+" in string "+t)}a=s}}var A=o,f=s-a-l;if(0===f)A=o;else if(f>0){var p=jS.TEN.pow(f);A=o.divide(p)}else if(f<0){var d=jS.TEN.pow(-f);A=o.multiply(d)}return n?A.negate():A},jS.createNaN=function(){return new jS(CS.NaN,CS.NaN)},jS.copy=function(t){return new jS(t)},jS.magnitude=function(t){var e=Math.abs(t),r=Math.log(e)/Math.log(10),n=Math.trunc(Math.floor(r));return 10*Math.pow(10,n)<=e&&(n+=1),n},jS.stringOfChar=function(t,e){for(var r=new DS,n=0;n<e;n++)r.append(t);return r.toString()},HS.PI.get=function(){return new jS(3.141592653589793,12246467991473532e-32)},HS.TWO_PI.get=function(){return new jS(6.283185307179586,24492935982947064e-32)},HS.PI_2.get=function(){return new jS(1.5707963267948966,6123233995736766e-32)},HS.E.get=function(){return new jS(2.718281828459045,14456468917292502e-32)},HS.NaN.get=function(){return new jS(CS.NaN,CS.NaN)},HS.EPS.get=function(){return 123259516440783e-46},HS.SPLIT.get=function(){return 134217729},HS.MAX_PRINT_DIGITS.get=function(){return 32},HS.TEN.get=function(){return jS.valueOf(10)},HS.ONE.get=function(){return jS.valueOf(1)},HS.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},HS.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(jS,HS);var zS=function(){},VS={DP_SAFE_EPSILON:{configurable:!0}};zS.prototype.interfaces_=function(){return[]},zS.prototype.getClass=function(){return zS},zS.orientationIndex=function(t,e,r){var n=zS.orientationIndexFilter(t,e,r);if(n<=1)return n;var i=jS.valueOf(e.x).selfAdd(-t.x),o=jS.valueOf(e.y).selfAdd(-t.y),s=jS.valueOf(r.x).selfAdd(-e.x),a=jS.valueOf(r.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},zS.signOfDet2x2=function(t,e,r,n){return t.multiply(n).selfSubtract(e.multiply(r)).signum()},zS.intersection=function(t,e,r,n){var i=jS.valueOf(n.y).selfSubtract(r.y).selfMultiply(jS.valueOf(e.x).selfSubtract(t.x)),o=jS.valueOf(n.x).selfSubtract(r.x).selfMultiply(jS.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=jS.valueOf(n.x).selfSubtract(r.x).selfMultiply(jS.valueOf(t.y).selfSubtract(r.y)),l=jS.valueOf(n.y).selfSubtract(r.y).selfMultiply(jS.valueOf(t.x).selfSubtract(r.x)),u=a.subtract(l).selfDivide(s).doubleValue(),h=jS.valueOf(t.x).selfAdd(jS.valueOf(e.x).selfSubtract(t.x).selfMultiply(u)).doubleValue(),c=jS.valueOf(e.x).selfSubtract(t.x).selfMultiply(jS.valueOf(t.y).selfSubtract(r.y)),A=jS.valueOf(e.y).selfSubtract(t.y).selfMultiply(jS.valueOf(t.x).selfSubtract(r.x)),f=c.subtract(A).selfDivide(s).doubleValue(),p=jS.valueOf(r.y).selfAdd(jS.valueOf(n.y).selfSubtract(r.y).selfMultiply(f)).doubleValue();return new PS(h,p)},zS.orientationIndexFilter=function(t,e,r){var n=null,i=(t.x-r.x)*(e.y-r.y),o=(t.y-r.y)*(e.x-r.x),s=i-o;if(i>0){if(o<=0)return zS.signum(s);n=i+o}else{if(!(i<0))return zS.signum(s);if(o>=0)return zS.signum(s);n=-i-o}var a=zS.DP_SAFE_EPSILON*n;return s>=a||-s>=a?zS.signum(s):2},zS.signum=function(t){return t>0?1:t<0?-1:0},VS.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(zS,VS);var KS=function(){},qS={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};qS.X.get=function(){return 0},qS.Y.get=function(){return 1},qS.Z.get=function(){return 2},qS.M.get=function(){return 3},KS.prototype.setOrdinate=function(t,e,r){},KS.prototype.size=function(){},KS.prototype.getOrdinate=function(t,e){},KS.prototype.getCoordinate=function(){},KS.prototype.getCoordinateCopy=function(t){},KS.prototype.getDimension=function(){},KS.prototype.getX=function(t){},KS.prototype.clone=function(){},KS.prototype.expandEnvelope=function(t){},KS.prototype.copy=function(){},KS.prototype.getY=function(t){},KS.prototype.toCoordinateArray=function(){},KS.prototype.interfaces_=function(){return[BS]},KS.prototype.getClass=function(){return KS},Object.defineProperties(KS,qS);var WS=function(){},XS=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}(WS),YS=function(){};YS.arraycopy=function(t,e,r,n,i){for(var o=0,s=e;s<e+i;s++)r[n+o]=t[s],o++},YS.getProperty=function(t){return{"line.separator":"\n"}[t]};var ZS=function t(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this.x=r,this.y=n,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof PS&&arguments[1]instanceof PS){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 l=arguments[0],u=arguments[1],h=arguments[2];this.x=l,this.y=u,this.w=h}else if(4===arguments.length){var c=arguments[0],A=arguments[1],f=arguments[2],p=arguments[3],d=c.y-A.y,g=A.x-c.x,y=c.x*A.y-A.x*c.y,m=f.y-p.y,v=p.x-f.x,_=f.x*p.y-p.x*f.y;this.x=g*_-v*y,this.y=m*y-d*_,this.w=d*v-m*g}};ZS.prototype.getY=function(){var t=this.y/this.w;if(CS.isNaN(t)||CS.isInfinite(t))throw new XS;return t},ZS.prototype.getX=function(){var t=this.x/this.w;if(CS.isNaN(t)||CS.isInfinite(t))throw new XS;return t},ZS.prototype.getCoordinate=function(){var t=new PS;return t.x=this.getX(),t.y=this.getY(),t},ZS.prototype.interfaces_=function(){return[]},ZS.prototype.getClass=function(){return ZS},ZS.intersection=function(t,e,r,n){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=r.y-n.y,l=n.x-r.x,u=r.x*n.y-n.x*r.y,h=i*l-a*o,c=(o*u-l*s)/h,A=(a*s-i*u)/h;if(CS.isNaN(c)||CS.isInfinite(c)||CS.isNaN(A)||CS.isInfinite(A))throw new XS;return new PS(c,A)};var JS=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 PS){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],l=arguments[3];this.init(o,s,a,l)}},$S={serialVersionUID:{configurable:!0}};JS.prototype.getArea=function(){return this.getWidth()*this.getHeight()},JS.prototype.equals=function(t){if(!(t instanceof JS))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()},JS.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new JS;var e=this._minx>t._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny,n=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new JS(e,n,r,i)},JS.prototype.isNull=function(){return this._maxx<this._minx},JS.prototype.getMaxX=function(){return this._maxx},JS.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof PS){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof JS){var e=arguments[0];return!this.isNull()&&!e.isNull()&&e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&r>=this._minx&&r<=this._maxx&&n>=this._miny&&n<=this._maxy}},JS.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof JS){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 PS){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&!(r>this._maxx||r<this._minx||n>this._maxy||n<this._miny)}},JS.prototype.getMinY=function(){return this._miny},JS.prototype.getMinX=function(){return this._minx},JS.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof PS){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof JS){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=n,this._maxy=n):(r<this._minx&&(this._minx=r),r>this._maxx&&(this._maxx=r),n<this._miny&&(this._miny=n),n>this._maxy&&(this._maxy=n))}},JS.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},JS.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},JS.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},JS.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},JS.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},JS.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},JS.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},JS.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},JS.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},JS.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof JS){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof PS){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.covers(r,n)}},JS.prototype.centre=function(){return this.isNull()?null:new PS((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},JS.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof PS){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof JS){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.init(r.x,n.x,r.y,n.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];i<o?(this._minx=i,this._maxx=o):(this._minx=o,this._maxx=i),s<a?(this._miny=s,this._maxy=a):(this._miny=a,this._maxy=s)}},JS.prototype.getMaxY=function(){return this._maxy},JS.prototype.distance=function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var r=0;return this._maxy<t._miny?r=t._miny-this._maxy:this._miny>t._maxy&&(r=this._miny-t._maxy),0===e?r:0===r?e:Math.sqrt(e*e+r*r)},JS.prototype.hashCode=function(){var t=17;return 37*(t=37*(t=37*(t=37*t+PS.hashCode(this._minx))+PS.hashCode(this._maxx))+PS.hashCode(this._miny))+PS.hashCode(this._maxy)},JS.prototype.interfaces_=function(){return[SS,TS]},JS.prototype.getClass=function(){return JS},JS.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2];return r.x>=(t.x<e.x?t.x:e.x)&&r.x<=(t.x>e.x?t.x:e.x)&&r.y>=(t.y<e.y?t.y:e.y)&&r.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),l=Math.max(o.x,s.x),u=Math.min(n.x,i.x),h=Math.max(n.x,i.x);return!(u>l||h<a||(a=Math.min(o.y,s.y),l=Math.max(o.y,s.y),u=Math.min(n.y,i.y),h=Math.max(n.y,i.y),u>l||h<a))}},$S.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(JS,$S);var tB={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*$/},eB=function(t){this.geometryFactory=t||new GI};eB.prototype.read=function(t){var e,r,n;t=t.replace(/[\n\r]/g," ");var i=tB.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=tB.emptyTypeStr.exec(t))[2]=void 0),i&&(r=i[1].toLowerCase(),n=i[2],nB[r]&&(e=nB[r].apply(this,[n]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},eB.prototype.write=function(t){return this.extractGeometry(t)},eB.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!rB[e])return null;var r=e.toUpperCase();return t.isEmpty()?r+" EMPTY":r+"("+rB[e].apply(this,[t])+")"};var rB={coordinate:function(t){return t.x+" "+t.y},point:function(t){return rB.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+rB.point.apply(this,[t._geometries[r]])+")");return e.join(",")},linestring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(rB.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},linearring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(rB.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},multilinestring:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+rB.linestring.apply(this,[t._geometries[r]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+rB.linestring.apply(this,[t._shell])+")");for(var r=0,n=t._holes.length;r<n;++r)e.push("("+rB.linestring.apply(this,[t._holes[r]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+rB.polygon.apply(this,[t._geometries[r]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push(this.extractGeometry(t._geometries[r]));return e.join(",")}},nB={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(tB.spaces);return this.geometryFactory.createPoint(new PS(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPoint();for(var r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(tB.trimParens,"$1"),n.push(nB.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(n)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(tB.spaces),n.push(new PS(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(n)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(tB.spaces),n.push(new PS(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(n)},multilinestring:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiLineString();for(var r=t.trim().split(tB.parenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(tB.trimParens,"$1"),n.push(nB.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(n)},polygon:function(t){var e,r,n;if(void 0===t)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(tB.parenComma),s=[],a=0,l=o.length;a<l;++a)e=o[a].replace(tB.trimParens,"$1"),r=nB.linestring.apply(this,[e]),n=this.geometryFactory.createLinearRing(r._points),0===a?i=n:s.push(n);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var r=t.trim().split(tB.doubleParenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(tB.trimParens,"$1"),n.push(nB.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(n)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),r=[],n=0,i=e.length;n<i;++n)r.push(this.read(e[n]));return this.geometryFactory.createGeometryCollection(r)}},iB=function(t){this.parser=new eB(t)};iB.prototype.write=function(t){return this.parser.write(t)},iB.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var oB=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),sB=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}(oB),aB=function(){};aB.prototype.interfaces_=function(){return[]},aB.prototype.getClass=function(){return aB},aB.shouldNeverReachHere=function(){if(0===arguments.length)aB.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new sB("Should never reach here"+(null!==t?": "+t:""))}},aB.isTrue=function(){var t,e;if(1===arguments.length)t=arguments[0],aB.isTrue(t,null);else if(2===arguments.length&&(e=arguments[1],!(t=arguments[0])))throw null===e?new sB:new sB(e)},aB.equals=function(){var t,e,r;if(2===arguments.length)t=arguments[0],e=arguments[1],aB.equals(t,e,null);else if(3===arguments.length&&(t=arguments[0],r=arguments[2],!(e=arguments[1]).equals(t)))throw new sB("Expected "+t+" but encountered "+e+(null!==r?": "+r:""))};var lB=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 PS,this._intPt[1]=new PS,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},uB={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};lB.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},lB.prototype.getTopologySummary=function(){var t=new DS;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},lB.prototype.computeIntersection=function(t,e,r,n){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=r,this._inputLines[1][1]=n,this._result=this.computeIntersect(t,e,r,n)},lB.prototype.getIntersectionNum=function(){return this._result},lB.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)}},lB.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},lB.prototype.setPrecisionModel=function(t){this._precisionModel=t},lB.prototype.isInteriorIntersection=function(){var t=this;if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var e=arguments[0],r=0;r<this._result;r++)if(!t._intPt[r].equals2D(t._inputLines[e][0])&&!t._intPt[r].equals2D(t._inputLines[e][1]))return!0;return!1}},lB.prototype.getIntersection=function(t){return this._intPt[t]},lB.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},lB.prototype.hasIntersection=function(){return this._result!==lB.NO_INTERSECTION},lB.prototype.getEdgeDistance=function(t,e){return lB.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},lB.prototype.isCollinear=function(){return this._result===lB.COLLINEAR_INTERSECTION},lB.prototype.toString=function(){return iB.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+iB.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},lB.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},lB.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},lB.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},lB.prototype.interfaces_=function(){return[]},lB.prototype.getClass=function(){return lB},lB.computeEdgeDistance=function(t,e,r){var n=Math.abs(r.x-e.x),i=Math.abs(r.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(r))o=n>i?n:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=n>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return aB.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},lB.nonRobustComputeEdgeDistance=function(t,e,r){var n=t.x-e.x,i=t.y-e.y,o=Math.sqrt(n*n+i*i);return aB.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},uB.DONT_INTERSECT.get=function(){return 0},uB.DO_INTERSECT.get=function(){return 1},uB.COLLINEAR.get=function(){return 2},uB.NO_INTERSECTION.get=function(){return 0},uB.POINT_INTERSECTION.get=function(){return 1},uB.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(lB,uB);var hB=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 JS(this._inputLines[0][0],this._inputLines[0][1]),r=new JS(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&r.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],r=arguments[1],n=arguments[2];if(this._isProper=!1,JS.intersects(r,n,e)&&0===fB.orientationIndex(r,n,e)&&0===fB.orientationIndex(n,r,e))return this._isProper=!0,(e.equals(r)||e.equals(n))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,r,n,i){i.x=this.smallestInAbsValue(t.x,e.x,r.x,n.x),i.y=this.smallestInAbsValue(t.y,e.y,r.y,n.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,r,n,i){var o=null;try{o=ZS.intersection(t,r,n,i)}catch(UW){if(!(UW instanceof XS))throw UW;o=e.nearestEndpoint(t,r,n,i)}return o},e.prototype.intersection=function(t,r,n,i){var o=this.intersectionWithNormalization(t,r,n,i);return this.isInSegmentEnvelopes(o)||(o=new PS(e.nearestEndpoint(t,r,n,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,r,n){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(r)<o&&(i=r,o=Math.abs(r)),Math.abs(n)<o&&(i=n),i},e.prototype.checkDD=function(t,e,r,n,i){var o=zS.intersection(t,e,r,n),s=this.isInSegmentEnvelopes(o);YS.out.println("DD in env = "+s+" --------------------- "+o),i.distance(o)>1e-4&&YS.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,r,n){var i=new PS(t),o=new PS(e),s=new PS(r),a=new PS(n),l=new PS;this.normalizeToEnvCentre(i,o,s,a,l);var u=this.safeHCoordinateIntersection(i,o,s,a);return u.x+=l.x,u.y+=l.y,u},e.prototype.computeCollinearIntersection=function(e,r,n,i){var o=JS.intersects(e,r,n),s=JS.intersects(e,r,i),a=JS.intersects(n,i,e),l=JS.intersects(n,i,r);return o&&s?(this._intPt[0]=n,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&l?(this._intPt[0]=e,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||s||l?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&l?(this._intPt[0]=n,this._intPt[1]=r,!n.equals(r)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||l?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&l?(this._intPt[0]=i,this._intPt[1]=r,!i.equals(r)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,r,n,i){var o=t.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,l=t.y>e.y?t.y:e.y,u=r.x<n.x?r.x:n.x,h=r.y<n.y?r.y:n.y,c=r.x>n.x?r.x:n.x,A=r.y>n.y?r.y:n.y,f=((o>u?o:u)+(a<c?a:c))/2,p=((s>h?s:h)+(l<A?l:A))/2;i.x=f,i.y=p,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.computeIntersect=function(e,r,n,i){if(this._isProper=!1,!JS.intersects(e,r,n,i))return t.NO_INTERSECTION;var o=fB.orientationIndex(e,r,n),s=fB.orientationIndex(e,r,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=fB.orientationIndex(n,i,e),l=fB.orientationIndex(n,i,r);return a>0&&l>0||a<0&&l<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===l?this.computeCollinearIntersection(e,r,n,i):(0===o||0===s||0===a||0===l?(this._isProper=!1,e.equals2D(n)||e.equals2D(i)?this._intPt[0]=e:r.equals2D(n)||r.equals2D(i)?this._intPt[0]=r:0===o?this._intPt[0]=new PS(n):0===s?this._intPt[0]=new PS(i):0===a?this._intPt[0]=new PS(e):0===l&&(this._intPt[0]=new PS(r))):(this._isProper=!0,this._intPt[0]=this.intersection(e,r,n,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,r,n){var i=t,o=fB.distancePointLine(t,r,n),s=fB.distancePointLine(e,r,n);return s<o&&(o=s,i=e),(s=fB.distancePointLine(r,t,e))<o&&(o=s,i=r),(s=fB.distancePointLine(n,t,e))<o&&(o=s,i=n),i},e}(lB),cB=function(){};cB.prototype.interfaces_=function(){return[]},cB.prototype.getClass=function(){return cB},cB.orientationIndex=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=r.x-e.x,s=r.y-e.y;return cB.signOfDet2x2(n,i,o,s)},cB.signOfDet2x2=function(t,e,r,n){var i=null,o=null,s=null;if(i=1,0===t||0===n)return 0===e||0===r?0:e>0?r>0?-i:i:r>0?i:-i;if(0===e||0===r)return n>0?t>0?i:-i:t>0?-i:i;if(e>0?n>0?e<=n||(i=-i,o=t,t=r,r=o,o=e,e=n,n=o):e<=-n?(i=-i,r=-r,n=-n):(o=t,t=-r,r=o,o=e,e=-n,n=o):n>0?-e<=n?(i=-i,t=-t,e=-e):(o=-t,t=r,r=o,o=-e,e=n,n=o):e>=n?(t=-t,e=-e,r=-r,n=-n):(i=-i,o=-t,t=-r,r=o,o=-e,e=-n,n=o),t>0){if(!(r>0))return i;if(!(t<=r))return i}else{if(r>0)return-i;if(!(t>=r))return-i;i=-i,t=-t,r=-r}for(;;){if((n-=(s=Math.floor(r/t))*e)<0)return-i;if(n>e)return i;if(t>(r-=s*t)+r){if(e<n+n)return i}else{if(e>n+n)return-i;r=t-r,n=e-n,i=-i}if(0===n)return 0===r?0:-i;if(0===r)return i;if((e-=(s=Math.floor(t/r))*n)<0)return i;if(e>n)return-i;if(r>(t-=s*r)+t){if(n<e+e)return-i}else{if(n>e+e)return i;t=r-t,e=n-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var AB=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};AB.prototype.countSegment=function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var r=t.x,n=e.x;return r>n&&(r=e.x,n=t.x),this._p.x>=r&&this._p.x<=n&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,l=cB.signOfDet2x2(i,o,s,a);if(0===l)return this._isPointOnSegment=!0,null;a<o&&(l=-l),l>0&&this._crossingCount++}},AB.prototype.isPointInPolygon=function(){return this.getLocation()!==OS.EXTERIOR},AB.prototype.getLocation=function(){return this._isPointOnSegment?OS.BOUNDARY:this._crossingCount%2==1?OS.INTERIOR:OS.EXTERIOR},AB.prototype.isOnSegment=function(){return this._isPointOnSegment},AB.prototype.interfaces_=function(){return[]},AB.prototype.getClass=function(){return AB},AB.locatePointInRing=function(){if(arguments[0]instanceof PS&&NS(arguments[1],KS)){for(var t=arguments[1],e=new AB(arguments[0]),r=new PS,n=new PS,i=1;i<t.size();i++)if(t.getCoordinate(i,r),t.getCoordinate(i-1,n),e.countSegment(r,n),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof PS&&arguments[1]instanceof Array){for(var o=arguments[1],s=new AB(arguments[0]),a=1;a<o.length;a++){var l=o[a],u=o[a-1];if(s.countSegment(l,u),s.isOnSegment())return s.getLocation()}return s.getLocation()}};var fB=function(){},pB={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};fB.prototype.interfaces_=function(){return[]},fB.prototype.getClass=function(){return fB},fB.orientationIndex=function(t,e,r){return zS.orientationIndex(t,e,r)},fB.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,r=t[0].x,n=1;n<t.length-1;n++){var i=t[n].x-r,o=t[n+1].y;e+=i*(t[n-1].y-o)}return e/2}if(NS(arguments[0],KS)){var s=arguments[0],a=s.size();if(a<3)return 0;var l=new PS,u=new PS,h=new PS;s.getCoordinate(0,u),s.getCoordinate(1,h);var c=u.x;h.x-=c;for(var A=0,f=1;f<a-1;f++)l.y=u.y,u.x=h.x,u.y=h.y,s.getCoordinate(f+1,h),h.x-=c,A+=u.x*(l.y-h.y);return A/2}},fB.distanceLineLine=function(t,e,r,n){if(t.equals(e))return fB.distancePointLine(t,r,n);if(r.equals(n))return fB.distancePointLine(n,t,e);var i=!1;if(JS.intersects(t,e,r,n)){var o=(e.x-t.x)*(n.y-r.y)-(e.y-t.y)*(n.x-r.x);if(0===o)i=!0;else{var s=(t.y-r.y)*(n.x-r.x)-(t.x-r.x)*(n.y-r.y),a=((t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y))/o,l=s/o;(l<0||l>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?RS.min(fB.distancePointLine(t,r,n),fB.distancePointLine(e,r,n),fB.distancePointLine(r,t,e),fB.distancePointLine(n,t,e)):0},fB.isPointInRing=function(t,e){return fB.locatePointInRing(t,e)!==OS.EXTERIOR},fB.computeLength=function(t){var e=t.size();if(e<=1)return 0;var r=0,n=new PS;t.getCoordinate(0,n);for(var i=n.x,o=n.y,s=1;s<e;s++){t.getCoordinate(s,n);var a=n.x,l=n.y,u=a-i,h=l-o;r+=Math.sqrt(u*u+h*h),i=a,o=l}return r},fB.isCCW=function(t){var e=t.length-1;if(e<3)throw new xS("Ring has fewer than 4 points, so orientation cannot be determined");for(var r=t[0],n=0,i=1;i<=e;i++){var o=t[i];o.y>r.y&&(r=o,n=i)}var s=n;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(r)&&s!==n);var a=n;do{a=(a+1)%e}while(t[a].equals2D(r)&&a!==n);var l=t[s],u=t[a];if(l.equals2D(r)||u.equals2D(r)||l.equals2D(u))return!1;var h=fB.computeOrientation(l,r,u);return 0===h?l.x>u.x:h>0},fB.locatePointInRing=function(t,e){return AB.locatePointInRing(t,e)},fB.distancePointLinePerpendicular=function(t,e,r){var n=(r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y),i=((e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y))/n;return Math.abs(i)*Math.sqrt(n)},fB.computeOrientation=function(t,e,r){return fB.orientationIndex(t,e,r)},fB.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new xS("Line array must contain at least one vertex");for(var r=t.distance(e[0]),n=0;n<e.length-1;n++){var i=fB.distancePointLine(t,e[n],e[n+1]);i<r&&(r=i)}return r}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var l=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),u=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/l;if(u<=0)return o.distance(s);if(u>=1)return o.distance(a);var h=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/l;return Math.abs(h)*Math.sqrt(l)}},fB.isOnLine=function(t,e){for(var r=new hB,n=1;n<e.length;n++){var i=e[n-1],o=e[n];if(r.computeIntersection(t,i,o),r.hasIntersection())return!0}return!1},pB.CLOCKWISE.get=function(){return-1},pB.RIGHT.get=function(){return fB.CLOCKWISE},pB.COUNTERCLOCKWISE.get=function(){return 1},pB.LEFT.get=function(){return fB.COUNTERCLOCKWISE},pB.COLLINEAR.get=function(){return 0},pB.STRAIGHT.get=function(){return fB.COLLINEAR},Object.defineProperties(fB,pB);var dB=function(){};dB.prototype.filter=function(t){},dB.prototype.interfaces_=function(){return[]},dB.prototype.getClass=function(){return dB};var gB=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},yB={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}};gB.prototype.isGeometryCollection=function(){return this.getSortIndex()===gB.SORTINDEX_GEOMETRYCOLLECTION},gB.prototype.getFactory=function(){return this._factory},gB.prototype.getGeometryN=function(t){return this},gB.prototype.getArea=function(){return 0},gB.prototype.isRectangle=function(){return!1},gB.prototype.equals=function(){if(arguments[0]instanceof gB){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof gB))return!1;var r=e;return this.equalsExact(r)}},gB.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},gB.prototype.geometryChanged=function(){this.apply(gB.geometryChangedFilter)},gB.prototype.geometryChangedAction=function(){this._envelope=null},gB.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},gB.prototype.getLength=function(){return 0},gB.prototype.getNumGeometries=function(){return 1},gB.prototype.compareTo=function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.getSortIndex()!==r.getSortIndex()?this.getSortIndex()-r.getSortIndex():this.isEmpty()&&r.isEmpty()?0:this.isEmpty()?-1:r.isEmpty()?1:this.compareToSameClass(r,n)}},gB.prototype.getUserData=function(){return this._userData},gB.prototype.getSRID=function(){return this._SRID},gB.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},gB.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===gB.SORTINDEX_GEOMETRYCOLLECTION)throw new xS("This method does not support GeometryCollection arguments")},gB.prototype.equal=function(t,e,r){return 0===r?t.equals(e):t.distance(e)<=r},gB.prototype.norm=function(){var t=this.copy();return t.normalize(),t},gB.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},gB.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new JS(this._envelope)},gB.prototype.setSRID=function(t){this._SRID=t},gB.prototype.setUserData=function(t){this._userData=t},gB.prototype.compare=function(t,e){for(var r=t.iterator(),n=e.iterator();r.hasNext()&&n.hasNext();){var i=r.next(),o=n.next(),s=i.compareTo(o);if(0!==s)return s}return r.hasNext()?1:n.hasNext()?-1:0},gB.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},gB.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===gB.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===gB.SORTINDEX_MULTIPOINT||this.getSortIndex()===gB.SORTINDEX_MULTILINESTRING||this.getSortIndex()===gB.SORTINDEX_MULTIPOLYGON},gB.prototype.interfaces_=function(){return[BS,SS,TS]},gB.prototype.getClass=function(){return gB},gB.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},gB.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},yB.serialVersionUID.get=function(){return 0x799ea46522854c00},yB.SORTINDEX_POINT.get=function(){return 0},yB.SORTINDEX_MULTIPOINT.get=function(){return 1},yB.SORTINDEX_LINESTRING.get=function(){return 2},yB.SORTINDEX_LINEARRING.get=function(){return 3},yB.SORTINDEX_MULTILINESTRING.get=function(){return 4},yB.SORTINDEX_POLYGON.get=function(){return 5},yB.SORTINDEX_MULTIPOLYGON.get=function(){return 6},yB.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},yB.geometryChangedFilter.get=function(){return mB},Object.defineProperties(gB,yB);var mB=function(){};mB.interfaces_=function(){return[dB]},mB.filter=function(t){t.geometryChangedAction()};var vB=function(){};vB.prototype.filter=function(t){},vB.prototype.interfaces_=function(){return[]},vB.prototype.getClass=function(){return vB};var _B=function(){},wB={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}};_B.prototype.isInBoundary=function(t){},_B.prototype.interfaces_=function(){return[]},_B.prototype.getClass=function(){return _B},wB.Mod2BoundaryNodeRule.get=function(){return bB},wB.EndPointBoundaryNodeRule.get=function(){return xB},wB.MultiValentEndPointBoundaryNodeRule.get=function(){return CB},wB.MonoValentEndPointBoundaryNodeRule.get=function(){return EB},wB.MOD2_BOUNDARY_RULE.get=function(){return new bB},wB.ENDPOINT_BOUNDARY_RULE.get=function(){return new xB},wB.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new CB},wB.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new EB},wB.OGC_SFS_BOUNDARY_RULE.get=function(){return _B.MOD2_BOUNDARY_RULE},Object.defineProperties(_B,wB);var bB=function(){};bB.prototype.isInBoundary=function(t){return t%2==1},bB.prototype.interfaces_=function(){return[_B]},bB.prototype.getClass=function(){return bB};var xB=function(){};xB.prototype.isInBoundary=function(t){return t>0},xB.prototype.interfaces_=function(){return[_B]},xB.prototype.getClass=function(){return xB};var CB=function(){};CB.prototype.isInBoundary=function(t){return t>1},CB.prototype.interfaces_=function(){return[_B]},CB.prototype.getClass=function(){return CB};var EB=function(){};EB.prototype.isInBoundary=function(t){return 1===t},EB.prototype.interfaces_=function(){return[_B]},EB.prototype.getClass=function(){return EB};var SB=function(){};function BB(t){this.message=t||""}SB.prototype.add=function(){},SB.prototype.addAll=function(){},SB.prototype.isEmpty=function(){},SB.prototype.iterator=function(){},SB.prototype.size=function(){},SB.prototype.toArray=function(){},SB.prototype.remove=function(){},BB.prototype=new Error,BB.prototype.name="IndexOutOfBoundsException";var IB=function(){};IB.prototype.hasNext=function(){},IB.prototype.next=function(){},IB.prototype.remove=function(){};var TB=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}(SB);function PB(t){this.message=t||""}PB.prototype=new Error,PB.prototype.name="NoSuchElementException";var FB=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof SB&&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,SB]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var r=this.array_[t];return this.array_[t]=e,r},e.prototype.iterator=function(){return new LB(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new BB;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,r=0,n=this.array_.length;r<n;r++)if(this.array_[r]===t){this.array_.splice(r,1),e=!0;break}return e},e}(TB),LB=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 PB;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}(IB),MB=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.ensureCapacity(r.length),this.add(r,n)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={coordArrayType:{configurable:!0}};return r.coordArrayType.get=function(){return new Array(0).fill(null)},e.prototype.getCoordinate=function(t){return this.get(t)},e.prototype.addAll=function(){if(2===arguments.length){for(var e=arguments[1],r=!1,n=arguments[0].iterator();n.hasNext();)this.add(n.next(),e),r=!0;return r}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),r=0;r<this.size();r++)e.add(r,this.get(r).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){var e=this;if(1===arguments.length){var r=arguments[0];t.prototype.add.call(this,r)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1];return this.add(n,i,!0),!0}if(arguments[0]instanceof PS&&"boolean"==typeof arguments[1]){var o=arguments[0];if(!arguments[1]&&this.size()>=1&&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 l=arguments[0],u=arguments[1];if(arguments[2])for(var h=0;h<l.length;h++)e.add(l[h],u);else for(var c=l.length-1;c>=0;c--)e.add(l[c],u);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof PS){var A=arguments[0],f=arguments[1];if(!arguments[2]){var p=this.size();if(p>0){if(A>0&&this.get(A-1).equals2D(f))return null;if(A<p&&this.get(A).equals2D(f))return null}}t.prototype.add.call(this,A,f)}}else if(4===arguments.length){var d=arguments[0],g=arguments[1],y=arguments[2],m=arguments[3],v=1;y>m&&(v=-1);for(var _=y;_!==m;_+=v)e.add(d[_],g);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new PS(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,r),e}(FB),OB=function(){},kB={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};kB.ForwardComparator.get=function(){return NB},kB.BidirectionalComparator.get=function(){return RB},kB.coordArrayType.get=function(){return new Array(0).fill(null)},OB.prototype.interfaces_=function(){return[]},OB.prototype.getClass=function(){return OB},OB.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))},OB.ptNotInList=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(OB.indexOf(n,e)<0)return n}return null},OB.scroll=function(t,e){var r=OB.indexOf(e,t);if(r<0)return null;var n=new Array(t.length).fill(null);YS.arraycopy(t,r,n,0,t.length-r),YS.arraycopy(t,0,n,t.length-r,r),YS.arraycopy(n,0,t,0,t.length)},OB.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(!t[r].equals(e[r]))return!1;return!0}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];if(n===i)return!0;if(null===n||null===i)return!1;if(n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(0!==o.compare(n[s],i[s]))return!1;return!0}},OB.intersection=function(t,e){for(var r=new MB,n=0;n<t.length;n++)e.intersects(t[n])&&r.add(t[n],!0);return r.toCoordinateArray()},OB.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},OB.removeRepeatedPoints=function(t){return OB.hasRepeatedPoints(t)?new MB(t,!1).toCoordinateArray():t},OB.reverse=function(t){for(var e=t.length-1,r=Math.trunc(e/2),n=0;n<=r;n++){var i=t[n];t[n]=t[e-n],t[e-n]=i}},OB.removeNull=function(t){for(var e=0,r=0;r<t.length;r++)null!==t[r]&&e++;var n=new Array(e).fill(null);if(0===e)return n;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(n[i++]=t[o]);return n},OB.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),r=0;r<t.length;r++)e[r]=new PS(t[r]);return e}if(5===arguments.length)for(var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],l=0;l<a;l++)o[s+l]=new PS(n[i+l])},OB.isEqualReversed=function(t,e){for(var r=0;r<t.length;r++){var n=t[r],i=e[t.length-r-1];if(0!==n.compareTo(i))return!1}return!0},OB.envelope=function(t){for(var e=new JS,r=0;r<t.length;r++)e.expandToInclude(t[r]);return e},OB.toCoordinateArray=function(t){return t.toArray(OB.coordArrayType)},OB.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},OB.indexOf=function(t,e){for(var r=0;r<e.length;r++)if(t.equals(e[r]))return r;return-1},OB.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var r=t.length-1-e,n=t[e].compareTo(t[r]);if(0!==n)return n}return 1},OB.compare=function(t,e){for(var r=0;r<t.length&&r<e.length;){var n=t[r].compareTo(e[r]);if(0!==n)return n;r++}return r<e.length?-1:r<t.length?1:0},OB.minCoordinate=function(t){for(var e=null,r=0;r<t.length;r++)(null===e||e.compareTo(t[r])>0)&&(e=t[r]);return e},OB.extract=function(t,e,r){e=RS.clamp(e,0,t.length);var n=(r=RS.clamp(r,-1,t.length))-e+1;r<0&&(n=0),e>=t.length&&(n=0),r<e&&(n=0);var i=new Array(n).fill(null);if(0===n)return i;for(var o=0,s=e;s<=r;s++)i[o++]=t[s];return i},Object.defineProperties(OB,kB);var NB=function(){};NB.prototype.compare=function(t,e){var r=t,n=e;return OB.compare(r,n)},NB.prototype.interfaces_=function(){return[IS]},NB.prototype.getClass=function(){return NB};var RB=function(){};RB.prototype.compare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;var i=OB.compare(r,n);return OB.isEqualReversed(r,n)?0:i},RB.prototype.OLDcompare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;for(var i=OB.increasingDirection(r),o=OB.increasingDirection(n),s=i>0?0:r.length-1,a=o>0?0:r.length-1,l=0;l<r.length;l++){var u=r[s].compareTo(n[a]);if(0!==u)return u;s+=i,a+=o}return 0},RB.prototype.interfaces_=function(){return[IS]},RB.prototype.getClass=function(){return RB};var UB=function(){};UB.prototype.get=function(){},UB.prototype.put=function(){},UB.prototype.size=function(){},UB.prototype.values=function(){},UB.prototype.entrySet=function(){};var DB=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}(UB);function QB(t){this.message=t||""}function GB(){}QB.prototype=new Error,QB.prototype.name="OperationNotSupported",GB.prototype=new SB,GB.prototype.contains=function(){};var jB=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof SB&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++)if(this.array_[e]===t)return!0;return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new HB(this)},e}(GB),HB=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 PB;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new QB},e}(IB),zB=0;function VB(t){return null===t?zB:t.color}function KB(t){return null===t?null:t.parent}function qB(t,e){null!==t&&(t.color=e)}function WB(t){return null===t?null:t.left}function XB(t){return null===t?null:t.right}function YB(){this.root_=null,this.size_=0}YB.prototype=new DB,YB.prototype.get=function(t){for(var e=this.root_;null!==e;){var r=t.compareTo(e.key);if(r<0)e=e.left;else{if(!(r>0))return e.value;e=e.right}}return null},YB.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:zB,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var r,n,i=this.root_;do{if(r=i,(n=t.compareTo(i.key))<0)i=i.left;else{if(!(n>0)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var s={key:t,left:null,right:null,value:e,parent:r,color:zB,getValue:function(){return this.value},getKey:function(){return this.key}};return n<0?r.left=s:r.right=s,this.fixAfterInsertion(s),this.size_++,null},YB.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(KB(t)===WB(KB(KB(t)))){var r=XB(KB(KB(t)));1===VB(r)?(qB(KB(t),zB),qB(r,zB),qB(KB(KB(t)),1),t=KB(KB(t))):(t===XB(KB(t))&&(t=KB(t),e.rotateLeft(t)),qB(KB(t),zB),qB(KB(KB(t)),1),e.rotateRight(KB(KB(t))))}else{var n=WB(KB(KB(t)));1===VB(n)?(qB(KB(t),zB),qB(n,zB),qB(KB(KB(t)),1),t=KB(KB(t))):(t===WB(KB(t))&&(t=KB(t),e.rotateRight(t)),qB(KB(t),zB),qB(KB(KB(t)),1),e.rotateLeft(KB(KB(t))))}this.root_.color=zB},YB.prototype.values=function(){var t=new FB,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=YB.successor(e));)t.add(e.value);return t},YB.prototype.entrySet=function(){var t=new jB,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=YB.successor(e));)t.add(e);return t},YB.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}},YB.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}},YB.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},YB.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}for(var r=t.parent,n=t;null!==r&&n===r.right;)n=r,r=r.parent;return r},YB.prototype.size=function(){return this.size_};var ZB=function(){};function JB(){}function $B(){this.array_=[],arguments[0]instanceof SB&&this.addAll(arguments[0])}ZB.prototype.interfaces_=function(){return[]},ZB.prototype.getClass=function(){return ZB},JB.prototype=new GB,$B.prototype=new JB,$B.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++)if(0===this.array_[e].compareTo(t))return!0;return!1},$B.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,r=this.array_.length;e<r;e++)if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0;return this.array_.push(t),!0},$B.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},$B.prototype.remove=function(t){throw new QB},$B.prototype.size=function(){return this.array_.length},$B.prototype.isEmpty=function(){return 0===this.array_.length},$B.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},$B.prototype.iterator=function(){return new tI(this)};var tI=function(t){this.treeSet_=t,this.position_=0};tI.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new PB;return this.treeSet_.array_[this.position_++]},tI.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},tI.prototype.remove=function(){throw new QB};var eI=function(){};eI.sort=function(){var t,e,r,n,i=arguments[0];if(1===arguments.length)n=function(t,e){return t.compareTo(e)},i.sort(n);else if(2===arguments.length)r=arguments[1],n=function(t,e){return r.compare(t,e)},i.sort(n);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),r=arguments[3],n=function(t,e){return r.compare(t,e)},e.sort(n),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},eI.asList=function(t){for(var e=new FB,r=0,n=t.length;r<n;r++)e.add(t[r]);return e};var rI=function(){},nI={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}};nI.P.get=function(){return 0},nI.L.get=function(){return 1},nI.A.get=function(){return 2},nI.FALSE.get=function(){return-1},nI.TRUE.get=function(){return-2},nI.DONTCARE.get=function(){return-3},nI.SYM_FALSE.get=function(){return"F"},nI.SYM_TRUE.get=function(){return"T"},nI.SYM_DONTCARE.get=function(){return"*"},nI.SYM_P.get=function(){return"0"},nI.SYM_L.get=function(){return"1"},nI.SYM_A.get=function(){return"2"},rI.prototype.interfaces_=function(){return[]},rI.prototype.getClass=function(){return rI},rI.toDimensionSymbol=function(t){switch(t){case rI.FALSE:return rI.SYM_FALSE;case rI.TRUE:return rI.SYM_TRUE;case rI.DONTCARE:return rI.SYM_DONTCARE;case rI.P:return rI.SYM_P;case rI.L:return rI.SYM_L;case rI.A:return rI.SYM_A}throw new xS("Unknown dimension value: "+t)},rI.toDimensionValue=function(t){switch(GS.toUpperCase(t)){case rI.SYM_FALSE:return rI.FALSE;case rI.SYM_TRUE:return rI.TRUE;case rI.SYM_DONTCARE:return rI.DONTCARE;case rI.SYM_P:return rI.P;case rI.SYM_L:return rI.L;case rI.SYM_A:return rI.A}throw new xS("Unknown dimension symbol: "+t)},Object.defineProperties(rI,nI);var iI=function(){};iI.prototype.filter=function(t){},iI.prototype.interfaces_=function(){return[]},iI.prototype.getClass=function(){return iI};var oI=function(){};oI.prototype.filter=function(t,e){},oI.prototype.isDone=function(){},oI.prototype.isGeometryChanged=function(){},oI.prototype.interfaces_=function(){return[]},oI.prototype.getClass=function(){return oI};var sI=function(t){function e(e,r){if(t.call(this,r),this._geometries=e||[],t.hasNullElements(this._geometries))throw new xS("geometries must not contain null elements")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new JS,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries[t]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=0;r<this._geometries.length;r++)for(var n=this._geometries[r].getCoordinates(),i=0;i<n.length;i++)t[++e]=n[i];return t},e.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._geometries.length!==n._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(n._geometries[i],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();eI.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=rI.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=rI.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new $B(eI.asList(this._geometries)),r=new $B(eI.asList(t._geometries));return this.compare(e,r)}if(2===arguments.length){for(var n=arguments[1],i=arguments[0],o=this.getNumGeometries(),s=i.getNumGeometries(),a=0;a<o&&a<s;){var l=this.getGeometryN(a),u=i.getGeometryN(a),h=l.compareToSameClass(u,n);if(0!==h)return h;a++}return a<o?1:a<s?-1:0}},e.prototype.apply=function(){var t=this;if(NS(arguments[0],vB))for(var e=arguments[0],r=0;r<this._geometries.length;r++)t._geometries[r].apply(e);else if(NS(arguments[0],oI)){var n=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(t._geometries[i].apply(n),!n.isDone());i++);n.isGeometryChanged()&&this.geometryChanged()}else if(NS(arguments[0],iI)){var o=arguments[0];o.filter(this);for(var s=0;s<this._geometries.length;s++)t._geometries[s].apply(o)}else if(NS(arguments[0],dB)){var a=arguments[0];a.filter(this);for(var l=0;l<this._geometries.length;l++)t._geometries[l].apply(a)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),aB.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var r=0;r<this._geometries.length;r++)e._geometries[r]=this._geometries[r].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,r),e}(gB),aI=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return gB.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?rI.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[t-1-r]=this._geometries[r].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new lI(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[ZB]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,r),e}(sI),lI=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=_B.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._geom=r,this._geomFact=r.getFactory(),this._bnRule=n}};lI.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)},lI.prototype.getBoundary=function(){return this._geom instanceof vI?this.boundaryLineString(this._geom):this._geom instanceof aI?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},lI.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()])},lI.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},lI.prototype.computeBoundaryCoordinates=function(t){var e=this,r=new FB;this._endpointMap=new YB;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);0!==i.getNumPoints()&&(e.addEndpoint(i.getCoordinateN(0)),e.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var o=this._endpointMap.entrySet().iterator();o.hasNext();){var s=o.next(),a=s.getValue().count;e._bnRule.isInBoundary(a)&&r.add(s.getKey())}return OB.toCoordinateArray(r)},lI.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new uI,this._endpointMap.put(t,e)),e.count++},lI.prototype.interfaces_=function(){return[]},lI.prototype.getClass=function(){return lI},lI.getBoundary=function(){return 1===arguments.length?new lI(arguments[0]).getBoundary():2===arguments.length?new lI(arguments[0],arguments[1]).getBoundary():void 0};var uI=function(){this.count=null};function hI(){}function cI(){}uI.prototype.interfaces_=function(){return[]},uI.prototype.getClass=function(){return uI};var AI=function(){};function fI(){}function pI(){}function dI(){}var gI=function(){},yI={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};gI.prototype.interfaces_=function(){return[]},gI.prototype.getClass=function(){return gI},gI.chars=function(t,e){for(var r=new Array(e).fill(null),n=0;n<e;n++)r[n]=t;return String(r)},gI.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new fI,r=new hI;return t.printStackTrace(r),e.toString()}if(2===arguments.length){var n=arguments[0],i=arguments[1],o="";new cI(gI.getStackTrace(n));for(var s=new dI,a=0;a<i;a++)try{o+=s.readLine()+gI.NEWLINE}catch(UW){if(!(UW instanceof pI))throw UW;aB.shouldNeverReachHere()}return o}},gI.split=function(t,e){for(var r=e.length,n=new FB,i=""+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);n.add(s),o=(i=i.substring(o+r)).indexOf(e)}i.length>0&&n.add(i);for(var a=new Array(n.size()).fill(null),l=0;l<a.length;l++)a[l]=n.get(l);return a},gI.toString=function(){if(1===arguments.length){var t=arguments[0];return gI.SIMPLE_ORDINATE_FORMAT.format(t)}},gI.spaces=function(t){return gI.chars(" ",t)},yI.NEWLINE.get=function(){return YS.getProperty("line.separator")},yI.SIMPLE_ORDINATE_FORMAT.get=function(){return new AI},Object.defineProperties(gI,yI);var mI=function(){};mI.prototype.interfaces_=function(){return[]},mI.prototype.getClass=function(){return mI},mI.copyCoord=function(t,e,r,n){for(var i=Math.min(t.getDimension(),r.getDimension()),o=0;o<i;o++)r.setOrdinate(n,o,t.getOrdinate(e,o))},mI.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&t.getOrdinate(0,KS.X)===t.getOrdinate(e-1,KS.X)&&t.getOrdinate(0,KS.Y)===t.getOrdinate(e-1,KS.Y)},mI.isEqual=function(t,e){var r=t.size();if(r!==e.size())return!1;for(var n=Math.min(t.getDimension(),e.getDimension()),i=0;i<r;i++)for(var o=0;o<n;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(!(t.getOrdinate(i,o)===e.getOrdinate(i,o)||CS.isNaN(s)&&CS.isNaN(a)))return!1}return!0},mI.extend=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();if(mI.copy(e,0,n,0,i),i>0)for(var o=i;o<r;o++)mI.copy(e,i-1,n,o,1);return n},mI.reverse=function(t){for(var e=t.size()-1,r=Math.trunc(e/2),n=0;n<=r;n++)mI.swap(t,n,e-n)},mI.swap=function(t,e,r){if(e===r)return null;for(var n=0;n<t.getDimension();n++){var i=t.getOrdinate(e,n);t.setOrdinate(e,n,t.getOrdinate(r,n)),t.setOrdinate(r,n,i)}},mI.copy=function(t,e,r,n,i){for(var o=0;o<i;o++)mI.copyCoord(t,e+o,r,n+o)},mI.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var r=t.getDimension(),n=new DS;n.append("(");for(var i=0;i<e;i++){i>0&&n.append(" ");for(var o=0;o<r;o++)o>0&&n.append(","),n.append(gI.toString(t.getOrdinate(i,o)))}return n.append(")"),n.toString()}},mI.ensureValidRing=function(t,e){var r=e.size();return 0===r?e:r<=3?mI.createClosedRing(t,e,4):e.getOrdinate(0,KS.X)===e.getOrdinate(r-1,KS.X)&&e.getOrdinate(0,KS.Y)===e.getOrdinate(r-1,KS.Y)?e:mI.createClosedRing(t,e,r+1)},mI.createClosedRing=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();mI.copy(e,0,n,0,i);for(var o=i;o<r;o++)mI.copy(e,0,n,o,1);return n};var vI=function(t){function e(e,r){t.call(this,r),this._points=null,this.init(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new JS:this._points.expandEnvelope(new JS)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._points.size()!==n._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),n._points.getCoordinate(i),r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=this,e=0;e<Math.trunc(this._points.size()/2);e++){var r=t._points.size()-1-e;if(!t._points.getCoordinate(e).equals(t._points.getCoordinate(r)))return t._points.getCoordinate(e).compareTo(t._points.getCoordinate(r))>0&&mI.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?rI.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 fB.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return mI.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,r=0;e<this._points.size()&&r<t._points.size();){var n=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(r));if(0!==n)return n;e++,r++}return e<this._points.size()?1:r<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(NS(arguments[0],vB))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(NS(arguments[0],oI)){var r=arguments[0];if(0===this._points.size())return null;for(var n=0;n<this._points.size()&&(r.filter(this._points,n),!r.isDone());n++);r.isGeometryChanged()&&this.geometryChanged()}else(NS(arguments[0],iI)||NS(arguments[0],dB))&&arguments[0].filter(this)},e.prototype.getBoundary=function(){return new lI(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 xS("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[ZB]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,r),e}(gB),_I=function(){};_I.prototype.interfaces_=function(){return[]},_I.prototype.getClass=function(){return _I};var wI=function(t){function e(e,r){t.call(this,r),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new JS;var t=new JS;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),r))}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){},e.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},e.prototype.getBoundaryDimension=function(){return rI.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(NS(arguments[0],vB)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(NS(arguments[0],oI)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else(NS(arguments[0],iI)||NS(arguments[0],dB))&&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([])),aB.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[_I]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,r),e}(gB),bI=function(){};bI.prototype.interfaces_=function(){return[]},bI.prototype.getClass=function(){return bI};var xI=function(t){function e(e,r,n){if(t.call(this,n),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===r&&(r=[]),t.hasNullElements(r))throw new xS("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(r))throw new xS("shell is empty but holes are not");this._shell=e,this._holes=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},e.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},e.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=this._shell.getCoordinates(),n=0;n<r.length;n++)t[++e]=r[n];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(fB.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(fB.signedArea(this._holes[e].getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),r=0;r<5;r++){var n=t.getX(r);if(n!==e.getMinX()&&n!==e.getMaxX())return!1;var i=t.getY(r);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var l=t.getX(a),u=t.getY(a);if(l!==o==(u!==s))return!1;o=l,s=u}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e,i=this._shell,o=n._shell;if(!i.equalsExact(o,r))return!1;if(this._holes.length!==n._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(n._holes[s],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);eI.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(e.isEmpty())return null;var n=new Array(e.getCoordinates().length-1).fill(null);YS.arraycopy(e.getCoordinates(),0,n,0,n.length);var i=OB.minCoordinate(e.getCoordinates());OB.scroll(n,i),YS.arraycopy(n,0,e.getCoordinates(),0,n.length),e.getCoordinates()[n.length]=n[0],fB.isCCW(e.getCoordinates())===r&&OB.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,r=t._shell;return e.compareToSameClass(r)}if(2===arguments.length){var n=arguments[1],i=arguments[0],o=this._shell,s=i._shell,a=o.compareToSameClass(s,n);if(0!==a)return a;for(var l=this.getNumInteriorRing(),u=i.getNumInteriorRing(),h=0;h<l&&h<u;){var c=this.getInteriorRingN(h),A=i.getInteriorRingN(h),f=c.compareToSameClass(A,n);if(0!==f)return f;h++}return h<l?1:h<u?-1:0}},e.prototype.apply=function(t){var e=this;if(NS(t,vB)){this._shell.apply(t);for(var r=0;r<this._holes.length;r++)e._holes[r].apply(t)}else if(NS(t,oI)){if(this._shell.apply(t),!t.isDone())for(var n=0;n<this._holes.length&&(e._holes[n].apply(t),!t.isDone());n++);t.isGeometryChanged()&&this.geometryChanged()}else if(NS(t,iI))t.filter(this);else if(NS(t,dB)){t.filter(this),this._shell.apply(t);for(var i=0;i<this._holes.length;i++)e._holes[i].apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var r=0;r<this._holes.length;r++)e._holes[r]=this._holes[r].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),r=new Array(this._holes.length).fill(null),n=0;n<r.length;n++)r[n]=this._holes[n].copy();return new e(t,r,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes[t]},e.prototype.interfaces_=function(){return[bI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,r),e}(gB),CI=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return gB.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(1===arguments.length){var e=arguments[0];return this._geometries[e].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return rI.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.getGeometryType=function(){return"MultiPoint"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[_I]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,r),e}(sI),EI=function(t){function e(e,r){e instanceof PS&&r instanceof GI&&(e=r.getCoordinateSequenceFactory().create(e)),t.call(this,e,r),this.validateConstruction()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return gB.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return rI.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return mI.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new xS("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new xS("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.MINIMUM_VALID_SIZE.get=function(){return 4},r.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,r),e}(vI),SI=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return gB.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new FB,e=0;e<this._geometries.length;e++)for(var r=this._geometries[e].getBoundary(),n=0;n<r.getNumGeometries();n++)t.add(r.getGeometryN(n));var i=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(i))},e.prototype.getGeometryType=function(){return"MultiPolygon"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[bI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,r),e}(sI),BI=function(t){this._factory=t||null,this._isUserDataCopied=!1},II={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};BI.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},BI.prototype.edit=function(t,e){if(null===t)return null;var r=this.editInternal(t,e);return this._isUserDataCopied&&r.setUserData(t.getUserData()),r},BI.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof sI?this.editGeometryCollection(t,e):t instanceof xI?this.editPolygon(t,e):t instanceof wI||t instanceof vI?e.edit(t,this._factory):(aB.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},BI.prototype.editGeometryCollection=function(t,e){for(var r=e.edit(t,this._factory),n=new FB,i=0;i<r.getNumGeometries();i++){var o=this.edit(r.getGeometryN(i),e);null===o||o.isEmpty()||n.add(o)}return r.getClass()===CI?this._factory.createMultiPoint(n.toArray([])):r.getClass()===aI?this._factory.createMultiLineString(n.toArray([])):r.getClass()===SI?this._factory.createMultiPolygon(n.toArray([])):this._factory.createGeometryCollection(n.toArray([]))},BI.prototype.editPolygon=function(t,e){var r=e.edit(t,this._factory);if(null===r&&(r=this._factory.createPolygon(null)),r.isEmpty())return r;var n=this.edit(r.getExteriorRing(),e);if(null===n||n.isEmpty())return this._factory.createPolygon();for(var i=new FB,o=0;o<r.getNumInteriorRing();o++){var s=this.edit(r.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(n,i.toArray([]))},BI.prototype.interfaces_=function(){return[]},BI.prototype.getClass=function(){return BI},BI.GeometryEditorOperation=function(){},II.NoOpGeometryOperation.get=function(){return TI},II.CoordinateOperation.get=function(){return PI},II.CoordinateSequenceOperation.get=function(){return FI},Object.defineProperties(BI,II);var TI=function(){};TI.prototype.edit=function(t,e){return t},TI.prototype.interfaces_=function(){return[BI.GeometryEditorOperation]},TI.prototype.getClass=function(){return TI};var PI=function(){};PI.prototype.edit=function(t,e){var r=this.editCoordinates(t.getCoordinates(),t);return null===r?t:t instanceof EI?e.createLinearRing(r):t instanceof vI?e.createLineString(r):t instanceof wI?r.length>0?e.createPoint(r[0]):e.createPoint():t},PI.prototype.interfaces_=function(){return[BI.GeometryEditorOperation]},PI.prototype.getClass=function(){return PI};var FI=function(){};FI.prototype.edit=function(t,e){return t instanceof EI?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof vI?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof wI?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},FI.prototype.interfaces_=function(){return[BI.GeometryEditorOperation]},FI.prototype.getClass=function(){return FI};var LI=function(){var t=this;if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var r=0;r<e;r++)t._coordinates[r]=new PS}else if(NS(arguments[0],KS)){var n=arguments[0];if(null===n)return this._coordinates=new Array(0).fill(null),null;this._dimension=n.getDimension(),this._coordinates=new Array(n.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)t._coordinates[i]=n.getCoordinateCopy(i)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],s=arguments[1];this._coordinates=o,this._dimension=s,null===o&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var a=arguments[0],l=arguments[1];this._coordinates=new Array(a).fill(null),this._dimension=l;for(var u=0;u<a;u++)t._coordinates[u]=new PS}},MI={serialVersionUID:{configurable:!0}};LI.prototype.setOrdinate=function(t,e,r){switch(e){case KS.X:this._coordinates[t].x=r;break;case KS.Y:this._coordinates[t].y=r;break;case KS.Z:this._coordinates[t].z=r;break;default:throw new xS("invalid ordinateIndex")}},LI.prototype.size=function(){return this._coordinates.length},LI.prototype.getOrdinate=function(t,e){switch(e){case KS.X:return this._coordinates[t].x;case KS.Y:return this._coordinates[t].y;case KS.Z:return this._coordinates[t].z}return CS.NaN},LI.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],r=arguments[1];r.x=this._coordinates[e].x,r.y=this._coordinates[e].y,r.z=this._coordinates[e].z}},LI.prototype.getCoordinateCopy=function(t){return new PS(this._coordinates[t])},LI.prototype.getDimension=function(){return this._dimension},LI.prototype.getX=function(t){return this._coordinates[t].x},LI.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 LI(t,this._dimension)},LI.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},LI.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 LI(t,this._dimension)},LI.prototype.toString=function(){if(this._coordinates.length>0){var t=new DS(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"()"},LI.prototype.getY=function(t){return this._coordinates[t].y},LI.prototype.toCoordinateArray=function(){return this._coordinates},LI.prototype.interfaces_=function(){return[KS,TS]},LI.prototype.getClass=function(){return LI},MI.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(LI,MI);var OI=function(){},kI={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};OI.prototype.readResolve=function(){return OI.instance()},OI.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array)return new LI(arguments[0]);if(NS(arguments[0],KS))return new LI(arguments[0])}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new LI(t):new LI(t,e)}},OI.prototype.interfaces_=function(){return[MS,TS]},OI.prototype.getClass=function(){return OI},OI.instance=function(){return OI.instanceObject},kI.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},kI.instanceObject.get=function(){return new OI},Object.defineProperties(OI,kI);var NI=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 FB,e=this.map_.values(),r=e.next();!r.done;)t.add(r.value),r=e.next();return t},e.prototype.entrySet=function(){var t=new jB;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(UB),RI=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 DI){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var r=arguments[0];this._modelType=t.FIXED,this.setScale(r)}else if(arguments[0]instanceof t){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}},UI={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};RI.prototype.equals=function(t){if(!(t instanceof RI))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},RI.prototype.compareTo=function(t){var e=t,r=this.getMaximumSignificantDigits(),n=e.getMaximumSignificantDigits();return new QS(r).compareTo(new QS(n))},RI.prototype.getScale=function(){return this._scale},RI.prototype.isFloating=function(){return this._modelType===RI.FLOATING||this._modelType===RI.FLOATING_SINGLE},RI.prototype.getType=function(){return this._modelType},RI.prototype.toString=function(){var t="UNKNOWN";return this._modelType===RI.FLOATING?t="Floating":this._modelType===RI.FLOATING_SINGLE?t="Floating-Single":this._modelType===RI.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},RI.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return CS.isNaN(t)||this._modelType===RI.FLOATING_SINGLE?t:this._modelType===RI.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof PS){var e=arguments[0];if(this._modelType===RI.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},RI.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===RI.FLOATING?t=16:this._modelType===RI.FLOATING_SINGLE?t=6:this._modelType===RI.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},RI.prototype.setScale=function(t){this._scale=Math.abs(t)},RI.prototype.interfaces_=function(){return[TS,SS]},RI.prototype.getClass=function(){return RI},RI.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},UI.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},UI.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(RI,UI);var DI=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},QI={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};DI.prototype.readResolve=function(){return DI.nameToTypeMap.get(this._name)},DI.prototype.toString=function(){return this._name},DI.prototype.interfaces_=function(){return[TS]},DI.prototype.getClass=function(){return DI},QI.serialVersionUID.get=function(){return-552860263173159e4},QI.nameToTypeMap.get=function(){return new NI},Object.defineProperties(DI,QI),RI.Type=DI,RI.FIXED=new DI("FIXED"),RI.FLOATING=new DI("FLOATING"),RI.FLOATING_SINGLE=new DI("FLOATING SINGLE");var GI=function t(){this._precisionModel=new RI,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?NS(arguments[0],MS)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof RI&&(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]))},jI={serialVersionUID:{configurable:!0}};GI.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new PS(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new PS(t.getMinX(),t.getMinY()),new PS(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new PS(t.getMinX(),t.getMinY()),new PS(t.getMinX(),t.getMaxY()),new PS(t.getMaxX(),t.getMaxY()),new PS(t.getMaxX(),t.getMinY()),new PS(t.getMinX(),t.getMinY())]),null)},GI.prototype.createLineString=function(t){return t?t instanceof Array?new vI(this.getCoordinateSequenceFactory().create(t),this):NS(t,KS)?new vI(t,this):void 0:new vI(this.getCoordinateSequenceFactory().create([]),this)},GI.prototype.createMultiLineString=function(){return 0===arguments.length?new aI(null,this):1===arguments.length?new aI(arguments[0],this):void 0},GI.prototype.buildGeometry=function(t){for(var e=null,r=!1,n=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(r=!0),o.isGeometryCollectionOrDerived()&&(n=!0)}if(null===e)return this.createGeometryCollection();if(r||n)return this.createGeometryCollection(GI.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof xI)return this.createMultiPolygon(GI.toPolygonArray(t));if(a instanceof vI)return this.createMultiLineString(GI.toLineStringArray(t));if(a instanceof wI)return this.createMultiPoint(GI.toPointArray(t));aB.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},GI.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},GI.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof PS){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(NS(arguments[0],KS))return new wI(arguments[0],this)}},GI.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},GI.prototype.createPolygon=function(){if(0===arguments.length)return new xI(null,null,this);if(1===arguments.length){if(NS(arguments[0],KS)){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 EI){var r=arguments[0];return this.createPolygon(r,null)}}else if(2===arguments.length)return new xI(arguments[0],arguments[1],this)},GI.prototype.getSRID=function(){return this._SRID},GI.prototype.createGeometryCollection=function(){return 0===arguments.length?new sI(null,this):1===arguments.length?new sI(arguments[0],this):void 0},GI.prototype.createGeometry=function(t){return new BI(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},GI.prototype.getPrecisionModel=function(){return this._precisionModel},GI.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(NS(arguments[0],KS))return new EI(arguments[0],this)}},GI.prototype.createMultiPolygon=function(){return 0===arguments.length?new SI(null,this):1===arguments.length?new SI(arguments[0],this):void 0},GI.prototype.createMultiPoint=function(){if(0===arguments.length)return new CI(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new CI(arguments[0],this);if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(NS(arguments[0],KS)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(e.size()).fill(null),n=0;n<e.size();n++){var i=this.getCoordinateSequenceFactory().create(1,e.getDimension());mI.copy(e,n,i,0,1),r[n]=this.createPoint(i)}return this.createMultiPoint(r)}}},GI.prototype.interfaces_=function(){return[TS]},GI.prototype.getClass=function(){return GI},GI.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.getDefaultCoordinateSequenceFactory=function(){return OI.instance()},GI.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},GI.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},jI.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(GI,jI);var HI=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],zI=function(t){this.geometryFactory=t||new GI};zI.prototype.read=function(t){var e,r=(e="string"==typeof t?JSON.parse(t):t).type;if(!VI[r])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==HI.indexOf(r)?VI[r].apply(this,[e.coordinates]):"GeometryCollection"===r?VI[r].apply(this,[e.geometries]):VI[r].apply(this,[e])},zI.prototype.write=function(t){var e=t.getGeometryType();if(!KI[e])throw new Error("Geometry is not supported");return KI[e].apply(this,[t])};var VI={Feature:function(t){var e={};for(var r in t)e[r]=t[r];if(t.geometry){var n=t.geometry.type;if(!VI[n])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=VI.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var r=0;r<t.features.length;++r)e.features.push(this.read(t.features[r]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(new PS(n[0],n[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new PS(t[0],t[1]),new PS(t[2],t[1]),new PS(t[2],t[3]),new PS(t[0],t[3]),new PS(t[0],t[1])])},Point:function(t){var e=new PS(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],r=0;r<t.length;++r)e.push(VI.Point.apply(this,[t[r]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=VI.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],r=0;r<t.length;++r)e.push(VI.LineString.apply(this,[t[r]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=VI.coordinates.apply(this,[t[0]]),r=this.geometryFactory.createLinearRing(e),n=[],i=1;i<t.length;++i){var o=t[i],s=VI.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);n.push(a)}return this.geometryFactory.createPolygon(r,n)},MultiPolygon:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(VI.Polygon.apply(this,[n]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(this.read(n))}return this.geometryFactory.createGeometryCollection(e)}},KI={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:KI.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=KI.Point.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],r=t.getCoordinates(),n=0;n<r.length;++n){var i=r[n];e.push(KI.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=KI.LineString.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],r=KI.LineString.apply(this,[t._shell]);e.push(r.coordinates);for(var n=0;n<t._holes.length;++n){var i=t._holes[n],o=KI.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=KI.Polygon.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=n.getGeometryType();e.push(KI[i].apply(this,[n]))}return{type:"GeometryCollection",geometries:e}}},qI=function(t){this.geometryFactory=t||new GI,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new zI(this.geometryFactory)};qI.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===RI.FIXED&&this.reducePrecision(e),e},qI.prototype.reducePrecision=function(t){var e,r;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,r=t.points.length;e<r;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,r=t.geometries.length;e<r;e++)this.reducePrecision(t.geometries[e])};var WI=function(){this.parser=new zI(this.geometryFactory)};WI.prototype.write=function(t){return this.parser.write(t)};var XI=function(){},YI={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function ZI(t){this.message=t||""}function JI(){this.array_=[]}XI.prototype.interfaces_=function(){return[]},XI.prototype.getClass=function(){return XI},XI.opposite=function(t){return t===XI.LEFT?XI.RIGHT:t===XI.RIGHT?XI.LEFT:t},YI.ON.get=function(){return 0},YI.LEFT.get=function(){return 1},YI.RIGHT.get=function(){return 2},Object.defineProperties(XI,YI),ZI.prototype=new Error,ZI.prototype.name="EmptyStackException",JI.prototype=new TB,JI.prototype.add=function(t){return this.array_.push(t),!0},JI.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},JI.prototype.push=function(t){return this.array_.push(t),t},JI.prototype.pop=function(t){if(0===this.array_.length)throw new ZI;return this.array_.pop()},JI.prototype.peek=function(){if(0===this.array_.length)throw new ZI;return this.array_[this.array_.length-1]},JI.prototype.empty=function(){return 0===this.array_.length},JI.prototype.isEmpty=function(){return this.empty()},JI.prototype.search=function(t){return this.array_.indexOf(t)},JI.prototype.size=function(){return this.array_.length},JI.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t};var $I=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};$I.prototype.getCoordinate=function(){return this._minCoord},$I.prototype.getRightmostSide=function(t,e){var r=this.getRightmostSideOfSegment(t,e);return r<0&&(r=this.getRightmostSideOfSegment(t,e-1)),r<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),r},$I.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();aB.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],r=t[this._minIndex+1],n=fB.computeOrientation(this._minCoord,r,e),i=!1;(e.y<this._minCoord.y&&r.y<this._minCoord.y&&n===fB.COUNTERCLOCKWISE||e.y>this._minCoord.y&&r.y>this._minCoord.y&&n===fB.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},$I.prototype.getRightmostSideOfSegment=function(t,e){var r=t.getEdge().getCoordinates();if(e<0||e+1>=r.length)return-1;if(r[e].y===r[e+1].y)return-1;var n=XI.LEFT;return r[e].y<r[e+1].y&&(n=XI.RIGHT),n},$I.prototype.getEdge=function(){return this._orientedDe},$I.prototype.checkForRightmostCoordinate=function(t){for(var e=this,r=t.getEdge().getCoordinates(),n=0;n<r.length-1;n++)(null===e._minCoord||r[n].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=n,e._minCoord=r[n])},$I.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)},$I.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();r.isForward()&&this.checkForRightmostCoordinate(r)}aB.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)===XI.LEFT&&(this._orientedDe=this._minDe.getSym())},$I.prototype.interfaces_=function(){return[]},$I.prototype.getClass=function(){return $I};var tT=function(t){function e(r,n){t.call(this,e.msgWithCoord(r,n)),this.pt=n?new PS(n):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},e}(oB),eT=function(){this.array_=[]};eT.prototype.addLast=function(t){this.array_.push(t)},eT.prototype.removeFirst=function(){return this.array_.shift()},eT.prototype.isEmpty=function(){return 0===this.array_.length};var rT=function(){this._finder=null,this._dirEdgeList=new FB,this._nodes=new FB,this._rightMostCoord=null,this._env=null,this._finder=new $I};rT.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},rT.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},rT.prototype.computeNodeDepth=function(t){for(var e=null,r=t.getEdges().iterator();r.hasNext();){var n=r.next();if(n.isVisited()||n.getSym().isVisited()){e=n;break}}if(null===e)throw new tT("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)}},rT.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(XI.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},rT.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},rT.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(XI.RIGHT)>=1&&e.getDepth(XI.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},rT.prototype.computeDepths=function(t){var e=new jB,r=new eT,n=t.getNode();for(r.addLast(n),e.add(n),t.setVisited(!0);!r.isEmpty();){var i=r.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(r.addLast(a),e.add(a))}}}},rT.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},rT.prototype.getEnvelope=function(){if(null===this._env){for(var t=new JS,e=this._dirEdgeList.iterator();e.hasNext();)for(var r=e.next().getEdge().getCoordinates(),n=0;n<r.length-1;n++)t.expandToInclude(r[n]);this._env=t}return this._env},rT.prototype.addReachable=function(t){var e=new JI;for(e.add(t);!e.empty();){var r=e.pop();this.add(r,e)}},rT.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(XI.LEFT,t.getDepth(XI.RIGHT)),e.setDepth(XI.RIGHT,t.getDepth(XI.LEFT))},rT.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var r=t.getEdges().iterator();r.hasNext();){var n=r.next();this._dirEdgeList.add(n);var i=n.getSym().getNode();i.isVisited()||e.push(i)}},rT.prototype.getNodes=function(){return this._nodes},rT.prototype.getDirectedEdges=function(){return this._dirEdgeList},rT.prototype.interfaces_=function(){return[SS]},rT.prototype.getClass=function(){return rT};var nT=function t(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var r=arguments[0];this.init(1),this.location[XI.ON]=r}else if(arguments[0]instanceof t){var n=arguments[0];if(this.init(n.location.length),null!==n)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.init(3),this.location[XI.ON]=o,this.location[XI.LEFT]=s,this.location[XI.RIGHT]=a}};nT.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},nT.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==OS.NONE)return!1;return!0},nT.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===OS.NONE&&(this.location[e]=t)},nT.prototype.isLine=function(){return 1===this.location.length},nT.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[XI.ON]=this.location[XI.ON],e[XI.LEFT]=OS.NONE,e[XI.RIGHT]=OS.NONE,this.location=e}for(var r=0;r<this.location.length;r++)this.location[r]===OS.NONE&&r<t.location.length&&(this.location[r]=t.location[r])},nT.prototype.getLocations=function(){return this.location},nT.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[XI.LEFT];this.location[XI.LEFT]=this.location[XI.RIGHT],this.location[XI.RIGHT]=t},nT.prototype.toString=function(){var t=new DS;return this.location.length>1&&t.append(OS.toLocationSymbol(this.location[XI.LEFT])),t.append(OS.toLocationSymbol(this.location[XI.ON])),this.location.length>1&&t.append(OS.toLocationSymbol(this.location[XI.RIGHT])),t.toString()},nT.prototype.setLocations=function(t,e,r){this.location[XI.ON]=t,this.location[XI.LEFT]=e,this.location[XI.RIGHT]=r},nT.prototype.get=function(t){return t<this.location.length?this.location[t]:OS.NONE},nT.prototype.isArea=function(){return this.location.length>1},nT.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===OS.NONE)return!0;return!1},nT.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(XI.ON,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.location[e]=r}},nT.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(OS.NONE)},nT.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},nT.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},nT.prototype.interfaces_=function(){return[]},nT.prototype.getClass=function(){return nT};var iT=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 nT(e),this.elt[1]=new nT(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.elt[0]=new nT(r.elt[0]),this.elt[1]=new nT(r.elt[1])}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.elt[0]=new nT(OS.NONE),this.elt[1]=new nT(OS.NONE),this.elt[n].setLocation(i)}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new nT(o,s,a),this.elt[1]=new nT(o,s,a)}else if(4===arguments.length){var l=arguments[0],u=arguments[1],h=arguments[2],c=arguments[3];this.elt[0]=new nT(OS.NONE,OS.NONE,OS.NONE),this.elt[1]=new nT(OS.NONE,OS.NONE,OS.NONE),this.elt[l].setLocations(u,h,c)}};iT.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},iT.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},iT.prototype.isNull=function(t){return this.elt[t].isNull()},iT.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.elt[e].setAllLocationsIfNull(r)}},iT.prototype.isLine=function(t){return this.elt[t].isLine()},iT.prototype.merge=function(t){for(var e=this,r=0;r<2;r++)null===e.elt[r]&&null!==t.elt[r]?e.elt[r]=new nT(t.elt[r]):e.elt[r].merge(t.elt[r])},iT.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},iT.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(XI.ON)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return this.elt[e].get(r)}},iT.prototype.toString=function(){var t=new DS;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()},iT.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()}},iT.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},iT.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(XI.ON,e)}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this.elt[r].setLocation(n,i)}},iT.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},iT.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},iT.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new nT(this.elt[t].location[0]))},iT.prototype.interfaces_=function(){return[]},iT.prototype.getClass=function(){return iT},iT.toLineLabel=function(t){for(var e=new iT(OS.NONE),r=0;r<2;r++)e.setLocation(r,t.getLocation(r));return e};var oT=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new FB,this._pts=new FB,this._label=new iT(OS.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new FB,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};oT.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=fB.isCCW(this._ring.getCoordinates())},oT.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},oT.prototype.computePoints=function(t){var e=this;this._startDe=t;var r=t,n=!0;do{if(null===r)throw new tT("Found null DirectedEdge");if(r.getEdgeRing()===e)throw new tT("Directed Edge visited twice during ring-building at "+r.getCoordinate());e._edges.add(r);var i=r.getLabel();aB.isTrue(i.isArea()),e.mergeLabel(i),e.addPoints(r.getEdge(),r.isForward(),n),n=!1,e.setEdgeRing(r,e),r=e.getNext(r)}while(r!==this._startDe)},oT.prototype.getLinearRing=function(){return this._ring},oT.prototype.getCoordinate=function(t){return this._pts.get(t)},oT.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var r=e.getNode().getEdges().getOutgoingDegree(t);r>t._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},oT.prototype.addPoints=function(t,e,r){var n=t.getCoordinates();if(e){var i=1;r&&(i=0);for(var o=i;o<n.length;o++)this._pts.add(n[o])}else{var s=n.length-2;r&&(s=n.length-1);for(var a=s;a>=0;a--)this._pts.add(n[a])}},oT.prototype.isHole=function(){return this._isHole},oT.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},oT.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!fB.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();)if(r.next().containsPoint(t))return!1;return!0},oT.prototype.addHole=function(t){this._holes.add(t)},oT.prototype.isShell=function(){return null===this._shell},oT.prototype.getLabel=function(){return this._label},oT.prototype.getEdges=function(){return this._edges},oT.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},oT.prototype.getShell=function(){return this._shell},oT.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[1],r=arguments[0].getLocation(e,XI.RIGHT);if(r===OS.NONE)return null;if(this._label.getLocation(e)===OS.NONE)return this._label.setLocation(e,r),null}},oT.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},oT.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),r=0;r<this._holes.size();r++)e[r]=this._holes.get(r).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},oT.prototype.interfaces_=function(){return[]},oT.prototype.getClass=function(){return oT};var sT=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},e.prototype.getNext=function(t){return t.getNextMin()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(oT),aT=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new FB,e=this._startDe;do{if(null===e.getMinEdgeRing()){var r=new sT(e,this._geometryFactory);t.add(r)}e=e.getNext()}while(e!==this._startDe);return t},e.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},e.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)},e.prototype.getNext=function(t){return t.getNext()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(oT),lT=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}};lT.prototype.setVisited=function(t){this._isVisited=t},lT.prototype.setInResult=function(t){this._isInResult=t},lT.prototype.isCovered=function(){return this._isCovered},lT.prototype.isCoveredSet=function(){return this._isCoveredSet},lT.prototype.setLabel=function(t){this._label=t},lT.prototype.getLabel=function(){return this._label},lT.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},lT.prototype.updateIM=function(t){aB.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},lT.prototype.isInResult=function(){return this._isInResult},lT.prototype.isVisited=function(){return this._isVisited},lT.prototype.interfaces_=function(){return[]},lT.prototype.getClass=function(){return lT};var uT=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],r=arguments[1];this._coord=e,this._edges=r,this._label=new iT(0,OS.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();)if(t.next().getEdge().isInResult())return!0;return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var r=OS.NONE;if(r=this._label.getLocation(e),!t.isNull(e)){var n=t.getLocation(e);r!==OS.BOUNDARY&&(r=n)}return r},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],r=arguments[1];null===this._label?this._label=new iT(e,r):this._label.setLocation(e,r)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof iT)for(var n=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(n,i);t._label.getLocation(i)===OS.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=OS.NONE;null!==this._label&&(e=this._label.getLocation(t));var r=null;switch(e){case OS.BOUNDARY:r=OS.INTERIOR;break;case OS.INTERIOR:default:r=OS.BOUNDARY}this._label.setLocation(t,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(lT),hT=function(){this.nodeMap=new YB,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};hT.prototype.find=function(t){return this.nodeMap.get(t)},hT.prototype.addNode=function(){if(arguments[0]instanceof PS){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 uT){var r=arguments[0],n=this.nodeMap.get(r.getCoordinate());return null===n?(this.nodeMap.put(r.getCoordinate(),r),r):(n.mergeLabel(r),n)}},hT.prototype.print=function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)},hT.prototype.iterator=function(){return this.nodeMap.values().iterator()},hT.prototype.values=function(){return this.nodeMap.values()},hT.prototype.getBoundaryNodes=function(t){for(var e=new FB,r=this.iterator();r.hasNext();){var n=r.next();n.getLabel().getLocation(t)===OS.BOUNDARY&&e.add(n)}return e},hT.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},hT.prototype.interfaces_=function(){return[]},hT.prototype.getClass=function(){return hT};var cT=function(){},AT={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};cT.prototype.interfaces_=function(){return[]},cT.prototype.getClass=function(){return cT},cT.isNorthern=function(t){return t===cT.NE||t===cT.NW},cT.isOpposite=function(t,e){return t!==e&&2==(t-e+4)%4},cT.commonHalfPlane=function(t,e){if(t===e)return t;if(2==(t-e+4)%4)return-1;var r=t<e?t:e;return 0===r&&3===(t>e?t:e)?3:r},cT.isInHalfPlane=function(t,e){return e===cT.SE?t===cT.SE||t===cT.SW:t===e||t===e+1},cT.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 xS("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?cT.NE:cT.SE:e>=0?cT.NW:cT.SW}if(arguments[0]instanceof PS&&arguments[1]instanceof PS){var r=arguments[0],n=arguments[1];if(n.x===r.x&&n.y===r.y)throw new xS("Cannot compute the quadrant for two identical points "+r);return n.x>=r.x?n.y>=r.y?cT.NE:cT.SE:n.y>=r.y?cT.NW:cT.SW}},AT.NE.get=function(){return 0},AT.NW.get=function(){return 1},AT.SW.get=function(){return 2},AT.SE.get=function(){return 3},Object.defineProperties(cT,AT);var fT=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._edge=e,this.init(r,n),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=i,this.init(o,s),this._label=a}};fT.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:fB.computeOrientation(t._p0,t._p1,this._p1)},fT.prototype.getDy=function(){return this._dy},fT.prototype.getCoordinate=function(){return this._p0},fT.prototype.setNode=function(t){this._node=t},fT.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),r=this.getClass().getName(),n=r.lastIndexOf("."),i=r.substring(n+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},fT.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},fT.prototype.getDirectedCoordinate=function(){return this._p1},fT.prototype.getDx=function(){return this._dx},fT.prototype.getLabel=function(){return this._label},fT.prototype.getEdge=function(){return this._edge},fT.prototype.getQuadrant=function(){return this._quadrant},fT.prototype.getNode=function(){return this._node},fT.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),r=e.lastIndexOf(".");return" "+e.substring(r+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},fT.prototype.computeLabel=function(t){},fT.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=cT.quadrant(this._dx,this._dy),aB.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},fT.prototype.interfaces_=function(){return[SS]},fT.prototype.getClass=function(){return fT};var pT=function(t){function e(){var e=arguments[0],r=arguments[1];if(t.call(this,e),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=r,r)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var n=e.getNumPoints()-1;this.init(e.getCoordinate(n),e.getCoordinate(n-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth[t]},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new iT(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 tT("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=this,e=!0,r=0;r<2;r++)t._label.isArea(r)&&t._label.getLocation(r,XI.LEFT)===OS.INTERIOR&&t._label.getLocation(r,XI.RIGHT)===OS.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[XI.LEFT]+"/"+this._depth[XI.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,OS.EXTERIOR),r=!this._label.isArea(1)||this._label.allPositionsEqual(1,OS.EXTERIOR);return t&&e&&r},e.prototype.setEdgeRing=function(t){this._edgeRing=t},e.prototype.getMinEdgeRing=function(){return this._minEdgeRing},e.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},e.prototype.setInResult=function(t){this._isInResult=t},e.prototype.getSym=function(){return this._sym},e.prototype.isForward=function(){return this._isForward},e.prototype.getEdge=function(){return this._edge},e.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},e.prototype.setSym=function(t){this._sym=t},e.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},e.prototype.setEdgeDepths=function(t,e){var r=this.getEdge().getDepthDelta();this._isForward||(r=-r);var n=1;t===XI.LEFT&&(n=-1);var i=XI.opposite(t),o=e+r*n;this.setDepth(t,e),this.setDepth(i,o)},e.prototype.getEdgeRing=function(){return this._edgeRing},e.prototype.isInResult=function(){return this._isInResult},e.prototype.setNext=function(t){this._next=t},e.prototype.isVisited=function(){return this._isVisited},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.depthFactor=function(t,e){return t===OS.EXTERIOR&&e===OS.INTERIOR?1:t===OS.INTERIOR&&e===OS.EXTERIOR?-1:0},e}(fT),dT=function(){};dT.prototype.createNode=function(t){return new uT(t,null)},dT.prototype.interfaces_=function(){return[]},dT.prototype.getClass=function(){return dT};var gT=function(){if(this._edges=new FB,this._nodes=null,this._edgeEndList=new FB,0===arguments.length)this._nodes=new hT(new dT);else if(1===arguments.length){var t=arguments[0];this._nodes=new hT(t)}};gT.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var r=this._edges.get(e);r.print(t),r.eiList.print(t)}},gT.prototype.find=function(t){return this._nodes.find(t)},gT.prototype.addNode=function(){if(arguments[0]instanceof uT){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof PS){var e=arguments[0];return this._nodes.addNode(e)}},gT.prototype.getNodeIterator=function(){return this._nodes.iterator()},gT.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},gT.prototype.debugPrintln=function(t){YS.out.println(t)},gT.prototype.isBoundaryNode=function(t,e){var r=this._nodes.find(e);if(null===r)return!1;var n=r.getLabel();return null!==n&&n.getLocation(t)===OS.BOUNDARY},gT.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},gT.prototype.matchInSameDirection=function(t,e,r,n){return!!t.equals(r)&&fB.computeOrientation(t,e,n)===fB.COLLINEAR&&cT.quadrant(t,e)===cT.quadrant(r,n)},gT.prototype.getEdgeEnds=function(){return this._edgeEndList},gT.prototype.debugPrint=function(t){YS.out.print(t)},gT.prototype.getEdgeIterator=function(){return this._edges.iterator()},gT.prototype.findEdgeInSameDirection=function(t,e){for(var r=this,n=0;n<this._edges.size();n++){var i=r._edges.get(n),o=i.getCoordinates();if(r.matchInSameDirection(t,e,o[0],o[1]))return i;if(r.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return i}return null},gT.prototype.insertEdge=function(t){this._edges.add(t)},gT.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var r=e.next();if(r.getEdge()===t)return r}return null},gT.prototype.addEdges=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next();e._edges.add(n);var i=new pT(n,!0),o=new pT(n,!1);i.setSym(o),o.setSym(i),e.add(i),e.add(o)}},gT.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},gT.prototype.getNodes=function(){return this._nodes.values()},gT.prototype.findEdge=function(t,e){for(var r=0;r<this._edges.size();r++){var n=this._edges.get(r),i=n.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return n}return null},gT.prototype.interfaces_=function(){return[]},gT.prototype.getClass=function(){return gT},gT.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()};var yT=function(){this._geometryFactory=null,this._shellList=new FB;var t=arguments[0];this._geometryFactory=t};yT.prototype.sortShellsAndHoles=function(t,e,r){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()?r.add(i):e.add(i)}},yT.prototype.computePolygons=function(t){for(var e=new FB,r=t.iterator();r.hasNext();){var n=r.next().toPolygon(this._geometryFactory);e.add(n)}return e},yT.prototype.placeFreeHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(null===n.getShell()){var i=this.findEdgeRingContaining(n,t);if(null===i)throw new tT("unable to assign hole to a shell",n.getCoordinate(0));n.setShell(i)}}},yT.prototype.buildMinimalEdgeRings=function(t,e,r){for(var n=new FB,i=t.iterator();i.hasNext();){var o=i.next();if(o.getMaxNodeDegree()>2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):r.addAll(s)}else n.add(o)}return n},yT.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();)if(e.next().containsPoint(t))return!0;return!1},yT.prototype.buildMaximalEdgeRings=function(t){for(var e=new FB,r=t.iterator();r.hasNext();){var n=r.next();if(n.isInResult()&&n.getLabel().isArea()&&null===n.getEdgeRing()){var i=new aT(n,this._geometryFactory);e.add(i),i.setInResult()}}return e},yT.prototype.placePolygonHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();n.isHole()&&n.setShell(t)}},yT.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},yT.prototype.findEdgeRingContaining=function(t,e){for(var r=t.getLinearRing(),n=r.getEnvelopeInternal(),i=r.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var l=a.next(),u=l.getLinearRing(),h=u.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var c=!1;h.contains(n)&&fB.isPointInRing(i,u.getCoordinates())&&(c=!0),c&&(null===o||s.contains(h))&&(o=l)}return o},yT.prototype.findShell=function(t){for(var e=0,r=null,n=t.iterator();n.hasNext();){var i=n.next();i.isHole()||(r=i,e++)}return aB.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),r},yT.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],r=arguments[1];gT.linkResultDirectedEdges(r);var n=this.buildMaximalEdgeRings(e),i=new FB,o=this.buildMinimalEdgeRings(n,this._shellList,i);this.sortShellsAndHoles(o,this._shellList,i),this.placeFreeHoles(this._shellList,i)}},yT.prototype.interfaces_=function(){return[]},yT.prototype.getClass=function(){return yT};var mT=function(){};mT.prototype.getBounds=function(){},mT.prototype.interfaces_=function(){return[]},mT.prototype.getClass=function(){return mT};var vT=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};vT.prototype.getItem=function(){return this._item},vT.prototype.getBounds=function(){return this._bounds},vT.prototype.interfaces_=function(){return[mT,TS]},vT.prototype.getClass=function(){return vT};var _T=function(){this._size=null,this._items=null,this._size=0,this._items=new FB,this._items.add(null)};_T.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},_T.prototype.size=function(){return this._size},_T.prototype.reorder=function(t){for(var e=this,r=null,n=this._items.get(t);2*t<=this._size&&((r=2*t)!==e._size&&e._items.get(r+1).compareTo(e._items.get(r))<0&&r++,e._items.get(r).compareTo(n)<0);t=r)e._items.set(t,e._items.get(r));this._items.set(t,n)},_T.prototype.clear=function(){this._size=0,this._items.clear()},_T.prototype.isEmpty=function(){return 0===this._size},_T.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)},_T.prototype.interfaces_=function(){return[]},_T.prototype.getClass=function(){return _T};var wT=function(){};wT.prototype.visitItem=function(t){},wT.prototype.interfaces_=function(){return[]},wT.prototype.getClass=function(){return wT};var bT=function(){};bT.prototype.insert=function(t,e){},bT.prototype.remove=function(t,e){},bT.prototype.query=function(){},bT.prototype.interfaces_=function(){return[]},bT.prototype.getClass=function(){return bT};var xT=function(){if(this._childBoundables=new FB,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},CT={serialVersionUID:{configurable:!0}};xT.prototype.getLevel=function(){return this._level},xT.prototype.size=function(){return this._childBoundables.size()},xT.prototype.getChildBoundables=function(){return this._childBoundables},xT.prototype.addChildBoundable=function(t){aB.isTrue(null===this._bounds),this._childBoundables.add(t)},xT.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},xT.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},xT.prototype.interfaces_=function(){return[mT,TS]},xT.prototype.getClass=function(){return xT},CT.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(xT,CT);var ET=function(){};ET.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},ET.min=function(t){return ET.sort(t),t.get(0)},ET.sort=function(t,e){var r=t.toArray();e?eI.sort(r,e):eI.sort(r);for(var n=t.iterator(),i=0,o=r.length;i<o;i++)n.next(),n.set(r[i])},ET.singletonList=function(t){var e=new FB;return e.add(t),e};var ST=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],r=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=r,this._distance=this.distance()};ST.prototype.expandToQueue=function(t,e){var r=ST.isComposite(this._boundable1),n=ST.isComposite(this._boundable2);if(r&&n)return ST.area(this._boundable1)>ST.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(r)return this.expand(this._boundable1,this._boundable2,t,e),null;if(n)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new xS("neither boundable is composite")},ST.prototype.isLeaves=function(){return!(ST.isComposite(this._boundable1)||ST.isComposite(this._boundable2))},ST.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},ST.prototype.expand=function(t,e,r,n){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new ST(o,e,this._itemDistance);s.getDistance()<n&&r.add(s)}},ST.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},ST.prototype.getDistance=function(){return this._distance},ST.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},ST.prototype.interfaces_=function(){return[SS]},ST.prototype.getClass=function(){return ST},ST.area=function(t){return t.getBounds().getArea()},ST.isComposite=function(t){return t instanceof xT};var BT=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new FB,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var r=arguments[0];aB.isTrue(r>1,"Node capacity must be greater than 1"),this._nodeCapacity=r}},IT={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};BT.prototype.getNodeCapacity=function(){return this._nodeCapacity},BT.prototype.lastNode=function(t){return t.get(t.size()-1)},BT.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();r instanceof xT?t+=this.size(r):r instanceof vT&&(t+=1)}return t}},BT.prototype.removeItem=function(t,e){for(var r=null,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof vT&&i.getItem()===e&&(r=i)}return null!==r&&(t.getChildBoundables().remove(r),!0)},BT.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new FB:t}if(1===arguments.length){for(var e=arguments[0],r=new FB,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof xT){var o=this.itemsTree(i);null!==o&&r.add(o)}else i instanceof vT?r.add(i.getItem()):aB.shouldNeverReachHere()}return r.size()<=0?null:r}},BT.prototype.insert=function(t,e){aB.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new vT(t,e))},BT.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new FB;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];if(aB.isTrue(r>-2),n.getLevel()===r)return i.add(n),null;for(var o=n.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof xT?this.boundablesAtLevel(r,s,i):(aB.isTrue(s instanceof vT),-1===r&&i.add(s))}return null}},BT.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var r=new FB;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,r),r}if(2===arguments.length){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i)}else if(3===arguments.length)if(NS(arguments[2],wT)&&arguments[0]instanceof Object&&arguments[1]instanceof xT)for(var o=arguments[0],s=arguments[2],a=arguments[1].getChildBoundables(),l=0;l<a.size();l++){var u=a.get(l);t.getIntersectsOp().intersects(u.getBounds(),o)&&(u instanceof xT?t.query(o,u,s):u instanceof vT?s.visitItem(u.getItem()):aB.shouldNeverReachHere())}else if(NS(arguments[2],TB)&&arguments[0]instanceof Object&&arguments[1]instanceof xT)for(var h=arguments[0],c=arguments[2],A=arguments[1].getChildBoundables(),f=0;f<A.size();f++){var p=A.get(f);t.getIntersectsOp().intersects(p.getBounds(),h)&&(p instanceof xT?t.query(h,p,c):p instanceof vT?c.add(p.getItem()):aB.shouldNeverReachHere())}},BT.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},BT.prototype.getRoot=function(){return this.build(),this._root},BT.prototype.remove=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=this.removeItem(n,i);if(o)return!0;for(var s=null,a=n.getChildBoundables().iterator();a.hasNext();){var l=a.next();if(this.getIntersectsOp().intersects(l.getBounds(),r)&&l instanceof xT&&(o=this.remove(r,l,i))){s=l;break}}return null!==s&&s.getChildBoundables().isEmpty()&&n.getChildBoundables().remove(s),o}},BT.prototype.createHigherLevels=function(t,e){aB.isTrue(!t.isEmpty());var r=this.createParentBoundables(t,e+1);return 1===r.size()?r.get(0):this.createHigherLevels(r,e+1)},BT.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();if(r instanceof xT){var n=this.depth(r);n>t&&(t=n)}}return t+1}},BT.prototype.createParentBoundables=function(t,e){var r=this;aB.isTrue(!t.isEmpty());var n=new FB;n.add(this.createNode(e));var i=new FB(t);ET.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var s=o.next();r.lastNode(n).getChildBoundables().size()===r.getNodeCapacity()&&n.add(r.createNode(e)),r.lastNode(n).addChildBoundable(s)}return n},BT.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},BT.prototype.interfaces_=function(){return[TS]},BT.prototype.getClass=function(){return BT},BT.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},IT.IntersectsOp.get=function(){return TT},IT.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},IT.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(BT,IT);var TT=function(){},PT=function(){};PT.prototype.distance=function(t,e){},PT.prototype.interfaces_=function(){return[]},PT.prototype.getClass=function(){return PT};var FT=function(t){function e(r){r=r||e.DEFAULT_NODE_CAPACITY,t.call(this,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return e.prototype.createParentBoundablesFromVerticalSlices=function(t,e){aB.isTrue(t.length>0);for(var r=new FB,n=0;n<t.length;n++)r.addAll(this.createParentBoundablesFromVerticalSlice(t[n],e));return r},e.prototype.createNode=function(t){return new LT(t)},e.prototype.size=function(){return 0===arguments.length?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},e.prototype.insert=function(){if(2!==arguments.length)return t.prototype.insert.apply(this,arguments);var e=arguments[0],r=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,r)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.prototype.verticalSlices=function(t,e){for(var r=Math.trunc(Math.ceil(t.size()/e)),n=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){n[o]=new FB;for(var s=0;i.hasNext()&&s<r;){var a=i.next();n[o].add(a),s++}}return n},e.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var r=arguments[0],n=arguments[1];t.prototype.query.call(this,r,n)}else if(3===arguments.length)if(NS(arguments[2],wT)&&arguments[0]instanceof Object&&arguments[1]instanceof xT){var i=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,i,o,s)}else if(NS(arguments[2],TB)&&arguments[0]instanceof Object&&arguments[1]instanceof xT){var a=arguments[0],l=arguments[1],u=arguments[2];t.prototype.query.call(this,a,l,u)}},e.prototype.getComparator=function(){return e.yComparator},e.prototype.createParentBoundablesFromVerticalSlice=function(e,r){return t.prototype.createParentBoundables.call(this,e,r)},e.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return t.prototype.remove.call(this,e,r)}return t.prototype.remove.apply(this,arguments)},e.prototype.depth=function(){return 0===arguments.length?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},e.prototype.createParentBoundables=function(t,r){aB.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new FB(t);ET.sort(i,e.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(n))));return this.createParentBoundablesFromVerticalSlices(o,r)},e.prototype.nearestNeighbour=function(){if(1===arguments.length){if(NS(arguments[0],PT)){var t=arguments[0],r=new ST(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(r)}if(arguments[0]instanceof ST){var n=arguments[0];return this.nearestNeighbour(n,CS.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof e&&NS(arguments[1],PT)){var i=arguments[0],o=arguments[1],s=new ST(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof ST&&"number"==typeof arguments[1]){var a=arguments[0],l=arguments[1],u=null,h=new _T;for(h.add(a);!h.isEmpty()&&l>0;){var c=h.poll(),A=c.getDistance();if(A>=l)break;c.isLeaves()?(l=A,u=c):c.expandToQueue(h,l)}return[u.getBoundable(0).getItem(),u.getBoundable(1).getItem()]}}else if(3===arguments.length){var f=arguments[2],p=new vT(arguments[0],arguments[1]),d=new ST(this.getRoot(),p,f);return this.nearestNeighbour(d)[0]}},e.prototype.interfaces_=function(){return[bT,TS]},e.prototype.getClass=function(){return e},e.centreX=function(t){return e.avg(t.getMinX(),t.getMaxX())},e.avg=function(t,e){return(t+e)/2},e.centreY=function(t){return e.avg(t.getMinY(),t.getMaxY())},r.STRtreeNode.get=function(){return LT},r.serialVersionUID.get=function(){return 0x39920f7d5f261e0},r.xComparator.get=function(){return{interfaces_:function(){return[IS]},compare:function(r,n){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(n.getBounds()))}}},r.yComparator.get=function(){return{interfaces_:function(){return[IS]},compare:function(r,n){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(n.getBounds()))}}},r.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},r.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,r),e}(BT),LT=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var r=e.next();null===t?t=new JS(r.getBounds()):t.expandToInclude(r.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(xT),MT=function(){};MT.prototype.interfaces_=function(){return[]},MT.prototype.getClass=function(){return MT},MT.relativeSign=function(t,e){return t<e?-1:t>e?1:0},MT.compare=function(t,e,r){if(e.equals2D(r))return 0;var n=MT.relativeSign(e.x,r.x),i=MT.relativeSign(e.y,r.y);switch(t){case 0:return MT.compareValue(n,i);case 1:return MT.compareValue(i,n);case 2:return MT.compareValue(i,-n);case 3:return MT.compareValue(-n,i);case 4:return MT.compareValue(-n,-i);case 5:return MT.compareValue(-i,-n);case 6:return MT.compareValue(-i,n);case 7:return MT.compareValue(n,-i)}return aB.shouldNeverReachHere("invalid octant value"),0},MT.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var OT=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._segString=t,this.coord=new PS(e),this.segmentIndex=r,this._segmentOctant=n,this._isInterior=!e.equals2D(t.getCoordinate(r))};OT.prototype.getCoordinate=function(){return this.coord},OT.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},OT.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:MT.compare(this._segmentOctant,this.coord,e.coord)},OT.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},OT.prototype.isInterior=function(){return this._isInterior},OT.prototype.interfaces_=function(){return[SS]},OT.prototype.getClass=function(){return OT};var kT=function(){this._nodeMap=new YB,this._edge=null;var t=arguments[0];this._edge=t};kT.prototype.getSplitCoordinates=function(){var t=new MB;this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next();this.addEdgeCoordinates(r,n,t),r=n}return t.toCoordinateArray()},kT.prototype.addCollapsedNodes=function(){var t=new FB;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var r=e.next().intValue();this.add(this._edge.getCoordinate(r),r)}},kT.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},kT.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var r=this._edge.getCoordinate(e),n=this._edge.getCoordinate(e+2);r.equals2D(n)&&t.add(new QS(e+1))}},kT.prototype.addEdgeCoordinates=function(t,e,r){var n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);r.add(new PS(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)r.add(this._edge.getCoordinate(o));i&&r.add(new PS(e.coord))},kT.prototype.iterator=function(){return this._nodeMap.values().iterator()},kT.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},kT.prototype.findCollapseIndex=function(t,e,r){if(!t.coord.equals2D(e.coord))return!1;var n=e.segmentIndex-t.segmentIndex;return e.isInterior()||n--,1===n&&(r[0]=t.segmentIndex+1,!0)},kT.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),r=this.iterator(),n=r.next();r.hasNext();){var i=r.next();this.findCollapseIndex(n,i,e)&&t.add(new QS(e[0])),n=i}},kT.prototype.getEdge=function(){return this._edge},kT.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},kT.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new PS(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new PS(e.coord)),new DT(o,this._edge.getData())},kT.prototype.add=function(t,e){var r=new OT(this._edge,t,e,this._edge.getSegmentOctant(e)),n=this._nodeMap.get(r);return null!==n?(aB.isTrue(n.coord.equals2D(t),"Found equal nodes with different coordinates"),n):(this._nodeMap.put(r,r),r)},kT.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),r=t.get(0).getCoordinate(0);if(!r.equals2D(e[0]))throw new oB("bad split edge start point at "+r);var n=t.get(t.size()-1).getCoordinates(),i=n[n.length-1];if(!i.equals2D(e[e.length-1]))throw new oB("bad split edge end point at "+i)},kT.prototype.interfaces_=function(){return[]},kT.prototype.getClass=function(){return kT};var NT=function(){};NT.prototype.interfaces_=function(){return[]},NT.prototype.getClass=function(){return NT},NT.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 xS("Cannot compute the octant for point ( "+t+", "+e+" )");var r=Math.abs(t),n=Math.abs(e);return t>=0?e>=0?r>=n?0:1:r>=n?7:6:e>=0?r>=n?3:2:r>=n?4:5}if(arguments[0]instanceof PS&&arguments[1]instanceof PS){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new xS("Cannot compute the octant for two identical points "+i);return NT.octant(s,a)}};var RT=function(){};RT.prototype.getCoordinates=function(){},RT.prototype.size=function(){},RT.prototype.getCoordinate=function(t){},RT.prototype.isClosed=function(){},RT.prototype.setData=function(t){},RT.prototype.getData=function(){},RT.prototype.interfaces_=function(){return[]},RT.prototype.getClass=function(){return RT};var UT=function(){};UT.prototype.addIntersection=function(t,e){},UT.prototype.interfaces_=function(){return[RT]},UT.prototype.getClass=function(){return UT};var DT=function(){this._nodeList=new kT(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};DT.prototype.getCoordinates=function(){return this._pts},DT.prototype.size=function(){return this._pts.length},DT.prototype.getCoordinate=function(t){return this._pts[t]},DT.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},DT.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},DT.prototype.setData=function(t){this._data=t},DT.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:NT.octant(t,e)},DT.prototype.getData=function(){return this._data},DT.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var r=arguments[1],n=arguments[3],i=new PS(arguments[0].getIntersection(n));this.addIntersection(i,r)}},DT.prototype.toString=function(){return iB.toLineString(new LI(this._pts))},DT.prototype.getNodeList=function(){return this._nodeList},DT.prototype.addIntersectionNode=function(t,e){var r=e,n=r+1;if(n<this._pts.length){var i=this._pts[n];t.equals2D(i)&&(r=n)}return this._nodeList.add(t,r)},DT.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},DT.prototype.interfaces_=function(){return[UT]},DT.prototype.getClass=function(){return DT},DT.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new FB;return DT.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();)n.next().getNodeList().addSplitEdges(r)};var QT=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new PS,this.p1=new PS;else if(1===arguments.length){var t=arguments[0];this.p0=new PS(t.p0),this.p1=new PS(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=arguments[3];this.p0=new PS(e,r),this.p1=new PS(n,i)}},GT={serialVersionUID:{configurable:!0}};QT.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},QT.prototype.orientationIndex=function(){if(arguments[0]instanceof QT){var t=arguments[0],e=fB.orientationIndex(this.p0,this.p1,t.p0),r=fB.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&r>=0||e<=0&&r<=0?Math.max(e,r):0}if(arguments[0]instanceof PS){var n=arguments[0];return fB.orientationIndex(this.p0,this.p1,n)}},QT.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},QT.prototype.isVertical=function(){return this.p0.x===this.p1.x},QT.prototype.equals=function(t){if(!(t instanceof QT))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},QT.prototype.intersection=function(t){var e=new hB;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},QT.prototype.project=function(){if(arguments[0]instanceof PS){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new PS(t);var e=this.projectionFactor(t),r=new PS;return r.x=this.p0.x+e*(this.p1.x-this.p0.x),r.y=this.p0.y+e*(this.p1.y-this.p0.y),r}if(arguments[0]instanceof QT){var n=arguments[0],i=this.projectionFactor(n.p0),o=this.projectionFactor(n.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(n.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(n.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new QT(s,a)}},QT.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},QT.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},QT.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},QT.prototype.distancePerpendicular=function(t){return fB.distancePointLinePerpendicular(t,this.p0,this.p1)},QT.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},QT.prototype.midPoint=function(){return QT.midPoint(this.p0,this.p1)},QT.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,r=this.p1.y-this.p0.y,n=e*e+r*r;return n<=0?CS.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*r)/n},QT.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var r=new Array(2).fill(null),n=CS.MAX_VALUE,i=null,o=this.closestPoint(t.p0);n=o.distance(t.p0),r[0]=o,r[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<n&&(n=i,r[0]=s,r[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<n&&(n=i,r[0]=this.p0,r[1]=a);var l=t.closestPoint(this.p1);return(i=l.distance(this.p1))<n&&(n=i,r[0]=this.p1,r[1]=l),r},QT.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},QT.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},QT.prototype.getLength=function(){return this.p0.distance(this.p1)},QT.prototype.compareTo=function(t){var e=t,r=this.p0.compareTo(e.p0);return 0!==r?r:this.p1.compareTo(e.p1)},QT.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},QT.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)},QT.prototype.lineIntersection=function(t){try{return ZS.intersection(this.p0,this.p1,t.p0,t.p1)}catch(e){if(!(e instanceof XS))throw e}return null},QT.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},QT.prototype.pointAlongOffset=function(t,e){var r=this.p0.x+t*(this.p1.x-this.p0.x),n=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,s=Math.sqrt(i*i+o*o),a=0,l=0;if(0!==e){if(s<=0)throw new Error("Cannot compute offset from zero-length line segment");a=e*i/s,l=e*o/s}return new PS(r-l,n+a)},QT.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=r.x,this.p1.y=r.y}},QT.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||CS.isNaN(e))&&(e=1),e},QT.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},QT.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},QT.prototype.distance=function(){if(arguments[0]instanceof QT){var t=arguments[0];return fB.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof PS){var e=arguments[0];return fB.distancePointLine(e,this.p0,this.p1)}},QT.prototype.pointAlong=function(t){var e=new PS;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},QT.prototype.hashCode=function(){var t=CS.doubleToLongBits(this.p0.x);t^=31*CS.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),r=CS.doubleToLongBits(this.p1.x);return r^=31*CS.doubleToLongBits(this.p1.y),e^Math.trunc(r)^Math.trunc(r>>32)},QT.prototype.interfaces_=function(){return[SS,TS]},QT.prototype.getClass=function(){return QT},QT.midPoint=function(t,e){return new PS((t.x+e.x)/2,(t.y+e.y)/2)},GT.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(QT,GT);var jT=function(){this.tempEnv1=new JS,this.tempEnv2=new JS,this._overlapSeg1=new QT,this._overlapSeg2=new QT};jT.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},jT.prototype.interfaces_=function(){return[]},jT.prototype.getClass=function(){return jT};var HT=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._pts=t,this._start=e,this._end=r,this._context=n};HT.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},HT.prototype.computeSelect=function(t,e,r,n){var i=this._pts[e],o=this._pts[r];if(n.tempEnv1.init(i,o),r-e==1)return n.select(this,e),null;if(!t.intersects(n.tempEnv1))return null;var s=Math.trunc((e+r)/2);e<s&&this.computeSelect(t,e,s,n),s<r&&this.computeSelect(t,s,r,n)},HT.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,r=this._start;r<=this._end;r++)t[e++]=this._pts[r];return t},HT.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},HT.prototype.setId=function(t){this._id=t},HT.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},HT.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new JS(t,e)}return this._env},HT.prototype.getEndIndex=function(){return this._end},HT.prototype.getStartIndex=function(){return this._start},HT.prototype.getContext=function(){return this._context},HT.prototype.getId=function(){return this._id},HT.prototype.computeOverlapsInternal=function(t,e,r,n,i,o){var s=this._pts[t],a=this._pts[e],l=r._pts[n],u=r._pts[i];if(e-t==1&&i-n==1)return o.overlap(this,t,r,n),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(l,u),!o.tempEnv1.intersects(o.tempEnv2))return null;var h=Math.trunc((t+e)/2),c=Math.trunc((n+i)/2);t<h&&(n<c&&this.computeOverlapsInternal(t,h,r,n,c,o),c<i&&this.computeOverlapsInternal(t,h,r,c,i,o)),h<e&&(n<c&&this.computeOverlapsInternal(h,e,r,n,c,o),c<i&&this.computeOverlapsInternal(h,e,r,c,i,o))},HT.prototype.interfaces_=function(){return[]},HT.prototype.getClass=function(){return HT};var zT=function(){};zT.prototype.interfaces_=function(){return[]},zT.prototype.getClass=function(){return zT},zT.getChainStartIndices=function(t){var e=0,r=new FB;r.add(new QS(e));do{var n=zT.findChainEnd(t,e);r.add(new QS(n)),e=n}while(e<t.length-1);return zT.toIntArray(r)},zT.findChainEnd=function(t,e){for(var r=e;r<t.length-1&&t[r].equals2D(t[r+1]);)r++;if(r>=t.length-1)return t.length-1;for(var n=cT.quadrant(t[r],t[r+1]),i=e+1;i<t.length&&(t[i-1].equals2D(t[i])||cT.quadrant(t[i-1],t[i])===n);)i++;return i-1},zT.getChains=function(){if(1===arguments.length){var t=arguments[0];return zT.getChains(t,null)}if(2===arguments.length){for(var e=arguments[0],r=arguments[1],n=new FB,i=zT.getChainStartIndices(e),o=0;o<i.length-1;o++){var s=new HT(e,i[o],i[o+1],r);n.add(s)}return n}},zT.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var VT=function(){};VT.prototype.computeNodes=function(t){},VT.prototype.getNodedSubstrings=function(){},VT.prototype.interfaces_=function(){return[]},VT.prototype.getClass=function(){return VT};var KT=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};KT.prototype.setSegmentIntersector=function(t){this._segInt=t},KT.prototype.interfaces_=function(){return[VT]},KT.prototype.getClass=function(){return KT};var qT=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new FB,this._index=new FT,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return DT.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=this,r=zT.getChains(t.getCoordinates(),t).iterator();r.hasNext();){var n=r.next();n.setId(e._idCounter++),e._index.insert(n.getEnvelope(),n),e._monoChains.add(n)}},e.prototype.computeNodes=function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},e.prototype.intersectChains=function(){for(var t=this,e=new WT(this._segInt),r=this._monoChains.iterator();r.hasNext();)for(var n=r.next(),i=t._index.query(n.getEnvelope()).iterator();i.hasNext();){var o=i.next();if(o.getId()>n.getId()&&(n.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.SegmentOverlapAction.get=function(){return WT},Object.defineProperties(e,r),e}(KT),WT=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[1],r=arguments[2],n=arguments[3],i=arguments[0].getContext(),o=r.getContext();this._si.processIntersections(i,e,o,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(jT),XT=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(n)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},YT={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}};XT.prototype.getEndCapStyle=function(){return this._endCapStyle},XT.prototype.isSingleSided=function(){return this._isSingleSided},XT.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=XT.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=XT.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==XT.JOIN_ROUND&&(this._quadrantSegments=XT.DEFAULT_QUADRANT_SEGMENTS)},XT.prototype.getJoinStyle=function(){return this._joinStyle},XT.prototype.setJoinStyle=function(t){this._joinStyle=t},XT.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},XT.prototype.getSimplifyFactor=function(){return this._simplifyFactor},XT.prototype.getQuadrantSegments=function(){return this._quadrantSegments},XT.prototype.setEndCapStyle=function(t){this._endCapStyle=t},XT.prototype.getMitreLimit=function(){return this._mitreLimit},XT.prototype.setMitreLimit=function(t){this._mitreLimit=t},XT.prototype.setSingleSided=function(t){this._isSingleSided=t},XT.prototype.interfaces_=function(){return[]},XT.prototype.getClass=function(){return XT},XT.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},YT.CAP_ROUND.get=function(){return 1},YT.CAP_FLAT.get=function(){return 2},YT.CAP_SQUARE.get=function(){return 3},YT.JOIN_ROUND.get=function(){return 1},YT.JOIN_MITRE.get=function(){return 2},YT.JOIN_BEVEL.get=function(){return 3},YT.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},YT.DEFAULT_MITRE_LIMIT.get=function(){return 5},YT.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(XT,YT);var ZT=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=fB.COUNTERCLOCKWISE,this._inputLine=t||null},JT={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};ZT.prototype.isDeletable=function(t,e,r,n){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[r];return!!this.isConcave(i,o,s)&&!!this.isShallow(i,o,s,n)&&this.isShallowSampled(i,o,t,r,n)},ZT.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,r=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(r),i=!1;n<this._inputLine.length;){var o=!1;t.isDeletable(e,r,n,t._distanceTol)&&(t._isDeleted[r]=ZT.DELETE,o=!0,i=!0),e=o?n:r,r=t.findNextNonDeletedIndex(e),n=t.findNextNonDeletedIndex(r)}return i},ZT.prototype.isShallowConcavity=function(t,e,r,n){return fB.computeOrientation(t,e,r)===this._angleOrientation&&fB.distancePointLine(e,t,r)<n},ZT.prototype.isShallowSampled=function(t,e,r,n,i){var o=Math.trunc((n-r)/ZT.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=r;s<n;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},ZT.prototype.isConcave=function(t,e,r){return fB.computeOrientation(t,e,r)===this._angleOrientation},ZT.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=fB.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},ZT.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===ZT.DELETE;)e++;return e},ZT.prototype.isShallow=function(t,e,r,n){return fB.distancePointLine(e,t,r)<n},ZT.prototype.collapseLine=function(){for(var t=new MB,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==ZT.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},ZT.prototype.interfaces_=function(){return[]},ZT.prototype.getClass=function(){return ZT},ZT.simplify=function(t,e){return new ZT(t).simplify(e)},JT.INIT.get=function(){return 0},JT.DELETE.get=function(){return 1},JT.KEEP.get=function(){return 1},JT.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(ZT,JT);var $T=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new FB},tP={COORDINATE_ARRAY_TYPE:{configurable:!0}};$T.prototype.getCoordinates=function(){return this._ptList.toArray($T.COORDINATE_ARRAY_TYPE)},$T.prototype.setPrecisionModel=function(t){this._precisionModel=t},$T.prototype.addPt=function(t){var e=new PS(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},$T.prototype.revere=function(){},$T.prototype.addPts=function(t,e){if(e)for(var r=0;r<t.length;r++)this.addPt(t[r]);else for(var n=t.length-1;n>=0;n--)this.addPt(t[n])},$T.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},$T.prototype.toString=function(){return(new GI).createLineString(this.getCoordinates()).toString()},$T.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new PS(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},$T.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},$T.prototype.interfaces_=function(){return[]},$T.prototype.getClass=function(){return $T},tP.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties($T,tP);var eP=function(){},rP={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};eP.prototype.interfaces_=function(){return[]},eP.prototype.getClass=function(){return eP},eP.toDegrees=function(t){return 180*t/Math.PI},eP.normalize=function(t){for(;t>Math.PI;)t-=eP.PI_TIMES_2;for(;t<=-Math.PI;)t+=eP.PI_TIMES_2;return t},eP.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],r=arguments[1],n=r.x-e.x,i=r.y-e.y;return Math.atan2(i,n)}},eP.isAcute=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)>0},eP.isObtuse=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)<0},eP.interiorAngle=function(t,e,r){var n=eP.angle(e,t),i=eP.angle(e,r);return Math.abs(i-n)},eP.normalizePositive=function(t){if(t<0){for(;t<0;)t+=eP.PI_TIMES_2;t>=eP.PI_TIMES_2&&(t=0)}else{for(;t>=eP.PI_TIMES_2;)t-=eP.PI_TIMES_2;t<0&&(t=0)}return t},eP.angleBetween=function(t,e,r){var n=eP.angle(e,t),i=eP.angle(e,r);return eP.diff(n,i)},eP.diff=function(t,e){var r=null;return(r=t<e?e-t:t-e)>Math.PI&&(r=2*Math.PI-r),r},eP.toRadians=function(t){return t*Math.PI/180},eP.getTurn=function(t,e){var r=Math.sin(e-t);return r>0?eP.COUNTERCLOCKWISE:r<0?eP.CLOCKWISE:eP.NONE},eP.angleBetweenOriented=function(t,e,r){var n=eP.angle(e,t),i=eP.angle(e,r)-n;return i<=-Math.PI?i+eP.PI_TIMES_2:i>Math.PI?i-eP.PI_TIMES_2:i},rP.PI_TIMES_2.get=function(){return 2*Math.PI},rP.PI_OVER_2.get=function(){return Math.PI/2},rP.PI_OVER_4.get=function(){return Math.PI/4},rP.COUNTERCLOCKWISE.get=function(){return fB.COUNTERCLOCKWISE},rP.CLOCKWISE.get=function(){return fB.CLOCKWISE},rP.NONE.get=function(){return fB.COLLINEAR},Object.defineProperties(eP,rP);var nP=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 QT,this._seg1=new QT,this._offset0=new QT,this._offset1=new QT,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._precisionModel=e,this._bufParams=r,this._li=new hB,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===XT.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},iP={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}};nP.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var r=fB.computeOrientation(this._s0,this._s1,this._s2),n=r===fB.CLOCKWISE&&this._side===XI.LEFT||r===fB.COUNTERCLOCKWISE&&this._side===XI.RIGHT;0===r?this.addCollinear(e):n?this.addOutsideTurn(r,e):this.addInsideTurn(r,e)},nP.prototype.addLineEndCap=function(t,e){var r=new QT(t,e),n=new QT;this.computeOffsetSegment(r,XI.LEFT,this._distance,n);var i=new QT;this.computeOffsetSegment(r,XI.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 XT.CAP_ROUND:this._segList.addPt(n.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,fB.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case XT.CAP_FLAT:this._segList.addPt(n.p1),this._segList.addPt(i.p1);break;case XT.CAP_SQUARE:var l=new PS;l.x=Math.abs(this._distance)*Math.cos(a),l.y=Math.abs(this._distance)*Math.sin(a);var u=new PS(n.p1.x+l.x,n.p1.y+l.y),h=new PS(i.p1.x+l.x,i.p1.y+l.y);this._segList.addPt(u),this._segList.addPt(h)}},nP.prototype.getCoordinates=function(){return this._segList.getCoordinates()},nP.prototype.addMitreJoin=function(t,e,r,n){var i=!0,o=null;try{o=ZS.intersection(e.p0,e.p1,r.p0,r.p1),(n<=0?1:o.distance(t)/Math.abs(n))>this._bufParams.getMitreLimit()&&(i=!1)}catch(s){if(!(s instanceof XS))throw s;o=new PS(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,r,n,this._bufParams.getMitreLimit())},nP.prototype.addFilletCorner=function(t,e,r,n,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),l=r.x-t.x,u=r.y-t.y,h=Math.atan2(u,l);n===fB.CLOCKWISE?a<=h&&(a+=2*Math.PI):a>=h&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,h,n,i),this._segList.addPt(r)},nP.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*nP.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===XT.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===XT.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))},nP.prototype.createSquare=function(t){this._segList.addPt(new PS(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new PS(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new PS(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new PS(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},nP.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},nP.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},nP.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},nP.prototype.initSideSegments=function(t,e,r){this._s1=t,this._s2=e,this._side=r,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,r,this._distance,this._offset1)},nP.prototype.addLimitedMitreJoin=function(t,e,r,n){var i=this._seg0.p1,o=eP.angle(i,this._seg0.p0),s=eP.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=eP.normalize(o+s),l=eP.normalize(a+Math.PI),u=n*r,h=r-u*Math.abs(Math.sin(s)),c=i.x+u*Math.cos(l),A=i.y+u*Math.sin(l),f=new PS(c,A),p=new QT(i,f),d=p.pointAlongOffset(1,h),g=p.pointAlongOffset(1,-h);this._side===XI.LEFT?(this._segList.addPt(d),this._segList.addPt(g)):(this._segList.addPt(g),this._segList.addPt(d))},nP.prototype.computeOffsetSegment=function(t,e,r,n){var i=e===XI.LEFT?1:-1,o=t.p1.x-t.p0.x,s=t.p1.y-t.p0.y,a=Math.sqrt(o*o+s*s),l=i*r*o/a,u=i*r*s/a;n.p0.x=t.p0.x-u,n.p0.y=t.p0.y+l,n.p1.x=t.p1.x-u,n.p1.y=t.p1.y+l},nP.prototype.addFilletArc=function(t,e,r,n,i){var o=n===fB.CLOCKWISE?-1:1,s=Math.abs(e-r),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var l=s/a,u=0,h=new PS;u<s;){var c=e+o*u;h.x=t.x+i*Math.cos(c),h.y=t.y+i*Math.sin(c),this._segList.addPt(h),u+=l}},nP.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*nP.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var r=new PS((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r);var n=new PS((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},nP.prototype.createCircle=function(t){var e=new PS(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},nP.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},nP.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new $T,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*nP.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},nP.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===XT.JOIN_BEVEL||this._bufParams.getJoinStyle()===XT.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,fB.CLOCKWISE,this._distance))},nP.prototype.closeRing=function(){this._segList.closeRing()},nP.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},nP.prototype.interfaces_=function(){return[]},nP.prototype.getClass=function(){return nP},iP.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},iP.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},iP.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},iP.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(nP,iP);var oP=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};oP.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var r=e<0,n=Math.abs(e),i=this.getSegGen(n);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,r,i);var o=i.getCoordinates();return r&&OB.reverse(o),o},oP.prototype.computeSingleSidedBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){r.addSegments(t,!0);var i=ZT.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],XI.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{r.addSegments(t,!1);var a=ZT.simplify(t,n),l=a.length-1;r.initSideSegments(a[0],a[1],XI.LEFT),r.addFirstSegment();for(var u=2;u<=l;u++)r.addNextSegment(a[u],!0)}r.addLastSegment(),r.closeRing()},oP.prototype.computeRingBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);e===XI.RIGHT&&(n=-n);var i=ZT.simplify(t,n),o=i.length-1;r.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;r.addNextSegment(i[s],a)}r.closeRing()},oP.prototype.computeLineBufferCurve=function(t,e){var r=this.simplifyTolerance(this._distance),n=ZT.simplify(t,r),i=n.length-1;e.initSideSegments(n[0],n[1],XI.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(n[o],!0);e.addLastSegment(),e.addLineEndCap(n[i-1],n[i]);var s=ZT.simplify(t,-r),a=s.length-1;e.initSideSegments(s[a],s[a-1],XI.LEFT);for(var l=a-2;l>=0;l--)e.addNextSegment(s[l],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},oP.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case XT.CAP_ROUND:e.createCircle(t);break;case XT.CAP_SQUARE:e.createSquare(t)}},oP.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var r=Math.abs(e),n=this.getSegGen(r);if(t.length<=1)this.computePointCurve(t[0],n);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,n)}else this.computeLineBufferCurve(t,n);return n.getCoordinates()},oP.prototype.getBufferParameters=function(){return this._bufParams},oP.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},oP.prototype.getRingCurve=function(t,e,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(0===r)return oP.copyCoordinates(t);var n=this.getSegGen(r);return this.computeRingBufferCurve(t,e,n),n.getCoordinates()},oP.prototype.computeOffsetCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){var i=ZT.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],XI.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{var a=ZT.simplify(t,n),l=a.length-1;r.initSideSegments(a[0],a[1],XI.LEFT),r.addFirstSegment();for(var u=2;u<=l;u++)r.addNextSegment(a[u],!0)}r.addLastSegment()},oP.prototype.getSegGen=function(t){return new nP(this._precisionModel,this._bufParams,t)},oP.prototype.interfaces_=function(){return[]},oP.prototype.getClass=function(){return oP},oP.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),r=0;r<e.length;r++)e[r]=new PS(t[r]);return e};var sP=function(){this._subgraphs=null,this._seg=new QT,this._cga=new fB;var t=arguments[0];this._subgraphs=t},aP={DepthSegment:{configurable:!0}};sP.prototype.findStabbedSegments=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=new FB,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),o=i.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),r)}return r}if(3===arguments.length)if(NS(arguments[2],TB)&&arguments[0]instanceof PS&&arguments[1]instanceof pT){for(var s=arguments[0],a=arguments[1],l=arguments[2],u=a.getEdge().getCoordinates(),h=0;h<u.length-1;h++)if(t._seg.p0=u[h],t._seg.p1=u[h+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||fB.computeOrientation(t._seg.p0,t._seg.p1,s)===fB.RIGHT)){var c=a.getDepth(XI.LEFT);t._seg.p0.equals(u[h])||(c=a.getDepth(XI.RIGHT));var A=new lP(t._seg,c);l.add(A)}}else if(NS(arguments[2],TB)&&arguments[0]instanceof PS&&NS(arguments[1],TB))for(var f=arguments[0],p=arguments[2],d=arguments[1].iterator();d.hasNext();){var g=d.next();g.isForward()&&t.findStabbedSegments(f,g,p)}},sP.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:ET.min(e)._leftDepth},sP.prototype.interfaces_=function(){return[]},sP.prototype.getClass=function(){return sP},aP.DepthSegment.get=function(){return lP},Object.defineProperties(sP,aP);var lP=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new QT(t),this._leftDepth=e};lP.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var r=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==r||0!=(r=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?r:this._upwardSeg.compareTo(e._upwardSeg)},lP.prototype.compareX=function(t,e){var r=t.p0.compareTo(e.p0);return 0!==r?r:t.p1.compareTo(e.p1)},lP.prototype.toString=function(){return this._upwardSeg.toString()},lP.prototype.interfaces_=function(){return[SS]},lP.prototype.getClass=function(){return lP};var uP=function(t,e,r){this.p0=t||null,this.p1=e||null,this.p2=r||null};uP.prototype.area=function(){return uP.area(this.p0,this.p1,this.p2)},uP.prototype.signedArea=function(){return uP.signedArea(this.p0,this.p1,this.p2)},uP.prototype.interpolateZ=function(t){if(null===t)throw new xS("Supplied point is null.");return uP.interpolateZ(t,this.p0,this.p1,this.p2)},uP.prototype.longestSideLength=function(){return uP.longestSideLength(this.p0,this.p1,this.p2)},uP.prototype.isAcute=function(){return uP.isAcute(this.p0,this.p1,this.p2)},uP.prototype.circumcentre=function(){return uP.circumcentre(this.p0,this.p1,this.p2)},uP.prototype.area3D=function(){return uP.area3D(this.p0,this.p1,this.p2)},uP.prototype.centroid=function(){return uP.centroid(this.p0,this.p1,this.p2)},uP.prototype.inCentre=function(){return uP.inCentre(this.p0,this.p1,this.p2)},uP.prototype.interfaces_=function(){return[]},uP.prototype.getClass=function(){return uP},uP.area=function(t,e,r){return Math.abs(((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2)},uP.signedArea=function(t,e,r){return((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2},uP.det=function(t,e,r,n){return t*n-e*r},uP.interpolateZ=function(t,e,r,n){var i=e.x,o=e.y,s=r.x-i,a=n.x-i,l=r.y-o,u=n.y-o,h=s*u-a*l,c=t.x-i,A=t.y-o,f=(u*c-a*A)/h,p=(-l*c+s*A)/h;return e.z+f*(r.z-e.z)+p*(n.z-e.z)},uP.longestSideLength=function(t,e,r){var n=t.distance(e),i=e.distance(r),o=r.distance(t),s=n;return i>s&&(s=i),o>s&&(s=o),s},uP.isAcute=function(t,e,r){return!!eP.isAcute(t,e,r)&&!!eP.isAcute(e,r,t)&&!!eP.isAcute(r,t,e)},uP.circumcentre=function(t,e,r){var n=r.x,i=r.y,o=t.x-n,s=t.y-i,a=e.x-n,l=e.y-i,u=2*uP.det(o,s,a,l),h=uP.det(s,o*o+s*s,l,a*a+l*l),c=uP.det(o,o*o+s*s,a,a*a+l*l);return new PS(n-h/u,i+c/u)},uP.perpendicularBisector=function(t,e){var r=e.x-t.x,n=e.y-t.y,i=new ZS(t.x+r/2,t.y+n/2,1),o=new ZS(t.x-n+r/2,t.y+r+n/2,1);return new ZS(i,o)},uP.angleBisector=function(t,e,r){var n=e.distance(t),i=n/(n+e.distance(r)),o=r.x-t.x,s=r.y-t.y;return new PS(t.x+i*o,t.y+i*s)},uP.area3D=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=r.x-t.x,a=r.y-t.y,l=r.z-t.z,u=i*l-o*a,h=o*s-n*l,c=n*a-i*s,A=u*u+h*h+c*c;return Math.sqrt(A)/2},uP.centroid=function(t,e,r){var n=(t.x+e.x+r.x)/3,i=(t.y+e.y+r.y)/3;return new PS(n,i)},uP.inCentre=function(t,e,r){var n=e.distance(r),i=t.distance(r),o=t.distance(e),s=n+i+o,a=(n*t.x+i*e.x+o*r.x)/s,l=(n*t.y+i*e.y+o*r.y)/s;return new PS(a,l)};var hP=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new FB;var t=arguments[0],e=arguments[1],r=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=r};hP.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,OS.EXTERIOR,OS.INTERIOR)},hP.prototype.addPolygon=function(t){var e=this,r=this._distance,n=XI.LEFT;this._distance<0&&(r=-this._distance,n=XI.RIGHT);var i=t.getExteriorRing(),o=OB.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,r,n,OS.EXTERIOR,OS.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var a=t.getInteriorRingN(s),l=OB.removeRepeatedPoints(a.getCoordinates());e._distance>0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(l,r,XI.opposite(n),OS.INTERIOR,OS.EXTERIOR)}},hP.prototype.isTriangleErodedCompletely=function(t,e){var r=new uP(t[0],t[1],t[2]),n=r.inCentre();return fB.distancePointLine(n,r.p0,r.p1)<Math.abs(e)},hP.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=OB.removeRepeatedPoints(t.getCoordinates()),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,OS.EXTERIOR,OS.INTERIOR)},hP.prototype.addCurve=function(t,e,r){if(null===t||t.length<2)return null;var n=new DT(t,new iT(0,OS.BOUNDARY,e,r));this._curveList.add(n)},hP.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},hP.prototype.addPolygonRing=function(t,e,r,n,i){if(0===e&&t.length<EI.MINIMUM_VALID_SIZE)return null;var o=n,s=i;t.length>=EI.MINIMUM_VALID_SIZE&&fB.isCCW(t)&&(o=i,s=n,r=XI.opposite(r));var a=this._curveBuilder.getRingCurve(t,r,e);this.addCurve(a,o,s)},hP.prototype.add=function(t){if(t.isEmpty())return null;t instanceof xI?this.addPolygon(t):t instanceof vI?this.addLineString(t):t instanceof wI?this.addPoint(t):(t instanceof CI||t instanceof aI||t instanceof SI||t instanceof sI)&&this.addCollection(t)},hP.prototype.isErodedCompletely=function(t,e){var r=t.getCoordinates();if(r.length<4)return e<0;if(4===r.length)return this.isTriangleErodedCompletely(r,e);var n=t.getEnvelopeInternal(),i=Math.min(n.getHeight(),n.getWidth());return e<0&&2*Math.abs(e)>i},hP.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},hP.prototype.interfaces_=function(){return[]},hP.prototype.getClass=function(){return hP};var cP=function(){};cP.prototype.locate=function(t){},cP.prototype.interfaces_=function(){return[]},cP.prototype.getClass=function(){return cP};var AP=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()};AP.prototype.next=function(){if(this._atStart)return this._atStart=!1,AP.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 PB;var t=this._parent.getGeometryN(this._index++);return t instanceof sI?(this._subcollectionIterator=new AP(t),this._subcollectionIterator.next()):t},AP.prototype.remove=function(){throw new Error(this.getClass().getName())},AP.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)},AP.prototype.interfaces_=function(){return[IB]},AP.prototype.getClass=function(){return AP},AP.isAtomic=function(t){return!(t instanceof sI)};var fP=function(){this._geom=null;var t=arguments[0];this._geom=t};fP.prototype.locate=function(t){return fP.locate(t,this._geom)},fP.prototype.interfaces_=function(){return[cP]},fP.prototype.getClass=function(){return fP},fP.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&fB.isPointInRing(t,e.getCoordinates())},fP.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var r=e.getExteriorRing();if(!fP.isPointInRing(t,r))return!1;for(var n=0;n<e.getNumInteriorRing();n++){var i=e.getInteriorRingN(n);if(fP.isPointInRing(t,i))return!1}return!0},fP.containsPoint=function(t,e){if(e instanceof xI)return fP.containsPointInPolygon(t,e);if(e instanceof sI)for(var r=new AP(e);r.hasNext();){var n=r.next();if(n!==e&&fP.containsPoint(t,n))return!0}return!1},fP.locate=function(t,e){return e.isEmpty()?OS.EXTERIOR:fP.containsPoint(t,e)?OS.INTERIOR:OS.EXTERIOR};var pP=function(){this._edgeMap=new YB,this._edgeList=null,this._ptInAreaLocation=[OS.NONE,OS.NONE]};pP.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),r=e-1;return 0===e&&(r=this._edgeList.size()-1),this._edgeList.get(r)},pP.prototype.propagateSideLabels=function(t){for(var e=OS.NONE,r=this.iterator();r.hasNext();){var n=r.next().getLabel();n.isArea(t)&&n.getLocation(t,XI.LEFT)!==OS.NONE&&(e=n.getLocation(t,XI.LEFT))}if(e===OS.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,XI.ON)===OS.NONE&&a.setLocation(t,XI.ON,i),a.isArea(t)){var l=a.getLocation(t,XI.LEFT),u=a.getLocation(t,XI.RIGHT);if(u!==OS.NONE){if(u!==i)throw new tT("side location conflict",s.getCoordinate());l===OS.NONE&&aB.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=l}else aB.isTrue(a.getLocation(t,XI.LEFT)===OS.NONE,"found single null side"),a.setLocation(t,XI.RIGHT,i),a.setLocation(t,XI.LEFT,i)}}},pP.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},pP.prototype.print=function(t){YS.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)},pP.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},pP.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var r=e.size()-1,n=e.get(r).getLabel().getLocation(t,XI.LEFT);aB.isTrue(n!==OS.NONE,"Found unlabelled area edge");for(var i=n,o=this.iterator();o.hasNext();){var s=o.next().getLabel();aB.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,XI.LEFT),l=s.getLocation(t,XI.RIGHT);if(a===l)return!1;if(l!==i)return!1;i=a}return!0},pP.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},pP.prototype.iterator=function(){return this.getEdges().iterator()},pP.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new FB(this._edgeMap.values())),this._edgeList},pP.prototype.getLocation=function(t,e,r){return this._ptInAreaLocation[t]===OS.NONE&&(this._ptInAreaLocation[t]=fP.locate(e,r[t].getGeometry())),this._ptInAreaLocation[t]},pP.prototype.toString=function(){var t=new DS;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var r=e.next();t.append(r),t.append("\n")}return t.toString()},pP.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)},pP.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],r=this.iterator();r.hasNext();)for(var n=r.next().getLabel(),i=0;i<2;i++)n.isLine(i)&&n.getLocation(i)===OS.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),l=0;l<2;l++)if(a.isAnyNull(l)){var u=OS.NONE;if(e[l])u=OS.EXTERIOR;else{var h=s.getCoordinate();u=this.getLocation(l,h,t)}a.setAllLocationsIfNull(l,u)}},pP.prototype.getDegree=function(){return this._edgeMap.size()},pP.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},pP.prototype.interfaces_=function(){return[]},pP.prototype.getClass=function(){return pP};var dP=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){var t=this;this.getResultAreaEdges();for(var e=null,r=null,n=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var o=t._resultAreaEdgeList.get(i),s=o.getSym();if(o.getLabel().isArea())switch(null===e&&o.isInResult()&&(e=o),n){case t._SCANNING_FOR_INCOMING:if(!s.isInResult())continue;r=s,n=t._LINKING_TO_OUTGOING;break;case t._LINKING_TO_OUTGOING:if(!o.isInResult())continue;r.setNext(o),n=t._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===e)throw new tT("no outgoing dirEdge found",this.getCoordinate());aB.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),r.setNext(e)}},e.prototype.insert=function(t){var e=t;this.insertEdgeEnd(e,e)},e.prototype.getRightmostEdge=function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var r=t.get(0);if(1===e)return r;var n=t.get(e-1),i=r.getQuadrant(),o=n.getQuadrant();return cT.isNorthern(i)&&cT.isNorthern(o)?r:cT.isNorthern(i)||cT.isNorthern(o)?0!==r.getDy()?r:0!==n.getDy()?n:(aB.shouldNeverReachHere("found two horizontal edges incident on node"),null):n},e.prototype.print=function(t){YS.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var r=e.next();t.print("out "),r.print(t),t.println(),t.print("in "),r.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new FB;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},e.prototype.updateLabelling=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next().getLabel();r.setAllLocationsIfNull(0,t.getLocation(0)),r.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,r=this._edgeList.size()-1;r>=0;r--){var n=this._edgeList.get(r),i=n.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=n}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),r=t.getDepth(XI.LEFT),n=t.getDepth(XI.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),r);if(this.computeDepths(0,e,i)!==n)throw new tT("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 l=this._edgeList.get(a);l.setEdgeDepths(XI.RIGHT,s),s=l.getDepth(XI.LEFT)}return s}},e.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},e.prototype.linkMinimalDirectedEdges=function(t){for(var e=this,r=null,n=null,i=this._SCANNING_FOR_INCOMING,o=this._resultAreaEdgeList.size()-1;o>=0;o--){var s=e._resultAreaEdgeList.get(o),a=s.getSym();switch(null===r&&s.getEdgeRing()===t&&(r=s),i){case e._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;n=a,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;n.setNextMin(s),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(aB.isTrue(null!==r,"found null for first outgoing dirEdge"),aB.isTrue(r.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(r))},e.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();)e.next().isInResult()&&t++;return t}if(1===arguments.length){for(var r=arguments[0],n=0,i=this.iterator();i.hasNext();)i.next().getEdgeRing()===r&&n++;return n}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=OS.NONE,e=this.iterator();e.hasNext();){var r=e.next(),n=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){t=OS.INTERIOR;break}if(n.isInResult()){t=OS.EXTERIOR;break}}}if(t===OS.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===OS.INTERIOR):(s.isInResult()&&(i=OS.EXTERIOR),a.isInResult()&&(i=OS.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new iT(OS.NONE);for(var r=this.iterator();r.hasNext();)for(var n=r.next().getEdge().getLabel(),i=0;i<2;i++){var o=n.getLocation(i);o!==OS.INTERIOR&&o!==OS.BOUNDARY||this._label.setLocation(i,OS.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(pP),gP=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 uT(t,new dP)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(dT),yP=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};yP.prototype.compareTo=function(t){var e=t;return yP.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},yP.prototype.interfaces_=function(){return[SS]},yP.prototype.getClass=function(){return yP},yP.orientation=function(t){return 1===OB.increasingDirection(t)},yP.compareOriented=function(t,e,r,n){for(var i=e?1:-1,o=n?1:-1,s=e?t.length:-1,a=n?r.length:-1,l=e?0:t.length-1,u=n?0:r.length-1;;){var h=t[l].compareTo(r[u]);if(0!==h)return h;var c=(l+=i)===s,A=(u+=o)===a;if(c&&!A)return-1;if(!c&&A)return 1;if(c&&A)return 0}};var mP=function(){this._edges=new FB,this._ocaMap=new YB};mP.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var r=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var n=r.getCoordinates(),i=0;i<n.length;i++)i>0&&t.print(","),t.print(n[i].x+" "+n[i].y);t.println(")")}t.print(") ")},mP.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},mP.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},mP.prototype.iterator=function(){return this._edges.iterator()},mP.prototype.getEdges=function(){return this._edges},mP.prototype.get=function(t){return this._edges.get(t)},mP.prototype.findEqualEdge=function(t){var e=new yP(t.getCoordinates());return this._ocaMap.get(e)},mP.prototype.add=function(t){this._edges.add(t);var e=new yP(t.getCoordinates());this._ocaMap.put(e,t)},mP.prototype.interfaces_=function(){return[]},mP.prototype.getClass=function(){return mP};var vP=function(){};vP.prototype.processIntersections=function(t,e,r,n){},vP.prototype.isDone=function(){},vP.prototype.interfaces_=function(){return[]},vP.prototype.getClass=function(){return vP};var _P=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};_P.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(_P.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},_P.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},_P.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},_P.prototype.getLineIntersector=function(){return this._li},_P.prototype.hasProperIntersection=function(){return this._hasProper},_P.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},_P.prototype.hasIntersection=function(){return this._hasIntersection},_P.prototype.isDone=function(){return!1},_P.prototype.hasInteriorIntersection=function(){return this._hasInterior},_P.prototype.interfaces_=function(){return[vP]},_P.prototype.getClass=function(){return _P},_P.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var wP=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],r=arguments[2];this.coord=new PS(t),this.segmentIndex=e,this.dist=r};wP.prototype.getSegmentIndex=function(){return this.segmentIndex},wP.prototype.getCoordinate=function(){return this.coord},wP.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},wP.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},wP.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},wP.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},wP.prototype.getDistance=function(){return this.dist},wP.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},wP.prototype.interfaces_=function(){return[SS]},wP.prototype.getClass=function(){return wP};var bP=function(){this._nodeMap=new YB,this.edge=null;var t=arguments[0];this.edge=t};bP.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},bP.prototype.iterator=function(){return this._nodeMap.values().iterator()},bP.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},bP.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)},bP.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new PS(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 BP(o,new iT(this.edge._label))},bP.prototype.add=function(t,e,r){var n=new wP(t,e,r),i=this._nodeMap.get(n);return null!==i?i:(this._nodeMap.put(n,n),n)},bP.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1},bP.prototype.interfaces_=function(){return[]},bP.prototype.getClass=function(){return bP};var xP=function(){};xP.prototype.getChainStartIndices=function(t){var e=0,r=new FB;r.add(new QS(e));do{var n=this.findChainEnd(t,e);r.add(new QS(n)),e=n}while(e<t.length-1);return xP.toIntArray(r)},xP.prototype.findChainEnd=function(t,e){for(var r=cT.quadrant(t[e],t[e+1]),n=e+1;n<t.length&&cT.quadrant(t[n-1],t[n])===r;)n++;return n-1},xP.prototype.interfaces_=function(){return[]},xP.prototype.getClass=function(){return xP},xP.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var CP=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new JS,this.env2=new JS;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new xP;this.startIndex=e.getChainStartIndices(this.pts)};CP.prototype.getCoordinates=function(){return this.pts},CP.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e>r?e:r},CP.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e<r?e:r},CP.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[r],e.startIndex[r+1],n)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],l=arguments[4],u=arguments[5],h=this.pts[i],c=this.pts[o],A=s.pts[a],f=s.pts[l];if(o-i==1&&l-a==1)return u.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(h,c),this.env2.init(A,f),!this.env1.intersects(this.env2))return null;var p=Math.trunc((i+o)/2),d=Math.trunc((a+l)/2);i<p&&(a<d&&this.computeIntersectsForChain(i,p,s,a,d,u),d<l&&this.computeIntersectsForChain(i,p,s,d,l,u)),p<o&&(a<d&&this.computeIntersectsForChain(p,o,s,a,d,u),d<l&&this.computeIntersectsForChain(p,o,s,d,l,u))}},CP.prototype.getStartIndexes=function(){return this.startIndex},CP.prototype.computeIntersects=function(t,e){for(var r=0;r<this.startIndex.length-1;r++)for(var n=0;n<t.startIndex.length-1;n++)this.computeIntersectsForChain(r,t,n,e)},CP.prototype.interfaces_=function(){return[]},CP.prototype.getClass=function(){return CP};var EP=function t(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var e=0;e<2;e++)for(var r=0;r<3;r++)this._depth[e][r]=t.NULL_VALUE},SP={NULL_VALUE:{configurable:!0}};EP.prototype.getDepth=function(t,e){return this._depth[t][e]},EP.prototype.setDepth=function(t,e,r){this._depth[t][e]=r},EP.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]!==EP.NULL_VALUE)return!1;return!0}if(1===arguments.length){var r=arguments[0];return this._depth[r][1]===EP.NULL_VALUE}if(2===arguments.length){var n=arguments[0],i=arguments[1];return this._depth[n][i]===EP.NULL_VALUE}},EP.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var r=t._depth[e][1];t._depth[e][2]<r&&(r=t._depth[e][2]),r<0&&(r=0);for(var n=1;n<3;n++){var i=0;t._depth[e][n]>r&&(i=1),t._depth[e][n]=i}}},EP.prototype.getDelta=function(t){return this._depth[t][XI.RIGHT]-this._depth[t][XI.LEFT]},EP.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?OS.EXTERIOR:OS.INTERIOR},EP.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},EP.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],r=0;r<2;r++)for(var n=1;n<3;n++){var i=e.getLocation(r,n);i!==OS.EXTERIOR&&i!==OS.INTERIOR||(t.isNull(r,n)?t._depth[r][n]=EP.depthAtLocation(i):t._depth[r][n]+=EP.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],s=arguments[1];arguments[2]===OS.INTERIOR&&this._depth[o][s]++}},EP.prototype.interfaces_=function(){return[]},EP.prototype.getClass=function(){return EP},EP.depthAtLocation=function(t){return t===OS.EXTERIOR?0:t===OS.INTERIOR?1:EP.NULL_VALUE},SP.NULL_VALUE.get=function(){return-1},Object.defineProperties(EP,SP);var BP=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new bP(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new EP,this._depthDelta=0,1===arguments.length){var r=arguments[0];e.call(this,r,null)}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.pts=n,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new e(t,iT.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var r=t;if(this.pts.length!==r.pts.length)return!1;for(var n=!0,i=!0,o=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(r.pts[s])||(n=!1),this.pts[s].equals2D(r.pts[--o])||(i=!1),!n&&!i)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new CP(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new JS;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,r,n){var i=new PS(t.getIntersection(n)),o=e,s=t.getEdgeDistance(r,n),a=o+1;if(a<this.pts.length){var l=this.pts[a];i.equals2D(l)&&(o=a,s=0)}this.eiList.add(i,o,s)},e.prototype.toString=function(){var t=new DS;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments[0],r=arguments[1];r.setAtLeastIfValid(e.getLocation(0,XI.ON),e.getLocation(1,XI.ON),1),e.isArea()&&(r.setAtLeastIfValid(e.getLocation(0,XI.LEFT),e.getLocation(1,XI.LEFT),2),r.setAtLeastIfValid(e.getLocation(0,XI.RIGHT),e.getLocation(1,XI.RIGHT),2))},e}(lT),IP=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new mP,this._bufParams=t||null};IP.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},IP.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new iT(t.getLabel())).flip(),r.merge(n);var i=IP.depthDelta(n),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(IP.depthDelta(t.getLabel()))},IP.prototype.buildSubgraphs=function(t,e){for(var r=new FB,n=t.iterator();n.hasNext();){var i=n.next(),o=i.getRightmostCoordinate(),s=new sP(r).getDepth(o);i.computeDepth(s),i.findResultEdges(),r.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},IP.prototype.createSubgraphs=function(t){for(var e=new FB,r=t.getNodes().iterator();r.hasNext();){var n=r.next();if(!n.isVisited()){var i=new rT;i.create(n),e.add(i)}}return ET.sort(e,ET.reverseOrder()),e},IP.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},IP.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new qT,r=new hB;return r.setPrecisionModel(t),e.setSegmentIntersector(new _P(r)),e},IP.prototype.buffer=function(t,e){var r=this._workingPrecisionModel;null===r&&(r=t.getPrecisionModel()),this._geomFact=t.getFactory();var n=new oP(r,this._bufParams),i=new hP(t,e,n).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,r),this._graph=new gT(new gP),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new yT(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},IP.prototype.computeNodedEdges=function(t,e){var r=this.getNoder(e);r.computeNodes(t);for(var n=r.getNodedSubstrings().iterator();n.hasNext();){var i=n.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=i.getData(),a=new BP(i.getCoordinates(),new iT(s));this.insertUniqueEdge(a)}}},IP.prototype.setNoder=function(t){this._workingNoder=t},IP.prototype.interfaces_=function(){return[]},IP.prototype.getClass=function(){return IP},IP.depthDelta=function(t){var e=t.getLocation(0,XI.LEFT),r=t.getLocation(0,XI.RIGHT);return e===OS.INTERIOR&&r===OS.EXTERIOR?1:e===OS.EXTERIOR&&r===OS.INTERIOR?-1:0},IP.convertSegStrings=function(t){for(var e=new GI,r=new FB;t.hasNext();){var n=t.next(),i=e.createLineString(n.getCoordinates());r.add(i)}return e.buildGeometry(r)};var TP=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=arguments[3];this._noder=r,this._scaleFactor=n,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};TP.prototype.rescale=function(){var t=this;if(NS(arguments[0],SB))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.rescale(r.getCoordinates())}else if(arguments[0]instanceof Array){for(var n=arguments[0],i=0;i<n.length;i++)n[i].x=n[i].x/t._scaleFactor+t._offsetX,n[i].y=n[i].y/t._scaleFactor+t._offsetY;2===n.length&&n[0].equals2D(n[1])&&YS.out.println(n)}},TP.prototype.scale=function(){var t=this;if(NS(arguments[0],SB)){for(var e=arguments[0],r=new FB,n=e.iterator();n.hasNext();){var i=n.next();r.add(new DT(t.scale(i.getCoordinates()),i.getData()))}return r}if(arguments[0]instanceof Array){for(var o=arguments[0],s=new Array(o.length).fill(null),a=0;a<o.length;a++)s[a]=new PS(Math.round((o[a].x-t._offsetX)*t._scaleFactor),Math.round((o[a].y-t._offsetY)*t._scaleFactor),o[a].z);return OB.removeRepeatedPoints(s)}},TP.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},TP.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},TP.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},TP.prototype.interfaces_=function(){return[VT]},TP.prototype.getClass=function(){return TP};var PP=function(){this._li=new hB,this._segStrings=null;var t=arguments[0];this._segStrings=t},FP={fact:{configurable:!0}};PP.prototype.checkEndPtVertexIntersections=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();){var r=e.next().getCoordinates();t.checkEndPtVertexIntersections(r[0],t._segStrings),t.checkEndPtVertexIntersections(r[r.length-1],t._segStrings)}else if(2===arguments.length)for(var n=arguments[0],i=arguments[1].iterator();i.hasNext();)for(var o=i.next().getCoordinates(),s=1;s<o.length-1;s++)if(o[s].equals(n))throw new oB("found endpt/interior pt intersection at index "+s+" :pt "+n)},PP.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),r=this._segStrings.iterator();r.hasNext();){var n=r.next();this.checkInteriorIntersections(e,n)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=i.getCoordinates(),a=o.getCoordinates(),l=0;l<s.length-1;l++)for(var u=0;u<a.length-1;u++)this.checkInteriorIntersections(i,l,o,u);else if(4===arguments.length){var h=arguments[0],c=arguments[1],A=arguments[2],f=arguments[3];if(h===A&&c===f)return null;var p=h.getCoordinates()[c],d=h.getCoordinates()[c+1],g=A.getCoordinates()[f],y=A.getCoordinates()[f+1];if(this._li.computeIntersection(p,d,g,y),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,p,d)||this.hasInteriorIntersection(this._li,g,y)))throw new oB("found non-noded intersection at "+p+"-"+d+" and "+g+"-"+y)}},PP.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},PP.prototype.checkCollapses=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1===arguments.length)for(var r=arguments[0].getCoordinates(),n=0;n<r.length-2;n++)this.checkCollapse(r[n],r[n+1],r[n+2])},PP.prototype.hasInteriorIntersection=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++){var i=t.getIntersection(n);if(!i.equals(e)&&!i.equals(r))return!0}return!1},PP.prototype.checkCollapse=function(t,e,r){if(t.equals(r))throw new oB("found non-noded collapse at "+PP.fact.createLineString([t,e,r]))},PP.prototype.interfaces_=function(){return[]},PP.prototype.getClass=function(){return PP},FP.fact.get=function(){return new GI},Object.defineProperties(PP,FP);var LP=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],r=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=r,e<=0)throw new xS("Scale factor must be non-zero");1!==e&&(this._pt=new PS(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new PS,this._p1Scaled=new PS),this.initCorners(this._pt)},MP={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};LP.prototype.intersectsScaled=function(t,e){var r=Math.min(t.x,e.x),n=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<r||this._minx>n||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return aB.isTrue(!(s&&a),"Found bad envelope test"),a},LP.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 PS(this._maxx,this._maxy),this._corner[1]=new PS(this._minx,this._maxy),this._corner[2]=new PS(this._minx,this._miny),this._corner[3]=new PS(this._maxx,this._miny)},LP.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))},LP.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},LP.prototype.getCoordinate=function(){return this._originalPt},LP.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},LP.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=LP.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new JS(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},LP.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()))))},LP.prototype.intersectsToleranceSquare=function(t,e){var r=!1,n=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper()||r&&n||t.equals(this._pt)||e.equals(this._pt)))))},LP.prototype.addSnappedNode=function(t,e){var r=t.getCoordinate(e),n=t.getCoordinate(e+1);return!!this.intersects(r,n)&&(t.addIntersection(this.getCoordinate(),e),!0)},LP.prototype.interfaces_=function(){return[]},LP.prototype.getClass=function(){return LP},MP.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(LP,MP);var OP=function(){this.tempEnv1=new JS,this.selectedSegment=new QT};OP.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)}},OP.prototype.interfaces_=function(){return[]},OP.prototype.getClass=function(){return OP};var kP=function(){this._index=null;var t=arguments[0];this._index=t},NP={HotPixelSnapAction:{configurable:!0}};kP.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=e.getSafeEnvelope(),o=new RP(e,r,n);return this._index.query(i,{interfaces_:function(){return[wT]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},kP.prototype.interfaces_=function(){return[]},kP.prototype.getClass=function(){return kP},NP.HotPixelSnapAction.get=function(){return RP},Object.defineProperties(kP,NP);var RP=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._hotPixel=e,this._parentEdge=r,this._hotPixelVertexIndex=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments[1],r=arguments[0].getContext();if(null!==this._parentEdge&&r===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(OP),UP=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new FB};UP.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];if(this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var l=0;l<this._li.getIntersectionNum();l++)this._interiorIntersections.add(this._li.getIntersection(l));t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1)}},UP.prototype.isDone=function(){return!1},UP.prototype.getInteriorIntersections=function(){return this._interiorIntersections},UP.prototype.interfaces_=function(){return[vP]},UP.prototype.getClass=function(){return UP};var DP=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 hB,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};DP.prototype.checkCorrectness=function(t){var e=DT.getNodedSubstrings(t),r=new PP(e);try{r.checkValid()}catch(n){if(!(n instanceof WS))throw n;n.printStackTrace()}},DP.prototype.getNodedSubstrings=function(){return DT.getNodedSubstrings(this._nodedSegStrings)},DP.prototype.snapRound=function(t,e){var r=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(r),this.computeVertexSnaps(t)},DP.prototype.findInteriorIntersections=function(t,e){var r=new UP(e);return this._noder.setSegmentIntersector(r),this._noder.computeNodes(t),r.getInteriorIntersections()},DP.prototype.computeVertexSnaps=function(){var t=this;if(NS(arguments[0],SB))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.computeVertexSnaps(r)}else if(arguments[0]instanceof DT)for(var n=arguments[0],i=n.getCoordinates(),o=0;o<i.length;o++){var s=new LP(i[o],t._scaleFactor,t._li);t._pointSnapper.snap(s,n,o)&&n.addIntersection(i[o],o)}},DP.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new qT,this._pointSnapper=new kP(this._noder.getIndex()),this.snapRound(t,this._li)},DP.prototype.computeIntersectionSnaps=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next(),i=new LP(n,e._scaleFactor,e._li);e._pointSnapper.snap(i)}},DP.prototype.interfaces_=function(){return[VT]},DP.prototype.getClass=function(){return DP};var QP=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new XT,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._argGeom=e,this._bufParams=r}},GP={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};QP.prototype.bufferFixedPrecision=function(t){var e=new TP(new DP(new RI(1)),t.getScale()),r=new IP(this._bufParams);r.setWorkingPrecisionModel(t),r.setNoder(e),this._resultGeometry=r.buffer(this._argGeom,this._distance)},QP.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=QP.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(o){if(!(o instanceof tT))throw o;t._saveException=o}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var r=arguments[0],n=QP.precisionScaleFactor(this._argGeom,this._distance,r),i=new RI(n);this.bufferFixedPrecision(i)}},QP.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===RI.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},QP.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},QP.prototype.bufferOriginalPrecision=function(){try{var t=new IP(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(!(e instanceof oB))throw e;this._saveException=e}},QP.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},QP.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},QP.prototype.interfaces_=function(){return[]},QP.prototype.getClass=function(){return QP},QP.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new QP(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof gB&&"number"==typeof arguments[1]){var e=arguments[1],r=arguments[2],n=new QP(arguments[0]);return n.setQuadrantSegments(r),n.getResultGeometry(e)}if(arguments[2]instanceof XT&&arguments[0]instanceof gB&&"number"==typeof arguments[1]){var i=arguments[1];return new QP(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],s=arguments[2],a=arguments[3],l=new QP(arguments[0]);return l.setQuadrantSegments(s),l.setEndCapStyle(a),l.getResultGeometry(o)}},QP.precisionScaleFactor=function(t,e,r){var n=t.getEnvelopeInternal(),i=RS.max(Math.abs(n.getMaxX()),Math.abs(n.getMaxY()),Math.abs(n.getMinX()),Math.abs(n.getMinY()))+2*(e>0?e:0),o=r-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},GP.CAP_ROUND.get=function(){return XT.CAP_ROUND},GP.CAP_BUTT.get=function(){return XT.CAP_FLAT},GP.CAP_FLAT.get=function(){return XT.CAP_FLAT},GP.CAP_SQUARE.get=function(){return XT.CAP_SQUARE},GP.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(QP,GP);var jP=function(){this._pt=[new PS,new PS],this._distance=CS.NaN,this._isNull=!0};jP.prototype.getCoordinates=function(){return this._pt},jP.prototype.getCoordinate=function(t){return this._pt[t]},jP.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},jP.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},jP.prototype.getDistance=function(){return this._distance},jP.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},jP.prototype.interfaces_=function(){return[]},jP.prototype.getClass=function(){return jP};var HP=function(){};HP.prototype.interfaces_=function(){return[]},HP.prototype.getClass=function(){return HP},HP.computeDistance=function(){if(arguments[2]instanceof jP&&arguments[0]instanceof vI&&arguments[1]instanceof PS)for(var t=arguments[1],e=arguments[2],r=arguments[0].getCoordinates(),n=new QT,i=0;i<r.length-1;i++){n.setCoordinates(r[i],r[i+1]);var o=n.closestPoint(t);e.setMinimum(o,t)}else if(arguments[2]instanceof jP&&arguments[0]instanceof xI&&arguments[1]instanceof PS){var s=arguments[0],a=arguments[1],l=arguments[2];HP.computeDistance(s.getExteriorRing(),a,l);for(var u=0;u<s.getNumInteriorRing();u++)HP.computeDistance(s.getInteriorRingN(u),a,l)}else if(arguments[2]instanceof jP&&arguments[0]instanceof gB&&arguments[1]instanceof PS){var h=arguments[0],c=arguments[1],A=arguments[2];if(h instanceof vI)HP.computeDistance(h,c,A);else if(h instanceof xI)HP.computeDistance(h,c,A);else if(h instanceof sI)for(var f=h,p=0;p<f.getNumGeometries();p++){var d=f.getGeometryN(p);HP.computeDistance(d,c,A)}else A.setMinimum(h.getCoordinate(),c)}else if(arguments[2]instanceof jP&&arguments[0]instanceof QT&&arguments[1]instanceof PS){var g=arguments[1],y=arguments[2],m=arguments[0].closestPoint(g);y.setMinimum(m,g)}};var zP=function(t){this._maxPtDist=new jP,this._inputGeom=t||null},VP={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};zP.prototype.computeMaxMidpointDistance=function(t){var e=new qP(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},zP.prototype.computeMaxVertexDistance=function(t){var e=new KP(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},zP.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},zP.prototype.getDistancePoints=function(){return this._maxPtDist},zP.prototype.interfaces_=function(){return[]},zP.prototype.getClass=function(){return zP},VP.MaxPointDistanceFilter.get=function(){return KP},VP.MaxMidpointDistanceFilter.get=function(){return qP},Object.defineProperties(zP,VP);var KP=function(t){this._maxPtDist=new jP,this._minPtDist=new jP,this._geom=t||null};KP.prototype.filter=function(t){this._minPtDist.initialize(),HP.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},KP.prototype.getMaxPointDistance=function(){return this._maxPtDist},KP.prototype.interfaces_=function(){return[vB]},KP.prototype.getClass=function(){return KP};var qP=function(t){this._maxPtDist=new jP,this._minPtDist=new jP,this._geom=t||null};qP.prototype.filter=function(t,e){if(0===e)return null;var r=t.getCoordinate(e-1),n=t.getCoordinate(e),i=new PS((r.x+n.x)/2,(r.y+n.y)/2);this._minPtDist.initialize(),HP.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},qP.prototype.isDone=function(){return!1},qP.prototype.isGeometryChanged=function(){return!1},qP.prototype.getMaxPointDistance=function(){return this._maxPtDist},qP.prototype.interfaces_=function(){return[oI]},qP.prototype.getClass=function(){return qP};var WP=function(t){this._comps=t||null};WP.prototype.filter=function(t){t instanceof xI&&this._comps.add(t)},WP.prototype.interfaces_=function(){return[iI]},WP.prototype.getClass=function(){return WP},WP.getPolygons=function(){if(1===arguments.length){var t=arguments[0];return WP.getPolygons(t,new FB)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e instanceof xI?r.add(e):e instanceof sI&&e.apply(new WP(r)),r}};var XP=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._lines=e,this._isForcedToLineString=r}};XP.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof EI){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof vI&&this._lines.add(t)},XP.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},XP.prototype.interfaces_=function(){return[dB]},XP.prototype.getClass=function(){return XP},XP.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(XP.getLines(t))}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().buildGeometry(XP.getLines(e,r))}},XP.getLines=function(){if(1===arguments.length){var t=arguments[0];return XP.getLines(t,!1)}if(2===arguments.length){if(NS(arguments[0],SB)&&NS(arguments[1],SB)){for(var e=arguments[1],r=arguments[0].iterator();r.hasNext();){var n=r.next();XP.getLines(n,e)}return e}if(arguments[0]instanceof gB&&"boolean"==typeof arguments[1]){var i=arguments[0],o=arguments[1],s=new FB;return i.apply(new XP(s,o)),s}if(arguments[0]instanceof gB&&NS(arguments[1],SB)){var a=arguments[0],l=arguments[1];return a instanceof vI?l.add(a):a.apply(new XP(l)),l}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&NS(arguments[0],SB)&&NS(arguments[1],SB)){for(var u=arguments[1],h=arguments[2],c=arguments[0].iterator();c.hasNext();){var A=c.next();XP.getLines(A,u,h)}return u}if("boolean"==typeof arguments[2]&&arguments[0]instanceof gB&&NS(arguments[1],SB)){var f=arguments[1],p=arguments[2];return arguments[0].apply(new XP(f,p)),f}}};var YP=function(){if(this._boundaryRule=_B.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 xS("Rule must be non-null");this._boundaryRule=t}};YP.prototype.locateInternal=function(){if(arguments[0]instanceof PS&&arguments[1]instanceof xI){var t=arguments[0],e=arguments[1];if(e.isEmpty())return OS.EXTERIOR;var r=e.getExteriorRing(),n=this.locateInPolygonRing(t,r);if(n===OS.EXTERIOR)return OS.EXTERIOR;if(n===OS.BOUNDARY)return OS.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===OS.INTERIOR)return OS.EXTERIOR;if(s===OS.BOUNDARY)return OS.BOUNDARY}return OS.INTERIOR}if(arguments[0]instanceof PS&&arguments[1]instanceof vI){var a=arguments[0],l=arguments[1];if(!l.getEnvelopeInternal().intersects(a))return OS.EXTERIOR;var u=l.getCoordinates();return l.isClosed()||!a.equals(u[0])&&!a.equals(u[u.length-1])?fB.isOnLine(a,u)?OS.INTERIOR:OS.EXTERIOR:OS.BOUNDARY}if(arguments[0]instanceof PS&&arguments[1]instanceof wI){var h=arguments[0];return arguments[1].getCoordinate().equals2D(h)?OS.INTERIOR:OS.EXTERIOR}},YP.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?fB.locatePointInRing(t,e.getCoordinates()):OS.EXTERIOR},YP.prototype.intersects=function(t,e){return this.locate(t,e)!==OS.EXTERIOR},YP.prototype.updateLocationInfo=function(t){t===OS.INTERIOR&&(this._isIn=!0),t===OS.BOUNDARY&&this._numBoundaries++},YP.prototype.computeLocation=function(t,e){var r=this;if(e instanceof wI&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof vI)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof xI)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof aI)for(var n=e,i=0;i<n.getNumGeometries();i++){var o=n.getGeometryN(i);r.updateLocationInfo(r.locateInternal(t,o))}else if(e instanceof SI)for(var s=e,a=0;a<s.getNumGeometries();a++){var l=s.getGeometryN(a);r.updateLocationInfo(r.locateInternal(t,l))}else if(e instanceof sI)for(var u=new AP(e);u.hasNext();){var h=u.next();h!==e&&r.computeLocation(t,h)}},YP.prototype.locate=function(t,e){return e.isEmpty()?OS.EXTERIOR:e instanceof vI||e instanceof xI?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?OS.BOUNDARY:this._numBoundaries>0||this._isIn?OS.INTERIOR:OS.EXTERIOR)},YP.prototype.interfaces_=function(){return[]},YP.prototype.getClass=function(){return YP};var ZP=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length)t.call(this,arguments[0],t.INSIDE_AREA,arguments[1]);else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._component=e,this._segIndex=r,this._pt=n}},JP={INSIDE_AREA:{configurable:!0}};ZP.prototype.isInsideArea=function(){return this._segIndex===ZP.INSIDE_AREA},ZP.prototype.getCoordinate=function(){return this._pt},ZP.prototype.getGeometryComponent=function(){return this._component},ZP.prototype.getSegmentIndex=function(){return this._segIndex},ZP.prototype.interfaces_=function(){return[]},ZP.prototype.getClass=function(){return ZP},JP.INSIDE_AREA.get=function(){return-1},Object.defineProperties(ZP,JP);var $P=function(t){this._pts=t||null};$P.prototype.filter=function(t){t instanceof wI&&this._pts.add(t)},$P.prototype.interfaces_=function(){return[iI]},$P.prototype.getClass=function(){return $P},$P.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof wI?ET.singletonList(t):$P.getPoints(t,new FB)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e instanceof wI?r.add(e):e instanceof sI&&e.apply(new $P(r)),r}};var tF=function(){this._locations=null;var t=arguments[0];this._locations=t};tF.prototype.filter=function(t){(t instanceof wI||t instanceof vI||t instanceof xI)&&this._locations.add(new ZP(t,0,t.getCoordinate()))},tF.prototype.interfaces_=function(){return[iI]},tF.prototype.getClass=function(){return tF},tF.getLocations=function(t){var e=new FB;return t.apply(new tF(e)),e};var eF=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new YP,this._minDistanceLocation=null,this._minDistance=CS.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=n,this._terminateDistance=i}};eF.prototype.computeContainmentDistance=function(){var t=this;if(0===arguments.length){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1],i=1-r,o=WP.getPolygons(this._geom[r]);if(o.size()>0){var s=tF.getLocations(this._geom[i]);if(this.computeContainmentDistance(s,o,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=n[0],this._minDistanceLocation[r]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&NS(arguments[0],TB)&&NS(arguments[1],TB)){for(var a=arguments[0],l=arguments[1],u=arguments[2],h=0;h<a.size();h++)for(var c=a.get(h),A=0;A<l.size();A++)if(t.computeContainmentDistance(c,l.get(A),u),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof ZP&&arguments[1]instanceof xI){var f=arguments[0],p=arguments[1],d=arguments[2],g=f.getCoordinate();if(OS.EXTERIOR!==this._ptLocator.locate(g,p))return this._minDistance=0,d[0]=f,d[1]=new ZP(p,g),null}},eF.prototype.computeMinDistanceLinesPoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},eF.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=XP.getLines(this._geom[0]),r=XP.getLines(this._geom[1]),n=$P.getPoints(this._geom[0]),i=$P.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,r,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(r,n,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(n,i,t),void this.updateMinDistance(t,!1))))},eF.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},eF.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])},eF.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},eF.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 vI&&arguments[1]instanceof wI){var e=arguments[0],r=arguments[1],n=arguments[2];if(e.getEnvelopeInternal().distance(r.getEnvelopeInternal())>this._minDistance)return null;for(var i=e.getCoordinates(),o=r.getCoordinate(),s=0;s<i.length-1;s++){var a=fB.distancePointLine(o,i[s],i[s+1]);if(a<t._minDistance){t._minDistance=a;var l=new QT(i[s],i[s+1]).closestPoint(o);n[0]=new ZP(e,s,l),n[1]=new ZP(r,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof vI&&arguments[1]instanceof vI){var u=arguments[0],h=arguments[1],c=arguments[2];if(u.getEnvelopeInternal().distance(h.getEnvelopeInternal())>this._minDistance)return null;for(var A=u.getCoordinates(),f=h.getCoordinates(),p=0;p<A.length-1;p++)for(var d=0;d<f.length-1;d++){var g=fB.distanceLineLine(A[p],A[p+1],f[d],f[d+1]);if(g<t._minDistance){t._minDistance=g;var y=new QT(A[p],A[p+1]),m=new QT(f[d],f[d+1]),v=y.closestPoints(m);c[0]=new ZP(u,p,v[0]),c[1]=new ZP(h,d,v[1])}if(t._minDistance<=t._terminateDistance)return null}}},eF.prototype.computeMinDistancePoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s),l=o.getCoordinate().distance(a.getCoordinate());if(l<n._minDistance&&(n._minDistance=l,r[0]=new ZP(o,0,o.getCoordinate()),r[1]=new ZP(a,0,a.getCoordinate())),n._minDistance<=n._terminateDistance)return null}},eF.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new xS("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},eF.prototype.computeMinDistanceLines=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},eF.prototype.interfaces_=function(){return[]},eF.prototype.getClass=function(){return eF},eF.distance=function(t,e){return new eF(t,e).distance()},eF.isWithinDistance=function(t,e,r){return new eF(t,e,r).distance()<=r},eF.nearestPoints=function(t,e){return new eF(t,e).nearestPoints()};var rF=function(){this._pt=[new PS,new PS],this._distance=CS.NaN,this._isNull=!0};rF.prototype.getCoordinates=function(){return this._pt},rF.prototype.getCoordinate=function(t){return this._pt[t]},rF.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},rF.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},rF.prototype.toString=function(){return iB.toLineString(this._pt[0],this._pt[1])},rF.prototype.getDistance=function(){return this._distance},rF.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},rF.prototype.interfaces_=function(){return[]},rF.prototype.getClass=function(){return rF};var nF=function(){};nF.prototype.interfaces_=function(){return[]},nF.prototype.getClass=function(){return nF},nF.computeDistance=function(){if(arguments[2]instanceof rF&&arguments[0]instanceof vI&&arguments[1]instanceof PS)for(var t=arguments[0],e=arguments[1],r=arguments[2],n=new QT,i=t.getCoordinates(),o=0;o<i.length-1;o++){n.setCoordinates(i[o],i[o+1]);var s=n.closestPoint(e);r.setMinimum(s,e)}else if(arguments[2]instanceof rF&&arguments[0]instanceof xI&&arguments[1]instanceof PS){var a=arguments[0],l=arguments[1],u=arguments[2];nF.computeDistance(a.getExteriorRing(),l,u);for(var h=0;h<a.getNumInteriorRing();h++)nF.computeDistance(a.getInteriorRingN(h),l,u)}else if(arguments[2]instanceof rF&&arguments[0]instanceof gB&&arguments[1]instanceof PS){var c=arguments[0],A=arguments[1],f=arguments[2];if(c instanceof vI)nF.computeDistance(c,A,f);else if(c instanceof xI)nF.computeDistance(c,A,f);else if(c instanceof sI)for(var p=c,d=0;d<p.getNumGeometries();d++){var g=p.getGeometryN(d);nF.computeDistance(g,A,f)}else f.setMinimum(c.getCoordinate(),A)}else if(arguments[2]instanceof rF&&arguments[0]instanceof QT&&arguments[1]instanceof PS){var y=arguments[1],m=arguments[2],v=arguments[0].closestPoint(y);m.setMinimum(v,y)}};var iF=function(){this._g0=null,this._g1=null,this._ptDist=new rF,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},oF={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};iF.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},iF.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new xS("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},iF.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},iF.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},iF.prototype.computeOrientedDistance=function(t,e,r){var n=new sF(e);if(t.apply(n),r.setMaximum(n.getMaxPointDistance()),this._densifyFrac>0){var i=new aF(e,this._densifyFrac);t.apply(i),r.setMaximum(i.getMaxPointDistance())}},iF.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},iF.prototype.interfaces_=function(){return[]},iF.prototype.getClass=function(){return iF},iF.distance=function(){if(2===arguments.length)return new iF(arguments[0],arguments[1]).distance();if(3===arguments.length){var t=arguments[2],e=new iF(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},oF.MaxPointDistanceFilter.get=function(){return sF},oF.MaxDensifiedByFractionDistanceFilter.get=function(){return aF},Object.defineProperties(iF,oF);var sF=function(){this._maxPtDist=new rF,this._minPtDist=new rF,this._euclideanDist=new nF,this._geom=null;var t=arguments[0];this._geom=t};sF.prototype.filter=function(t){this._minPtDist.initialize(),nF.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},sF.prototype.getMaxPointDistance=function(){return this._maxPtDist},sF.prototype.interfaces_=function(){return[vB]},sF.prototype.getClass=function(){return sF};var aF=function(){this._maxPtDist=new rF,this._minPtDist=new rF,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};aF.prototype.filter=function(t,e){var r=this;if(0===e)return null;for(var n=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-n.x)/this._numSubSegs,s=(i.y-n.y)/this._numSubSegs,a=0;a<this._numSubSegs;a++){var l=n.x+a*o,u=n.y+a*s,h=new PS(l,u);r._minPtDist.initialize(),nF.computeDistance(r._geom,h,r._minPtDist),r._maxPtDist.setMaximum(r._minPtDist)}},aF.prototype.isDone=function(){return!1},aF.prototype.isGeometryChanged=function(){return!1},aF.prototype.getMaxPointDistance=function(){return this._maxPtDist},aF.prototype.interfaces_=function(){return[oI]},aF.prototype.getClass=function(){return aF};var lF=function(t,e,r){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=r||null},uF={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};lF.prototype.checkMaximumDistance=function(t,e,r){var n=new iF(e,t);if(n.setDensifyFraction(.25),this._maxDistanceFound=n.orientedDistance(),this._maxDistanceFound>r){this._isValid=!1;var i=n.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+iB.toLineString(i[0],i[1])+")"}},lF.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=lF.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(),lF.VERBOSE&&YS.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},lF.prototype.checkNegativeValid=function(){if(!(this._input instanceof xI||this._input instanceof SI||this._input instanceof sI))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)},lF.prototype.getErrorIndicator=function(){return this._errorIndicator},lF.prototype.checkMinimumDistance=function(t,e,r){var n=new eF(t,e,r);if(this._minDistanceFound=n.distance(),this._minDistanceFound<r){this._isValid=!1;var i=n.nearestPoints();this._errorLocation=n.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+iB.toLineString(i[0],i[1])+" )"}},lF.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)},lF.prototype.getErrorLocation=function(){return this._errorLocation},lF.prototype.getPolygonLines=function(t){for(var e=new FB,r=new XP(e),n=WP.getPolygons(t).iterator();n.hasNext();)n.next().apply(r);return t.getFactory().buildGeometry(e)},lF.prototype.getErrorMessage=function(){return this._errMsg},lF.prototype.interfaces_=function(){return[]},lF.prototype.getClass=function(){return lF},uF.VERBOSE.get=function(){return!1},uF.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(lF,uF);var hF=function(t,e,r){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=r||null},cF={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};hF.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},hF.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*hF.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new JS(this._input.getEnvelopeInternal());e.expandBy(this._distance);var r=new JS(this._result.getEnvelopeInternal());r.expandBy(t),r.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(r)),this.report("Envelope")},hF.prototype.checkDistance=function(){var t=new lF(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")},hF.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")},hF.prototype.checkPolygonal=function(){this._result instanceof xI||this._result instanceof SI||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},hF.prototype.getErrorIndicator=function(){return this._errorIndicator},hF.prototype.getErrorLocation=function(){return this._errorLocation},hF.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"))},hF.prototype.report=function(t){if(!hF.VERBOSE)return null;YS.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},hF.prototype.getErrorMessage=function(){return this._errorMsg},hF.prototype.interfaces_=function(){return[]},hF.prototype.getClass=function(){return hF},hF.isValidMsg=function(t,e,r){var n=new hF(t,e,r);return n.isValid()?null:n.getErrorMessage()},hF.isValid=function(t,e,r){return!!new hF(t,e,r).isValid()},cF.VERBOSE.get=function(){return!1},cF.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(hF,cF);var AF=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};AF.prototype.getCoordinates=function(){return this._pts},AF.prototype.size=function(){return this._pts.length},AF.prototype.getCoordinate=function(t){return this._pts[t]},AF.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},AF.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:NT.octant(this.getCoordinate(t),this.getCoordinate(t+1))},AF.prototype.setData=function(t){this._data=t},AF.prototype.getData=function(){return this._data},AF.prototype.toString=function(){return iB.toLineString(new LI(this._pts))},AF.prototype.interfaces_=function(){return[RT]},AF.prototype.getClass=function(){return AF};var fF=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new FB,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};fF.prototype.getInteriorIntersection=function(){return this._interiorIntersection},fF.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},fF.prototype.getIntersectionSegments=function(){return this._intSegments},fF.prototype.count=function(){return this._intersectionCount},fF.prototype.getIntersections=function(){return this._intersections},fF.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},fF.prototype.setKeepIntersections=function(t){this._keepIntersections=t},fF.prototype.processIntersections=function(t,e,r,n){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===r&&e===n)return null;if(this._isCheckEndSegmentsOnly&&!this.isEndSegment(t,e)&&!this.isEndSegment(r,n))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},fF.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},fF.prototype.hasIntersection=function(){return null!==this._interiorIntersection},fF.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},fF.prototype.interfaces_=function(){return[vP]},fF.prototype.getClass=function(){return fF},fF.createAllIntersectionsFinder=function(t){var e=new fF(t);return e.setFindAllIntersections(!0),e},fF.createAnyIntersectionFinder=function(t){return new fF(t)},fF.createIntersectionCounter=function(t){var e=new fF(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var pF=function(){this._li=new hB,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};pF.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},pF.prototype.getIntersections=function(){return this._segInt.getIntersections()},pF.prototype.isValid=function(){return this.execute(),this._isValid},pF.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},pF.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new fF(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new qT;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},pF.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new tT(this.getErrorMessage(),this._segInt.getInteriorIntersection())},pF.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+iB.toLineString(t[0],t[1])+" and "+iB.toLineString(t[2],t[3])},pF.prototype.interfaces_=function(){return[]},pF.prototype.getClass=function(){return pF},pF.computeIntersections=function(t){var e=new pF(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var dF=function t(){this._nv=null;var e=arguments[0];this._nv=new pF(t.toSegmentStrings(e))};dF.prototype.checkValid=function(){this._nv.checkValid()},dF.prototype.interfaces_=function(){return[]},dF.prototype.getClass=function(){return dF},dF.toSegmentStrings=function(t){for(var e=new FB,r=t.iterator();r.hasNext();){var n=r.next();e.add(new AF(n.getCoordinates(),n))}return e},dF.checkValid=function(t){new dF(t).checkValid()};var gF=function(t){this._mapOp=t};gF.prototype.map=function(t){for(var e=new FB,r=0;r<t.getNumGeometries();r++){var n=this._mapOp.map(t.getGeometryN(r));n.isEmpty()||e.add(n)}return t.getFactory().createGeometryCollection(GI.toGeometryArray(e))},gF.prototype.interfaces_=function(){return[]},gF.prototype.getClass=function(){return gF},gF.map=function(t,e){return new gF(e).map(t)};var yF=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new FB,this._resultLineList=new FB;var t=arguments[0],e=arguments[1],r=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=r};yF.prototype.collectLines=function(t){for(var e=this,r=this._op.getGraph().getEdgeEnds().iterator();r.hasNext();){var n=r.next();e.collectLineEdge(n,t,e._lineEdgesList),e.collectBoundaryTouchEdge(n,t,e._lineEdgesList)}},yF.prototype.labelIsolatedLine=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,r)},yF.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},yF.prototype.collectLineEdge=function(t,e,r){var n=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!ZF.isResultOfOp(n,e)||i.isCovered()||(r.add(i),t.setVisitedEdge(!0)))},yF.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();)t.next().getEdges().findCoveredLineEdges();for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var r=e.next(),n=r.getEdge();if(r.isLineEdge()&&!n.isCoveredSet()){var i=this._op.isCoveredByA(r.getCoordinate());n.setCovered(i)}}},yF.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next(),n=r.getLabel();r.isIsolated()&&(n.isNull(0)?this.labelIsolatedLine(r,0):this.labelIsolatedLine(r,1))}},yF.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var r=e.next(),n=this._geometryFactory.createLineString(r.getCoordinates());this._resultLineList.add(n),r.setInResult(!0)}},yF.prototype.collectBoundaryTouchEdge=function(t,e,r){var n=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(aB.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(ZF.isResultOfOp(n,e)&&e===ZF.INTERSECTION&&(r.add(t.getEdge()),t.setVisitedEdge(!0))))},yF.prototype.interfaces_=function(){return[]},yF.prototype.getClass=function(){return yF};var mF=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new FB;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};mF.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var r=this._geometryFactory.createPoint(e);this._resultPointList.add(r)}},mF.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var r=e.next();if(!(r.isInResult()||r.isIncidentEdgeInResult()||0!==r.getEdges().getDegree()&&t!==ZF.INTERSECTION)){var n=r.getLabel();ZF.isResultOfOp(n,t)&&this.filterCoveredNodeToPoint(r)}}},mF.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},mF.prototype.interfaces_=function(){return[]},mF.prototype.getClass=function(){return mF};var vF=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};vF.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},vF.prototype.transformPolygon=function(t,e){var r=!0,n=this.transformLinearRing(t.getExteriorRing(),t);null!==n&&n instanceof EI&&!n.isEmpty()||(r=!1);for(var i=new FB,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof EI||(r=!1),i.add(s))}if(r)return this._factory.createPolygon(n,i.toArray([]));var a=new FB;return null!==n&&a.add(n),a.addAll(i),this._factory.buildGeometry(a)},vF.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},vF.prototype.getInputGeometry=function(){return this._inputGeom},vF.prototype.transformMultiLineString=function(t,e){for(var r=new FB,n=0;n<t.getNumGeometries();n++){var i=this.transformLineString(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},vF.prototype.transformCoordinates=function(t,e){return this.copy(t)},vF.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},vF.prototype.transformMultiPoint=function(t,e){for(var r=new FB,n=0;n<t.getNumGeometries();n++){var i=this.transformPoint(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},vF.prototype.transformMultiPolygon=function(t,e){for(var r=new FB,n=0;n<t.getNumGeometries();n++){var i=this.transformPolygon(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},vF.prototype.copy=function(t){return t.copy()},vF.prototype.transformGeometryCollection=function(t,e){for(var r=new FB,n=0;n<t.getNumGeometries();n++){var i=this.transform(t.getGeometryN(n));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||r.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(GI.toGeometryArray(r)):this._factory.buildGeometry(r)},vF.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof wI)return this.transformPoint(t,null);if(t instanceof CI)return this.transformMultiPoint(t,null);if(t instanceof EI)return this.transformLinearRing(t,null);if(t instanceof vI)return this.transformLineString(t,null);if(t instanceof aI)return this.transformMultiLineString(t,null);if(t instanceof xI)return this.transformPolygon(t,null);if(t instanceof SI)return this.transformMultiPolygon(t,null);if(t instanceof sI)return this.transformGeometryCollection(t,null);throw new xS("Unknown Geometry subtype: "+t.getClass().getName())},vF.prototype.transformLinearRing=function(t,e){var r=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===r)return this._factory.createLinearRing(null);var n=r.size();return n>0&&n<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)},vF.prototype.interfaces_=function(){return[]},vF.prototype.getClass=function(){return vF};var _F=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new QT,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof vI&&"number"==typeof arguments[1]){var e=arguments[1];t.call(this,arguments[0].getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=n}};_F.prototype.snapVertices=function(t,e){for(var r=this._isClosed?t.size()-1:t.size(),n=0;n<r;n++){var i=t.get(n),o=this.findSnapForVertex(i,e);null!==o&&(t.set(n,new PS(o)),0===n&&this._isClosed&&t.set(t.size()-1,new PS(o)))}},_F.prototype.findSnapForVertex=function(t,e){for(var r=0;r<e.length;r++){if(t.equals2D(e[r]))return null;if(t.distance(e[r])<this._snapTolerance)return e[r]}return null},_F.prototype.snapTo=function(t){var e=new MB(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},_F.prototype.snapSegments=function(t,e){if(0===e.length)return null;var r=e.length;e[0].equals2D(e[e.length-1])&&(r=e.length-1);for(var n=0;n<r;n++){var i=e[n],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new PS(i),!1)}},_F.prototype.findSegmentIndexToSnap=function(t,e){for(var r=this,n=CS.MAX_VALUE,i=-1,o=0;o<e.size()-1;o++){if(r._seg.p0=e.get(o),r._seg.p1=e.get(o+1),r._seg.p0.equals2D(t)||r._seg.p1.equals2D(t)){if(r._allowSnappingToSourceVertices)continue;return-1}var s=r._seg.distance(t);s<r._snapTolerance&&s<n&&(n=s,i=o)}return i},_F.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},_F.prototype.interfaces_=function(){return[]},_F.prototype.getClass=function(){return _F},_F.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var wF=function(t){this._srcGeom=t||null},bF={SNAP_PRECISION_FACTOR:{configurable:!0}};wF.prototype.snapTo=function(t,e){var r=this.extractTargetCoordinates(t);return new xF(e,r).transform(this._srcGeom)},wF.prototype.snapToSelf=function(t,e){var r=this.extractTargetCoordinates(this._srcGeom),n=new xF(t,r,!0).transform(this._srcGeom),i=n;return e&&NS(i,bI)&&(i=n.buffer(0)),i},wF.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},wF.prototype.extractTargetCoordinates=function(t){for(var e=new $B,r=t.getCoordinates(),n=0;n<r.length;n++)e.add(r[n]);return e.toArray(new Array(0).fill(null))},wF.prototype.computeMinimumSegmentLength=function(t){for(var e=CS.MAX_VALUE,r=0;r<t.length-1;r++){var n=t[r].distance(t[r+1]);n<e&&(e=n)}return e},wF.prototype.interfaces_=function(){return[]},wF.prototype.getClass=function(){return wF},wF.snap=function(t,e,r){var n=new Array(2).fill(null),i=new wF(t);n[0]=i.snapTo(e,r);var o=new wF(e);return n[1]=o.snapTo(n[0],r),n},wF.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=wF.computeSizeBasedSnapTolerance(t),r=t.getPrecisionModel();if(r.getType()===RI.FIXED){var n=1/r.getScale()*2/1.415;n>e&&(e=n)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(wF.computeOverlaySnapTolerance(i),wF.computeOverlaySnapTolerance(o))}},wF.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*wF.SNAP_PRECISION_FACTOR},wF.snapToSelf=function(t,e,r){return new wF(t).snapToSelf(e,r)},bF.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(wF,bF);var xF=function(t){function e(e,r,n){t.call(this),this._snapTolerance=e||null,this._snapPts=r||null,this._isSelfSnap=void 0!==n&&n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var r=new _F(t,this._snapTolerance);return r.setAllowSnappingToSourceVertices(this._isSelfSnap),r.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var r=t.toCoordinateArray(),n=this.snapLine(r,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(vF),CF=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};CF.prototype.getCommon=function(){return CS.longBitsToDouble(this._commonBits)},CF.prototype.add=function(t){var e=CS.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=CF.signExpBits(this._commonBits),this._isFirst=!1,null):CF.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=CF.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=CF.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},CF.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=CS.longBitsToDouble(t),r="0000000000000000000000000000000000000000000000000000000000000000"+CS.toBinaryString(t),n=r.substring(r.length-64);return n.substring(0,1)+" "+n.substring(1,12)+"(exp) "+n.substring(12)+" [ "+e+" ]"}},CF.prototype.interfaces_=function(){return[]},CF.prototype.getClass=function(){return CF},CF.getBit=function(t,e){return 0!=(t&1<<e)?1:0},CF.signExpBits=function(t){return t>>52},CF.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},CF.numCommonMostSigMantissaBits=function(t,e){for(var r=0,n=52;n>=0;n--){if(CF.getBit(t,n)!==CF.getBit(e,n))return r;r++}return 52};var EF=function(){this._commonCoord=null,this._ccFilter=new BF},SF={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};EF.prototype.addCommonBits=function(t){var e=new IF(this._commonCoord);t.apply(e),t.geometryChanged()},EF.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new PS(this._commonCoord);e.x=-e.x,e.y=-e.y;var r=new IF(e);return t.apply(r),t.geometryChanged(),t},EF.prototype.getCommonCoordinate=function(){return this._commonCoord},EF.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},EF.prototype.interfaces_=function(){return[]},EF.prototype.getClass=function(){return EF},SF.CommonCoordinateFilter.get=function(){return BF},SF.Translater.get=function(){return IF},Object.defineProperties(EF,SF);var BF=function(){this._commonBitsX=new CF,this._commonBitsY=new CF};BF.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},BF.prototype.getCommonCoordinate=function(){return new PS(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},BF.prototype.interfaces_=function(){return[vB]},BF.prototype.getClass=function(){return BF};var IF=function(){this.trans=null;var t=arguments[0];this.trans=t};IF.prototype.filter=function(t,e){var r=t.getOrdinate(e,0)+this.trans.x,n=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,r),t.setOrdinate(e,1,n)},IF.prototype.isDone=function(){return!1},IF.prototype.isGeometryChanged=function(){return!0},IF.prototype.interfaces_=function(){return[oI]},IF.prototype.getClass=function(){return IF};var TF=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()};TF.prototype.selfSnap=function(t){return new wF(t).snapTo(t,this._snapTolerance)},TF.prototype.removeCommonBits=function(t){this._cbr=new EF,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},TF.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},TF.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),r=ZF.overlayOp(e[0],e[1],t);return this.prepareResult(r)},TF.prototype.checkValid=function(t){t.isValid()||YS.out.println("Snapped geometry is invalid")},TF.prototype.computeSnapTolerance=function(){this._snapTolerance=wF.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},TF.prototype.snap=function(t){var e=this.removeCommonBits(t);return wF.snap(e[0],e[1],this._snapTolerance)},TF.prototype.interfaces_=function(){return[]},TF.prototype.getClass=function(){return TF},TF.overlayOp=function(t,e,r){return new TF(t,e).getResultGeometry(r)},TF.union=function(t,e){return TF.overlayOp(t,e,ZF.UNION)},TF.intersection=function(t,e){return TF.overlayOp(t,e,ZF.INTERSECTION)},TF.symDifference=function(t,e){return TF.overlayOp(t,e,ZF.SYMDIFFERENCE)},TF.difference=function(t,e){return TF.overlayOp(t,e,ZF.DIFFERENCE)};var PF=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};PF.prototype.getResultGeometry=function(t){var e=null,r=!1,n=null;try{e=ZF.overlayOp(this._geom[0],this._geom[1],t),r=!0}catch(i){if(!(i instanceof oB))throw i;n=i}if(!r)try{e=TF.overlayOp(this._geom[0],this._geom[1],t)}catch(i){throw i instanceof oB?n:i}return e},PF.prototype.interfaces_=function(){return[]},PF.prototype.getClass=function(){return PF},PF.overlayOp=function(t,e,r){return new PF(t,e).getResultGeometry(r)},PF.union=function(t,e){return PF.overlayOp(t,e,ZF.UNION)},PF.intersection=function(t,e){return PF.overlayOp(t,e,ZF.INTERSECTION)},PF.symDifference=function(t,e){return PF.overlayOp(t,e,ZF.SYMDIFFERENCE)},PF.difference=function(t,e){return PF.overlayOp(t,e,ZF.DIFFERENCE)};var FF=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};FF.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},FF.prototype.interfaces_=function(){return[]},FF.prototype.getClass=function(){return FF};var LF=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],r=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=r}else if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=n,this._xValue=i,this._obj=o}},MF={INSERT:{configurable:!0},DELETE:{configurable:!0}};LF.prototype.isDelete=function(){return this._eventType===LF.DELETE},LF.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},LF.prototype.getObject=function(){return this._obj},LF.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},LF.prototype.getInsertEvent=function(){return this._insertEvent},LF.prototype.isInsert=function(){return this._eventType===LF.INSERT},LF.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},LF.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},LF.prototype.interfaces_=function(){return[SS]},LF.prototype.getClass=function(){return LF},MF.INSERT.get=function(){return 1},MF.DELETE.get=function(){return 2},Object.defineProperties(LF,MF);var OF=function(){};OF.prototype.interfaces_=function(){return[]},OF.prototype.getClass=function(){return OF};var kF=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],r=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=r};kF.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(kF.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},kF.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},kF.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},kF.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},kF.prototype.isBoundaryPointInternal=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next().getCoordinate();if(t.isIntersection(n))return!0}return!1},kF.prototype.hasProperIntersection=function(){return this._hasProper},kF.prototype.hasIntersection=function(){return this._hasIntersection},kF.prototype.isDone=function(){return this._isDone},kF.prototype.isBoundaryPoint=function(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))},kF.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},kF.prototype.addIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},kF.prototype.interfaces_=function(){return[]},kF.prototype.getClass=function(){return kF},kF.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var NF=function(t){function e(){t.call(this),this.events=new FB,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){ET.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var r=this.events.get(e);if(r.isInsert()&&this.processOverlaps(e,r.getDeleteEventIndex(),r,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof kF&&NS(arguments[0],TB)&&NS(arguments[1],TB)){var n=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(n,n),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&NS(arguments[0],TB)&&arguments[1]instanceof kF){var s=arguments[0],a=arguments[1];arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)}},e.prototype.addEdge=function(t,e){for(var r=t.getMonotoneChainEdge(),n=r.getStartIndexes(),i=0;i<n.length-1;i++){var o=new FF(r,i),s=new LF(e,r.getMinX(i),o);this.events.add(s),this.events.add(new LF(r.getMaxX(i),s))}},e.prototype.processOverlaps=function(t,e,r,n){for(var i=r.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();r.isSameLabel(s)||(i.computeIntersections(a,n),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){var i=n.next();this.addEdge(i,r)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(OF),RF=function(){this._min=CS.POSITIVE_INFINITY,this._max=CS.NEGATIVE_INFINITY},UF={NodeComparator:{configurable:!0}};RF.prototype.getMin=function(){return this._min},RF.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},RF.prototype.getMax=function(){return this._max},RF.prototype.toString=function(){return iB.toLineString(new PS(this._min,0),new PS(this._max,0))},RF.prototype.interfaces_=function(){return[]},RF.prototype.getClass=function(){return RF},UF.NodeComparator.get=function(){return DF},Object.defineProperties(RF,UF);var DF=function(){};DF.prototype.compare=function(t,e){var r=t,n=e,i=(r._min+r._max)/2,o=(n._min+n._max)/2;return i<o?-1:i>o?1:0},DF.prototype.interfaces_=function(){return[IS]},DF.prototype.getClass=function(){return DF};var QF=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],r=arguments[1],n=arguments[2];this._min=e,this._max=r,this._item=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;r.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(RF),GF=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],r=arguments[1];this._node1=e,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,r),null!==this._node2&&this._node2.query(t,e,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(RF),jF=function(){this._leaves=new FB,this._root=null,this._level=0};jF.prototype.buildTree=function(){ET.sort(this._leaves,new RF.NodeComparator);for(var t=this._leaves,e=null,r=new FB;;){if(this.buildLevel(t,r),1===r.size())return r.get(0);e=t,t=r,r=e}},jF.prototype.insert=function(t,e,r){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new QF(t,e,r))},jF.prototype.query=function(t,e,r){this.init(),this._root.query(t,e,r)},jF.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},jF.prototype.printNode=function(t){YS.out.println(iB.toLineString(new PS(t._min,this._level),new PS(t._max,this._level)))},jF.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},jF.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var r=0;r<t.size();r+=2){var n=t.get(r);if(null===(r+1<t.size()?t.get(r):null))e.add(n);else{var i=new GF(t.get(r),t.get(r+1));e.add(i)}}},jF.prototype.interfaces_=function(){return[]},jF.prototype.getClass=function(){return jF};var HF=function(){this._items=new FB};HF.prototype.visitItem=function(t){this._items.add(t)},HF.prototype.getItems=function(){return this._items},HF.prototype.interfaces_=function(){return[wT]},HF.prototype.getClass=function(){return HF};var zF=function(){this._index=null;var t=arguments[0];if(!NS(t,bI))throw new xS("Argument must be Polygonal");this._index=new qF(t)},VF={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};zF.prototype.locate=function(t){var e=new AB(t),r=new KF(e);return this._index.query(t.y,t.y,r),e.getLocation()},zF.prototype.interfaces_=function(){return[cP]},zF.prototype.getClass=function(){return zF},VF.SegmentVisitor.get=function(){return KF},VF.IntervalIndexedGeometry.get=function(){return qF},Object.defineProperties(zF,VF);var KF=function(){this._counter=null;var t=arguments[0];this._counter=t};KF.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},KF.prototype.interfaces_=function(){return[wT]},KF.prototype.getClass=function(){return KF};var qF=function(){this._index=new jF;var t=arguments[0];this.init(t)};qF.prototype.init=function(t){for(var e=XP.getLines(t).iterator();e.hasNext();){var r=e.next().getCoordinates();this.addLine(r)}},qF.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var r=new QT(t[e-1],t[e]),n=Math.min(r.p0.y,r.p1.y),i=Math.max(r.p0.y,r.p1.y);this._index.insert(n,i,r)}},qF.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new HF;return this._index.query(t,e,r),r.getItems()}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._index.query(n,i,o)}},qF.prototype.interfaces_=function(){return[]},qF.prototype.getClass=function(){return qF};var WF=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new NI,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new YP,2===arguments.length){var e=arguments[0],r=arguments[1],n=_B.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=r,this._boundaryNodeRule=n,null!==r&&this.add(r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];this._argIndex=i,this._parentGeom=o,this._boundaryNodeRule=s,null!==o&&this.add(o)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertBoundaryPoint=function(t,r){var n=this._nodes.addNode(r).getLabel(),i=1;OS.NONE,n.getLocation(t,XI.ON)===OS.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);n.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var r=arguments[1],n=arguments[2],i=new kF(arguments[0],!0,!1);i.setIsDoneIfProperInt(n);var o=this.createEdgeSetIntersector(),s=this._parentGeom instanceof EI||this._parentGeom instanceof xI||this._parentGeom instanceof SI,a=r||!s;return o.computeIntersections(this._edges,i,a),this.addSelfIntersectionNodes(this._argIndex),i}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();)e.next().eiList.addSplitEdges(t)},e.prototype.computeEdgeIntersections=function(t,e,r){var n=new kF(e,r,!0);return n.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,n),n},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof wI){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,OS.INTERIOR)}else if(arguments[0]instanceof PS){var e=arguments[0];this.insertPoint(this._argIndex,e,OS.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),OS.EXTERIOR,OS.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var r=t.getInteriorRingN(e);this.addPolygonRing(r,OS.INTERIOR,OS.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],OS.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],OS.BOUNDARY)},e.prototype.addLineString=function(t){var e=OB.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var r=new BP(e,new iT(this._argIndex,OS.INTERIOR));this._lineEdgeMap.put(t,r),this.insertEdge(r),aB.isTrue(e.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),r=0,n=t.iterator();n.hasNext();){var i=n.next();e[r++]=i.getCoordinate().copy()}return e},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,r){if(this.isBoundaryNode(t,e))return null;r===OS.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,r)},e.prototype.addPolygonRing=function(t,e,r){if(t.isEmpty())return null;var n=OB.removeRepeatedPoints(t.getCoordinates());if(n.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=n[0],null;var i=e,o=r;fB.isCCW(n)&&(i=r,o=e);var s=new BP(n,new iT(this._argIndex,OS.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,n[0],OS.BOUNDARY)},e.prototype.insertPoint=function(t,e,r){var n=this._nodes.addNode(e),i=n.getLabel();null===i?n._label=new iT(t,r):i.setLocation(t,r)},e.prototype.createEdgeSetIntersector=function(){return new NF},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var r=e.next(),n=r.getLabel().getLocation(t),i=r.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,n)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof SI&&(this._useBoundaryDeterminationRule=!1),e instanceof xI)this.addPolygon(e);else if(e instanceof vI)this.addLineString(e);else if(e instanceof wI)this.addPoint(e);else if(e instanceof CI)this.addCollection(e);else if(e instanceof aI)this.addCollection(e);else if(e instanceof SI)this.addCollection(e);else{if(!(e instanceof sI))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},e.prototype.locate=function(t){return NS(this._parentGeom,bI)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new zF(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)?OS.BOUNDARY:OS.INTERIOR},e}(gT),XF=function(){if(this._li=new hB,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 WF(0,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1],n=_B.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new WF(0,e,n),this._arg[1]=new WF(1,r,n)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new WF(0,i,s),this._arg[1]=new WF(1,o,s)}};XF.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},XF.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},XF.prototype.interfaces_=function(){return[]},XF.prototype.getClass=function(){return XF};var YF=function(){};YF.prototype.interfaces_=function(){return[]},YF.prototype.getClass=function(){return YF},YF.map=function(){if(arguments[0]instanceof gB&&NS(arguments[1],YF.MapOp)){for(var t=arguments[0],e=arguments[1],r=new FB,n=0;n<t.getNumGeometries();n++){var i=e.map(t.getGeometryN(n));null!==i&&r.add(i)}return t.getFactory().buildGeometry(r)}if(NS(arguments[0],SB)&&NS(arguments[1],YF.MapOp)){for(var o=arguments[0],s=arguments[1],a=new FB,l=o.iterator();l.hasNext();){var u=l.next(),h=s.map(u);null!==h&&a.add(h)}return a}},YF.MapOp=function(){};var ZF=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r),this._ptLocator=new YP,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new mP,this._resultPolyList=new FB,this._resultLineList=new FB,this._resultPointList=new FB,this._graph=new gT(new gP),this._geomFact=e.getFactory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new iT(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(r),i.add(n),r.merge(n)}else this._edgeList.add(t)},e.prototype.getGraph=function(){return this._graph},e.prototype.cancelDuplicateResultEdges=function(){for(var t=this._graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),r=e.getSym();e.isInResult()&&r.isInResult()&&(e.setInResult(!1),r.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,r,n,i){var o=new FB;return o.addAll(t),o.addAll(r),o.addAll(n),o.isEmpty()?e.createEmptyResult(i,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().mergeSymLabels()},e.prototype.isCovered=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(this._ptLocator.locate(t,n)!==OS.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new FB,e=this._edgeList.iterator();e.hasNext();){var r=e.next();r.isCollapsed()&&(e.remove(),t.add(r.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getEdges().getLabel();e.getLabel().merge(r)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();this.insertUniqueEdge(r)}},e.prototype.computeOverlay=function(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var e=new FB;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),dF.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var r=new yT(this._geomFact);r.add(this._graph),this._resultPolyList=r.getPolygons();var n=new yF(this,this._geomFact,this._ptLocator);this._resultLineList=n.build(t);var i=new mF(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},e.prototype.labelIncompleteNode=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,r)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var r=e.next();this._graph.addNode(r.getCoordinate()).setLabel(t,r.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var r=this._graph.getEdgeEnds().iterator();r.hasNext();){var n=r.next(),i=n.getLabel();i.isArea()&&!n.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,XI.RIGHT),i.getLocation(1,XI.RIGHT),t)&&n.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),r=e.getLabel(),n=e.getDepth();if(!n.isNull()){n.normalize();for(var i=0;i<2;i++)r.isNull(i)||!r.isArea()||n.isNull(i)||(0===n.getDelta(i)?r.toLine(i):(aB.isTrue(!n.isNull(i,XI.LEFT),"depth of LEFT side has not been initialized"),r.setLocation(i,XI.LEFT,n.getLocation(i,XI.LEFT)),aB.isTrue(!n.isNull(i,XI.RIGHT),"depth of RIGHT side has not been initialized"),r.setLocation(i,XI.RIGHT,n.getLocation(i,XI.RIGHT))))}}},e.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},e.prototype.labelIncompleteNodes=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getLabel();e.isIsolated()&&(r.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(r)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(XF);ZF.overlayOp=function(t,e,r){return new ZF(t,e).getResultGeometry(r)},ZF.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return ZF.createEmptyResult(ZF.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var r=e;return gF.map(t,{interfaces_:function(){return[YF.MapOp]},map:function(t){return t.intersection(r)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),PF.overlayOp(t,e,ZF.INTERSECTION)},ZF.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ZF.createEmptyResult(ZF.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),PF.overlayOp(t,e,ZF.SYMDIFFERENCE)},ZF.resultDimension=function(t,e,r){var n=e.getDimension(),i=r.getDimension(),o=-1;switch(t){case ZF.INTERSECTION:o=Math.min(n,i);break;case ZF.UNION:o=Math.max(n,i);break;case ZF.DIFFERENCE:o=n;break;case ZF.SYMDIFFERENCE:o=Math.max(n,i)}return o},ZF.createEmptyResult=function(t,e,r,n){var i=null;switch(ZF.resultDimension(t,e,r)){case-1:i=n.createGeometryCollection(new Array(0).fill(null));break;case 0:i=n.createPoint();break;case 1:i=n.createLineString();break;case 2:i=n.createPolygon()}return i},ZF.difference=function(t,e){return t.isEmpty()?ZF.createEmptyResult(ZF.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),PF.overlayOp(t,e,ZF.DIFFERENCE))},ZF.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=t.getLocation(0),n=t.getLocation(1);return ZF.isResultOfOp(r,n,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];switch(i===OS.BOUNDARY&&(i=OS.INTERIOR),o===OS.BOUNDARY&&(o=OS.INTERIOR),s){case ZF.INTERSECTION:return i===OS.INTERIOR&&o===OS.INTERIOR;case ZF.UNION:return i===OS.INTERIOR||o===OS.INTERIOR;case ZF.DIFFERENCE:return i===OS.INTERIOR&&o!==OS.INTERIOR;case ZF.SYMDIFFERENCE:return i===OS.INTERIOR&&o!==OS.INTERIOR||i!==OS.INTERIOR&&o===OS.INTERIOR}return!1}},ZF.INTERSECTION=1,ZF.UNION=2,ZF.DIFFERENCE=3,ZF.SYMDIFFERENCE=4;var JF=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new YP,this._seg=new QT;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};JF.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,r=0;r<this._linework.getNumGeometries();r++)for(var n=e._linework.getGeometryN(r).getCoordinateSequence(),i=0;i<n.size()-1;i++)if(n.getCoordinate(i,e._seg.p0),n.getCoordinate(i+1,e._seg.p1),e._seg.distance(t)<=e._boundaryDistanceTolerance)return!0;return!1},JF.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?OS.BOUNDARY:this._ptLocator.locate(t,this._g)},JF.prototype.extractLinework=function(t){var e=new $F;t.apply(e);var r=e.getLinework(),n=GI.toLineStringArray(r);return t.getFactory().createMultiLineString(n)},JF.prototype.interfaces_=function(){return[]},JF.prototype.getClass=function(){return JF};var $F=function(){this._linework=null,this._linework=new FB};$F.prototype.getLinework=function(){return this._linework},$F.prototype.filter=function(t){if(t instanceof xI){var e=t;this._linework.add(e.getExteriorRing());for(var r=0;r<e.getNumInteriorRing();r++)this._linework.add(e.getInteriorRingN(r))}},$F.prototype.interfaces_=function(){return[iI]},$F.prototype.getClass=function(){return $F};var tL=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};tL.prototype.extractPoints=function(t,e,r){for(var n=t.getCoordinates(),i=0;i<n.length-1;i++)this.computeOffsetPoints(n[i],n[i+1],e,r)},tL.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},tL.prototype.getPoints=function(t){for(var e=new FB,r=XP.getLines(this._g).iterator();r.hasNext();){var n=r.next();this.extractPoints(n,t,e)}return e},tL.prototype.computeOffsetPoints=function(t,e,r,n){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),a=r*i/s,l=r*o/s,u=(e.x+t.x)/2,h=(e.y+t.y)/2;if(this._doLeft){var c=new PS(u-l,h+a);n.add(c)}if(this._doRight){var A=new PS(u+l,h-a);n.add(A)}},tL.prototype.interfaces_=function(){return[]},tL.prototype.getClass=function(){return tL};var eL=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 FB;var e=arguments[0],r=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,r),this._geom=[e,r,n],this._locFinder=[new JF(this._geom[0],this._boundaryDistanceTolerance),new JF(this._geom[1],this._boundaryDistanceTolerance),new JF(this._geom[2],this._boundaryDistanceTolerance)]},rL={TOLERANCE:{configurable:!0}};eL.prototype.reportResult=function(t,e,r){YS.out.println("Overlay result invalid - A:"+OS.toLocationSymbol(e[0])+" B:"+OS.toLocationSymbol(e[1])+" expected:"+(r?"i":"e")+" actual:"+OS.toLocationSymbol(e[2]))},eL.prototype.isValid=function(t){return this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]),this.checkValid(t)},eL.prototype.checkValid=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=0;r<this._testCoords.size();r++){var n=t._testCoords.get(r);if(!t.checkValid(e,n))return t._invalidLocation=n,!1}return!0}if(2===arguments.length){var i=arguments[0],o=arguments[1];return this._location[0]=this._locFinder[0].getLocation(o),this._location[1]=this._locFinder[1].getLocation(o),this._location[2]=this._locFinder[2].getLocation(o),!!eL.hasLocation(this._location,OS.BOUNDARY)||this.isValidResult(i,this._location)}},eL.prototype.addTestPts=function(t){var e=new tL(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},eL.prototype.isValidResult=function(t,e){var r=ZF.isResultOfOp(e[0],e[1],t),n=!(r^e[2]===OS.INTERIOR);return n||this.reportResult(t,e,r),n},eL.prototype.getInvalidLocation=function(){return this._invalidLocation},eL.prototype.interfaces_=function(){return[]},eL.prototype.getClass=function(){return eL},eL.hasLocation=function(t,e){for(var r=0;r<3;r++)if(t[r]===e)return!0;return!1},eL.computeBoundaryDistanceTolerance=function(t,e){return Math.min(wF.computeSizeBasedSnapTolerance(t),wF.computeSizeBasedSnapTolerance(e))},eL.isValid=function(t,e,r,n){return new eL(t,e,n).isValid(r)},rL.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(eL,rL);var nL=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};nL.prototype.extractElements=function(t,e){if(null===t)return null;for(var r=0;r<t.getNumGeometries();r++){var n=t.getGeometryN(r);this._skipEmpty&&n.isEmpty()||e.add(n)}},nL.prototype.combine=function(){for(var t=new FB,e=this._inputGeoms.iterator();e.hasNext();){var r=e.next();this.extractElements(r,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},nL.prototype.interfaces_=function(){return[]},nL.prototype.getClass=function(){return nL},nL.combine=function(){if(1===arguments.length)return new nL(arguments[0]).combine();if(2===arguments.length){var t=arguments[0],e=arguments[1];return new nL(nL.createList(t,e)).combine()}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];return new nL(nL.createList(r,n,i)).combine()}},nL.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},nL.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new FB;return r.add(t),r.add(e),r}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=new FB;return s.add(n),s.add(i),s.add(o),s}};var iL=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new FB)},oL={STRTREE_NODE_CAPACITY:{configurable:!0}};iL.prototype.reduceToGeometries=function(t){for(var e=new FB,r=t.iterator();r.hasNext();){var n=r.next(),i=null;NS(n,TB)?i=this.unionTree(n):n instanceof gB&&(i=n),e.add(i)}return e},iL.prototype.extractByEnvelope=function(t,e,r){for(var n=new FB,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?n.add(o):r.add(o)}return this._geomFactory.buildGeometry(n)},iL.prototype.unionOptimized=function(t,e){var r=t.getEnvelopeInternal(),n=e.getEnvelopeInternal();if(!r.intersects(n))return nL.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=r.intersection(n);return this.unionUsingEnvelopeIntersection(t,e,i)},iL.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 FT(iL.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var r=e.next();t.insert(r.getEnvelopeInternal(),r)}this._inputPolys=null;var n=t.itemsTree();return this.unionTree(n)},iL.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];if(n-r<=1){var i=iL.getGeometry(e,r);return this.unionSafe(i,null)}if(n-r==2)return this.unionSafe(iL.getGeometry(e,r),iL.getGeometry(e,r+1));var o=Math.trunc((n+r)/2),s=this.binaryUnion(e,r,o),a=this.binaryUnion(e,o,n);return this.unionSafe(s,a)}},iL.prototype.repeatedUnion=function(t){for(var e=null,r=t.iterator();r.hasNext();){var n=r.next();e=null===e?n.copy():e.union(n)}return e},iL.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},iL.prototype.unionActual=function(t,e){return iL.restrictToPolygons(t.union(e))},iL.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},iL.prototype.unionUsingEnvelopeIntersection=function(t,e,r){var n=new FB,i=this.extractByEnvelope(r,t,n),o=this.extractByEnvelope(r,e,n),s=this.unionActual(i,o);return n.add(s),nL.combine(n)},iL.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().createGeometryCollection([e,r]).buffer(0)}},iL.prototype.interfaces_=function(){return[]},iL.prototype.getClass=function(){return iL},iL.restrictToPolygons=function(t){if(NS(t,bI))return t;var e=WP.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(GI.toPolygonArray(e))},iL.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},iL.union=function(t){return new iL(t).union()},oL.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(iL,oL);var sL=function(){};function aL(){return new lL}function lL(){this.reset()}sL.prototype.interfaces_=function(){return[]},sL.prototype.getClass=function(){return sL},sL.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ZF.createEmptyResult(ZF.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),PF.overlayOp(t,e,ZF.UNION)},lL.prototype={constructor:lL,reset:function(){this.s=this.t=0},add:function(t){hL(uL,t,this.t),hL(this,uL.s,this.s),this.s?this.t+=uL.t:this.s=uL.t},valueOf:function(){return this.s}};var uL=new lL;function hL(t,e,r){var n=t.s=e+r,i=n-e,o=n-i;t.t=e-o+(r-i)}var cL=1e-6,AL=Math.PI,fL=AL/2,pL=AL/4,dL=2*AL,gL=180/AL,yL=AL/180,mL=Math.abs,vL=Math.atan,_L=Math.atan2,wL=Math.cos,bL=Math.sin,xL=Math.sqrt;function CL(t){return t>1?0:t<-1?AL:Math.acos(t)}function EL(t){return t>1?fL:t<-1?-fL:Math.asin(t)}function SL(){}function BL(t,e){t&&FL.hasOwnProperty(t.type)&&FL[t.type](t,e)}var IL,TL,PL={Feature:function(t,e){BL(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)BL(r[n].geometry,e)}},FL={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){LL(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)LL(r[n],e,0)},Polygon:function(t,e){ML(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)ML(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)BL(r[n],e)}};function LL(t,e,r){var n,i=-1,o=t.length-r;for(e.lineStart();++i<o;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function ML(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)LL(t[r],e,1);e.polygonEnd()}function OL(t){return[_L(t[1],t[0]),EL(t[2])]}function kL(t){var e=t[0],r=t[1],n=wL(r);return[n*wL(e),n*bL(e),bL(r)]}function NL(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function RL(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 UL(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function DL(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function QL(t){var e=xL(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function GL(t,e){function r(r,n){return r=t(r,n),e(r[0],r[1])}return t.invert&&e.invert&&(r.invert=function(r,n){return(r=e.invert(r,n))&&t.invert(r[0],r[1])}),r}function jL(t,e){return[t>AL?t-dL:t<-AL?t+dL:t,e]}function HL(t){return function(e,r){return[(e+=t)>AL?e-dL:e<-AL?e+dL:e,r]}}function zL(t){var e=HL(t);return e.invert=HL(-t),e}function VL(t,e){var r=wL(t),n=bL(t),i=wL(e),o=bL(e);function s(t,e){var s=wL(e),a=wL(t)*s,l=bL(t)*s,u=bL(e),h=u*r+a*n;return[_L(l*i-h*o,a*r-u*n),EL(h*i+l*o)]}return s.invert=function(t,e){var s=wL(e),a=wL(t)*s,l=bL(t)*s,u=bL(e),h=u*i-l*o;return[_L(l*i+u*o,a*r+h*n),EL(h*r-a*n)]},s}function KL(t,e){(e=kL(e))[0]-=t,QL(e);var r=CL(-e[1]);return((-e[2]<0?-r:r)+dL-cL)%dL}function qL(){var t,e=[];return{point:function(e,r){t.push([e,r])},lineStart:function(){e.push(t=[])},lineEnd:SL,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function WL(t,e){return mL(t[0]-e[0])<cL&&mL(t[1]-e[1])<cL}function XL(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function YL(t,e,r,n,i){var o,s,a=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,r,n=t[0],s=t[e];if(WL(n,s)){for(i.lineStart(),o=0;o<e;++o)i.point((n=t[o])[0],n[1]);i.lineEnd()}else a.push(r=new XL(n,t,null,!0)),l.push(r.o=new XL(n,null,r,!1)),a.push(r=new XL(s,t,null,!1)),l.push(r.o=new XL(s,null,r,!0))}})),a.length){for(l.sort(e),ZL(a),ZL(l),o=0,s=l.length;o<s;++o)l[o].e=r=!r;for(var u,h,c=a[0];;){for(var A=c,f=!0;A.v;)if((A=A.n)===c)return;u=A.z,i.lineStart();do{if(A.v=A.o.v=!0,A.e){if(f)for(o=0,s=u.length;o<s;++o)i.point((h=u[o])[0],h[1]);else n(A.x,A.n.x,1,i);A=A.n}else{if(f)for(u=A.p.z,o=u.length-1;o>=0;--o)i.point((h=u[o])[0],h[1]);else n(A.x,A.p.x,-1,i);A=A.p}u=(A=A.o).z,f=!f}while(!A.v);i.lineEnd()}}}function ZL(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}function JL(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function $L(t){for(var e,r,n,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(r=new Array(s);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--s]=n[e];return r}aL(),aL(),aL(),jL.invert=jL,1===(IL=JL).length&&(TL=IL,IL=function(t,e){return JL(TL(t),e)});var tM=1e9,eM=-tM,rM=aL();function nM(t){return t}aL(),aL(),aL();var iM=1/0,oM=iM,sM=-iM,aM=sM,lM={point:function(t,e){t<iM&&(iM=t),t>sM&&(sM=t),e<oM&&(oM=e),e>aM&&(aM=e)},lineStart:SL,lineEnd:SL,polygonStart:SL,polygonEnd:SL,result:function(){var t=[[iM,oM],[sM,aM]];return sM=aM=-(oM=iM=1/0),t}};function uM(t,e,r,n){return function(i,o){var s,a,l,u=e(o),h=i.invert(n[0],n[1]),c=qL(),A=e(c),f=!1,p={point:d,lineStart:y,lineEnd:m,polygonStart:function(){p.point=v,p.lineStart=_,p.lineEnd=w,a=[],s=[]},polygonEnd:function(){p.point=d,p.lineStart=y,p.lineEnd=m,a=$L(a);var t=function(t,e){var r=e[0],n=e[1],i=[bL(r),-wL(r),0],o=0,s=0;rM.reset();for(var a=0,l=t.length;a<l;++a)if(h=(u=t[a]).length)for(var u,h,c=u[h-1],A=c[0],f=c[1]/2+pL,p=bL(f),d=wL(f),g=0;g<h;++g,A=m,p=_,d=w,c=y){var y=u[g],m=y[0],v=y[1]/2+pL,_=bL(v),w=wL(v),b=m-A,x=b>=0?1:-1,C=x*b,E=C>AL,S=p*_;if(rM.add(_L(S*x*bL(C),d*w+S*wL(C))),o+=E?b+x*dL:b,E^A>=r^m>=r){var B=RL(kL(c),kL(y));QL(B);var I=RL(i,B);QL(I);var T=(E^b>=0?-1:1)*EL(I[2]);(n>T||n===T&&(B[0]||B[1]))&&(s+=E^b>=0?1:-1)}}return(o<-cL||o<cL&&rM<-cL)^1&s}(s,h);a.length?(f||(o.polygonStart(),f=!0),YL(a,cM,t,r,o)):t&&(f||(o.polygonStart(),f=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),f&&(o.polygonEnd(),f=!1),a=s=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function d(e,r){var n=i(e,r);t(e=n[0],r=n[1])&&o.point(e,r)}function g(t,e){var r=i(t,e);u.point(r[0],r[1])}function y(){p.point=g,u.lineStart()}function m(){p.point=d,u.lineEnd()}function v(t,e){l.push([t,e]);var r=i(t,e);A.point(r[0],r[1])}function _(){A.lineStart(),l=[]}function w(){v(l[0][0],l[0][1]),A.lineEnd();var t,e,r,n,i=A.clean(),u=c.result(),h=u.length;if(l.pop(),s.push(l),l=null,h)if(1&i){if((e=(r=u[0]).length-1)>0){for(f||(o.polygonStart(),f=!0),o.lineStart(),t=0;t<e;++t)o.point((n=r[t])[0],n[1]);o.lineEnd()}}else h>1&&2&i&&u.push(u.pop().concat(u.shift())),a.push(u.filter(hM))}return p}}function hM(t){return t.length>1}function cM(t,e){return((t=t.x)[0]<0?t[1]-fL-cL:fL-t[1])-((e=e.x)[0]<0?e[1]-fL-cL:fL-e[1])}aL();const AM=uM((function(){return!0}),(function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?AL:-AL,l=mL(o-r);mL(l-AL)<cL?(t.point(r,n=(n+s)/2>0?fL:-fL),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(o,n),e=0):i!==a&&l>=AL&&(mL(r-i)<cL&&(r-=i*cL),mL(o-a)<cL&&(o-=a*cL),n=function(t,e,r,n){var i,o,s=bL(t-r);return mL(s)>cL?vL((bL(e)*(o=wL(n))*bL(r)-bL(n)*(i=wL(e))*bL(t))/(i*o*s)):(e+n)/2}(r,n,o,s),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),e=0),t.point(r=o,n=s),i=a},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var i;if(null==t)i=r*fL,n.point(-AL,i),n.point(0,i),n.point(AL,i),n.point(AL,0),n.point(AL,-i),n.point(0,-i),n.point(-AL,-i),n.point(-AL,0),n.point(-AL,i);else if(mL(t[0]-e[0])>cL){var o=t[0]<e[0]?AL:-AL;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(e[0],e[1])}),[-AL,-fL]);function fM(t){return function(e){var r=new pM;for(var n in t)r[n]=t[n];return r.stream=e,r}}function pM(){}function dM(t,e,r){var n=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),function(t,e){t&&PL.hasOwnProperty(t.type)?PL[t.type](t,e):BL(t,e)}(r,t.stream(lM));var s=lM.result(),a=Math.min(n/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),l=+e[0][0]+(n-a*(s[1][0]+s[0][0]))/2,u=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([l,u])}pM.prototype={constructor:pM,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 gM=16,yM=wL(30*yL);function mM(t,e){return+e?function(t,e){function r(n,i,o,s,a,l,u,h,c,A,f,p,d,g){var y=u-n,m=h-i,v=y*y+m*m;if(v>4*e&&d--){var _=s+A,w=a+f,b=l+p,x=xL(_*_+w*w+b*b),C=EL(b/=x),E=mL(mL(b)-1)<cL||mL(o-c)<cL?(o+c)/2:_L(w,_),S=t(E,C),B=S[0],I=S[1],T=B-n,P=I-i,F=m*T-y*P;(F*F/v>e||mL((y*T+m*P)/v-.5)>.3||s*A+a*f+l*p<yM)&&(r(n,i,o,s,a,l,B,I,E,_/=x,w/=x,b,d,g),g.point(B,I),r(B,I,E,_,w,b,u,h,c,A,f,p,d,g))}}return function(e){var n,i,o,s,a,l,u,h,c,A,f,p,d={point:g,lineStart:y,lineEnd:v,polygonStart:function(){e.polygonStart(),d.lineStart=_},polygonEnd:function(){e.polygonEnd(),d.lineStart=y}};function g(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){h=NaN,d.point=m,e.lineStart()}function m(n,i){var o=kL([n,i]),s=t(n,i);r(h,c,u,A,f,p,h=s[0],c=s[1],u=n,A=o[0],f=o[1],p=o[2],gM,e),e.point(h,c)}function v(){d.point=g,e.lineEnd()}function _(){y(),d.point=w,d.lineEnd=b}function w(t,e){m(n=t,e),i=h,o=c,s=A,a=f,l=p,d.point=m}function b(){r(h,c,u,A,f,p,i,o,n,s,a,l,gM,e),d.lineEnd=v,v()}return d}}(t,e):function(t){return fM({point:function(e,r){e=t(e,r),this.stream.point(e[0],e[1])}})}(t)}var vM=fM({point:function(t,e){this.stream.point(t*yL,e*yL)}});function _M(t){return function(e,r){var n=wL(e),i=wL(r),o=t(n*i);return[o*i*bL(e),o*bL(r)]}}function wM(t){return function(e,r){var n=xL(e*e+r*r),i=t(n),o=bL(i),s=wL(i);return[_L(e*o,n*s),EL(n&&r*o/n)]}}_M((function(t){return xL(2/(1+t))})).invert=wM((function(t){return 2*EL(t/2)}));var bM=_M((function(t){return(t=CL(t))&&t/bL(t)}));function xM(t,e){return[t,e]}function CM(t,e,r){var n=(r=r||{}).units||"kilometers",i=r.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof r)throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return Hm(t,(function(t){var r=EM(t,e,n,i);r&&o.push(r)})),Cm(o);case"FeatureCollection":return Qm(t,(function(t){var r=EM(t,e,n,i);r&&Qm(r,(function(t){t&&o.push(t)}))})),Cm(o)}return EM(t,e,n,i)}function EM(t,e,r,n){var i=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var s=[];return Hm(t,(function(t){var i=EM(t,e,r,n);i&&s.push(i)})),Cm(s)}var a=function(t){var e,r=Jv(t).geometry.coordinates,n=[-r[0],-r[1]];return(e=bM,function(t){var e,r,n,i,o,s,a,l,u,h,c=150,A=480,f=250,p=0,d=0,g=0,y=0,m=0,v=null,_=AM,w=null,b=nM,x=.5,C=mM(B,x);function E(t){return[(t=o(t[0]*yL,t[1]*yL))[0]*c+r,n-t[1]*c]}function S(t){return(t=o.invert((t[0]-r)/c,(n-t[1])/c))&&[t[0]*gL,t[1]*gL]}function B(t,i){return[(t=e(t,i))[0]*c+r,n-t[1]*c]}function I(){o=GL(i=function(t,e,r){return(t%=dL)?e||r?GL(zL(t),VL(e,r)):zL(t):e||r?VL(e,r):jL}(g,y,m),e);var t=e(p,d);return r=A-t[0]*c,n=f+t[1]*c,T()}function T(){return u=h=null,E}return E.stream=function(t){return u&&h===t?u:u=vM(_(i,C(b(h=t))))},E.clipAngle=function(t){return arguments.length?(_=+t?function(t,e){var r=wL(t),n=r>0,i=mL(r)>cL;function o(t,e){return wL(t)*wL(e)>r}function s(t,e,n){var i=[1,0,0],o=RL(kL(t),kL(e)),s=NL(o,o),a=o[0],l=s-a*a;if(!l)return!n&&t;var u=r*s/l,h=-r*a/l,c=RL(i,o),A=DL(i,u);UL(A,DL(o,h));var f=c,p=NL(A,f),d=NL(f,f),g=p*p-d*(NL(A,A)-1);if(!(g<0)){var y=xL(g),m=DL(f,(-p-y)/d);if(UL(m,A),m=OL(m),!n)return m;var v,_=t[0],w=e[0],b=t[1],x=e[1];w<_&&(v=_,_=w,w=v);var C=w-_,E=mL(C-AL)<cL;if(!E&&x<b&&(v=b,b=x,x=v),E||C<cL?E?b+x>0^m[1]<(mL(m[0]-_)<cL?b:x):b<=m[1]&&m[1]<=x:C>AL^(_<=m[0]&&m[0]<=w)){var S=DL(f,(-p+y)/d);return UL(S,A),[m,OL(S)]}}}function a(e,r){var i=n?t:AL-t,o=0;return e<-i?o|=1:e>i&&(o|=2),r<-i?o|=4:r>i&&(o|=8),o}return uM(o,(function(t){var e,r,l,u,h;return{lineStart:function(){u=l=!1,h=1},point:function(c,A){var f,p=[c,A],d=o(c,A),g=n?d?0:a(c,A):d?a(c+(c<0?AL:-AL),A):0;if(!e&&(u=l=d)&&t.lineStart(),d!==l&&(!(f=s(e,p))||WL(e,f)||WL(p,f))&&(p[0]+=cL,p[1]+=cL,d=o(p[0],p[1])),d!==l)h=0,d?(t.lineStart(),f=s(p,e),t.point(f[0],f[1])):(f=s(e,p),t.point(f[0],f[1]),t.lineEnd()),e=f;else if(i&&e&&n^d){var y;g&r||!(y=s(p,e,!0))||(h=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!d||e&&WL(e,p)||t.point(p[0],p[1]),e=p,l=d,r=g},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return h|(u&&l)<<1}}}),(function(r,n,i,o){!function(t,e,r,n,i,o){if(r){var s=wL(e),a=bL(e),l=n*r;null==i?(i=e+n*dL,o=e-l/2):(i=KL(s,i),o=KL(s,o),(n>0?i<o:i>o)&&(i+=n*dL));for(var u,h=i;n>0?h>o:h<o;h-=l)u=OL([s,-a*wL(h),-a*bL(h)]),t.point(u[0],u[1])}}(o,t,e,i,r,n)}),n?[0,-t]:[-AL,t-AL])}(v=t*yL,6*yL):(v=null,AM),T()):v*gL},E.clipExtent=function(t){return arguments.length?(b=null==t?(w=s=a=l=null,nM):function(t,e,r,n){function i(i,o){return t<=i&&i<=r&&e<=o&&o<=n}function o(i,o,a,u){var h=0,c=0;if(null==i||(h=s(i,a))!==(c=s(o,a))||l(i,o)<0^a>0)do{u.point(0===h||3===h?t:r,h>1?n:e)}while((h=(h+a+4)%4)!==c);else u.point(o[0],o[1])}function s(n,i){return mL(n[0]-t)<cL?i>0?0:3:mL(n[0]-r)<cL?i>0?2:1:mL(n[1]-e)<cL?i>0?1:0:i>0?3:2}function a(t,e){return l(t.x,e.x)}function l(t,e){var r=s(t,1),n=s(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){var l,u,h,c,A,f,p,d,g,y,m,v=s,_=qL(),w={point:b,lineStart:function(){w.point=x,u&&u.push(h=[]),y=!0,g=!1,p=d=NaN},lineEnd:function(){l&&(x(c,A),f&&g&&_.rejoin(),l.push(_.result())),w.point=b,g&&v.lineEnd()},polygonStart:function(){v=_,l=[],u=[],m=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=u.length;r<i;++r)for(var o,s,a=u[r],l=1,h=a.length,c=a[0],A=c[0],f=c[1];l<h;++l)o=A,s=f,A=(c=a[l])[0],f=c[1],s<=n?f>n&&(A-o)*(n-s)>(f-s)*(t-o)&&++e:f<=n&&(A-o)*(n-s)<(f-s)*(t-o)&&--e;return e}(),r=m&&e,i=(l=$L(l)).length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&YL(l,a,e,o,s),s.polygonEnd()),v=s,l=u=h=null}};function b(t,e){i(t,e)&&v.point(t,e)}function x(o,s){var a=i(o,s);if(u&&h.push([o,s]),y)c=o,A=s,f=a,y=!1,a&&(v.lineStart(),v.point(o,s));else if(a&&g)v.point(o,s);else{var l=[p=Math.max(eM,Math.min(tM,p)),d=Math.max(eM,Math.min(tM,d))],_=[o=Math.max(eM,Math.min(tM,o)),s=Math.max(eM,Math.min(tM,s))];!function(t,e,r,n,i,o){var s,a=t[0],l=t[1],u=0,h=1,c=e[0]-a,A=e[1]-l;if(s=r-a,c||!(s>0)){if(s/=c,c<0){if(s<u)return;s<h&&(h=s)}else if(c>0){if(s>h)return;s>u&&(u=s)}if(s=i-a,c||!(s<0)){if(s/=c,c<0){if(s>h)return;s>u&&(u=s)}else if(c>0){if(s<u)return;s<h&&(h=s)}if(s=n-l,A||!(s>0)){if(s/=A,A<0){if(s<u)return;s<h&&(h=s)}else if(A>0){if(s>h)return;s>u&&(u=s)}if(s=o-l,A||!(s<0)){if(s/=A,A<0){if(s>h)return;s>u&&(u=s)}else if(A>0){if(s<u)return;s<h&&(h=s)}return u>0&&(t[0]=a+u*c,t[1]=l+u*A),h<1&&(e[0]=a+h*c,e[1]=l+h*A),!0}}}}}(l,_,t,e,r,n)?a&&(v.lineStart(),v.point(o,s),m=!1):(g||(v.lineStart(),v.point(l[0],l[1])),v.point(_[0],_[1]),a||v.lineEnd(),m=!1)}p=o,d=s,g=a}return w}}(w=+t[0][0],s=+t[0][1],a=+t[1][0],l=+t[1][1]),T()):null==w?null:[[w,s],[a,l]]},E.scale=function(t){return arguments.length?(c=+t,I()):c},E.translate=function(t){return arguments.length?(A=+t[0],f=+t[1],I()):[A,f]},E.center=function(t){return arguments.length?(p=t[0]%360*yL,d=t[1]%360*yL,I()):[p*gL,d*gL]},E.rotate=function(t){return arguments.length?(g=t[0]%360*yL,y=t[1]%360*yL,m=t.length>2?t[2]%360*yL:0,I()):[g*gL,y*gL,m*gL]},E.precision=function(t){return arguments.length?(C=mM(B,x=t*t),T()):xL(x)},E.fitExtent=function(t,e){return dM(E,t,e)},E.fitSize=function(t,e){return function(t,e,r){return dM(t,[[0,0],e],r)}(E,t,e)},function(){return e=t.apply(this,arguments),E.invert=e.invert&&S,I()}}((function(){return e}))()).scale(79.4188).clipAngle(179.999).rotate(n).scale(gm)}(o),l={type:o.type,coordinates:BM(o.coordinates,a)},u=(new qI).read(l),h=Tm(Pm(e,r),"meters"),c=QP.bufferOp(u,h,n);if(!SM((c=(new WI).write(c)).coordinates))return _m({type:c.type,coordinates:IM(c.coordinates,a)},i)}function SM(t){return Array.isArray(t[0])?SM(t[0]):isNaN(t[0])}function BM(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return BM(t,e)}))}function IM(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return IM(t,e)}))}function TM(t,e,r){void 0===r&&(r={});var n=rv(t),i=rv(e),o=wS.union(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?bm(o[0],r.properties):Bm(o,r.properties)}function PM(t,e,r){void 0===r&&(r={});var n=rv(t),i=rv(e),o=wS.intersection(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?bm(o[0],r.properties):Bm(o,r.properties)}function FM(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var l=t[0]+e*i[a],u=t[1]+r*o[a];s.push([l,u])}return s.push(s[0].slice()),bm([s],n)}function LM(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var l=[];l.push(t),l.push([t[0]+e*i[a],t[1]+r*o[a]]),l.push([t[0]+e*i[(a+1)%6],t[1]+r*o[(a+1)%6]]),l.push(t),s.push(bm([l],n))}return s}function MM(t,e){var r,n,i=function(t){return bm(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}(e),o=null;return"FeatureCollection"===t.type?(n=2===(r=t).features.length?wS.union(r.features[0].geometry.coordinates,r.features[1].geometry.coordinates):wS.union.apply(wS,r.features.map((function(t){return t.geometry.coordinates}))),o=OM(n)):o=OM(wS.union(t.geometry.coordinates)),o.geometry.coordinates.forEach((function(t){i.geometry.coordinates.push(t[0])})),i}function OM(t){return Bm(t)}bM.invert=wM((function(t){return t})),xM.invert=xM;const kM=class{static sector(t,e,r,n){let i=function(t,e,r,n,i){if(!Nm(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(null==r)throw new Error("bearing1 is required");if(null==n)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if("object"!=typeof i)throw new Error("options must be an object");if(ux(r)===ux(n))return Yv(t,e,i);var s=tv(t),a=function(t,e,r,n,i){void 0===i&&(i={});var o=i.steps||64,s=O_(r),a=O_(n),l=Array.isArray(t)||"Feature"!==t.type?{}:t.properties;if(s===a)return xm(Yv(t,e,i).geometry.coordinates[0],l);for(var u=s,h=s<a?a:a+360,c=u,A=[],f=0;c<h;)A.push(Xv(t,e,c,i).geometry.coordinates),c=u+360*++f/o;return c>h&&A.push(Xv(t,e,h,i).geometry.coordinates),xm(A,l)}(t,e,r,n,i),l=[[s]];return Um(a,(function(t){l[0].push(t)})),l[0].push(s),bm(l,o)}(t,e/1e3,r,n);return kM.to3857(i)}static nearestPoint(t,e){let r=function(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var r,n=1/0,i=0;return Qm(e,(function(e,r){var o=fv(t,e);o<n&&(i=r,n=o)})),(r=vv(e.features[i])).properties.featureIndex=i,r.properties.distanceToPoint=n,r}(kM.featureTo4326(t),kM.featuresTo4326(e));return kM.to3857(r)}static bezierSpline(t,e){let r;r=t instanceof W?kM.featureTo4326(t):t;let n=function(t,e){void 0===e&&(e={});for(var r=e.resolution||1e4,n=e.sharpness||.85,i=[],o=rv(t).coordinates.map((function(t){return{x:t[0],y:t[1]}})),s=new Wv({duration:r,points:o,sharpness:n}),a=function(t){var e=s.pos(t);Math.floor(t/100)%2==0&&i.push([e.x,e.y])},l=0;l<s.duration;l+=10)a(l);return a(s.duration),xm(i,e.properties)}(r,e);return kM.to3857(n)}static pointsWithinPolygon(t,e){let r,n=kM.featuresTo4326(t);"Circle"===e.getGeometry().getType()?(e.setGeometry(xn(e.getGeometry(),128)),r=kM.featureTo4326(e)):r=kM.featureTo4326(e);let i=(o=r,s=[],Qm(n,(function(t){var e=!1;if("Point"===t.geometry.type)Hm(o,(function(r){cv(t,r)&&(e=!0)})),e&&s.push(t);else{if("MultiPoint"!==t.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var r=[];Hm(o,(function(n){Um(t,(function(t){cv(t,n)&&(e=!0,r.push(t))}))})),e&&s.push(Sm(r))}})),Cm(s));var o,s;return kM.to3857_featureList(i)}static lineOffset(t,e=1){let r=function(t,e,r){if(!Nm(r=r||{}))throw new Error("options is invalid");var n=r.units;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");var i=nv(t),o=t.properties;switch(i){case"LineString":return vC(t,e,n);case"MultiLineString":var s=[];return Vm(t,(function(t){s.push(vC(t,e,n).geometry.coordinates)})),Em(s,o);default:throw new Error("geometry "+i+" is not supported")}}(kM.featureTo4326(t),e/=1e3,{units:"kilometers"});return kM.to3857(r)}static nearestPointOnLine(t,e){let r=kM.featureTo4326(t),n=p_(kM.featureTo4326(e),r,{units:"kilometers"});return kM.to3857(n)}static nearestPointOnLines(t,e){let r=kM.featureTo4326(t),n=p_(kM.featuresTo4326(e),r,{units:"kilometers"});return kM.to3857(n)}static booleanOverlap(t,e){return RC(kM.featureTo4326(t),kM.featureTo4326(e))}static booleanPointInPolygon(t,e){return cv(kM.featureTo4326(t),kM.featureTo4326(e))}static buffer(t,e=5){e/=1e3;let r=CM(kM.featureTo4326(t),e,{units:"kilometers"});return kM.to3857(r)}static difference(t,e){new nf;let r=kM.featureTo4326(t),n=(o=kM.featureTo4326(e),s=rv(i=r),a=rv(o),l=i.properties||{},0===(u=wS.difference(s.coordinates,a.coordinates)).length?null:1===u.length?bm(u[0],l):Bm(u,l));var i,o,s,a,l,u;return kM.to3857(n)}static intersect(t,e){let r=PM(kM.featureTo4326(t),kM.featureTo4326(e));return kM.to3857(r)}static booleanContains(t,e){try{let r,n,i,o=[],s=new nf;n="Circle"===t.getGeometry().getType()?xn(t.getGeometry(),128):t.getGeometry();let a=s.writeGeometryObject(n);return e.forEach((e=>{if(t!==e){i="Circle"===e.getGeometry().getType()?xn(e.getGeometry(),128):e.getGeometry();let t=s.writeGeometryObject(i);if(CC(a,t))r=s.readFeature(t),r.setProperties(e.getProperties()),o.push(r);else if("Point"!==i.getType()&&"LineString"!==i.getType()&&RC(a,t)){let n=PM(a,t);r=s.readFeature(n);let l=e.getProperties();l.name=e.get("name")+"重叠区域",l.重叠对象=e.get("name"),l.重叠面积=this.formatArea(i),r.setProperties(l),o.push(r)}}})),o}catch(UW){}}static createPolygon(t,e,r,n){let i,o=[],s=kM.featuresTo4326(e),a=function(t,e){void 0===e&&(e={});var r=e.maxEdge||1/0,n=function(t){var e=[],r={};return Qm(t,(function(t){if(t.geometry){var n=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(r,n)||(e.push(t),r[n]=!0)}})),Cm(e)}(t),i=dv(n);if(i.features=i.features.filter((function(t){var n=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],s=fv(n,i,e),a=fv(i,o,e),l=fv(n,o,e);return s<=r&&a<=r&&l<=r})),i.features.length<1)return null;var o=Hv(i);return 1===o.coordinates.length&&(o.coordinates=o.coordinates[0],o.type="Polygon"),_m(o)}(s),l={bbox:Zm(a)};switch(t){case Jy.voronoi:i=function(t,e){if(!Nm(e=e||{}))throw new Error("options is invalid");var r=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(r))throw new Error("bbox is invalid");return ev(t,"Point","points"),Cm(function(){var t=KC,e=qC,r=null;function n(n){return new BE(n.map((function(r,i){var o=[Math.round(t(r,i,n)/CE)*CE,Math.round(e(r,i,n)/CE)*CE];return o.index=i,o.data=r,o})),r)}return n.polygons=function(t){return n(t).polygons()},n.links=function(t){return n(t).links()},n.triangles=function(t){return n(t).triangles()},n.x=function(e){return arguments.length?(t="function"==typeof e?e:VC(+e),n):t},n.y=function(t){return arguments.length?(e="function"==typeof t?t:VC(+t),n):e},n.extent=function(t){return arguments.length?(r=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],n):r&&[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},n.size=function(t){return arguments.length?(r=null==t?null:[[0,0],[+t[0],+t[1]]],n):r&&[r[1][0]-r[0][0],r[1][1]-r[0][1]]},n}().x((function(t){return t.geometry.coordinates[0]})).y((function(t){return t.geometry.coordinates[1]})).extent([[r[0],r[1]],[r[2],r[3]]]).polygons(t.features).map(IE))}(s,l);break;case Jy.tin:i=dv(s,"z");break;case Jy.convex:kM.to3857(a)}return i.features.forEach(((t,e)=>{let i=kM.to3857(t);i.setStyle(new Gi({stroke:new kn({color:r||dm.getRandomColor(),width:5}),fill:new Tn({color:n||dm.getRandomColor()})})),i.setProperties({uuid:fm.uuid15(),name:"第"+e+"个"}),o.push(i)})),o}static createGrid(t,e={box:[0,0,0,0],cellSide:50}){let r=[];e.cellSide=e.cellSide/1e3;let n,i={units:"kilometers"};switch(t){case Zy.point:n=function(t,e,r){void 0===r&&(r={}),r.mask&&!r.units&&(r.units="kilometers");for(var n=[],i=t[0],o=t[1],s=t[2],a=t[3],l=e/fv([i,o],[s,o],r)*(s-i),u=e/fv([i,o],[i,a],r)*(a-o),h=s-i,c=a-o,A=Math.floor(h/l),f=(c-Math.floor(c/u)*u)/2,p=i+(h-A*l)/2;p<=s;){for(var d=o+f;d<=a;){var g=wm([p,d],r.properties);r.mask?S_(g,r.mask)&&n.push(g):n.push(g),d+=u}p+=l}return Cm(n)}(e.box,e.cellSide,i);break;case Zy.hex:n=function(t,e,r){void 0===r&&(r={});var n=JSON.stringify(r.properties||{}),i=t[0],o=t[1],s=t[2],a=t[3],l=(o+a)/2,u=(i+s)/2,h=2*e/fv([i,l],[s,l],r)*(s-i),c=2*e/fv([u,o],[u,a],r)*(a-o),A=h/2,f=2*A,p=Math.sqrt(3)/2*c,d=s-i,g=a-o,y=3/4*f,m=p,v=(d-f)/(f-A/2),_=Math.floor(v),w=(_*y-A/2-d)/2-A/2+y/2,b=Math.floor((g-p)/p),x=(g-b*p)/2,C=b*p-g>p/2;C&&(x-=p/4);for(var E=[],S=[],B=0;B<6;B++){var I=2*Math.PI/6*B;E.push(Math.cos(I)),S.push(Math.sin(I))}for(var T=[],P=0;P<=_;P++)for(var F=0;F<=b;F++){var L=P%2==1;if(!(0===F&&L||0===F&&C)){var M=P*y+i-w,O=F*m+o+x;if(L&&(O-=p/2),!0===r.triangles)LM([M,O],h/2,c/2,JSON.parse(n),E,S).forEach((function(t){r.mask?PM(r.mask,t)&&T.push(t):T.push(t)}));else{var k=FM([M,O],h/2,c/2,JSON.parse(n),E,S);r.mask?PM(r.mask,k)&&T.push(k):T.push(k)}}}return Cm(T)}(e.box,e.cellSide,i);break;case Zy.square:void 0===(s=i)&&(s={}),n=function(t,e,r,n){void 0===n&&(n={});for(var i=[],o=t[0],s=t[1],a=t[2],l=t[3],u=e/fv([o,s],[a,s],n)*(a-o),h=r/fv([o,s],[o,l],n)*(l-s),c=a-o,A=l-s,f=Math.floor(c/u),p=Math.floor(A/h),d=(A-p*h)/2,g=o+(c-f*u)/2,y=0;y<f;y++){for(var m=s+d,v=0;v<p;v++){var _=bm([[[g,m],[g,m+h],[g+u,m+h],[g+u,m],[g,m]]],n.properties);n.mask?UC(n.mask,_)&&i.push(_):i.push(_),m+=h}g+=u}return Cm(i)}(e.box,o=e.cellSide,o,s);break;case Zy.triangle:n=function(t,e,r){void 0===r&&(r={});for(var n=[],i=e/fv([t[0],t[1]],[t[2],t[1]],r)*(t[2]-t[0]),o=e/fv([t[0],t[1]],[t[0],t[3]],r)*(t[3]-t[1]),s=0,a=t[0];a<=t[2];){for(var l=0,u=t[1];u<=t[3];){var h=null,c=null;s%2==0&&l%2==0?(h=bm([[[a,u],[a,u+o],[a+i,u],[a,u]]],r.properties),c=bm([[[a,u+o],[a+i,u+o],[a+i,u],[a,u+o]]],r.properties)):s%2==0&&l%2==1?(h=bm([[[a,u],[a+i,u+o],[a+i,u],[a,u]]],r.properties),c=bm([[[a,u],[a,u+o],[a+i,u+o],[a,u]]],r.properties)):l%2==0&&s%2==1?(h=bm([[[a,u],[a,u+o],[a+i,u+o],[a,u]]],r.properties),c=bm([[[a,u],[a+i,u+o],[a+i,u],[a,u]]],r.properties)):l%2==1&&s%2==1&&(h=bm([[[a,u],[a,u+o],[a+i,u],[a,u]]],r.properties),c=bm([[[a,u+o],[a+i,u+o],[a+i,u],[a,u+o]]],r.properties)),r.mask?(PM(r.mask,h)&&n.push(h),PM(r.mask,c)&&n.push(c)):(n.push(h),n.push(c)),u+=o,l++}s++,a+=i}return Cm(n)}(e.box,e.cellSide,i)}var o,s;return n.features.forEach(((t,e)=>{let n=kM.to3857(t);n.setProperties({uuid:fm.uuid15(),name:"第"+e+"个"}),r.push(n)})),r}static isobands(t,e,r){const n=cC(t,e,{zProperty:r});return kM.to3857_featureList(n)}static isolines(t,e,r){const n=cC(t,e,{zProperty:r});return kM.to3857_featureList(n)}static randomPolygons(t,e=.0111,r=100){let n=[],i=Math.round(10*Math.random());return i=i<3?3:i,function(t,e){void 0===e&&(e={}),null==t&&(t=1),km(e.num_vertices)&&void 0!==e.num_vertices||(e.num_vertices=10),km(e.max_radial_length)&&void 0!==e.max_radial_length||(e.max_radial_length=10);for(var r=[],n=function(t){var n,i=[],o=TE(Array(e.num_vertices+1)).map(Math.random);o.forEach((function(t,e,r){r[e]=e>0?t+r[e-1]:t})),o.forEach((function(t){t=2*t*Math.PI/o[o.length-1];var r=Math.random();i.push([r*(e.max_radial_length||10)*Math.sin(t),r*(e.max_radial_length||10)*Math.cos(t)])})),i[i.length-1]=i[0],i=i.map((n=PE(e.bbox),function(t){return[t[0]+n[0],t[1]+n[1]]})),r.push(bm([i]))},i=0;i<t;i++)n();return Cm(r)}(r,{bbox:pr(t,"EPSG:3857","EPSG:4326"),num_vertices:i,max_radial_length:e}).features.forEach(((t,e)=>{let r=kM.to3857(t);r.setProperties({style:{fillcolor:dm.getRandomColor(),strokecolor:dm.getRandomColor(),strokewidth:2},uuid:fm.uuid15(),name:"第"+e+"个"}),n.push(r)})),n}static randomPolylines(t,e=.0111,r=100){let n=[],i=Math.round(10*Math.random());i=i<3?3:i;let o=function(t,e){if(void 0===e&&(e={}),!Nm(e=e||{}))throw new Error("options is invalid");var r=e.bbox,n=e.num_vertices,i=e.max_length,o=e.max_rotation;null==t&&(t=1),(!km(n)||void 0===n||n<2)&&(n=10),km(i)&&void 0!==i||(i=1e-4),km(o)&&void 0!==o||(o=Math.PI/8);for(var s=[],a=0;a<t;a++){for(var l=[PE(r)],u=0;u<n-1;u++){var h=(0===u?2*Math.random()*Math.PI:Math.tan((l[u][1]-l[u-1][1])/(l[u][0]-l[u-1][0])))+(Math.random()-.5)*o*2,c=Math.random()*i;l.push([l[u][0]+c*Math.cos(h),l[u][1]+c*Math.sin(h)])}s.push(xm(l))}return Cm(s)}(r,{bbox:pr(t,"EPSG:3857","EPSG:4326"),num_vertices:i,max_length:e});return o.features.forEach(((t,e)=>{let r=kM.to3857(t);r.setProperties({style:{fillcolor:dm.getRandomColor(),strokecolor:dm.getRandomColor(),strokewidth:2},uuid:fm.uuid15(),name:"第"+e+"个"}),n.push(r)})),n}static randomPoints(t,e=100){let r=[];return function(t,e){void 0===e&&(e={}),null==t&&(t=1);for(var r=[],n=0;n<t;n++)r.push(wm(PE(e.bbox)));return Cm(r)}(e,{bbox:pr(t,"EPSG:3857","EPSG:4326")}).features.forEach(((t,e)=>{let n=kM.to3857(t);n.setProperties({style:{fillcolor:dm.getRandomColor(),strokecolor:dm.getRandomColor(),strokewidth:2,radius:8},uuid:fm.uuid15(),name:"第"+e+"个"}),r.push(n)})),r}static formatArea(t,e=!1){const r=Ye(t);if(e)return r;{let t;return t=r>1e5?Math.round(r/1e6*100)/100+" km²":Math.round(100*r)/100+" m²",t}}static transTo3857(t){return pr(t,"EPSG:4326","EPSG:3857")}static transExtentTo4326(t){return pr(t,"EPSG:3857","EPSG:4326")}static getFeatureExtent(t){return t.getGeometry().getExtent()}static getFeatureCoord(t){return t.getGeometry().getCoordinates()}static randomLatLng(t){function e(t,e){return Math.floor(Math.random()*(e-t+1)+t)}let r,n=_m({type:"Polygon",coordinates:[[[114.02709960937501,22.59372606392931],[113.59313964843751,23.03929774776974],[113.48327636718751,22.253512814974744],[110.24230957031251,21.401933838235188],[107.88574218750001,22.522705703482472],[105.27099609375,23.664650731631625],[104.0625,22.998851594142923],[99.93164062500001,22.471954507739227],[98.85498046875001,25.025884063244828],[99.84375,29.065772888415406],[92.57080078125001,28.65203063036226],[85.53955078125001,29.219302076779456],[80.61767578125001,31.690781806136822],[79.69482421875,34.903952965590065],[75.49804687500001,37.26530995561875],[74.95971679687501,39.45316112807394],[81.82617187500001,42.74701217318067],[81.5185546875,44.25306865928177],[84.04541015625001,46.042735653846506],[87.72583007812501,48.026672195436014],[90.5712890625,45.10454630976873],[96.45996093750001,42.32606244456202],[105.71044921875001,41.19518982948959],[112.0166015625,42.84375132629023],[117.02636718750001,45.73685954736049],[120.60791015625,46.55886030311719],[117.83935546875001,48.922499263758255],[122.65136718750001,53.10721669189343],[127.13378906250001,49.53946900793534],[130.97900390625003,47.368594345213374],[134.45068359375003,48.019324184801185],[131.11083984375003,45.521743896993634],[130.51757812500003,43.197167282501276],[126.46362304687501,41.89409955811395],[121.94824218750001,39.26628442213066],[122.54150390625001,40.55554790286314],[121.70654296875001,41.19518982948959],[119.46533203125001,39.985538414809746],[118.64135742187501,39.206718844918505],[117.52075195312501,39.342794408952386],[117.43286132812501,38.41055825094609],[118.56445312500001,37.59682400108367],[119.080810546875,36.96744946416934],[120.81665039062501,37.326488613342086],[122.40966796875001,37.22158045838649],[120.05859375000001,36.35052700542766],[118.88305664062501,35.10193405724608],[120.47607421875001,33.422272258866045],[120.66284179687501,31.784216884487385],[121.81640625000001,30.996445897426373],[120.36621093750001,30.477082932837682],[121.28906250000001,29.19053283229458],[120.30029296875001,27.31321389856826],[119.102783203125,26.52956523826758],[118.45458984375001,24.9163314045991],[116.71875000000001,23.805449612314625],[115.04882812500001,22.84707068783908],[114.02709960937501,22.59372606392931]]]});t?(n=t,r=Zm(n)):r=Zm(t);let i=0,o=0,s=!0;try{do{i=e(1e6*r[0],1e6*r[2])/1e6,o=e(1e6*r[1],1e6*r[3])/1e6,s=cv(wm([i,o]),n)}while(!s);return{lnglat:[i,o],box:this.transTo3857(r)}}catch(UW){}}static shortestPath(t,e,r){let n,i=kM.featureTo4326(t),o=kM.featureTo4326(e);r&&(n={obstacles:kM.featuresTo4326(r.obstacles)});let s=function(t,e,r){if(!Nm(r=r||{}))throw new Error("options is invalid");var n=r.resolution,i=r.minDistance,o=r.obstacles||Cm([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(n&&!km(n)||n<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var s=$m(t),a=$m(e);switch(t=wm(s),e=wm(a),nv(o)){case"FeatureCollection":if(0===o.features.length)return xm([s,a]);break;case"Polygon":o=Cm([_m(rv(o))]);break;default:throw new Error("invalid obstacles")}var l=o;l.features.push(t),l.features.push(e);var u=Zm(function(t,e,r){if(!Nm(r=r||{}))throw new Error("options is invalid");var n=r.origin,i=r.mutate;if(!t)throw new Error("geojson required");var o=Array.isArray(n)||"object"==typeof n;return!0!==i&&(t=vv(t)),"FeatureCollection"!==t.type||o?gC(t,1.15,n):(Qm(t,(function(e,r){t.features[r]=gC(e,1.15,n)})),t)}(function(t,e){void 0===e&&(e={});var r=Number(t[0]),n=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(6===t.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var s=[r,n];return bm([[s,[i,n],[i,o],[r,o],s]],e.properties,{bbox:t,id:e.id})}(Zm(l))));n||(n=fv([u[0],u[1]],[u[2],u[1]],r)/100),l.features.pop(),l.features.pop();for(var h=u[0],c=u[1],A=u[2],f=u[3],p=n/fv([h,c],[A,c],r)*(A-h),d=n/fv([h,c],[h,f],r)*(f-c),g=A-h,y=f-c,m=Math.floor(g/p),v=Math.floor(y/d),_=(g-m*p)/2,w=[],b=[],x=[],C=[],E=1/0,S=1/0,B=f-(y-v*d)/2,I=0;B>=c;){for(var T=[],P=[],F=h+_,L=0;F<=A;){var M=wm([F,B]),O=zC(M,o);T.push(O?0:1),P.push(F+"|"+B);var k=fv(M,t);!O&&k<E&&(E=k,x={x:L,y:I});var N=fv(M,e);!O&&N<S&&(S=N,C={x:L,y:I}),F+=p,L++}b.push(T),w.push(P),B-=d,I++}var R=new GC(b,{diagonal:!0}),U=R.grid[x.y][x.x],D=R.grid[C.y][C.x],Q=QC.search(R,U,D),G=[s];return Q.forEach((function(t){var e=w[t.x][t.y].split("|");G.push([+e[0],+e[1]])})),G.push(a),function(t,e){void 0===e&&(e={});var r="object"==typeof e?e.mutate:e;if(!t)throw new Error("geojson is required");var n=nv(t),i=[];switch(n){case"LineString":i=zv(t);break;case"MultiLineString":case"Polygon":tv(t).forEach((function(t){i.push(zv(t))}));break;case"MultiPolygon":tv(t).forEach((function(t){var e=[];t.forEach((function(t){e.push(zv(t))})),i.push(e)}));break;case"Point":return t;case"MultiPoint":var o={};tv(t).forEach((function(t){var e=t.join("-");Object.prototype.hasOwnProperty.call(o,e)||(i.push(t),o[e]=!0)}));break;default:throw new Error(n+" geometry not supported")}return t.coordinates?!0===r?(t.coordinates=i,t):{type:n,coordinates:i}:!0===r?(t.geometry.coordinates=i,t):_m({type:n,coordinates:i},t.properties,{bbox:t.bbox,id:t.id})}(xm(G))}(i,o,n);return kM.to3857(s)}static lineMerger(t,e=1){let r=kM.featuresTo4326(t),n=[];r.features.forEach((t=>{let e=tv(t);if(xm(e),n.length>0)e[e.length-1][0]===n[n.length-1][0]&&e[e.length-1][1]===n[n.length-1][1]&&(e=e.reverse()),n[n.length-1][0]===e[0][0]&&n[n.length-1][1]===e[0][1]&&e.splice(0,1);else if(r.features.length>1){let t=tv(r.features[1]),n=A_(xm([e[0],e[e.length-1]]),xm([t[0],t[t.length-1]]));n.features[0].geometry.coordinates[0]===e[0][0]&&n.features[0].geometry.coordinates[1]===e[0][1]&&(e=e.reverse())}e.forEach((t=>{n.push(t)}))}));let i=xm(n);return{line:kM.to3857(i),nodeData:kM.lineAttr(n),coordinates:kM.along(n,e)}}static along(t,e){let r=xm(t);e/=1e3;let n=[];n.push(r.geometry.coordinates[0]);const i=w_(r,{units:"kilometers"});for(let o=1;o<=i/e;o++){const t=__(r,o*e,{units:"kilometers"});n.push(t.geometry.coordinates)}return n.push(r.geometry.coordinates[r.geometry.coordinates.length-1]),n}static lineAttr(t){let e=[];for(let r=0;r<t.length;r++){let n={coordIndex:0,distance:0,bearing:0,coords:[]};n.coordIndex=r,r+1<t.length?n.distance=1e3*fv(t[r],t[r+1],{units:"kilometers"}):n.distance=0,n.coords=t[r],e.push(n)}return e}static movePointContain(t,e){let r=new nf,n=xn(t.getGeometry(),128),i=r.writeGeometryObject(n,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"}),o={coordIndex:-1,distance:0,bearing:0,coords:[]};for(let s=0;s<e.length-1;s++)cv(wm(e[s].coords),i)&&(o=e[s]);return o}static arrayDup(t){let e=new Map;return t.forEach((t=>{e.set(JSON.stringify(t),t)})),Array.from(e.values())}static decoratePath(t,e){let r=function(t,e,r){if(!Nm(r=r||{}))throw new Error("options is invalid");var n=r.units,i=r.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return Vm(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,r,n){var i=w_(t,{units:r});if(i<=e)return n(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++)n(x_(t,e*s,e*(s+1),{units:r}))}(t,e,n,(function(t){o.push(t)}))})),Cm(o)}(xm(kM.arrayDup(t)),e,{units:"meters"});return kM.arrayDup(r.features.filter((t=>"Feature"===t.type)).map((t=>t.geometry.coordinates)).flat())}static lineSlice(t,e,r){let n=b_(kM.featureTo4326(t),kM.featureTo4326(e),kM.featureTo4326(r));return kM.to3857(n)}static booleanPointOnLine(t,e){let r=kM.featureTo4326(t),n=kM.featureTo4326(e);return C_($m(r),n)}static booleanCrosses(t,e){return function(t,e){var r=rv(t),n=rv(e),i=r.type,o=n.type;switch(i){case"MultiPoint":switch(o){case"LineString":return BC(r,n);case"Polygon":return TC(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return BC(n,r);case"LineString":return function(t,e){if(A_(t,e).features.length>0)for(var r=0;r<t.coordinates.length-1;r++)for(var n=0;n<e.coordinates.length-1;n++){var i=!0;if(0!==n&&n!==e.coordinates.length-2||(i=!1),PC(t.coordinates[r],t.coordinates[r+1],e.coordinates[n],i))return!0}return!1}(r,n);case"Polygon":return IC(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return TC(n,r);case"LineString":return IC(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}(kM.featureTo4326(t),kM.featureTo4326(e))}static lineIntersect(t,e){let r=kM.featureTo4326(t),n=kM.featureTo4326(e);return kM.to3857_featureList(A_(r,n))}static lineSplit(t,e){let r=kM.featureTo4326(t),n=kM.featureTo4326(e);return kM.to3857(T_(r,n))}static lineCrossesSplit(t,e,r){const n=Sm([]);if(e.length>=1){const i=[];e.forEach((t=>{const e=kM.featureTo4326(t),r=d_(e);r.features.length>0&&r.features.forEach((t=>{n.geometry.coordinates.push(t.geometry.coordinates)}));const o=jm(e);i.push(o)}));const o=d_(Em(i));o.features.length>0&&o.features.forEach((t=>{n.geometry.coordinates.push(t.geometry.coordinates)}));for(let t=0;t<e.length;t++){const i=kM.featureTo4326(e[t]),o=T_(i,n);o.features.length>0&&(e[t].set("classname","del"),o.features.forEach((t=>{r(t,i.properties)})))}t.removeFeatures("del")}}static lineErase(t,e,r,n,i){const o=CM(wm(e),r,{units:"kilometers"});n.forEach((e=>{const r=kM.featureTo4326(e);if(CC(o,r))t.removeFeature(e);else if(!_C(o,r)){Zm(o);const n=T_(r,o);n.features.length>0&&(t.removeFeature(e),n.features.forEach((t=>{if(!CC(o,t)){let r=e.getProperties();e.getGeometry()&&delete r[e.getGeometryName()],i(t,r)}})))}}))}static featureToJson(t){return(new nf).writeFeatureObject(t)}static featureTo4326(t){return(new nf).writeFeatureObject(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static featuresTo4326(t){return(new nf).writeFeaturesObject(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static getCenter(t){return zt(t instanceof W?t.getGeometry().getExtent():t.getExtent())}static to3857(t){return(new nf).readFeature(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static to3857_featureList(t){return(new nf).readFeatures(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static lineClipPolygon(t,e,r,n){e.forEach((e=>{try{const n=kM.geoUtil.polygonClipByLine(kM.featureTo4326(e),kM.featureTo4326(t));r(n)}catch(i){n(i)}}))}static formatJsonTo3857(t){let e;return e=t.crs?"EPSG:3857"===t.crs.properties.name?(new nf).readFeatures(t):"EPSG:4326"===t.crs.properties.name?(new nf).readFeatures(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"}):(new nf).readFeatures(t,{dataProjection:t.crs.properties.name,featureProjection:"EPSG:3857"}):(new nf).readFeatures(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"}),e}};let NM=kM;r(NM,"geoUtil",{unionPolygon:function(t){let e=t[0];for(let r=0;r<t.length;r++)e=TM(e,t[r]);return e},polygonClipByLine:function(t,e){if("Polygon"!==t.geometry.type){if("MultiPolygon"===t.geometry.type){const r=this.multiPolygon2polygons(t);let n=null,i=-1;if(r.forEach((function(t,r){if(2===A_(k_(t),e).features.length){if(n)throw new Error("MultiPolygon只能有一个多边形与切割线存在交点");n=t,i=r}})),-1!==i)return r.splice(i,1),Cm(r.concat(this.polygonClipByLine(n,e).features));throw new Error("MultiPolygon与切割线无交点")}throw new Error("输入的多边形类型为错误")}{const r=k_(t);if("LineString"===r.geometry.type)return this._singlePolygonClip(r,e);if("MultiLineString"===r.geometry.type)return this._multiPolygonClip(r,e)}},_singlePolygonClip:function(t,e){const r=A_(t,e);if(2!==r.features.length)throw new Error("切割线与多边形交点应该为2个,当前交点个数为"+r.features.length);const n=e.geometry.coordinates.length,i=wm(e.geometry.coordinates[0]),o=wm(e.geometry.coordinates[n-1]),s=bm([t.geometry.coordinates]);if(cv(i,s)||cv(o,s))throw new Error("切割线起点或终点不能在 裁剪多边形内部");const a=b_(r.features[0],r.features[1],t),l=b_(r.features[0],r.features[1],e),u=this.connectLine(a,l);u.geometry.coordinates.push(u.geometry.coordinates[0]);const h=U_(u),c=[];if(this.isOnLine(wm(t.geometry.coordinates[0]),a))for(let p=0;p<t.geometry.coordinates.length;p++){const e=t.geometry.coordinates[p];this.isOnLine(wm(e),a)||c.push(e)}else{let e=0,r=!1;for(let n=0;n<t.geometry.coordinates.length;n++){const i=t.geometry.coordinates[n];this.isOnLine(wm(i),a)?r=!0:r?c.push(i):e++}for(let n=0;n<e;n++)c.push(t.geometry.coordinates[n])}const A=xm(c),f=this.connectLine(A,l);return f.geometry.coordinates.push(f.geometry.coordinates[0]),Cm([h,U_(f)])},_multiPolygonClip:function(t,e){let r;const n=[];for(let o=0;o<t.geometry.coordinates.length;o++){const i=xm(t.geometry.coordinates[o]);if(cx(i)){if(r)throw new Error("出现了两个外部多边形无法处理");r=i}else{if(A_(i,e).features.length>0)throw new Error("切割线不能与内环有交点");n.push(i)}}const i=this._singlePolygonClip(r,e);for(let o=0;o<i.features.length;o++)for(let t=0;t<n.length;t++)cv(wm(n[t].geometry.coordinates[0]),i.features[o])&&(i.features[o]=MM(i.features[o],U_(n[t])));return i},connectLine:function(t,e){const r=e.geometry.coordinates.length,n=t.geometry.coordinates[0],i=e.geometry.coordinates[0],o=e.geometry.coordinates[r-1],s=[];for(let a=0;a<t.geometry.coordinates.length;a++){const e=t.geometry.coordinates[a];s.push(e)}fv(n,i)<fv(n,o)&&(e.geometry.coordinates=e.geometry.coordinates.reverse());for(let a=0;a<e.geometry.coordinates.length;a++){const t=e.geometry.coordinates[a];s.push(t)}return xm(s)},isOnLine:function(t,e){for(let r=0;r<e.geometry.coordinates.length;r++){const n=e.geometry.coordinates[r];if(t.geometry.coordinates[0]===n[0]&&t.geometry.coordinates[1]===n[1])return!0}return!1},getIntersectPoints:function(t,e){return A_(t,e)},multiPolygon2polygons:function(t){if("MultiPolygon"!==t.geometry.type)return;const e=[];return t.geometry.coordinates.forEach((t=>{const r={type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[]}};r.geometry.coordinates=t,e.push(r)})),e},polygons2MultiPolygon:function(t){const e={type:"FeatureCollection",features:[{geometry:{coordinates:[],type:"MultiPolygon"},type:"Feature",properties:{}}]};return t.features.forEach((t=>{"Polygon"===t.geometry.type?e.features[0].geometry.coordinates.push(t.geometry.coordinates):t.geometry.coordinates.forEach((t=>{e.features[0].geometry.coordinates.push(t)}))})),e}});const RM=class{static isArray(t){return Array.isArray?Array.isArray(t):"[object Array]"===RM.objToString.call(t)}static isFunction(t){return"function"==typeof t}static isString(t){return"string"==typeof t}static isStringSafe(t){return"[object String]"===RM.objToString.call(t)}static isNumber(t){return"number"==typeof t}static isObject(t){let e=typeof t;return"function"===e||!!t&&"object"===e}static isBuiltInObject(t){return!!RM.BUILTIN_OBJECT[RM.objToString.call(t)]}static isTypedArray(t){return!!RM.TYPED_ARRAY[RM.objToString.call(t)]}static isDom(t){return"object"==typeof t&&"number"==typeof t.nodeType&&"object"==typeof t.ownerDocument}static isGradientObject(t){return null!==t.colorStops}static isImagePatternObject(t){return null!==t.image}static isRegExp(t){return"[object RegExp]"===RM.objToString.call(t)}static isPrimitive(t){return t[RM.primitiveKey]}};let UM=RM;r(UM,"BUILTIN_OBJECT",{"[object Function]":!0,"[object RegExp]":!0,"[object Date]":!0,"[object Error]":!0,"[object CanvasGradient]":!0,"[object CanvasPattern]":!0,"[object Image]":!0,"[object Canvas]":!0}),r(UM,"TYPED_ARRAY",{"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}),r(UM,"primitiveKey","__ec_primitive__"),r(UM,"objToString",Object.prototype.toString);const DM=class{static merge(t,e,r){if(!UM.isObject(e)||!UM.isObject(t))return r?DM.clone(e):t;for(let n in e)if(e.hasOwnProperty(n)&&n!==DM.protoKey){let i=t[n],o=e[n];!UM.isObject(o)||!UM.isObject(i)||UM.isArray(o)||UM.isArray(i)||UM.isDom(o)||UM.isDom(i)||UM.isBuiltInObject(o)||UM.isBuiltInObject(i)||UM.isPrimitive(o)||UM.isPrimitive(i)?!r&&n in t||(t[n]=DM.clone(e[n])):DM.merge(i,o,r)}return t}static clone(t){if(null===t||"object"!=typeof t)return t;let e=t,r=UM.objToString.call(t);if("[object Array]"===r){if(!UM.isPrimitive(t)){e=[];for(let r=0,n=t.length;r<n;r++)e[r]=DM.clone(t[r])}}else if(UM.TYPED_ARRAY[r]){if(!UM.isPrimitive(t)){let r=t.constructor;if(r.from)e=r.from(t);else{e=new r(t.length);for(let r=0,n=t.length;r<n;r++)e[r]=DM.clone(t[r])}}}else if(!UM.BUILTIN_OBJECT[r]&&!UM.isPrimitive(t)&&!UM.isDom(t)){e={};for(let r in t)t.hasOwnProperty(r)&&r!==DM.protoKey&&(e[r]=DM.clone(t[r]))}return e}};let QM=DM;function GM(t){let e,r="";for(e in t)t[e]&&String(t[e])&&(r+=`&${e}=${t[e]}`);return r&&(r="?"+r.slice(1)),r}r(QM,"protoKey","__proto__");const jM=Object.freeze(Object.defineProperty({__proto__:null,SecondToHHMMSS:function(t){let e=parseInt(t),r=0,n=0;e>60&&(r=Math.floor(e/60),e=Math.floor(e%60),r>60&&(n=Math.floor(r/60),r=Math.floor(r%60)));let i=Math.floor(e)+"秒";return r>0&&(i=Math.floor(r)+"分"+i),n>0&&(i=Math.floor(n)+"小时"+i),i},ToDegree:function(t=0,e=0,r=0,n=6){return(t+e/60+r/3600).toFixed(n=n>6?6:n)},ToDegreeMinuteSecond:function(t){let e;if(e="number"==typeof t?String(t):t,void 0===e||""===e)return{degree:0,minute:0,second:0};let r=e.indexOf("."),n=r<0?e:e.substring(0,r),i="0",o="0";return r>0&&(i="0"+e.substring(r),i=60*parseFloat(i)+"",r=i.indexOf("."),r>0&&(o="0"+i.substring(r),i=i.substring(0,r),o=60*parseFloat(o)+"",r=o.indexOf("."),o=o.substring(0,r+4),o=parseFloat(o).toFixed(2))),{degree:parseInt(n),minute:parseInt(i),second:parseFloat(o)}},formatDistance:function(t){let e="";return e=t?t>=1e3?(t/1e3).toFixed(2)+"公里":t+"米":"0米",e},paramsToUrl:GM},Symbol.toStringTag,{value:"Module"}));function HM(t){return async function(t){return(await fetch(t,{method:"GET",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer"})).json()}(t)}const zM=Object.freeze(Object.defineProperty({__proto__:null,fetchJson:HM,format:jM,isutil:UM,json:QM},Symbol.toStringTag,{value:"Module"}));var VM=function(t){var e,r;t||(t={});var n=this.canvas_=document.createElement("canvas"),i=(Number(t.scale)>0?Number(t.scale):1)*at||at,o=n.getContext("2d");if(t.image){t.image.load();var s=t.image.getImage();if(s.width)n.width=Math.round(s.width*i),n.height=Math.round(s.height*i),o.globalAlpha="number"==typeof t.opacity?t.opacity:1,o.drawImage(s,0,0,s.width,s.height,0,0,n.width,n.height),e=o.createPattern(n,"repeat");else{var a=this;e=[0,0,0,0],s.onload=function(){n.width=Math.round(s.width*i),n.height=Math.round(s.height*i),o.globalAlpha="number"==typeof t.opacity?t.opacity:1,o.drawImage(s,0,0,s.width,s.height,0,0,n.width,n.height),e=o.createPattern(n,"repeat"),a.setColor(e)}}}else{var l=this.getPattern_(t);if(n.width=Math.round(l.width*i),n.height=Math.round(l.height*i),o.beginPath(),t.fill&&(o.fillStyle=jn(t.fill.getColor()),o.fillRect(0,0,n.width,n.height)),o.scale(i,i),o.lineCap="round",o.lineWidth=l.stroke||1,o.fillStyle=jn(t.color||"#000"),o.strokeStyle=jn(t.color||"#000"),l.circles)for(r=0;r<l.circles.length;r++){var u=l.circles[r];o.beginPath(),o.arc(u[0],u[1],u[2],0,2*Math.PI),l.fill&&o.fill(),l.stroke&&o.stroke()}if(l.repeat||(l.repeat=[[0,0]]),l.char&&(o.font=l.font||l.width+"px Arial",o.textAlign="center",o.textBaseline="middle",l.angle?(o.fillText(l.char,l.width/4,l.height/4),o.fillText(l.char,5*l.width/4,5*l.height/4),o.fillText(l.char,l.width/4,5*l.height/4),o.fillText(l.char,5*l.width/4,l.height/4),o.fillText(l.char,3*l.width/4,3*l.height/4),o.fillText(l.char,-l.width/4,-l.height/4),o.fillText(l.char,3*l.width/4,-l.height/4),o.fillText(l.char,-l.width/4,3*l.height/4)):o.fillText(l.char,l.width/2,l.height/2)),l.lines)for(r=0;r<l.lines.length;r++)for(var h=0;h<l.repeat.length;h++){var c=l.lines[r];o.beginPath(),o.moveTo(c[0]+l.repeat[h][0],c[1]+l.repeat[h][1]);for(var A=2;A<c.length;A+=2)o.lineTo(c[A]+l.repeat[h][0],c[A+1]+l.repeat[h][1]);l.fill&&o.fill(),l.stroke&&o.stroke(),o.save(),o.strokeStyle="red",o.strokeWidth=.1,o.restore()}if(e=o.createPattern(n,"repeat"),t.offset){var f=t.offset;if("number"==typeof f&&(f=[f,f]),f instanceof Array){var p=Math.round(f[0]*i),d=Math.round(f[1]*i);o.scale(1/i,1/i),o.clearRect(0,0,n.width,n.height),o.translate(p,d),o.fillStyle=e,o.fillRect(-p,-d,n.width,n.height),e=o.createPattern(n,"repeat")}}}t.color=e,kn.call(this,t)};cm(VM,kn),VM.prototype.clone=function(){var t=Tn.prototype.clone.call(this);return t.canvas_=this.canvas_,t},VM.prototype.getImage=function(){return this.canvas_},VM.prototype.getPattern_=function(t){var e,r=Am.prototype.patterns[t.pattern]||Am.prototype.patterns.dot,n=Math.round(t.spacing)||10;switch(t.pattern){case"dot":case"circle":e=0===t.size?0:t.size/2||2,t.angle?(n=r.width=r.height=Math.round(1.4*n),r.circles=[[n/4,n/4,e],[3*n/4,3*n/4,e]],"circle"==t.pattern&&(r.circles=r.circles.concat([[n/4+n,n/4,e],[n/4,n/4+n,e],[3*n/4-n,3*n/4,e],[3*n/4,3*n/4-n,e],[n/4+n,n/4+n,e],[3*n/4-n,3*n/4-n,e]]))):(r.width=r.height=n,r.circles=[[n/2,n/2,e]],"circle"==t.pattern&&(r.circles=r.circles.concat([[n/2+n,n/2,e],[n/2-n,n/2,e],[n/2,n/2+n,e],[n/2,n/2-n,e],[n/2+n,n/2+n,e],[n/2+n,n/2-n,e],[n/2-n,n/2+n,e],[n/2-n,n/2-n,e]])));break;case"tile":case"square":e=0===t.size?0:t.size/2||2,t.angle?(r.width=r.height=n,r.lines=[[n/2-e,n/2,n/2,n/2-e,n/2+e,n/2,n/2,n/2+e,n/2-e,n/2]]):(r.width=r.height=n,r.lines=[[n/2-e,n/2-e,n/2+e,n/2-e,n/2+e,n/2+e,n/2-e,n/2+e,n/2-e,n/2-e]]),"square"==t.pattern&&(r.repeat=[[0,0],[0,n],[n,0],[0,-n],[-n,0],[-n,-n],[n,n],[-n,n],[n,-n]]);break;case"cross":t.angle&&(t.angle=45);case"hatch":var i=Math.round(((t.angle||0)-90)%360);i>180&&(i-=360),i*=Math.PI/180;var o=Math.cos(i),s=Math.sin(i);if(Math.abs(s)<1e-4)r.width=r.height=n,r.lines=[[0,.5,n,.5]],r.repeat=[[0,0],[0,n]];else if(Math.abs(o)<1e-4)r.width=r.height=n,r.lines=[[.5,0,.5,n]],r.repeat=[[0,0],[n,0]],"cross"==t.pattern&&(r.lines.push([0,.5,n,.5]),r.repeat.push([0,n]));else{var a=r.width=Math.round(Math.abs(n/s))||1,l=r.height=Math.round(Math.abs(n/o))||1;"cross"==t.pattern?(r.lines=[[-a,-l,2*a,2*l],[2*a,-l,-a,2*l]],r.repeat=[[0,0]]):o*s>0?(r.lines=[[-a,-l,2*a,2*l]],r.repeat=[[0,0],[a,0],[0,l]]):(r.lines=[[2*a,-l,-a,2*l]],r.repeat=[[0,0],[-a,0],[0,l]])}r.stroke=0===t.size?0:t.size||4}return r};class KM{constructor(){r(this,"data"),r(this,"pi"),r(this,"x_pi"),r(this,"a"),r(this,"ee"),_y(),wy(kd),this.data=[],this.data.push({dh:13,wkid:4502}),this.data.push({dh:14,wkid:4503}),this.data.push({dh:15,wkid:4504}),this.data.push({dh:16,wkid:4505}),this.data.push({dh:17,wkid:4506}),this.data.push({dh:18,wkid:4507}),this.data.push({dh:19,wkid:4508}),this.data.push({dh:20,wkid:4509}),this.data.push({dh:21,wkid:4510}),this.data.push({dh:22,wkid:4511}),this.data.push({dh:23,wkid:4512}),this.data.push({dh:75,wkid:4534}),this.data.push({dh:78,wkid:4535}),this.data.push({dh:81,wkid:4536}),this.data.push({dh:84,wkid:4537}),this.data.push({dh:87,wkid:4538}),this.data.push({dh:90,wkid:4539}),this.data.push({dh:93,wkid:4540}),this.data.push({dh:96,wkid:4541}),this.data.push({dh:99,wkid:4542}),this.data.push({dh:102,wkid:4543}),this.data.push({dh:105,wkid:4544}),this.data.push({dh:108,wkid:4545}),this.data.push({dh:111,wkid:4546}),this.data.push({dh:114,wkid:4547}),this.data.push({dh:117,wkid:4548}),this.data.push({dh:120,wkid:4549}),this.data.push({dh:123,wkid:4550}),this.data.push({dh:126,wkid:4551}),this.data.push({dh:129,wkid:4552}),this.data.push({dh:132,wkid:4553}),this.data.push({dh:135,wkid:4554}),this.pi=3.141592653589793,this.x_pi=52.35987755982988,this.a=6378245,this.ee=.006693421622965943}ConvertToMapCoord(t,e){return{Coord3857:this.ConvertCoordinatesTo3857(t,e),Coord4326:this.ConvertCoordinatesTo4326(t,e)}}ConvertCoordinatesTo3857(t,e){return-1===t.toUpperCase().indexOf("EPSG:")&&(t="EPSG:"+t),kd(t,"EPSG:3857",e)}ConvertCoordinatesTo4326(t,e){return-1===t.toUpperCase().indexOf("EPSG:")&&(t="EPSG:"+t),kd(t,"EPSG:4326",e)}formatJsonTo3857(t){let e;return e="EPSG:3857"===t.crs.properties.name?(new nf).readFeatures(t):"EPSG:4326"===t.crs.properties.name?(new nf).readFeatures(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"}):(new nf).readFeatures(t,{dataProjection:t.crs.properties.name,featureProjection:"EPSG:3857"}),e}formatJsonTo4326Json(t){let e,r=new nf;return e="EPSG:4326"===t.crs.properties.name?r.readFeatures(t):"EPSG:3857"===t.crs.properties.name?r.readFeatures(t,{dataProjection:"EPSG:3857",featureProjection:"EPSG:4326"}):r.readFeatures(t,{dataProjection:t.crs.properties.name,featureProjection:"EPSG:4326"}),r.writeFeaturesObject(e)}formatJsonToPoint(t){let e=this.formatJsonTo3857(t),r=[];return e.forEach((t=>{switch(t.getGeometry().getType()){case"Polygon":r.push(new W({geometry:t.getGeometry().getInteriorPoint(),properties:t.getProperties().properties}));break;case"Point":r.push(t)}})),r}LnglatToCGCS2000(t,e,r=3){let n,i;return n=3===r?3*parseInt(((t+1.5)/3).toString()):6*parseInt(((t+6)/6).toString())-3,this.data.forEach((t=>{t.dh!==n||(i=t.wkid)})),i?kd("EPSG:4326","EPSG:"+i,[t,e]):[0,0]}ConvertWebMercatorToCGCS2000(t,e,r=3){let n=ur([t,e]);return this.LnglatToCGCS2000(n[0],n[1],r)}webMktToLngLat(t){return ur(t)}lngLatToWebMkt(t){return lr(t)}transformLat(t,e){let r=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.pi)+20*Math.sin(2*t*this.pi))/3,r+=2*(20*Math.sin(e*this.pi)+40*Math.sin(e/3*this.pi))/3,r+=2*(160*Math.sin(e/12*this.pi)+320*Math.sin(e*this.pi/30))/3,r}transformLon(t,e){let r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.pi)+20*Math.sin(2*t*this.pi))/3,r+=2*(20*Math.sin(t*this.pi)+40*Math.sin(t/3*this.pi))/3,r+=2*(150*Math.sin(t/12*this.pi)+300*Math.sin(t/30*this.pi))/3,r}transform(t,e){if(this.outOfChina(t,e))return[t,e];let r=this.transformLat(e-105,t-35),n=this.transformLon(e-105,t-35),i=t/180*this.pi,o=Math.sin(i);o=1-this.ee*o*o;let s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.pi),n=180*n/(this.a/s*Math.cos(i)*this.pi),[t+r,e+n]}outOfChina(t,e){return e<72.004||e>137.8347||t<.8293||t>55.8271}wgs84ToGcj02(t,e){if(this.outOfChina(t,e))return{lat:t,lon:e};let r=this.transformLat(e-105,t-35),n=this.transformLon(e-105,t-35),i=t/180*this.pi,o=Math.sin(i);o=1-this.ee*o*o;let s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.pi),n=180*n/(this.a/s*Math.cos(i)*this.pi),{mgLat:t+r,mgLon:e+n}}gcj02ToWgs84(t,e){let r=this.transform(t,e),n=2*e-r[1];return{latitude:2*t-r[0],lontitude:n}}gcj02ToBd09(t,e){let r=e,n=t,i=Math.sqrt(r*r+n*n)+2e-5*Math.sin(n*this.x_pi),o=Math.atan2(n,r)+3e-6*Math.cos(r*this.x_pi),s=i*Math.cos(o)+.0065;return{tempLat:i*Math.sin(o)+.006,tempLon:s}}bd09ToGcj02(t,e){let r=e-.0065,n=t-.006,i=Math.sqrt(r*r+n*n)-2e-5*Math.sin(n*this.x_pi),o=Math.atan2(n,r)-3e-6*Math.cos(r*this.x_pi),s=i*Math.cos(o);return{tempLat:i*Math.sin(o),tempLon:s}}wgs84ToBd09(t,e){let r=this.wgs84ToGcj02(t,e);return this.gcj02ToBd09(r[0],r[1])}bd09_To_gps84(t,e){let r=this.bd09ToGcj02(t,e),n=this.gcj02ToWgs84(r[0],r[1]);return n[0]=n[0].toFixed(6),n[1]=n[1].toFixed(6),n}}class qM extends W{constructor(t){super(),r(this,"option"),r(this,"Proj"),this.option={graphicType:"baseGraphic",lnglat:[0,0],dataWkID:Yy.EPSG3857,tooltipOption:{offset:[0,0]},popupOption:{offset:[0,0]},style:{text:{font:"14px Microsoft YaHei",text:"",fill:{color:"#8B4513"},stroke:{color:"rgba(255, 255, 255,1)",width:2},backgroundFill:{color:"rgba(255, 255, 255, 0.0)"},backgroundStroke:{color:"rgba(0, 0, 0, 0.0)",width:2},padding:[3,3,3,3],offsetX:0,offsetY:-10,textBaseline:"bottom"},image:{scale:1,radius:5,fill:{color:"rgba(255, 0, 0,1)"},stroke:{color:"rgba(255, 255, 0,1)",width:1}},stroke:{color:"rgba(255, 255, 0,1)",width:2,lineDash:null,pattern:void 0,image:void 0,ratio:1,patternColor:"rgba(0, 0, 0,1)",offset:0,scale:1,size:5,spacing:10,angle:0},fill:{patternColor:"rgba(0, 0, 0,1)",color:"rgba(255, 255, 255,0.2)",pattern:void 0,image:void 0,ratio:1,offset:0,scale:1,size:5,spacing:10,angle:0},imageOption:{},zIndex:999,radius:0,startAngle:0,stopAngle:0,rotation:0},attribute:null},this.option=QM.merge(this.option,t,!0),this.Proj=new KM,this.setStyle(new Gi({zIndex:this.option.style.zIndex}))}setAttribute(t){let e=QM.merge(this.getProperties(),t,!0);this.setProperties(e)}toGeoJSON(){return(new nf).writeGeometryObject(this.getGeometry(),{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}bindPopup(t,e={offset:[0,0]}){this.option.popupInfo=t,this.option.popupOption=e}bindTooltip(t,e={offset:[0,0]}){this.option.tooltipInfo=t,this.option.tooltipOption=e}isPopupBind(){return!!this.option.popupInfo}isTooltipBind(){return!!this.option.tooltipInfo}openPopup(t,e){t&&(this.option.popupInfo=t),e&&(this.option.popupOption=e),this.dispatchEvent({type:"graphicPopopOpen",data:this.option.popupInfo,option:this.option.popupOption})}closePopup(){this.dispatchEvent({type:"graphicPopopClose",data:this.option.popupInfo})}openTooltip(t,e){t&&(this.option.tooltipInfo=t),e&&(this.option.tooltipOption=e),this.dispatchEvent({type:"graphicTooltipOpen",data:this.option.tooltipInfo,option:this.option.tooltipOption})}chaikin_copy(t,e){return t[0]=e[0],t[1]=e[1],t}chaikin_smooth_line(t,e=[]){Array.isArray(e)||(e=[]),t.length>0&&e.push(this.chaikin_copy([0,0],t[0]));for(let r=0;r<t.length-1;r++){let n=t[r],i=t[r+1],o=n[0],s=n[1],a=i[0],l=i[1],u=[.75*o+.25*a,.75*s+.25*l],h=[.25*o+.75*a,.25*s+.75*l];e.push(u),e.push(h)}return t.length>1&&e.push(this.chaikin_copy([0,0],t[t.length-1])),e}chaikin_smooth_polygon(t,e=[]){Array.isArray(e)||(e=[]);for(let r=0;r<t.length-1;r++){let n=t[r],i=t[r+1],o=n[0],s=n[1],a=i[0],l=i[1],u=[.75*o+.25*a,.75*s+.25*l],h=[.25*o+.75*a,.25*s+.75*l];e.push(u),e.push(h)}return e.push(e[0]),e}smoothFunc(t,e=5,r=!0){let n=Math.min(Math.max(e||5,1),10);for(;n>0;)t=r?this.chaikin_smooth_line(t):this.chaikin_smooth_polygon(t),n--;return t}setSmooth(t=5,e=!0){if(e){let r=this.getGeometry(),n=r.getCoordinates();r.setCoordinates(this.smoothFunc(n,t,e))}else{let r=this.getGeometry(),n=r.getCoordinates()[0];r.setCoordinates([this.smoothFunc(n,t,e)])}}setTextStyle(t){var e;t=QM.merge(this.option.style.text,t,!0);let r=new zi({text:t.text,font:t.font,fill:new Tn({color:t.fill.color}),stroke:new kn({color:t.stroke.color,width:t.stroke.width}),backgroundFill:new Tn({color:t.backgroundFill.color}),backgroundStroke:new kn({color:t.backgroundStroke.color,width:t.backgroundStroke.width}),padding:t.padding,textBaseline:t.textBaseline,offsetX:t.offsetX,offsetY:t.offsetY});null==(e=this.getStyle())||e.setText(r),this.option.style.text=t}setSquarePointStyle(t={}){var e;t=QM.merge(this.option.style.image,t,!0);let r=new Mi({scale:t.scale,radius:t.radius,points:4,angle:Math.PI/4,fill:new Tn({color:t.fill.color}),stroke:new kn({color:t.stroke.color,width:t.stroke.width})});null==(e=this.getStyle())||e.setImage(r),this.option.style.image=t}setTrianglePointStyle(t={}){var e;t=QM.merge(this.option.style.image,t,!0);let r=new Mi({scale:t.scale,radius:t.radius,points:3,angle:t.angle?t.angle:0,rotation:t.rotation?t.rotation:Math.PI,displacement:[0,0],fill:new Tn({color:t.fill.color}),stroke:new kn({color:t.stroke.color,width:t.stroke.width})});null==(e=this.getStyle())||e.setImage(r),this.option.style.image=t}setStarPointStyle(t={}){var e;t=QM.merge(this.option.style.image,t,!0);let r=new Mi({scale:t.scale,radius:t.radius,points:5,radius2:t.radius/2.5,angle:t.angle?t.angle:0,rotation:t.rotation?t.rotation:Math.PI,displacement:[0,0],fill:new Tn({color:t.fill.color}),stroke:new kn({color:t.stroke.color,width:t.stroke.width})});null==(e=this.getStyle())||e.setImage(r),this.option.style.image=t}setCirclePointStyle(t={}){var e;t=QM.merge(this.option.style.image,t,!0);let r=new ki({scale:t.scale,radius:t.radius,fill:new Tn({color:t.fill.color}),stroke:new kn({color:t.stroke.color,width:t.stroke.width})});null==(e=this.getStyle())||e.setImage(r),this.option.style.image=t}setStrokeSimpleStyle(t){t=QM.merge(this.option.style.stroke,t,!0);let e=new kn({color:t.color,width:t.width,lineDash:t.lineDash});this.getStyle().setStroke(e),this.option.style.stroke=t}setStrokePatternStyle(t){t=QM.merge(this.option.style.stroke,t,!0);let e=new VM({pattern:t.pattern,image:t.image?new ms({src:t.image}):void 0,ratio:t.ratio,color:t.patternColor,offset:t.offset,scale:t.scale,fill:new Tn({color:t.color}),size:t.size,spacing:t.spacing,angle:t.angle,width:t.width,lineDash:t.lineDash});this.getStyle().setStroke(e),this.option.style.stroke=t}setFillColor(t){var e;null==(e=this.getStyle())||e.setFill(new Tn({color:t})),this.option.style.fill.color=t}setFillPatternStyle(t){t=QM.merge(this.option.style.fill,t,!0);let e=new Am({pattern:t.pattern,image:void 0,ratio:t.ratio,color:t.patternColor,offset:t.offset,scale:t.scale,size:t.size,spacing:t.spacing,angle:t.angle,fill:new Tn({color:t.color})});this.getStyle().setFill(e),this.option.style.fill=t}setFillImageStyle(t){this.option.style.fill.image=t;const e=document.createElement("canvas").getContext("2d"),r=new Image;r.src=t,r.onload=()=>{this.getStyle().setFill(new Tn({color:e.createPattern(r,"repeat")}))}}setZIndex(t){this.option.style.zIndex=t,this.getStyle().setZIndex(t)}getCoordinates(t="3857"){let e=this.getGeometry().clone();return"4326"===t&&e.transform("EPSG:3857","EPSG:4326"),e.getCoordinates()}getGraphicJson(t="3857"){let e=this.getProperties();return this.getGeometry()&&delete e[this.getGeometryName()],{type:this.option.graphicType,lnglat:this.getCoordinates(t),dataWkID:t,style:this.option.style,attribute:e}}}class WM extends qM{constructor(t){let e;if(super(t),this.option.graphicType="PointGraphic",this.option=QM.merge(this.option,t,!0),0!==this.option.lnglat[0])switch(this.option.dataWkID){case Yy.EPSG4326:this.setGeometry(new rn(lr(this.option.lnglat)));break;case Yy.EPSG3857:this.setGeometry(new rn(this.option.lnglat));break;case Yy.BAIDU:e=this.Proj.bd09_To_gps84(this.option.lnglat[0],this.option.lnglat[1]),this.setGeometry(new rn([e.lontitude,e.latitude]));break;case Yy.GCJ02:e=this.Proj.gcj02ToWgs84(this.option.lnglat[0],this.option.lnglat[1]),this.setGeometry(new rn([e.lontitude,e.latitude]));break;case Yy.CGCS2000_GK_CM_6:break;default:this.setGeometry(new rn(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,this.option.lnglat)))}this.option.attribute&&this.setProperties(this.option.attribute),this.setTextStyle(this.option.style.text),this.option.style.image.scale>0&&this.setCirclePointStyle(this.option.style.image)}setCoordinates(t,e,r=Yy.EPSG4326){let n=this.getGeometry();this.option.dataWkID===Yy.EPSG4326?n.setCoordinates(lr([t,e])):this.option.dataWkID===Yy.EPSG3857?n.setCoordinates([t,e]):n.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}}class XM extends qM{constructor(t){let e;if(super(t),this.option.graphicType="ImagePointGraphic",0!==this.option.lnglat[0])switch(this.option.dataWkID){case Yy.EPSG4326:this.setGeometry(new rn(lr(t.lnglat)));break;case Yy.EPSG3857:this.setGeometry(new rn(t.lnglat));break;case Yy.BAIDU:e=this.Proj.bd09_To_gps84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new rn([e.lontitude,e.latitude]));break;case Yy.GCJ02:e=this.Proj.gcj02ToWgs84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new rn([e.lontitude,e.latitude]));break;default:this.setGeometry(new rn(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,t.lnglat)))}if(this.option.attribute&&this.setProperties(this.option.attribute),"gif"===this.option.style.imageOption.type){const t=gifler(this.option.style.imageOption.src);let e=document.createElement("canvas");t.frames(e,((t,e)=>{this.getStyle()||this.setStyle(new Gi({image:new ms({img:t.canvas,imgSize:[e.width,e.height],opacity:.8})})),t.clearRect(0,0,e.width,e.height),t.drawImage(e.buffer,e.x,e.y),this.option.style.imageOption.maprender()}),!0)}else this.setTextStyle(this.option.style.text),this.setPointIconStyle(this.option.style.imageOption)}setPointIconStyle(t){this.option.style.imageOption=t;let e=new ms(this.option.style.imageOption);e.load(),this.getStyle().setImage(e)}setCoordinates(t,e,r=Yy.EPSG4326){let n=this.getGeometry();this.option.dataWkID===Yy.EPSG4326?n.setCoordinates(lr([t,e])):this.option.dataWkID===Yy.EPSG3857?n.setCoordinates([t,e]):n.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}setRotation(t){this.getStyle().getImage().setRotation(t),this.changed()}}class YM extends qM{constructor(t){super(t),this.option.graphicType="LineGraphic",0!==this.option.lnglat[0]&&this.setCoordinates(this.option.lnglat,this.option.dataWkID),this.option.attribute&&this.setProperties(this.option.attribute),this.option.style.stroke.image||this.option.style.stroke.pattern?this.setStrokePatternStyle(this.option.style.stroke):this.setStrokeSimpleStyle(this.option.style.stroke)}getGraphicJson(t="3857"){let e;e=this.option.style.stroke.image||this.option.style.stroke.pattern?{pattern:this.option.style.stroke.pattern,image:this.option.style.stroke.image,ratio:this.option.style.stroke.ratio,patternColor:this.option.style.stroke.patternColor,offset:this.option.style.stroke.offset,scale:this.option.style.stroke.scale,color:this.option.style.stroke.color,size:this.option.style.stroke.size,spacing:this.option.style.stroke.spacing,angle:this.option.style.stroke.angle,width:this.option.style.stroke.width,lineDash:this.option.style.stroke.lineDash}:{color:this.option.style.stroke.color,width:this.option.style.stroke.width,lineDash:this.option.style.stroke.lineDash};let r=this.getProperties();return this.getGeometry()&&delete r[this.getGeometryName()],{type:"LineGraphic",lnglat:this.getCoordinates(t),dataWkID:t,style:{stroke:e,text:this.option.style.text},attribute:r}}setCoordinates(t,e="4326"){switch(this.option.lnglat=t,this.option.dataWkID=e,e){case Yy.EPSG4326:this.setGeometry(new On(this.option.lnglat).transform("EPSG:4326","EPSG:3857"));break;case Yy.EPSG3857:this.setGeometry(new On(this.option.lnglat));break;case Yy.BAIDU:this.option.lnglat.forEach(((t,e)=>{let r=this.Proj.bd09_To_gps84(t[0],t[1]);this.option.lnglat[e]=[r.lontitude,r.latitude]})),this.setGeometry(new On(this.option.lnglat));break;case Yy.GCJ02:this.option.lnglat.forEach(((t,e)=>{let r=this.Proj.gcj02ToWgs84(t[0],t[1]);this.option.lnglat[e]=[r.lontitude,r.latitude]})),this.setGeometry(new On(this.option.lnglat));break;default:this.option.lnglat.forEach(((t,e)=>{this.option.lnglat[e]=this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,t)})),this.setGeometry(new On(this.option.lnglat))}}lineStyle(){let t=[];for(let e=0;e<10;e++)t.push(new Gi({stroke:new kn({color:[0,255,255,1/(10-e)],width:2*(10-e)-1}),fill:new Tn({color:"rgba(0, 0, 255, 0.05)"})}));return t}}class ZM extends qM{constructor(t){if(super(t),this.option.graphicType="PolygonGraphic",0!==this.option.lnglat[0])switch(this.option.dataWkID){case Yy.EPSG4326:this.setGeometry(new wn(this.option.lnglat).transform("EPSG:4326","EPSG:3857"));break;case Yy.EPSG3857:this.setGeometry(new wn(this.option.lnglat));break;case Yy.BAIDU:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.bd09_To_gps84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new wn(this.option.lnglat));break;case Yy.GCJ02:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.gcj02ToWgs84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new wn(this.option.lnglat));break;default:this.option.lnglat.forEach((t=>{t.forEach(((e,r)=>{t[r]=this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,e)}))})),this.setGeometry(new wn(this.option.lnglat))}this.option.attribute&&this.setProperties(this.option.attribute),this.setPolygonStyle(this.option.style)}setPolygonStyle(t){t.stroke.pattern?this.setStrokePatternStyle(t.stroke):this.setStrokeSimpleStyle(t.stroke),t.fill.pattern?this.setFillPatternStyle(t.fill):t.fill.image?this.setFillImageStyle(t.fill.image):this.setFillColor(t.fill.color),this.setTextStyle(t.text)}setCoordinates(t,e=Yy.EPSG4326){switch(this.option.lnglat=t,this.option.dataWkID=e,this.option.dataWkID){case Yy.EPSG4326:this.setGeometry(new wn(this.option.lnglat).transform("EPSG:4326","EPSG:3857"));break;case Yy.EPSG3857:this.setGeometry(new wn(this.option.lnglat));break;case Yy.BAIDU:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.bd09_To_gps84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new wn(this.option.lnglat));break;case Yy.GCJ02:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.gcj02ToWgs84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new wn(this.option.lnglat));break;default:this.option.lnglat.forEach((t=>{t.forEach(((e,r)=>{t[r]=this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,e)}))})),this.setGeometry(new wn(this.option.lnglat))}}setGeometryFromExtent(t){this.setGeometry(bn(t))}}const JM=Object.freeze(Object.defineProperty({__proto__:null,CurveGraphic:class extends qM{constructor(t){super(t),this.option.graphicType="CurveGraphic",0!==this.option.lnglat[0]&&this.setCoordinates(this.option.lnglat,this.option.dataWkID),this.option.attribute&&this.setProperties(this.option.attribute),this.setStrokeSimpleStyle(this.option.style.stroke),this.setFillColor(this.option.style.fill.color),this.setTextStyle(this.option.style.text)}setAngle(t,e){this.option.dataWkID===Yy.EPSG4326?this.setGeometry(this.createRegularPolygonCurve(this.option.lnglat,this.option.style.radius,t,e,this.option.style.rotation)):this.option.dataWkID===Yy.EPSG3857?this.setGeometry(this.createRegularPolygonCurve(ur(this.option.lnglat),this.option.style.radius,t,e,this.option.style.rotation)):this.setGeometry(this.createRegularPolygonCurve(this.Proj.ConvertCoordinatesTo4326(this.option.dataWkID,this.option.lnglat),this.option.style.radius,t,e,this.option.style.rotation))}setCoordinates(t,e="4326"){switch(this.option.lnglat=t,this.option.dataWkID=e,this.option.dataWkID){case Yy.EPSG4326:this.setGeometry(this.createRegularPolygonCurve(this.option.lnglat,this.option.style.radius,this.option.style.startAngle,this.option.style.stopAngle,this.option.style.rotation));break;case Yy.EPSG3857:this.setGeometry(this.createRegularPolygonCurve(ur(this.option.lnglat),this.option.style.radius,this.option.style.startAngle,this.option.style.stopAngle,this.option.style.rotation));break;case Yy.BAIDU:case Yy.GCJ02:break;default:this.setGeometry(this.createRegularPolygonCurve(this.Proj.ConvertCoordinatesTo4326(this.option.dataWkID,this.option.lnglat),this.option.style.radius,this.option.style.startAngle,this.option.style.stopAngle,this.option.style.rotation))}}createRegularPolygonCurve(t,e,r,n,i){let o=NM.sector(t,e,r,n).getGeometry();return o.rotate(i,lr(t)),o}},DivGraphic:class extends fl{constructor(t){let e,n=fm.uuid15(),i=document.createElement("div");if(i.setAttribute("id",n),super({id:n,element:i}),r(this,"option"),r(this,"Proj"),r(this,"handlers"),r(this,"elementDiv"),this.handlers={},this.elementDiv=i,this.option={html:"<div></div>",positioning:om.bottomleft,hashMove:!1,enabledRightMenu:!0,enabledPopup:!1,enabledTooltip:!1,contextmenu:[{text:"开始编辑对象",icon:"img/marker.png",callback:t=>{"开始编辑对象"===this.option.contextmenu[0].text?(this.option.contextmenu[0].text="停止编辑对象",this.startEdit()):(this.option.contextmenu[0].text="开始编辑对象",this.endEdit())}},{text:"删除对象",icon:"img/marker.png",callback:t=>{this.remove()}}],attribute:{}},this.option=QM.merge(this.option,t,!0),this.Proj=new KM,this.elementDiv.innerHTML=this.option.html,this.setPositioning(this.option.positioning),0!==this.option.coordinate[0])switch(this.option.dataWkID){case Yy.EPSG4326:this.setPosition(lr(this.option.coordinate));break;case Yy.EPSG3857:this.setPosition(this.option.coordinate);break;case Yy.BAIDU:e=this.Proj.bd09_To_gps84(this.option.coordinate[0],this.option.coordinate[1]),this.setPosition([e.lontitude,e.latitude]);break;case Yy.GCJ02:e=this.Proj.gcj02ToWgs84(this.option.coordinate[0],this.option.coordinate[1]),this.setPosition([e.lontitude,e.latitude]);break;case Yy.CGCS2000_GK_CM_6:break;default:this.setPosition(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,this.option.coordinate))}this._bindPoupEvent(),this.on(jy.onFeatureContextmenu,(t=>{this._setFeatureContextmenu(t.data.contextmenu)})),this.element.addEventListener("mousedown",(t=>{this.option.hashMove?(this.set("isDragging",!0),this.set("dragStart",[t.x,t.y])):(0===t.button&&this.option.enabledPopup&&this.openPopup(),this.trigger(jy.onClick,t))}));let o=!1;this.element.addEventListener("mousemove",(t=>{o||this.option.enabledTooltip&&(this.showTooltip(),o=!0)})),this.element.addEventListener("mouseout",(t=>{o=!1,this.option.enabledTooltip&&this.closeTooltip()})),this.on("change:element",(t=>{})),this.on("change:position",(t=>{this.trigger(jy.onChangePosition,{oldVal:t.oldValue,newVal:t.target.getPosition()})})),this.on("change:map",(t=>{void 0===t.oldValue&&(this.getMap().on("pointermove",(t=>{if(this.option.hashMove&&this.get("isDragging")){let e=this.get("dragStart"),r=this.getMap().getCoordinateFromPixel(e),n=t.coordinate,i=r[0]-n[0],o=r[1]-n[1],s=[this.getPosition()[0]-i,this.getPosition()[1]-o];this.setPosition(s),this.set("dragStart",t.pixel)}})),this.getMap().getViewport().addEventListener("mouseup",(t=>{this.option.hashMove&&this.set("isDragging",!1)})))}))}_setFeatureContextmenu(t){this.option.enabledRightMenu&&(t.clear(),this.option.contextmenu.length>0&&t.extend(this.option.contextmenu))}show(){this.element.classList.remove("mirage-hide")}hide(){this.element.classList.add("mirage-hide")}startEdit(){this.element.classList.add("mirage-edit-marker-selected"),this.option.hashMove=!0,this.trigger(jy.onEditStart,{})}endEdit(){this.element.classList.remove("mirage-edit-marker-selected"),this.option.hashMove=!1,this.set("isDragging",!1),this.trigger(jy.onEditEnd,{})}remove(){this.trigger(jy.onFeatureDeleted,{}),this.getMap().removeOverlay(this)}setCoordinates(t,e,r=Yy.EPSG4326){this.option.coordinate=[t,e],this.option.dataWkID===Yy.EPSG4326?this.setPosition(lr([t,e])):this.option.dataWkID===Yy.EPSG3857?this.setPosition([t,e]):this.setPosition(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}unbindContextmenu(){this.option.enabledRightMenu=!1}appendContextmenu(t){t.forEach((t=>{this.option.contextmenu.push(t)}))}bindPopup(t,e={offset:[0,0]}){this.option.enabledPopup=!0,this.option.popupInfo=t,this.option.popupOption=e}unbindPopup(){this.option.enabledPopup=!1,this.closePopup()}openPopup(){if(this.option.enabledPopup&&this.option.popupInfo){let t="";if("string"==typeof this.option.popupInfo?t=this.option.popupInfo:this.option.popupInfo.forEach((e=>{e.dataType===this.option.attribute.dataType&&e.showContent.forEach((e=>{e.type?t+=e.html:t+=e.name+":"+this.option.attribute[e.field]+"<br>"}))})),""!==t){let e=this.getPosition(),r=document.getElementById("popup-content");r&&(r.innerHTML=t),this.getMap().getOverlayById("popup").setPosition(e),this.getMap().getOverlayById("popup").setOffset(this.option.popupOption.offset),this.trigger(jy.onFeaturePopupOpen,{element:document.getElementById("popup-content"),data:this.option.attribute})}}}closePopup(t){this.getMap().getOverlayById("popup").setPosition(void 0),this.trigger(jy.onFeaturePopupClose,{element:document.getElementById("popup-content"),data:t})}_bindPoupEvent(){let t=document.getElementById("popup-closer");t&&(t.onclick=()=>{this.closePopup()})}bindTooltip(t,e={offset:[0,0]}){this.option.enabledTooltip=!0,this.option.tooltipInfo=t,this.option.tooltipOption=e}unbindTooltip(){this.option.enabledTooltip=!1,this.closeTooltip()}showTooltip(){if(this.option.enabledTooltip&&this.option.tooltipInfo){let t="";if("string"==typeof this.option.tooltipInfo?t=this.option.tooltipInfo:this.option.tooltipInfo.forEach((e=>{e.dataType===this.option.attribute.dataType&&e.showContent.forEach((e=>{e.type?t+=e.html:t+=e.name+":"+this.option.attribute[e.field]+"<br>"}))})),""!==t){let e=this.getPosition(),r=document.getElementById("tooltip-content");r&&(r.innerHTML=t),this.getMap().getOverlayById("tooltip").setPosition(e),this.getMap().getOverlayById("tooltip").setOffset(this.option.tooltipOption.offset),this.trigger(jy.onFeatureTooltipOpen,{element:document.getElementById("tooltip-content"),data:this.option.attribute})}}}closeTooltip(){this.getMap().getOverlayById("tooltip").setPosition(void 0),this.trigger(jy.onFeatureTooltiClose,{element:document.getElementById("tooltip-content"),data:""})}_on(t,e){return this.handlers[t]||(this.handlers[t]=[]),this.handlers[t].push(e),this}off(t,e){let r=this.handlers[t];for(let n=0;n<r.length;n++)if(r[n]===e){r.splice(n,1);break}return this}onec(t,e,r){let n=this;return this._on(t,(function i(){n.off(t,i),e.apply(r||n,arguments)})),this}trigger(t,e){this.handlers.hasOwnProperty(t)&&this.handlers[t].forEach((t=>{t.call(this,e)}))}},ImagePointGraphic:XM,LabelGraphic:class extends qM{constructor(t){let e;if(super(t),this.option.graphicType="LabelGraphic",0!==this.option.lnglat[0])switch(this.option.dataWkID){case Yy.EPSG4326:this.setGeometry(new rn(lr(t.lnglat)));break;case Yy.EPSG3857:this.setGeometry(new rn(t.lnglat));break;case Yy.BAIDU:e=this.Proj.bd09_To_gps84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new rn([e.lontitude,e.latitude]));break;case Yy.GCJ02:e=this.Proj.gcj02ToWgs84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new rn([e.lontitude,e.latitude]));break;default:this.setGeometry(new rn(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,t.lnglat)))}this.option.attribute&&this.setProperties(this.option.attribute),this.setStyle(new Gi({zIndex:this.option.style.zIndex})),this.setTextStyle(this.option.style.text),this.option.style.image.scale>0&&this.setTrianglePointStyle(this.option.style.image)}setCoordinates(t,e,r=Yy.EPSG4326){let n=this.getGeometry();this.option.dataWkID===Yy.EPSG4326?n.setCoordinates(lr([t,e])):this.option.dataWkID===Yy.EPSG3857?n.setCoordinates([t,e]):n.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}},LineGraphic:YM,PointGraphic:WM,PolygonGraphic:ZM},Symbol.toStringTag,{value:"Module"}));class $M extends Ky{constructor(t,e){super(t,e),r(this,"_graphicLayerSelect"),r(this,"selectFeature"),r(this,"_modify"),r(this,"_translate"),r(this,"_snap"),r(this,"_source"),r(this,"_draw"),r(this,"_tipPoint");let n={autoPointSize:!1,enabledRightMenu:!1,enabledPopup:!1,enabledTooltip:!1,imageRatio:5,zIndex:500,contextmenu:[{classname:"menudisabled",text:"操作",icon:"img/marker.png",items:[{text:"移动",icon:"img/marker.png",callback:t=>{this.startMove()}},{classname:"menudisabled",text:"编辑",icon:"img/marker.png",callback:t=>{this.startEdit()}},{text:"删除",icon:"img/marker.png",callback:t=>{this._source.removeFeature(this.selectFeature)}}]},{text:"保存为kml",icon:"img/marker.png",callback:t=>{fm.saveTokml(NM.featureTo4326(this.selectFeature),"文件.kml")}}],hashEdit:!1,hashMove:!1,hashSelect:!0,declutter:!1};this.option=Object.assign({},n,this.option),this._source=new Ks({wrapX:!1}),this._source.on("featuresloadstart",(t=>{this.trigger(jy.onLoadStart,t)})),this._source.on("featuresloadend",(t=>{this.trigger(jy.onFeaturesLoad,t)})),this._source.on("featuresloaderror",(t=>{this.trigger(jy.onLoadError,t)})),this._source.on("removefeature",(t=>{t.feature&&this.trigger(jy.onFeatureDeleted,t.feature.getProperties())})),this._source.on("addfeature",(t=>{t.feature&&(t.feature.on("mousemove",(t=>{t.target.get("editstate")||("function"==typeof t.target.isTooltipBind&&t.target.isTooltipBind()?t.target.openTooltip():(this.showTooltip(t.target),this.trigger(jy.onFeatureMousemove,{data:t.target})))})),t.feature.on("mouseout",(t=>{this.closeTooltip(),this.trigger(jy.onFeatureMouseout,{data:t.target})})),t.feature.on("graphicPopopOpen",(t=>{this.showPopup(t.target,t.data,t.option)})),t.feature.on("graphicPopopClose",(t=>{this.closePopup(t.target)})),t.feature.on("graphicTooltipOpen",(t=>{this._showTooltip2(t.target,t.data,t.option)})))})),this._on(jy.onFeatureSelected,(t=>{this.showTooltip(t.target),this.trigger(jy.onFeatureMousemove,t)})),this._bindPoupEvent()}initSelect(){var t,e,r,n;this._graphicLayerSelect=new nh({layers:[this.layer],condition:jl,style:t=>{const e=t.getGeometry().getType();let r;return r=dm.getStyle(e,{fillcolor:"rgba(0,191,255,0.1)",strokewidth:5,strokecolor:"rgba(0,191,255,1)"}),r},filter:function(t,e){if(e)return"ClusterImageLayer"!==e.get("layertype")&&!!t.get("editallows")}}),this._modify=new Ju({features:this._graphicLayerSelect.getFeatures(),snapToPointer:!0,style:dm.getEditPointStyle});const i=this._modify.getOverlay().getSource();this.layer instanceof da?this._snap=new ah({source:this.layer.getLayers[0].getSource(),pixelTolerance:10}):this._snap=new ah({source:this.layer.getSource(),pixelTolerance:10}),this._graphicLayerSelect.on("select",(t=>{t.selected[0]?t.selected[0].set("editstate",!0):t.deselected[0].set("editstate",!1)})),i.on(["addfeature","removefeature"],(function(t){})),this._modify.on("modifystart",(t=>{let e=t.target.features_.array_[0];this.trigger(jy.onEditModifyStart,{data:e})})),this._modify.on("modifyend",(t=>{let e=t.target.features_.array_[0];this.trigger(jy.onEditModifyEnd,{data:e})})),this._modify.on("change:active",(t=>{let e=t.target.features_.array_[0];t.target.get("active")?(this.trigger(jy.onEditStart,{data:e}),t.target.features_.forEach((function(t){if(t.set("editstate",!0),(t.getGeometry().getType()===Wy.Polygon||t.getGeometry().getType()===Wy.Line)&&t.getStyle()[0]!==dm.getEditPolygonStyle()[0])return t.setStyle(dm.getEditPolygonStyle()),void(t.getStyle()[0].text_.text_=t.get("name"))}))):(this.selectFeature&&this.selectFeature.set("editstate",!1),this.trigger(jy.onEditEnd,{data:e}))})),this._translate=new hh({layers:[this.layer]}),this._translate.on("translateend",(t=>{this.trigger(jy.onFeatureMoved,t.features.getArray()[0].getProperties())})),this._graphicLayerSelect.setActive(!0),this._translate.setActive(!1),this._modify.setActive(!1),null==(t=this._map)||t.addInteraction(this._graphicLayerSelect),null==(e=this._map)||e.addInteraction(this._modify),null==(r=this._map)||r.addInteraction(this._snap),null==(n=this._map)||n.addInteraction(this._translate),this.option.hashMove&&this._translate.setActive(!0)}setSelectState(t=!0){this.option.hashSelect=t,this._graphicLayerSelect.setActive(t)}startMove(){this.option.hashMove=!0,this._translate.setActive(!0)}endMove(){this.option.hashMove=!1,this._translate.setActive(!1)}startEdit(){this.option.hashEdit=!0,this._graphicLayerSelect.setActive(!1),this._modify.setActive(!0)}endEdit(){this.option.hashEdit=!1,this._graphicLayerSelect.setActive(!1),this._modify.setActive(!1)}bindContextmenu(t){this.option.enabledRightMenu=!0,t&&(this.option.contextmenu=t)}unbindContextmenu(){this.option.enabledRightMenu=!1}appendContextmenu(t){t.forEach((t=>{this.option.contextmenu.push(t)}))}_setFeatureContextmenu(t,e){this.option.enabledRightMenu&&(e.clear(),this.selectFeature=t,this.option.contextmenu.forEach((e=>{e.data={SelectedFeature:t}})),this.option.contextmenu.length>0&&e.extend(this.option.contextmenu))}showTitle(t,e,r="name"){new Promise((()=>{this.layer.getSource().getFeatures().forEach((n=>{let i=n.getProperties();if(t===i.dataType)try{n.getStyle().getText().setText(e?n.get(r):"")}catch(UW){}})),this.layer.changed()}))}showTitleByClassname(t,e,r="name"){this.layer.getSource().forEachFeature((n=>{let i=n.getProperties();t===i.dataType&&(n.getStyle().getText().setText(e?n.get(r):""),n.changed())}))}showTitleByField(t,e,r,n="name"){this.layer.getSource().forEachFeature((i=>{let o=i.getProperties()[t];e===o&&(i.getStyle().getText().setText(r?i.get(n):""),i.changed())}))}_bindPoupEvent(){let t=document.getElementById("popup-closer");t&&(t.onclick=()=>{this.closePopup()})}bindPopup(t,e={offset:[0,0]}){this.option.enabledPopup=!0,t&&(this.option.popupInfo=t),this.option.popupOption=e}unbindPopup(){this.option.enabledPopup=!1,this.closePopup()}openPopup(t,e,r={offset:[0,0]}){if(e&&(this.option.popupInfo=e),this.option.enabledPopup&&this.option.popupInfo){let e="";if("string"==typeof this.option.popupInfo)e=this.option.popupInfo;else{let r=t.getProperties();this.option.popupInfo.forEach((t=>{t.dataType===r.dataType&&t.showContent.forEach((t=>{t.type?e+=t.html:e+=t.name+":"+r[t.field]+"<br>"}))}))}""!==e&&this.showPopup(t,e,r)}}showPopup(t,e,r){var n,i;let o=zt(t.getGeometry().getExtent()),s=document.getElementById("popup-content");s&&(s.innerHTML=e),null==(n=this._map)||n.getOverlayById("popup").setPosition(o),null==(i=this._map)||i.getOverlayById("popup").setOffset(r.offset),this.trigger(jy.onFeaturePopupOpen,{element:document.getElementById("popup-content"),data:t})}closePopup(t){var e;null==(e=this._map)||e.getOverlayById("popup").setPosition(void 0),this.trigger(jy.onFeaturePopupClose,{element:document.getElementById("popup-content"),data:t})}bindTooltip(t,e={offset:[0,0]}){this.option.enabledTooltip=!0,t&&(this.option.tooltipInfo=t),this.option.tooltipOption=e}unbindTooltip(){this.option.enabledTooltip=!1,this.closeTooltip()}showTooltip(t){if(this.option.enabledTooltip&&this.option.tooltipInfo){let e="";if("string"==typeof this.option.tooltipInfo)e=this.option.tooltipInfo;else{let r=t.getProperties();this.option.tooltipInfo.forEach((t=>{t.dataType===r.dataType&&t.showContent.forEach((t=>{t.type?e+=t.html:e+=t.name+":"+r[t.field]+"<br>"}))}))}""!==e&&this._showTooltip2(t,e,this.option.tooltipOption)}}_showTooltip2(t,e,r){var n,i;let o=zt(t.getGeometry().getExtent()),s=document.getElementById("tooltip-content");s&&(s.innerHTML=e),null==(n=this._map)||n.getOverlayById("tooltip").setPosition(o),null==(i=this._map)||i.getOverlayById("tooltip").setOffset(r.offset),this.trigger(jy.onFeatureTooltipOpen,{element:document.getElementById("tooltip-content"),data:t})}closeTooltip(){var t;null==(t=this._map)||t.getOverlayById("tooltip").setPosition(void 0),this.trigger(jy.onFeatureTooltiClose,{element:document.getElementById("tooltip-content"),data:""})}addGeoJson(t,e){this.addFeatures(t,this.formatJsonTo3857(e))}addGeoJsonPoint(t,e){this.addFeatures(t,this.formatJsonToPoint(e))}convertGeoJsontoFeatures(t){return this.formatJsonTo3857(t)}addFeatures(t,e,r,n){this.trigger(jy.onLoadStart,t),e.forEach((e=>{let i=this._getFeatureAttribute(t),o=QM.merge(e.getProperties(),i,!1);r&&(o=QM.merge(o,r,!0)),e.setProperties(o),e.set("classname",t);let s=e.getStyle();if(s||(s=e.get("style")?dm.getStyle(e.getGeometry().getType(),e.get("style")):dm.getStyle(e.getGeometry().getType(),{}),e.setStyle(s)),n){let t=n(e.getProperties());s=dm.getStyle(e.getGeometry().getType(),t)}"探方"!==e.get("dataType")&&"新增探方"!==e.get("dataType")||e.get("name")&&s.getText()&&s.getText().setText(e.get("name")+"\n"+e.get("负责人"))})),this._source.addFeatures(e),this._source.changed()}_getFeatureAttribute(t="default"){return{classname:t,uuid:fm.uuid15(),editallows:!0,editstate:!1,movestate:!0,featuretype:qy.vector,dataType:""}}addFeature(t,e,r,n){this.trigger(jy.onLoadStart,t);let i=this._getFeatureAttribute(t),o=QM.merge(e.getProperties(),i,!1);r&&(o=QM.merge(o,r,!0)),e.setProperties(o),e.set("classname",t);let s=e.getStyle();if(!s){let t=e.get("style");if(t){if(s=dm.getStyle(e.getGeometry().getType(),t),n){let t=n(e.getProperties());s=dm.getStyle(e.getGeometry().getType(),t)}e.setStyle(s)}}this._source.addFeature(e)}setFeaturesAttribute(t){this._source.getFeatures().forEach((e=>{if(t){let r=QM.merge(e.getProperties(),t,!0);e.setProperties(r)}}))}setFeaturesAttributeByClassName(t,e){this.getFeaturesByClassName(t).forEach((t=>{if(e){let r=QM.merge(t.getProperties(),e,!0);t.setProperties(r)}}))}setFeatureAttribute(t,e){let r=this.getFeatureByUid(t);if(e){let t=QM.merge(r.getProperties(),e,!0);r.setProperties(t)}}getFeaturesAll(){return this._source.getFeatures()}getFeaturesByFieldName(t,e){let r=[];return this._source.getFeatures().forEach((n=>{n.get(t)===e&&r.push(n)})),r}getFeaturesByClassName(t){let e=[];return this._source.getFeatures().forEach((r=>{r.get("classname")===t&&e.push(r)})),e}getFeatures(t){let e=[];return this._source.getFeatures().forEach((r=>{r.get("name")===t&&e.push(r)})),e}getFeature(t){let e=null;return this._source.getFeatures().forEach((r=>{r.get("name")!==t||(e=r)})),e}getFeatureByUid(t){let e=null;return this._source.getFeatures().forEach((r=>{r.get("uuid")!==t||(e=r)})),e}removeFeature(t){"string"==typeof t?this._source.getFeatures().forEach((e=>{e.get("uuid")===t&&this._source.removeFeature(e)})):this._source.removeFeature(t)}removeFeatures(t){this._source.getFeatures().forEach((e=>{try{e.get("classname").replaceAll(" ","")===t.replaceAll(" ","")&&this._source.removeFeature(e)}catch(UW){}}))}removeFeaturesByJson(t){this._source.getFeatures().forEach((e=>{let r=0;for(let n=0;n<t.name.length;n++)try{e.get(t.name[n].replace(/\s*/g,"")).replace(/\s*/g,"")===t.value[n].replace(/\s*/g,"")&&r++}catch(UW){}r===t.name.length&&this._source.removeFeature(e)}))}replaceField(t){let e;if(/\{[^}]+\}/g.test(t)){let r=/\{(.*?)\}/g;return e=t.match(r)[0].replace("{","").replace("}",""),e}return t}setSymbol(t,e){this._source.getFeatures().forEach((r=>{let n=dm.getStyle(r.getGeometry().getType(),t);if(t.text){let e=this.replaceField(t.text);e!==t.text&&n.getText().setText(r.getProperties()[e])}if(e){let t=e(r.getProperties());n=dm.getStyle(r.getGeometry().getType(),t)}r.setStyle(n)}))}setSymbolLevelColor(t){let e=[],r=0,n=0;void 0!==t.autolevel&&null!==t.autolevel||(t.autolevel=!0);let i=[{maxnum:0,fillcolor:"rgba(255,255,255,0.1)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.2)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.4)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.6)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.8)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,1)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1}];if(t.levelColor&&(i=t.levelColor),t.autolevel){let o=i.length;this._source.getFeatures().forEach((r=>{let n=r.get(t.attributeName);n&&e.push(parseInt(n))})),r=Math.max(...e),n=r/o,i.forEach(((t,e)=>{t.maxnum=n*e}))}return i.sort((function(t,e){return e.maxnum-t.maxnum})),this._source.getFeatures().forEach((e=>{if(e.get("classname")===t.classname){let r=e.get(t.attributeName);if(r)if(0===parseInt(r)){let t=dm.getStyle(e.getGeometry().getType(),{fillcolor:"rgba(255,255,255,0)",strokecolor:"rgba(255,255,255,0.1)",strokewidth:.1});e.setStyle(t)}else for(let t=0;t<i.length;t++)if(parseFloat(r)>i[t].maxnum){let r=dm.getStyle(e.getGeometry().getType(),{fillcolor:i[t].fillcolor,strokecolor:i[t].strokecolor,strokewidth:i[t].strokewidth});e.setStyle(r);break}}})),i}setSymbolByClassname(t,e,r){this._source.getFeatures().forEach((n=>{if(n.get("classname")===t){let t=dm.getStyle(n.getGeometry().getType(),e);if(e.text){let r=this.replaceField(e.text);r!==e.text&&t.getText().setText(n.getProperties()[r])}if(r){let e=r(n.getProperties());t=dm.getStyle(n.getGeometry().getType(),e)}n.setStyle(t)}}))}setSymbolByFeatures(t,e,r){t.forEach((t=>{let n=dm.getStyle(t.getGeometry().getType(),e);if(e.text){let r=this.replaceField(e.text);r!==e.text&&n.getText().setText(t.getProperties()[r])}if(r){let e=r(t.getProperties());n=dm.getStyle(t.getGeometry().getType(),e)}t.setStyle(n),t.changed()}))}setSymbolByStyleClass(t){this._source.getFeatures().forEach((e=>{t.forEach((t=>{if(e.get(t.className)===t.classValue){let r=dm.getStyle(e.getGeometry().getType(),t.style);if(t.style.text){let n=this.replaceField(t.style.text);n!==t.style.text&&r.getText().setText(e.getProperties()[n])}e.setStyle(r)}}))}))}setClassSymbol(t,e){this._source.getFeatures().forEach((r=>{r.get("classname")===t&&e.forEach((t=>{if(r.get(t.className)===t.classValue){let e=dm.getStyle(r.getGeometry().getType(),t.style);if(t.style.text){let n=this.replaceField(t.style.text);n!==t.style.text&&e.getText().setText(r.getProperties()[n])}r.setStyle(e)}}))}))}setFeaturesTileByJson(t,e){this._source.getFeatures().forEach((r=>{let n=r.get("featureStyle");r.get("dataType")===t&&(e&&r.get("name")?"探方"===r.get("dataType")?n.getText()&&n.getText().setText(r.get("name")+"\n"+r.get("负责人")):n.getText()&&n.getText().setText(r.get("name")):n.getText()&&n.getText().setText(""))}))}clear(){this._source.clear()}startDraw(t){var e;let r=t.type;t.attribute=Object.assign(this._getFeatureAttribute(),t.attribute),t.geometryFunction=null,t.type===Wy.Rectangle&&(r=Wy.Circle,t.geometryFunction=function(t,e,r){var n=xt([t[0],t[t.length-1]].map((function(t){return wr(t)}))),i=[[jt(n),Ht(n),Zt(n),Yt(n),jt(n)]],o=e;return o?o.setCoordinates(i):o=new wn(i),o}),t.style=t.style?t.style:{};const n=t.type===Wy.Circle||t.type===Wy.Rectangle?"移动到所需位置,单击结束绘制":"单击继续绘制,双击结束绘制"+(t.type===Wy.Polygon?"多边形":"线"),i="点击任意位置开始绘制";let o=i;this._draw=new Gu({type:r,geometryFunction:t.geometryFunction,freehand:t.freehand||!1,style:e=>{const r=e.getGeometry(),n=null==r?void 0:r.getType();let i=null;if(i=[dm.getStyle(t.type,t.style)],o&&"Point"===n&&!this._modify.getOverlay().getSource().getFeatures().length){this._tipPoint=r;let t=dm.getTipStyle();t.getText().setText(o),i.push(t)}return i}}),null==(e=this._map)||e.addInteraction(this._draw),this._draw.on("drawstart",(t=>{o=n,this.trigger(jy.onDrawStart,t)})),this._draw.on("drawend",(e=>{var r,n;o=i,null==(r=this._draw)||r.setActive(!1),null==(n=this._map)||n.removeInteraction(this._draw),setTimeout((()=>{this.changeGraphicData(t,e.feature)}),100)}))}changeGraphicData(t,e){for(let i in t.style)""===t.style[i].toString()&&delete t.style[i];let r,n;switch(t.type){case Wy.Circle:n=Object.assign({},dm.getDefaultPolygonStyle(),t.style),r=new ZM({lnglat:xn(e.getGeometry(),128).getCoordinates(),dataWkID:Yy.EPSG3857,style:{stroke:{color:n.strokecolor,width:n.strokewidth,lineDash:n.strokelineDash},fill:{color:n.fillcolor}},attribute:t.attribute});break;case Wy.Polygon:case Wy.Rectangle:n=Object.assign({},dm.getDefaultPolygonStyle(),t.style),r=new ZM({lnglat:e.getGeometry().getCoordinates(),dataWkID:Yy.EPSG3857,style:{stroke:{color:n.strokecolor,width:n.strokewidth,lineDash:n.strokelineDash},fill:{color:n.fillcolor}},attribute:t.attribute});break;case Wy.Line:n=Object.assign({},dm.getDefaulLineStyle(),t.style),r=new YM({lnglat:e.getGeometry().getCoordinates(),dataWkID:Yy.EPSG3857,style:{stroke:{color:n.strokecolor,width:n.strokewidth,lineDash:n.strokelineDash}},attribute:t.attribute});break;case Wy.Point:n=Object.assign({},dm.getDefaultPointStyle(),t.style),r=n.imageOption?new XM({lnglat:e.getGeometry().getCoordinates(),dataWkID:Yy.EPSG3857,style:{text:{font:n.Font,text:n.text,fill:{color:n.FontColor},stroke:{color:n.FontStrokeColor,width:n.FontStrokeWidth}},imageOption:n.imageOption,zIndex:999},attribute:Object.assign({},t.attribute,{movestate:!1,editallows:!1})}):new WM({lnglat:e.getGeometry().getCoordinates(),dataWkID:Yy.EPSG3857,style:{text:{font:n.Font,text:n.text,fill:{color:n.FontColor},stroke:{color:n.FontStrokeColor,width:n.FontStrokeWidth}},image:{scale:n.scale,radius:n.radius,fill:{color:n.fillcolor},stroke:{color:n.strokecolor,width:n.strokewidth}},zIndex:999},attribute:Object.assign({},t.attribute,{movestate:!1,editallows:!1})})}t.attribute.classname?this.addFeature(t.attribute.classname,r):this.addFeature("temp",r),t.success&&t.success(r),this.trigger(jy.onDrawEnd,r)}appendTo(t){var e;this._map=t,this.layer&&(null==(e=this._map)||e.addLayer(this.layer),this.isAdded=!0),this.initSelect(),this._map.on("singleclick",(t=>{var e;if(this.option.hashSelect){this._modify.setActive(!1),this._graphicLayerSelect.setActive(!0);const r=null==(e=this._map)?void 0:e.forEachFeatureAtPixel(t.pixel,(function(t,e){return{feature:t,layer:e}}));r&&r.feature}})),this.trigger("appendToEnd",{})}toGeoJSON(){return(new nf).writeFeaturesObject(this.layer.getSource().getFeatures(),{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}}class tO extends $M{constructor(t,e){super(t,e),new Gi({fill:new Tn({color:"#eeeeee"})}),this.layertype="GraphicImageLayer",this.layer=new gf({imageRatio:this.option.imageRatio,source:this._source,zIndex:this.option.zIndex,declutter:this.option.declutter}),this.layer.set("layerid",t),this.layer.on(this.EventType.featureType.onFeatureContextmenu,(t=>{this._setFeatureContextmenu(t.data.feature,t.data.contextmenu)})),this.layer.on("sourceready",(t=>{this.trigger(jy.onLoadEnd,t)})),this._on("onClickTolayer",(t=>{"function"==typeof t.isPopupBind&&t.isPopupBind()?t.openPopup():this.option.enabledPopup&&this.openPopup(t,this.option.popupInfo,this.option.popupOption)}))}}var eO=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const rO=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;void 0!==n.interpolate&&(i=n.interpolate);var o=void 0!==n.projection?n.projection:"EPSG:3857",s=void 0!==n.tileGrid?n.tileGrid:NA({extent:UA(o),maxResolution:n.maxResolution,maxZoom:n.maxZoom,minZoom:n.minZoom,tileSize:n.tileSize});return(r=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,interpolate:i,opaque:n.opaque,projection:o,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileGrid:s,tileLoadFunction:n.tileLoadFunction,tilePixelRatio:n.tilePixelRatio,tileUrlFunction:n.tileUrlFunction,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition,attributionsCollapsible:n.attributionsCollapsible,zDirection:n.zDirection})||this).gutter_=void 0!==n.gutter?n.gutter:0,r}return eO(e,t),e.prototype.getGutter=function(){return this.gutter_},e}(lf);var nO=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const iO=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,wrapX:e.wrapX})||this;return r.resolution=void 0,r.distance=void 0!==e.distance?e.distance:20,r.minDistance=e.minDistance||0,r.interpolationRatio=0,r.features=[],r.geometryFunction=e.geometryFunction||function(t){var e=t.getGeometry();return K("Point"==e.getType(),10),e},r.createCustomCluster_=e.createCluster,r.source=null,r.boundRefresh_=r.refresh.bind(r),r.updateDistance(r.distance,r.minDistance),r.setSource(e.source||null),r}return nO(e,t),e.prototype.clear=function(e){this.features.length=0,t.prototype.clear.call(this,e)},e.prototype.getDistance=function(){return this.distance},e.prototype.getSource=function(){return this.source},e.prototype.loadFeatures=function(t,e,r){this.source.loadFeatures(t,e,r),e!==this.resolution&&(this.resolution=e,this.refresh())},e.prototype.setDistance=function(t){this.updateDistance(t,this.minDistance)},e.prototype.setMinDistance=function(t){this.updateDistance(this.distance,t)},e.prototype.getMinDistance=function(){return this.minDistance},e.prototype.setSource=function(t){this.source&&this.source.removeEventListener(P.CHANGE,this.boundRefresh_),this.source=t,t&&t.addEventListener(P.CHANGE,this.boundRefresh_),this.refresh()},e.prototype.refresh=function(){this.clear(),this.cluster(),this.addFeatures(this.features)},e.prototype.updateDistance=function(t,e){var r=0===t?0:Math.min(e,t)/t,n=t!==this.distance||this.interpolationRatio!==r;this.distance=t,this.minDistance=e,this.interpolationRatio=r,n&&this.refresh()},e.prototype.cluster=function(){if(void 0!==this.resolution&&this.source)for(var t=[1/0,1/0,-1/0,-1/0],e=this.distance*this.resolution,r=this.source.getFeatures(),n={},i=0,o=r.length;i<o;i++){var a=r[i];if(!(s(a)in n)){var l=this.geometryFunction(a);if(l){Mt(l.getCoordinates(),t),Ct(t,e,t);var u=this.source.getFeaturesInExtent(t).filter((function(t){var e=s(t);return!(e in n)&&(n[e]=!0,!0)}));this.features.push(this.createCluster(u,t))}}}},e.prototype.createCluster=function(t,e){for(var r=[0,0],n=t.length-1;n>=0;--n){var i=this.geometryFunction(t[n]);i?ke(r,i.getCoordinates()):t.splice(n,1)}Qe(r,1/t.length);var o=zt(e),s=this.interpolationRatio,a=new rn([r[0]*(1-s)+o[0]*s,r[1]*(1-s)+o[1]*s]);return this.createCustomCluster_?this.createCustomCluster_(a,t):new W({geometry:a,features:t})},e}(Ks);var oO=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const sO=function(t){function e(e){var r=this,n=void 0===e.projection?"EPSG:3857":e.projection,i=e.tileGrid;if(void 0===i&&n&&(i=NA({extent:UA(n),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize})),(r=t.call(this,{cacheSize:.1,attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:n,tileGrid:i,opaque:e.opaque,state:e.state,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate})||this).gutter_=void 0!==e.gutter?e.gutter:0,r.tileSize_=e.tileSize?Un(e.tileSize):null,!r.tileSize_&&e.tilePixelRatio&&i){var o=Un(i.getTileSize(0));r.tileSize_=[o[0]*e.tilePixelRatio,o[1]*e.tilePixelRatio]}return r.tileSizes_=null,r.tileLoadingKeys_={},r.loader_=e.loader,r.handleTileChange_=r.handleTileChange_.bind(r),r.bandCount=void 0===e.bandCount?4:e.bandCount,r}return oO(e,t),e.prototype.setTileSizes=function(t){this.tileSizes_=t},e.prototype.getTileSize=function(t){if(this.tileSizes_)return this.tileSizes_[t];if(this.tileSize_)return this.tileSize_;var e=this.getTileGrid();return e?Un(e.getTileSize(t)):[256,256]},e.prototype.getGutterForProjection=function(t){return this.gutter_},e.prototype.setLoader=function(t){this.loader_=t},e.prototype.getTile=function(t,e,r,n,i){var o=this.getTileSize(t),s=yh(t,e,r);if(this.tileCache.containsKey(s))return this.tileCache.get(s);var a=this.loader_,l=x({tileCoord:[t,e,r],loader:function(){return n=function(){return a(t,e,r)},function(){var t;try{t=n()}catch(e){return Promise.reject(e)}return t instanceof Promise?t:Promise.resolve(t)}();var n},size:o},this.tileOptions),u=new wf(l);return u.key=this.getKey(),u.addEventListener(P.CHANGE,this.handleTileChange_),this.tileCache.set(s,u),u},e.prototype.handleTileChange_=function(t){var e,r=t.target,n=s(r),i=r.getState();i==Xs.LOADING?(this.tileLoadingKeys_[n]=!0,e=LA):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],e=i==Xs.ERROR?OA:i==Xs.LOADED?MA:void 0),e&&this.dispatchEvent(new GA(e,r))},e}(jA);function aO(t){return(e,...r)=>uO(t,e,r)}function lO(t,e){return aO(fO(t,e).get)}const{apply:uO,construct:hO,defineProperty:cO,get:AO,getOwnPropertyDescriptor:fO,getPrototypeOf:pO,has:dO,ownKeys:gO,set:yO,setPrototypeOf:mO}=Reflect,{iterator:vO,species:_O,toStringTag:wO,for:bO}=Symbol,xO=Object,{create:CO,defineProperty:EO,freeze:SO,is:BO}=xO,IO=Array.prototype[vO],TO=aO(IO),PO=ArrayBuffer;lO(PO.prototype,"byteLength");const FO="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:null;FO&&lO(FO.prototype,"byteLength");const LO=pO(Uint8Array);LO.from;const MO=LO.prototype;MO[vO],aO(MO.keys),aO(MO.values),aO(MO.entries),aO(MO.set),aO(MO.reverse),aO(MO.fill),aO(MO.copyWithin),aO(MO.sort),aO(MO.slice),aO(MO.subarray),lO(MO,"buffer"),lO(MO,"byteOffset"),lO(MO,"length"),lO(MO,wO);const OO=Uint32Array,kO=Float32Array,NO=pO([][vO]()),RO=aO(NO.next),UO=aO(function*(){}().next),DO=pO(NO),QO=aO(DataView.prototype.getUint16),GO=WeakMap,jO=GO.prototype,HO=aO(jO.get),zO=aO(jO.set),VO=new GO,KO=CO(null,{next:{value:function(){const t=HO(VO,this);return RO(t)}},[vO]:{value:function(){return this}}}),qO=new GO,WO=CO(DO,{next:{value:function(){const t=HO(qO,this);return UO(t)},writable:!0,configurable:!0}});for(const ol of gO(NO))"next"!==ol&&EO(WO,ol,fO(NO,ol));const XO=new PO(4),YO=new kO(XO),ZO=new OO(XO),JO=new OO(512),$O=new OO(512);for(let ol=0;ol<256;++ol){const t=ol-127;t<-27?(JO[ol]=0,JO[256|ol]=32768,$O[ol]=24,$O[256|ol]=24):t<-14?(JO[ol]=1024>>-t-14,JO[256|ol]=1024>>-t-14|32768,$O[ol]=-t-1,$O[256|ol]=-t-1):t<=15?(JO[ol]=t+15<<10,JO[256|ol]=t+15<<10|32768,$O[ol]=13,$O[256|ol]=13):t<128?(JO[ol]=31744,JO[256|ol]=64512,$O[ol]=24,$O[256|ol]=24):(JO[ol]=31744,JO[256|ol]=64512,$O[ol]=13,$O[256|ol]=13)}const tk=new OO(2048),ek=new OO(64),rk=new OO(64);for(let ol=1;ol<1024;++ol){let t=ol<<13,e=0;for(;0==(8388608&t);)t<<=1,e-=8388608;t&=-8388609,e+=947912704,tk[ol]=t|e}for(let ol=1024;ol<2048;++ol)tk[ol]=939524096+(ol-1024<<13);for(let ol=1;ol<31;++ol)ek[ol]=ol<<23;ek[31]=1199570944,ek[32]=2147483648;for(let ol=33;ol<63;++ol)ek[ol]=2147483648+(ol-32<<23);ek[63]=3347054592;for(let ol=1;ol<64;++ol)32!==ol&&(rk[ol]=1024);function nk(t,e,...r){return function(t){const e=t>>10;return ZO[0]=tk[rk[e]+(1023&t)]+ek[e],YO[0]}(QO(t,e,...function(t){if(t[vO]===IO&&NO.next===RO)return t;const e=CO(KO);return zO(VO,e,TO(t)),e}(r)))}var ik={};function ok(t,e,r){r&&r.debug;const n="object"==typeof t?t.outer:t,i=new RegExp(`${e}\\="([^"]*)"`).exec(n);if(i)return i[1]}({get exports(){return ik},set exports(t){ik=t}}).exports=ok,ik.default=ok;var sk={},ak={get exports(){return sk},set exports(t){sk=t}},lk={},uk={get exports(){return lk},set exports(t){lk=t}},hk={};function ck(t,e,r){const n=new RegExp(e).exec(t.slice(r));return n?r+n.index:-1}({get exports(){return hk},set exports(t){hk=t}}).exports=ck,hk.default=ck;var Ak={};function fk(t,e,r){const n=new RegExp(e).exec(t.slice(r));return n?r+n.index+n[0].length-1:-1}({get exports(){return Ak},set exports(t){Ak=t}}).exports=fk,Ak.default=fk;var pk={};function dk(t,e){const r=new RegExp(e,"g"),n=t.match(r);return n?n.length:0}({get exports(){return pk},set exports(t){pk=t}}).exports=dk,pk.default=dk;const gk=hk,yk=Ak,mk=pk;function vk(t,e,r){r&&r.debug;const n=!(r&&!1===typeof r.nested),i=r&&r.startIndex||0,o=gk(t,`<${e}[ >/]`,i);if(-1===o)return;const s=t.slice(o+e.length);let a=yk(s,"^[^<]*[ /]>",0);const l=-1!==a&&"/"===s[a-1];if(!1===l)if(n){let t=0,r=1,n=0;for(;-1!==(a=yk(s,"[ /]"+e+">",t));){const i=s.substring(t,a+1);if(r+=mk(i,"<"+e),n+=mk(i,"/"+e+">"),n>=r)break;t=a}}else a=yk(s,"[ /]"+e+">",0);const u=o+e.length+a+1;if(-1===u)return;const h=t.slice(o,u);let c;return c=l?null:h.slice(h.indexOf(">")+1,h.lastIndexOf("<")),{inner:c,outer:h,start:o,end:u}}uk.exports=vk,lk.default=vk;const _k=lk;function wk(t,e,r){const n=[],i=r&&r.debug||!1,o=!r||"boolean"!=typeof r.nested||r.nested;let s,a=r&&r.startIndex||0;for(;s=_k(t,e,{debug:i,startIndex:a});)a=o?s.start+1+e.length:s.end,n.push(s);return n}ak.exports=wk,sk.default=wk;const bk={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},xk={};for(const ol in bk)bk.hasOwnProperty(ol)&&(xk[bk[ol]]=parseInt(ol,10));const Ck=[xk.BitsPerSample,xk.ExtraSamples,xk.SampleFormat,xk.StripByteCounts,xk.StripOffsets,xk.StripRowCounts,xk.TileByteCounts,xk.TileOffsets,xk.SubIFDs],Ek={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},Sk={};for(const ol in Ek)Ek.hasOwnProperty(ol)&&(Sk[Ek[ol]]=parseInt(ol,10));const Bk={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"},Ik=new Map;function Tk(t,e){Array.isArray(t)||(t=[t]),t.forEach((t=>Ik.set(t,e)))}async function Pk(t){const e=Ik.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);return new(await e())(t)}function Fk(t,e,r,n=1){return new(Object.getPrototypeOf(t).constructor)(e*r*n)}function Lk(t,e,r){return(1-r)*t+r*e}function Mk(t,e,r){let n=0;for(let i=e;i<r;++i)n+=t[i];return n}function Ok(t,e,r){switch(t){case 1:if(e<=8)return new Uint8Array(r);if(e<=16)return new Uint16Array(r);if(e<=32)return new Uint32Array(r);break;case 2:if(8===e)return new Int8Array(r);if(16===e)return new Int16Array(r);if(32===e)return new Int32Array(r);break;case 3:switch(e){case 16:case 32:return new Float32Array(r);case 64:return new Float64Array(r)}}throw Error("Unsupported data format/bitsPerSample")}Tk([void 0,1],(()=>Promise.resolve().then((()=>rAt)).then((t=>t.default)))),Tk(5,(()=>Promise.resolve().then((()=>sAt)).then((t=>t.default)))),Tk(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),Tk(7,(()=>Promise.resolve().then((()=>_At)).then((t=>t.default)))),Tk([8,32946],(()=>Promise.resolve().then((()=>Idt)).then((t=>t.default)))),Tk(32773,(()=>Promise.resolve().then((()=>Tdt)).then((t=>t.default)))),Tk(34887,(()=>Promise.resolve().then((()=>Fdt)).then((t=>t.default)))),Tk(50001,(()=>Promise.resolve().then((()=>Ldt)).then((t=>t.default))));const kk=class{constructor(t,e,r,n,i,o){this.fileDirectory=t,this.geoKeys=e,this.dataView=r,this.littleEndian=n,this.tiles=i?{}:null,this.isTiled=!t.StripOffsets;const s=t.PlanarConfiguration;if(this.planarConfiguration=void 0===s?1:s,1!==this.planarConfiguration&&2!==this.planarConfiguration)throw new Error("Invalid planar configuration.");this.source=o}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return void 0!==this.fileDirectory.SamplesPerPixel?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:void 0!==this.fileDirectory.RowsPerStrip?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(t){return this.isTiled||(t+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-t*this.getTileHeight()}getBytesPerPixel(){let t=0;for(let e=0;e<this.fileDirectory.BitsPerSample.length;++e)t+=this.getSampleByteSize(e);return t}getSampleByteSize(t){if(t>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${t} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[t]/8)}getReaderForSample(t){const e=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1,r=this.fileDirectory.BitsPerSample[t];switch(e){case 1:if(r<=8)return DataView.prototype.getUint8;if(r<=16)return DataView.prototype.getUint16;if(r<=32)return DataView.prototype.getUint32;break;case 2:if(r<=8)return DataView.prototype.getInt8;if(r<=16)return DataView.prototype.getInt16;if(r<=32)return DataView.prototype.getInt32;break;case 3:switch(r){case 16:return function(t,e){return nk(this,t,e)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(t=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1}getBitsPerSample(t=0){return this.fileDirectory.BitsPerSample[t]}getArrayForSample(t,e){return Ok(this.getSampleFormat(t),this.getBitsPerSample(t),e)}async getTileOrStrip(t,e,r,n,i){const o=Math.ceil(this.getWidth()/this.getTileWidth()),s=Math.ceil(this.getHeight()/this.getTileHeight());let a;const{tiles:l}=this;let u,h;1===this.planarConfiguration?a=e*o+t:2===this.planarConfiguration&&(a=r*o*s+e*o+t),this.isTiled?(u=this.fileDirectory.TileOffsets[a],h=this.fileDirectory.TileByteCounts[a]):(u=this.fileDirectory.StripOffsets[a],h=this.fileDirectory.StripByteCounts[a]);const c=(await this.source.fetch([{offset:u,length:h}],i))[0];let A;return null!==l&&l[a]?A=l[a]:(A=(async()=>{let t=await n.decode(this.fileDirectory,c);const r=this.getSampleFormat(),i=this.getBitsPerSample();return function(t,e){return(1!==t&&2!==t||!(e<=32)||e%8!=0)&&(3!==t||16!==e&&32!==e&&64!==e)}(r,i)&&(t=function(t,e,r,n,i,o,s){const a=new DataView(t),l=2===r?1:n,u=Ok(e,i,2===r?s*o:s*o*n),h=parseInt("1".repeat(i),2);if(1===e){let t;t=1===r?n*i:i;let e=o*t;0!=(7&e)&&(e=e+7&-8);for(let r=0;r<s;++r){const t=r*e;for(let e=0;e<o;++e){const n=t+e*l*i;for(let t=0;t<l;++t){const s=n+t*i,c=(r*o+e)*l+t,A=Math.floor(s/8),f=s%8;if(f+i<=8)u[c]=a.getUint8(A)>>8-i-f&h;else if(f+i<=16)u[c]=a.getUint16(A)>>16-i-f&h;else if(f+i<=24){const t=a.getUint16(A)<<8|a.getUint8(A+2);u[c]=t>>24-i-f&h}else u[c]=a.getUint32(A)>>32-i-f&h}}}}return u.buffer}(t,r,this.planarConfiguration,this.getSamplesPerPixel(),i,this.getTileWidth(),this.getBlockHeight(e))),t})(),null!==l&&(l[a]=A)),{x:t,y:e,sample:r,data:await A}}async _readRaster(t,e,r,n,i,o,s,a,l){const u=this.getTileWidth(),h=this.getTileHeight(),c=this.getWidth(),A=this.getHeight(),f=Math.max(Math.floor(t[0]/u),0),p=Math.min(Math.ceil(t[2]/u),Math.ceil(c/u)),d=Math.max(Math.floor(t[1]/h),0),g=Math.min(Math.ceil(t[3]/h),Math.ceil(A/h)),y=t[2]-t[0];let m=this.getBytesPerPixel();const v=[],_=[];for(let x=0;x<e.length;++x)1===this.planarConfiguration?v.push(Mk(this.fileDirectory.BitsPerSample,0,e[x])/8):v.push(0),_.push(this.getReaderForSample(e[x]));const w=[],{littleEndian:b}=this;for(let x=d;x<g;++x)for(let o=f;o<p;++o)for(let s=0;s<e.length;++s){const a=s,f=e[s];2===this.planarConfiguration&&(m=this.getSampleByteSize(s));const p=this.getTileOrStrip(o,x,f,i,l);w.push(p),p.then((i=>{const o=i.data,s=new DataView(o),l=this.getBlockHeight(i.y),f=i.y*h,p=i.x*u,d=f+l,g=(i.x+1)*u,w=_[a],x=Math.min(l,l-(d-t[3]),A-f),C=Math.min(u,u-(g-t[2]),c-p);for(let h=Math.max(0,t[1]-f);h<x;++h)for(let i=Math.max(0,t[0]-p);i<C;++i){const o=(h*u+i)*m,l=w.call(s,o+v[a],b);let c;n?(c=(h+f-t[1])*y*e.length+(i+p-t[0])*e.length+a,r[c]=l):(c=(h+f-t[1])*y+i+p-t[0],r[a][c]=l)}}))}if(await Promise.all(w),o&&t[2]-t[0]!==o||s&&t[3]-t[1]!==s){let i;return i=n?function(t,e,r,n,i,o,s="nearest"){switch(s.toLowerCase()){case"nearest":return function(t,e,r,n,i,o){const s=e/n,a=r/i,l=Fk(t,n,i,o);for(let u=0;u<i;++u){const i=Math.min(Math.round(a*u),r-1);for(let r=0;r<n;++r){const a=Math.min(Math.round(s*r),e-1);for(let s=0;s<o;++s){const h=t[i*e*o+a*o+s];l[u*n*o+r*o+s]=h}}}return l}(t,e,r,n,i,o);case"bilinear":case"linear":return function(t,e,r,n,i,o){const s=e/n,a=r/i,l=Fk(t,n,i,o);for(let u=0;u<i;++u){const i=a*u,h=Math.floor(i),c=Math.min(Math.ceil(i),r-1);for(let r=0;r<n;++r){const a=s*r,A=a%1,f=Math.floor(a),p=Math.min(Math.ceil(a),e-1);for(let s=0;s<o;++s){const a=t[h*e*o+f*o+s],d=t[h*e*o+p*o+s],g=t[c*e*o+f*o+s],y=t[c*e*o+p*o+s],m=Lk(Lk(a,d,A),Lk(g,y,A),i%1);l[u*n*o+r*o+s]=m}}}return l}(t,e,r,n,i,o);default:throw new Error(`Unsupported resampling method: '${s}'`)}}(r,t[2]-t[0],t[3]-t[1],o,s,e.length,a):function(t,e,r,n,i,o="nearest"){switch(o.toLowerCase()){case"nearest":return function(t,e,r,n,i){const o=e/n,s=r/i;return t.map((t=>{const a=Fk(t,n,i);for(let l=0;l<i;++l){const i=Math.min(Math.round(s*l),r-1);for(let r=0;r<n;++r){const s=Math.min(Math.round(o*r),e-1),u=t[i*e+s];a[l*n+r]=u}}return a}))}(t,e,r,n,i);case"bilinear":case"linear":return function(t,e,r,n,i){const o=e/n,s=r/i;return t.map((t=>{const a=Fk(t,n,i);for(let l=0;l<i;++l){const i=s*l,u=Math.floor(i),h=Math.min(Math.ceil(i),r-1);for(let r=0;r<n;++r){const s=o*r,c=s%1,A=Math.floor(s),f=Math.min(Math.ceil(s),e-1),p=t[u*e+A],d=t[u*e+f],g=t[h*e+A],y=t[h*e+f],m=Lk(Lk(p,d,c),Lk(g,y,c),i%1);a[l*n+r]=m}}return a}))}(t,e,r,n,i);default:throw new Error(`Unsupported resampling method: '${o}'`)}}(r,t[2]-t[0],t[3]-t[1],o,s,a),i.width=o,i.height=s,i}return r.width=o||t[2]-t[0],r.height=s||t[3]-t[1],r}async readRasters({window:t,samples:e=[],interleave:r,pool:n=null,width:i,height:o,resampleMethod:s,fillValue:a,signal:l}={}){const u=t||[0,0,this.getWidth(),this.getHeight()];if(u[0]>u[2]||u[1]>u[3])throw new Error("Invalid subsets");const h=(u[2]-u[0])*(u[3]-u[1]),c=this.getSamplesPerPixel();if(e&&e.length){for(let p=0;p<e.length;++p)if(e[p]>=c)return Promise.reject(new RangeError(`Invalid sample index '${e[p]}'.`))}else for(let p=0;p<c;++p)e.push(p);let A;if(r)A=Ok(this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,Math.max.apply(null,this.fileDirectory.BitsPerSample),h*e.length),a&&A.fill(a);else{A=[];for(let t=0;t<e.length;++t){const r=this.getArrayForSample(e[t],h);Array.isArray(a)&&t<a.length?r.fill(a[t]):a&&!Array.isArray(a)&&r.fill(a),A.push(r)}}const f=n||await Pk(this.fileDirectory);return await this._readRaster(u,e,A,r,f,i,o,s,l)}async readRGB({window:t,interleave:e=!0,pool:r=null,width:n,height:i,resampleMethod:o,enableAlpha:s=!1,signal:a}={}){const l=t||[0,0,this.getWidth(),this.getHeight()];if(l[0]>l[2]||l[1]>l[3])throw new Error("Invalid subsets");const u=this.fileDirectory.PhotometricInterpretation;if(2===u){let l=[0,1,2];if(0!==this.fileDirectory.ExtraSamples&&s){l=[];for(let t=0;t<this.fileDirectory.BitsPerSample.length;t+=1)l.push(t)}return this.readRasters({window:t,interleave:e,samples:l,pool:r,width:n,height:i,resampleMethod:o,signal:a})}let h;switch(u){case 0:case 1:case 3:h=[0];break;case 5:h=[0,1,2,3];break;case 6:case 8:h=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const c={window:l,interleave:!0,samples:h,pool:r,width:n,height:i,resampleMethod:o,signal:a},{fileDirectory:A}=this,f=await this.readRasters(c),p=2**this.fileDirectory.BitsPerSample[0];let d;switch(u){case 0:d=function(t,e){const{width:r,height:n}=t,i=new Uint8Array(r*n*3);let o;for(let s=0,a=0;s<t.length;++s,a+=3)o=256-t[s]/e*256,i[a]=o,i[a+1]=o,i[a+2]=o;return i}(f,p);break;case 1:d=function(t,e){const{width:r,height:n}=t,i=new Uint8Array(r*n*3);let o;for(let s=0,a=0;s<t.length;++s,a+=3)o=t[s]/e*256,i[a]=o,i[a+1]=o,i[a+2]=o;return i}(f,p);break;case 3:d=function(t,e){const{width:r,height:n}=t,i=new Uint8Array(r*n*3),o=e.length/3,s=e.length/3*2;for(let a=0,l=0;a<t.length;++a,l+=3){const r=t[a];i[l]=e[r]/65536*256,i[l+1]=e[r+o]/65536*256,i[l+2]=e[r+s]/65536*256}return i}(f,A.ColorMap);break;case 5:d=function(t){const{width:e,height:r}=t,n=new Uint8Array(e*r*3);for(let i=0,o=0;i<t.length;i+=4,o+=3){const e=t[i],r=t[i+1],s=t[i+2],a=t[i+3];n[o]=(255-e)/256*255*((255-a)/256),n[o+1]=(255-r)/256*255*((255-a)/256),n[o+2]=(255-s)/256*255*((255-a)/256)}return n}(f);break;case 6:d=function(t){const{width:e,height:r}=t,n=new Uint8ClampedArray(e*r*3);for(let i=0,o=0;i<t.length;i+=3,o+=3){const e=t[i],r=t[i+1],s=t[i+2];n[o]=e+1.402*(s-128),n[o+1]=e-.34414*(r-128)-.71414*(s-128),n[o+2]=e+1.772*(r-128)}return n}(f);break;case 8:d=function(t){const{width:e,height:r}=t,n=new Uint8Array(e*r*3);for(let i=0,o=0;i<t.length;i+=3,o+=3){let e,r,s,a=(t[i+0]+16)/116,l=(t[i+1]<<24>>24)/500+a,u=a-(t[i+2]<<24>>24)/200;l=.95047*(l*l*l>.008856?l*l*l:(l-16/116)/7.787),a=1*(a*a*a>.008856?a*a*a:(a-16/116)/7.787),u=1.08883*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),e=3.2406*l+-1.5372*a+-.4986*u,r=-.9689*l+1.8758*a+.0415*u,s=.0557*l+-.204*a+1.057*u,e=e>.0031308?1.055*e**(1/2.4)-.055:12.92*e,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,n[o]=255*Math.max(0,Math.min(1,e)),n[o+1]=255*Math.max(0,Math.min(1,r)),n[o+2]=255*Math.max(0,Math.min(1,s))}return n}(f);break;default:throw new Error("Unsupported photometric interpretation.")}if(!e){const t=new Uint8Array(d.length/3),e=new Uint8Array(d.length/3),r=new Uint8Array(d.length/3);for(let n=0,i=0;n<d.length;n+=3,++i)t[i]=d[n],e[i]=d[n+1],r[i]=d[n+2];d=[t,e,r]}return d.width=f.width,d.height=f.height,d}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const t=[];for(let e=0;e<this.fileDirectory.ModelTiepoint.length;e+=6)t.push({i:this.fileDirectory.ModelTiepoint[e],j:this.fileDirectory.ModelTiepoint[e+1],k:this.fileDirectory.ModelTiepoint[e+2],x:this.fileDirectory.ModelTiepoint[e+3],y:this.fileDirectory.ModelTiepoint[e+4],z:this.fileDirectory.ModelTiepoint[e+5]});return t}getGDALMetadata(t=null){const e={};if(!this.fileDirectory.GDAL_METADATA)return null;const r=this.fileDirectory.GDAL_METADATA;let n=sk(r,"Item");n=null===t?n.filter((t=>void 0===ik(t,"sample"))):n.filter((e=>Number(ik(e,"sample"))===t));for(let i=0;i<n.length;++i){const t=n[i];e[ik(t,"name")]=t.inner}return e}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const t=this.fileDirectory.GDAL_NODATA;return Number(t.substring(0,t.length-1))}getOrigin(){const t=this.fileDirectory.ModelTiepoint,e=this.fileDirectory.ModelTransformation;if(t&&6===t.length)return[t[3],t[4],t[5]];if(e)return[e[3],e[7],e[11]];throw new Error("The image does not have an affine transformation.")}getResolution(t=null){const e=this.fileDirectory.ModelPixelScale,r=this.fileDirectory.ModelTransformation;if(e)return[e[0],-e[1],e[2]];if(r)return[r[0],r[5],r[10]];if(t){const[e,r,n]=t.getResolution();return[e*t.getWidth()/this.getWidth(),r*t.getHeight()/this.getHeight(),n*t.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return 1===this.geoKeys.GTRasterTypeGeoKey}getBoundingBox(){const t=this.getOrigin(),e=this.getResolution(),r=t[0],n=t[1],i=r+e[0]*this.getWidth(),o=n+e[1]*this.getHeight();return[Math.min(r,i),Math.min(n,o),Math.max(r,i),Math.max(n,o)]}};class Nk{constructor(t){this._dataView=new DataView(t)}get buffer(){return this._dataView.buffer}getUint64(t,e){const r=this.getUint32(t,e),n=this.getUint32(t+4,e);let i;if(e){if(i=r+2**32*n,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}if(i=2**32*r+n,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}getInt64(t,e){let r=0;const n=(128&this._dataView.getUint8(t+(e?7:0)))>0;let i=!0;for(let o=0;o<8;o++){let s=this._dataView.getUint8(t+(e?o:7-o));n&&(i?0!==s&&(s=255&~(s-1),i=!1):s=255&~s),r+=s*256**o}return n&&(r=-r),r}getUint8(t,e){return this._dataView.getUint8(t,e)}getInt8(t,e){return this._dataView.getInt8(t,e)}getUint16(t,e){return this._dataView.getUint16(t,e)}getInt16(t,e){return this._dataView.getInt16(t,e)}getUint32(t,e){return this._dataView.getUint32(t,e)}getInt32(t,e){return this._dataView.getInt32(t,e)}getFloat16(t,e){return nk(this._dataView,t,e)}getFloat32(t,e){return this._dataView.getFloat32(t,e)}getFloat64(t,e){return this._dataView.getFloat64(t,e)}}class Rk{constructor(t,e,r,n){this._dataView=new DataView(t),this._sliceOffset=e,this._littleEndian=r,this._bigTiff=n}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(t,e){return this.sliceOffset<=t&&this.sliceTop>=t+e}readUint8(t){return this._dataView.getUint8(t-this._sliceOffset,this._littleEndian)}readInt8(t){return this._dataView.getInt8(t-this._sliceOffset,this._littleEndian)}readUint16(t){return this._dataView.getUint16(t-this._sliceOffset,this._littleEndian)}readInt16(t){return this._dataView.getInt16(t-this._sliceOffset,this._littleEndian)}readUint32(t){return this._dataView.getUint32(t-this._sliceOffset,this._littleEndian)}readInt32(t){return this._dataView.getInt32(t-this._sliceOffset,this._littleEndian)}readFloat32(t){return this._dataView.getFloat32(t-this._sliceOffset,this._littleEndian)}readFloat64(t){return this._dataView.getFloat64(t-this._sliceOffset,this._littleEndian)}readUint64(t){const e=this.readUint32(t),r=this.readUint32(t+4);let n;if(this._littleEndian){if(n=e+2**32*r,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}if(n=2**32*e+r,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}readInt64(t){let e=0;const r=(128&this._dataView.getUint8(t+(this._littleEndian?7:0)))>0;let n=!0;for(let i=0;i<8;i++){let o=this._dataView.getUint8(t+(this._littleEndian?i:7-i));r&&(n?0!==o&&(o=255&~(o-1),n=!1):o=255&~o),e+=o*256**i}return r&&(e=-e),e}readOffset(t){return this._bigTiff?this.readUint64(t):this.readUint32(t)}}const Uk="undefined"!=typeof navigator&&navigator.hardwareConcurrency||2,Dk=class{constructor(t=Uk,e){this.workers=null,this._awaitingDecoder=null,this.size=t,this.messageId=0,t&&(this._awaitingDecoder=e?Promise.resolve(e):new Promise((t=>{Promise.resolve().then((()=>Odt)).then((e=>{t(e.create)}))})),this._awaitingDecoder.then((e=>{this._awaitingDecoder=null,this.workers=[];for(let r=0;r<t;r++)this.workers.push({worker:e(),idle:!0})})))}async decode(t,e){return this._awaitingDecoder&&await this._awaitingDecoder,0===this.size?Pk(t).then((r=>r.decode(t,e))):new Promise((r=>{const n=this.workers.find((t=>t.idle))||this.workers[Math.floor(Math.random()*this.size)];n.idle=!1;const i=this.messageId++,o=t=>{t.data.id===i&&(n.idle=!0,r(t.data.decoded),n.worker.removeEventListener("message",o))};n.worker.addEventListener("message",o),n.worker.postMessage({fileDirectory:t,buffer:e,id:i},[e])}))}destroy(){this.workers&&(this.workers.forEach((t=>{t.worker.terminate()})),this.workers=null)}},Qk="\r\n\r\n";function Gk(t){if(void 0!==Object.fromEntries)return Object.fromEntries(t);const e={};for(const[r,n]of t)e[r.toLowerCase()]=n;return e}function jk(t){return Gk(t.split("\r\n").map((t=>{const e=t.split(":").map((t=>t.trim()));return e[0]=e[0].toLowerCase(),e})))}function Hk(t){let e,r,n;return t&&([,e,r,n]=t.match(/bytes (\d+)-(\d+)\/(\d+)/),e=parseInt(e,10),r=parseInt(r,10),n=parseInt(n,10)),{start:e,end:r,total:n}}class zk{async fetch(t,e=undefined){return Promise.all(t.map((t=>this.fetchSlice(t,e))))}async fetchSlice(t){throw new Error(`fetching of slice ${t} not possible, not implemented`)}get fileSize(){return null}async close(){}}var Vk,Kk,qk=Wk;function Wk(t){var e=this;if(e instanceof Wk||(e=new Wk),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var r=0,n=arguments.length;r<n;r++)e.push(arguments[r]);return e}function Xk(t,e,r,n){if(!(this instanceof Xk))return new Xk(t,e,r,n);this.list=n,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}Wk.Node=Xk,Wk.create=Wk,Wk.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,r=t.prev;return e&&(e.prev=r),r&&(r.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=r),t.list.length--,t.next=null,t.prev=null,t.list=null,e},Wk.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},Wk.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}},Wk.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)n=arguments[t],(r=this).tail=new Xk(n,r.tail,null,r),r.head||(r.head=r.tail),r.length++;var r,n;return this.length},Wk.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)n=arguments[t],(r=this).head=new Xk(n,null,r.head,r),r.tail||(r.tail=r.head),r.length++;var r,n;return this.length},Wk.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},Wk.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},Wk.prototype.forEach=function(t,e){e=e||this;for(var r=this.head,n=0;null!==r;n++)t.call(e,r.value,n,this),r=r.next},Wk.prototype.forEachReverse=function(t,e){e=e||this;for(var r=this.tail,n=this.length-1;null!==r;n--)t.call(e,r.value,n,this),r=r.prev},Wk.prototype.get=function(t){for(var e=0,r=this.head;null!==r&&e<t;e++)r=r.next;if(e===t&&null!==r)return r.value},Wk.prototype.getReverse=function(t){for(var e=0,r=this.tail;null!==r&&e<t;e++)r=r.prev;if(e===t&&null!==r)return r.value},Wk.prototype.map=function(t,e){e=e||this;for(var r=new Wk,n=this.head;null!==n;)r.push(t.call(e,n.value,this)),n=n.next;return r},Wk.prototype.mapReverse=function(t,e){e=e||this;for(var r=new Wk,n=this.tail;null!==n;)r.push(t.call(e,n.value,this)),n=n.prev;return r},Wk.prototype.reduce=function(t,e){var r,n=this.head;if(arguments.length>1)r=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var i=0;null!==n;i++)r=t(r,n.value,i),n=n.next;return r},Wk.prototype.reduceReverse=function(t,e){var r,n=this.tail;if(arguments.length>1)r=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var i=this.length-1;null!==n;i--)r=t(r,n.value,i),n=n.prev;return r},Wk.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;null!==r;e++)t[e]=r.value,r=r.next;return t},Wk.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;null!==r;e++)t[e]=r.value,r=r.prev;return t},Wk.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new Wk;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=0,i=this.head;null!==i&&n<t;n++)i=i.next;for(;null!==i&&n<e;n++,i=i.next)r.push(i.value);return r},Wk.prototype.sliceReverse=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new Wk;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=this.length,i=this.tail;null!==i&&n>e;n--)i=i.prev;for(;null!==i&&n>t;n--,i=i.prev)r.push(i.value);return r},Wk.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,i=this.head;null!==i&&n<t;n++)i=i.next;var o,s,a,l,u=[];for(n=0;i&&n<e;n++)u.push(i.value),i=this.removeNode(i);for(null===i&&(i=this.tail),i!==this.head&&i!==this.tail&&(i=i.prev),n=0;n<r.length;n++)o=this,s=i,a=r[n],void 0,null===(l=s===o.head?new Xk(a,null,s,o):new Xk(a,s,s.next,o)).next&&(o.tail=l),null===l.prev&&(o.head=l),o.length++,i=l;return u},Wk.prototype.reverse=function(){for(var t=this.head,e=this.tail,r=t;null!==r;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=e,this.tail=t,this};try{(Kk?Vk:(Kk=1,Vk=function(t){t.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}))(Wk)}catch(yxt){}const Yk=qk,Zk=Symbol("max"),Jk=Symbol("length"),$k=Symbol("lengthCalculator"),tN=Symbol("allowStale"),eN=Symbol("maxAge"),rN=Symbol("dispose"),nN=Symbol("noDisposeOnSet"),iN=Symbol("lruList"),oN=Symbol("cache"),sN=Symbol("updateAgeOnGet"),aN=()=>1,lN=(t,e,r)=>{const n=t[oN].get(e);if(n){const e=n.value;if(uN(t,e)){if(cN(t,n),!t[tN])return}else r&&(t[sN]&&(n.value.now=Date.now()),t[iN].unshiftNode(n));return e.value}},uN=(t,e)=>{if(!e||!e.maxAge&&!t[eN])return!1;const r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[eN]&&r>t[eN]},hN=t=>{if(t[Jk]>t[Zk])for(let e=t[iN].tail;t[Jk]>t[Zk]&&null!==e;){const r=e.prev;cN(t,e),e=r}},cN=(t,e)=>{if(e){const r=e.value;t[rN]&&t[rN](r.key,r.value),t[Jk]-=r.length,t[oN].delete(r.key),t[iN].removeNode(e)}};class AN{constructor(t,e,r,n,i){this.key=t,this.value=e,this.length=r,this.now=n,this.maxAge=i||0}}const fN=(t,e,r,n)=>{let i=r.value;uN(t,i)&&(cN(t,r),t[tN]||(i=void 0)),i&&e.call(n,i.value,i.key,t)};function pN(t,e){const r=Array.isArray(t)?t:Array.from(t),n=Array.isArray(e)?e:Array.from(e);return r.map(((t,e)=>[t,n[e]]))}class dN extends Error{constructor(t){super(t),Error.captureStackTrace&&Error.captureStackTrace(this,dN),this.name="AbortError"}}class gN extends Error{constructor(t,e){super(e),this.errors=t,this.message=e,this.name="AggregateError"}}const yN=gN;class mN{constructor(t,e,r=null){this.offset=t,this.length=e,this.data=r}get top(){return this.offset+this.length}}class vN{constructor(t,e,r){this.offset=t,this.length=e,this.blockIds=r}}class _N extends zk{constructor(t,{blockSize:e=65536,cacheSize:r=100}={}){super(),this.source=t,this.blockSize=e,this.blockCache=new class{constructor(t){if("number"==typeof t&&(t={max:t}),t||(t={}),t.max&&("number"!=typeof t.max||t.max<0))throw new TypeError("max must be a non-negative number");this[Zk]=t.max||1/0;const e=t.length||aN;if(this[$k]="function"!=typeof e?aN:e,this[tN]=t.stale||!1,t.maxAge&&"number"!=typeof t.maxAge)throw new TypeError("maxAge must be a number");this[eN]=t.maxAge||0,this[rN]=t.dispose,this[nN]=t.noDisposeOnSet||!1,this[sN]=t.updateAgeOnGet||!1,this.reset()}set max(t){if("number"!=typeof t||t<0)throw new TypeError("max must be a non-negative number");this[Zk]=t||1/0,hN(this)}get max(){return this[Zk]}set allowStale(t){this[tN]=!!t}get allowStale(){return this[tN]}set maxAge(t){if("number"!=typeof t)throw new TypeError("maxAge must be a non-negative number");this[eN]=t,hN(this)}get maxAge(){return this[eN]}set lengthCalculator(t){"function"!=typeof t&&(t=aN),t!==this[$k]&&(this[$k]=t,this[Jk]=0,this[iN].forEach((t=>{t.length=this[$k](t.value,t.key),this[Jk]+=t.length}))),hN(this)}get lengthCalculator(){return this[$k]}get length(){return this[Jk]}get itemCount(){return this[iN].length}rforEach(t,e){e=e||this;for(let r=this[iN].tail;null!==r;){const n=r.prev;fN(this,t,r,e),r=n}}forEach(t,e){e=e||this;for(let r=this[iN].head;null!==r;){const n=r.next;fN(this,t,r,e),r=n}}keys(){return this[iN].toArray().map((t=>t.key))}values(){return this[iN].toArray().map((t=>t.value))}reset(){this[rN]&&this[iN]&&this[iN].length&&this[iN].forEach((t=>this[rN](t.key,t.value))),this[oN]=new Map,this[iN]=new Yk,this[Jk]=0}dump(){return this[iN].map((t=>!uN(this,t)&&{k:t.key,v:t.value,e:t.now+(t.maxAge||0)})).toArray().filter((t=>t))}dumpLru(){return this[iN]}set(t,e,r){if((r=r||this[eN])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,i=this[$k](e,t);if(this[oN].has(t)){if(i>this[Zk])return cN(this,this[oN].get(t)),!1;const o=this[oN].get(t).value;return this[rN]&&(this[nN]||this[rN](t,o.value)),o.now=n,o.maxAge=r,o.value=e,this[Jk]+=i-o.length,o.length=i,this.get(t),hN(this),!0}const o=new AN(t,e,i,n,r);return o.length>this[Zk]?(this[rN]&&this[rN](t,e),!1):(this[Jk]+=o.length,this[iN].unshift(o),this[oN].set(t,this[iN].head),hN(this),!0)}has(t){if(!this[oN].has(t))return!1;const e=this[oN].get(t).value;return!uN(this,e)}get(t){return lN(this,t,!0)}peek(t){return lN(this,t,!1)}pop(){const t=this[iN].tail;return t?(cN(this,t),t.value):null}del(t){cN(this,this[oN].get(t))}load(t){this.reset();const e=Date.now();for(let r=t.length-1;r>=0;r--){const n=t[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const t=i-e;t>0&&this.set(n.k,n.v,t)}}}prune(){this[oN].forEach(((t,e)=>lN(this,e,!1)))}}({max:r}),this.blockRequests=new Map,this.blockIdsToFetch=new Set}get fileSize(){return this.source.fileSize}async fetch(t,e){const r=new Map,n=new Map,i=new Set;for(const{offset:l,length:u}of t){let t=l+u;const{fileSize:e}=this;null!==e&&(t=Math.min(t,e));for(let o=Math.floor(l/this.blockSize)*this.blockSize;o<t;o+=this.blockSize){const t=Math.floor(o/this.blockSize);this.blockCache.has(t)?r.set(t,this.blockCache.get(t)):this.blockRequests.has(t)?n.set(t,this.blockRequests.get(t)):(this.blockIdsToFetch.has(t)||this.blockIdsToFetch.add(t),i.add(t))}}await async function(t){return new Promise((t=>setTimeout(t,void 0)))}(),this.fetchBlocks(e);for(const l of i){const t=this.blockRequests.get(l),e=this.blockCache.get(l);if(t)n.set(l,t);else{if(!e)throw new Error(`Block ${l} is not in the block requests`);r.set(l,e)}}let o=await Promise.allSettled(Array.from(n.values()));if(o.some((t=>"rejected"===t.status))){const t=new Set;for(const[r,i]of pN(n.keys(),o)){const{rejected:n,reason:o}=i;n&&"AbortError"===o.name&&o.signal!==e&&(this.blockIdsToFetch.add(r),t.add(r))}if(this.blockIdsToFetch.length>0){this.fetchBlocks(e);for(const e of t){const t=this.blockRequests.get(e);if(!t)throw new Error(`Block ${e} is not in the block requests`);n.set(e,t)}o=await Promise.allSettled(Array.from(n.values()))}}if(o.some((t=>"rejected"===t.status))){if(e&&e.aborted)throw new dN("Request was aborted");throw new yN(o.filter((t=>"rejected"===t.status)).map((t=>t.reason)),"Request failed")}const s=o.map((t=>t.value)),a=new Map(pN(Array.from(n.keys()),s));for(const[l,u]of r)a.set(l,u);return this.readSliceData(t,a)}fetchBlocks(t){if(this.blockIdsToFetch.size>0){const e=this.groupBlocks(this.blockIdsToFetch),r=this.source.fetch(e,t);for(let n=0;n<e.length;++n){const i=e[n];for(const e of i.blockIds){const i=(async()=>{try{const t=(await r)[n],i=e*this.blockSize,o=i-t.offset,s=Math.min(o+this.blockSize,t.data.byteLength),a=t.data.slice(o,s),l=new mN(i,a.byteLength,a);return this.blockCache.set(e,l),l}catch(i){throw"AbortError"===i.name&&(i.signal=t),i}finally{this.blockRequests.delete(e)}})();this.blockRequests.set(e,i)}}this.blockIdsToFetch.clear()}}groupBlocks(t){const e=Array.from(t).sort(((t,e)=>t-e));if(0===e.length)return[];let r=[],n=null;const i=[];for(const o of e)null===n||n+1===o?(r.push(o),n=o):(i.push(new vN(r[0]*this.blockSize,r.length*this.blockSize,r)),r=[o],n=o);return i.push(new vN(r[0]*this.blockSize,r.length*this.blockSize,r)),i}readSliceData(t,e){return t.map((t=>{const r=t.offset+t.length,n=Math.floor(t.offset/this.blockSize),i=Math.floor((t.offset+t.length)/this.blockSize),o=new ArrayBuffer(t.length),s=new Uint8Array(o);for(let a=n;a<=i;++a){const n=e.get(a),i=n.offset-t.offset;let o,l=0,u=0;i<0?l=-i:i>0&&(u=i),o=n.top-r<0?n.length-l:r-n.offset-l;const h=new Uint8Array(n.data,l,o);s.set(h,u)}return o}))}}class wN{get ok(){return this.status>=200&&this.status<=299}get status(){throw new Error("not implemented")}getHeader(t){throw new Error("not implemented")}async getData(){throw new Error("not implemented")}}class bN{constructor(t){this.url=t}async request({headers:t,credentials:e,signal:r}={}){throw new Error("request is not implemented")}}class xN extends wN{constructor(t){super(),this.response=t}get status(){return this.response.status}getHeader(t){return this.response.headers.get(t)}async getData(){return this.response.arrayBuffer?await this.response.arrayBuffer():(await this.response.buffer()).buffer}}class CN extends bN{constructor(t,e){super(t),this.credentials=e}async request({headers:t,credentials:e,signal:r}={}){const n=await fetch(this.url,{headers:t,credentials:e,signal:r});return new xN(n)}}class EN extends wN{constructor(t,e){super(),this.xhr=t,this.data=e}get status(){return this.xhr.status}getHeader(t){return this.xhr.getResponseHeader(t)}async getData(){return this.data}}class SN extends bN{constructRequest(t,e){return new Promise(((r,n)=>{const i=new XMLHttpRequest;i.open("GET",this.url),i.responseType="arraybuffer";for(const[e,o]of Object.entries(t))i.setRequestHeader(e,o);i.onload=()=>{const t=i.response;r(new EN(i,t))},i.onerror=n,i.onabort=()=>n(new dN("Request aborted")),i.send(),e&&(e.aborted&&i.abort(),e.addEventListener("abort",(()=>i.abort())))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}const BN={},IN=Object.freeze(Object.defineProperty({__proto__:null,default:BN},Symbol.toStringTag,{value:"Module"}));class TN extends wN{constructor(t,e){super(),this.response=t,this.dataPromise=e}get status(){return this.response.statusCode}getHeader(t){return this.response.headers[t]}async getData(){return await this.dataPromise}}class PN extends bN{constructor(t){super(t),this.parsedUrl=BN.parse(this.url),this.httpApi=(this.parsedUrl.protocol,BN)}constructRequest(t,e){return new Promise(((r,n)=>{const i=this.httpApi.get({...this.parsedUrl,headers:t},(t=>{const e=new Promise((e=>{const r=[];t.on("data",(t=>{r.push(t)})),t.on("end",(()=>{const t=Buffer.concat(r).buffer;e(t)})),t.on("error",n)}));r(new TN(t,e))}));i.on("error",n),e&&(e.aborted&&i.destroy(new dN("Request aborted")),e.addEventListener("abort",(()=>i.destroy(new dN("Request aborted")))))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}class FN extends zk{constructor(t,e,r,n){super(),this.client=t,this.headers=e,this.maxRanges=r,this.allowFullFile=n,this._fileSize=null}async fetch(t,e){return this.maxRanges>=t.length?this.fetchSlices(t,e):(this.maxRanges>0&&t.length,Promise.all(t.map((t=>this.fetchSlice(t,e)))))}async fetchSlices(t,e){const r=await this.client.request({headers:{...this.headers,Range:`bytes=${t.map((({offset:t,length:e})=>`${t}-${t+e}`)).join(",")}`},signal:e});if(r.ok){if(206===r.status){const{type:n,params:i}=function(t){const[e,...r]=t.split(";").map((t=>t.trim()));return{type:e,params:Gk(r.map((t=>t.split("="))))}}(r.getHeader("content-type"));if("multipart/byteranges"===n){const t=function(t,e){let r=null;const n=new TextDecoder("ascii"),i=[],o=`--${e}`,s=`${o}--`;for(let a=0;a<10;++a)n.decode(new Uint8Array(t,a,o.length))===o&&(r=a);if(null===r)throw new Error("Could not find initial boundary");for(;r<t.byteLength;){const e=n.decode(new Uint8Array(t,r,Math.min(o.length+1024,t.byteLength-r)));if(0===e.length||e.startsWith(s))break;if(!e.startsWith(o))throw new Error("Part does not start with boundary");const a=e.substr(o.length+2);if(0===a.length)break;const l=a.indexOf(Qk),u=jk(a.substr(0,l)),{start:h,end:c,total:A}=Hk(u["content-range"]),f=r+o.length+l+Qk.length,p=parseInt(c,10)+1-parseInt(h,10);i.push({headers:u,data:t.slice(f,f+p),offset:h,length:p,fileSize:A}),r=f+p+4}return i}(await r.getData(),i.boundary);return this._fileSize=t[0].fileSize||null,t}const o=await r.getData(),{start:s,end:a,total:l}=Hk(r.getHeader("content-range"));this._fileSize=l||null;const u=[{data:o,offset:s,length:a-s}];if(t.length>1){const r=await Promise.all(t.slice(1).map((t=>this.fetchSlice(t,e))));return u.concat(r)}return u}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await r.getData();return this._fileSize=t.byteLength,[{data:t,offset:0,length:t.byteLength}]}}throw new Error("Error fetching data.")}async fetchSlice(t,e){const{offset:r,length:n}=t,i=await this.client.request({headers:{...this.headers,Range:`bytes=${r}-${r+n}`},signal:e});if(i.ok){if(206===i.status){const t=await i.getData(),{total:e}=Hk(i.getHeader("content-range"));return this._fileSize=e||null,{data:t,offset:r,length:n}}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await i.getData();return this._fileSize=t.byteLength,{data:t,offset:0,length:t.byteLength}}}throw new Error("Error fetching data.")}get fileSize(){return this._fileSize}}function LN(t,{blockSize:e,cacheSize:r}){return null===e?t:new _N(t,e,r)}function MN(t,{forceXHR:e=!1,...r}={}){return"function"!=typeof fetch||e?"undefined"!=typeof XMLHttpRequest?function(t,{headers:e={},maxRanges:r=0,allowFullFile:n=!1,...i}={}){const o=new SN(t);return LN(new FN(o,e,r,n),i)}(t,r):function(t,{headers:e={},maxRanges:r=0,allowFullFile:n=!1,...i}={}){const o=new PN(t);return LN(new FN(o,e,r,n),i)}(t,r):function(t,{headers:e={},credentials:r,maxRanges:n=0,allowFullFile:i=!1,...o}={}){const s=new CN(t,r);return LN(new FN(s,e,n,i),o)}(t,r)}class ON extends zk{constructor(t){super(),this.file=t}async fetchSlice(t,e){return new Promise(((r,n)=>{const i=this.file.slice(t.offset,t.offset+t.length),o=new FileReader;o.onload=t=>r(t.target.result),o.onerror=n,o.onabort=n,o.readAsArrayBuffer(i),e&&e.addEventListener("abort",(()=>o.abort()))}))}}function kN(t){switch(t){case Sk.BYTE:case Sk.ASCII:case Sk.SBYTE:case Sk.UNDEFINED:return 1;case Sk.SHORT:case Sk.SSHORT:return 2;case Sk.LONG:case Sk.SLONG:case Sk.FLOAT:case Sk.IFD:return 4;case Sk.RATIONAL:case Sk.SRATIONAL:case Sk.DOUBLE:case Sk.LONG8:case Sk.SLONG8:case Sk.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function NN(t,e,r,n){let i=null,o=null;const s=kN(e);switch(e){case Sk.BYTE:case Sk.ASCII:case Sk.UNDEFINED:i=new Uint8Array(r),o=t.readUint8;break;case Sk.SBYTE:i=new Int8Array(r),o=t.readInt8;break;case Sk.SHORT:i=new Uint16Array(r),o=t.readUint16;break;case Sk.SSHORT:i=new Int16Array(r),o=t.readInt16;break;case Sk.LONG:case Sk.IFD:i=new Uint32Array(r),o=t.readUint32;break;case Sk.SLONG:i=new Int32Array(r),o=t.readInt32;break;case Sk.LONG8:case Sk.IFD8:i=new Array(r),o=t.readUint64;break;case Sk.SLONG8:i=new Array(r),o=t.readInt64;break;case Sk.RATIONAL:i=new Uint32Array(2*r),o=t.readUint32;break;case Sk.SRATIONAL:i=new Int32Array(2*r),o=t.readInt32;break;case Sk.FLOAT:i=new Float32Array(r),o=t.readFloat32;break;case Sk.DOUBLE:i=new Float64Array(r),o=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e!==Sk.RATIONAL&&e!==Sk.SRATIONAL)for(let a=0;a<r;++a)i[a]=o.call(t,n+a*s);else for(let a=0;a<r;a+=2)i[a]=o.call(t,n+a*s),i[a+1]=o.call(t,n+(a*s+4));return e===Sk.ASCII?new TextDecoder("utf-8").decode(i):i}class RN{constructor(t,e,r){this.fileDirectory=t,this.geoKeyDirectory=e,this.nextIFDByteOffset=r}}class UN extends Error{constructor(t){super(`No image at index ${t}`),this.index=t}}class DN{async readRasters(t={}){const{window:e,width:r,height:n}=t;let{resX:i,resY:o,bbox:s}=t;const a=await this.getImage();let l=a;const u=await this.getImageCount(),h=a.getBoundingBox();if(e&&s)throw new Error('Both "bbox" and "window" passed.');if(r||n){if(e){const[t,r]=a.getOrigin(),[n,i]=a.getResolution();s=[t+e[0]*n,r+e[1]*i,t+e[2]*n,r+e[3]*i]}const t=s||h;if(r){if(i)throw new Error("Both width and resX passed");i=(t[2]-t[0])/r}if(n){if(o)throw new Error("Both width and resY passed");o=(t[3]-t[1])/n}}if(i||o){const t=[];for(let e=0;e<u;++e){const r=await this.getImage(e),{SubfileType:n,NewSubfileType:i}=r.fileDirectory;(0===e||2===n||1&i)&&t.push(r)}t.sort(((t,e)=>t.getWidth()-e.getWidth()));for(let e=0;e<t.length;++e){const r=t[e],n=(h[2]-h[0])/r.getWidth(),s=(h[3]-h[1])/r.getHeight();if(l=r,i&&i>n||o&&o>s)break}}let c=e;if(s){const[t,e]=a.getOrigin(),[r,n]=l.getResolution(a);c=[Math.round((s[0]-t)/r),Math.round((s[1]-e)/n),Math.round((s[2]-t)/r),Math.round((s[3]-e)/n)],c=[Math.min(c[0],c[2]),Math.min(c[1],c[3]),Math.max(c[0],c[2]),Math.max(c[1],c[3])]}return l.readRasters({...t,window:c})}}let QN=class t extends DN{constructor(t,e,r,n,i={}){super(),this.source=t,this.littleEndian=e,this.bigTiff=r,this.firstIFDOffset=n,this.cache=i.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(t,e){const r=this.bigTiff?4048:1024;return new Rk((await this.source.fetch([{offset:t,length:void 0!==e?e:r}]))[0],t,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(t){const e=this.bigTiff?20:12,r=this.bigTiff?8:2;let n=await this.getSlice(t);const i=this.bigTiff?n.readUint64(t):n.readUint16(t),o=i*e+(this.bigTiff?16:6);n.covers(t,o)||(n=await this.getSlice(t,o));const s={};let a=t+(this.bigTiff?8:2);for(let h=0;h<i;a+=e,++h){const t=n.readUint16(a),e=n.readUint16(a+2),r=this.bigTiff?n.readUint64(a+4):n.readUint32(a+4);let i,o;const l=kN(e),u=a+(this.bigTiff?12:8);if(l*r<=(this.bigTiff?8:4))i=NN(n,e,r,u);else{const t=n.readOffset(u),o=kN(e)*r;i=n.covers(t,o)?NN(n,e,r,t):NN(await this.getSlice(t,o),e,r,t)}o=1===r&&-1===Ck.indexOf(t)&&e!==Sk.RATIONAL&&e!==Sk.SRATIONAL?i[0]:i,s[bk[t]]=o}const l=function(t){const e=t.GeoKeyDirectory;if(!e)return null;const r={};for(let n=4;n<=4*e[3];n+=4){const i=Bk[e[n]],o=e[n+1]?bk[e[n+1]]:null,s=e[n+2],a=e[n+3];let l=null;if(o){if(l=t[o],null==l)throw new Error(`Could not get value of geoKey '${i}'.`);"string"==typeof l?l=l.substring(a,a+s-1):l.subarray&&(l=l.subarray(a,a+s),1===s&&(l=l[0]))}else l=a;r[i]=l}return r}(s),u=n.readOffset(t+r+e*i);return new RN(s,l,u)}async requestIFD(t){if(this.ifdRequests[t])return this.ifdRequests[t];if(0===t)return this.ifdRequests[t]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[t];if(!this.ifdRequests[t-1])try{this.ifdRequests[t-1]=this.requestIFD(t-1)}catch(UW){if(UW instanceof UN)throw new UN(t);throw UW}return this.ifdRequests[t]=(async()=>{const e=await this.ifdRequests[t-1];if(0===e.nextIFDByteOffset)throw new UN(t);return this.parseFileDirectoryAt(e.nextIFDByteOffset)})(),this.ifdRequests[t]}async getImage(t=0){const e=await this.requestIFD(t);return new kk(e.fileDirectory,e.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let t=0,e=!0;for(;e;)try{await this.requestIFD(t),++t}catch(UW){if(!(UW instanceof UN))throw UW;e=!1}return t}async getGhostValues(){const t=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const e="GDAL_STRUCTURAL_METADATA_SIZE=",r=e.length+100;let n=await this.getSlice(t,r);if(e===NN(n,Sk.ASCII,e.length,t)){const e=NN(n,Sk.ASCII,r,t).split("\n")[0],i=Number(e.split("=")[1].split(" ")[0])+e.length;i>r&&(n=await this.getSlice(t,i));const o=NN(n,Sk.ASCII,i,t);this.ghostValues={},o.split("\n").filter((t=>t.length>0)).map((t=>t.split("="))).forEach((([t,e])=>{this.ghostValues[t]=e}))}return this.ghostValues}static async fromSource(e,r,n){const i=(await e.fetch([{offset:0,length:1024}],n))[0],o=new Nk(i),s=o.getUint16(0,0);let a;if(18761===s)a=!0;else{if(19789!==s)throw new TypeError("Invalid byte order value.");a=!1}const l=o.getUint16(2,a);let u;if(42===l)u=!1;else{if(43!==l)throw new TypeError("Invalid magic number.");if(u=!0,8!==o.getUint16(4,a))throw new Error("Unsupported offset byte-size.")}const h=u?o.getUint64(8,a):o.getUint32(4,a);return new t(e,a,u,h,r)}close(){return"function"==typeof this.source.close&&this.source.close()}};class GN extends DN{constructor(t,e){super(),this.mainFile=t,this.overviewFiles=e,this.imageFiles=[t].concat(e),this.fileDirectoriesPerFile=null,this.fileDirectoriesPerFileParsing=null,this.imageCount=null}async parseFileDirectoriesPerFile(){const t=[this.mainFile.parseFileDirectoryAt(this.mainFile.firstIFDOffset)].concat(this.overviewFiles.map((t=>t.parseFileDirectoryAt(t.firstIFDOffset))));return this.fileDirectoriesPerFile=await Promise.all(t),this.fileDirectoriesPerFile}async getImage(t=0){await this.getImageCount(),await this.parseFileDirectoriesPerFile();let e=0,r=0;for(let n=0;n<this.imageFiles.length;n++){const i=this.imageFiles[n];for(let o=0;o<this.imageCounts[n];o++){if(t===e){const t=await i.requestIFD(r);return new kk(t.fileDirectory,t.geoKeyDirectory,i.dataView,i.littleEndian,i.cache,i.source)}e++,r++}r=0}throw new RangeError("Invalid image index")}async getImageCount(){if(null!==this.imageCount)return this.imageCount;const t=[this.mainFile.getImageCount()].concat(this.overviewFiles.map((t=>t.getImageCount())));return this.imageCounts=await Promise.all(t),this.imageCount=this.imageCounts.reduce(((t,e)=>t+e),0),this.imageCount}}var jN,HN=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zN="STATISTICS_MAXIMUM",VN="STATISTICS_MINIMUM";function KN(t){try{return t.getBoundingBox()}catch(r){var e=t.fileDirectory;return[0,0,e.ImageWidth,e.ImageLength]}}function qN(t){try{return t.getOrigin().slice(0,2)}catch(e){return[0,t.fileDirectory.ImageLength]}}function WN(t,e){try{return t.getResolution(e)}catch(r){return[e.fileDirectory.ImageWidth/t.fileDirectory.ImageWidth,e.fileDirectory.ImageHeight/t.fileDirectory.ImageHeight]}}function XN(t){var e,r,n,i=t.geoKeys;return i?i.ProjectedCSTypeGeoKey?((r=rr(e="EPSG:"+i.ProjectedCSTypeGeoKey))||(n=J(i.ProjLinearUnitsGeoKey))&&(r=new oe({code:e,units:n})),r):i.GeographicTypeGeoKey?((r=rr(e="EPSG:"+i.GeographicTypeGeoKey))||(n=J(i.GeogAngularUnitsGeoKey))&&(r=new oe({code:e,units:n})),r):null:null}function YN(t){return t.getImageCount().then((function(e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t.getImage(n);return Promise.all(r)}))}function ZN(t,e){var r;return r=t.blob?async function(t,e){return QN.fromSource(new ON(t),void 0)}(t.blob):t.overviews?async function(t,e=[],r={},n){const i=await QN.fromSource(MN(t,r),n),o=await Promise.all(e.map((t=>QN.fromSource(MN(t,r)))));return new GN(i,o)}(t.url,t.overviews,e):async function(t,e={},r){return QN.fromSource(MN(t,e),r)}(t.url,e),r.then(YN)}function JN(t,e,r,n,i){if(Array.isArray(t)){var o=t.length;if(!Array.isArray(e)||o!=e.length){var s=new Error(n);throw i(s),s}for(var a=0;a<o;++a)JN(t[a],e[a],r,n,i)}else if(Math.abs(t-e)>r*t)throw new Error(n)}function $N(t){return t instanceof Int8Array?127:t instanceof Uint8Array||t instanceof Uint8ClampedArray?255:t instanceof Int16Array?32767:t instanceof Uint16Array?65535:t instanceof Int32Array?2147483647:t instanceof Uint32Array?4294967295:t instanceof Float32Array?34e37:255}var tR=function(t){function e(e){var r=t.call(this,{state:"loading",tileGrid:null,projection:null,opaque:e.opaque,transition:e.transition,interpolate:!1!==e.interpolate,wrapX:e.wrapX})||this;r.sourceInfo_=e.sources;var n=r.sourceInfo_.length;r.sourceOptions_=e.sourceOptions,r.sourceImagery_=new Array(n),r.resolutionFactors_=new Array(n),r.samplesPerPixel_,r.nodataValues_,r.metadata_,r.normalize_=!1!==e.normalize,r.addAlpha_=!1,r.error_=null,r.readMethod_=e.convertToRGB?"readRGB":"readRasters",r.setKey(r.sourceInfo_.map((function(t){return t.url})).join(","));for(var i=r,o=new Array(n),s=0;s<n;++s)o[s]=ZN(r.sourceInfo_[s],r.sourceOptions_);return Promise.all(o).then((function(t){i.configure_(t)})).catch((function(t){i.error_=t,i.setState("error")})),r}return HN(e,t),e.prototype.getError=function(){return this.error_},e.prototype.configure_=function(t){for(var e,r,n,i,o,s=new Array(t.length),a=new Array(t.length),l=new Array(t.length),u=0,h=t.length,c=function(h){var c=t[h],f=c.length,p=void 0,d=void 0,g=new Array(f),y=new Array(f),m=new Array(f);a[h]=new Array(f),l[h]=new Array(f);for(var v=0;v<f;++v){var _=c[v],w=_.getGDALNoData();l[h][v]=_.getGDALMetadata(0),a[h][v]=w;var b=A.sourceInfo_[h].bands;s[h]=b?b.length:_.getSamplesPerPixel();var x=f-(v+1);p||(p=KN(_)),d||(d=qN(_));var C=WN(_,c[0]);m[x]=C[0];var E=[_.getTileWidth(),_.getTileHeight()];g[x]=E;var S=C[0]/Math.abs(C[1]);y[x]=[E[0],E[1]/S]}if(e?Xt(e,p,e):e=p,r){var B="Origin mismatch for source ".concat(h,", got [").concat(d,"] but expected [").concat(r,"]");JN(r,d,0,B,A.viewRejector)}else r=d;if(o){o.length-u>m.length&&(u=o.length-m.length);var I=o[o.length-1]/m[m.length-1];A.resolutionFactors_[h]=I;var T=m.map((function(t){return t*I}));B="Resolution mismatch for source ".concat(h,", got [").concat(T,"] but expected [").concat(o,"]"),JN(o.slice(u,o.length),T,.02,B,A.viewRejector)}else o=m,A.resolutionFactors_[h]=1;n?JN(n.slice(u,n.length),y,.01,"Tile size mismatch for source ".concat(h),A.viewRejector):n=y,i?JN(i.slice(u,i.length),g,0,"Tile size mismatch for source ".concat(h),A.viewRejector):i=g,A.sourceImagery_[h]=c.reverse()},A=this,f=0;f<h;++f)c(f);for(var p=0,d=this.sourceImagery_.length;p<d;++p)for(var g=this.sourceImagery_[p];g.length<o.length;)g.unshift(void 0);if(!this.getProjection()){var y=t[0];for(p=y.length-1;p>=0;--p){var m=XN(y[p]);if(m){this.projection=m;break}}}this.samplesPerPixel_=s,this.nodataValues_=a,this.metadata_=l;t:for(f=0;f<h;++f){if(void 0!==this.sourceInfo_[f].nodata){this.addAlpha_=!0;break}var v=a[f],_=this.sourceInfo_[f].bands;if(_){for(p=0;p<_.length;++p)if(null!==v[_[p]-1]){this.addAlpha_=!0;break t}}else for(var w=0;w<v.length;++w)if(null!==v[w]){this.addAlpha_=!0;break t}}var b=this.addAlpha_?1:0;this.bandCount=s.reduce((function(t,e){return t+e}),0)+b;var x=new FA({extent:e,minZoom:u,origin:r,resolutions:o,tileSizes:n});this.tileGrid=x,this.setTileSizes(i),this.setLoader(this.loadTile_.bind(this)),this.setState("ready"),this.viewResolver({projection:this.projection,resolutions:o,center:_r(zt(e),this.projection),extent:br(e,this.projection),zoom:0})},e.prototype.loadTile_=function(t,e,r){for(var n=this.getTileSize(t),i=this.sourceImagery_.length,o=new Array(i),s=this.addAlpha_,a=this.bandCount,l=this.samplesPerPixel_,u=this.nodataValues_,h=this.sourceInfo_,c=function(i){var s,a=h[i],l=A.resolutionFactors_[i],c=[Math.round(e*(n[0]*l)),Math.round(r*(n[1]*l)),Math.round((e+1)*(n[0]*l)),Math.round((r+1)*(n[1]*l))],f=A.sourceImagery_[i][t],p=void 0;a.bands&&(p=a.bands.map((function(t){return t-1}))),s="nodata"in a&&null!==a.nodata?a.nodata:p?p.map((function(t){return u[i][t]})):u[i],o[i]=f[A.readMethod_]({window:c,width:n[0],height:n[1],samples:p,fillValue:s,pool:(jN||(jN=new Dk),jN),interleave:!1})},A=this,f=0;f<i;++f)c(f);var p=n[0]*n[1],d=p*a,g=this.normalize_,y=this.metadata_;return Promise.all(o).then((function(t){var e;e=g?new Uint8Array(d):new Float32Array(d);for(var r,n=0,o=0;o<p;++o){for(var a=s,c=0;c<i;++c){var A=h[c],f=A.min,m=A.max,v=void 0,_=void 0;if(g){var w=y[c][0];void 0===f&&(f=w&&VN in w?parseFloat(w[VN]):(r=t[c][0])instanceof Int8Array?-128:r instanceof Int16Array?-32768:r instanceof Int32Array?-2147483648:r instanceof Float32Array?12e-39:0),void 0===m&&(m=w&&zN in w?parseFloat(w[zN]):$N(t[c][0])),_=-f*(v=255/(m-f))}for(var b=0;b<l[c];++b){var x,C=t[c][b][o];if(x=g?se(v*C+_,0,255):C,s){var E,S=A.nodata;if(void 0===S)E=A.bands?A.bands[b]-1:b,S=u[c][E];var B=isNaN(S);(!B&&C!==S||B&&!isNaN(C))&&(a=!1,e[n]=x)}else e[n]=x;n++}}s&&(a||(e[n]=255),n++)}return e})).catch((function(t){throw t}))},e}(sO);tR.prototype.getView;const eR=tR;var rR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const nR=function(t){function e(e,r,n,i,o,s,a){var l=this,u=e.getExtent(),h=r.getExtent(),c=h?Xt(n,h):n,A=fA(e,r,zt(c),i),f=new lA(e,r,c,u,A*gc,i),p=s(f.calculateSourceExtent(),A,o),d=p?Nn.IDLE:Nn.EMPTY,g=p?p.getPixelRatio():1;return(l=t.call(this,n,i,g,d)||this).targetProj_=r,l.maxSourceExtent_=u,l.triangulation_=f,l.targetResolution_=i,l.targetExtent_=n,l.sourceImage_=p,l.sourcePixelRatio_=g,l.interpolate_=a,l.canvas_=null,l.sourceListenerKey_=null,l}return rR(e,t),e.prototype.disposeInternal=function(){this.state==Nn.LOADING&&this.unlistenSource_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.getProjection=function(){return this.targetProj_},e.prototype.reproject_=function(){var t=this.sourceImage_.getState();if(t==Nn.LOADED){var e=Jt(this.targetExtent_)/this.targetResolution_,r=Wt(this.targetExtent_)/this.targetResolution_;this.canvas_=pA(e,r,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_)}this.state=t,this.changed()},e.prototype.load=function(){if(this.state==Nn.IDLE){this.state=Nn.LOADING,this.changed();var t=this.sourceImage_.getState();t==Nn.LOADED||t==Nn.ERROR?this.reproject_():(this.sourceListenerKey_=F(this.sourceImage_,P.CHANGE,(function(t){var e=this.sourceImage_.getState();e!=Nn.LOADED&&e!=Nn.ERROR||(this.unlistenSource_(),this.reproject_())}),this),this.sourceImage_.load())}},e.prototype.unlistenSource_=function(){M(this.sourceListenerKey_),this.sourceListenerKey_=null},e}(us);var iR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),oR=function(t){function e(e,r){var n=t.call(this,e)||this;return n.image=r,n}return iR(e,t),e}(c);function sR(t,e){t.getImage().src=e}const aR=function(t){function e(e){var r=this,n=void 0===e.imageSmoothing||e.imageSmoothing;return void 0!==e.interpolate&&(n=e.interpolate),(r=t.call(this,{attributions:e.attributions,projection:e.projection,state:e.state,interpolate:n})||this).on,r.once,r.un,r.resolutions_=void 0!==e.resolutions?e.resolutions:null,r.reprojectedImage_=null,r.reprojectedRevision_=0,r}return iR(e,t),e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.findNearestResolution=function(t){if(this.resolutions_){var e=g(this.resolutions_,t,0);t=this.resolutions_[e]}return t},e.prototype.getImage=function(t,e,r,n){var i=this.getProjection();if(i&&n&&!hr(i,n)){if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&hr(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&kt(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new nR(i,n,t,e,r,function(t,e,r){return this.getImageInternal(t,e,r,i)}.bind(this),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}return i&&(n=i),this.getImageInternal(t,e,r,n)},e.prototype.getImageInternal=function(t,e,r,n){return i()},e.prototype.handleImageChange=function(t){var e,r=t.target;switch(r.getState()){case Nn.LOADING:this.loading=!0,e="imageloadstart";break;case Nn.LOADED:this.loading=!1,e="imageloadend";break;case Nn.ERROR:this.loading=!1,e="imageloaderror";break;default:return}this.hasListener(e)&&this.dispatchEvent(new oR(e,r))},e}(Us);function lR(t,e){var r=[];Object.keys(e).forEach((function(t){null!==e[t]&&void 0!==e[t]&&r.push(t+"="+encodeURIComponent(e[t]))}));var n=r.join("&");return(t=-1===(t=t.replace(/[?&]$/,"")).indexOf("?")?t+"?":t+"&")+n}var uR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const hR=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;return void 0!==n.interpolate&&(i=n.interpolate),(r=t.call(this,{attributions:n.attributions,interpolate:i,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.hidpi_=void 0===n.hidpi||n.hidpi,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:sR,r.params_=n.params||{},r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return uR(e,t),e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),r=this.hidpi_?r:1;var i=this.image_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&It(i.getExtent(),t))return i;var o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};x(o,this.params_);var s=((t=t.slice())[0]+t[2])/2,a=(t[1]+t[3])/2;if(1!=this.ratio_){var l=this.ratio_*Jt(t)/2,u=this.ratio_*Wt(t)/2;t[0]=s-l,t[1]=a-u,t[2]=s+l,t[3]=a+u}var h=e/r,c=Math.ceil(Jt(t)/h),A=Math.ceil(Wt(t)/h);t[0]=s-h*c/2,t[2]=s+h*c/2,t[1]=a-h*A/2,t[3]=a+h*A/2,this.imageSize_[0]=c,this.imageSize_[1]=A;var f=this.getRequestUrl_(t,this.imageSize_,r,n,o);return this.image_=new cs(t,e,r,f,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(P.CHANGE,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){var o=n.getCode().split(/:(?=\d+$)/).pop();i.SIZE=e[0]+","+e[1],i.BBOX=t.join(","),i.BBOXSR=o,i.IMAGESR=o,i.DPI=Math.round(90*r);var s=this.url_,a=s.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return a==s&&K(!1,50),lR(a,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){x(this.params_,t),this.image_=null,this.changed()},e}(aR);var cR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const AR=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;return void 0!==n.interpolate&&(i=n.interpolate),(r=t.call(this,{attributions:n.attributions,interpolate:i,projection:n.projection,resolutions:n.resolutions,state:n.state})||this).canvasFunction_=n.canvasFunction,r.canvas_=null,r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return cR(e,t),e.prototype.getImageInternal=function(t,e,r,n){e=this.findNearestResolution(e);var i=this.canvas_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&It(i.getExtent(),t))return i;ee(t=t.slice(),this.ratio_);var o=[Jt(t)/e*r,Wt(t)/e*r],s=this.canvasFunction_.call(this,t,e,r,o,n);return s&&(i=new Ws(t,e,r,s)),this.canvas_=i,this.renderedRevision_=this.getRevision(),i},e}(aR);var fR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const pR=function(t){function e(e){var r=this,n=void 0!==e.crossOrigin?e.crossOrigin:null,i=void 0!==e.imageLoadFunction?e.imageLoadFunction:sR,o=void 0===e.imageSmoothing||e.imageSmoothing;return void 0!==e.interpolate&&(o=e.interpolate),(r=t.call(this,{attributions:e.attributions,interpolate:o,projection:rr(e.projection)})||this).url_=e.url,r.imageExtent_=e.imageExtent,r.image_=new cs(r.imageExtent_,void 0,1,r.url_,n,i),r.imageSize_=e.imageSize?e.imageSize:null,r.image_.addEventListener(P.CHANGE,r.handleImageChange.bind(r)),r}return fR(e,t),e.prototype.getImageExtent=function(){return this.imageExtent_},e.prototype.getImageInternal=function(t,e,r,n){return $t(t,this.image_.getExtent())?this.image_:null},e.prototype.getUrl=function(){return this.url_},e.prototype.handleImageChange=function(e){if(this.image_.getState()==Nn.LOADED){var r=this.image_.getExtent(),n=this.image_.getImage(),i=void 0,o=void 0;this.imageSize_?(i=this.imageSize_[0],o=this.imageSize_[1]):(i=n.width,o=n.height);var s=Jt(r),a=Wt(r),l=s/i,u=a/o,h=i,c=o;if(l>u?h=Math.round(s/u):c=Math.round(a/l),h!==i||c!==o){var A=Zn(h,c);this.getInterpolate()||x(A,yc);var f=A.canvas;A.drawImage(n,0,0,i,o,0,0,f.width,f.height),this.image_.setImage(f)}}t.prototype.handleImageChange.call(this,e)},e}(aR);var dR="1.3.0",gR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),yR=[101,101];const mR=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;return void 0!==n.interpolate&&(i=n.interpolate),(r=t.call(this,{attributions:n.attributions,interpolate:i,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:sR,r.params_=n.params||{},r.v13_=!0,r.updateV13_(),r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return gR(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){if(void 0!==this.url_){var i=rr(r),o=this.getProjection();o&&o!==i&&(e=fA(o,i,t,e),t=fr(t,i,o));var s=Kt(t,e,0,yR),a={SERVICE:"WMS",VERSION:dR,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};x(a,this.params_,n);var l=ge((t[0]-s[0])/e,4),u=ge((s[3]-t[1])/e,4);return a[this.v13_?"I":"X"]=l,a[this.v13_?"J":"Y"]=u,this.getRequestUrl_(s,yR,1,o||i,a)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.url_){var r={SERVICE:"WMS",VERSION:dR,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(Array.isArray(n)&&1!==n.length)return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i/28e-5}return x(r,e),lR(this.url_,r)}},e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),1==r||this.hidpi_&&void 0!==this.serverType_||(r=1);var i=e/r,o=zt(t),s=Kt(o,i,0,[ye(Jt(t)/i,4),ye(Wt(t)/i,4)]),a=Kt(o,i,0,[ye(this.ratio_*Jt(t)/i,4),ye(this.ratio_*Wt(t)/i,4)]),l=this.image_;if(l&&this.renderedRevision_==this.getRevision()&&l.getResolution()==e&&l.getPixelRatio()==r&&It(l.getExtent(),s))return l;var u={SERVICE:"WMS",VERSION:dR,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};x(u,this.params_),this.imageSize_[0]=de(Jt(a)/i,4),this.imageSize_[1]=de(Wt(a)/i,4);var h=this.getRequestUrl_(a,this.imageSize_,r,n,u);return this.image_=new cs(a,e,r,h,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(P.CHANGE,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){if(K(void 0!==this.url_,9),i[this.v13_?"CRS":"SRS"]=n.getCode(),"STYLES"in this.params_||(i.STYLES=""),1!=r)switch(this.serverType_){case"geoserver":var o=90*r+.5|0;"FORMAT_OPTIONS"in i?i.FORMAT_OPTIONS+=";dpi:"+o:i.FORMAT_OPTIONS="dpi:"+o;break;case"mapserver":i.MAP_RESOLUTION=90*r;break;case"carmentaserver":case"qgis":i.DPI=90*r;break;default:K(!1,8)}i.WIDTH=e[0],i.HEIGHT=e[1];var s,a=n.getAxisOrientation();return s=this.v13_&&"ne"==a.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,i.BBOX=s.join(","),lR(this.url_,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){x(this.params_,t),this.updateV13_(),this.image_=null,this.changed()},e.prototype.updateV13_=function(){var t=this.params_.VERSION||dR;this.v13_=function(t,e){for(var r=(""+t).split("."),n="1.3".split("."),i=0;i<Math.max(r.length,n.length);i++){var o=parseInt(r[i]||"0",10),s=parseInt(n[i]||"0",10);if(o>s)return 1;if(s>o)return-1}return 0}(t)>=0},e}(aR);var vR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const _R=function(t){function e(e){var r=t.call(this,{extent:e.extent,origin:e.origin,origins:e.origins,resolutions:e.resolutions,tileSize:e.tileSize,tileSizes:e.tileSizes,sizes:e.sizes})||this;return r.matrixIds_=e.matrixIds,r}return vR(e,t),e.prototype.getMatrixId=function(t){return this.matrixIds_[t]},e.prototype.getMatrixIds=function(){return this.matrixIds_},e}(FA);var wR=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const bR=function(t){function e(e){var r=this,n=void 0===e.imageSmoothing||e.imageSmoothing;void 0!==e.interpolate&&(n=e.interpolate);var i=void 0!==e.requestEncoding?e.requestEncoding:"KVP",o=e.tileGrid,s=e.urls;return void 0===s&&void 0!==e.url&&(s=VA(e.url)),(r=t.call(this,{attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:n,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:o,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,urls:s,wrapX:void 0!==e.wrapX&&e.wrapX,transition:e.transition,zDirection:e.zDirection})||this).version_=void 0!==e.version?e.version:"1.0.0",r.format_=void 0!==e.format?e.format:"image/jpeg",r.dimensions_=void 0!==e.dimensions?e.dimensions:{},r.layer_=e.layer,r.matrixSet_=e.matrixSet,r.style_=e.style,r.requestEncoding_=i,r.setKey(r.getKeyForDimensions_()),s&&s.length>0&&(r.tileUrlFunction=zA(s.map(r.createFromWMTSTemplate.bind(r)))),r}return wR(e,t),e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(zA(t.map(this.createFromWMTSTemplate.bind(this))),e)},e.prototype.getDimensions=function(){return this.dimensions_},e.prototype.getFormat=function(){return this.format_},e.prototype.getLayer=function(){return this.layer_},e.prototype.getMatrixSet=function(){return this.matrixSet_},e.prototype.getRequestEncoding=function(){return this.requestEncoding_},e.prototype.getStyle=function(){return this.style_},e.prototype.getVersion=function(){return this.version_},e.prototype.getKeyForDimensions_=function(){var t=0,e=[];for(var r in this.dimensions_)e[t++]=r+"-"+this.dimensions_[r];return e.join("/")},e.prototype.updateDimensions=function(t){x(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())},e.prototype.createFromWMTSTemplate=function(t){var e=this.requestEncoding_,r={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};"KVP"==e&&x(r,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t="KVP"==e?lR(t,r):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in r?r[e.toLowerCase()]:t}));var n=this.tileGrid,i=this.dimensions_;return function(r,o,s){if(r){var a={TileMatrix:n.getMatrixId(r[0]),TileCol:r[1],TileRow:r[2]};x(a,i);var l=t;return"KVP"==e?lR(l,a):l.replace(/\{(\w+?)\}/g,(function(t,e){return a[e]}))}}},e}(lf);class xR extends by{constructor(t){super(),r(this,"_map"),r(this,"segmentStyles"),r(this,"clearPrevious"),r(this,"showSegments"),r(this,"_tipPoint"),r(this,"_draw"),r(this,"isdraw"),r(this,"_source"),r(this,"layer"),r(this,"style"),r(this,"labelStyle"),r(this,"tipStyle"),r(this,"modifyStyle"),r(this,"segmentStyle"),r(this,"_modify"),this._map=t,this.segmentStyles=[],this.clearPrevious=!1,this.showSegments=!0,this._tipPoint=void 0,this.isdraw=!1,this._source=new Ks,this.layer=new Ms({source:this._source,zIndex:1e3,style:t=>this.styleFunction(t,this.showSegments,null,null)}),this.style=new Gi({fill:new Tn({color:"rgba(255, 255, 255, 0.2)"}),stroke:new kn({color:"rgba(255, 255, 0, 1)",lineDash:[10,10],width:2}),image:new ki({radius:5,stroke:new kn({color:"rgba(0, 0, 0, 1)"}),fill:new Tn({color:"rgba(255, 255, 255, 0.2)"})})}),this.labelStyle=new Gi({text:new zi({font:"14px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 1)"}),padding:[3,3,3,3],textBaseline:"bottom",offsetY:-15}),image:new Mi({radius:8,points:3,angle:Math.PI,displacement:[0,10],fill:new Tn({color:"rgba(0, 0, 0, 1)"})})}),this.tipStyle=new Gi({text:new zi({font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.8)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.modifyStyle=new Gi({image:new ki({radius:5,stroke:new kn({color:"rgba(255, 255,255, 0.7)"}),fill:new Tn({color:"rgba(0, 255, 255, 0.8)"})}),text:new zi({text:"拖动点修改图形",font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.7)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.segmentStyle=new Gi({text:new zi({font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.8)"}),padding:[2,2,2,2],textBaseline:"bottom",offsetY:-12}),image:new Mi({radius:6,points:3,angle:Math.PI,displacement:[0,8],fill:new Tn({color:"rgba(0, 0, 0, 0.8)"})})}),this._modify=new Ju({source:this._source,style:this.modifyStyle}),this._map.addLayer(this.layer),this._map.addInteraction(this._modify)}getSource(){return this._source}clear(){this._source.clear()}formatLength(t){const e=We(t);let r;return r=e>1e3?Math.round(e/1e3*100)/100+" km":Math.round(100*e)/100+" m",r}formatArea(t){const e=Ye(t);let r;return r=e>1e5?Math.round(e/1e6*100)/100+" km²":Math.round(100*e)/100+" m²",r}styleFunction(t,e,r,n){this.segmentStyles=[this.segmentStyle];const i=[this.style],o=t.getGeometry(),s=o.getType();let a,l,u;if(r&&r!==s||("Polygon"===s?(a=o.getInteriorPoint(),l=this.formatArea(o),u=new On(o.getCoordinates()[0])):"LineString"===s&&(a=new rn(o.getLastCoordinate()),l=this.formatLength(o),u=o)),e&&u){let t=0;u.forEachSegment(((e,r)=>{const n=new On([e,r]),o=this.formatLength(n);this.segmentStyles.length-1<t&&this.segmentStyles.push(this.segmentStyle.clone());const s=new rn(n.getCoordinateAt(.5));this.segmentStyles[t].setGeometry(s),this.segmentStyles[t].getText().setText(o),i.push(this.segmentStyles[t]),t++}))}return l&&(this.labelStyle.setGeometry(a),this.labelStyle.getText().setText(l),i.push(this.labelStyle)),n&&"Point"===s&&!this._modify.getOverlay().getSource().getFeatures().length&&(this._tipPoint=o,this.tipStyle.getText().setText(n),i.push(this.tipStyle)),i}stopMeasure(){this._draw.setActive(!1),this._map.removeInteraction(this._draw),this.isdraw=!1}addInteraction(t){if(this.isdraw)return;this.isdraw=!0;const e="单击继续绘制,双击结束绘制"+("Polygon"===t?"多边形":"线"),r="点击任意位置";let n=r;this._draw=new Gu({source:this._source,type:t,style:e=>this.styleFunction(e,!0,t,n)}),this._draw.on("drawstart",(t=>{this.clearPrevious&&this._source.clear(),this._modify.setActive(!1),n=e,this.trigger(jy.onDrawStart,t)})),this._draw.on("drawend",(t=>{this.isdraw=!1,this._modify.setActive(!0),n=r,t.feature.setProperties({featuretype:qy.Measure}),this.trigger(jy.onDrawEnd,t)})),this._modify.setActive(!0),this._map.addInteraction(this._draw)}}var CR=function(t){D.call(this,t),this._listener=[],t&&!1===t.active?this.set("active",!1):this.set("active",!0)};cm(CR,D),CR.prototype.setActive=function(t){this.set("active",!0===t)},CR.prototype.getActive=function(){return this.get("active")},function(){function t(t){this.get("active")&&t.context&&this.precompose(t)}function e(t){this.get("active")&&t.context&&this.postcompose(t)}function r(){if(this.renderSync)try{this.renderSync()}catch(UW){}else this.changed()}function n(n){this.filters_||(this.filters_=[]),this.filters_.push(n),n.addToLayer&&n.addToLayer(this),n.precompose&&n._listener.push({listener:this.on(["precompose","prerender"],t.bind(n)),target:this}),n.postcompose&&n._listener.push({listener:this.on(["postcompose","postrender"],e.bind(n)),target:this}),n._listener.push({listener:n.on("propertychange",r.bind(this)),target:this}),r.call(this)}function i(t){var e;if(this.filters_||(this.filters_=[]),t){for(e=this.filters_.length-1;e>=0;e--)this.filters_[e]===t&&this.filters_.splice(e,1);for(e=t._listener.length-1;e>=0;e--)t._listener[e].target===this&&(t.removeFromLayer&&t.removeFromLayer(this),N(t._listener[e].listener),t._listener.splice(e,1));r.call(this)}else this.filters_.forEach(function(t){this.removeFilter(t)}.bind(this))}fh.prototype.addFilter=function(t){n.call(this,t)},fh.prototype.removeFilter=function(t){i.call(this,t)},fh.prototype.getFilters=function(){return this.filters_||[]},qi.prototype.addFilter=function(t){n.call(this,t)},qi.prototype.removeFilter=function(t){i.call(this,t)},qi.prototype.getFilters=function(){return this.filters_||[]}}();var ER=function(t){if(CR.call(this,t=t||{}),t.feature)switch(t.feature.getGeometry().getType()){case"Polygon":case"MultiPolygon":this.feature_=t.feature}this.set("inner",t.inner),this.fillColor_=t.fill&&jn(t.fill.getColor())||"rgba(0,0,0,0.2)"};cm(ER,CR),ER.prototype.drawFeaturePath_=function(t,e){var r,n=t.context,i=n.canvas,o=t.frameState.pixelRatio;if(t.frameState.coordinateToPixelTransform){var s=t.frameState.coordinateToPixelTransform;if(t.inversePixelTransform){var a=t.inversePixelTransform;r=function(t){return[(t=[t[0]*s[0]+t[1]*s[1]+s[4],t[0]*s[2]+t[1]*s[3]+s[5]])[0]*a[0]-t[1]*a[1]+a[4],-t[0]*a[2]+t[1]*a[3]+a[5]]}}else r=function(t){return[(t[0]*s[0]+t[1]*s[1]+s[4])*o,(t[0]*s[2]+t[1]*s[3]+s[5])*o]}}else s=t.frameState.coordinateToPixelMatrix,r=function(t){return[(t[0]*s[0]+t[1]*s[1]+s[12])*o,(t[0]*s[4]+t[1]*s[5]+s[13])*o]};var l=this.feature_.getGeometry().getCoordinates();function u(t){for(var e=0;e<l.length;e++)for(var i=l[e],o=0;o<i.length;o++){var s=r([i[o][0][0]+t,i[o][0][1]]);n.moveTo(s[0],s[1]);for(var a=1;a<i[o].length;a++)s=r([i[o][a][0]+t,i[o][a][1]]),n.lineTo(s[0],s[1])}}if("Polygon"===this.feature_.getGeometry().getType()&&(l=[l]),n.beginPath(),e&&(n.moveTo(0,0),n.lineTo(i.width,0),n.lineTo(i.width,i.height),n.lineTo(0,i.height),n.lineTo(0,0)),this.get("wrapX")){var h=t.frameState.viewState.projection.getExtent(),c=h[2]-h[0],A=t.frameState.extent,f=this.feature_.getGeometry().getExtent(),p=f[2]-f[1],d=Math.floor((A[0]+p-h[0])/c),g=Math.floor((A[2]-p-h[2])/c)+1;d>g&&([d,g]=[g,d]);for(var y=d;y<=g;y++)u(y*c)}else u(0)},ER.prototype.postcompose=function(t){if(this.feature_){var e=t.context;e.save(),this.drawFeaturePath_(t,!this.get("inner")),e.fillStyle=this.fillColor_,e.fill("evenodd"),e.restore()}};var SR=function(t){CR.call(this,t=t||{}),this.set("blur",t.blur||8),this.set("intensity",t.intensity||.8)};cm(SR,CR),SR.prototype.precompose=function(){},SR.prototype.postcompose=function(t){var e=t.context,r=e.canvas,n=r.width,i=r.height,o=document.createElement("canvas");o.width=n,o.height=i;var s=o.getContext("2d");s.filter="grayscale(1) invert(1) blur("+this.get("blur")+"px)",s.drawImage(r,0,0),e.save(),this.get("color")?(e.globalCompositeOperation="darken",e.globalAlpha=.3,e.drawImage(r,0,0)):(e.filter="grayscale(1)",e.drawImage(r,0,0)),e.globalCompositeOperation="color-dodge",e.globalAlpha=this.get("intensity"),e.drawImage(o,0,0),e.restore()};var BR=function(t){CR.call(this,t),this.setFilter(t)};cm(BR,CR),BR.prototype.setFilter=function(t){switch(t=t||{}){case"grayscale":t={operation:"hue",color:[0,0,0],value:1};break;case"invert":t={operation:"difference",color:[255,255,255],value:1};break;case"sepia":t={operation:"color",color:[153,102,51],value:.6}}var e,r=t.color?qn(t.color):[t.red,t.green,t.blue,t.value];switch(this.set("color",jn(r)),this.set("value",t.value||1),this.set("preserveAlpha",t.preserveAlpha),t.operation){case"hue":case"difference":case"color-dodge":case"enhance":this.set("operation",t.operation);break;case"saturation":e=255*(t.value||0),this.set("color",jn([0,0,e,e||1])),this.set("operation",t.operation);break;case"luminosity":e=255*(t.value||0),this.set("color",jn([e,e,e,255])),this.set("operation","hard-light");break;case"contrast":e=255*(t.value||0),this.set("color",jn([e,e,e,255])),this.set("operation","soft-light");break;default:this.set("operation","color"),this.setValue(t.value||1)}},BR.prototype.setValue=function(t){this.set("value",t);var e=qn(this.get("color"));e[3]=t,this.set("color",jn(e))},BR.prototype.setColor=function(t){(t=qn(t))&&(t[3]=this.get("value"),this.set("color",jn(t)))},BR.prototype.precompose=function(){},BR.prototype.postcompose=function(t){var e,r,n=t.context,i=n.canvas;if(n.save(),"enhance"==this.get("operation")){var o=this.get("value");if(o){var s=i.width,a=i.height;this.get("preserveAlpha")?((e=document.createElement("CANVAS")).width=i.width,e.height=i.height,(r=e.getContext("2d")).drawImage(i,0,0,s,a),r.globalCompositeOperation="color-burn",r.globalAlpha=o,r.drawImage(e,0,0,s,a),r.drawImage(e,0,0,s,a),r.drawImage(e,0,0,s,a),n.globalCompositeOperation="source-in",n.drawImage(e,0,0)):(n.globalCompositeOperation="color-burn",n.globalAlpha=o,n.drawImage(i,0,0,s,a),n.drawImage(i,0,0,s,a),n.drawImage(i,0,0,s,a))}}else this.get("preserveAlpha")?((e=document.createElement("CANVAS")).width=i.width,e.height=i.height,(r=e.getContext("2d")).drawImage(i,0,0),r.globalCompositeOperation=this.get("operation"),r.fillStyle=this.get("color"),r.fillRect(0,0,i.width,i.height),n.globalCompositeOperation="source-in",n.drawImage(e,0,0)):(n.globalCompositeOperation=this.get("operation"),n.fillStyle=this.get("color"),n.fillRect(0,0,i.width,i.height));n.restore()};var IR=function(t){CR.call(this,t),this._svg={}};cm(IR,CR),IR.prototype.addSVGFilter=function(t){t.getId&&(t="#"+t.getId()),this._svg[t]=1,this.dispatchEvent({type:"propertychange",key:"svg",oldValue:this._svg})},IR.prototype.removeSVGFilter=function(t){t.getId&&(t="#"+t.getId()),delete this._svg[t],this.dispatchEvent({type:"propertychange",key:"svg",oldValue:this._svg})},IR.prototype.precompose=function(){},IR.prototype.postcompose=function(t){var e=[];for(var r in void 0!==this.get("url")&&e.push("url("+this.get("url")+")"),this._svg)e.push("url("+r+")");void 0!==this.get("blur")&&e.push("blur("+this.get("blur")+"px)"),void 0!==this.get("brightness")&&e.push("brightness("+this.get("brightness")+"%)"),void 0!==this.get("contrast")&&e.push("contrast("+this.get("contrast")+"%)"),void 0!==this.get("shadow")&&e.push("drop-shadow("+this.get("shadow")[0]+"px "+this.get("shadow")[1]+"px "+(this.get("shadowBlur")||0)+"px "+this.get("shadowColor")+")"),void 0!==this.get("grayscale")&&e.push("grayscale("+this.get("grayscale")+"%)"),void 0!==this.get("sepia")&&e.push("sepia("+this.get("sepia")+"%)"),void 0!==this.get("hueRotate")&&e.push("hue-rotate("+this.get("hueRotate")+"deg)"),void 0!==this.get("invert")&&e.push("invert("+this.get("invert")+"%)"),void 0!==this.get("saturate")&&e.push("saturate("+this.get("saturate")+"%)"),(e=e.join(" "))&&(t.context.save(),t.context.filter=e,t.context.drawImage(t.context.canvas,0,0),t.context.restore())};var TR=function(t){"string"==typeof t&&(t={feoperation:t}),t&&t.feoperation&&(D.call(this),this._name=t.feoperation,this.element=document.createElementNS(this.NS,this._name),this.setProperties(t),t.operations instanceof Array&&this.appendChild(t.operations))};cm(TR,D),TR.prototype.NS="http://www.w3.org/2000/svg",TR.prototype.getName=function(){return this._name},TR.prototype.set=function(t,e){/^feoperation$|^operations$/.test(t)||(D.prototype.set.call(this,t,e),this.element.setAttribute(t,e))},TR.prototype.setProperties=function(t){for(var e in t=t||{})this.set(e,t[e])},TR.prototype.geElement=function(){return this.element},TR.prototype.appendChild=function(t){t instanceof Array?t.forEach(function(t){this.appendChild(t)}.bind(this)):(t instanceof TR||(t=new TR(t)),this.element.appendChild(t.geElement()))};var PR=function(t){t=t||{},D.call(this),PR.prototype.svg||(PR.prototype.svg=document.createElementNS(this.NS,"svg"),PR.prototype.svg.setAttribute("version","1.1"),PR.prototype.svg.setAttribute("width",0),PR.prototype.svg.setAttribute("height",0),PR.prototype.svg.style.position="absolute",document.body.appendChild(PR.prototype.svg)),this.element=document.createElementNS(this.NS,"filter"),this._id=t.id||"_ol_SVGFilter_"+PR.prototype._id++,this.element.setAttribute("id",this._id),t.color&&this.element.setAttribute("color-interpolation-filters",t.color),t.operation&&this.addOperation(t.operation),PR.prototype.svg.appendChild(this.element)};cm(PR,D),PR.prototype.NS="http://www.w3.org/2000/svg",PR.prototype.svg=null,PR.prototype._id=0,PR.prototype.getId=function(){return this._id},PR.prototype.remove=function(){this.element.remove()},PR.prototype.addOperation=function(t){t instanceof Array?t.forEach(function(t){this.addOperation(t)}.bind(this)):(t instanceof TR||(t=new TR(t)),this.element.appendChild(t.geElement()))},PR.prototype.grayscale=function(t){this.addOperation({feoperation:"feColorMatrix",type:"saturate",values:t||0})},PR.prototype.luminanceToAlpha=function(t){t=t||{},this.addOperation({feoperation:"feColorMatrix",type:"luminanceToAlpha"}),t.gamma&&this.addOperation({feoperation:"feComponentTransfer",operations:[{feoperation:"feFuncA",type:"gamma",amplitude:t.gamma,exponent:1,offset:0}]})},PR.prototype.applyTo=function(t){var e=document.createElement("CANVAS");return e.width=t.naturalWidth||t.width,e.height=t.naturalHeight||t.height,e.getContext("2d").filter="url(#"+this.getId()+")",e.getContext("2d").drawImage(t,0,0),e};class FR extends Ky{constructor(t,e){super(t,e),r(this,"mask"),r(this,"pencil"),r(this,"colorize"),r(this,"canvasFilter"),r(this,"emboss"),r(this,"embossFilter"),r(this,"erode"),r(this,"erodeFilter"),r(this,"paperFilter"),r(this,"mImageExtent"),this.layerclass="tilelayer",this.mImageExtent=null,this.option={zIndex:900,projection:"EPSG:3857",url:"",ImageExtent:null,ImageExtentWKID:Yy.EPSG3857,opacity:1},this.option=Object.assign({},this.option,e),this.option.ImageExtent&&(this.mImageExtent=[this.option.ImageExtent.xmin,this.option.ImageExtent.ymin,this.option.ImageExtent.xmax,this.option.ImageExtent.ymax],this.option.ImageExtentWKID===Yy.EPSG4326&&(this.mImageExtent=pr(this.mImageExtent,"EPSG:4326","EPSG:3857")))}setOpacity(t){this.layer.setOpacity(t)}appendTo(t){t.addLayer(this.layer),this.isAdded=!0}addFilter(t){let e={feature:null,wrapX:!0,inner:!1,color:"rgba(255, 255, 255, 0.8)"};e=Object.assign({},e,t),this.mask=new ER({feature:e.feature,wrapX:e.wrapX,inner:e.inner,fill:new Tn({color:e.color})}),this.mask.set("active",!0),this.layer instanceof da?this.layer.getLayers().forEach((t=>{t.addFilter(this.mask)})):this.layer.addFilter(this.mask)}removeMaskFilter(){this.layer instanceof da?this.layer.getLayers().forEach((t=>{t.removeFilter(this.mask)})):this.layer.removeFilter(this.mask)}addPencilSketchFilter(){this.pencil=new SR,this.layer instanceof da?this.layer.getLayers().forEach((t=>{t.addFilter(this.pencil)})):this.layer.addFilter(this.pencil)}removePencilSketchFilter(){this.layer instanceof da?this.layer.getLayers().forEach((t=>{t.removeFilter(this.pencil)})):this.layer.removeFilter(this.pencil)}setPencilSketchFilter(t,e){this.pencil.set(t,e)}addColorizeFilter(t=!1){this.colorize=new BR;let e=new BR({operation:"enhance",value:1});this.layer instanceof da?this.layer.getLayers().forEach((r=>{t&&r.addFilter(e),r.addFilter(this.colorize)})):(t&&this.layer.addFilter(e),this.layer.addFilter(this.colorize))}removeColorizeFilter(){this.layer instanceof da?this.layer.getLayers().forEach((t=>{t.removeFilter(this.colorize)})):this.layer.removeFilter(this.colorize)}setColorizeFilter(t){switch(t.type){case tm.grayscale:case tm.invert:case tm.sepia:this.colorize.setFilter(t.type);break;default:this.colorize.setFilter({operation:t.type,red:Number(t.red),green:Number(t.green),blue:Number(t.blue),value:Number(t.value)})}}addCanvasFilter(){this.canvasFilter=new IR,this.erode=new TR({feoperation:"feMorphology",operator:"erode",radius:1}),this.emboss=new TR("feConvolveMatrix"),this.embossFilter=new PR({operation:this.emboss}),this.erodeFilter=new PR({operation:this.erode}),this.layer instanceof da?this.layer.getLayers().forEach((t=>{t.addFilter(this.canvasFilter)})):this.layer.addFilter(this.canvasFilter)}removeCanvasFilter(){this.layer instanceof da?this.layer.getLayers().forEach((t=>{t.removeFilter(this.canvasFilter)})):this.layer.removeFilter(this.canvasFilter)}setCanvasFilter(t,e){switch(t){case em.emboss:0===e?this.canvasFilter.removeSVGFilter(this.embossFilter):(this.emboss.set("kernelMatrix",[e,e,-e,e,1,-e,e,-e,-e]),this.canvasFilter.addSVGFilter(this.embossFilter));break;case em.erode:0===e?this.canvasFilter.removeSVGFilter(this.erodeFilter):(this.erode.set("radius",e),this.canvasFilter.addSVGFilter(this.erodeFilter));break;case em.paper:break;default:this.canvasFilter.set(t,e)}}}class LR extends FR{constructor(t,e){super(t,e),this.layerid=t,this.layertype="TileXyzLayer";let r=this;this.layerSource=new rO({tileUrlFunction:function(t,n,i){let o="C"+r.padLeft(t[1],8,16),s="R"+r.padLeft(t[2],8,16),a="L"+r.padLeft(t[0],2,10);return e.url.replace("{x}",o).replace("{y}",s).replace("{z}",a)}}),this.layer=new Af({zIndex:e.zIndex,source:this.layerSource}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(this.mImageExtent),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}padLeft(t,e,r){let n=t.toString(r||10);return(new Array(e).join("0")+n).slice(-e)}}class MR extends FR{constructor(t,e){super(t,e),this.layertype="ArcGisMapServerLayer",this.layerSource=new hR(e),this.layer=new bc({source:this.layerSource}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(this.mImageExtent),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}}var OR={},kR={get exports(){return OR},set exports(t){OR=t}},NR={},RR={get exports(){return NR},set exports(t){NR=t}};const UR=Ji(IN);var DR;function QR(){return DR||(DR=1,function(t,e){var r;t.exports=(r=r||function(t,e){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==Zi&&Zi.crypto&&(r=Zi.crypto),!r)try{r=UR}catch(d){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(d){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(d){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),o={},s=o.lib={},a=s.Base={extend:function(t){var e=i(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},l=s.WordArray=a.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||h).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var s=r[o>>>2]>>>24-o%4*8&255;e[n+o>>>2]|=s<<24-(n+o)%4*8}else for(var a=0;a<i;a+=4)e[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r<t;r+=4)e.push(n());return new l.init(e,t)}}),u=o.enc={},h=u.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var o=e[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new l.init(r,e/2)}},c=u.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var o=e[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new l.init(r,e)}},A=u.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(UW){throw new Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},f=s.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=A.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r,n=this._data,i=n.words,o=n.sigBytes,s=this.blockSize,a=o/(4*s),u=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,h=t.min(4*u,o);if(u){for(var c=0;c<u;c+=s)this._doProcessBlock(i,c);r=i.splice(0,u),n.sigBytes-=h}return new l.init(r,h)},clone:function(){var t=a.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});s.Hasher=f.extend({cfg:a.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new p.HMAC.init(t,r).finalize(e)}}});var p=o.algo={};return o}(Math),r)}(RR)),NR}var GR,jR={},HR={get exports(){return jR},set exports(t){jR=t}};var zR,VR,KR,qR,WR={},XR={get exports(){return WR},set exports(t){WR=t}},YR={},ZR={get exports(){return YR},set exports(t){YR=t}},JR={},$R={get exports(){return JR},set exports(t){JR=t}},tU={},eU={get exports(){return tU},set exports(t){tU=t}};function rU(){return qR||(qR=1,function(t,e){var r,n,i,o,s,a,l,u;t.exports=(u=QR(),VR||(VR=1,function(t,e){var r,n,i,o,s,a,l,u;t.exports=(n=(r=u=QR()).lib,i=n.WordArray,o=n.Hasher,s=r.algo,a=[],l=s.SHA1=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],l=r[4],u=0;u<80;u++){if(u<16)a[u]=0|t[e+u];else{var h=a[u-3]^a[u-8]^a[u-14]^a[u-16];a[u]=h<<1|h>>>31}var c=(n<<5|n>>>27)+l+a[u];c+=u<20?1518500249+(i&o|~i&s):u<40?1859775393+(i^o^s):u<60?(i&o|i&s|o&s)-1894007588:(i^o^s)-899497514,l=s,s=o,o=i<<30|i>>>2,i=n,n=c}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+l|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),e[15+(n+64>>>9<<4)]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}}),r.SHA1=o._createHelper(l),r.HmacSHA1=o._createHmacHelper(l),u.SHA1)}($R)),KR||(KR=1,function(t,e){var r,n,i;t.exports=(n=(r=QR()).lib.Base,i=r.enc.Utf8,void(r.algo.HMAC=n.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=i.parse(e));var r=t.blockSize,n=4*r;e.sigBytes>n&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),s=this._iKey=e.clone(),a=o.words,l=s.words,u=0;u<r;u++)a[u]^=1549556828,l[u]^=909522486;o.sigBytes=s.sigBytes=n,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,r=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(r))}})))}(eU)),i=(n=(r=u).lib).Base,o=n.WordArray,a=(s=r.algo).MD5,l=s.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var r,n=this.cfg,i=n.hasher.create(),s=o.create(),a=s.words,l=n.keySize,u=n.iterations;a.length<l;){r&&i.update(r),r=i.update(t).finalize(e),i.reset();for(var h=1;h<u;h++)r=i.finalize(r),i.reset();s.concat(r)}return s.sigBytes=4*l,s}}),r.EvpKDF=function(t,e,r){return l.create(r).compute(t,e)},u.EvpKDF)}(ZR)),YR}var nU,iU={},oU={get exports(){return iU},set exports(t){iU=t}};!function(t,e){var r;t.exports=(r=QR(),GR||(GR=1,function(t,e){var r,n,i;t.exports=(r=QR(),i=(n=r).lib.WordArray,n.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp();for(var i=[],o=0;o<r;o+=3)for(var s=(e[o>>>2]>>>24-o%4*8&255)<<16|(e[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|e[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<r;a++)i.push(n.charAt(s>>>6*(3-a)&63));var l=n.charAt(64);if(l)for(;i.length%4;)i.push(l);return i.join("")},parse:function(t){var e=t.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var o=0;o<r.length;o++)n[r.charCodeAt(o)]=o}var s=r.charAt(64);if(s){var a=t.indexOf(s);-1!==a&&(e=a)}return function(t,e,r){for(var n=[],o=0,s=0;s<e;s++)if(s%4){var a=r[t.charCodeAt(s-1)]<<s%4*2|r[t.charCodeAt(s)]>>>6-s%4*2;n[o>>>2]|=a<<24-o%4*8,o++}return i.create(n,o)}(t,e,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},r.enc.Base64)}(HR)),zR||(zR=1,function(t,e){var r;t.exports=(r=QR(),function(t){var e=r,n=e.lib,i=n.WordArray,o=n.Hasher,s=e.algo,a=[];!function(){for(var e=0;e<64;e++)a[e]=4294967296*t.abs(t.sin(e+1))|0}();var l=s.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var n=e+r,i=t[n];t[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,s=t[e+0],l=t[e+1],f=t[e+2],p=t[e+3],d=t[e+4],g=t[e+5],y=t[e+6],m=t[e+7],v=t[e+8],_=t[e+9],w=t[e+10],b=t[e+11],x=t[e+12],C=t[e+13],E=t[e+14],S=t[e+15],B=o[0],I=o[1],T=o[2],P=o[3];B=u(B,I,T,P,s,7,a[0]),P=u(P,B,I,T,l,12,a[1]),T=u(T,P,B,I,f,17,a[2]),I=u(I,T,P,B,p,22,a[3]),B=u(B,I,T,P,d,7,a[4]),P=u(P,B,I,T,g,12,a[5]),T=u(T,P,B,I,y,17,a[6]),I=u(I,T,P,B,m,22,a[7]),B=u(B,I,T,P,v,7,a[8]),P=u(P,B,I,T,_,12,a[9]),T=u(T,P,B,I,w,17,a[10]),I=u(I,T,P,B,b,22,a[11]),B=u(B,I,T,P,x,7,a[12]),P=u(P,B,I,T,C,12,a[13]),T=u(T,P,B,I,E,17,a[14]),B=h(B,I=u(I,T,P,B,S,22,a[15]),T,P,l,5,a[16]),P=h(P,B,I,T,y,9,a[17]),T=h(T,P,B,I,b,14,a[18]),I=h(I,T,P,B,s,20,a[19]),B=h(B,I,T,P,g,5,a[20]),P=h(P,B,I,T,w,9,a[21]),T=h(T,P,B,I,S,14,a[22]),I=h(I,T,P,B,d,20,a[23]),B=h(B,I,T,P,_,5,a[24]),P=h(P,B,I,T,E,9,a[25]),T=h(T,P,B,I,p,14,a[26]),I=h(I,T,P,B,v,20,a[27]),B=h(B,I,T,P,C,5,a[28]),P=h(P,B,I,T,f,9,a[29]),T=h(T,P,B,I,m,14,a[30]),B=c(B,I=h(I,T,P,B,x,20,a[31]),T,P,g,4,a[32]),P=c(P,B,I,T,v,11,a[33]),T=c(T,P,B,I,b,16,a[34]),I=c(I,T,P,B,E,23,a[35]),B=c(B,I,T,P,l,4,a[36]),P=c(P,B,I,T,d,11,a[37]),T=c(T,P,B,I,m,16,a[38]),I=c(I,T,P,B,w,23,a[39]),B=c(B,I,T,P,C,4,a[40]),P=c(P,B,I,T,s,11,a[41]),T=c(T,P,B,I,p,16,a[42]),I=c(I,T,P,B,y,23,a[43]),B=c(B,I,T,P,_,4,a[44]),P=c(P,B,I,T,x,11,a[45]),T=c(T,P,B,I,S,16,a[46]),B=A(B,I=c(I,T,P,B,f,23,a[47]),T,P,s,6,a[48]),P=A(P,B,I,T,m,10,a[49]),T=A(T,P,B,I,E,15,a[50]),I=A(I,T,P,B,g,21,a[51]),B=A(B,I,T,P,x,6,a[52]),P=A(P,B,I,T,p,10,a[53]),T=A(T,P,B,I,w,15,a[54]),I=A(I,T,P,B,l,21,a[55]),B=A(B,I,T,P,v,6,a[56]),P=A(P,B,I,T,S,10,a[57]),T=A(T,P,B,I,y,15,a[58]),I=A(I,T,P,B,C,21,a[59]),B=A(B,I,T,P,d,6,a[60]),P=A(P,B,I,T,b,10,a[61]),T=A(T,P,B,I,f,15,a[62]),I=A(I,T,P,B,_,21,a[63]),o[0]=o[0]+B|0,o[1]=o[1]+I|0,o[2]=o[2]+T|0,o[3]=o[3]+P|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var o=t.floor(n/4294967296),s=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),e.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,l=a.words,u=0;u<4;u++){var h=l[u];l[u]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return a},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});function u(t,e,r,n,i,o,s){var a=t+(e&r|~e&n)+i+s;return(a<<o|a>>>32-o)+e}function h(t,e,r,n,i,o,s){var a=t+(e&n|r&~n)+i+s;return(a<<o|a>>>32-o)+e}function c(t,e,r,n,i,o,s){var a=t+(e^r^n)+i+s;return(a<<o|a>>>32-o)+e}function A(t,e,r,n,i,o,s){var a=t+(r^(e|~n))+i+s;return(a<<o|a>>>32-o)+e}e.MD5=o._createHelper(l),e.HmacMD5=o._createHmacHelper(l)}(Math),r.MD5)}(XR)),rU(),nU||(nU=1,function(t,e){var r;t.exports=(r=QR(),rU(),void(r.lib.Cipher||function(t){var e=r,n=e.lib,i=n.Base,o=n.WordArray,s=n.BufferedBlockAlgorithm,a=e.enc;a.Utf8;var l=a.Base64,u=e.algo.EvpKDF,h=n.Cipher=s.extend({cfg:i.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?v:y}return function(e){return{encrypt:function(r,n,i){return t(n).encrypt(e,r,n,i)},decrypt:function(r,n,i){return t(n).decrypt(e,r,n,i)}}}}()});n.StreamCipher=h.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var c=e.mode={},A=n.BlockCipherMode=i.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),f=c.CBC=function(){var e=A.extend();function r(e,r,n){var i,o=this._iv;o?(i=o,this._iv=t):i=this._prevBlock;for(var s=0;s<n;s++)e[r+s]^=i[s]}return e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize;r.call(this,t,e,i),n.encryptBlock(t,e),this._prevBlock=t.slice(e,e+i)}}),e.Decryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,o=t.slice(e,e+i);n.decryptBlock(t,e),r.call(this,t,e,i),this._prevBlock=o}}),e}(),p=(e.pad={}).Pkcs7={pad:function(t,e){for(var r=4*e,n=r-t.sigBytes%r,i=n<<24|n<<16|n<<8|n,s=[],a=0;a<n;a+=4)s.push(i);var l=o.create(s,n);t.concat(l)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}};n.BlockCipher=h.extend({cfg:h.cfg.extend({mode:f,padding:p}),reset:function(){var t;h.reset.call(this);var e=this.cfg,r=e.iv,n=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=n.createEncryptor:(t=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,r&&r.words):(this._mode=t.call(n,this,r&&r.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4});var d=n.CipherParams=i.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),g=(e.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,r=t.salt;return(r?o.create([1398893684,1701076831]).concat(r).concat(e):e).toString(l)},parse:function(t){var e,r=l.parse(t),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(e=o.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),d.create({ciphertext:r,salt:e})}},y=n.SerializableCipher=i.extend({cfg:i.extend({format:g}),encrypt:function(t,e,r,n){n=this.cfg.extend(n);var i=t.createEncryptor(r,n),o=i.finalize(e),s=i.cfg;return d.create({ciphertext:o,key:r,iv:s.iv,algorithm:t,mode:s.mode,padding:s.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(r,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),m=(e.kdf={}).OpenSSL={execute:function(t,e,r,n){n||(n=o.random(8));var i=u.create({keySize:e+r}).compute(t,n),s=o.create(i.words.slice(e),4*r);return i.sigBytes=4*e,d.create({key:i,iv:s,salt:n})}},v=n.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:m}),encrypt:function(t,e,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,t.keySize,t.ivSize);n.iv=i.iv;var o=y.encrypt.call(this,t,e,i.key,n);return o.mixIn(i),o},decrypt:function(t,e,r,n){n=this.cfg.extend(n),e=this._parse(e,n.format);var i=n.kdf.execute(r,t.keySize,t.ivSize,e.salt);return n.iv=i.iv,y.decrypt.call(this,t,e,i.key,n)}})}()))}(oU)),function(){var t=r,e=t.lib,n=e.WordArray,i=e.BlockCipher,o=t.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],c=o.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],r=0;r<56;r++){var n=s[r]-1;e[r]=t[n>>>5]>>>31-n%32&1}for(var i=this._subKeys=[],o=0;o<16;o++){var u=i[o]=[],h=l[o];for(r=0;r<24;r++)u[r/6|0]|=e[(a[r]-1+h)%28]<<31-r%6,u[4+(r/6|0)]|=e[28+(a[r+24]-1+h)%28]<<31-r%6;for(u[0]=u[0]<<1|u[0]>>>31,r=1;r<7;r++)u[r]=u[r]>>>4*(r-1)+3;u[7]=u[7]<<5|u[7]>>>27}var c=this._invSubKeys=[];for(r=0;r<16;r++)c[r]=i[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,r){this._lBlock=t[e],this._rBlock=t[e+1],A.call(this,4,252645135),A.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),A.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],o=this._lBlock,s=this._rBlock,a=0,l=0;l<8;l++)a|=u[l][((s^i[l])&h[l])>>>0];this._lBlock=s,this._rBlock=o^a}var c=this._lBlock;this._lBlock=this._rBlock,this._rBlock=c,A.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),A.call(this,16,65535),A.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function A(t,e){var r=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=r,this._lBlock^=r<<t}function f(t,e){var r=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<<t}t.DES=i._createHelper(c);var p=o.TripleDES=i.extend({_doReset:function(){var t=this._key.words;if(2!==t.length&&4!==t.length&&t.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var e=t.slice(0,2),r=t.length<4?t.slice(0,2):t.slice(2,4),i=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=c.createEncryptor(n.create(e)),this._des2=c.createEncryptor(n.create(r)),this._des3=c.createEncryptor(n.create(i))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=i._createHelper(p)}(),r.TripleDES)}(kR);var sU={};!function(t,e){t.exports=QR().enc.Utf8}({get exports(){return sU},set exports(t){sU=t}});const aU=n({__proto__:null,default:sU},[sU]);class lU{getMessage(){}scanApk(t,e){let r=!1;try{let n=JSON.parse(this.Decrypt1(t)),i="";if(n.EndUser&&n.version&&parseInt(n.version.split(".")[0])<=parseInt(e.split(".")[0])&&(r=!0),r){let t=this.getVersionsInfo2(n.EndUser,e);i="%c"+t.name+"%c \n\n"+t.version+"\n"+t.Copyright}else{let t=this.getVersionsInfo(e);i="%c"+t.name+"%c \n\n"+t.version+"\n"+t.Copyright+"\n\n"+t.ContactUs}return r}catch{let t=this.getVersionsInfo(e);return t.name,t.version,t.Copyright,t.ContactUs,!1}}getVersionsInfo(t){return{name:"Mirage2D平台",Copyright:'版权声明:\n 1. Mirage2D版权完全属于 "西安唐远信息科技有限公司".\n 2. Mirage2D软件包,任何人或组织在遵守下列条件的前提下可以永久免费使用:\n 1)不进行任何形式的破解和裁剪,程序包完整引用;\n 2)保留对此版权信息在控制台输出. \n 我们保留对此版权信息的最终解释权.',expirationDate:" 2024-03-29",Author:"xd",EndUser:"授权信息:西安唐远信息科技有限公司",version:"版 本 号:"+t,ContactUs:"联系方式:20276704@qq.com"}}getVersionsInfo2(t,e){return{name:t,version:"版 本 号:"+e,Copyright:'版权声明:\n 1. 当前平台版本属于"'+t+'"独自所有.\n 2. 其中Mirage2D版权完全属于"西安唐远信息科技有限公司"所有,已授权"'+t+'"永久使用Mirage2D当前版本.'}}Encrypt1(t){return OR.encrypt(t,"apple3D").toString()}Decrypt1(t){return OR.decrypt(t,"apple3D").toString(aU)}}class uU extends xy{constructor(){super(),r(this,"_map"),r(this,"contextmenuitems"),r(this,"contextmenu"),r(this,"EventType"),this._map=null,this.contextmenuitems=[],this.contextmenu=null,this.EventType=Vy}initContextmenu(){this.contextmenu=new Gy({id:"contextmenu",width:150,defaultItems:!0,items:this.contextmenuitems}),this.contextmenu&&(this.contextmenu.set("id","contextmenu"),this._map&&(this._map.addControl(this.contextmenu),this.contextmenu.on("beforeopen",(t=>{if(this._map){let e=this._map.forEachFeatureAtPixel(t.pixel,(function(t,e){return t}));this.contextmenu.clear(),e?void 0!==e.get("featuretype")&&"量测图层"!==e.get("featuretype")||this.contextmenu.extend([{text:"定位到",icon:"img/marker.png",callback:t=>{this._map&&this._map.getView().setCenter(t.data.Center)},data:{Center:t.coordinate}}]):this.contextmenuitems.forEach((e=>{e.data={e:t}}))}})),this.contextmenu.on("open",(t=>{if(this._map){t.coordinate;let e=!1;if(this._map.getOverlays().forEach((r=>{let n=r.getElement();if(n&&"none"!==n.style.display){let i=t.pixel,o=n.getBoundingClientRect();o.left<=i[0]&&i[0]<=o.right&&o.top<=i[1]&&i[1]<=o.bottom&&(e=!0,r.dispatchEvent({type:this.EventType.featureType.onFeatureContextmenu,data:{contextmenu:this.contextmenu}}))}})),!e){let e=this._map.forEachFeatureAtPixel(t.pixel,(function(t,e){return{feature:t,layer:e}}));e?e.layer&&e.layer.dispatchEvent({type:this.EventType.featureType.onFeatureContextmenu,data:{feature:e.feature,layer:e.layer,contextmenu:this.contextmenu}}):this.trigger(this.EventType.XMapEventType.onMapContextmenu,t)}}}))))}}class hU extends FR{constructor(t,e){super(t,e),r(this,"projection"),this.layertype="TileXyzLayer",this.projection=this.option.projection,"GCJ02"===e.chinaCRS&&this.setGCJ02(),this.layerSource=new rO({url:e.url,crossOrigin:"Anonymous",projection:this.projection}),this.layer=new Af({zIndex:e.zIndex,source:this.layerSource,useInterimTilesOnError:!1}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(pr(this.mImageExtent,"EPSG:4326","EPSG:3857")),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}setGCJ02(){const t=new oe({code:"GCJ02",extent:[-20037508.342789244,-20037508.342789244,20037508.342789244,20037508.342789244],units:"m"});this.projection=t,er(t);let e=function(t){return function(e,r,n){let i,o=e.length,s=n||2;i=r||(2!==s?e.slice():new Array(o));for(let a=0;a<o;a+=s)t(e,i,a);return i}},r={},n=Math.PI,i=6378245,o=.006693421622965943;function s(t,e){let r=function(t,e){let r=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*n)+20*Math.sin(2*t*n))/3,r+=2*(20*Math.sin(e*n)+40*Math.sin(e/3*n))/3,r+=2*(160*Math.sin(e/12*n)+320*Math.sin(e*n/30))/3,r}(t-105,e-35),s=function(t,e){let r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*n)+20*Math.sin(2*t*n))/3,r+=2*(20*Math.sin(t*n)+40*Math.sin(t/3*n))/3,r+=2*(150*Math.sin(t/12*n)+300*Math.sin(t/30*n))/3,r}(t-105,e-35),a=e/180*n,l=Math.sin(a);l=1-o*l*l;let u=Math.sqrt(l);return r=180*r/(i*(1-o)/(l*u)*n),s=180*s/(i/u*Math.cos(a)*n),[s,r]}function a(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271}r.toWGS84=e((function(t,e,r){let n=t[r],i=t[r+1];if(!a(n,i)){let t=s(n,i);n-=t[0],i-=t[1]}e[r]=n,e[r+1]=i})),r.fromWGS84=e((function(t,e,r){let n=t[r],i=t[r+1];if(!a(n,i)){let t=s(n,i);n+=t[0],i+=t[1]}e[r]=n,e[r+1]=i}));let l={},u=6378137,h=Math.PI/180;l.forward=e((function(t,e,r){let n=Math.max(Math.min(85.0511287798,t[r+1]),-85.0511287798),i=Math.sin(n*h);e[r]=u*t[r]*h,e[r+1]=u*Math.log((1+i)/(1-i))/2})),l.inverse=e((function(t,e,r){e[r]=t[r]/u/h,e[r+1]=(2*Math.atan(Math.exp(t[r+1]/u))-Math.PI/2)/h}));let c={ll2gmerc:function(t,e,n){let i=r.fromWGS84(t,e,n);return c.ll2smerc(i,i,n)},gmerc2ll:function(t,e,n){let i=c.smerc2ll(t,t,n);return r.toWGS84(i,e,n)},smerc2gmerc:function(t,e,n){let i=c.smerc2ll(t,t,n);return i=r.fromWGS84(i,i,n),c.ll2smerc(i,i,n)},gmerc2smerc:function(t,e,n){let i=c.smerc2ll(t,t,n);return i=r.toWGS84(i,i,n),c.ll2smerc(i,i,n)}};c.ll2smerc=l.forward,c.smerc2ll=l.inverse,ar("EPSG:4326",t,c.ll2gmerc,c.gmerc2ll),ar("EPSG:3857",t,c.smerc2gmerc,c.gmerc2smerc)}}class cU extends hU{constructor(t,e){super(t,e),this.layertype="TileTencentLayer",this.layerSource.setTileUrlFunction((function(t){let r=e.url,n=t[1],i=(1<<t[0])-t[2]-1,o=t[0],s=t[1]>>4,a=(1<<t[0])-t[2]-1>>4;if(e.subdomains&&r.indexOf("{s}")>0){let t=e.subdomains.split(",");r=r.replace("{s}",t[Math.floor(Math.random()*t.length)])}return r.replaceAll("{x}",n.toString()).replace("{ry}",i.toString()).replace("{z}",o.toString()).replace("{sx}",s.toString()).replace("{sy}",a.toString())}))}}var AU={},fU={},pU={},dU=function(t){return function(e,r,n){var i,o=e.length,s=n||2;i=r||(2!==s?e.slice():new Array(o));for(var a=0;a<o;a+=s)t(e,i,a);return i}},gU=dU,yU=[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],mU=[75,60,45,30,15,0],vU=[[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]],_U=[[-.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]];function wU(t,e,r,n){var i=t[r],o=t[r+1],s=n[0]+n[1]*Math.abs(i),a=Math.abs(o)/n[9],l=n[2]+n[3]*a+n[4]*a*a+n[5]*a*a*a+n[6]*a*a*a*a+n[7]*a*a*a*a*a+n[8]*a*a*a*a*a*a;e[r]=s*(i<0?-1:1),e[r+1]=l*(o<0?-1:1)}pU.forward=gU((function(t,e,r){var n,i,o=function(t,e,r){for(;t>180;)t-=360;for(;t<-180;)t+=360;return t}(t[r]),s=(n=t[r+1],n=Math.max(n,-74),Math.min(n,74)),a=null;for(i=0;i<mU.length;++i)if(s>=mU[i]){a=_U[i];break}if(null===a)for(i=mU.length-1;i>=0;--i)if(s<=-mU[i]){a=_U[i];break}e[r]=o,e[r+1]=s,wU(e,e,r,a)})),pU.inverse=gU((function(t,e,r){for(var n=Math.abs(t[r+1]),i=null,o=0;o<yU.length;o++)if(n>=yU[o]){i=vU[o];break}wU(t,e,r,i)}));var bU={},xU=dU,CU=6378137,EU=85.0511287798,SU=Math.PI/180;bU.forward=xU((function(t,e,r){var n=Math.max(Math.min(EU,t[r+1]),-EU),i=Math.sin(n*SU);e[r]=CU*t[r]*SU,e[r+1]=CU*Math.log((1+i)/(1-i))/2})),bU.inverse=xU((function(t,e,r){e[r]=t[r]/CU/SU,e[r+1]=(2*Math.atan(Math.exp(t[r+1]/CU))-Math.PI/2)/SU})),fU.baiduMercator=pU,fU.sphericalMercator=bU;var BU={},IU={},TU={},PU=dU,FU=Math.PI,LU=6378245,MU=.006693421622965943;function OU(t,e){var r,n,i,o=(i=2*(r=t-105)-100+3*(n=e-35)+.2*n*n+.1*r*n+.2*Math.sqrt(Math.abs(r)),i+=2*(20*Math.sin(6*r*FU)+20*Math.sin(2*r*FU))/3,i+=2*(20*Math.sin(n*FU)+40*Math.sin(n/3*FU))/3,i+=2*(160*Math.sin(n/12*FU)+320*Math.sin(n*FU/30))/3),s=function(t,e){var r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*FU)+20*Math.sin(2*t*FU))/3,(r+=2*(20*Math.sin(t*FU)+40*Math.sin(t/3*FU))/3)+2*(150*Math.sin(t/12*FU)+300*Math.sin(t/30*FU))/3}(t-105,e-35),a=e/180*FU,l=Math.sin(a);l=1-MU*l*l;var u=Math.sqrt(l);return o=180*o/(LU*(1-MU)/(l*u)*FU),[s=180*s/(LU/u*Math.cos(a)*FU),o]}function kU(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271}TU.toWGS84=PU((function(t,e,r){var n=t[r],i=t[r+1];if(!kU(n,i)){var o=OU(n,i);n-=o[0],i-=o[1]}e[r]=n,e[r+1]=i})),TU.fromWGS84=PU((function(t,e,r){var n=t[r],i=t[r+1];if(!kU(n,i)){var o=OU(n,i);n+=o[0],i+=o[1]}e[r]=n,e[r+1]=i}));var NU=dU,RU=TU,UU=3e3*Math.PI/180,DU=IU.toGCJ02=NU((function(t,e,r){var n=t[r]-.0065,i=t[r+1]-.006,o=Math.sqrt(n*n+i*i)-2e-5*Math.sin(i*UU),s=Math.atan2(i,n)-3e-6*Math.cos(n*UU);return e[r]=o*Math.cos(s),e[r+1]=o*Math.sin(s),e})),QU=IU.fromGCJ02=NU((function(t,e,r){var n=t[r],i=t[r+1],o=Math.sqrt(n*n+i*i)+2e-5*Math.sin(i*UU),s=Math.atan2(i,n)+3e-6*Math.cos(n*UU);return e[r]=o*Math.cos(s)+.0065,e[r+1]=o*Math.sin(s)+.006,e}));IU.toWGS84=function(t,e,r){var n=DU(t,e,r);return RU.toWGS84(n,n,r)},IU.fromWGS84=function(t,e,r){var n=RU.fromWGS84(t,e,r);return QU(n,n,r)},BU.bd09=IU,BU.gcj02=TU;var GU=fU,jU=BU;AU.smerc2bmerc=function(t,e,r){var n=GU.sphericalMercator.inverse(t,e,r);return n=jU.bd09.fromWGS84(n,n,r),GU.baiduMercator.forward(n,n,r)},AU.bmerc2smerc=function(t,e,r){var n=GU.baiduMercator.inverse(t,e,r);return n=jU.bd09.toWGS84(n,n,r),GU.sphericalMercator.forward(n,n,r)},AU.bmerc2ll=function(t,e,r){var n=GU.baiduMercator.inverse(t,e,r);return jU.bd09.toWGS84(n,n,r)},AU.ll2bmerc=function(t,e,r){var n=jU.bd09.fromWGS84(t,e,r);return GU.baiduMercator.forward(n,n,r)},AU.ll2smerc=GU.sphericalMercator.forward,AU.smerc2ll=GU.sphericalMercator.inverse,AU.datum=jU,AU.projection=GU;class HU extends FR{constructor(t,e){super(t,e),this.layertype="TileBaiDuLayer";let r=[-20037725.11268234,-19994619.55417086,20037725.11268234,19994619.55417086],n=new oe({code:"baidu",extent:re(r,AU.ll2bmerc),units:"m"});er(n),ar("EPSG:4326",n,AU.ll2bmerc,AU.bmerc2ll),ar("EPSG:3857",n,AU.smerc2bmerc,AU.bmerc2smerc);let i=new Array(19);for(let s=0;s<19;++s)i[s]=Math.pow(2,18-s);let o=new FA({resolutions:i,origin:[0,0],extent:re(r,AU.ll2bmerc),tileSize:[256,256]});this.layerSource=new lf({projection:"baidu",tileGrid:o,tileUrlFunction:function(t,r,n){let i=e.url;if(e.subdomains&&i.indexOf("{s}")>0){let t=e.subdomains.split(",");i=i.replace("{s}",t[Math.floor(Math.random()*t.length)])}let o=t[0],s=t[1],a=-1-t[2];return i.replaceAll("{z}",o.toString()).replaceAll("{x}",s.toString()).replaceAll("{y}",a.toString())}}),this.layer=new Af({zIndex:e.zIndex,source:this.layerSource,useInterimTilesOnError:!1}),this.layer.set("layerid",t)}}class zU extends FR{constructor(t,e){super(t,e),this.layertype="TileGroupLayer";let r=[];e.layers.forEach((t=>{"xyz"===t.type?r.push(new hU(t.name,t).layer):"tencent"===t.type?r.push(new cU(t.name,t).layer):"baidu"===t.type&&r.push(new HU(t.name,t).layer)})),this.layer=new da({layers:r}),this.layer.set("layerid",t)}}class VU extends FR{constructor(t,e){super(t,e),this.layertype="imageLayer",this.layerSource=new pR({url:this.option.url,projection:this.option.projection,imageExtent:this.mImageExtent}),this.layer=new bc({source:this.layerSource,opacity:this.option.opacity}),this.layer.set("layerid",t),this.layerSource.on("tileloadstart",(function(t){})),this.layerSource.on("tileloadend",(function(t){})),this.layerSource.on("tileloaderror",(function(t){}))}}
86
86
  /*!
87
87
  * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
88
88
  * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>