dgeoutils 2.4.52 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/DPoint.d.ts +1 -0
- package/dist/cjs/DPoint.js +17 -0
- package/dist/cjs/DPolygon.d.ts +2 -0
- package/dist/cjs/DPolygon.js +85 -56
- package/dist/es2015/DPoint.js +17 -0
- package/dist/es2015/DPolygon.js +10 -0
- package/dist/esm/DPoint.js +17 -0
- package/dist/esm/DPolygon.js +85 -56
- package/dist/umd/dgeoutils.js +103 -57
- package/dist/umd/dgeoutils.min.js +1 -1
- package/dist/umd/dgeoutils.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jsts")):"function"==typeof define&&define.amd?define(["exports","jsts"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).DGeoUtils={},t.jsts)}(this,function(y,D){"use strict";function x(t){return function(){return t}}function s(b){return{checkArgument:function(t){return P.DEBUG?{shouldBeDegree:function(t){return t.likeWorldGeodeticSystem||M('"'.concat(v,'" -> "').concat(g,'" should be degree!')),m},shouldBeMeters:function(t){return t.likePseudoMercator||M('"'.concat(y,'" -> "').concat(d,'" should be meters!')),f},shouldBeInt:function(t){return t.clone().round().equal(t)||M('"'.concat(l,'" -> "').concat(p,'" should be Int!')),h},shouldBeUInt:function(t){return t.clone().round().equal(t)&&t.gtOrEqual(O.zero())||M('"'.concat(u,'" -> "').concat(c,'" should be UInt!')),a},shouldBeRadians:function(t){return t.likeRadians||M('"'.concat(i,'" -> "').concat(s,'" should be radians!')),o},shouldExist:(e=o=a=h=f=m=this,r=i=u=l=y=v=b,n=s=c=p=d=g=t,function(t){return w(t)||M('"'.concat(r,'" -> "').concat(n,'" should exist!')),e})}:{shouldBeDegree:x(this),shouldBeMeters:x(this),shouldBeInt:x(this),shouldBeUInt:x(this),shouldBeRadians:x(this),shouldExist:x(this)};var e,r,n,o,i,s,a,u,c,h,l,p,f,y,d,m,v,g}}}function G(t,r){var e=t.h,n=t.w;return"function"==typeof r?p(e).map(function(t,e){return p(n,function(t){return r(t,e)})}):p(e).map(function(){return p(n,r)})}function u(t){for(var e=t.length,r=G(new O(e+1,e)),n=0;n<e;n++)for(var o=0;o<e+1;o++)t[n][o]=0===t[n][o]?u.MIN:t[n][o],r[n][o]=t[n][o];for(var i=0;i<e;i++){for(n=0;n<e+1;n++)r[i][n]/=t[i][i];for(n=i+1;n<e;n++)for(var s=r[n][i]/r[i][i],o=0;o<e+1;o++)r[n][o]-=r[i][o]*s;for(n=0;n<e;n++)for(o=0;o<e+1;o++)t[n][o]=r[n][o]}for(i=e-1;-1<i;i--){for(n=e;-1<n;n--)r[i][n]/=t[i][i];for(n=i-1;-1<n;n--)for(s=r[n][i]/r[i][i],o=e;-1<o;o--)r[n][o]-=r[i][o]*s}for(var a=p(e),n=0;n<e;n++)a[n]=r[n][e];return a}function R(t,e,r){var n=0,o=0,i=!1,e=(o=t instanceof O?(n=t.x,t.y):n=t,"boolean"==typeof e?i=e:"number"==typeof e&&(o=e),(i="boolean"==typeof r?r:i)?new OffscreenCanvas(n,o):(null!=(t=R.document)?t:document).createElement("canvas"));return i||(e.width=n,e.height=o),[e,e.getContext("2d")]}function L(t,e){for(var r,n,o=[],i=2;i<arguments.length;i++)o[i-2]=arguments[i];return e?L.apply(void 0,l([(r=t,n=e,[].concat.apply([],l([],h(r.map(function(e){return n.map(function(t){return[].concat(e,t)})})),!1)))],h(o),!1)):t}function E(t){if(1===t.length)return t[0];for(var e=[],r=E(t.slice(1)),n=0;n<r.length;n++)for(var o=0;o<t[0].length;o++)e.push(l([t[0][o]],h(r[n]),!1));return e}function a(t,e){return Math.floor(t/e)}function V(t){var e=t<0,r=Math.floor(Math.abs(t)),t=Math.abs(t)%1*60,n=Math.floor(t),t=(t%1*60).toFixed(2);return"".concat(e?"-":"").concat(r,"° ").concat(n,"' ").concat(t,'"')}var c,h=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},l=function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||((n=n||Array.prototype.slice.call(e,0,o))[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},Y=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},P={DEBUG:!1,parseFormat:"xyz"},M=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];P.DEBUG&&console.warn.apply(console,l([],h(t),!1))},w=function(t){return null!=t},p=function(t,r){return"function"==typeof r?new Array(t).fill(!1).map(function(t,e){return r(e)}):new Array(t).fill(null!=r?r:0)},f=(u.MIN=1e-10,e.like=function(t,e,r){return void 0===r&&(r=.001),Math.abs(t-e)<r},e.likeZero=function(t){return e.like(t,0)},e.like2PI=function(t){return e.like(e.rad2Deg(t),g)},e.likePI=function(t){return e.like(e.rad2Deg(t),i)},e.rad2Deg=function(t){return t*$},e.deg2Rad=function(t){return t*b},e);function e(){}(r=c=c||{})[r.getTileFromCoords=0]="getTileFromCoords",r[r.getCoordsFromTile=1]="getCoordsFromTile",r[r.height=2]="height",r[r.setX=3]="setX",r[r.setY=4]="setY",r[r.setZ=5]="setZ",r[r.rotate=6]="rotate",r[r.rotate3dX=7]="rotate3dX",r[r.rotate3dY=8]="rotate3dY",r[r.rotate3dZ=9]="rotate3dZ",r[r.move=10]="move",r[r.round=11]="round",r[r.ceil=12]="ceil",r[r.floor=13]="floor",r[r.toFixed=14]="toFixed",r[r.abs=15]="abs",r[r.scale=16]="scale",r[r.divide=17]="divide",r[r.degreeToRadians=18]="degreeToRadians",r[r.radiansToDegrees=19]="radiansToDegrees",r[r.radiansToMeters=20]="radiansToMeters",r[r.metersToRadians=21]="metersToRadians",r[r.hipPoint=22]="hipPoint",r[r.xPoint=23]="xPoint",r[r.yPoint=24]="yPoint",r[r.wPoint=25]="wPoint",r[r.hPoint=26]="hPoint",r[r.setIfLessThan=27]="setIfLessThan",r[r.minus=28]="minus",r[r.degreeToMeters=29]="degreeToMeters",r[r.metersToDegree=30]="metersToDegree",r[r.flipVertically=31]="flipVertically",r[r.setProperties=32]="setProperties",r[r.div=33]="div",r[r.mod=34]="mod";function q(r,t){var e=t.functionName,n=t.pointArg,o=t.numberPointArg,i=t.numberArg,s=t.setterArg,a=t.setterArgByObject,u=r;switch(e){case c.getTileFromCoords:u=function(t,e){return r(t,e).getTileFromCoords(i)};break;case c.getCoordsFromTile:u=function(t,e){return r(t,e).getCoordsFromTile(i)};break;case c.height:u=function(t,e){return r(t,e).height(i)};break;case c.setX:u=function(t,e){return"number"==typeof s?r(t,e).setX(s):r(t,e).setX(function(t){return s(t,e)})};break;case c.setY:u=function(t,e){return"number"==typeof s?r(t,e).setY(s):r(t,e).setY(function(t){return s(t,e)})};break;case c.setZ:u=function(t,e){return"number"==typeof s?r(t,e).setZ(s):r(t,e).setZ(function(t){return s(t,e)})};break;case c.rotate:u=function(t,e){return r(t,e).rotate(i)};break;case c.rotate3dX:u=function(t,e){return r(t,e).rotate3dX(i)};break;case c.rotate3dY:u=function(t,e){return r(t,e).rotate3dY(i)};break;case c.rotate3dZ:u=function(t,e){return r(t,e).rotate3dZ(i)};break;case c.move:u=function(t,e){return r(t,e).move(o,i)};break;case c.round:u=function(t,e){return r(t,e).round()};break;case c.ceil:u=function(t,e){return r(t,e).ceil()};break;case c.floor:u=function(t,e){return r(t,e).floor()};break;case c.toFixed:u=function(t,e){return r(t,e).toFixed(i)};break;case c.abs:u=function(t,e){return r(t,e).abs()};break;case c.scale:u=function(t,e){return r(t,e).scale(o,i)};break;case c.divide:u=function(t,e){return r(t,e).divide(o,i)};break;case c.div:u=function(t,e){return r(t,e).div(o,i)};break;case c.mod:u=function(t,e){return r(t,e).mod(o,i)};break;case c.degreeToRadians:u=function(t,e){return r(t,e).degreeToRadians()};break;case c.radiansToDegrees:u=function(t,e){return r(t,e).radiansToDegrees()};break;case c.radiansToMeters:u=function(t,e){return r(t,e).radiansToMeters()};break;case c.metersToRadians:u=function(t,e){return r(t,e).metersToRadians()};break;case c.hipPoint:u=function(t,e){return r(t,e).hipPoint};break;case c.xPoint:u=function(t,e){return r(t,e).xPoint};break;case c.yPoint:u=function(t,e){return r(t,e).yPoint};break;case c.wPoint:u=function(t,e){return r(t,e).wPoint};break;case c.hPoint:u=function(t,e){return r(t,e).hPoint};break;case c.setIfLessThan:u=function(t,e){return r(t,e).setIfLessThan(n)};break;case c.minus:u=function(t,e){return r(t,e).minus()};break;case c.degreeToMeters:u=function(t,e){return r(t,e).degreeToMeters()};break;case c.metersToDegree:u=function(t,e){return r(t,e).metersToDegree()};break;case c.flipVertically:u=function(t,e){return r(t,e).flipVertically(o)};break;case c.setProperties:u=function(t,e){return"object"==typeof a?r(t,e).setProperties(a):r(t,e).setProperties(function(t){return a(t,e)})}}return u}t.prototype.getLoopFunction=function(){return this.pool.reduce(q,function(t){return t})},t.prototype.run=function(){return this.parent.map(this.getLoopFunction())},t.prototype.getTileFromCoords=function(t){return this.pool.push({functionName:c.getTileFromCoords,numberArg:t}),this},t.prototype.getCoordsFromTile=function(t){return this.pool.push({functionName:c.getCoordsFromTile,numberArg:t}),this},t.prototype.height=function(t){return this.pool.push({functionName:c.height,numberArg:t}),this},t.prototype.setX=function(t){return this.pool.push({functionName:c.setX,setterArg:t}),this},t.prototype.setProperties=function(t){return this.pool.push({functionName:c.setProperties,setterArgByObject:t}),this},t.prototype.setY=function(t){return this.pool.push({functionName:c.setY,setterArg:t}),this},t.prototype.setZ=function(t){return this.pool.push({functionName:c.setZ,setterArg:t}),this},t.prototype.rotate=function(t){return this.pool.push({functionName:c.rotate,numberArg:t}),this},t.prototype.rotate3dX=function(t){return this.pool.push({functionName:c.rotate3dX,numberArg:t}),this},t.prototype.rotate3dY=function(t){return this.pool.push({functionName:c.rotate3dY,numberArg:t}),this},t.prototype.rotate3dZ=function(t){return this.pool.push({functionName:c.rotate3dZ,numberArg:t}),this},t.prototype.move=function(t,e){return this.pool.push({functionName:c.move,numberPointArg:t,numberArg:e=void 0===e?t:e}),this},t.prototype.round=function(){return this.pool.push({functionName:c.round}),this},t.prototype.ceil=function(){return this.pool.push({functionName:c.ceil}),this},t.prototype.floor=function(){return this.pool.push({functionName:c.floor}),this},t.prototype.toFixed=function(t){return this.pool.push({functionName:c.toFixed,numberArg:t=void 0===t?2:t}),this},t.prototype.abs=function(){return this.pool.push({functionName:c.abs}),this},t.prototype.scale=function(t,e){return this.pool.push({functionName:c.scale,numberPointArg:t,numberArg:e=void 0===e?t:e}),this},t.prototype.divide=function(t,e){return this.pool.push({functionName:c.divide,numberPointArg:t,numberArg:e}),this},t.prototype.div=function(t,e){return this.pool.push({functionName:c.div,numberPointArg:t,numberArg:e}),this},t.prototype.mod=function(t,e){return this.pool.push({functionName:c.mod,numberPointArg:t,numberArg:e}),this},t.prototype.degreeToRadians=function(){return this.pool.push({functionName:c.degreeToRadians}),this},t.prototype.radiansToDegrees=function(){return this.pool.push({functionName:c.radiansToDegrees}),this},t.prototype.radiansToMeters=function(){return this.pool.push({functionName:c.radiansToMeters}),this},t.prototype.metersToRadians=function(){return this.pool.push({functionName:c.metersToRadians}),this},t.prototype.getHipPoint=function(){return this.pool.push({functionName:c.hipPoint}),this},t.prototype.getXPoint=function(){return this.pool.push({functionName:c.xPoint}),this},t.prototype.getYPoint=function(){return this.pool.push({functionName:c.yPoint}),this},t.prototype.getWPoint=function(){return this.pool.push({functionName:c.wPoint}),this},t.prototype.getHPoint=function(){return this.pool.push({functionName:c.hPoint}),this},t.prototype.setIfLessThan=function(t){return this.pool.push({functionName:c.setIfLessThan,pointArg:t}),this},t.prototype.minus=function(){return this.pool.push({functionName:c.minus}),this},t.prototype.degreeToMeters=function(){return this.pool.push({functionName:c.degreeToMeters}),this},t.prototype.metersToDegree=function(){return this.pool.push({functionName:c.metersToDegree}),this},t.prototype.flipVertically=function(t){return this.pool.push({functionName:c.flipVertically,numberPointArg:t}),this};var X=t;function t(t){this.parent=t,this.pool=[]}var o=function(){return(o=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},_=function(n,o){var i,s,a,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(r){return function(t){var e=[r,t];if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,s&&(a=2&e[0]?s.return:e[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,e[1])).done)return a;switch(s=0,(e=a?[2&e[0],a.value]:e)[0]){case 0:case 1:a=e;break;case 4:return u.label++,{value:e[1],done:!1};case 5:u.label++,s=e[1],e=[0];continue;case 7:e=u.ops.pop(),u.trys.pop();continue;default:if(!(a=0<(a=u.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){u=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3]))u.label=e[1];else if(6===e[0]&&u.label<a[1])u.label=a[1],a=e;else{if(!(a&&u.label<a[2])){a[2]&&u.ops.pop(),u.trys.pop();continue}u.label=a[2],u.ops.push(e)}}e=o.call(n,u)}catch(t){e=[6,t],s=0}finally{i=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}}},I=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},S=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},T=function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||((n=n||Array.prototype.slice.call(e,0,o))[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},r=D.operation.buffer.BufferParameters,W=r.CAP_ROUND,n=r.CAP_FLAT,r=r.CAP_SQUARE,d=(N.arrayOfTrianglesToVertices=function(t,e){return t.map(function(t){return(w(e)?t.loop().height(e).run():t).toArrayOfCoords()}).flat(2)},N.minAreaRectangleSize=function(t){var t=t.clone().open(),e=t.first,r=t.second,t=t.last;return new O(e.distance(r),e.distance(t))},N.toDash=function(t){var e,r,n=new N,o=[n],i=!0;try{for(var s=I(t.points),a=s.next();!a.done;a=s.next()){var u=a.value;i&&n.push(u.clone()),u.properties.pieceBorder&&(i=!i)&&(n=new N,o.push(n),n.push(u.clone()))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return o},N.minAreaRectangleDirection=function(t){var t=t.clone().open(),e=t.first,r=t.second,t=t.last;return e&&r&&t?(e.distance(r)>e.distance(t)?e.findLine(r):e.findLine(t)).getFi():0},N.parseFromWKT=function(t){var e,r,n,t=t.trim().toUpperCase(),o=new N;return 0===t.indexOf("POLYGON")&&(n=/POLYGON \(\((?<data>(?:(?!\)\)$).)*?)\)\)$/imu.exec(t),e=(r=S(n.groups.data.split("), (").map(function(t){return new N(t.split(", ").map(function(t){return O.parse(t.split(" ").map(Number))}))})))[0],(r=r.slice(1))&&r.length&&(e.holes=r),o=e),0===t.indexOf("LINESTRING")&&(o=new N((n=/LINESTRING \((?<data>(?:(?!\)$).)*?)\)$/imu.exec(t)).groups.data.split(", ").map(function(t){return O.parse(t.split(" ").map(Number))}))),o=0===t.indexOf("POINT")?new N([O.parseFromWKT(t)]):o},N.createSquareBySize=function(t){return new N([O.zero(),t.clone().setX(0),t.clone(),t.clone().setY(0)]).close()},N.prototype.loop=function(){return new X(this)},Object.defineProperty(N.prototype,"points",{get:function(){return this.pPoints},set:function(t){this.pPoints=t},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"maxX",{get:function(){return this.reduce(function(t,e){return Math.max(t,e.x)},-1/0)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"minX",{get:function(){return this.reduce(function(t,e){return Math.min(t,e.x)},1/0)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"maxY",{get:function(){return this.reduce(function(t,e){return Math.max(t,e.y)},-1/0)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"minY",{get:function(){return this.reduce(function(t,e){return Math.min(t,e.y)},1/0)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"innerCenter",{get:function(){var o=this.center;return this.toTriangles().map(function(t){n=(e=t).at(0),r=e.at(1),e=e.at(2);var e,r,n=new O((n.x+r.x+e.x)/3,(n.y+r.y+e.y)/3);return n.properties.score=Math.min(n.distance(t.at(0)),n.distance(t.at(1)),n.distance(t.at(2)))+n.distance(o),n}).sort(function(t,e){return t.properties.score-e.properties.score})[0]},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"center",{get:function(){return this.leftTop.move(this.size.divide(2))},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"h",{get:function(){return this.maxY-this.minY},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"w",{get:function(){return this.maxX-this.minX},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"dY",{get:function(){return this.h},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"dX",{get:function(){return this.w},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"extend",{get:function(){var t=this.minX,e=this.minY,r=this.maxX,n=this.maxY;return new N([new O(t,e),new O(r,e),new O(r,n),new O(t,n),new O(t,e)])},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"size",{get:function(){var t=this.w,e=this.h;return new O(t,e)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"leftTop",{get:function(){var t=this.minX,e=this.minY;return new O(t,e)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"minPoint",{get:function(){return this.leftTop},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"rightBottom",{get:function(){var t=this.maxX,e=this.maxY;return new O(t,e)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"maxPoint",{get:function(){return this.rightBottom},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"length",{get:function(){return this.pPoints.length},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"fullLength",{get:function(){return this.clone().open().perimeter},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"perimeter",{get:function(){var e,t,r=0;try{for(var n=I(this.loopPointsGenerator()()),o=n.next();!o.done;o=n.next()){var i=S(o.value,2),s=i[0],a=i[1];r+=s.distance(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"area",{get:function(){var e,t,r=0;try{for(var n=I(this.deintersection.loopPointsGenerator()()),o=n.next();!o.done;o=n.next()){var i=S(o.value,2),s=i[0],a=s.x,u=s.y,c=i[1],h=c.x;r+=a*c.y-u*h}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return Math.abs(r/2)-this.holes.reduce(function(t,e){return t+e.area},0)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"filledDeintersection",{get:function(){for(var o=this.clone().deintersection.removeDuplicates().clockWise.open(),t=function(t){for(var e={},r=t=void 0===t?0:t;r<o.length;r++){var n=o.at(r).toString();if("number"==typeof e[n])return[e[n],r];e[n]=r}},e=t(),r=[];e;)var n=new N(o.clone().removePart(e[0],e[1]-e[0])),e=n.isClockwise?t(e[0]+1):(r.push(n.close()),o.removePart(e[0],e[1]-e[0]),t());return o.holes=r,o.close()},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"deintersection",{get:function(){for(var e,t,o=this.clone().close(),r={},i=0;i<o.length-1;i++)for(var n=o.at(i).toString(),s=(r[n]=r[n]||[],r[n].push(i),i+2);s<o.length-1;s++)!function(t){var e=o.at(i).findLine(o.at(i+1)),r=o.at(t).findLine(o.at(t+1)),n=e.intersection(r);n&&!T(T([],S(e.points),!1),S(r.points),!1).some(function(t){return t.like(n)})&&(e=o.removePart(i,t-i).reverse(),o.insertAfter.apply(o,T([i],S(e),!1)),o.insertAfter(t,n),o.insertAfter(i,n))}(s);try{for(var a=I(Object.keys(r)),u=a.next();!u.done;u=a.next()){var c=r[u.value];if(1<c.length)for(var h=function(t){var r=o.clone(),e=c[t]-c[t-1];1<e&&(e=new N(r.removePart(c[t-1],e))).reduce(function(t,e){return t&&function(t,e){var r,n;if(t.points.some(function(t){return t.equal(e)}))return!0;try{for(var o=I(t.loopPointsGenerator(!0)()),i=o.next();!i.done;i=o.next()){var s=S(i.value,3)[2];if(s.x(e).equal(e)&&s.inRange(e))return!0}}catch(t){P={error:t}}finally{try{i&&!i.done&&(x=o.return)&&x.call(o)}finally{if(P)throw P.error}}var a=0;try{for(var u=I(t.loopPointsGenerator()()),c=u.next();!c.done;c=u.next()){var h=S(c.value,2),l=h[0],p=l.x,f=l.y,y=h[1],d=y.x,m=y.y,v=new k(p-e.x,f-e.y,0),g=new k(d-e.x,m-e.y,0),b=v.findFi(g);0<v.vectorProduct(g).c?a+=b:a-=b}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}var x=Math.PI/1e4,P=!1,t=Math.abs(a);if(t<x)P=!1;else{if(!(Math.abs(2*Math.PI-t)<x))throw new Error("contains2 faild");P=!0}return P}(r,e)},!0)&&r.isClockwise===e.isClockwise&&(r.insertAfter.apply(r,T([c[t-1]-1],S(e.reverse().points),!1)),o=r)},s=c.length-1;0<s;s--)h(s)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return o},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"valid",{get:function(){return 3<this.length},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"first",{get:function(){return this.at(0)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"second",{get:function(){return this.at(1)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"last",{get:function(){return this.at(this.length-1)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"minAreaRectangle",{get:function(){var e,t,r,n,o=this.convex,i=new N,s=1/0;try{for(var a=I(o.loopPointsGenerator(!0)()),u=a.next();!u.done;u=a.next()){var c,h,l,p,f=S(u.value,3)[2],y=0,d=null,m=null,v=0,g=null;try{r=void 0;for(var b=I(o.loopPointsGenerator()()),x=b.next();!x.done;x=b.next()){var P=S(x.value,4),M=P[0],w=P[3],T=f.findPoint(f.findPerpendicular(M)),k=T.distance(M);v<=k&&(v=k,g=M);for(var O=w;O<o.length-1;O++){var z=f.findPoint(f.findPerpendicular(o.at(O))),A=T.distance(z);y<=A&&(y=A,d=T,m=z)}}}catch(t){r={error:t}}finally{try{x&&!x.done&&(n=b.return)&&n.call(b)}finally{if(r)throw r.error}}d&&m&&g&&(h=(c=d.findLine(m)).findPerpendicular(d),(p=new N([d,m,(l=c.findPerpendicular(m)).findPoint(l.findPerpendicular(g)),h.findPoint(h.findPerpendicular(g))]).close()).area<s)&&(s=(i=p).area)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return i},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"convex",{get:function(){var t=this.clone().open(),e=t.isClockwise;e||t.reverse();do{var r=t.last,n=t.first,o=t.second}while(((u=n.findInnerAngle(r,o))>Math.PI||f.likeZero(f.rad2Deg(u))||f.likePI(u)||f.like2PI(u))&&(t.removePart(-1,1),t.length));t.close();var i=0;do{for(var s=(t=t.deintersection).length,a=1;a<t.length-1;a++){var u,r=t.at(a-1),n=t.at(a),o=t.at(a+1);((u=n.findInnerAngle(r,o))>Math.PI||f.likeZero(f.rad2Deg(u))||f.likePI(u)||f.like2PI(u))&&t.removePart(--a,1)}}while(i++,t.length!==s&&i<100);return e||t.reverse(),t},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"isClockwise",{get:function(){var e,t,r=0;try{for(var n=I(this.clone().close().loopPointsGenerator()()),o=n.next();!o.done;o=n.next()){var i=S(o.value,2),s=i[0],a=s.x,u=s.y,c=i[1];r+=(c.x-a)*(c.y+u)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r<0},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"clockWise",{get:function(){return this.isClockwise?this.clone():this.clone().reverse()},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"noHoles",{get:function(){var t=this.clone();return t.holes=[],t},enumerable:!1,configurable:!0}),N.prototype.reduce=function(t,e){return this.pPoints.reduce(t,e)},N.prototype.intersection=function(t,e){void 0===e&&(e=!1);var r,n,o=[];try{for(var i=I(this.loopPointsGenerator(!0)()),s=i.next();!s.done;s=i.next()){var a=S(s.value,3)[2].intersection(t,0,e);a&&o.push(a)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return o},N.prototype.setCenter=function(t){return this.loop().move(t.clone().move(this.center.minus())).run()},N.prototype.toWKT=function(t,e){return void 0===e&&(e=!1),(t=void 0===t?N.WKT_POLYGON:t)===N.WKT_POLYGON?(t="",this.holes&&this.holes.length&&(t=", ".concat(this.holes.map(function(t){return t.toString()}).join(", "))),"POLYGON ((".concat(this.deintersection.mapArray(function(t){return"".concat(t.x," ").concat(t.y).concat(e?" ".concat(t.z):"")}).join(", "),")").concat(t,")")):"LINESTRING (".concat(this.mapArray(function(t){return"".concat(t.x," ").concat(t.y).concat(e?" ".concat(t.z):"")}).join(", "),")")},N.prototype.filter=function(t){return this.pPoints=this.pPoints.filter(t),this},N.prototype.map=function(e){return this.pPoints=this.mapArray(e),this.holes=this.holes.map(function(t){return t.map(e)}),this},N.prototype.mapArray=function(t){return this.pPoints.map(t)},N.prototype.sort=function(t){return this.points.sort(t),this},N.prototype.at=function(t){var e=this.length;return this.points[(t%e+e)%e]},N.prototype.pop=function(){return this.pPoints.pop()},N.prototype.push=function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return(t=this.pPoints).push.apply(t,T([],S(e),!1))},N.prototype.shift=function(){return this.pPoints.shift()},N.prototype.unshift=function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return(t=this.pPoints).unshift.apply(t,T([],S(e),!1))},N.prototype.reverse=function(){return this.pPoints=this.pPoints.reverse(),this.holes=this.holes.map(function(t){return t.reverse()}),this},N.prototype.getValue=function(){return this.pPoints.map(function(t){return t.getValue()})+this.holes.reduce(function(t,e){return t+e.getValue()},"")},N.prototype.toString=function(){return"(".concat(this.mapArray(function(t){return t.toString()}).join(", "),")")},N.prototype.close=function(){var t=this.first;return t&&!this.closed&&this.push(t.clone()),this},N.prototype.open=function(){var t=this.first;return 2<this.length&&t&&this.closed&&this.pop(),this},N.prototype.add=function(t){var e=new N(T(T([],S(this.points),!1),S(t.points),!1)).close();return e.holes=T(T([],S(this.holes),!1),S(t.holes),!1).map(function(t){return t.clone()}),e},N.prototype.has=function(e){return this.pPoints.some(function(t){return t.equal(e)})},N.prototype.clone=function(){var t=new N(this.points.map(function(t){return t.clone()}));return t.holes=this.holes.map(function(t){return t.clone()}),t.properties=o({},this.properties),t},N.prototype.equal=function(r){return r instanceof N&&this.length===r.length&&this.holes.length===r.holes.length&&this.same(r)&&this.holes.reduce(function(t,e){return t&&r.holes.some(function(t){return t.same(e)})},!0)},N.prototype.same=function(t){for(var e=t.clone().close(),r=this.clone().close().toString(),n=0;n<e.length;n++){if(r===e.toString()||r===e.clone().reverse().toString())return!0;e.nextStart()}return!1},N.prototype.findIndex=function(e){return e instanceof O?this.points.findIndex(function(t){return t.equal(e)}):this.points.findIndex(e)},N.prototype.approximation=function(t){return void 0===t&&(t=.1*Math.sqrt(this.perimeter)),new N(this.clone().douglasPeucker(this.pPoints,t))},N.prototype.insertAfter=function(t){for(var e,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];(e=this.pPoints).splice.apply(e,T([t+1,0],S(r),!1))},N.prototype.removePart=function(t,e){return this.pPoints.splice(t+1,e)},N.prototype.hasSimpleIntersection=function(t){var e=this.extend,r=t.extend,t=e.points,n=r.points,t=t.some(function(t){return r.simpleInclude(t)}),n=n.some(function(t){return e.simpleInclude(t)});return t||n},N.prototype.simpleInclude=function(t){return this.simpleIncludeX(t)&&this.simpleIncludeY(t)},N.prototype.drawPolygonOnCanvas=function(t,e,r,n,o,i){return void 0===o&&(o=1),void 0===i&&(i=this.length-1),1<this.length&&(t=t.getContext("2d"),e&&(t.fillStyle=e),r&&(t.strokeStyle=r),o&&(t.lineWidth=o),(e||r)&&t.beginPath(),this.goByPath(t,i%this.length),n&&(t.shadowColor=n,t.shadowBlur=0,t.shadowOffsetX=1,t.shadowOffsetY=1),e&&(t.closePath(),t.fill()),r)&&t.stroke(),this},N.prototype.clearPolygonOnCanvas=function(t){var t=t.getContext("2d"),e=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",this.goByPath(t),t.fill(),t.globalCompositeOperation=e},N.prototype.contain=function(t,e){var r;if(void 0===e&&(e=!1),!this.simpleInclude(t))return!1;if(this.onBorder(t))return e;var e=this.deintersection,n=0;try{for(var o=I(e.loopPointsGenerator()()),i=o.next();!i.done;i=o.next()){var s=S(i.value,2),a=s[0],u=a.x,c=a.y,h=s[1],l=h.x,p=h.y,f=new k(u-t.x,c-t.y,0),y=new k(l-t.x,p-t.y,0),d=f.findFi(y);0<f.vectorProduct(y).c?n+=d:n-=d}}catch(t){r={error:t}}finally{try{i&&!i.done&&(m=o.return)&&m.call(o)}finally{if(r)throw r.error}}var e=Math.PI/1e4,m=Math.abs(n);if(m<e)return!1;if(Math.abs(2*Math.PI-m)<e)return!0;throw new Error("contains2 faild")},N.prototype.onBorder=function(e){var r,t;if(this.simpleInclude(e)){var n=this.deintersection;if(this.points.some(function(t){return t.equal(e)}))return!0;try{for(var o=I(n.loopPointsGenerator(!0)()),i=o.next();!i.done;i=o.next()){var s=S(i.value,3)[2];if(s.x(e).equal(e)&&s.inRange(e))return!0}}catch(t){r={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(r)throw r.error}}}return!1},N.prototype.nextStart=function(){return this.open(),this.push(this.shift()),this.close(),this},N.prototype.removeDuplicates=function(){for(var t=0;t<this.length-1;t++){var e=this.at(t),r=this.at(t+1);e.equal(r)&&(this.removePart(t,1),t--)}return this},N.toGeoJSONFeatureCollection=function(t,e){return void 0===e&&(e=P.parseFormat),{type:"FeatureCollection",features:t.map(function(t){return t.toGeoJSONFeature(e)})}},N.parse=function(t,n){if(void 0===n&&(n=P.parseFormat),t.type)switch(t.type){case"FeatureCollection":return t.features.reduce(function(t,e){e=N.parse(e,n);return Array.isArray(e)?t.push.apply(t,T([],S(e),!1)):t.push(e),t},[]);case"Feature":var e=N.parse(t.geometry,n),r=o(o({},t.properties),t.id?{id:t.id}:{});return Array.isArray(e)?e.forEach(function(t){t.properties=o({},r)}):e.properties=o({},r),e;case"LineString":case"MultiPoint":return new N(t.coordinates.map(function(t){return O.parse(t,n)}));case"Polygon":return t.coordinates.reduce(function(t,e,r){return 0===r?t.points=e.map(function(t){return O.parse(t,n)}):t.holes.push(new N(e.map(function(t){return O.parse(t,n)}))),t},new N);case"MultiLineString":return t.coordinates.reduce(function(t,e){return t.push(new N(e.map(function(t){return O.parse(t,n)}))),t},[]);case"MultiPolygon":return t.coordinates.reduce(function(t,e){return t.push(N.parse({type:"Polygon",coordinates:e},n)),t},[]);case"GeometryCollection":return t.geometries.reduce(function(t,e){return t.push(N.parse(e,n)),t},[])}return new N(t.map(function(t){return O.parse(t,n)}))},N.prototype.toArrayOfCoords=function(e){return void 0===e&&(e=P.parseFormat),this.mapArray(function(t){return t.toCoords(e)})},N.prototype.toGeoJSONFeature=function(t){return void 0===t&&(t=P.parseFormat),{type:"Feature",properties:o({},this.properties),geometry:this.toGeoJSON(t)}},N.prototype.toGeoJSON=function(e){return void 0===e&&(e=P.parseFormat),this.closed?{type:"Polygon",coordinates:T([this.toArrayOfCoords(e)],S(this.holes.map(function(t){return t.toArrayOfCoords(e)})),!1)}:{type:"LineString",coordinates:this.toArrayOfCoords(e)}},N.prototype.divideToPieces=function(t,s){var e,r;void 0===s&&(s=!1);var a=this.fullLength/t,u=a,c=this;try{for(var n=I(this.loopPointsGenerator()()),o=n.next();!o.done;o=n.next()){var i=S(o.value,4);!function(t,e,r){var n,o,i=t.distance(e);i===u?(e.properties.pieceBorder=!0,u=a):0<i-u?(o=new tt(t,u),(o=(n=t.findLine(e)).intersectionWithCircle(o).filter(function(t){return n.inRange(t,.001)})[0]).properties.pieceBorder=!0,c.insertAfter(r,o),s&&(r=t.z,o.z=r-(r-e.z)*(t.distance(o)/i)),u=a):u-=i}(i[0],i[1],i[3])}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return this},N.prototype.prepareToFastSearch=function(){var e,t;this.searchStore={};try{for(var r=I(this.points),n=r.next();!n.done;n=r.next()){var o=n.value,i=o.x,s=o.y,a=o.z;this.searchStore[i]||(this.searchStore[i]={}),this.searchStore[i][s]||(this.searchStore[i][s]={}),this.searchStore[i][s][a||"undefined"]=!0}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},N.prototype.fastHas=function(t){var e=t.x,r=t.y,t=t.z;return this.searchStore[e]&&this.searchStore[e][r]&&this.searchStore[e][r][t||"undefined"]||!1},Object.defineProperty(N.prototype,"growingPiecesGenerator",{get:function(){var a=this;return function(){var e,r,n,o,i,s;return _(this,function(t){switch(t.label){case 0:e=new N,t.label=1;case 1:t.trys.push([1,6,7,8]),r=I(a.pPoints),n=r.next(),t.label=2;case 2:return n.done?[3,5]:(o=n.value,e.push(o),o.properties.pieceBorder?[4,e.clone()]:[3,4]);case 3:t.sent(),t.label=4;case 4:return n=r.next(),[3,2];case 5:return[3,8];case 6:return o=t.sent(),i={error:o},[3,8];case 7:try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(i)throw i.error}return[7];case 8:return[2,e.clone()]}})}},enumerable:!1,configurable:!0}),N.prototype.simpleUnion=function(t){try{var e=this.simpleLogicFunction(t,!0,!0);return null===e?null:e instanceof N?e:null}catch(t){return null}},N.prototype.simpleIntersection=function(t){return this.simpleLogicFunction(t,!1,!1)},N.prototype.simpleDifference=function(t){return this.simpleLogicFunction(t,!0,!1)},N.prototype.smartUnion=function(t){var e,r,n=this.clone().simpleUnion(t);if(n){var i=T(T(T([],S(this.holes),!1),S(t.holes),!1),S(n.holes),!1).map(function(t){return t.clone()}),o=function(r){var e,t;try{e=void 0;for(var n=I(i),o=n.next();!o.done;o=n.next())!function(e){if(r.equal(e))return;var t=r.simpleUnion(e);t&&(i=i.filter(function(t){return!t.equal(r)&&!t.equal(e)})).push(t)}(o.value)}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}};try{for(var s=I(i),a=s.next();!a.done;a=s.next())o(a.value)}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}n.holes=i}return n},N.prototype.toTriangles=function(){var t=this.clone().removeDuplicates().open();if(t.length<3)return[];if(3===t.length)return[t];for(var i=function(t,e,r){var n=e.findLine(r),o=n.center,e=t.holes.reduce(function(t,e){return t&&Boolean(e.clone().close().intersection(n,!0).length)},Boolean(t.clone().close().intersection(n,!0).length)),r=t.holes.reduce(function(t,e){return t&&!e.contain(o)},t.contain(o));return!e&&r},e=this.clone().removeDuplicates().clockWise.open();e.holes.length;)for(var r=e.holes.shift().clone().clockWise.reverse().close(),n=0;n<e.length;n++){if(i(e,e.first,r.first)){e.insertAfter.apply(e,T(T([0],S(r.points),!1),[e.first],!1));break}e.push(e.shift())}for(var o=[];3<e.length;){var s=function(t){for(var e=0;e<t.length;e++){var r=t.at(0),n=t.at(1),o=t.at(2);if(i(t,r,o))return t.removePart(0,1),new N([r.clone(),n.clone(),o.clone()]);t.push(t.shift())}}(e);s&&o.push(s)}return o.push(e),o},N.prototype.getTrianglesPointIndexes=function(){var i=function(t,e,r){var n=e.findLine(r),o=n.center,e=t.holes.reduce(function(t,e){return t&&Boolean(e.clone().close().intersection(n,!0).length)},Boolean(t.clone().close().intersection(n,!0).length)),r=t.holes.reduce(function(t,e){return t&&!e.contain(o)},t.contain(o));return!e&&r},t=this.clone(),e=0;for(t.points.forEach(function(t){t.properties.index=e++}),t.holes.forEach(function(t){t.pPoints.forEach(function(t){t.properties.index=e++})}),t=t.clockWise.open();t.holes.length;)for(var r=t.holes.shift().clone().clockWise.reverse().close(),n=0;n<t.length;n++){if(i(t,t.first,r.first)){t.insertAfter.apply(t,T(T([0],S(r.points),!1),[t.first],!1));break}t.push(t.shift())}for(var o=[];3<t.length;){var s=function(t){for(var e=0;e<t.length;e++){var r=t.at(0),n=t.at(1),o=t.at(2);if(i(t,r,o))return t.removePart(0,1),[r.properties.index,n.properties.index,o.properties.index];t.push(t.shift())}}(t);s&&o.push.apply(o,T([],S(s),!1))}return o.push.apply(o,T([],S(t.points.map(function(t){return t.properties.index})),!1)),o},Object.defineProperty(N.prototype,"closed",{get:function(){return this.first.equal(this.last)},enumerable:!1,configurable:!0}),N.prototype.buffer=function(t,e,r){void 0===e&&(e=64),void 0===r&&(r=N.CAP_ROUND);var n=new D.io.WKTReader,o=this.noHoles,i=this.closed;return new N(n.read(o.toWKT(i?N.WKT_POLYGON:N.WKT_LINESTRING)).buffer(t,e,r).getCoordinates().map(function(t){var e=t.x,t=t.y;return new O(e,t)}))},N.prototype.sideBuffers=function(t,e){var r=this.first,n=this.last,t=this.buffer(t,e=void 0===e?64:e,N.CAP_FLAT).open(),e=S(r.sortByDistance(t).points.map(function(t){return t.properties.index}),2),r=e[0],e=e[1],n=S(n.sortByDistance(t).points.map(function(t){return t.properties.index}),2),o=n[0],n=n[1],i=Math.min(Math.max(r,e),Math.max(o,n)),r=Math.max(Math.min(r,e),Math.min(o,n)),e=new N(t.removePart(i-1,r-i+1));return t.unshift(t.pop()),[e.reverse(),t]},N.prototype.setProperties=function(t){return this.properties="object"==typeof t?t:t(this),this},N.prototype.bezier=function(t){void 0===t&&(t=.1);for(var e=new N,r=0;r<1;r+=t)e.push(this.clone().getBezierPoint(r));return e},N.prototype.setGrowingHeight=function(e,t){var r=this.fullLength,n=this.first,o=t-e,i=0;return this.loop().setZ(function(t){return i+=n.distance(t),n=t,e+i/r*o}).run(),this},N.prototype.loopPointsGenerator=function(o){void 0===o&&(o=!1);var i=this;return function(){var e,r,n;return _(this,function(t){switch(t.label){case 0:e=0,t.label=1;case 1:return e<i.length-1?(r=i.at(e),n=i.at(e+1),[4,[r,n,o?r.findLine(n):void 0,e]]):[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})}},N.prototype.getBezierPoint=function(t){var e,r;if(1===this.length)return this.first;try{for(var n=I(this.loopPointsGenerator()()),o=n.next();!o.done;o=n.next()){var i=S(o.value,2),s=i[0],a=i[1];s.move(a.clone().move(s.clone().minus()).scale(t))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return this.pop(),this.getBezierPoint(t)},N.prototype.simpleIncludeX=function(t){t=t.x;return this.minX<=t&&this.maxX>=t},N.prototype.simpleIncludeY=function(t){t=t.y;return this.minY<=t&&this.maxY>=t},N.prototype.douglasPeucker=function(t,e){for(var r,n=0,o=0,i=t.length-1,s=t[0].findLine(t[i]),a=1;a<i;a++){var u=s.perpendicularDistance(t[a]);n<u&&(o=a,n=u)}return e<=n?(r=this.douglasPeucker(t.slice(0,o+1),e),e=this.douglasPeucker(t.slice(o),e),r.pop(),T(T([],S(r),!1),S(e),!1)):[t[0],t[i]]},N.prototype.goByPath=function(t,e){void 0===e&&(e=this.length-1);var r=this.first;t.moveTo(r.x,r.y);for(var n=1;n<=e%this.length;n++){var o=this.at(n),i=o.x,o=o.y;t.lineTo(i,o)}},N.prototype.getJSTSGeometry=function(t,e,r){var r=r===e,n=new D.io.WKTReader,o=n.read(this.noHoles.toWKT()),n=n.read(t.noHoles.toWKT());return r?e?o.union(n):o.intersection(n):o.difference(n)},N.prototype.simpleLogicFunction=function(t,e,r){var n,o,i,s,a,u,c,h,t=this.getJSTSGeometry(t,e,r);if(t){var l=t.getCoordinates();if(l.length){var p=l.reduce(function(t,e,r){var n=e.x,e=e.y,o=t.length-1,n=new O(n,e),e=t[o].first;return n.equal(e)?l[r+1]&&(e=new O(l[r+1].x,l[r+1].y),1<t[o].length)&&t.push(new N([e])):t[o].push(n),t},[new N([new O(l[0].x,l[0].y)])]);if(r&&e&&1<p.length)try{for(var f=I(p),y=f.next();!y.done;y=f.next()){var d=y.value;try{i=void 0;for(var m=I(p),v=m.next();!v.done;v=m.next())if("break"===function(e){var t,r;return d.has(e.first)&&!d.equal(e)?(r=d.findIndex(e.first),(t=d.points).splice.apply(t,T([r,0],S(e.points),!1)),p=p.filter(function(t){return!t.equal(e)}),"continue"):p.length<2?"break":void 0}(v.value))break}catch(t){i={error:t}}finally{try{v&&!v.done&&(s=m.return)&&s.call(m)}finally{if(i)throw i.error}}if(p.length<2)break}}catch(t){n={error:t}}finally{try{y&&!y.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}p=p.filter(function(t){return 2<t.length}).map(function(t){return t.close()});try{for(var g=I(p),b=g.next();!b.done;b=g.next()){d=b.value;try{c=void 0;for(var x=I(p),P=x.next();!P.done;P=x.next())if("break"===function(e){if(p.length<2)return"break";d.equal(e)||d.contain(e.first,!0)&&(d.holes.push(e),p=p.filter(function(t){return!t.equal(e)}))}(P.value))break}catch(t){c={error:t}}finally{try{P&&!P.done&&(h=x.return)&&h.call(x)}finally{if(c)throw c.error}}if(p.length<2)break}}catch(t){a={error:t}}finally{try{b&&!b.done&&(u=g.return)&&u.call(g)}finally{if(a)throw a.error}}return 0===p.length?null:1===p.length?p[0].close():p.map(function(t){return t.close()})}}return null},N.CAP_ROUND=W,N.CAP_FLAT=n,N.CAP_SQUARE=r,N.WKT_LINESTRING="LINESTRING",N.WKT_POLYGON="POLYGON",N);function N(t){this.pPoints=t=void 0===t?[]:t,this.properties={},this.holes=[],this.searchStore={}}m.prototype.clone=function(){return new m(this.a,this.b,this.c,this.begin.clone(),this.end.clone())},m.prototype.findPerpendicular=function(t){return s("findPerpendicular").checkArgument("this.begin").shouldBeMeters(this.begin).checkArgument("this.end").shouldBeMeters(this.end).checkArgument("p").shouldBeMeters(t),new m(-this.b,this.a,this.b*t.x-this.a*t.y)},m.prototype.perpendicularDistance=function(t){return s("perpendicularDistance").checkArgument("this.begin").shouldBeMeters(this.begin).checkArgument("this.end").shouldBeMeters(this.end).checkArgument("p").shouldBeMeters(t),this.findPerpendicular(t).findPoint(this).distance(t)},m.prototype.intersection=function(t,e,r){void 0===e&&(e=0),void 0===r&&(r=!1);var n=this.findPoint(t);return n?r?this.insideRange(n,e)&&t.insideRange(n,e)?n:null:this.inRange(n,e)&&t.inRange(n,e)?n:null:null},m.prototype.intersectionWithCircle=function(t){var e=t.center,t=t.r,r=this.findPerpendicular(e),r=this.findPoint(r),n=r.distance(e);if(this.begin.equal(e)&&(n=0),(n=this.end.equal(e)?0:n)<t){var o,i=this.a,s=this.b,a=this.c;if(this.isParallel){var u=e.distance(r),u=Math.sqrt(t*t-u*u);if(this.isParallelY)return r.x=this.begin.x,[r.clone().move(0,-u),r.clone().move(0,u)];if(this.isParallelX)return r.y=this.begin.y,[r.clone().move(u,0),r.clone().move(-u,0)]}return this.begin.like(e)?(o=this.begin.clone(),[this.movePoint(o,t),this.movePoint(o,-t)]):this.end.like(e)?(o=this.end.clone(),[this.movePoint(o,t),this.movePoint(o,-t)]):(u=i*i+s*s,e=Math.sqrt((t*t-a*a/u)/u),[r.clone().move(s*e,-i*e),r.clone().move(-s*e,i*e)])}return n===t?r:null},m.prototype.inRange=function(t,e){var r=this.minX,n=this.minY,o=this.maxX,i=this.maxY,s=t.x,t=t.y;return r-(e=void 0===e?0:e)<=s&&s<=o+e&&(n-e<=t&&t<=i+e)},m.prototype.insideRange=function(t,e){var r=this.begin,n=this.end;return this.inRange(t,e=void 0===e?0:e)&&!r.like(t,1e-5)&&!n.like(t,1e-5)},Object.defineProperty(m.prototype,"center",{get:function(){return this.begin.clone().setIfLessThan(this.end).move(this.end.clone().move(this.begin.clone().minus()).abs().minus().divide(2))},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"minX",{get:function(){return Math.min(this.begin.x,this.end.x)},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"minY",{get:function(){return Math.min(this.begin.y,this.end.y)},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"maxX",{get:function(){return Math.max(this.begin.x,this.end.x)},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"maxY",{get:function(){return Math.max(this.begin.y,this.end.y)},enumerable:!1,configurable:!0}),m.prototype.toString=function(){return"(".concat(this.a,", ").concat(this.b,", ").concat(this.c,")")},m.prototype.getValue=function(){return[this.a,this.b,this.c]},m.prototype.x=function(t){return this.isParallelY?new O(-this.c/this.a,t.y):this.isParallelX?new O(t.x,-this.c/this.b):new O(-this.b/this.a*t.y-this.c/this.a,t.y)},m.prototype.y=function(t){return this.isParallelY?new O(-this.c/this.a,t.y):this.isParallelX?new O(t.x,-this.c/this.b):new O(t.x,-this.a/this.b*t.x-this.c/this.b)},m.prototype.findPoint=function(t){var e,r;return this.isParallelY&&t.isParallelY||this.isParallelX&&t.isParallelX?null:this.isParallelX&&t.isParallelY?new O(-t.c/t.a,-this.c/this.b):this.isParallelY&&t.isParallelX?new O(-this.c/this.a,-t.c/t.b):this.isParallelY?(r=-this.c/this.a,t.y(new O(r))):this.isParallelX?(e=-this.c/this.b,t.x(new O(0,e))):t.isParallelY?(r=-t.c/t.a,this.y(new O(r))):t.isParallelX?(e=-t.c/t.b,this.x(new O(0,e))):(r=this.y(new O((t.c/t.b-this.c/this.b)/(this.a/this.b-t.a/t.b))),isFinite(r.x)||isFinite(r.y)?r:null)},Object.defineProperty(m.prototype,"isParallel",{get:function(){return this.isParallelX||this.isParallelY},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"isParallelY",{get:function(){return Math.abs(this.b)<.001},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"isParallelX",{get:function(){return Math.abs(this.a)<.001},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"points",{get:function(){return[this.begin,this.end]},enumerable:!1,configurable:!0}),m.prototype.getFi=function(){s("getFi").checkArgument("this.begin").shouldBeMeters(this.begin).checkArgument("this.end").shouldBeMeters(this.end);var t=this.end.clone().move(this.begin.clone().minus()),e=t.x,t=t.y,t=Math.atan2(t,e)-Math.PI;return 0<t&&(t=Math.PI-t),(Math.PI-t)%(2*Math.PI)},m.prototype.toWKT=function(){var t=this.begin,e=t.x,t=t.y,r=this.end,n=r.x,r=r.y;return"LINESTRING (".concat(e," ").concat(t,", ").concat(n," ").concat(r,")")},m.prototype.movePoint=function(t,e){var r=Array.isArray(t),t=r?t:[t],n=r?e:[e],e=this.findFi(new m(1,0,0)),o=this.x(new O(1,1)).distance(this.x(new O(2,2)))/2,i=new O(Math.sin(e),Math.cos(e)),e=i.clone().scale(o),o=t[0].clone().move(e.clone().minus()),e=t[0].clone().move(e),s=[],s=f.like(this.y(o).y,o.y)||f.like(this.y(e).y,e.y)?t.map(function(t,e){return t.clone().move(i.clone().scale(n[e]))}):t.map(function(t,e){return t.clone().move(i.clone().scale(n[e]).setX(function(t){return-t.x}))});return r?s:s[0]},m.prototype.findFi=function(t,e){var r=t.a,t=t.b,n=(void 0===e&&(e=1.0001),this.a),o=this.b,n=(n*r+o*t)/(Math.sqrt(n*n+o*o)*Math.sqrt(r*r+t*t));return 1<n&&n<e?n=1:n<-1&&-e<n&&(n=-1),Math.acos(n)},m.prototype.vectorProduct=function(t){var e=t.a,r=t.b,t=t.c,n=this.a,o=this.b,i=this.c;return new m(o*t-i*r,i*e-n*t,n*r-o*e)},m.prototype.bresenhamsLine=function(){for(var t=this.begin,e=t.x,r=t.y,t=this.end,n=t.x,o=t.y,i=Math.abs(n-e),s=e<n?1:-1,a=-Math.abs(o-r),u=r<o?1:-1,c=i+a,h=new d;h.push(new O(e,r)),e!==n||r!==o;){var l=2*c;if(a<=l){if(e===n)break;c+=a,e+=s}if(l<=i){if(r===o)break;c+=i,r+=u}}return h};var k=m;function m(t,e,r,n,o){void 0===n&&(n=O.zero()),void 0===o&&(o=O.zero()),this.a=t,this.b=e,this.c=r,this.begin=n,this.end=o}var v=function(){return(v=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},K=function(t,e){var r={};for(o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(r[o[n]]=t[o[n]]);return r},U=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},Z=new d,H=new d,J=new d,W=20037508.34,Q=W/180,i=180,g=360,b=Math.PI/i,$=i/Math.PI,O=(z.zero=function(){return new z},z.parse=function(t,e){void 0===e&&(e=P.parseFormat);var r,o,n=t.lat,i=t.lon,s=t.lng,i=void 0===s?i:s,s=t.alt;return n&&i?new z(i,n,null!=s?s:0):(i=t.x,n=t.y,s=t.z,r=K(t,["x","y","z"]),w(i)&&w(n)?new z(i,n,s).setProperties(r):("Point"===(o=t).type&&(o=t.coordinates),"Feature"===t.type?((i=z.parse(t.geometry,e)).properties=v({},t.properties),i):e.replace(/[^x-z]/gimu,"").split("").reduce(function(t,e,r){var n;switch(e){case"x":t.x=null!=(n=o[r])?n:0;break;case"y":t.y=null!=(n=o[r])?n:0;break;case"z":t.z=o[r]}return t},new z)))},z.parseFromWKT=function(t){t=t.trim().toUpperCase(),t=/POINT \((?<data>(?:(?!\)).)*?)\)$/imu.exec(t),t=U(t.groups.data.split(" ").map(Number),3);return new z(t[0],t[1],t[2])},z.random=function(){return new z(Math.random(),Math.random())},z.getTileFromQuadKey=function(t){for(var e=new z(0,0,t.length),r=e.z;0<r;r--){var n=1<<r-1;switch(t[e.z-r]){case"0":break;case"1":e.x|=n;break;case"2":e.y|=n;break;case"3":e.x|=n,e.y|=n;break;default:throw new Error("Invalid QuadKey digit sequence.")}}return e},z.prototype.toDegreesMinutesSeconds=function(){return{x:V(this.x),y:V(this.y)}},z.prototype.getTileFromCoords=function(t){return void 0===t&&(t=this.z),s("getTileFromCoords").checkArgument("this").shouldBeDegree(this),new z(Math.floor((this.x+i)/g*Math.pow(2,t)),Math.floor((1-Math.log(Math.tan(this.y*b)+1/Math.cos(this.y*b))/Math.PI)/2*Math.pow(2,t)),t)},z.prototype.getQuadKeyFromTile=function(t){for(var e=[],r=t=void 0===t?this.z:t;0<r;r--){var n=0,o=1<<r-1;0!=(this.x&o)&&n++,0!=(this.y&o)&&(n++,n++),e.push(n)}return e.join("")},z.prototype.getCoordsFromTile=function(t){void 0===t&&(t=this.z),s("getCoordsFromTile").checkArgument("this").shouldBeUInt(this);var e=Math.PI-2*Math.PI*this.y/Math.pow(2,t);return new z(this.x/Math.pow(2,t)*g-i,i/Math.PI*Math.atan((Math.exp(e)-Math.exp(-e))/2),t)},z.prototype.toCoords=function(t){var e=this;return(t=void 0===t?P.parseFormat:t).replace(/[^x-z]/gimu,"").split("").map(function(t){return{x:e.x,y:e.y,z:e.z}[t]}).filter(function(t){return void 0!==t})},z.prototype.toGeoJSON=function(t){return{type:"Point",coordinates:this.toCoords(t=void 0===t?P.parseFormat:t)}},z.prototype.toGeoJSONFeature=function(t){return void 0===t&&(t=P.parseFormat),{type:"Feature",properties:v({},this.properties),geometry:this.toGeoJSON(t)}},z.prototype.findLine=function(t){var e,r,n;return s("findLine").checkArgument("this").shouldBeMeters(this).checkArgument("p").shouldBeMeters(t),this.equal(t)?this.findLine(t.clone().move(0,1)):(e=this.y-t.y,r=t.x-this.x,n=this.x*t.y-t.x*this.y,0==e?new k(0,1,n/r,this,t):0==r?new k(1,0,n/e,this,t):new k(e,r,n,this,t))},z.prototype.findInnerAngle=function(t,e){s("findInnerAngle").checkArgument("this").shouldBeMeters(this).checkArgument("p1").shouldBeMeters(t).checkArgument("p3").shouldBeMeters(e);t=this.findLine(t).getFi(),e=this.findLine(e).getFi();return t<=e?e-t:e+2*Math.PI-t},z.prototype.toString=function(){return"".concat(this.x," ").concat(this.y)},z.prototype.getValue=function(){return[this.x,this.y]},z.prototype.height=function(t){return this.z=t,this},z.prototype.toWKT=function(){var t=this.x,e=this.y;return"POINT (".concat(t," ").concat(e,")")},z.prototype.distance=function(t){s("distance").checkArgument("this").shouldBeMeters(this).checkArgument("p").shouldBeMeters(t);var e=t.x-this.x,t=t.y-this.y;return Math.sqrt(e*e+t*t)},z.prototype.distance3d=function(t){s("distance3d").checkArgument("this").shouldBeMeters(this).checkArgument("p").shouldBeMeters(t).checkArgument("this.z").shouldExist(this.z).checkArgument("p.z").shouldExist(t.z);var e=t.x-this.x,r=t.y-this.y,t=t.z-this.z;return Math.sqrt(e*e+r*r+t*t)},z.prototype.setX=function(t){return this.x="number"==typeof t?t:t(this),this},z.prototype.setZ=function(t){return this.z="number"==typeof t?t:t(this),this},z.prototype.setY=function(t){return this.y="number"==typeof t?t:t(this),this},z.prototype.setProperties=function(t){return this.properties="object"==typeof t?t:t(this),this},z.prototype.clone=function(){var t=new z(this.x,this.y,this.z);return t.properties=v({},this.properties),t},z.prototype.gt=function(t){return this.x>t.x&&this.y>t.y},z.prototype.lt=function(t){return this.x<t.x&&this.y<t.y},z.prototype.gtOrEqual=function(t){return this.gt(t)||this.equal(t)},z.prototype.ltOrEqual=function(t){return this.lt(t)||this.equal(t)},z.prototype.rotate=function(t){var e=this.x*Math.cos(t)-this.y*Math.sin(t),t=this.x*Math.sin(t)+this.y*Math.cos(t);return this.x=e,this.y=t,this},z.prototype.rotate3dX=function(t){var e=this.y,r=this.z;return this.y=e*Math.cos(t)+r*Math.sin(t),this.z=-e*Math.sin(t)+r*Math.cos(t),this},z.prototype.rotate3dY=function(t){var e=this.x,r=this.z;return this.x=e*Math.cos(t)+r*Math.sin(t),this.z=-e*Math.sin(t)+r*Math.cos(t),this},z.prototype.rotate3dZ=function(t){var e=this.x,r=this.y;return this.x=e*Math.cos(t)-r*Math.sin(t),this.y=-e*Math.sin(t)+r*Math.cos(t),this},z.prototype.move=function(t,e,r){void 0===e&&(e=t);var n=0,o=0,i=void 0;return t instanceof z?(n=this.x+t.x,o=this.y+t.y,w(this.z)&&w(t.z)&&(i=this.z+t.z)):(n=this.x+t,o=this.y+e,w(this.z)&&w(r)&&(i=this.z+r)),this.x=n,this.y=o,w(i)&&(this.z=i),this},z.prototype.degreeToMeters=function(){s("degreeToMeters").checkArgument("this").shouldBeDegree(this);var t=((this.x+i)%g-i)*Q,e=Math.log(Math.tan((this.y+90)%i*(Math.PI/g)))/b*Q;return this.x=t,this.y=e,this},z.prototype.metersToDegree=function(){s("metersToDegree").checkArgument("this").shouldBeMeters(this);var t=8983152842445679e-21*this.x,e=Math.atan(Math.pow(Math.E,this.y/Q*b))*(g/Math.PI)-90;return this.x=t,this.y=e,this},z.prototype.degreeToRadians=function(){return s("degreeToRadians").checkArgument("this").shouldBeDegree(this),this.scale(b)},z.prototype.radiansToDegrees=function(){return s("radiansToDegrees").checkArgument("this").shouldBeRadians(this),this.scale($)},z.prototype.radiansToMeters=function(){return s("radiansToMeters").checkArgument("this").shouldBeRadians(this),this.radiansToDegrees().degreeToMeters()},z.prototype.metersToRadians=function(){return s("metersToRadians").checkArgument("this").shouldBeMeters(this),this.metersToDegree().degreeToRadians()},z.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},z.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},z.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},z.prototype.toFixed=function(t){return void 0===t&&(t=2),this.x=parseFloat(this.x.toFixed(t)),this.y=parseFloat(this.y.toFixed(t)),this},z.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},z.prototype.scale=function(t,e,r){void 0===e&&(e=t);var n=0,o=0,i=void 0;return t instanceof z?(n=this.x*t.x,o=this.y*t.y,w(this.z)&&w(t.z)&&(i=this.z*t.z)):(n=this.x*t,o=this.y*e,w(this.z)&&w(r)&&(i=this.z*r)),this.x=n,this.y=o,w(i)&&(this.z=i),this},z.prototype.divide=function(t,e,r){void 0===e&&(e=t);var n=0,o=0,i=void 0;return t instanceof z?(n=this.x/t.x,o=this.y/t.y,w(this.z)&&w(t.z)&&(i=this.z/t.z)):(n=this.x/t,o=this.y/e,w(this.z)&&w(r)&&(i=this.z/r)),this.x=n,this.y=o,w(i)&&(this.z=i),this},z.prototype.mod=function(t,e,r){void 0===e&&(e=t);var n=0,o=0,i=void 0;return t instanceof z?(n=this.x%t.x,o=this.y%t.y,w(this.z)&&w(t.z)&&(i=this.z%t.z)):(n=this.x%t,o=this.y%e,w(this.z)&&w(r)&&(i=this.z%r)),this.x=n,this.y=o,w(i)&&(this.z=i),this},z.prototype.div=function(t,e,r){void 0===e&&(e=t);var n=0,o=0,i=void 0;return t instanceof z?(n=a(this.x,t.x),o=a(this.y,t.y),w(this.z)&&w(t.z)&&(i=a(this.z,t.z))):(n=a(this.x,t),o=a(this.y,e),w(this.z)&&w(r)&&(i=a(this.z,r))),this.x=n,this.y=o,w(i)&&(this.z=i),this},z.prototype.equal=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},z.prototype.like=function(t,e){var r,n,o;return void 0===e&&(e=.001),!!this.equal(t)||(r=Math.abs(this.x-t.x)<e,n=Math.abs(this.y-t.y)<e,o=Math.abs((null!=(o=null!=(o=this.z)?o:t.z)?o:0)-(null!=(t=null!=(o=t.z)?o:this.z)?t:0))<e,r&&n&&o)},z.prototype.flipVertically=function(t){var e=t;return t instanceof z&&(e=t.y),this.y=e-this.y,this},Object.defineProperty(z.prototype,"likeRadians",{get:function(){return 0===Z.length&&Z.push(new z(-Math.PI,-Math.PI/2),new z(Math.PI,Math.PI/2)),Z.simpleInclude(this)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"likeWorldGeodeticSystem",{get:function(){return 0===J.length&&J.push(new z(-180,-90),new z(180,90)),!this.likeRadians&&J.simpleInclude(this)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"likePseudoMercator",{get:function(){return 0===H.length&&H.push(new z(-20026376.39,-20048966.1),new z(20026376.39,20048966.1)),!this.likeRadians&&!this.likeWorldGeodeticSystem&&H.simpleInclude(this)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"w",{get:function(){return this.x},set:function(t){this.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"h",{get:function(){return this.y},set:function(t){this.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"area",{get:function(){return s("area").checkArgument("this").shouldBeMeters(this),this.w*this.h},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"hip",{get:function(){return s("hip").checkArgument("this").shouldBeMeters(this),Math.sqrt(this.w*this.w+this.h*this.h)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"min",{get:function(){return Math.min(this.x,this.y)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"max",{get:function(){return Math.max(this.x,this.y)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"hipPoint",{get:function(){var t=this.hip;return new z(t,t)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"xPoint",{get:function(){var t=this.x;return new z(t,t)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"yPoint",{get:function(){var t=this.y;return new z(t,t)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"wPoint",{get:function(){return this.xPoint},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"hPoint",{get:function(){return this.yPoint},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"lat",{get:function(){return this.y},set:function(t){this.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"lng",{get:function(){return this.x},set:function(t){this.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"lon",{get:function(){return this.x},set:function(t){this.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"alt",{get:function(){return this.z},set:function(t){this.z=t},enumerable:!1,configurable:!0}),z.prototype.simple=function(t,e,r){var n;return void 0===e&&(e="y"),void 0===r&&(r="z"),v(((n={})[t=void 0===t?"x":t]=this.x,n[e]=this.y,n),w(this.z)?((t={})[r]=this.z,t):{})},z.prototype.setIfLessThan=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},z.prototype.setIfMoreThan=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},z.prototype.minus=function(){return this.scale(-1)},z.prototype.orthodromicPath=function(t,e){void 0===e&&(e=360),s("orthodromicPath").checkArgument("this").shouldBeDegree(this).checkArgument("point").shouldBeDegree(t);var r=this.clone().degreeToRadians(),n=t.clone().degreeToRadians(),o=Math.sin(n.x-r.x),i=(n.x-r.x)/(e-1);return new d(p(e).map(function(t,e){e=r.x+i*e;return new z(e,Math.atan(Math.tan(r.y)*Math.sin(n.x-e)/o+Math.tan(n.y)*Math.sin(e-r.x)/o)).radiansToDegrees()}))},z.prototype.sortByDistance=function(t){var r=this;return t.clone().map(function(t,e){return t.properties.distance=t.distance(r),t.properties.index=e,t}).sort(function(t,e){return t.properties.distance-e.properties.distance})},z.prototype.calculateAltitudeByDistanceBetweenPoints=function(t,e){var r,n,o,i;return t.alt===e.alt?this.alt=t.alt:(r=Math.min(null!=(r=t.alt)?r:0,null!=(r=e.alt)?r:0),n=Math.max(null!=(n=t.alt)?n:0,null!=(n=e.alt)?n:0)-r,i=(o=this.distance(t))+(e=this.distance(e)),(null!=(t=t.alt)?t:0)===r?this.alt=r+o/i*n:this.alt=r+e/i*n),this},z);function z(t,e,r){void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this.z=r,this.properties={}}A.prototype.toString=function(){return"(".concat(this.center.toString(),", ").concat(this.r,")")},A.prototype.getValue=function(){return{center:this.center,r:this.r}},A.prototype.clone=function(){return new A(this.center,this.r)},A.prototype.findPoints=function(t){var e,r,n,o,i,s,a,u;return this.equal(t)?1/0:(u=(a=this.center).x,a=a.y,n=this.r,r=(s=t.center).x,e=(s=s.y)-a,t=(u=u+(i=(t=((n=n*n)-(o=t.r)*o+(o=this.center.distance(t.center))*o)/(2*o))/o)*(r=r-u))+(n=Math.sqrt(n-t*t)/o)*e,i=(o=a+i*(s-a))-n*r,s=u-n*e,a=o+n*r,u=[],isNaN(t)||isNaN(i)||u.push(new O(t,i)),isNaN(s)||isNaN(a)||t===s&&i===a||u.push(new O(s,a)),u)},A.prototype.equal=function(t){var e=t.center,t=t.r;return this.center.equal(e)&&this.r===t},A.prototype.findPolygonInside=function(t,e,r){void 0===t&&(t=64),void 0===e&&(e=0),void 0===r&&(r=2*Math.PI);for(var n=2*Math.PI/t,o=[],i=e;i<r-n;)o.push(new O(this.r).scale(Math.cos(i),Math.sin(i)).move(this.center)),i+=n;t=this.r*Math.cos(r)+this.center.x,e=this.r*Math.sin(r)+this.center.y;return o.push(new O(t,e)),new d(o)},A.prototype.findPolygonInsideOnSphere=function(t,e,r){void 0===t&&(t=64),void 0===e&&(e=0),void 0===r&&(r=2*Math.PI),s("findPolygonInsideOnSphere").checkArgument("center").shouldBeDegree(this.center);for(var n=2*Math.PI/t,o=[],i=e;i<r-n;)o.push(this.sphereOffset(i)),i+=n;return o.push(this.sphereOffset(r)),new d(o)},A.prototype.sphereOffset=function(t,e){void 0===e&&(e=6378137);var r=this.center.clone().degreeToRadians(),n=r.x,r=r.y,e=this.r/e,o=Math.asin(Math.sin(r)*Math.cos(e)+Math.cos(r)*Math.sin(e)*Math.cos(t)),n=n+Math.atan2(Math.sin(t)*Math.sin(e)*Math.cos(r),Math.cos(e)-Math.sin(r)*Math.sin(o));return new O(n,o).radiansToDegrees()};var tt=A;function A(t,e){void 0===t&&(t=O.zero()),void 0===e&&(e=0),this.center=t,this.r=e}var et=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},rt=(nt.prototype.add=function(t){var e,r;try{for(var n=et(t),o=n.next();!o.done;o=n.next()){var i=o.value,s=i.x,a=i.y,u=i.z;this.searchStore[s]||(this.searchStore[s]={}),this.searchStore[s][a]||(this.searchStore[s][a]={}),this.searchStore[s][a][u||"undefined"]=!0}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},nt.prototype.find=function(t){var e=t.x,r=t.y,t=t.z;return!!this.searchStore[e]&&!!this.searchStore[e][r]&&this.searchStore[e][r][t||"undefined"]},nt);function nt(){this.searchStore={}}function j(t,e,r){return void 0===r&&(r=y.TraceMatrixValues.f),void 0===t[e.y]||void 0===t[e.y][e.x]?r:t[e.y][e.x]}function ot(t,e,r){void 0!==t[e.y]&&void 0!==t[e.y][e.x]&&(t[e.y][e.x]=r,t[e.y][e.x])}var it=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},st=function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||((n=n||Array.prototype.slice.call(e,0,o))[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},at=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},r=(y.TraceMatrixValues=void 0,(n=y.TraceMatrixValues||(y.TraceMatrixValues={}))[n.f=0]="f",n[n.t=1]="t",C.prototype.fullMatrixTrace=function(){var r=this,t=this.findAllGroupsInMatrix(this.m),n=t.map(function(t){return r.traceGroup(r.m,t)}),o=t.map(this.createHoleMatrix),i=o.map(function(t){return t&&r.findAllGroupsInMatrix(t)}),s=i.map(function(t,e){return t&&t.map(function(t){return r.traceGroup(o[e],t)}).filter(function(t){return 3<t.length})});return t.map(function(t,e){var r=n[e];return i[e]&&i[e].length&&(r.holes=s[e]),r.loop().divide(4).round().run()})},C.prototype.reverseMatrix=function(e){return C.createMatrix(this.size,function(t){return j(e,t)===y.TraceMatrixValues.f?y.TraceMatrixValues.t:y.TraceMatrixValues.f})},C.prototype.findMarked=function(t,e){for(var r=this.size,n=!1,o=0;o<r.w;o++)for(var i=0;i<r.h;i++)if(!n&&e)o=e.x,i=e.y,n=!0;else if(j(t,new O(o,i))===y.TraceMatrixValues.t)return new O(o,i);return null},C.prototype.totalCountInMatrix=function(t){for(var e=0,r=this.size,n=0;n<r.w;n++)for(var o=0;o<r.h;o++)j(t,new O(n,o))&&e++;return e},C.createMatrix=function(e,n){return void 0===n&&(n=function(){return y.TraceMatrixValues.f}),p(e.h).map(function(t,r){return p(e.w).map(function(t,e){return n(new O(e,r))})})},C);function C(t,n){var f=this,e=(this.approximation=!0,this.findGroupByIndex=function(t,e){var r=new d;if(e&&j(t,e)===y.TraceMatrixValues.t){r.push(e);var n=0,o=C.createMatrix(f.size,function(){return y.TraceMatrixValues.f});for(ot(o,e,y.TraceMatrixValues.t);n<r.length;){for(var i=r.at(n),s=-1;s<2;s++)for(var a=-1;a<2;a++){var u=new O(i.x+s,i.y+a);j(o,u,y.TraceMatrixValues.t)===y.TraceMatrixValues.f&&j(t,u,y.TraceMatrixValues.f)===y.TraceMatrixValues.t&&(r.push(u),ot(o,u,y.TraceMatrixValues.t))}n++}}return r},this.findAllGroupsInMatrix=function(t){var e=f.findMarked(t);if(!e)return[];var e=f.findGroupByIndex(t,e),r=[e],n=e.length,o=st([],it(e.points),!1),i=new rt;for(i.add(o);n<f.totalCountInMatrix(t);){for(var s=f.findMarked(t);s&&i.find(s);)s=f.findMarked(t,s);var a=f.findGroupByIndex(t,s);n+=a.length,o=st(st([],it(o),!1),it(a.points),!1),i.add(a.points),r.push(a)}return r.filter(function(t){return 2<t.length})},this.traceGroup=function(t,e){function r(t){return(t+o.length+1)%o.length}var n,o=[new O(-1,-1),new O(-1,0),new O(-1,1),new O(0,1),new O(1,1),new O(1,0),new O(1,-1),new O(0,-1)];if(e.length<2)return n=e.at(0).clone(),new d([n,n,n]);for(var i=new d,s=0,a=1/0,u=e.at(0);!u.equal(e.at(0))||i.length<2;){for(;;){var c=j(t,u.clone().move(o[s])),h=j(t,u.clone().move(o[r(s)]));if(c===y.TraceMatrixValues.t&&h===y.TraceMatrixValues.f)break;s=(s+o.length-1)%o.length}a!==s&&(i.push(u),a=s),u=u.clone().move(o[s]),s=r(r(s))}return(f.approximation?i.approximation():i.clone()).close()},this.createHoleMatrix=function(e){for(var r,t,n=[new O(-1,0),new O(0,1),new O(1,0),new O(0,-1)],o=(e.prepareToFastSearch(),C.createMatrix(f.size,function(t){return e.fastHas(t)?y.TraceMatrixValues.t:y.TraceMatrixValues.f})),i=new d,s=0;s<f.size.w;s++)i.push(new O(s,-1)),i.push(new O(s,f.size.h));for(s=0;s<f.size.h;s++)i.push(new O(-1,s)),i.push(new O(f.size.w,s));for(;i.length;){var a=i.pop();try{r=void 0;for(var u=at(n),c=u.next();!c.done;c=u.next()){var h=c.value,l=a.clone().move(h);j(o,l,y.TraceMatrixValues.t)===y.TraceMatrixValues.f&&(ot(o,l,y.TraceMatrixValues.t),i.push(l))}}catch(t){r={error:t}}finally{try{c&&!c.done&&(t=u.return)&&t.call(u)}finally{if(r)throw r.error}}}var p=f.reverseMatrix(o);return f.totalCountInMatrix(p)?p:null},this.size=t.clone().scale(4),C.createMatrix(this.size,function(t){var e=t.clone().mod(4),r=e.x,e=e.y;return[1,2].includes(r)&&[1,2].includes(e)?n(t.clone().div(4)):y.TraceMatrixValues.f}));this.m=C.createMatrix(this.size);for(var r=1;r<this.size.y-1;r++)for(var o=1;o<this.size.x-1;o++)e[r][o]===y.TraceMatrixValues.t&&(this.m[r-1][o-1]=y.TraceMatrixValues.t,this.m[r-1][o]=y.TraceMatrixValues.t,this.m[r-1][o+1]=y.TraceMatrixValues.t,this.m[r][o-1]=y.TraceMatrixValues.t,this.m[r][o]=y.TraceMatrixValues.t,this.m[r][o+1]=y.TraceMatrixValues.t,this.m[r+1][o-1]=y.TraceMatrixValues.t,this.m[r+1][o]=y.TraceMatrixValues.t,this.m[r+1][o+1]=y.TraceMatrixValues.t)}var ut=function(){return(ut=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},ct=function(t,e){var r={};for(o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(r[o[n]]=t[o[n]]);return r},ht=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},W=(B.prototype.setKnownPoints=function(t){var e=this;return this.points=t instanceof d?t.points:t,this.minPoint.setProperties(this.points.reduce(function(n,o){return e.keys.reduce(function(t,e){var r;return t[e]=Math.min(null!=(r=n[e])?r:1/0,o.properties[e]),t},n)},{})),this.maxPoint.setProperties(this.points.reduce(function(n,o){return e.keys.reduce(function(t,e){var r;return t[e]=Math.max(null!=(r=n[e])?r:-1/0,o.properties[e]),t},n)},{})),this},B.prototype.positionToCellCoords=function(t){return t.clone().move(this.minPoint.clone().minus()).divide(this.stepSize).floor()},B.prototype.calculate=function(){return this.setKnownValues(),this.interpolateValues(),this},B.prototype.getCellValue=function(t,e){var r=t.x,t=t.y,n=this.cells[r][t];return e?Array.isArray(e)?e.reduce(function(t,e){return t[e]=n.properties[e],t},{}):n.properties[e]:ut({},n.properties)},Object.defineProperty(B.prototype,"getCellData",{get:function(){return this.allCells.reduce(function(t,e){var e=e.properties,r=e.x,n=e.y,e=ct(e,["x","y"]);return t[r]=t[r]||{},t[r][n]=ut({},e),t},{})},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"allCellsClone",{get:function(){return this.allCells.map(function(t){return t.clone()})},enumerable:!1,configurable:!0}),B.prototype.interpolateValues=function(){var i=this,t=this.points.map(function(t){return i.positionToCellCoords(t)});this.allCells.forEach(function(r){var e=new O(r.properties.x,r.properties.y),o=t.map(function(t){return Math.pow(e.distance(t),i.p)});i.keys.forEach(function(n){var t,e;w(r.properties[n])||(t=(e=ht(o.reduce(function(t,e,r){return w(i.points[r].properties[n])&&(t[0]+=i.points[r].properties[n]/e,t[1]+=1/e),t},[0,0]),2))[0],e=e[1],r.properties[n]=t/e)})})},B.prototype.setKnownValues=function(){var o=this;this.points.forEach(function(e){var t=o.positionToCellCoords(e),r=t.x,n=t.y;o.keys.forEach(function(t){o.cells[r][n].properties[t]=e.properties[t]})})},B.prototype.generateCells=function(){for(var t=this.minPoint.x,e=0;t<this.maxPoint.x;t+=this.stepSize,e++){this.cells[e]=this.cells[e]||{};for(var r=this.minPoint.y,n=0;r<this.maxPoint.y;r+=this.stepSize,n++){var o=this.sizePoly.clone().loop().move(t,r).run().setProperties({x:e,y:n});this.cells[e][n]=o,this.allCells.push(o)}}},B);function B(t,e,r,n){void 0===n&&(n=2),this.stepSize=e,this.p=n,this.points=[],this.cells={},this.allCells=[],this.minPoint=t.minPoint,this.maxPoint=t.maxPoint,this.sizePoly=d.createSquareBySize(new O(this.stepSize)),this.size=this.maxPoint.clone().move(this.minPoint.clone().minus()).divide(this.stepSize).ceil(),this.keys=Array.isArray(r)?r:[r],this.generateCells()}var lt=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},n=(F.find=function(t,e,r){var n;return t.x===e.x&&e.x===r.x?new F(1,0,0,-t.x,t,e,r):t.y===e.y&&e.y===r.y?new F(0,1,0,-t.y,t,e,r):t.z===e.z&&e.z===r.z?new F(0,0,1,-t.z,t,e,r):new F((n=lt(u([[t.x,t.y,t.z,-1],[e.x,e.y,e.z,-1],[r.x,r.y,r.z,-1]]),3))[0],n[1],n[2],1,t,e,r)},F.prototype.x=function(t){var e,r,n,o,i,s,a=this;return t instanceof O?(e=this.a,r=this.b,n=this.c,o=this.d,i=t.y,s=t.z,t.x=-(r*i+n*s+o)/e,t):t.map(function(t){return a.x(t)})},F.prototype.y=function(t){var e,r,n,o,i,s,a=this;return t instanceof O?(e=this.a,r=this.b,n=this.c,o=this.d,i=t.x,s=t.z,t.y=-(e*i+n*s+o)/r,t):t.map(function(t){return a.y(t)})},F.prototype.z=function(t){var e,r,n,o,i,s,a=this;return t instanceof O?(e=this.a,r=this.b,n=this.c,o=this.d,i=t.x,s=t.y,t.z=-(e*i+r*s+o)/n,t):t.map(function(t){return a.z(t)})},F.prototype.clone=function(){var t=this;return new F(t.a,t.b,t.c,t.d,t.p1,t.p2,t.p3)},F.prototype.distance=function(t){var e,r,n,o,i,s,a;return t instanceof O?(n=t.x,o=t.y,i=t.z,a=this.a,e=this.b,r=this.c,s=this.d,Math.abs(a*n+e*o+r*i+s)/Math.sqrt(a*a+e*e+r*r)):(n=t.a,o=t.b,i=t.c,s=t.d,a=this.d,Math.abs(s-a)/Math.sqrt(n*n+o*o+i*i))},F.prototype.equal=function(t){var e=t.a,r=t.b,n=t.c,t=t.d,o=this.a,i=this.b,s=this.c,a=this.d;return f.like(e,o)&&f.like(r,i)&&f.like(n,s)&&f.like(t,a)},F.prototype.same=function(t){var e=t.a,r=t.b,n=t.c,t=t.d,o=this.a,i=this.b,e=e/o,o=n/this.c,t=t/this.d;return f.like(e,r/i)&&f.like(e,o)&&f.like(e,n)&&f.like(e,t)},F.prototype.parallel=function(t){var e=t.a,r=t.b,n=t.c,t=t.d,o=this.a,i=this.b,e=e/o,o=n/this.c,t=t/this.d;return f.like(e,r/i)&&f.like(e,o)&&f.like(e,n)&&!f.like(e,t)},F);function F(t,e,r,n,o,i,s){void 0===o&&(o=O.zero()),void 0===i&&(i=O.zero()),void 0===s&&(s=O.zero()),this.a=t,this.b=e,this.c=r,this.d=n,this.p1=o,this.p2=i,this.p3=s}y.DCircle=tt,y.DEGREE_TO_PI=$,y.DGeo=P,y.DLine=k,y.DNumbers=f,y.DOUBLE_PI_IN_DEGREE=g,y.DPlane=n,y.DPoint=O,y.DPolygon=d,y.DPolygonLoop=X,y.EARTH_RADIUS_IN_METERS=6378137,y.FastSearch=rt,y.HALF_PI_IN_DEGREE=90,y.InterpolationMatrix=W,y.MIN_POINTS_IN_VALID_POLYGON=3,y.PI_IN_DEGREE=i,y.PI_TO_DEGREE=b,y.TraceMatrix=r,y.cartesianProduct=L,y.createArray=p,y.createCanvas=R,y.createMatrix=G,y.gaussianElimination=u,y.getCombinations=E,y.isDefAndNotNull=w,y.parseDegreesMinutesSeconds=function(t){var e,r,n,o,i,s,a,u,c,t=t.matchAll(/(?<value>-?\d+(?<tail>\.\d{1,})?)(?<type>°|'|")/gimu),h=0,l=0,p=0;try{for(var f=Y(t),y=f.next();!y.done;y=f.next()){var d=y.value;switch(null==(n=null==d?void 0:d.groups)?void 0:n.type){case"°":h=Number(null!=(i=null==(o=null==d?void 0:d.groups)?void 0:o.value)?i:"0");break;case"'":l=Number(null!=(a=null==(s=null==d?void 0:d.groups)?void 0:s.value)?a:"0");break;case'"':p=Number(null!=(c=null==(u=null==d?void 0:d.groups)?void 0:u.value)?c:"0")}}}catch(t){e={error:t}}finally{try{y&&!y.done&&(r=f.return)&&r.call(f)}finally{if(e)throw e.error}}t=h<0?-1:1;return h+t*l/60+t*p/3600},Object.defineProperty(y,"__esModule",{value:!0})});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jsts")):"function"==typeof define&&define.amd?define(["exports","jsts"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).DGeoUtils={},t.jsts)}(this,function(y,F){"use strict";function x(t){return function(){return t}}function s(b){return{checkArgument:function(t){return P.DEBUG?{shouldBeDegree:function(t){return t.likeWorldGeodeticSystem||M('"'.concat(v,'" -> "').concat(g,'" should be degree!')),m},shouldBeMeters:function(t){return t.likePseudoMercator||M('"'.concat(y,'" -> "').concat(d,'" should be meters!')),f},shouldBeInt:function(t){return t.clone().round().equal(t)||M('"'.concat(l,'" -> "').concat(p,'" should be Int!')),h},shouldBeUInt:function(t){return t.clone().round().equal(t)&&t.gtOrEqual(O.zero())||M('"'.concat(u,'" -> "').concat(c,'" should be UInt!')),a},shouldBeRadians:function(t){return t.likeRadians||M('"'.concat(i,'" -> "').concat(s,'" should be radians!')),o},shouldExist:(e=o=a=h=f=m=this,r=i=u=l=y=v=b,n=s=c=p=d=g=t,function(t){return w(t)||M('"'.concat(r,'" -> "').concat(n,'" should exist!')),e})}:{shouldBeDegree:x(this),shouldBeMeters:x(this),shouldBeInt:x(this),shouldBeUInt:x(this),shouldBeRadians:x(this),shouldExist:x(this)};var e,r,n,o,i,s,a,u,c,h,l,p,f,y,d,m,v,g}}}function L(t,r){var e=t.h,n=t.w;return"function"==typeof r?p(e).map(function(t,e){return p(n,function(t){return r(t,e)})}):p(e).map(function(){return p(n,r)})}function u(t){for(var e=t.length,r=L(new O(e+1,e)),n=0;n<e;n++)for(var o=0;o<e+1;o++)t[n][o]=0===t[n][o]?u.MIN:t[n][o],r[n][o]=t[n][o];for(var i=0;i<e;i++){for(n=0;n<e+1;n++)r[i][n]/=t[i][i];for(n=i+1;n<e;n++)for(var s=r[n][i]/r[i][i],o=0;o<e+1;o++)r[n][o]-=r[i][o]*s;for(n=0;n<e;n++)for(o=0;o<e+1;o++)t[n][o]=r[n][o]}for(i=e-1;-1<i;i--){for(n=e;-1<n;n--)r[i][n]/=t[i][i];for(n=i-1;-1<n;n--)for(s=r[n][i]/r[i][i],o=e;-1<o;o--)r[n][o]-=r[i][o]*s}for(var a=p(e),n=0;n<e;n++)a[n]=r[n][e];return a}function R(t,e,r){var n=0,o=0,i=!1,e=(o=t instanceof O?(n=t.x,t.y):n=t,"boolean"==typeof e?i=e:"number"==typeof e&&(o=e),(i="boolean"==typeof r?r:i)?new OffscreenCanvas(n,o):(null!=(t=R.document)?t:document).createElement("canvas"));return i||(e.width=n,e.height=o),[e,e.getContext("2d")]}function G(t,e){for(var r,n,o=[],i=2;i<arguments.length;i++)o[i-2]=arguments[i];return e?G.apply(void 0,l([(r=t,n=e,[].concat.apply([],l([],h(r.map(function(e){return n.map(function(t){return[].concat(e,t)})})),!1)))],h(o),!1)):t}function E(t){if(1===t.length)return t[0];for(var e=[],r=E(t.slice(1)),n=0;n<r.length;n++)for(var o=0;o<t[0].length;o++)e.push(l([t[0][o]],h(r[n]),!1));return e}function a(t,e){return Math.floor(t/e)}function V(t){var e=t<0,r=Math.floor(Math.abs(t)),t=Math.abs(t)%1*60,n=Math.floor(t),t=(t%1*60).toFixed(2);return"".concat(e?"-":"").concat(r,"° ").concat(n,"' ").concat(t,'"')}var c,h=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},l=function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||((n=n||Array.prototype.slice.call(e,0,o))[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},Y=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},P={DEBUG:!1,parseFormat:"xyz"},M=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];P.DEBUG&&console.warn.apply(console,l([],h(t),!1))},w=function(t){return null!=t},p=function(t,r){return"function"==typeof r?new Array(t).fill(!1).map(function(t,e){return r(e)}):new Array(t).fill(null!=r?r:0)},f=(u.MIN=1e-10,e.like=function(t,e,r){return void 0===r&&(r=.001),Math.abs(t-e)<r},e.likeZero=function(t){return e.like(t,0)},e.like2PI=function(t){return e.like(e.rad2Deg(t),g)},e.likePI=function(t){return e.like(e.rad2Deg(t),i)},e.rad2Deg=function(t){return t*tt},e.deg2Rad=function(t){return t*b},e);function e(){}(r=c=c||{})[r.getTileFromCoords=0]="getTileFromCoords",r[r.getCoordsFromTile=1]="getCoordsFromTile",r[r.height=2]="height",r[r.setX=3]="setX",r[r.setY=4]="setY",r[r.setZ=5]="setZ",r[r.rotate=6]="rotate",r[r.rotate3dX=7]="rotate3dX",r[r.rotate3dY=8]="rotate3dY",r[r.rotate3dZ=9]="rotate3dZ",r[r.move=10]="move",r[r.round=11]="round",r[r.ceil=12]="ceil",r[r.floor=13]="floor",r[r.toFixed=14]="toFixed",r[r.abs=15]="abs",r[r.scale=16]="scale",r[r.divide=17]="divide",r[r.degreeToRadians=18]="degreeToRadians",r[r.radiansToDegrees=19]="radiansToDegrees",r[r.radiansToMeters=20]="radiansToMeters",r[r.metersToRadians=21]="metersToRadians",r[r.hipPoint=22]="hipPoint",r[r.xPoint=23]="xPoint",r[r.yPoint=24]="yPoint",r[r.wPoint=25]="wPoint",r[r.hPoint=26]="hPoint",r[r.setIfLessThan=27]="setIfLessThan",r[r.minus=28]="minus",r[r.degreeToMeters=29]="degreeToMeters",r[r.metersToDegree=30]="metersToDegree",r[r.flipVertically=31]="flipVertically",r[r.setProperties=32]="setProperties",r[r.div=33]="div",r[r.mod=34]="mod";function q(r,t){var e=t.functionName,n=t.pointArg,o=t.numberPointArg,i=t.numberArg,s=t.setterArg,a=t.setterArgByObject,u=r;switch(e){case c.getTileFromCoords:u=function(t,e){return r(t,e).getTileFromCoords(i)};break;case c.getCoordsFromTile:u=function(t,e){return r(t,e).getCoordsFromTile(i)};break;case c.height:u=function(t,e){return r(t,e).height(i)};break;case c.setX:u=function(t,e){return"number"==typeof s?r(t,e).setX(s):r(t,e).setX(function(t){return s(t,e)})};break;case c.setY:u=function(t,e){return"number"==typeof s?r(t,e).setY(s):r(t,e).setY(function(t){return s(t,e)})};break;case c.setZ:u=function(t,e){return"number"==typeof s?r(t,e).setZ(s):r(t,e).setZ(function(t){return s(t,e)})};break;case c.rotate:u=function(t,e){return r(t,e).rotate(i)};break;case c.rotate3dX:u=function(t,e){return r(t,e).rotate3dX(i)};break;case c.rotate3dY:u=function(t,e){return r(t,e).rotate3dY(i)};break;case c.rotate3dZ:u=function(t,e){return r(t,e).rotate3dZ(i)};break;case c.move:u=function(t,e){return r(t,e).move(o,i)};break;case c.round:u=function(t,e){return r(t,e).round()};break;case c.ceil:u=function(t,e){return r(t,e).ceil()};break;case c.floor:u=function(t,e){return r(t,e).floor()};break;case c.toFixed:u=function(t,e){return r(t,e).toFixed(i)};break;case c.abs:u=function(t,e){return r(t,e).abs()};break;case c.scale:u=function(t,e){return r(t,e).scale(o,i)};break;case c.divide:u=function(t,e){return r(t,e).divide(o,i)};break;case c.div:u=function(t,e){return r(t,e).div(o,i)};break;case c.mod:u=function(t,e){return r(t,e).mod(o,i)};break;case c.degreeToRadians:u=function(t,e){return r(t,e).degreeToRadians()};break;case c.radiansToDegrees:u=function(t,e){return r(t,e).radiansToDegrees()};break;case c.radiansToMeters:u=function(t,e){return r(t,e).radiansToMeters()};break;case c.metersToRadians:u=function(t,e){return r(t,e).metersToRadians()};break;case c.hipPoint:u=function(t,e){return r(t,e).hipPoint};break;case c.xPoint:u=function(t,e){return r(t,e).xPoint};break;case c.yPoint:u=function(t,e){return r(t,e).yPoint};break;case c.wPoint:u=function(t,e){return r(t,e).wPoint};break;case c.hPoint:u=function(t,e){return r(t,e).hPoint};break;case c.setIfLessThan:u=function(t,e){return r(t,e).setIfLessThan(n)};break;case c.minus:u=function(t,e){return r(t,e).minus()};break;case c.degreeToMeters:u=function(t,e){return r(t,e).degreeToMeters()};break;case c.metersToDegree:u=function(t,e){return r(t,e).metersToDegree()};break;case c.flipVertically:u=function(t,e){return r(t,e).flipVertically(o)};break;case c.setProperties:u=function(t,e){return"object"==typeof a?r(t,e).setProperties(a):r(t,e).setProperties(function(t){return a(t,e)})}}return u}t.prototype.getLoopFunction=function(){return this.pool.reduce(q,function(t){return t})},t.prototype.run=function(){return this.parent.map(this.getLoopFunction())},t.prototype.getTileFromCoords=function(t){return this.pool.push({functionName:c.getTileFromCoords,numberArg:t}),this},t.prototype.getCoordsFromTile=function(t){return this.pool.push({functionName:c.getCoordsFromTile,numberArg:t}),this},t.prototype.height=function(t){return this.pool.push({functionName:c.height,numberArg:t}),this},t.prototype.setX=function(t){return this.pool.push({functionName:c.setX,setterArg:t}),this},t.prototype.setProperties=function(t){return this.pool.push({functionName:c.setProperties,setterArgByObject:t}),this},t.prototype.setY=function(t){return this.pool.push({functionName:c.setY,setterArg:t}),this},t.prototype.setZ=function(t){return this.pool.push({functionName:c.setZ,setterArg:t}),this},t.prototype.rotate=function(t){return this.pool.push({functionName:c.rotate,numberArg:t}),this},t.prototype.rotate3dX=function(t){return this.pool.push({functionName:c.rotate3dX,numberArg:t}),this},t.prototype.rotate3dY=function(t){return this.pool.push({functionName:c.rotate3dY,numberArg:t}),this},t.prototype.rotate3dZ=function(t){return this.pool.push({functionName:c.rotate3dZ,numberArg:t}),this},t.prototype.move=function(t,e){return this.pool.push({functionName:c.move,numberPointArg:t,numberArg:e=void 0===e?t:e}),this},t.prototype.round=function(){return this.pool.push({functionName:c.round}),this},t.prototype.ceil=function(){return this.pool.push({functionName:c.ceil}),this},t.prototype.floor=function(){return this.pool.push({functionName:c.floor}),this},t.prototype.toFixed=function(t){return this.pool.push({functionName:c.toFixed,numberArg:t=void 0===t?2:t}),this},t.prototype.abs=function(){return this.pool.push({functionName:c.abs}),this},t.prototype.scale=function(t,e){return this.pool.push({functionName:c.scale,numberPointArg:t,numberArg:e=void 0===e?t:e}),this},t.prototype.divide=function(t,e){return this.pool.push({functionName:c.divide,numberPointArg:t,numberArg:e}),this},t.prototype.div=function(t,e){return this.pool.push({functionName:c.div,numberPointArg:t,numberArg:e}),this},t.prototype.mod=function(t,e){return this.pool.push({functionName:c.mod,numberPointArg:t,numberArg:e}),this},t.prototype.degreeToRadians=function(){return this.pool.push({functionName:c.degreeToRadians}),this},t.prototype.radiansToDegrees=function(){return this.pool.push({functionName:c.radiansToDegrees}),this},t.prototype.radiansToMeters=function(){return this.pool.push({functionName:c.radiansToMeters}),this},t.prototype.metersToRadians=function(){return this.pool.push({functionName:c.metersToRadians}),this},t.prototype.getHipPoint=function(){return this.pool.push({functionName:c.hipPoint}),this},t.prototype.getXPoint=function(){return this.pool.push({functionName:c.xPoint}),this},t.prototype.getYPoint=function(){return this.pool.push({functionName:c.yPoint}),this},t.prototype.getWPoint=function(){return this.pool.push({functionName:c.wPoint}),this},t.prototype.getHPoint=function(){return this.pool.push({functionName:c.hPoint}),this},t.prototype.setIfLessThan=function(t){return this.pool.push({functionName:c.setIfLessThan,pointArg:t}),this},t.prototype.minus=function(){return this.pool.push({functionName:c.minus}),this},t.prototype.degreeToMeters=function(){return this.pool.push({functionName:c.degreeToMeters}),this},t.prototype.metersToDegree=function(){return this.pool.push({functionName:c.metersToDegree}),this},t.prototype.flipVertically=function(t){return this.pool.push({functionName:c.flipVertically,numberPointArg:t}),this};var X=t;function t(t){this.parent=t,this.pool=[]}var o=function(){return(o=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},_=function(n,o){var i,s,a,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(r){return function(t){var e=[r,t];if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,s&&(a=2&e[0]?s.return:e[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,e[1])).done)return a;switch(s=0,(e=a?[2&e[0],a.value]:e)[0]){case 0:case 1:a=e;break;case 4:return u.label++,{value:e[1],done:!1};case 5:u.label++,s=e[1],e=[0];continue;case 7:e=u.ops.pop(),u.trys.pop();continue;default:if(!(a=0<(a=u.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){u=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3]))u.label=e[1];else if(6===e[0]&&u.label<a[1])u.label=a[1],a=e;else{if(!(a&&u.label<a[2])){a[2]&&u.ops.pop(),u.trys.pop();continue}u.label=a[2],u.ops.push(e)}}e=o.call(n,u)}catch(t){e=[6,t],s=0}finally{i=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}}},I=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},S=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},T=function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||((n=n||Array.prototype.slice.call(e,0,o))[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},r=F.operation.buffer.BufferParameters,W=r.CAP_ROUND,n=r.CAP_FLAT,r=r.CAP_SQUARE,d=(j.arrayOfTrianglesToVertices=function(t,e){return t.map(function(t){return(w(e)?t.loop().height(e).run():t).toArrayOfCoords()}).flat(2)},j.minAreaRectangleSize=function(t){var t=t.clone().open(),e=t.first,r=t.second,t=t.last;return new O(e.distance(r),e.distance(t))},j.toDash=function(t){var e,r,n=new j,o=[n],i=!0;try{for(var s=I(t.points),a=s.next();!a.done;a=s.next()){var u=a.value;i&&n.push(u.clone()),u.properties.pieceBorder&&(i=!i)&&(n=new j,o.push(n),n.push(u.clone()))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return o},j.minAreaRectangleDirection=function(t){var t=t.clone().open(),e=t.first,r=t.second,t=t.last;return e&&r&&t?(e.distance(r)>e.distance(t)?e.findLine(r):e.findLine(t)).getFi():0},j.parseFromWKT=function(t){var e,r,n,t=t.trim().toUpperCase(),o=new j;return 0===t.indexOf("POLYGON")&&(n=/POLYGON \(\((?<data>(?:(?!\)\)$).)*?)\)\)$/imu.exec(t),e=(r=S(n.groups.data.split("), (").map(function(t){return new j(t.split(", ").map(function(t){return O.parse(t.split(" ").map(Number))}))})))[0],(r=r.slice(1))&&r.length&&(e.holes=r),o=e),0===t.indexOf("LINESTRING")&&(o=new j((n=/LINESTRING \((?<data>(?:(?!\)$).)*?)\)$/imu.exec(t)).groups.data.split(", ").map(function(t){return O.parse(t.split(" ").map(Number))}))),o=0===t.indexOf("POINT")?new j([O.parseFromWKT(t)]):o},j.createSquareBySize=function(t){return new j([O.zero(),t.clone().setX(0),t.clone(),t.clone().setY(0)]).close()},j.prototype.loop=function(){return new X(this)},Object.defineProperty(j.prototype,"points",{get:function(){return this.pPoints},set:function(t){this.pPoints=t},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"maxX",{get:function(){return this.reduce(function(t,e){return Math.max(t,e.x)},-1/0)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"minX",{get:function(){return this.reduce(function(t,e){return Math.min(t,e.x)},1/0)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"maxY",{get:function(){return this.reduce(function(t,e){return Math.max(t,e.y)},-1/0)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"minY",{get:function(){return this.reduce(function(t,e){return Math.min(t,e.y)},1/0)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"innerCenter",{get:function(){var o=this.center;return this.toTriangles().map(function(t){n=(e=t).at(0),r=e.at(1),e=e.at(2);var e,r,n=new O((n.x+r.x+e.x)/3,(n.y+r.y+e.y)/3);return n.properties.score=Math.min(n.distance(t.at(0)),n.distance(t.at(1)),n.distance(t.at(2)))+n.distance(o),n}).sort(function(t,e){return t.properties.score-e.properties.score})[0]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"center",{get:function(){return this.leftTop.move(this.size.divide(2))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"h",{get:function(){return this.maxY-this.minY},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"w",{get:function(){return this.maxX-this.minX},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"dY",{get:function(){return this.h},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"dX",{get:function(){return this.w},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"extend",{get:function(){var t=this.minX,e=this.minY,r=this.maxX,n=this.maxY;return new j([new O(t,e),new O(r,e),new O(r,n),new O(t,n),new O(t,e)])},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"size",{get:function(){var t=this.w,e=this.h;return new O(t,e)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"leftTop",{get:function(){var t=this.minX,e=this.minY;return new O(t,e)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"minPoint",{get:function(){return this.leftTop},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"rightBottom",{get:function(){var t=this.maxX,e=this.maxY;return new O(t,e)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"maxPoint",{get:function(){return this.rightBottom},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"length",{get:function(){return this.pPoints.length},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"fullLength",{get:function(){return this.clone().open().perimeter},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"fullLengthLatLon",{get:function(){return this.clone().open().perimeterLatLon},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"perimeter",{get:function(){var e,t,r=0;try{for(var n=I(this.loopPointsGenerator()()),o=n.next();!o.done;o=n.next()){var i=S(o.value,2),s=i[0],a=i[1];r+=s.distance(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"perimeterLatLon",{get:function(){var e,t,r=0;try{for(var n=I(this.loopPointsGenerator()()),o=n.next();!o.done;o=n.next()){var i=S(o.value,2),s=i[0],a=i[1];r+=s.distanceLatLon(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"area",{get:function(){var e,t,r=0;try{for(var n=I(this.deintersection.loopPointsGenerator()()),o=n.next();!o.done;o=n.next()){var i=S(o.value,2),s=i[0],a=s.x,u=s.y,c=i[1],h=c.x;r+=a*c.y-u*h}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return Math.abs(r/2)-this.holes.reduce(function(t,e){return t+e.area},0)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"filledDeintersection",{get:function(){for(var o=this.clone().deintersection.removeDuplicates().clockWise.open(),t=function(t){for(var e={},r=t=void 0===t?0:t;r<o.length;r++){var n=o.at(r).toString();if("number"==typeof e[n])return[e[n],r];e[n]=r}},e=t(),r=[];e;)var n=new j(o.clone().removePart(e[0],e[1]-e[0])),e=n.isClockwise?t(e[0]+1):(r.push(n.close()),o.removePart(e[0],e[1]-e[0]),t());return o.holes=r,o.close()},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"deintersection",{get:function(){for(var e,t,o=this.clone().close(),r={},i=0;i<o.length-1;i++)for(var n=o.at(i).toString(),s=(r[n]=r[n]||[],r[n].push(i),i+2);s<o.length-1;s++)!function(t){var e=o.at(i).findLine(o.at(i+1)),r=o.at(t).findLine(o.at(t+1)),n=e.intersection(r);n&&!T(T([],S(e.points),!1),S(r.points),!1).some(function(t){return t.like(n)})&&(e=o.removePart(i,t-i).reverse(),o.insertAfter.apply(o,T([i],S(e),!1)),o.insertAfter(t,n),o.insertAfter(i,n))}(s);try{for(var a=I(Object.keys(r)),u=a.next();!u.done;u=a.next()){var c=r[u.value];if(1<c.length)for(var h=function(t){var r=o.clone(),e=c[t]-c[t-1];1<e&&(e=new j(r.removePart(c[t-1],e))).reduce(function(t,e){return t&&function(t,e){var r,n;if(t.points.some(function(t){return t.equal(e)}))return!0;try{for(var o=I(t.loopPointsGenerator(!0)()),i=o.next();!i.done;i=o.next()){var s=S(i.value,3)[2];if(s.x(e).equal(e)&&s.inRange(e))return!0}}catch(t){P={error:t}}finally{try{i&&!i.done&&(x=o.return)&&x.call(o)}finally{if(P)throw P.error}}var a=0;try{for(var u=I(t.loopPointsGenerator()()),c=u.next();!c.done;c=u.next()){var h=S(c.value,2),l=h[0],p=l.x,f=l.y,y=h[1],d=y.x,m=y.y,v=new k(p-e.x,f-e.y,0),g=new k(d-e.x,m-e.y,0),b=v.findFi(g);0<v.vectorProduct(g).c?a+=b:a-=b}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}var x=Math.PI/1e4,P=!1,t=Math.abs(a);if(t<x)P=!1;else{if(!(Math.abs(2*Math.PI-t)<x))throw new Error("contains2 faild");P=!0}return P}(r,e)},!0)&&r.isClockwise===e.isClockwise&&(r.insertAfter.apply(r,T([c[t-1]-1],S(e.reverse().points),!1)),o=r)},s=c.length-1;0<s;s--)h(s)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return o},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"valid",{get:function(){return 3<this.length},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"first",{get:function(){return this.at(0)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"second",{get:function(){return this.at(1)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"last",{get:function(){return this.at(this.length-1)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"minAreaRectangle",{get:function(){var e,t,r,n,o=this.convex,i=new j,s=1/0;try{for(var a=I(o.loopPointsGenerator(!0)()),u=a.next();!u.done;u=a.next()){var c,h,l,p,f=S(u.value,3)[2],y=0,d=null,m=null,v=0,g=null;try{r=void 0;for(var b=I(o.loopPointsGenerator()()),x=b.next();!x.done;x=b.next()){var P=S(x.value,4),M=P[0],w=P[3],T=f.findPoint(f.findPerpendicular(M)),k=T.distance(M);v<=k&&(v=k,g=M);for(var O=w;O<o.length-1;O++){var z=f.findPoint(f.findPerpendicular(o.at(O))),A=T.distance(z);y<=A&&(y=A,d=T,m=z)}}}catch(t){r={error:t}}finally{try{x&&!x.done&&(n=b.return)&&n.call(b)}finally{if(r)throw r.error}}d&&m&&g&&(h=(c=d.findLine(m)).findPerpendicular(d),(p=new j([d,m,(l=c.findPerpendicular(m)).findPoint(l.findPerpendicular(g)),h.findPoint(h.findPerpendicular(g))]).close()).area<s)&&(s=(i=p).area)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return i},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"convex",{get:function(){var t=this.clone().open(),e=t.isClockwise;e||t.reverse();do{var r=t.last,n=t.first,o=t.second}while(((u=n.findInnerAngle(r,o))>Math.PI||f.likeZero(f.rad2Deg(u))||f.likePI(u)||f.like2PI(u))&&(t.removePart(-1,1),t.length));t.close();var i=0;do{for(var s=(t=t.deintersection).length,a=1;a<t.length-1;a++){var u,r=t.at(a-1),n=t.at(a),o=t.at(a+1);((u=n.findInnerAngle(r,o))>Math.PI||f.likeZero(f.rad2Deg(u))||f.likePI(u)||f.like2PI(u))&&t.removePart(--a,1)}}while(i++,t.length!==s&&i<100);return e||t.reverse(),t},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isClockwise",{get:function(){var e,t,r=0;try{for(var n=I(this.clone().close().loopPointsGenerator()()),o=n.next();!o.done;o=n.next()){var i=S(o.value,2),s=i[0],a=s.x,u=s.y,c=i[1];r+=(c.x-a)*(c.y+u)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r<0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"clockWise",{get:function(){return this.isClockwise?this.clone():this.clone().reverse()},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"noHoles",{get:function(){var t=this.clone();return t.holes=[],t},enumerable:!1,configurable:!0}),j.prototype.reduce=function(t,e){return this.pPoints.reduce(t,e)},j.prototype.intersection=function(t,e){void 0===e&&(e=!1);var r,n,o=[];try{for(var i=I(this.loopPointsGenerator(!0)()),s=i.next();!s.done;s=i.next()){var a=S(s.value,3)[2].intersection(t,0,e);a&&o.push(a)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return o},j.prototype.setCenter=function(t){return this.loop().move(t.clone().move(this.center.minus())).run()},j.prototype.toWKT=function(t,e){return void 0===e&&(e=!1),(t=void 0===t?j.WKT_POLYGON:t)===j.WKT_POLYGON?(t="",this.holes&&this.holes.length&&(t=", ".concat(this.holes.map(function(t){return t.toString()}).join(", "))),"POLYGON ((".concat(this.deintersection.mapArray(function(t){return"".concat(t.x," ").concat(t.y).concat(e?" ".concat(t.z):"")}).join(", "),")").concat(t,")")):"LINESTRING (".concat(this.mapArray(function(t){return"".concat(t.x," ").concat(t.y).concat(e?" ".concat(t.z):"")}).join(", "),")")},j.prototype.filter=function(t){return this.pPoints=this.pPoints.filter(t),this},j.prototype.map=function(e){return this.pPoints=this.mapArray(e),this.holes=this.holes.map(function(t){return t.map(e)}),this},j.prototype.mapArray=function(t){return this.pPoints.map(t)},j.prototype.sort=function(t){return this.points.sort(t),this},j.prototype.at=function(t){var e=this.length;return this.points[(t%e+e)%e]},j.prototype.pop=function(){return this.pPoints.pop()},j.prototype.push=function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return(t=this.pPoints).push.apply(t,T([],S(e),!1))},j.prototype.shift=function(){return this.pPoints.shift()},j.prototype.unshift=function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return(t=this.pPoints).unshift.apply(t,T([],S(e),!1))},j.prototype.reverse=function(){return this.pPoints=this.pPoints.reverse(),this.holes=this.holes.map(function(t){return t.reverse()}),this},j.prototype.getValue=function(){return this.pPoints.map(function(t){return t.getValue()})+this.holes.reduce(function(t,e){return t+e.getValue()},"")},j.prototype.toString=function(){return"(".concat(this.mapArray(function(t){return t.toString()}).join(", "),")")},j.prototype.close=function(){var t=this.first;return t&&!this.closed&&this.push(t.clone()),this},j.prototype.open=function(){var t=this.first;return 2<this.length&&t&&this.closed&&this.pop(),this},j.prototype.add=function(t){var e=new j(T(T([],S(this.points),!1),S(t.points),!1)).close();return e.holes=T(T([],S(this.holes),!1),S(t.holes),!1).map(function(t){return t.clone()}),e},j.prototype.has=function(e){return this.pPoints.some(function(t){return t.equal(e)})},j.prototype.clone=function(){var t=new j(this.points.map(function(t){return t.clone()}));return t.holes=this.holes.map(function(t){return t.clone()}),t.properties=o({},this.properties),t},j.prototype.equal=function(r){return r instanceof j&&this.length===r.length&&this.holes.length===r.holes.length&&this.same(r)&&this.holes.reduce(function(t,e){return t&&r.holes.some(function(t){return t.same(e)})},!0)},j.prototype.same=function(t){for(var e=t.clone().close(),r=this.clone().close().toString(),n=0;n<e.length;n++){if(r===e.toString()||r===e.clone().reverse().toString())return!0;e.nextStart()}return!1},j.prototype.findIndex=function(e){return e instanceof O?this.points.findIndex(function(t){return t.equal(e)}):this.points.findIndex(e)},j.prototype.approximation=function(t){return void 0===t&&(t=.1*Math.sqrt(this.perimeter)),new j(this.clone().douglasPeucker(this.pPoints,t))},j.prototype.insertAfter=function(t){for(var e,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];(e=this.pPoints).splice.apply(e,T([t+1,0],S(r),!1))},j.prototype.removePart=function(t,e){return this.pPoints.splice(t+1,e)},j.prototype.hasSimpleIntersection=function(t){var e=this.extend,r=t.extend,t=e.points,n=r.points,t=t.some(function(t){return r.simpleInclude(t)}),n=n.some(function(t){return e.simpleInclude(t)});return t||n},j.prototype.simpleInclude=function(t){return this.simpleIncludeX(t)&&this.simpleIncludeY(t)},j.prototype.drawPolygonOnCanvas=function(t,e,r,n,o,i){return void 0===o&&(o=1),void 0===i&&(i=this.length-1),1<this.length&&(t=t.getContext("2d"),e&&(t.fillStyle=e),r&&(t.strokeStyle=r),o&&(t.lineWidth=o),(e||r)&&t.beginPath(),this.goByPath(t,i%this.length),n&&(t.shadowColor=n,t.shadowBlur=0,t.shadowOffsetX=1,t.shadowOffsetY=1),e&&(t.closePath(),t.fill()),r)&&t.stroke(),this},j.prototype.clearPolygonOnCanvas=function(t){var t=t.getContext("2d"),e=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",this.goByPath(t),t.fill(),t.globalCompositeOperation=e},j.prototype.contain=function(t,e){var r;if(void 0===e&&(e=!1),!this.simpleInclude(t))return!1;if(this.onBorder(t))return e;var e=this.deintersection,n=0;try{for(var o=I(e.loopPointsGenerator()()),i=o.next();!i.done;i=o.next()){var s=S(i.value,2),a=s[0],u=a.x,c=a.y,h=s[1],l=h.x,p=h.y,f=new k(u-t.x,c-t.y,0),y=new k(l-t.x,p-t.y,0),d=f.findFi(y);0<f.vectorProduct(y).c?n+=d:n-=d}}catch(t){r={error:t}}finally{try{i&&!i.done&&(m=o.return)&&m.call(o)}finally{if(r)throw r.error}}var e=Math.PI/1e4,m=Math.abs(n);if(m<e)return!1;if(Math.abs(2*Math.PI-m)<e)return!0;throw new Error("contains2 faild")},j.prototype.onBorder=function(e){var r,t;if(this.simpleInclude(e)){var n=this.deintersection;if(this.points.some(function(t){return t.equal(e)}))return!0;try{for(var o=I(n.loopPointsGenerator(!0)()),i=o.next();!i.done;i=o.next()){var s=S(i.value,3)[2];if(s.x(e).equal(e)&&s.inRange(e))return!0}}catch(t){r={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(r)throw r.error}}}return!1},j.prototype.nextStart=function(){return this.open(),this.push(this.shift()),this.close(),this},j.prototype.removeDuplicates=function(){for(var t=0;t<this.length-1;t++){var e=this.at(t),r=this.at(t+1);e.equal(r)&&(this.removePart(t,1),t--)}return this},j.toGeoJSONFeatureCollection=function(t,e){return void 0===e&&(e=P.parseFormat),{type:"FeatureCollection",features:t.map(function(t){return t.toGeoJSONFeature(e)})}},j.parse=function(t,n){if(void 0===n&&(n=P.parseFormat),t.type)switch(t.type){case"FeatureCollection":return t.features.reduce(function(t,e){e=j.parse(e,n);return Array.isArray(e)?t.push.apply(t,T([],S(e),!1)):t.push(e),t},[]);case"Feature":var e=j.parse(t.geometry,n),r=o(o({},t.properties),t.id?{id:t.id}:{});return Array.isArray(e)?e.forEach(function(t){t.properties=o({},r)}):e.properties=o({},r),e;case"LineString":case"MultiPoint":return new j(t.coordinates.map(function(t){return O.parse(t,n)}));case"Polygon":return t.coordinates.reduce(function(t,e,r){return 0===r?t.points=e.map(function(t){return O.parse(t,n)}):t.holes.push(new j(e.map(function(t){return O.parse(t,n)}))),t},new j);case"MultiLineString":return t.coordinates.reduce(function(t,e){return t.push(new j(e.map(function(t){return O.parse(t,n)}))),t},[]);case"MultiPolygon":return t.coordinates.reduce(function(t,e){return t.push(j.parse({type:"Polygon",coordinates:e},n)),t},[]);case"GeometryCollection":return t.geometries.reduce(function(t,e){return t.push(j.parse(e,n)),t},[])}return new j(t.map(function(t){return O.parse(t,n)}))},j.prototype.toArrayOfCoords=function(e){return void 0===e&&(e=P.parseFormat),this.mapArray(function(t){return t.toCoords(e)})},j.prototype.toGeoJSONFeature=function(t){return void 0===t&&(t=P.parseFormat),{type:"Feature",properties:o({},this.properties),geometry:this.toGeoJSON(t)}},j.prototype.toGeoJSON=function(e){return void 0===e&&(e=P.parseFormat),this.closed?{type:"Polygon",coordinates:T([this.toArrayOfCoords(e)],S(this.holes.map(function(t){return t.toArrayOfCoords(e)})),!1)}:{type:"LineString",coordinates:this.toArrayOfCoords(e)}},j.prototype.divideToPieces=function(t,s){var e,r;void 0===s&&(s=!1);var a=this.fullLength/t,u=a,c=this;try{for(var n=I(this.loopPointsGenerator()()),o=n.next();!o.done;o=n.next()){var i=S(o.value,4);!function(t,e,r){var n,o,i=t.distance(e);i===u?(e.properties.pieceBorder=!0,u=a):0<i-u?(o=new et(t,u),(o=(n=t.findLine(e)).intersectionWithCircle(o).filter(function(t){return n.inRange(t,.001)})[0]).properties.pieceBorder=!0,c.insertAfter(r,o),s&&(r=t.z,o.z=r-(r-e.z)*(t.distance(o)/i)),u=a):u-=i}(i[0],i[1],i[3])}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return this},j.prototype.prepareToFastSearch=function(){var e,t;this.searchStore={};try{for(var r=I(this.points),n=r.next();!n.done;n=r.next()){var o=n.value,i=o.x,s=o.y,a=o.z;this.searchStore[i]||(this.searchStore[i]={}),this.searchStore[i][s]||(this.searchStore[i][s]={}),this.searchStore[i][s][a||"undefined"]=!0}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},j.prototype.fastHas=function(t){var e=t.x,r=t.y,t=t.z;return this.searchStore[e]&&this.searchStore[e][r]&&this.searchStore[e][r][t||"undefined"]||!1},Object.defineProperty(j.prototype,"growingPiecesGenerator",{get:function(){var a=this;return function(){var e,r,n,o,i,s;return _(this,function(t){switch(t.label){case 0:e=new j,t.label=1;case 1:t.trys.push([1,6,7,8]),r=I(a.pPoints),n=r.next(),t.label=2;case 2:return n.done?[3,5]:(o=n.value,e.push(o),o.properties.pieceBorder?[4,e.clone()]:[3,4]);case 3:t.sent(),t.label=4;case 4:return n=r.next(),[3,2];case 5:return[3,8];case 6:return o=t.sent(),i={error:o},[3,8];case 7:try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(i)throw i.error}return[7];case 8:return[2,e.clone()]}})}},enumerable:!1,configurable:!0}),j.prototype.simpleUnion=function(t){try{var e=this.simpleLogicFunction(t,!0,!0);return null===e?null:e instanceof j?e:null}catch(t){return null}},j.prototype.simpleIntersection=function(t){return this.simpleLogicFunction(t,!1,!1)},j.prototype.simpleDifference=function(t){return this.simpleLogicFunction(t,!0,!1)},j.prototype.smartUnion=function(t){var e,r,n=this.clone().simpleUnion(t);if(n){var i=T(T(T([],S(this.holes),!1),S(t.holes),!1),S(n.holes),!1).map(function(t){return t.clone()}),o=function(r){var e,t;try{e=void 0;for(var n=I(i),o=n.next();!o.done;o=n.next())!function(e){if(r.equal(e))return;var t=r.simpleUnion(e);t&&(i=i.filter(function(t){return!t.equal(r)&&!t.equal(e)})).push(t)}(o.value)}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}};try{for(var s=I(i),a=s.next();!a.done;a=s.next())o(a.value)}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}n.holes=i}return n},j.prototype.toTriangles=function(){var t=this.clone().removeDuplicates().open();if(t.length<3)return[];if(3===t.length)return[t];for(var i=function(t,e,r){var n=e.findLine(r),o=n.center,e=t.holes.reduce(function(t,e){return t&&Boolean(e.clone().close().intersection(n,!0).length)},Boolean(t.clone().close().intersection(n,!0).length)),r=t.holes.reduce(function(t,e){return t&&!e.contain(o)},t.contain(o));return!e&&r},e=this.clone().removeDuplicates().clockWise.open();e.holes.length;)for(var r=e.holes.shift().clone().clockWise.reverse().close(),n=0;n<e.length;n++){if(i(e,e.first,r.first)){e.insertAfter.apply(e,T(T([0],S(r.points),!1),[e.first],!1));break}e.push(e.shift())}for(var o=[];3<e.length;){var s=function(t){for(var e=0;e<t.length;e++){var r=t.at(0),n=t.at(1),o=t.at(2);if(i(t,r,o))return t.removePart(0,1),new j([r.clone(),n.clone(),o.clone()]);t.push(t.shift())}}(e);s&&o.push(s)}return o.push(e),o},j.prototype.getTrianglesPointIndexes=function(){var i=function(t,e,r){var n=e.findLine(r),o=n.center,e=t.holes.reduce(function(t,e){return t&&Boolean(e.clone().close().intersection(n,!0).length)},Boolean(t.clone().close().intersection(n,!0).length)),r=t.holes.reduce(function(t,e){return t&&!e.contain(o)},t.contain(o));return!e&&r},t=this.clone(),e=0;for(t.points.forEach(function(t){t.properties.index=e++}),t.holes.forEach(function(t){t.pPoints.forEach(function(t){t.properties.index=e++})}),t=t.clockWise.open();t.holes.length;)for(var r=t.holes.shift().clone().clockWise.reverse().close(),n=0;n<t.length;n++){if(i(t,t.first,r.first)){t.insertAfter.apply(t,T(T([0],S(r.points),!1),[t.first],!1));break}t.push(t.shift())}for(var o=[];3<t.length;){var s=function(t){for(var e=0;e<t.length;e++){var r=t.at(0),n=t.at(1),o=t.at(2);if(i(t,r,o))return t.removePart(0,1),[r.properties.index,n.properties.index,o.properties.index];t.push(t.shift())}}(t);s&&o.push.apply(o,T([],S(s),!1))}return o.push.apply(o,T([],S(t.points.map(function(t){return t.properties.index})),!1)),o},Object.defineProperty(j.prototype,"closed",{get:function(){return this.first.equal(this.last)},enumerable:!1,configurable:!0}),j.prototype.buffer=function(t,e,r){void 0===e&&(e=64),void 0===r&&(r=j.CAP_ROUND);var n=new F.io.WKTReader,o=this.noHoles,i=this.closed;return new j(n.read(o.toWKT(i?j.WKT_POLYGON:j.WKT_LINESTRING)).buffer(t,e,r).getCoordinates().map(function(t){var e=t.x,t=t.y;return new O(e,t)}))},j.prototype.sideBuffers=function(t,e){var r=this.first,n=this.last,t=this.buffer(t,e=void 0===e?64:e,j.CAP_FLAT).open(),e=S(r.sortByDistance(t).points.map(function(t){return t.properties.index}),2),r=e[0],e=e[1],n=S(n.sortByDistance(t).points.map(function(t){return t.properties.index}),2),o=n[0],n=n[1],i=Math.min(Math.max(r,e),Math.max(o,n)),r=Math.max(Math.min(r,e),Math.min(o,n)),e=new j(t.removePart(i-1,r-i+1));return t.unshift(t.pop()),[e.reverse(),t]},j.prototype.setProperties=function(t){return this.properties="object"==typeof t?t:t(this),this},j.prototype.bezier=function(t){void 0===t&&(t=.1);for(var e=new j,r=0;r<1;r+=t)e.push(this.clone().getBezierPoint(r));return e},j.prototype.setGrowingHeight=function(e,t){var r=this.fullLength,n=this.first,o=t-e,i=0;return this.loop().setZ(function(t){return i+=n.distance(t),n=t,e+i/r*o}).run(),this},j.prototype.loopPointsGenerator=function(o){void 0===o&&(o=!1);var i=this;return function(){var e,r,n;return _(this,function(t){switch(t.label){case 0:e=0,t.label=1;case 1:return e<i.length-1?(r=i.at(e),n=i.at(e+1),[4,[r,n,o?r.findLine(n):void 0,e]]):[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})}},j.prototype.getBezierPoint=function(t){var e,r;if(1===this.length)return this.first;try{for(var n=I(this.loopPointsGenerator()()),o=n.next();!o.done;o=n.next()){var i=S(o.value,2),s=i[0],a=i[1];s.move(a.clone().move(s.clone().minus()).scale(t))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return this.pop(),this.getBezierPoint(t)},j.prototype.simpleIncludeX=function(t){t=t.x;return this.minX<=t&&this.maxX>=t},j.prototype.simpleIncludeY=function(t){t=t.y;return this.minY<=t&&this.maxY>=t},j.prototype.douglasPeucker=function(t,e){for(var r,n=0,o=0,i=t.length-1,s=t[0].findLine(t[i]),a=1;a<i;a++){var u=s.perpendicularDistance(t[a]);n<u&&(o=a,n=u)}return e<=n?(r=this.douglasPeucker(t.slice(0,o+1),e),e=this.douglasPeucker(t.slice(o),e),r.pop(),T(T([],S(r),!1),S(e),!1)):[t[0],t[i]]},j.prototype.goByPath=function(t,e){void 0===e&&(e=this.length-1);var r=this.first;t.moveTo(r.x,r.y);for(var n=1;n<=e%this.length;n++){var o=this.at(n),i=o.x,o=o.y;t.lineTo(i,o)}},j.prototype.getJSTSGeometry=function(t,e,r){var r=r===e,n=new F.io.WKTReader,o=n.read(this.noHoles.toWKT()),n=n.read(t.noHoles.toWKT());return r?e?o.union(n):o.intersection(n):o.difference(n)},j.prototype.simpleLogicFunction=function(t,e,r){var n,o,i,s,a,u,c,h,t=this.getJSTSGeometry(t,e,r);if(t){var l=t.getCoordinates();if(l.length){var p=l.reduce(function(t,e,r){var n=e.x,e=e.y,o=t.length-1,n=new O(n,e),e=t[o].first;return n.equal(e)?l[r+1]&&(e=new O(l[r+1].x,l[r+1].y),1<t[o].length)&&t.push(new j([e])):t[o].push(n),t},[new j([new O(l[0].x,l[0].y)])]);if(r&&e&&1<p.length)try{for(var f=I(p),y=f.next();!y.done;y=f.next()){var d=y.value;try{i=void 0;for(var m=I(p),v=m.next();!v.done;v=m.next())if("break"===function(e){var t,r;return d.has(e.first)&&!d.equal(e)?(r=d.findIndex(e.first),(t=d.points).splice.apply(t,T([r,0],S(e.points),!1)),p=p.filter(function(t){return!t.equal(e)}),"continue"):p.length<2?"break":void 0}(v.value))break}catch(t){i={error:t}}finally{try{v&&!v.done&&(s=m.return)&&s.call(m)}finally{if(i)throw i.error}}if(p.length<2)break}}catch(t){n={error:t}}finally{try{y&&!y.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}p=p.filter(function(t){return 2<t.length}).map(function(t){return t.close()});try{for(var g=I(p),b=g.next();!b.done;b=g.next()){d=b.value;try{c=void 0;for(var x=I(p),P=x.next();!P.done;P=x.next())if("break"===function(e){if(p.length<2)return"break";d.equal(e)||d.contain(e.first,!0)&&(d.holes.push(e),p=p.filter(function(t){return!t.equal(e)}))}(P.value))break}catch(t){c={error:t}}finally{try{P&&!P.done&&(h=x.return)&&h.call(x)}finally{if(c)throw c.error}}if(p.length<2)break}}catch(t){a={error:t}}finally{try{b&&!b.done&&(u=g.return)&&u.call(g)}finally{if(a)throw a.error}}return 0===p.length?null:1===p.length?p[0].close():p.map(function(t){return t.close()})}}return null},j.CAP_ROUND=W,j.CAP_FLAT=n,j.CAP_SQUARE=r,j.WKT_LINESTRING="LINESTRING",j.WKT_POLYGON="POLYGON",j);function j(t){this.pPoints=t=void 0===t?[]:t,this.properties={},this.holes=[],this.searchStore={}}m.prototype.clone=function(){return new m(this.a,this.b,this.c,this.begin.clone(),this.end.clone())},m.prototype.findPerpendicular=function(t){return s("findPerpendicular").checkArgument("this.begin").shouldBeMeters(this.begin).checkArgument("this.end").shouldBeMeters(this.end).checkArgument("p").shouldBeMeters(t),new m(-this.b,this.a,this.b*t.x-this.a*t.y)},m.prototype.perpendicularDistance=function(t){return s("perpendicularDistance").checkArgument("this.begin").shouldBeMeters(this.begin).checkArgument("this.end").shouldBeMeters(this.end).checkArgument("p").shouldBeMeters(t),this.findPerpendicular(t).findPoint(this).distance(t)},m.prototype.intersection=function(t,e,r){void 0===e&&(e=0),void 0===r&&(r=!1);var n=this.findPoint(t);return n?r?this.insideRange(n,e)&&t.insideRange(n,e)?n:null:this.inRange(n,e)&&t.inRange(n,e)?n:null:null},m.prototype.intersectionWithCircle=function(t){var e=t.center,t=t.r,r=this.findPerpendicular(e),r=this.findPoint(r),n=r.distance(e);if(this.begin.equal(e)&&(n=0),(n=this.end.equal(e)?0:n)<t){var o,i=this.a,s=this.b,a=this.c;if(this.isParallel){var u=e.distance(r),u=Math.sqrt(t*t-u*u);if(this.isParallelY)return r.x=this.begin.x,[r.clone().move(0,-u),r.clone().move(0,u)];if(this.isParallelX)return r.y=this.begin.y,[r.clone().move(u,0),r.clone().move(-u,0)]}return this.begin.like(e)?(o=this.begin.clone(),[this.movePoint(o,t),this.movePoint(o,-t)]):this.end.like(e)?(o=this.end.clone(),[this.movePoint(o,t),this.movePoint(o,-t)]):(u=i*i+s*s,e=Math.sqrt((t*t-a*a/u)/u),[r.clone().move(s*e,-i*e),r.clone().move(-s*e,i*e)])}return n===t?r:null},m.prototype.inRange=function(t,e){var r=this.minX,n=this.minY,o=this.maxX,i=this.maxY,s=t.x,t=t.y;return r-(e=void 0===e?0:e)<=s&&s<=o+e&&(n-e<=t&&t<=i+e)},m.prototype.insideRange=function(t,e){var r=this.begin,n=this.end;return this.inRange(t,e=void 0===e?0:e)&&!r.like(t,1e-5)&&!n.like(t,1e-5)},Object.defineProperty(m.prototype,"center",{get:function(){return this.begin.clone().setIfLessThan(this.end).move(this.end.clone().move(this.begin.clone().minus()).abs().minus().divide(2))},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"minX",{get:function(){return Math.min(this.begin.x,this.end.x)},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"minY",{get:function(){return Math.min(this.begin.y,this.end.y)},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"maxX",{get:function(){return Math.max(this.begin.x,this.end.x)},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"maxY",{get:function(){return Math.max(this.begin.y,this.end.y)},enumerable:!1,configurable:!0}),m.prototype.toString=function(){return"(".concat(this.a,", ").concat(this.b,", ").concat(this.c,")")},m.prototype.getValue=function(){return[this.a,this.b,this.c]},m.prototype.x=function(t){return this.isParallelY?new O(-this.c/this.a,t.y):this.isParallelX?new O(t.x,-this.c/this.b):new O(-this.b/this.a*t.y-this.c/this.a,t.y)},m.prototype.y=function(t){return this.isParallelY?new O(-this.c/this.a,t.y):this.isParallelX?new O(t.x,-this.c/this.b):new O(t.x,-this.a/this.b*t.x-this.c/this.b)},m.prototype.findPoint=function(t){var e,r;return this.isParallelY&&t.isParallelY||this.isParallelX&&t.isParallelX?null:this.isParallelX&&t.isParallelY?new O(-t.c/t.a,-this.c/this.b):this.isParallelY&&t.isParallelX?new O(-this.c/this.a,-t.c/t.b):this.isParallelY?(r=-this.c/this.a,t.y(new O(r))):this.isParallelX?(e=-this.c/this.b,t.x(new O(0,e))):t.isParallelY?(r=-t.c/t.a,this.y(new O(r))):t.isParallelX?(e=-t.c/t.b,this.x(new O(0,e))):(r=this.y(new O((t.c/t.b-this.c/this.b)/(this.a/this.b-t.a/t.b))),isFinite(r.x)||isFinite(r.y)?r:null)},Object.defineProperty(m.prototype,"isParallel",{get:function(){return this.isParallelX||this.isParallelY},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"isParallelY",{get:function(){return Math.abs(this.b)<.001},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"isParallelX",{get:function(){return Math.abs(this.a)<.001},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"points",{get:function(){return[this.begin,this.end]},enumerable:!1,configurable:!0}),m.prototype.getFi=function(){s("getFi").checkArgument("this.begin").shouldBeMeters(this.begin).checkArgument("this.end").shouldBeMeters(this.end);var t=this.end.clone().move(this.begin.clone().minus()),e=t.x,t=t.y,t=Math.atan2(t,e)-Math.PI;return 0<t&&(t=Math.PI-t),(Math.PI-t)%(2*Math.PI)},m.prototype.toWKT=function(){var t=this.begin,e=t.x,t=t.y,r=this.end,n=r.x,r=r.y;return"LINESTRING (".concat(e," ").concat(t,", ").concat(n," ").concat(r,")")},m.prototype.movePoint=function(t,e){var r=Array.isArray(t),t=r?t:[t],n=r?e:[e],e=this.findFi(new m(1,0,0)),o=this.x(new O(1,1)).distance(this.x(new O(2,2)))/2,i=new O(Math.sin(e),Math.cos(e)),e=i.clone().scale(o),o=t[0].clone().move(e.clone().minus()),e=t[0].clone().move(e),s=[],s=f.like(this.y(o).y,o.y)||f.like(this.y(e).y,e.y)?t.map(function(t,e){return t.clone().move(i.clone().scale(n[e]))}):t.map(function(t,e){return t.clone().move(i.clone().scale(n[e]).setX(function(t){return-t.x}))});return r?s:s[0]},m.prototype.findFi=function(t,e){var r=t.a,t=t.b,n=(void 0===e&&(e=1.0001),this.a),o=this.b,n=(n*r+o*t)/(Math.sqrt(n*n+o*o)*Math.sqrt(r*r+t*t));return 1<n&&n<e?n=1:n<-1&&-e<n&&(n=-1),Math.acos(n)},m.prototype.vectorProduct=function(t){var e=t.a,r=t.b,t=t.c,n=this.a,o=this.b,i=this.c;return new m(o*t-i*r,i*e-n*t,n*r-o*e)},m.prototype.bresenhamsLine=function(){for(var t=this.begin,e=t.x,r=t.y,t=this.end,n=t.x,o=t.y,i=Math.abs(n-e),s=e<n?1:-1,a=-Math.abs(o-r),u=r<o?1:-1,c=i+a,h=new d;h.push(new O(e,r)),e!==n||r!==o;){var l=2*c;if(a<=l){if(e===n)break;c+=a,e+=s}if(l<=i){if(r===o)break;c+=i,r+=u}}return h};var k=m;function m(t,e,r,n,o){void 0===n&&(n=O.zero()),void 0===o&&(o=O.zero()),this.a=t,this.b=e,this.c=r,this.begin=n,this.end=o}var v=function(){return(v=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},K=function(t,e){var r={};for(o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(r[o[n]]=t[o[n]]);return r},U=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},Z=new d,H=new d,J=new d,Q=6378137,W=20037508.34,$=W/180,i=180,g=360,b=Math.PI/i,tt=i/Math.PI,O=(z.zero=function(){return new z},z.parse=function(t,e){void 0===e&&(e=P.parseFormat);var r,o,n=t.lat,i=t.lon,s=t.lng,i=void 0===s?i:s,s=t.alt;return n&&i?new z(i,n,null!=s?s:0):(i=t.x,n=t.y,s=t.z,r=K(t,["x","y","z"]),w(i)&&w(n)?new z(i,n,s).setProperties(r):("Point"===(o=t).type&&(o=t.coordinates),"Feature"===t.type?((i=z.parse(t.geometry,e)).properties=v({},t.properties),i):e.replace(/[^x-z]/gimu,"").split("").reduce(function(t,e,r){var n;switch(e){case"x":t.x=null!=(n=o[r])?n:0;break;case"y":t.y=null!=(n=o[r])?n:0;break;case"z":t.z=o[r]}return t},new z)))},z.parseFromWKT=function(t){t=t.trim().toUpperCase(),t=/POINT \((?<data>(?:(?!\)).)*?)\)$/imu.exec(t),t=U(t.groups.data.split(" ").map(Number),3);return new z(t[0],t[1],t[2])},z.random=function(){return new z(Math.random(),Math.random())},z.getTileFromQuadKey=function(t){for(var e=new z(0,0,t.length),r=e.z;0<r;r--){var n=1<<r-1;switch(t[e.z-r]){case"0":break;case"1":e.x|=n;break;case"2":e.y|=n;break;case"3":e.x|=n,e.y|=n;break;default:throw new Error("Invalid QuadKey digit sequence.")}}return e},z.prototype.toDegreesMinutesSeconds=function(){return{x:V(this.x),y:V(this.y)}},z.prototype.getTileFromCoords=function(t){return void 0===t&&(t=this.z),s("getTileFromCoords").checkArgument("this").shouldBeDegree(this),new z(Math.floor((this.x+i)/g*Math.pow(2,t)),Math.floor((1-Math.log(Math.tan(this.y*b)+1/Math.cos(this.y*b))/Math.PI)/2*Math.pow(2,t)),t)},z.prototype.getQuadKeyFromTile=function(t){for(var e=[],r=t=void 0===t?this.z:t;0<r;r--){var n=0,o=1<<r-1;0!=(this.x&o)&&n++,0!=(this.y&o)&&(n++,n++),e.push(n)}return e.join("")},z.prototype.getCoordsFromTile=function(t){void 0===t&&(t=this.z),s("getCoordsFromTile").checkArgument("this").shouldBeUInt(this);var e=Math.PI-2*Math.PI*this.y/Math.pow(2,t);return new z(this.x/Math.pow(2,t)*g-i,i/Math.PI*Math.atan((Math.exp(e)-Math.exp(-e))/2),t)},z.prototype.toCoords=function(t){var e=this;return(t=void 0===t?P.parseFormat:t).replace(/[^x-z]/gimu,"").split("").map(function(t){return{x:e.x,y:e.y,z:e.z}[t]}).filter(function(t){return void 0!==t})},z.prototype.toGeoJSON=function(t){return{type:"Point",coordinates:this.toCoords(t=void 0===t?P.parseFormat:t)}},z.prototype.toGeoJSONFeature=function(t){return void 0===t&&(t=P.parseFormat),{type:"Feature",properties:v({},this.properties),geometry:this.toGeoJSON(t)}},z.prototype.findLine=function(t){var e,r,n;return s("findLine").checkArgument("this").shouldBeMeters(this).checkArgument("p").shouldBeMeters(t),this.equal(t)?this.findLine(t.clone().move(0,1)):(e=this.y-t.y,r=t.x-this.x,n=this.x*t.y-t.x*this.y,0==e?new k(0,1,n/r,this,t):0==r?new k(1,0,n/e,this,t):new k(e,r,n,this,t))},z.prototype.findInnerAngle=function(t,e){s("findInnerAngle").checkArgument("this").shouldBeMeters(this).checkArgument("p1").shouldBeMeters(t).checkArgument("p3").shouldBeMeters(e);t=this.findLine(t).getFi(),e=this.findLine(e).getFi();return t<=e?e-t:e+2*Math.PI-t},z.prototype.toString=function(){return"".concat(this.x," ").concat(this.y)},z.prototype.getValue=function(){return[this.x,this.y]},z.prototype.height=function(t){return this.z=t,this},z.prototype.toWKT=function(){var t=this.x,e=this.y;return"POINT (".concat(t," ").concat(e,")")},z.prototype.distance=function(t){s("distance").checkArgument("this").shouldBeMeters(this).checkArgument("p").shouldBeMeters(t);var e=t.x-this.x,t=t.y-this.y;return Math.sqrt(e*e+t*t)},z.prototype.distanceLatLon=function(t){s("distance").checkArgument("this").shouldBeDegree(this).checkArgument("p").shouldBeDegree(t);var e=t.clone().move(this.clone().minus()).degreeToRadians(),r=this.clone().degreeToRadians(),t=t.clone().degreeToRadians(),r=Math.pow(Math.sin(e.lat/2),2)+Math.cos(r.lat)*Math.cos(t.lat)*Math.pow(Math.sin(e.lon/2),2),t=2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r));return Q*t},z.prototype.distance3d=function(t){s("distance3d").checkArgument("this").shouldBeMeters(this).checkArgument("p").shouldBeMeters(t).checkArgument("this.z").shouldExist(this.z).checkArgument("p.z").shouldExist(t.z);var e=t.x-this.x,r=t.y-this.y,t=t.z-this.z;return Math.sqrt(e*e+r*r+t*t)},z.prototype.setX=function(t){return this.x="number"==typeof t?t:t(this),this},z.prototype.setZ=function(t){return this.z="number"==typeof t?t:t(this),this},z.prototype.setY=function(t){return this.y="number"==typeof t?t:t(this),this},z.prototype.setProperties=function(t){return this.properties="object"==typeof t?t:t(this),this},z.prototype.clone=function(){var t=new z(this.x,this.y,this.z);return t.properties=v({},this.properties),t},z.prototype.gt=function(t){return this.x>t.x&&this.y>t.y},z.prototype.lt=function(t){return this.x<t.x&&this.y<t.y},z.prototype.gtOrEqual=function(t){return this.gt(t)||this.equal(t)},z.prototype.ltOrEqual=function(t){return this.lt(t)||this.equal(t)},z.prototype.rotate=function(t){var e=this.x*Math.cos(t)-this.y*Math.sin(t),t=this.x*Math.sin(t)+this.y*Math.cos(t);return this.x=e,this.y=t,this},z.prototype.rotate3dX=function(t){var e=this.y,r=this.z;return this.y=e*Math.cos(t)+r*Math.sin(t),this.z=-e*Math.sin(t)+r*Math.cos(t),this},z.prototype.rotate3dY=function(t){var e=this.x,r=this.z;return this.x=e*Math.cos(t)+r*Math.sin(t),this.z=-e*Math.sin(t)+r*Math.cos(t),this},z.prototype.rotate3dZ=function(t){var e=this.x,r=this.y;return this.x=e*Math.cos(t)-r*Math.sin(t),this.y=-e*Math.sin(t)+r*Math.cos(t),this},z.prototype.move=function(t,e,r){void 0===e&&(e=t);var n=0,o=0,i=void 0;return t instanceof z?(n=this.x+t.x,o=this.y+t.y,w(this.z)&&w(t.z)&&(i=this.z+t.z)):(n=this.x+t,o=this.y+e,w(this.z)&&w(r)&&(i=this.z+r)),this.x=n,this.y=o,w(i)&&(this.z=i),this},z.prototype.degreeToMeters=function(){s("degreeToMeters").checkArgument("this").shouldBeDegree(this);var t=((this.x+i)%g-i)*$,e=Math.log(Math.tan((this.y+90)%i*(Math.PI/g)))/b*$;return this.x=t,this.y=e,this},z.prototype.metersToDegree=function(){s("metersToDegree").checkArgument("this").shouldBeMeters(this);var t=8983152842445679e-21*this.x,e=Math.atan(Math.pow(Math.E,this.y/$*b))*(g/Math.PI)-90;return this.x=t,this.y=e,this},z.prototype.degreeToRadians=function(){return s("degreeToRadians").checkArgument("this").shouldBeDegree(this),this.scale(b)},z.prototype.radiansToDegrees=function(){return s("radiansToDegrees").checkArgument("this").shouldBeRadians(this),this.scale(tt)},z.prototype.radiansToMeters=function(){return s("radiansToMeters").checkArgument("this").shouldBeRadians(this),this.radiansToDegrees().degreeToMeters()},z.prototype.metersToRadians=function(){return s("metersToRadians").checkArgument("this").shouldBeMeters(this),this.metersToDegree().degreeToRadians()},z.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},z.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},z.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},z.prototype.toFixed=function(t){return void 0===t&&(t=2),this.x=parseFloat(this.x.toFixed(t)),this.y=parseFloat(this.y.toFixed(t)),this},z.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},z.prototype.scale=function(t,e,r){void 0===e&&(e=t);var n=0,o=0,i=void 0;return t instanceof z?(n=this.x*t.x,o=this.y*t.y,w(this.z)&&w(t.z)&&(i=this.z*t.z)):(n=this.x*t,o=this.y*e,w(this.z)&&w(r)&&(i=this.z*r)),this.x=n,this.y=o,w(i)&&(this.z=i),this},z.prototype.divide=function(t,e,r){void 0===e&&(e=t);var n=0,o=0,i=void 0;return t instanceof z?(n=this.x/t.x,o=this.y/t.y,w(this.z)&&w(t.z)&&(i=this.z/t.z)):(n=this.x/t,o=this.y/e,w(this.z)&&w(r)&&(i=this.z/r)),this.x=n,this.y=o,w(i)&&(this.z=i),this},z.prototype.mod=function(t,e,r){void 0===e&&(e=t);var n=0,o=0,i=void 0;return t instanceof z?(n=this.x%t.x,o=this.y%t.y,w(this.z)&&w(t.z)&&(i=this.z%t.z)):(n=this.x%t,o=this.y%e,w(this.z)&&w(r)&&(i=this.z%r)),this.x=n,this.y=o,w(i)&&(this.z=i),this},z.prototype.div=function(t,e,r){void 0===e&&(e=t);var n=0,o=0,i=void 0;return t instanceof z?(n=a(this.x,t.x),o=a(this.y,t.y),w(this.z)&&w(t.z)&&(i=a(this.z,t.z))):(n=a(this.x,t),o=a(this.y,e),w(this.z)&&w(r)&&(i=a(this.z,r))),this.x=n,this.y=o,w(i)&&(this.z=i),this},z.prototype.equal=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},z.prototype.like=function(t,e){var r,n,o;return void 0===e&&(e=.001),!!this.equal(t)||(r=Math.abs(this.x-t.x)<e,n=Math.abs(this.y-t.y)<e,o=Math.abs((null!=(o=null!=(o=this.z)?o:t.z)?o:0)-(null!=(t=null!=(o=t.z)?o:this.z)?t:0))<e,r&&n&&o)},z.prototype.flipVertically=function(t){var e=t;return t instanceof z&&(e=t.y),this.y=e-this.y,this},Object.defineProperty(z.prototype,"likeRadians",{get:function(){return 0===Z.length&&Z.push(new z(-Math.PI,-Math.PI/2),new z(Math.PI,Math.PI/2)),Z.simpleInclude(this)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"likeWorldGeodeticSystem",{get:function(){return 0===J.length&&J.push(new z(-180,-90),new z(180,90)),!this.likeRadians&&J.simpleInclude(this)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"likePseudoMercator",{get:function(){return 0===H.length&&H.push(new z(-20026376.39,-20048966.1),new z(20026376.39,20048966.1)),!this.likeRadians&&!this.likeWorldGeodeticSystem&&H.simpleInclude(this)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"w",{get:function(){return this.x},set:function(t){this.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"h",{get:function(){return this.y},set:function(t){this.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"area",{get:function(){return s("area").checkArgument("this").shouldBeMeters(this),this.w*this.h},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"hip",{get:function(){return s("hip").checkArgument("this").shouldBeMeters(this),Math.sqrt(this.w*this.w+this.h*this.h)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"min",{get:function(){return Math.min(this.x,this.y)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"max",{get:function(){return Math.max(this.x,this.y)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"hipPoint",{get:function(){var t=this.hip;return new z(t,t)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"xPoint",{get:function(){var t=this.x;return new z(t,t)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"yPoint",{get:function(){var t=this.y;return new z(t,t)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"wPoint",{get:function(){return this.xPoint},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"hPoint",{get:function(){return this.yPoint},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"lat",{get:function(){return this.y},set:function(t){this.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"lng",{get:function(){return this.x},set:function(t){this.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"lon",{get:function(){return this.x},set:function(t){this.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"alt",{get:function(){return this.z},set:function(t){this.z=t},enumerable:!1,configurable:!0}),z.prototype.simple=function(t,e,r){var n;return void 0===e&&(e="y"),void 0===r&&(r="z"),v(((n={})[t=void 0===t?"x":t]=this.x,n[e]=this.y,n),w(this.z)?((t={})[r]=this.z,t):{})},z.prototype.setIfLessThan=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},z.prototype.setIfMoreThan=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},z.prototype.minus=function(){return this.scale(-1)},z.prototype.orthodromicPath=function(t,e){void 0===e&&(e=360),s("orthodromicPath").checkArgument("this").shouldBeDegree(this).checkArgument("point").shouldBeDegree(t);var r=this.clone().degreeToRadians(),n=t.clone().degreeToRadians(),o=Math.sin(n.x-r.x),i=(n.x-r.x)/(e-1);return new d(p(e).map(function(t,e){e=r.x+i*e;return new z(e,Math.atan(Math.tan(r.y)*Math.sin(n.x-e)/o+Math.tan(n.y)*Math.sin(e-r.x)/o)).radiansToDegrees()}))},z.prototype.sortByDistance=function(t){var r=this;return t.clone().map(function(t,e){return t.properties.distance=t.distance(r),t.properties.index=e,t}).sort(function(t,e){return t.properties.distance-e.properties.distance})},z.prototype.calculateAltitudeByDistanceBetweenPoints=function(t,e){var r,n,o,i;return t.alt===e.alt?this.alt=t.alt:(r=Math.min(null!=(r=t.alt)?r:0,null!=(r=e.alt)?r:0),n=Math.max(null!=(n=t.alt)?n:0,null!=(n=e.alt)?n:0)-r,i=(o=this.distance(t))+(e=this.distance(e)),(null!=(t=t.alt)?t:0)===r?this.alt=r+o/i*n:this.alt=r+e/i*n),this},z);function z(t,e,r){void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this.z=r,this.properties={}}A.prototype.toString=function(){return"(".concat(this.center.toString(),", ").concat(this.r,")")},A.prototype.getValue=function(){return{center:this.center,r:this.r}},A.prototype.clone=function(){return new A(this.center,this.r)},A.prototype.findPoints=function(t){var e,r,n,o,i,s,a,u;return this.equal(t)?1/0:(u=(a=this.center).x,a=a.y,n=this.r,r=(s=t.center).x,e=(s=s.y)-a,t=(u=u+(i=(t=((n=n*n)-(o=t.r)*o+(o=this.center.distance(t.center))*o)/(2*o))/o)*(r=r-u))+(n=Math.sqrt(n-t*t)/o)*e,i=(o=a+i*(s-a))-n*r,s=u-n*e,a=o+n*r,u=[],isNaN(t)||isNaN(i)||u.push(new O(t,i)),isNaN(s)||isNaN(a)||t===s&&i===a||u.push(new O(s,a)),u)},A.prototype.equal=function(t){var e=t.center,t=t.r;return this.center.equal(e)&&this.r===t},A.prototype.findPolygonInside=function(t,e,r){void 0===t&&(t=64),void 0===e&&(e=0),void 0===r&&(r=2*Math.PI);for(var n=2*Math.PI/t,o=[],i=e;i<r-n;)o.push(new O(this.r).scale(Math.cos(i),Math.sin(i)).move(this.center)),i+=n;t=this.r*Math.cos(r)+this.center.x,e=this.r*Math.sin(r)+this.center.y;return o.push(new O(t,e)),new d(o)},A.prototype.findPolygonInsideOnSphere=function(t,e,r){void 0===t&&(t=64),void 0===e&&(e=0),void 0===r&&(r=2*Math.PI),s("findPolygonInsideOnSphere").checkArgument("center").shouldBeDegree(this.center);for(var n=2*Math.PI/t,o=[],i=e;i<r-n;)o.push(this.sphereOffset(i)),i+=n;return o.push(this.sphereOffset(r)),new d(o)},A.prototype.sphereOffset=function(t,e){void 0===e&&(e=Q);var r=this.center.clone().degreeToRadians(),n=r.x,r=r.y,e=this.r/e,o=Math.asin(Math.sin(r)*Math.cos(e)+Math.cos(r)*Math.sin(e)*Math.cos(t)),n=n+Math.atan2(Math.sin(t)*Math.sin(e)*Math.cos(r),Math.cos(e)-Math.sin(r)*Math.sin(o));return new O(n,o).radiansToDegrees()};var et=A;function A(t,e){void 0===t&&(t=O.zero()),void 0===e&&(e=0),this.center=t,this.r=e}var rt=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},nt=(ot.prototype.add=function(t){var e,r;try{for(var n=rt(t),o=n.next();!o.done;o=n.next()){var i=o.value,s=i.x,a=i.y,u=i.z;this.searchStore[s]||(this.searchStore[s]={}),this.searchStore[s][a]||(this.searchStore[s][a]={}),this.searchStore[s][a][u||"undefined"]=!0}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},ot.prototype.find=function(t){var e=t.x,r=t.y,t=t.z;return!!this.searchStore[e]&&!!this.searchStore[e][r]&&this.searchStore[e][r][t||"undefined"]},ot);function ot(){this.searchStore={}}function N(t,e,r){return void 0===r&&(r=y.TraceMatrixValues.f),void 0===t[e.y]||void 0===t[e.y][e.x]?r:t[e.y][e.x]}function it(t,e,r){void 0!==t[e.y]&&void 0!==t[e.y][e.x]&&(t[e.y][e.x]=r,t[e.y][e.x])}var st=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},at=function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||((n=n||Array.prototype.slice.call(e,0,o))[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},ut=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},r=(y.TraceMatrixValues=void 0,(n=y.TraceMatrixValues||(y.TraceMatrixValues={}))[n.f=0]="f",n[n.t=1]="t",C.prototype.fullMatrixTrace=function(){var r=this,t=this.findAllGroupsInMatrix(this.m),n=t.map(function(t){return r.traceGroup(r.m,t)}),o=t.map(this.createHoleMatrix),i=o.map(function(t){return t&&r.findAllGroupsInMatrix(t)}),s=i.map(function(t,e){return t&&t.map(function(t){return r.traceGroup(o[e],t)}).filter(function(t){return 3<t.length})});return t.map(function(t,e){var r=n[e];return i[e]&&i[e].length&&(r.holes=s[e]),r.loop().divide(4).round().run()})},C.prototype.reverseMatrix=function(e){return C.createMatrix(this.size,function(t){return N(e,t)===y.TraceMatrixValues.f?y.TraceMatrixValues.t:y.TraceMatrixValues.f})},C.prototype.findMarked=function(t,e){for(var r=this.size,n=!1,o=0;o<r.w;o++)for(var i=0;i<r.h;i++)if(!n&&e)o=e.x,i=e.y,n=!0;else if(N(t,new O(o,i))===y.TraceMatrixValues.t)return new O(o,i);return null},C.prototype.totalCountInMatrix=function(t){for(var e=0,r=this.size,n=0;n<r.w;n++)for(var o=0;o<r.h;o++)N(t,new O(n,o))&&e++;return e},C.createMatrix=function(e,n){return void 0===n&&(n=function(){return y.TraceMatrixValues.f}),p(e.h).map(function(t,r){return p(e.w).map(function(t,e){return n(new O(e,r))})})},C);function C(t,n){var f=this,e=(this.approximation=!0,this.findGroupByIndex=function(t,e){var r=new d;if(e&&N(t,e)===y.TraceMatrixValues.t){r.push(e);var n=0,o=C.createMatrix(f.size,function(){return y.TraceMatrixValues.f});for(it(o,e,y.TraceMatrixValues.t);n<r.length;){for(var i=r.at(n),s=-1;s<2;s++)for(var a=-1;a<2;a++){var u=new O(i.x+s,i.y+a);N(o,u,y.TraceMatrixValues.t)===y.TraceMatrixValues.f&&N(t,u,y.TraceMatrixValues.f)===y.TraceMatrixValues.t&&(r.push(u),it(o,u,y.TraceMatrixValues.t))}n++}}return r},this.findAllGroupsInMatrix=function(t){var e=f.findMarked(t);if(!e)return[];var e=f.findGroupByIndex(t,e),r=[e],n=e.length,o=at([],st(e.points),!1),i=new nt;for(i.add(o);n<f.totalCountInMatrix(t);){for(var s=f.findMarked(t);s&&i.find(s);)s=f.findMarked(t,s);var a=f.findGroupByIndex(t,s);n+=a.length,o=at(at([],st(o),!1),st(a.points),!1),i.add(a.points),r.push(a)}return r.filter(function(t){return 2<t.length})},this.traceGroup=function(t,e){function r(t){return(t+o.length+1)%o.length}var n,o=[new O(-1,-1),new O(-1,0),new O(-1,1),new O(0,1),new O(1,1),new O(1,0),new O(1,-1),new O(0,-1)];if(e.length<2)return n=e.at(0).clone(),new d([n,n,n]);for(var i=new d,s=0,a=1/0,u=e.at(0);!u.equal(e.at(0))||i.length<2;){for(;;){var c=N(t,u.clone().move(o[s])),h=N(t,u.clone().move(o[r(s)]));if(c===y.TraceMatrixValues.t&&h===y.TraceMatrixValues.f)break;s=(s+o.length-1)%o.length}a!==s&&(i.push(u),a=s),u=u.clone().move(o[s]),s=r(r(s))}return(f.approximation?i.approximation():i.clone()).close()},this.createHoleMatrix=function(e){for(var r,t,n=[new O(-1,0),new O(0,1),new O(1,0),new O(0,-1)],o=(e.prepareToFastSearch(),C.createMatrix(f.size,function(t){return e.fastHas(t)?y.TraceMatrixValues.t:y.TraceMatrixValues.f})),i=new d,s=0;s<f.size.w;s++)i.push(new O(s,-1)),i.push(new O(s,f.size.h));for(s=0;s<f.size.h;s++)i.push(new O(-1,s)),i.push(new O(f.size.w,s));for(;i.length;){var a=i.pop();try{r=void 0;for(var u=ut(n),c=u.next();!c.done;c=u.next()){var h=c.value,l=a.clone().move(h);N(o,l,y.TraceMatrixValues.t)===y.TraceMatrixValues.f&&(it(o,l,y.TraceMatrixValues.t),i.push(l))}}catch(t){r={error:t}}finally{try{c&&!c.done&&(t=u.return)&&t.call(u)}finally{if(r)throw r.error}}}var p=f.reverseMatrix(o);return f.totalCountInMatrix(p)?p:null},this.size=t.clone().scale(4),C.createMatrix(this.size,function(t){var e=t.clone().mod(4),r=e.x,e=e.y;return[1,2].includes(r)&&[1,2].includes(e)?n(t.clone().div(4)):y.TraceMatrixValues.f}));this.m=C.createMatrix(this.size);for(var r=1;r<this.size.y-1;r++)for(var o=1;o<this.size.x-1;o++)e[r][o]===y.TraceMatrixValues.t&&(this.m[r-1][o-1]=y.TraceMatrixValues.t,this.m[r-1][o]=y.TraceMatrixValues.t,this.m[r-1][o+1]=y.TraceMatrixValues.t,this.m[r][o-1]=y.TraceMatrixValues.t,this.m[r][o]=y.TraceMatrixValues.t,this.m[r][o+1]=y.TraceMatrixValues.t,this.m[r+1][o-1]=y.TraceMatrixValues.t,this.m[r+1][o]=y.TraceMatrixValues.t,this.m[r+1][o+1]=y.TraceMatrixValues.t)}var ct=function(){return(ct=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},ht=function(t,e){var r={};for(o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(r[o[n]]=t[o[n]]);return r},lt=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},W=(B.prototype.setKnownPoints=function(t){var e=this;return this.points=t instanceof d?t.points:t,this.minPoint.setProperties(this.points.reduce(function(n,o){return e.keys.reduce(function(t,e){var r;return t[e]=Math.min(null!=(r=n[e])?r:1/0,o.properties[e]),t},n)},{})),this.maxPoint.setProperties(this.points.reduce(function(n,o){return e.keys.reduce(function(t,e){var r;return t[e]=Math.max(null!=(r=n[e])?r:-1/0,o.properties[e]),t},n)},{})),this},B.prototype.positionToCellCoords=function(t){return t.clone().move(this.minPoint.clone().minus()).divide(this.stepSize).floor()},B.prototype.calculate=function(){return this.setKnownValues(),this.interpolateValues(),this},B.prototype.getCellValue=function(t,e){var r=t.x,t=t.y,n=this.cells[r][t];return e?Array.isArray(e)?e.reduce(function(t,e){return t[e]=n.properties[e],t},{}):n.properties[e]:ct({},n.properties)},Object.defineProperty(B.prototype,"getCellData",{get:function(){return this.allCells.reduce(function(t,e){var e=e.properties,r=e.x,n=e.y,e=ht(e,["x","y"]);return t[r]=t[r]||{},t[r][n]=ct({},e),t},{})},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"allCellsClone",{get:function(){return this.allCells.map(function(t){return t.clone()})},enumerable:!1,configurable:!0}),B.prototype.interpolateValues=function(){var i=this,t=this.points.map(function(t){return i.positionToCellCoords(t)});this.allCells.forEach(function(r){var e=new O(r.properties.x,r.properties.y),o=t.map(function(t){return Math.pow(e.distance(t),i.p)});i.keys.forEach(function(n){var t,e;w(r.properties[n])||(t=(e=lt(o.reduce(function(t,e,r){return w(i.points[r].properties[n])&&(t[0]+=i.points[r].properties[n]/e,t[1]+=1/e),t},[0,0]),2))[0],e=e[1],r.properties[n]=t/e)})})},B.prototype.setKnownValues=function(){var o=this;this.points.forEach(function(e){var t=o.positionToCellCoords(e),r=t.x,n=t.y;o.keys.forEach(function(t){o.cells[r][n].properties[t]=e.properties[t]})})},B.prototype.generateCells=function(){for(var t=this.minPoint.x,e=0;t<this.maxPoint.x;t+=this.stepSize,e++){this.cells[e]=this.cells[e]||{};for(var r=this.minPoint.y,n=0;r<this.maxPoint.y;r+=this.stepSize,n++){var o=this.sizePoly.clone().loop().move(t,r).run().setProperties({x:e,y:n});this.cells[e][n]=o,this.allCells.push(o)}}},B);function B(t,e,r,n){void 0===n&&(n=2),this.stepSize=e,this.p=n,this.points=[],this.cells={},this.allCells=[],this.minPoint=t.minPoint,this.maxPoint=t.maxPoint,this.sizePoly=d.createSquareBySize(new O(this.stepSize)),this.size=this.maxPoint.clone().move(this.minPoint.clone().minus()).divide(this.stepSize).ceil(),this.keys=Array.isArray(r)?r:[r],this.generateCells()}var pt=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},n=(D.find=function(t,e,r){var n;return t.x===e.x&&e.x===r.x?new D(1,0,0,-t.x,t,e,r):t.y===e.y&&e.y===r.y?new D(0,1,0,-t.y,t,e,r):t.z===e.z&&e.z===r.z?new D(0,0,1,-t.z,t,e,r):new D((n=pt(u([[t.x,t.y,t.z,-1],[e.x,e.y,e.z,-1],[r.x,r.y,r.z,-1]]),3))[0],n[1],n[2],1,t,e,r)},D.prototype.x=function(t){var e,r,n,o,i,s,a=this;return t instanceof O?(e=this.a,r=this.b,n=this.c,o=this.d,i=t.y,s=t.z,t.x=-(r*i+n*s+o)/e,t):t.map(function(t){return a.x(t)})},D.prototype.y=function(t){var e,r,n,o,i,s,a=this;return t instanceof O?(e=this.a,r=this.b,n=this.c,o=this.d,i=t.x,s=t.z,t.y=-(e*i+n*s+o)/r,t):t.map(function(t){return a.y(t)})},D.prototype.z=function(t){var e,r,n,o,i,s,a=this;return t instanceof O?(e=this.a,r=this.b,n=this.c,o=this.d,i=t.x,s=t.y,t.z=-(e*i+r*s+o)/n,t):t.map(function(t){return a.z(t)})},D.prototype.clone=function(){var t=this;return new D(t.a,t.b,t.c,t.d,t.p1,t.p2,t.p3)},D.prototype.distance=function(t){var e,r,n,o,i,s,a;return t instanceof O?(n=t.x,o=t.y,i=t.z,a=this.a,e=this.b,r=this.c,s=this.d,Math.abs(a*n+e*o+r*i+s)/Math.sqrt(a*a+e*e+r*r)):(n=t.a,o=t.b,i=t.c,s=t.d,a=this.d,Math.abs(s-a)/Math.sqrt(n*n+o*o+i*i))},D.prototype.equal=function(t){var e=t.a,r=t.b,n=t.c,t=t.d,o=this.a,i=this.b,s=this.c,a=this.d;return f.like(e,o)&&f.like(r,i)&&f.like(n,s)&&f.like(t,a)},D.prototype.same=function(t){var e=t.a,r=t.b,n=t.c,t=t.d,o=this.a,i=this.b,e=e/o,o=n/this.c,t=t/this.d;return f.like(e,r/i)&&f.like(e,o)&&f.like(e,n)&&f.like(e,t)},D.prototype.parallel=function(t){var e=t.a,r=t.b,n=t.c,t=t.d,o=this.a,i=this.b,e=e/o,o=n/this.c,t=t/this.d;return f.like(e,r/i)&&f.like(e,o)&&f.like(e,n)&&!f.like(e,t)},D);function D(t,e,r,n,o,i,s){void 0===o&&(o=O.zero()),void 0===i&&(i=O.zero()),void 0===s&&(s=O.zero()),this.a=t,this.b=e,this.c=r,this.d=n,this.p1=o,this.p2=i,this.p3=s}y.DCircle=et,y.DEGREE_TO_PI=tt,y.DGeo=P,y.DLine=k,y.DNumbers=f,y.DOUBLE_PI_IN_DEGREE=g,y.DPlane=n,y.DPoint=O,y.DPolygon=d,y.DPolygonLoop=X,y.EARTH_RADIUS_IN_METERS=Q,y.FastSearch=nt,y.HALF_PI_IN_DEGREE=90,y.InterpolationMatrix=W,y.MIN_POINTS_IN_VALID_POLYGON=3,y.PI_IN_DEGREE=i,y.PI_TO_DEGREE=b,y.TraceMatrix=r,y.cartesianProduct=G,y.createArray=p,y.createCanvas=R,y.createMatrix=L,y.gaussianElimination=u,y.getCombinations=E,y.isDefAndNotNull=w,y.parseDegreesMinutesSeconds=function(t){var e,r,n,o,i,s,a,u,c,t=t.matchAll(/(?<value>-?\d+(?<tail>\.\d{1,})?)(?<type>°|'|")/gimu),h=0,l=0,p=0;try{for(var f=Y(t),y=f.next();!y.done;y=f.next()){var d=y.value;switch(null==(n=null==d?void 0:d.groups)?void 0:n.type){case"°":h=Number(null!=(i=null==(o=null==d?void 0:d.groups)?void 0:o.value)?i:"0");break;case"'":l=Number(null!=(a=null==(s=null==d?void 0:d.groups)?void 0:s.value)?a:"0");break;case'"':p=Number(null!=(c=null==(u=null==d?void 0:d.groups)?void 0:u.value)?c:"0")}}}catch(t){e={error:t}}finally{try{y&&!y.done&&(r=f.return)&&r.call(f)}finally{if(e)throw e.error}}t=h<0?-1:1;return h+t*l/60+t*p/3600},Object.defineProperty(y,"__esModule",{value:!0})});
|