dgeoutils 2.3.4 → 2.3.7
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/DLine.js +7 -5
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/utils.d.ts +4 -0
- package/dist/cjs/utils.js +24 -1
- package/dist/es2015/DLine.js +7 -5
- package/dist/es2015/index.js +1 -1
- package/dist/es2015/utils.js +15 -0
- package/dist/esm/DLine.js +7 -5
- package/dist/esm/index.js +1 -1
- package/dist/esm/utils.js +21 -0
- package/dist/umd/dgeoutils.js +31 -6
- 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(d,c){"use strict";function x(t){return function(){return t}}function l(b){return{checkArgument:function(t){return P.DEBUG?{shouldBeDegree:function(t){return t.likeWorldGeodeticSystem||w('"'+v+'" -> "'+m+'" should be degree!'),g},shouldBeMeters:function(t){return t.likePseudoMercator||w('"'+d+'" -> "'+y+'" should be meters!'),p},shouldBeInt:function(t){return t.clone().round().equal(t)||w('"'+l+'" -> "'+f+'" should be Int!'),c},shouldBeUInt:function(t){return t.clone().round().equal(t)&&t.gtOrEqual(M.zero())||w('"'+u+'" -> "'+h+'" should be UInt!'),a},shouldBeRadians:function(t){return t.likeRadians||w('"'+o+'" -> "'+s+'" should be radians!'),i},shouldExist:(e=i=a=c=p=g=this,r=o=u=l=d=v=b,n=s=h=f=y=m=t,function(t){return T(t)||w('"'+r+'" -> "'+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,i,o,s,a,u,h,c,l,f,p,d,y,g,v,m}}}function f(t,e){var r=t.h,n=t.w;return void 0===e&&(e=0),g(r).map(function(){return g(n,e)})}function p(t){for(var e=t.length,r=f(new M(e+1,e)),n=0;n<e;n++)for(var i=0;i<e+1;i++)t[n][i]=0===t[n][i]?p.MIN:t[n][i],r[n][i]=t[n][i];for(var o=0;o<e;o++){for(n=0;n<e+1;n++)r[o][n]/=t[o][o];for(n=o+1;n<e;n++)for(var s=r[n][o]/r[o][o],i=0;i<e+1;i++)r[n][i]-=r[o][i]*s;for(n=0;n<e;n++)for(i=0;i<e+1;i++)t[n][i]=r[n][i]}for(o=e-1;-1<o;o--){for(n=e;-1<n;n--)r[o][n]/=t[o][o];for(n=o-1;-1<n;n--)for(s=r[n][o]/r[o][o],i=e;-1<i;i--)r[n][i]-=r[o][i]*s}for(var a=g(e),n=0;n<e;n++)a[n]=r[n][e];return a}function y(t,e,r){var n=0,i=0,o=!1,e=(i=t instanceof M?(n=t.x,t.y):n=t,"boolean"==typeof e?o=e:"number"==typeof e&&(i=e),(o="boolean"==typeof r?r:o)?new OffscreenCanvas(n,i):(null!==(t=y.document)&&void 0!==t?t:document).createElement("canvas"));return o||(e.width=n,e.height=i),[e,e.getContext("2d")]}var r=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},n=function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||((n=n||Array.prototype.slice.call(e,0,i))[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},P={DEBUG:!1},w=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];P.DEBUG&&console.warn.apply(console,n([],r(t),!1))},T=function(t){return null!=t},g=function(t,e){return void 0===e&&(e=0),new Array(t).fill(e)},h=(p.MIN=1e-10,i.like=function(t,e,r){return void 0===r&&(r=.001),Math.abs(t-e)<r},i.likeZero=function(t){return i.like(t,0)},i.like2PI=function(t){return i.like(i.rad2Deg(t),Y)},i.likePI=function(t){return i.like(i.rad2Deg(t),F)},i.rad2Deg=function(t){return t*q},i.deg2Rad=function(t){return t*E},i);function i(){}s.prototype.clone=function(){return new s(this.a,this.b,this.c,this.begin.clone(),this.end.clone())},s.prototype.findPerpendicular=function(t){return l("findPerpendicular").checkArgument("this.begin").shouldBeMeters(this.begin).checkArgument("this.end").shouldBeMeters(this.end).checkArgument("p").shouldBeMeters(t),new s(-this.b,this.a,this.b*t.x-this.a*t.y)},s.prototype.perpendicularDistance=function(t){return l("perpendicularDistance").checkArgument("this.begin").shouldBeMeters(this.begin).checkArgument("this.end").shouldBeMeters(this.end).checkArgument("p").shouldBeMeters(t),this.findPerpendicular(t).findPoint(this).distance(t)},s.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},s.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 i,o=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)]}if(this.begin.like(e))return i=this.begin.clone(),[this.movePoint(i,t),this.movePoint(i,-t)];if(this.end.like(e))return i=this.end.clone(),[this.movePoint(i,t),this.movePoint(i,-t)];u=o*o+s*s,e=Math.sqrt((t*t-a*a/u)/u);return[r.clone().move(s*e,-o*e),r.clone().move(-s*e,o*e)]}return n===t?r:null},s.prototype.inRange=function(t,e){var r=this.minX,n=this.minY,i=this.maxX,o=this.maxY,s=t.x,t=t.y;return r-(e=void 0===e?0:e)<=s&&s<=i+e&&(n-e<=t&&t<=o+e)},s.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(s.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(s.prototype,"minX",{get:function(){return Math.min(this.begin.x,this.end.x)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"minY",{get:function(){return Math.min(this.begin.y,this.end.y)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"maxX",{get:function(){return Math.max(this.begin.x,this.end.x)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"maxY",{get:function(){return Math.max(this.begin.y,this.end.y)},enumerable:!1,configurable:!0}),s.prototype.toString=function(){return"("+this.a+", "+this.b+", "+this.c+")"},s.prototype.getValue=function(){return[this.a,this.b,this.c]},s.prototype.x=function(t){return this.isParallelY?new M(-this.c/this.a,t.y):this.isParallelX?new M(t.x,-this.c/this.b):new M(-this.b/this.a*t.y-this.c/this.a,t.y)},s.prototype.y=function(t){return this.isParallelY?new M(-this.c/this.a,t.y):this.isParallelX?new M(t.x,-this.c/this.b):new M(t.x,-this.a/this.b*t.x-this.c/this.b)},s.prototype.findPoint=function(t){if(this.isParallelY&&t.isParallelY)return null;if(this.isParallelX&&t.isParallelX)return null;if(this.isParallelX&&t.isParallelY)return new M(-t.c/t.a,-this.c/this.b);if(this.isParallelY&&t.isParallelX)return new M(-this.c/this.a,-t.c/t.b);var e;if(this.isParallelY)return r=-this.c/this.a,t.y(new M(r));if(this.isParallelX)return e=-this.c/this.b,t.x(new M(0,e));if(t.isParallelY)return r=-t.c/t.a,this.y(new M(r));if(t.isParallelX)return e=-t.c/t.b,this.x(new M(0,e));var r=this.y(new M((t.c/t.b-this.c/this.b)/(this.a/this.b-t.a/t.b)));return isFinite(r.x)||isFinite(r.y)?r:null},Object.defineProperty(s.prototype,"isParallel",{get:function(){return this.isParallelX||this.isParallelY},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isParallelY",{get:function(){return Math.abs(this.b)<.001},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isParallelX",{get:function(){return Math.abs(this.a)<.001},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"points",{get:function(){return[this.begin,this.end]},enumerable:!1,configurable:!0}),s.prototype.getFi=function(){l("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)},s.prototype.toWKT=function(){var t=this.begin,e=t.x,t=t.y,r=this.end;return"LINESTRING ("+e+" "+t+", "+r.x+" "+r.y+")"},s.prototype.movePoint=function(t,e){var t=Array.isArray(t)?t:[t],r=Array.isArray(e)?e:[e],e=this.findFi(new s(1,0,0)),n=this.x(new M(1,1)).distance(this.x(new M(2,2)))/2,i=new M(Math.sin(e),Math.cos(e)),e=i.clone().scale(n),n=t[0].clone().move(e.clone().minus()),e=t[0].clone().move(e),o=[];return 1===(o=h.like(this.y(n).y,n.y)||h.like(this.y(e).y,e.y)?t.map(function(t,e){return t.clone().move(i.scale(r[e]))}):t.map(function(t,e){return t.clone().move(i.scale(r[e]).setX(function(t){return-t.x}))})).length?o[0]:o},s.prototype.findFi=function(t,e){var r=t.a,t=t.b,n=(void 0===e&&(e=1.0001),this.a),i=this.b,n=(n*r+i*t)/(Math.sqrt(n*n+i*i)*Math.sqrt(r*r+t*t));return 1<n&&n<e?n=1:n<-1&&-e<n&&(n=-1),Math.acos(n)},s.prototype.vectorProduct=function(t){var e=t.a,r=t.b,t=t.c,n=this.a,i=this.b,o=this.c;return new s(i*t-o*r,o*e-n*t,n*r-i*e)};var u,k=s;function s(t,e,r,n,i){void 0===n&&(n=M.zero()),void 0===i&&(i=M.zero()),this.a=t,this.b=e,this.c=r,this.begin=n,this.end=i}(e=u=u||{})[e.getTileFromCoords=0]="getTileFromCoords",e[e.getCoordsFromTile=1]="getCoordsFromTile",e[e.height=2]="height",e[e.setX=3]="setX",e[e.setY=4]="setY",e[e.setZ=5]="setZ",e[e.rotate=6]="rotate",e[e.rotate3dX=7]="rotate3dX",e[e.rotate3dY=8]="rotate3dY",e[e.rotate3dZ=9]="rotate3dZ",e[e.move=10]="move",e[e.round=11]="round",e[e.ceil=12]="ceil",e[e.floor=13]="floor",e[e.toFixed=14]="toFixed",e[e.abs=15]="abs",e[e.scale=16]="scale",e[e.divide=17]="divide",e[e.degreeToRadians=18]="degreeToRadians",e[e.radiansToDegrees=19]="radiansToDegrees",e[e.radiansToMeters=20]="radiansToMeters",e[e.metersToRadians=21]="metersToRadians",e[e.hipPoint=22]="hipPoint",e[e.xPoint=23]="xPoint",e[e.yPoint=24]="yPoint",e[e.wPoint=25]="wPoint",e[e.hPoint=26]="hPoint",e[e.setIfLessThan=27]="setIfLessThan",e[e.minus=28]="minus",e[e.degreeToMeters=29]="degreeToMeters",e[e.metersToDegree=30]="metersToDegree",e[e.flipVertically=31]="flipVertically";function o(e,t){var r=t.functionName,n=t.pointArg,i=t.numberPointArg,o=t.numberArg,s=t.setterArg,a=e;switch(r){case u.getTileFromCoords:a=function(t){return e(t).getTileFromCoords(o)};break;case u.getCoordsFromTile:a=function(t){return e(t).getCoordsFromTile(o)};break;case u.height:a=function(t){return e(t).height(o)};break;case u.setX:a=function(t){return e(t).setX(s)};break;case u.setY:a=function(t){return e(t).setY(s)};break;case u.setZ:a=function(t){return e(t).setZ(s)};break;case u.rotate:a=function(t){return e(t).rotate(o)};break;case u.rotate3dX:a=function(t){return e(t).rotate3dX(o)};break;case u.rotate3dY:a=function(t){return e(t).rotate3dY(o)};break;case u.rotate3dZ:a=function(t){return e(t).rotate3dZ(o)};break;case u.move:a=function(t){return e(t).move(i,o)};break;case u.round:a=function(t){return e(t).round()};break;case u.ceil:a=function(t){return e(t).ceil()};break;case u.floor:a=function(t){return e(t).floor()};break;case u.toFixed:a=function(t){return e(t).toFixed(o)};break;case u.abs:a=function(t){return e(t).abs()};break;case u.scale:a=function(t){return e(t).scale(i,o)};break;case u.divide:a=function(t){return e(t).divide(i,o)};break;case u.degreeToRadians:a=function(t){return e(t).degreeToRadians()};break;case u.radiansToDegrees:a=function(t){return e(t).radiansToDegrees()};break;case u.radiansToMeters:a=function(t){return e(t).radiansToMeters()};break;case u.metersToRadians:a=function(t){return e(t).metersToRadians()};break;case u.hipPoint:a=function(t){return e(t).hipPoint};break;case u.xPoint:a=function(t){return e(t).xPoint};break;case u.yPoint:a=function(t){return e(t).yPoint};break;case u.wPoint:a=function(t){return e(t).wPoint};break;case u.hPoint:a=function(t){return e(t).hPoint};break;case u.setIfLessThan:a=function(t){return e(t).setIfLessThan(n)};break;case u.minus:a=function(t){return e(t).minus()};break;case u.degreeToMeters:a=function(t){return e(t).degreeToMeters()};break;case u.metersToDegree:a=function(t){return e(t).metersToDegree()};break;case u.flipVertically:a=function(t){return e(t).flipVertically(i)}}return a}t.prototype.getLoopFunction=function(){return this.pool.reduce(o,function(t){return t})},t.prototype.run=function(){return this.parent.map(this.getLoopFunction())},t.prototype.getTileFromCoords=function(t){return this.pool.push({functionName:u.getTileFromCoords,numberArg:t}),this},t.prototype.getCoordsFromTile=function(t){return this.pool.push({functionName:u.getCoordsFromTile,numberArg:t}),this},t.prototype.height=function(t){return this.pool.push({functionName:u.height,numberArg:t}),this},t.prototype.setX=function(t){return this.pool.push({functionName:u.setX,setterArg:t}),this},t.prototype.setY=function(t){return this.pool.push({functionName:u.setY,setterArg:t}),this},t.prototype.setZ=function(t){return this.pool.push({functionName:u.setZ,setterArg:t}),this},t.prototype.rotate=function(t){return this.pool.push({functionName:u.rotate,numberArg:t}),this},t.prototype.rotate3dX=function(t){return this.pool.push({functionName:u.rotate3dX,numberArg:t}),this},t.prototype.rotate3dY=function(t){return this.pool.push({functionName:u.rotate3dY,numberArg:t}),this},t.prototype.rotate3dZ=function(t){return this.pool.push({functionName:u.rotate3dZ,numberArg:t}),this},t.prototype.move=function(t,e){return this.pool.push({functionName:u.move,numberPointArg:t,numberArg:e=void 0===e?t:e}),this},t.prototype.round=function(){return this.pool.push({functionName:u.round}),this},t.prototype.ceil=function(){return this.pool.push({functionName:u.ceil}),this},t.prototype.floor=function(){return this.pool.push({functionName:u.floor}),this},t.prototype.toFixed=function(t){return this.pool.push({functionName:u.toFixed,numberArg:t=void 0===t?2:t}),this},t.prototype.abs=function(){return this.pool.push({functionName:u.abs}),this},t.prototype.scale=function(t,e){return this.pool.push({functionName:u.scale,numberPointArg:t,numberArg:e=void 0===e?t:e}),this},t.prototype.divide=function(t,e){return this.pool.push({functionName:u.divide,numberPointArg:t,numberArg:e}),this},t.prototype.degreeToRadians=function(){return this.pool.push({functionName:u.degreeToRadians}),this},t.prototype.radiansToDegrees=function(){return this.pool.push({functionName:u.radiansToDegrees}),this},t.prototype.radiansToMeters=function(){return this.pool.push({functionName:u.radiansToMeters}),this},t.prototype.metersToRadians=function(){return this.pool.push({functionName:u.metersToRadians}),this},t.prototype.getHipPoint=function(){return this.pool.push({functionName:u.hipPoint}),this},t.prototype.getXPoint=function(){return this.pool.push({functionName:u.xPoint}),this},t.prototype.getYPoint=function(){return this.pool.push({functionName:u.yPoint}),this},t.prototype.getWPoint=function(){return this.pool.push({functionName:u.wPoint}),this},t.prototype.getHPoint=function(){return this.pool.push({functionName:u.hPoint}),this},t.prototype.setIfLessThan=function(t){return this.pool.push({functionName:u.setIfLessThan,pointArg:t}),this},t.prototype.minus=function(){return this.pool.push({functionName:u.minus}),this},t.prototype.degreeToMeters=function(){return this.pool.push({functionName:u.degreeToMeters}),this},t.prototype.metersToDegree=function(){return this.pool.push({functionName:u.metersToDegree}),this},t.prototype.flipVertically=function(t){return this.pool.push({functionName:u.flipVertically,numberPointArg:t}),this};var v=t;function t(t){this.parent=t,this.pool=[]}var m=function(n,i){var o,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(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=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];break}if(6===e[0]&&u.label<a[1]){u.label=a[1],a=e;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(e);break}a[2]&&u.ops.pop(),u.trys.pop();continue}e=i.call(n,u)}catch(t){e=[6,t],s=0}finally{o=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}}},S=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.")},z=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},I=function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||((n=n||Array.prototype.slice.call(e,0,i))[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},e=c.operation.buffer.BufferParameters,b=e.CAP_ROUND,A=e.CAP_FLAT,e=e.CAP_SQUARE,O=(N.arrayOfTrianglesToVertices=function(t,e){return t.map(function(t){return(T(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 M(e.distance(r),e.distance(t))},N.toDash=function(t){var e,r,n=new N,i=[n],o=!0;try{for(var s=S(t.points),a=s.next();!a.done;a=s.next()){var u=a.value;o&&n.push(u.clone()),u.properties.pieceBorder&&(o=!o)&&(n=new N,i.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 i},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(),i=new N;return 0===t.indexOf("POLYGON")&&(n=/POLYGON \(\((?<data>(?:(?!\)\)$).)*?)\)\)$/imu.exec(t),e=(r=z(n.groups.data.split("), (").map(function(t){return new N(t.split(", ").map(function(t){return M.parse(t.split(" ").map(Number))}))})))[0],(r=r.slice(1))&&r.length&&(e.holes=r),i=e),0===t.indexOf("LINESTRING")&&(i=new N((n=/LINESTRING \((?<data>(?:(?!\)$).)*?)\)$/imu.exec(t)).groups.data.split(", ").map(function(t){return M.parse(t.split(" ").map(Number))}))),i=0===t.indexOf("POINT")?new N([M.parseFromWKT(t)]):i},N.createSquareBySize=function(t){return new N([M.zero(),t.clone().setX(0),t.clone(),t.clone().setY(0)]).close()},N.prototype.loop=function(){return new v(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,"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 M(t,e),new M(r,e),new M(r,n),new M(t,n),new M(t,e)])},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"size",{get:function(){var t=this.w,e=this.h;return new M(t,e)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"leftTop",{get:function(){var t=this.minX,e=this.minY;return new M(t,e)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"rightBottom",{get:function(){var t=this.maxX,e=this.maxY;return new M(t,e)},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=S(this.loopPointsGenerator()()),i=n.next();!i.done;i=n.next()){var o=z(i.value,2),s=o[0],a=o[1];r+=s.distance(a)}}catch(t){e={error:t}}finally{try{i&&!i.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=S(this.deintersection.loopPointsGenerator()()),i=n.next();!i.done;i=n.next()){var o=z(i.value,2),s=o[0],a=s.x,u=s.y,h=o[1],c=h.x;r+=a*h.y-u*c}}catch(t){e={error:t}}finally{try{i&&!i.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,"deintersection",{get:function(){for(var e,t,i=this.clone().close(),r={},o=0;o<i.length-1;o++)for(var n=i.at(o).toString(),s=(r[n]=r[n]||[],r[n].push(o),o+2);s<i.length-1;s++)!function(t){var e=i.at(o).findLine(i.at(o+1)),r=i.at(t).findLine(i.at(t+1)),n=e.intersection(r);n&&!I(I([],z(e.points),!1),z(r.points),!1).some(function(t){return t.like(n)})&&(e=i.removePart(o,t-o).reverse(),i.insertAfter.apply(i,I([o],z(e),!1)),i.insertAfter(t,n),i.insertAfter(o,n))}(s);try{for(var a=S(Object.keys(r)),u=a.next();!u.done;u=a.next()){var h=r[u.value];if(1<h.length)for(var c=function(t){var r=i.clone(),e=h[t]-h[t-1];1<e&&((e=new N(r.removePart(h[t-1],e))).reduce(function(t,e){return t&&function(t,e){var r,c;if(t.points.some(function(t){return t.equal(e)}))return!0;try{for(var n=S(t.loopPointsGenerator(!0)()),i=n.next();!i.done;i=n.next()){var l=z(i.value,3)[2];if(l.x(e).equal(e)&&l.inRange(e))return!0}}catch(t){h={error:t}}finally{try{i&&!i.done&&(u=n.return)&&u.call(n)}finally{if(h)throw h.error}}var o=0;try{for(var s=S(t.loopPointsGenerator()()),a=s.next();!a.done;a=s.next()){var f=z(a.value,2),p=f[0],d=p.x,y=p.y,g=f[1],v=g.x,m=g.y,b=new k(d-e.x,y-e.y,0),x=new k(v-e.x,m-e.y,0),P=b.findFi(x);0<b.vectorProduct(x).c?o+=P:o-=P}}catch(t){r={error:t}}finally{try{a&&!a.done&&(c=s.return)&&c.call(s)}finally{if(r)throw r.error}}var u=Math.PI/1e4,h=!1,t=Math.abs(o);if(t<u)h=!1;else{if(!(Math.abs(2*Math.PI-t)<u))throw new Error("contains2 faild");h=!0}return h}(r,e)},!0)&&r.isClockwise===e.isClockwise&&(r.insertAfter.apply(r,I([h[t-1]-1],z(e.reverse().points),!1)),i=r))},s=h.length-1;0<s;s--)c(s)}}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,"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 c,l,e,f,t=this.convex,p=new N,d=1/0;try{for(var r=S(t.loopPointsGenerator(!0)()),n=r.next();!n.done;n=r.next()){var y,g,v,m,i=z(n.value,3)[2],b=0,o=null,s=null,x=0,a=null;try{e=void 0;for(var u=S(t.loopPointsGenerator()()),h=u.next();!h.done;h=u.next()){var P=z(h.value,4),M=P[0],w=P[3],T=i.findPoint(i.findPerpendicular(M)),k=T.distance(M);x<=k&&(x=k,a=M);for(var I=w;I<t.length-1;I++){var A=i.findPoint(i.findPerpendicular(t.at(I))),O=T.distance(A);b<=O&&(b=O,o=T,s=A)}}}catch(t){e={error:t}}finally{try{h&&!h.done&&(f=u.return)&&f.call(u)}finally{if(e)throw e.error}}o&&s&&a&&(g=(y=o.findLine(s)).findPerpendicular(o),(m=new N([o,s,(v=y.findPerpendicular(s)).findPoint(v.findPerpendicular(a)),g.findPoint(g.findPerpendicular(a))]).close()).area<d&&(d=(p=m).area))}}catch(t){c={error:t}}finally{try{n&&!n.done&&(l=r.return)&&l.call(r)}finally{if(c)throw c.error}}return p},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,i=t.second}while(((u=n.findInnerAngle(r,i))>Math.PI||h.likeZero(h.rad2Deg(u))||h.likePI(u)||h.like2PI(u))&&(t.removePart(-1,1),t.length));t.close();var o=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),i=t.at(a+1);((u=n.findInnerAngle(r,i))>Math.PI||h.likeZero(h.rad2Deg(u))||h.likePI(u)||h.like2PI(u))&&t.removePart(--a,1)}}while(o++,t.length!==s&&o<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=S(this.clone().close().loopPointsGenerator()()),i=n.next();!i.done;i=n.next()){var o=z(i.value,2),s=o[0],a=s.x,u=s.y,h=o[1];r+=(h.x-a)*(h.y+u)}}catch(t){e={error:t}}finally{try{i&&!i.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,i=[];try{for(var o=S(this.loopPointsGenerator(!0)()),s=o.next();!s.done;s=o.next()){var a=z(s.value,3)[2].intersection(t,0,e);a&&i.push(a)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},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=", "+this.holes.map(function(t){return t.toString()}).join(", ")),"POLYGON (("+this.deintersection.mapArray(function(t){return t.x+" "+t.y+(e?" "+t.z:"")}).join(", ")+")"+t+")"):"LINESTRING ("+this.mapArray(function(t){return t.x+" "+t.y+(e?" "+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,I([],z(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,I([],z(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"("+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(I(I([],z(this.points),!1),z(t.points),!1)).close();return e.holes=I(I([],z(this.holes),!1),z(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=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 M?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,I([t+1,0],z(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,i,o){return void 0===i&&(i=1),void 0===o&&(o=this.length-1),1<this.length&&(t=t.getContext("2d"),e&&(t.fillStyle=e),r&&(t.strokeStyle=r),i&&(t.lineWidth=i),(e||r)&&t.beginPath(),this.goByPath(t,o%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 i=S(e.loopPointsGenerator()()),o=i.next();!o.done;o=i.next()){var s=z(o.value,2),a=s[0],c=a.x,l=a.y,u=s[1],f=u.x,p=u.y,d=new k(c-t.x,l-t.y,0),y=new k(f-t.x,p-t.y,0),g=d.findFi(y);0<d.vectorProduct(y).c?n+=g:n-=g}}catch(t){r={error:t}}finally{try{o&&!o.done&&(h=i.return)&&h.call(i)}finally{if(r)throw r.error}}var e=Math.PI/1e4,h=Math.abs(n);if(h<e)return!1;if(Math.abs(2*Math.PI-h)<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 i=S(n.loopPointsGenerator(!0)()),o=i.next();!o.done;o=i.next()){var s=z(o.value,3)[2];if(s.x(e).equal(e)&&s.inRange(e))return!0}}catch(t){r={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}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.parse=function(t){return new N(t.map(function(t){return M.parse(t)}))},N.prototype.toArrayOfCoords=function(){return this.mapArray(function(t){return t.toCoords()})},N.prototype.divideToPieces=function(t){var e,r,s=this.fullLength/t,a=s,u=this;try{for(var n=S(this.loopPointsGenerator()()),i=n.next();!i.done;i=n.next()){var o=z(i.value,4);!function(t,e,r){var n,i,o=t.distance(e);o===a?(e.properties.pieceBorder=!0,a=s):0<o-a?(n=new X(t,a),(t=(i=t.findLine(e)).intersectionWithCircle(n).filter(function(t){return i.inRange(t,.001)})[0]).properties.pieceBorder=!0,u.insertAfter(r,t),a=s):a-=o}(o[0],o[1],o[3])}}catch(t){e={error:t}}finally{try{i&&!i.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=S(this.points),n=r.next();!n.done;n=r.next()){var i=n.value,o=i.x,s=i.y,a=i.z;this.searchStore[o]||(this.searchStore[o]={}),this.searchStore[o][s]||(this.searchStore[o][s]={}),this.searchStore[o][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,i,o,s;return m(this,function(t){switch(t.label){case 0:e=new N,t.label=1;case 1:t.trys.push([1,6,7,8]),r=S(a.pPoints),n=r.next(),t.label=2;case 2:return n.done?[3,5]:(i=n.value,e.push(i),i.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 i=t.sent(),o={error:i},[3,8];case 7:try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(o)throw o.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 o=I(I(I([],z(this.holes),!1),z(t.holes),!1),z(n.holes),!1).map(function(t){return t.clone()}),i=function(r){var e,t;try{e=void 0;for(var n=S(o),i=n.next();!i.done;i=n.next())!function(e){if(r.equal(e))return;var t=r.simpleUnion(e);t&&(o=o.filter(function(t){return!t.equal(r)&&!t.equal(e)})).push(t)}(i.value)}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}};try{for(var s=S(o),a=s.next();!a.done;a=s.next())i(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=o}return n},N.prototype.toTriangles=function(){for(var o=function(t,e,r){var n=e.findLine(r),i=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(i)},t.contain(i));return!e&&r},t=this.clone().clockWise.open();t.holes.length;)for(var e=t.holes.shift().clone().clockWise.reverse().close(),r=0;r<t.length;r++){if(o(t,t.first,e.first)){t.insertAfter.apply(t,I(I([0],z(e.points),!1),[t.first],!1));break}t.push(t.shift())}for(var n=[];3<t.length;){var i=function(t){for(var e=0;e<t.length;e++){var r=t.at(0),n=t.at(1),i=t.at(2);if(o(t,r,i))return t.removePart(0,1),new N([r.clone(),n.clone(),i.clone()]);t.push(t.shift())}}(t);i&&n.push(i)}return n.push(t),n},N.prototype.getTrianglesPointIndexes=function(){var o=function(t,e,r){var n=e.findLine(r),i=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(i)},t.contain(i));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(o(t,t.first,r.first)){t.insertAfter.apply(t,I(I([0],z(r.points),!1),[t.first],!1));break}t.push(t.shift())}for(var i=[];3<t.length;){var s=function(t){for(var e=0;e<t.length;e++){var r=t.at(0),n=t.at(1),i=t.at(2);if(o(t,r,i))return t.removePart(0,1),[r.properties.index,n.properties.index,i.properties.index];t.push(t.shift())}}(t);s&&i.push.apply(i,I([],z(s),!1))}return i.push.apply(i,I([],z(t.points.map(function(t){return t.properties.index})),!1)),i},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 c.io.WKTReader,i=this.noHoles,o=this.closed;return new N(n.read(i.toWKT(o?N.WKT_POLYGON:N.WKT_LINESTRING)).buffer(t,e,r).getCoordinates().map(function(t){var e=t.x,t=t.y;return new M(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=z(r.sortByDistance(t).points.map(function(t){return t.properties.index}),2),r=e[0],e=e[1],n=z(n.sortByDistance(t).points.map(function(t){return t.properties.index}),2),i=n[0],n=n[1],o=Math.min(Math.max(r,e),Math.max(i,n)),r=Math.max(Math.min(r,e),Math.min(i,n)),e=new N(t.removePart(o-1,r-o+1));return t.unshift(t.pop()),[e.reverse(),t]},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,i=t-e,o=0;return this.loop().setZ(function(t){return o+=n.distance(t),n=t,e+o/r*i}).run(),this},N.prototype.loopPointsGenerator=function(i){void 0===i&&(i=!1);var o=this;return function(){var e,r,n;return m(this,function(t){switch(t.label){case 0:e=0,t.label=1;case 1:return e<o.length-1?(r=o.at(e),n=o.at(e+1),[4,[r,n,i?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=S(this.loopPointsGenerator()()),i=n.next();!i.done;i=n.next()){var o=z(i.value,2),s=o[0],a=o[1];s.move(a.clone().move(s.clone().minus()).scale(t))}}catch(t){e={error:t}}finally{try{i&&!i.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,i=0,o=t.length-1,s=t[0].findLine(t[o]),a=1;a<o;a++){var u=s.perpendicularDistance(t[a]);n<u&&(i=a,n=u)}return e<=n?(r=this.douglasPeucker(t.slice(0,i+1),e),e=this.douglasPeucker(t.slice(i),e),r.pop(),I(I([],z(r),!1),z(e),!1)):[t[0],t[o]]},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 i=this.at(n),o=i.x,i=i.y;t.lineTo(o,i)}},N.prototype.getJSTSGeometry=function(t,e,r){var r=r===e,n=new c.io.WKTReader,i=n.read(this.noHoles.toWKT()),n=n.read(t.noHoles.toWKT());return r?e?i.union(n):i.intersection(n):i.difference(n)},N.prototype.simpleLogicFunction=function(c,l,f){var p,d,e,y,g,v,r,m,c=this.getJSTSGeometry(c,l,f);if(c){var o=c.getCoordinates();if(o.length){var n=o.reduce(function(t,e,r){var n=e.x,e=e.y,i=t.length-1,n=new M(n,e),e=t[i].first;return n.equal(e)?o[r+1]&&(e=new M(o[r+1].x,o[r+1].y),1<t[i].length&&t.push(new N([e]))):t[i].push(n),t},[new N([new M(o[0].x,o[0].y)])]);if(f&&l&&1<n.length)try{for(var t=S(n),i=t.next();!i.done;i=t.next()){var s=i.value;try{e=void 0;for(var b=S(n),a=b.next();!a.done;a=b.next())if("break"===function(e){var t,r;return s.has(e.first)&&!s.equal(e)?(r=s.findIndex(e.first),(t=s.points).splice.apply(t,I([r,0],z(e.points),!1)),n=n.filter(function(t){return!t.equal(e)}),"continue"):n.length<2?"break":void 0}(a.value))break}catch(t){e={error:t}}finally{try{a&&!a.done&&(y=b.return)&&y.call(b)}finally{if(e)throw e.error}}if(n.length<2)break}}catch(t){p={error:t}}finally{try{i&&!i.done&&(d=t.return)&&d.call(t)}finally{if(p)throw p.error}}n=n.filter(function(t){return 2<t.length}).map(function(t){return t.close()});try{for(var x=S(n),u=x.next();!u.done;u=x.next()){s=u.value;try{r=void 0;for(var P=S(n),h=P.next();!h.done;h=P.next())if("break"===function(e){if(n.length<2)return"break";s.equal(e)||s.contain(e.first,!0)&&(s.holes.push(e),n=n.filter(function(t){return!t.equal(e)}))}(h.value))break}catch(t){r={error:t}}finally{try{h&&!h.done&&(m=P.return)&&m.call(P)}finally{if(r)throw r.error}}if(n.length<2)break}}catch(t){g={error:t}}finally{try{u&&!u.done&&(v=x.return)&&v.call(x)}finally{if(g)throw g.error}}return 0===n.length?null:1===n.length?n[0].close():n.map(function(t){return t.close()})}}return null},N.CAP_ROUND=b,N.CAP_FLAT=A,N.CAP_SQUARE=e,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={}}var B=function(){return(B=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},j=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},D=new O,R=new O,G=new O,L=6371008.8,b=20037508.34,C=b/180,F=180,Y=360,E=Math.PI/F,q=F/Math.PI,M=(a.zero=function(){return new a},a.parse=function(t){var e=t.lat,r=t.lng;if(e&&r)return new a(e,r,0);e=j(t,3);return new a(e[0],e[1],e[2])},a.parseFromWKT=function(t){t=t.trim().toUpperCase(),t=/POINT \((?<data>(?:(?!\)).)*?)\)$/imu.exec(t),t=j(t.groups.data.split(" ").map(Number),3);return new a(t[0],t[1],t[2])},a.random=function(){return new a(Math.random(),Math.random())},a.prototype.getTileFromCoords=function(t){return void 0===t&&(t=this.z),l("getTileFromCoords").checkArgument("this").shouldBeDegree(this),new a(Math.floor((this.x+F)/Y*Math.pow(2,t)),Math.floor((1-Math.log(Math.tan(this.y*E)+1/Math.cos(this.y*E))/Math.PI)/2*Math.pow(2,t)),t)},a.prototype.getCoordsFromTile=function(t){void 0===t&&(t=this.z),l("getCoordsFromTile").checkArgument("this").shouldBeUInt(this);var e=Math.PI-2*Math.PI*this.y/Math.pow(2,t);return new a(this.x/Math.pow(2,t)*Y-F,F/Math.PI*Math.atan((Math.exp(e)-Math.exp(-e))/2),t)},a.prototype.toCoords=function(){return void 0===this.z?[this.x,this.y]:[this.x,this.y,this.z]},a.prototype.findLine=function(t){if(l("findLine").checkArgument("this").shouldBeMeters(this).checkArgument("p").shouldBeMeters(t),this.equal(t))return this.findLine(t.clone().move(0,1));var e=this.y-t.y,r=t.x-this.x,n=this.x*t.y-t.x*this.y;return 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)},a.prototype.findInnerAngle=function(t,e){l("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},a.prototype.toString=function(){return this.x+" "+this.y},a.prototype.getValue=function(){return[this.x,this.y]},a.prototype.height=function(t){return this.z=t,this},a.prototype.toWKT=function(){return"POINT ("+this.x+" "+this.y+")"},a.prototype.distance=function(t){l("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)},a.prototype.distance3d=function(t){l("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)},a.prototype.setX=function(t){return this.x="number"==typeof t?t:t(this),this},a.prototype.setZ=function(t){return this.z="number"==typeof t?t:t(this),this},a.prototype.setY=function(t){return this.y="number"==typeof t?t:t(this),this},a.prototype.clone=function(){var t=new a(this.x,this.y,this.z);return t.properties=B({},this.properties),t},a.prototype.gt=function(t){return this.x>t.x&&this.y>t.y},a.prototype.lt=function(t){return this.x<t.x&&this.y<t.y},a.prototype.gtOrEqual=function(t){return this.gt(t)||this.equal(t)},a.prototype.ltOrEqual=function(t){return this.lt(t)||this.equal(t)},a.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},a.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},a.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},a.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},a.prototype.move=function(t,e,r){void 0===e&&(e=t);var n=0,i=0,o=void 0;return t instanceof a?(n=this.x+t.x,i=this.y+t.y,T(this.z)&&T(t.z)&&(o=this.z+t.z)):(n=this.x+t,i=this.y+e,T(this.z)&&T(r)&&(o=this.z+r)),this.x=n,this.y=i,T(o)&&(this.z=o),this},a.prototype.degreeToMeters=function(){l("degreeToMeters").checkArgument("this").shouldBeDegree(this);var t=((this.x+F)%Y-F)*C,e=Math.log(Math.tan((this.y+90)%F*(Math.PI/Y)))/E*C;return this.x=t,this.y=e,this},a.prototype.metersToDegree=function(){l("metersToDegree").checkArgument("this").shouldBeMeters(this);var t=8983152842445679e-21*this.x,e=Math.atan(Math.pow(Math.E,this.y/C*E))*(Y/Math.PI)-90;return this.x=t,this.y=e,this},a.prototype.degreeToRadians=function(){return l("degreeToRadians").checkArgument("this").shouldBeDegree(this),this.scale(E)},a.prototype.radiansToDegrees=function(){return l("radiansToDegrees").checkArgument("this").shouldBeRadians(this),this.scale(q)},a.prototype.radiansToMeters=function(){return l("radiansToMeters").checkArgument("this").shouldBeRadians(this),this.radiansToDegrees().degreeToMeters()},a.prototype.metersToRadians=function(){return l("metersToRadians").checkArgument("this").shouldBeMeters(this),this.metersToDegree().degreeToRadians()},a.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},a.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},a.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},a.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},a.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},a.prototype.scale=function(t,e,r){void 0===e&&(e=t);var n=0,i=0,o=void 0;return t instanceof a?(n=this.x*t.x,i=this.y*t.y,T(this.z)&&T(t.z)&&(o=this.z*t.z)):(n=this.x*t,i=this.y*e,T(this.z)&&T(r)&&(o=this.z*r)),this.x=n,this.y=i,T(o)&&(this.z=o),this},a.prototype.divide=function(t,e,r){void 0===e&&(e=t);var n=0,i=0,o=void 0;return t instanceof a?(n=this.x/t.x,i=this.y/t.y,T(this.z)&&T(t.z)&&(o=this.z/t.z)):(n=this.x/t,i=this.y/e,T(this.z)&&T(r)&&(o=this.z/r)),this.x=n,this.y=i,T(o)&&(this.z=o),this},a.prototype.equal=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},a.prototype.like=function(t,e){if(void 0===e&&(e=.001),this.equal(t))return!0;var r=Math.abs(this.x-t.x)<e,n=Math.abs(this.y-t.y)<e,i=Math.abs((null!==(i=null!==(i=this.z)&&void 0!==i?i:t.z)&&void 0!==i?i:0)-(null!==(t=null!==(i=t.z)&&void 0!==i?i:this.z)&&void 0!==t?t:0))<e;return r&&n&&i},a.prototype.flipVertically=function(t){var e=t;return t instanceof a&&(e=t.y),this.y=e-this.y,this},Object.defineProperty(a.prototype,"likeRadians",{get:function(){return 0===D.length&&D.push(new a(-Math.PI,-Math.PI/2),new a(Math.PI,Math.PI/2)),D.simpleInclude(this)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"likeWorldGeodeticSystem",{get:function(){return 0===G.length&&G.push(new a(-180,-90),new a(180,90)),!this.likeRadians&&G.simpleInclude(this)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"likePseudoMercator",{get:function(){return 0===R.length&&R.push(new a(-20026376.39,-20048966.1),new a(20026376.39,20048966.1)),!this.likeRadians&&!this.likeWorldGeodeticSystem&&R.simpleInclude(this)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"w",{get:function(){return this.x},set:function(t){this.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"h",{get:function(){return this.y},set:function(t){this.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"area",{get:function(){return l("area").checkArgument("this").shouldBeMeters(this),this.w*this.h},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"hip",{get:function(){return l("hip").checkArgument("this").shouldBeMeters(this),Math.sqrt(this.w*this.w+this.h*this.h)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"min",{get:function(){return Math.min(this.x,this.y)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"max",{get:function(){return Math.max(this.x,this.y)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"hipPoint",{get:function(){var t=this.hip;return new a(t,t)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"xPoint",{get:function(){var t=this.x;return new a(t,t)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"yPoint",{get:function(){var t=this.y;return new a(t,t)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"wPoint",{get:function(){return this.xPoint},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"hPoint",{get:function(){return this.yPoint},enumerable:!1,configurable:!0}),a.prototype.simple=function(t,e){var r;return void 0===e&&(e="y"),(r={})[t=void 0===t?"x":t]=this.x,r[e]=this.y,r},a.prototype.setIfLessThan=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},a.prototype.minus=function(){return this.scale(-1)},a.prototype.orthodromicPath=function(t,e){void 0===e&&(e=360),l("orthodromicPath").checkArgument("this").shouldBeDegree(this).checkArgument("point").shouldBeDegree(t);var r=this.clone().degreeToRadians(),n=t.clone().degreeToRadians(),i=Math.sin(n.x-r.x),o=(n.x-r.x)/(e-1);return new O(g(e).map(function(t,e){e=r.x+o*e;return new a(e,Math.atan(Math.tan(r.y)*Math.sin(n.x-e)/i+Math.tan(n.y)*Math.sin(e-r.x)/i)).radiansToDegrees()}))},a.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})},a);function a(t,e,r){void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this.z=r,this.properties={}}V.prototype.toString=function(){return"("+this.center.toString()+", "+this.r+")"},V.prototype.getValue=function(){return{center:this.center,r:this.r}},V.prototype.clone=function(){return new V(this.center,this.r)},V.prototype.findPoints=function(t){if(this.equal(t))return 1/0;var e=this.center,r=e.x,e=e.y,n=this.r,i=t.center,o=i.x,i=i.y,s=t.r,n=n*n,t=this.center.distance(t.center),s=(n-s*s+t*t)/(2*t),a=s/t,u=i-e,h=o-r,n=Math.sqrt(n-s*s)/t,s=r+a*(o-r),t=e+a*(i-e),o=s+n*u,r=t-n*h,a=s-n*u,i=t+n*h,e=[];return isNaN(o)||isNaN(r)||e.push(new M(o,r)),isNaN(a)||isNaN(i)||o===a&&r===i||e.push(new M(a,i)),e},V.prototype.equal=function(t){var e=t.center,t=t.r;return this.center.equal(e)&&this.r===t},V.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,i=[],o=e;o<r-n;)i.push(new M(this.r).scale(Math.cos(o),Math.sin(o)).move(this.center)),o+=n;t=this.r*Math.cos(r)+this.center.x,e=this.r*Math.sin(r)+this.center.y;return i.push(new M(t,e)),new O(i)},V.prototype.findPolygonInsideOnSphere=function(t,e,r){void 0===t&&(t=64),void 0===e&&(e=0),void 0===r&&(r=2*Math.PI),l("findPolygonInsideOnSphere").checkArgument("center").shouldBeDegree(this.center);for(var n=2*Math.PI/t,i=[],o=e;o<r-n;)i.push(this.sphereOffset(o)),o+=n;return i.push(this.sphereOffset(r)),new O(i)},V.prototype.sphereOffset=function(t,e){void 0===e&&(e=L);var r=this.center.clone().degreeToRadians(),n=r.x,r=r.y,e=this.r/e,i=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(i));return new M(n,i).radiansToDegrees()};var X=V;function V(t,e){void 0===t&&(t=M.zero()),void 0===e&&(e=0),this.center=t,this.r=e}var _=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.")},W=(U.prototype.add=function(t){var e,r;try{for(var n=_(t),i=n.next();!i.done;i=n.next()){var o=i.value,s=o.x,a=o.y,u=o.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{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},U.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"])},U);function U(){this.searchStore={}}function Z(t,e,r){return void 0===r&&(r=d.TraceMatrixValues.f),void 0===t[e.y]||void 0===t[e.y][e.x]?r:t[e.y][e.x]}function K(t,e,r){return void 0===t[e.y]||void 0===t[e.y][e.x]?r:(t[e.y][e.x]=r,t[e.y][e.x])}var H=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},$=function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||((n=n||Array.prototype.slice.call(e,0,i))[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},J=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.")},e=(d.TraceMatrixValues=void 0,(A=d.TraceMatrixValues||(d.TraceMatrixValues={}))[A.f=0]="f",A[A.t=1]="t",Q.prototype.fullMatrixTrace=function(){var r=this,t=this.findAllGroupsInMatrix(this.m),n=t.map(function(t){return r.traceGroup(r.m,t)}),i=t.map(this.createHoleMatrix),o=i.map(function(t){return t&&r.findAllGroupsInMatrix(t)}),s=o.map(function(t,e){return t&&t.map(function(t){return r.traceGroup(i[e],t)}).filter(function(t){return 3<t.length})});return t.map(function(t,e){var r=n[e];return o[e]&&o[e].length&&(r.holes=s[e]),r})},Q.prototype.reverseMatrix=function(e){return Q.createMatrix(this.size,function(t){return Z(e,t)===d.TraceMatrixValues.f?d.TraceMatrixValues.t:d.TraceMatrixValues.f})},Q.prototype.findMarked=function(t,e){for(var r=this.size,n=!1,i=0;i<r.w;i++)for(var o=0;o<r.h;o++)if(n||!e){if(Z(t,new M(i,o))===d.TraceMatrixValues.t)return new M(i,o)}else i=e.x,o=e.y,n=!0;return null},Q.prototype.totalCountInMatrix=function(t){for(var e=0,r=this.size,n=0;n<r.w;n++)for(var i=0;i<r.h;i++)Z(t,new M(n,i))&&e++;return e},Q.createMatrix=function(e,n){return void 0===n&&(n=function(){return d.TraceMatrixValues.f}),g(e.h).map(function(t,r){return g(e.w).map(function(t,e){return n(new M(e,r))})})},Q);function Q(t,e){var p=this;this.size=t,this.findGroupByIndex=function(t,e){var r=new O;if(e&&Z(t,e)===d.TraceMatrixValues.t){r.push(e);var n=0,i=Q.createMatrix(p.size,function(){return d.TraceMatrixValues.f});for(K(i,e,d.TraceMatrixValues.t);n<r.length;){for(var o=r.at(n),s=-1;s<2;s++)for(var a=-1;a<2;a++){var u=new M(o.x+s,o.y+a);Z(i,u,d.TraceMatrixValues.t)===d.TraceMatrixValues.f&&Z(t,u,d.TraceMatrixValues.f)===d.TraceMatrixValues.t&&(r.push(u),K(i,u,d.TraceMatrixValues.t))}n++}}return r},this.findAllGroupsInMatrix=function(t){var e=p.findMarked(t);if(!e)return[];var e=p.findGroupByIndex(t,e),r=[e],n=e.length,i=$([],H(e.points),!1),o=new W;for(o.add(i);n<p.totalCountInMatrix(t);){for(var s=p.findMarked(t);s&&o.find(s);)s=p.findMarked(t,s);var a=p.findGroupByIndex(t,s);n+=a.length,i=$($([],H(i),!1),H(a.points),!1),o.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+i.length+1)%i.length}var n,i=[new M(-1,-1),new M(-1,0),new M(-1,1),new M(0,1),new M(1,1),new M(1,0),new M(1,-1),new M(0,-1)];if(e.length<2)return n=e.at(0).clone(),new O([n,n,n]);for(var o=new O,s=0,a=1/0,u=e.at(0);!u.equal(e.at(0))||o.length<2;){for(;;){var h=Z(t,u.clone().move(i[s])),c=Z(t,u.clone().move(i[r(s)]));if(h===d.TraceMatrixValues.t&&c===d.TraceMatrixValues.f)break;s=(s+i.length-1)%i.length}a!==s&&(o.push(u),a=s),u=u.clone().move(i[s]),s=r(r(s))}return o.approximation().close()},this.createHoleMatrix=function(e){for(var r,t,c=[new M(-1,0),new M(0,1),new M(1,0),new M(0,-1)],n=(e.prepareToFastSearch(),Q.createMatrix(p.size,function(t){return e.fastHas(t)?d.TraceMatrixValues.t:d.TraceMatrixValues.f})),i=new O,o=0;o<p.size.w;o++)i.push(new M(o,-1)),i.push(new M(o,p.size.h));for(o=0;o<p.size.h;o++)i.push(new M(-1,o)),i.push(new M(p.size.w,o));for(;i.length;){var l=i.pop();try{r=void 0;for(var s=J(c),a=s.next();!a.done;a=s.next()){var f=a.value,u=l.clone().move(f);Z(n,u,d.TraceMatrixValues.t)===d.TraceMatrixValues.f&&(K(n,u,d.TraceMatrixValues.t),i.push(u))}}catch(t){r={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(r)throw r.error}}}var h=p.reverseMatrix(n);return p.totalCountInMatrix(h)?h:null},this.m=Q.createMatrix(this.size,e)}var tt=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},b=(et.find=function(t,e,r){if(t.x===e.x&&e.x===r.x)return new et(1,0,0,-t.x,t,e,r);if(t.y===e.y&&e.y===r.y)return new et(0,1,0,-t.y,t,e,r);if(t.z===e.z&&e.z===r.z)return new et(0,0,1,-t.z,t,e,r);var n=tt(p([[t.x,t.y,t.z,-1],[e.x,e.y,e.z,-1],[r.x,r.y,r.z,-1]]),3);return new et(n[0],n[1],n[2],1,t,e,r)},et.prototype.x=function(t){var e,r,n,i,o,s,a=this;return t instanceof M?(e=this.a,r=this.b,n=this.c,i=this.d,o=t.y,s=t.z,t.x=-(r*o+n*s+i)/e,t):t.map(function(t){return a.x(t)})},et.prototype.y=function(t){var e,r,n,i,o,s,a=this;return t instanceof M?(e=this.a,r=this.b,n=this.c,i=this.d,o=t.x,s=t.z,t.y=-(e*o+n*s+i)/r,t):t.map(function(t){return a.y(t)})},et.prototype.z=function(t){var e,r,n,i,o,s,a=this;return t instanceof M?(e=this.a,r=this.b,n=this.c,i=this.d,o=t.x,s=t.y,t.z=-(e*o+r*s+i)/n,t):t.map(function(t){return a.z(t)})},et.prototype.clone=function(){var t=this;return new et(t.a,t.b,t.c,t.d,t.p1,t.p2,t.p3)},et.prototype.distance=function(t){var e,r;if(t instanceof M)return n=t.x,i=t.y,o=t.z,a=this.a,e=this.b,r=this.c,s=this.d,Math.abs(a*n+e*i+r*o+s)/Math.sqrt(a*a+e*e+r*r);var n=t.a,i=t.b,o=t.c,s=t.d,a=this.d;return Math.abs(s-a)/Math.sqrt(n*n+i*i+o*o)},et.prototype.equal=function(t){var e=t.a,r=t.b,n=t.c,t=t.d,i=this.a,o=this.b,s=this.c,a=this.d;return h.like(e,i)&&h.like(r,o)&&h.like(n,s)&&h.like(t,a)},et.prototype.same=function(t){var e=t.a,r=t.b,n=t.c,t=t.d,i=this.a,o=this.b,e=e/i,i=n/this.c,t=t/this.d;return h.like(e,r/o)&&h.like(e,i)&&h.like(e,n)&&h.like(e,t)},et.prototype.parallel=function(t){var e=t.a,r=t.b,n=t.c,t=t.d,i=this.a,o=this.b,e=e/i,i=n/this.c,t=t/this.d;return h.like(e,r/o)&&h.like(e,i)&&h.like(e,n)&&!h.like(e,t)},et);function et(t,e,r,n,i,o,s){void 0===i&&(i=M.zero()),void 0===o&&(o=M.zero()),void 0===s&&(s=M.zero()),this.a=t,this.b=e,this.c=r,this.d=n,this.p1=i,this.p2=o,this.p3=s}d.DCircle=X,d.DEGREE_TO_PI=q,d.DGeo=P,d.DLine=k,d.DNumbers=h,d.DOUBLE_PI_IN_DEGREE=Y,d.DPlane=b,d.DPoint=M,d.DPolygon=O,d.DPolygonLoop=v,d.EARTH_RADIUS_IN_METERS=L,d.FastSearch=W,d.HALF_PI_IN_DEGREE=90,d.MIN_POINTS_IN_VALID_POLYGON=3,d.PI_IN_DEGREE=F,d.PI_TO_DEGREE=E,d.TraceMatrix=e,d.createArray=g,d.createCanvas=y,d.createMatrix=f,d.gaussianElimination=p,d.isDefAndNotNull=T,Object.defineProperty(d,"__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(d,c){"use strict";function x(t){return function(){return t}}function l(b){return{checkArgument:function(t){return P.DEBUG?{shouldBeDegree:function(t){return t.likeWorldGeodeticSystem||w('"'+v+'" -> "'+m+'" should be degree!'),g},shouldBeMeters:function(t){return t.likePseudoMercator||w('"'+d+'" -> "'+y+'" should be meters!'),p},shouldBeInt:function(t){return t.clone().round().equal(t)||w('"'+l+'" -> "'+f+'" should be Int!'),c},shouldBeUInt:function(t){return t.clone().round().equal(t)&&t.gtOrEqual(M.zero())||w('"'+u+'" -> "'+h+'" should be UInt!'),a},shouldBeRadians:function(t){return t.likeRadians||w('"'+o+'" -> "'+s+'" should be radians!'),i},shouldExist:(e=i=a=c=p=g=this,r=o=u=l=d=v=b,n=s=h=f=y=m=t,function(t){return T(t)||w('"'+r+'" -> "'+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,i,o,s,a,u,h,c,l,f,p,d,y,g,v,m}}}function f(t,e){var r=t.h,n=t.w;return void 0===e&&(e=0),b(r).map(function(){return b(n,e)})}function p(t){for(var e=t.length,r=f(new M(e+1,e)),n=0;n<e;n++)for(var i=0;i<e+1;i++)t[n][i]=0===t[n][i]?p.MIN:t[n][i],r[n][i]=t[n][i];for(var o=0;o<e;o++){for(n=0;n<e+1;n++)r[o][n]/=t[o][o];for(n=o+1;n<e;n++)for(var s=r[n][o]/r[o][o],i=0;i<e+1;i++)r[n][i]-=r[o][i]*s;for(n=0;n<e;n++)for(i=0;i<e+1;i++)t[n][i]=r[n][i]}for(o=e-1;-1<o;o--){for(n=e;-1<n;n--)r[o][n]/=t[o][o];for(n=o-1;-1<n;n--)for(s=r[n][o]/r[o][o],i=e;-1<i;i--)r[n][i]-=r[o][i]*s}for(var a=b(e),n=0;n<e;n++)a[n]=r[n][e];return a}function y(t,e,r){var n=0,i=0,o=!1,e=(i=t instanceof M?(n=t.x,t.y):n=t,"boolean"==typeof e?o=e:"number"==typeof e&&(i=e),(o="boolean"==typeof r?r:o)?new OffscreenCanvas(n,i):(null!==(t=y.document)&&void 0!==t?t:document).createElement("canvas"));return o||(e.width=n,e.height=i),[e,e.getContext("2d")]}function g(t,e){for(var r,n,i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];return e?g.apply(void 0,m([(r=t,n=e,[].concat.apply([],m([],v(r.map(function(e){return n.map(function(t){return[].concat(e,t)})})),!1)))],v(i),!1)):t}function o(t){if(1===t.length)return t[0];for(var e=[],r=o(t.slice(1)),n=0;n<r.length;n++)for(var i=0;i<t[0].length;i++)e.push(m([t[0][i]],v(r[n]),!1));return e}var v=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},m=function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||((n=n||Array.prototype.slice.call(e,0,i))[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},P={DEBUG:!1},w=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];P.DEBUG&&console.warn.apply(console,m([],v(t),!1))},T=function(t){return null!=t},b=function(t,e){return void 0===e&&(e=0),new Array(t).fill(e)},h=(p.MIN=1e-10,r.like=function(t,e,r){return void 0===r&&(r=.001),Math.abs(t-e)<r},r.likeZero=function(t){return r.like(t,0)},r.like2PI=function(t){return r.like(r.rad2Deg(t),q)},r.likePI=function(t){return r.like(r.rad2Deg(t),E)},r.rad2Deg=function(t){return t*V},r.deg2Rad=function(t){return t*X},r);function r(){}a.prototype.clone=function(){return new a(this.a,this.b,this.c,this.begin.clone(),this.end.clone())},a.prototype.findPerpendicular=function(t){return l("findPerpendicular").checkArgument("this.begin").shouldBeMeters(this.begin).checkArgument("this.end").shouldBeMeters(this.end).checkArgument("p").shouldBeMeters(t),new a(-this.b,this.a,this.b*t.x-this.a*t.y)},a.prototype.perpendicularDistance=function(t){return l("perpendicularDistance").checkArgument("this.begin").shouldBeMeters(this.begin).checkArgument("this.end").shouldBeMeters(this.end).checkArgument("p").shouldBeMeters(t),this.findPerpendicular(t).findPoint(this).distance(t)},a.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},a.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 i,o=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)]}if(this.begin.like(e))return i=this.begin.clone(),[this.movePoint(i,t),this.movePoint(i,-t)];if(this.end.like(e))return i=this.end.clone(),[this.movePoint(i,t),this.movePoint(i,-t)];u=o*o+s*s,e=Math.sqrt((t*t-a*a/u)/u);return[r.clone().move(s*e,-o*e),r.clone().move(-s*e,o*e)]}return n===t?r:null},a.prototype.inRange=function(t,e){var r=this.minX,n=this.minY,i=this.maxX,o=this.maxY,s=t.x,t=t.y;return r-(e=void 0===e?0:e)<=s&&s<=i+e&&(n-e<=t&&t<=o+e)},a.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(a.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(a.prototype,"minX",{get:function(){return Math.min(this.begin.x,this.end.x)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"minY",{get:function(){return Math.min(this.begin.y,this.end.y)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"maxX",{get:function(){return Math.max(this.begin.x,this.end.x)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"maxY",{get:function(){return Math.max(this.begin.y,this.end.y)},enumerable:!1,configurable:!0}),a.prototype.toString=function(){return"("+this.a+", "+this.b+", "+this.c+")"},a.prototype.getValue=function(){return[this.a,this.b,this.c]},a.prototype.x=function(t){return this.isParallelY?new M(-this.c/this.a,t.y):this.isParallelX?new M(t.x,-this.c/this.b):new M(-this.b/this.a*t.y-this.c/this.a,t.y)},a.prototype.y=function(t){return this.isParallelY?new M(-this.c/this.a,t.y):this.isParallelX?new M(t.x,-this.c/this.b):new M(t.x,-this.a/this.b*t.x-this.c/this.b)},a.prototype.findPoint=function(t){if(this.isParallelY&&t.isParallelY)return null;if(this.isParallelX&&t.isParallelX)return null;if(this.isParallelX&&t.isParallelY)return new M(-t.c/t.a,-this.c/this.b);if(this.isParallelY&&t.isParallelX)return new M(-this.c/this.a,-t.c/t.b);var e;if(this.isParallelY)return r=-this.c/this.a,t.y(new M(r));if(this.isParallelX)return e=-this.c/this.b,t.x(new M(0,e));if(t.isParallelY)return r=-t.c/t.a,this.y(new M(r));if(t.isParallelX)return e=-t.c/t.b,this.x(new M(0,e));var r=this.y(new M((t.c/t.b-this.c/this.b)/(this.a/this.b-t.a/t.b)));return isFinite(r.x)||isFinite(r.y)?r:null},Object.defineProperty(a.prototype,"isParallel",{get:function(){return this.isParallelX||this.isParallelY},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isParallelY",{get:function(){return Math.abs(this.b)<.001},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isParallelX",{get:function(){return Math.abs(this.a)<.001},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"points",{get:function(){return[this.begin,this.end]},enumerable:!1,configurable:!0}),a.prototype.getFi=function(){l("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)},a.prototype.toWKT=function(){var t=this.begin,e=t.x,t=t.y,r=this.end;return"LINESTRING ("+e+" "+t+", "+r.x+" "+r.y+")"},a.prototype.movePoint=function(t,e){var r=Array.isArray(t),t=r?t:[t],n=r?e:[e],e=this.findFi(new a(1,0,0)),i=this.x(new M(1,1)).distance(this.x(new M(2,2)))/2,o=new M(Math.sin(e),Math.cos(e)),e=o.clone().scale(i),i=t[0].clone().move(e.clone().minus()),e=t[0].clone().move(e),s=[],s=h.like(this.y(i).y,i.y)||h.like(this.y(e).y,e.y)?t.map(function(t,e){return t.clone().move(o.clone().scale(n[e]))}):t.map(function(t,e){return t.clone().move(o.clone().scale(n[e]).setX(function(t){return-t.x}))});return r?s:s[0]},a.prototype.findFi=function(t,e){var r=t.a,t=t.b,n=(void 0===e&&(e=1.0001),this.a),i=this.b,n=(n*r+i*t)/(Math.sqrt(n*n+i*i)*Math.sqrt(r*r+t*t));return 1<n&&n<e?n=1:n<-1&&-e<n&&(n=-1),Math.acos(n)},a.prototype.vectorProduct=function(t){var e=t.a,r=t.b,t=t.c,n=this.a,i=this.b,o=this.c;return new a(i*t-o*r,o*e-n*t,n*r-i*e)};var u,k=a;function a(t,e,r,n,i){void 0===n&&(n=M.zero()),void 0===i&&(i=M.zero()),this.a=t,this.b=e,this.c=r,this.begin=n,this.end=i}(e=u=u||{})[e.getTileFromCoords=0]="getTileFromCoords",e[e.getCoordsFromTile=1]="getCoordsFromTile",e[e.height=2]="height",e[e.setX=3]="setX",e[e.setY=4]="setY",e[e.setZ=5]="setZ",e[e.rotate=6]="rotate",e[e.rotate3dX=7]="rotate3dX",e[e.rotate3dY=8]="rotate3dY",e[e.rotate3dZ=9]="rotate3dZ",e[e.move=10]="move",e[e.round=11]="round",e[e.ceil=12]="ceil",e[e.floor=13]="floor",e[e.toFixed=14]="toFixed",e[e.abs=15]="abs",e[e.scale=16]="scale",e[e.divide=17]="divide",e[e.degreeToRadians=18]="degreeToRadians",e[e.radiansToDegrees=19]="radiansToDegrees",e[e.radiansToMeters=20]="radiansToMeters",e[e.metersToRadians=21]="metersToRadians",e[e.hipPoint=22]="hipPoint",e[e.xPoint=23]="xPoint",e[e.yPoint=24]="yPoint",e[e.wPoint=25]="wPoint",e[e.hPoint=26]="hPoint",e[e.setIfLessThan=27]="setIfLessThan",e[e.minus=28]="minus",e[e.degreeToMeters=29]="degreeToMeters",e[e.metersToDegree=30]="metersToDegree",e[e.flipVertically=31]="flipVertically";function n(e,t){var r=t.functionName,n=t.pointArg,i=t.numberPointArg,o=t.numberArg,s=t.setterArg,a=e;switch(r){case u.getTileFromCoords:a=function(t){return e(t).getTileFromCoords(o)};break;case u.getCoordsFromTile:a=function(t){return e(t).getCoordsFromTile(o)};break;case u.height:a=function(t){return e(t).height(o)};break;case u.setX:a=function(t){return e(t).setX(s)};break;case u.setY:a=function(t){return e(t).setY(s)};break;case u.setZ:a=function(t){return e(t).setZ(s)};break;case u.rotate:a=function(t){return e(t).rotate(o)};break;case u.rotate3dX:a=function(t){return e(t).rotate3dX(o)};break;case u.rotate3dY:a=function(t){return e(t).rotate3dY(o)};break;case u.rotate3dZ:a=function(t){return e(t).rotate3dZ(o)};break;case u.move:a=function(t){return e(t).move(i,o)};break;case u.round:a=function(t){return e(t).round()};break;case u.ceil:a=function(t){return e(t).ceil()};break;case u.floor:a=function(t){return e(t).floor()};break;case u.toFixed:a=function(t){return e(t).toFixed(o)};break;case u.abs:a=function(t){return e(t).abs()};break;case u.scale:a=function(t){return e(t).scale(i,o)};break;case u.divide:a=function(t){return e(t).divide(i,o)};break;case u.degreeToRadians:a=function(t){return e(t).degreeToRadians()};break;case u.radiansToDegrees:a=function(t){return e(t).radiansToDegrees()};break;case u.radiansToMeters:a=function(t){return e(t).radiansToMeters()};break;case u.metersToRadians:a=function(t){return e(t).metersToRadians()};break;case u.hipPoint:a=function(t){return e(t).hipPoint};break;case u.xPoint:a=function(t){return e(t).xPoint};break;case u.yPoint:a=function(t){return e(t).yPoint};break;case u.wPoint:a=function(t){return e(t).wPoint};break;case u.hPoint:a=function(t){return e(t).hPoint};break;case u.setIfLessThan:a=function(t){return e(t).setIfLessThan(n)};break;case u.minus:a=function(t){return e(t).minus()};break;case u.degreeToMeters:a=function(t){return e(t).degreeToMeters()};break;case u.metersToDegree:a=function(t){return e(t).metersToDegree()};break;case u.flipVertically:a=function(t){return e(t).flipVertically(i)}}return a}t.prototype.getLoopFunction=function(){return this.pool.reduce(n,function(t){return t})},t.prototype.run=function(){return this.parent.map(this.getLoopFunction())},t.prototype.getTileFromCoords=function(t){return this.pool.push({functionName:u.getTileFromCoords,numberArg:t}),this},t.prototype.getCoordsFromTile=function(t){return this.pool.push({functionName:u.getCoordsFromTile,numberArg:t}),this},t.prototype.height=function(t){return this.pool.push({functionName:u.height,numberArg:t}),this},t.prototype.setX=function(t){return this.pool.push({functionName:u.setX,setterArg:t}),this},t.prototype.setY=function(t){return this.pool.push({functionName:u.setY,setterArg:t}),this},t.prototype.setZ=function(t){return this.pool.push({functionName:u.setZ,setterArg:t}),this},t.prototype.rotate=function(t){return this.pool.push({functionName:u.rotate,numberArg:t}),this},t.prototype.rotate3dX=function(t){return this.pool.push({functionName:u.rotate3dX,numberArg:t}),this},t.prototype.rotate3dY=function(t){return this.pool.push({functionName:u.rotate3dY,numberArg:t}),this},t.prototype.rotate3dZ=function(t){return this.pool.push({functionName:u.rotate3dZ,numberArg:t}),this},t.prototype.move=function(t,e){return this.pool.push({functionName:u.move,numberPointArg:t,numberArg:e=void 0===e?t:e}),this},t.prototype.round=function(){return this.pool.push({functionName:u.round}),this},t.prototype.ceil=function(){return this.pool.push({functionName:u.ceil}),this},t.prototype.floor=function(){return this.pool.push({functionName:u.floor}),this},t.prototype.toFixed=function(t){return this.pool.push({functionName:u.toFixed,numberArg:t=void 0===t?2:t}),this},t.prototype.abs=function(){return this.pool.push({functionName:u.abs}),this},t.prototype.scale=function(t,e){return this.pool.push({functionName:u.scale,numberPointArg:t,numberArg:e=void 0===e?t:e}),this},t.prototype.divide=function(t,e){return this.pool.push({functionName:u.divide,numberPointArg:t,numberArg:e}),this},t.prototype.degreeToRadians=function(){return this.pool.push({functionName:u.degreeToRadians}),this},t.prototype.radiansToDegrees=function(){return this.pool.push({functionName:u.radiansToDegrees}),this},t.prototype.radiansToMeters=function(){return this.pool.push({functionName:u.radiansToMeters}),this},t.prototype.metersToRadians=function(){return this.pool.push({functionName:u.metersToRadians}),this},t.prototype.getHipPoint=function(){return this.pool.push({functionName:u.hipPoint}),this},t.prototype.getXPoint=function(){return this.pool.push({functionName:u.xPoint}),this},t.prototype.getYPoint=function(){return this.pool.push({functionName:u.yPoint}),this},t.prototype.getWPoint=function(){return this.pool.push({functionName:u.wPoint}),this},t.prototype.getHPoint=function(){return this.pool.push({functionName:u.hPoint}),this},t.prototype.setIfLessThan=function(t){return this.pool.push({functionName:u.setIfLessThan,pointArg:t}),this},t.prototype.minus=function(){return this.pool.push({functionName:u.minus}),this},t.prototype.degreeToMeters=function(){return this.pool.push({functionName:u.degreeToMeters}),this},t.prototype.metersToDegree=function(){return this.pool.push({functionName:u.metersToDegree}),this},t.prototype.flipVertically=function(t){return this.pool.push({functionName:u.flipVertically,numberPointArg:t}),this};var i=t;function t(t){this.parent=t,this.pool=[]}var I=function(n,i){var o,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(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=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];break}if(6===e[0]&&u.label<a[1]){u.label=a[1],a=e;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(e);break}a[2]&&u.ops.pop(),u.trys.pop();continue}e=i.call(n,u)}catch(t){e=[6,t],s=0}finally{o=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}}},S=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.")},z=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},O=function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||((n=n||Array.prototype.slice.call(e,0,i))[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},e=c.operation.buffer.BufferParameters,A=e.CAP_ROUND,B=e.CAP_FLAT,e=e.CAP_SQUARE,j=(N.arrayOfTrianglesToVertices=function(t,e){return t.map(function(t){return(T(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 M(e.distance(r),e.distance(t))},N.toDash=function(t){var e,r,n=new N,i=[n],o=!0;try{for(var s=S(t.points),a=s.next();!a.done;a=s.next()){var u=a.value;o&&n.push(u.clone()),u.properties.pieceBorder&&(o=!o)&&(n=new N,i.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 i},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(),i=new N;return 0===t.indexOf("POLYGON")&&(n=/POLYGON \(\((?<data>(?:(?!\)\)$).)*?)\)\)$/imu.exec(t),e=(r=z(n.groups.data.split("), (").map(function(t){return new N(t.split(", ").map(function(t){return M.parse(t.split(" ").map(Number))}))})))[0],(r=r.slice(1))&&r.length&&(e.holes=r),i=e),0===t.indexOf("LINESTRING")&&(i=new N((n=/LINESTRING \((?<data>(?:(?!\)$).)*?)\)$/imu.exec(t)).groups.data.split(", ").map(function(t){return M.parse(t.split(" ").map(Number))}))),i=0===t.indexOf("POINT")?new N([M.parseFromWKT(t)]):i},N.createSquareBySize=function(t){return new N([M.zero(),t.clone().setX(0),t.clone(),t.clone().setY(0)]).close()},N.prototype.loop=function(){return new i(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,"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 M(t,e),new M(r,e),new M(r,n),new M(t,n),new M(t,e)])},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"size",{get:function(){var t=this.w,e=this.h;return new M(t,e)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"leftTop",{get:function(){var t=this.minX,e=this.minY;return new M(t,e)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"rightBottom",{get:function(){var t=this.maxX,e=this.maxY;return new M(t,e)},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=S(this.loopPointsGenerator()()),i=n.next();!i.done;i=n.next()){var o=z(i.value,2),s=o[0],a=o[1];r+=s.distance(a)}}catch(t){e={error:t}}finally{try{i&&!i.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=S(this.deintersection.loopPointsGenerator()()),i=n.next();!i.done;i=n.next()){var o=z(i.value,2),s=o[0],a=s.x,u=s.y,h=o[1],c=h.x;r+=a*h.y-u*c}}catch(t){e={error:t}}finally{try{i&&!i.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,"deintersection",{get:function(){for(var e,t,i=this.clone().close(),r={},o=0;o<i.length-1;o++)for(var n=i.at(o).toString(),s=(r[n]=r[n]||[],r[n].push(o),o+2);s<i.length-1;s++)!function(t){var e=i.at(o).findLine(i.at(o+1)),r=i.at(t).findLine(i.at(t+1)),n=e.intersection(r);n&&!O(O([],z(e.points),!1),z(r.points),!1).some(function(t){return t.like(n)})&&(e=i.removePart(o,t-o).reverse(),i.insertAfter.apply(i,O([o],z(e),!1)),i.insertAfter(t,n),i.insertAfter(o,n))}(s);try{for(var a=S(Object.keys(r)),u=a.next();!u.done;u=a.next()){var h=r[u.value];if(1<h.length)for(var c=function(t){var r=i.clone(),e=h[t]-h[t-1];1<e&&((e=new N(r.removePart(h[t-1],e))).reduce(function(t,e){return t&&function(t,e){var r,c;if(t.points.some(function(t){return t.equal(e)}))return!0;try{for(var n=S(t.loopPointsGenerator(!0)()),i=n.next();!i.done;i=n.next()){var l=z(i.value,3)[2];if(l.x(e).equal(e)&&l.inRange(e))return!0}}catch(t){h={error:t}}finally{try{i&&!i.done&&(u=n.return)&&u.call(n)}finally{if(h)throw h.error}}var o=0;try{for(var s=S(t.loopPointsGenerator()()),a=s.next();!a.done;a=s.next()){var f=z(a.value,2),p=f[0],d=p.x,y=p.y,g=f[1],v=g.x,m=g.y,b=new k(d-e.x,y-e.y,0),x=new k(v-e.x,m-e.y,0),P=b.findFi(x);0<b.vectorProduct(x).c?o+=P:o-=P}}catch(t){r={error:t}}finally{try{a&&!a.done&&(c=s.return)&&c.call(s)}finally{if(r)throw r.error}}var u=Math.PI/1e4,h=!1,t=Math.abs(o);if(t<u)h=!1;else{if(!(Math.abs(2*Math.PI-t)<u))throw new Error("contains2 faild");h=!0}return h}(r,e)},!0)&&r.isClockwise===e.isClockwise&&(r.insertAfter.apply(r,O([h[t-1]-1],z(e.reverse().points),!1)),i=r))},s=h.length-1;0<s;s--)c(s)}}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,"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 c,l,e,f,t=this.convex,p=new N,d=1/0;try{for(var r=S(t.loopPointsGenerator(!0)()),n=r.next();!n.done;n=r.next()){var y,g,v,m,i=z(n.value,3)[2],b=0,o=null,s=null,x=0,a=null;try{e=void 0;for(var u=S(t.loopPointsGenerator()()),h=u.next();!h.done;h=u.next()){var P=z(h.value,4),M=P[0],w=P[3],T=i.findPoint(i.findPerpendicular(M)),k=T.distance(M);x<=k&&(x=k,a=M);for(var I=w;I<t.length-1;I++){var O=i.findPoint(i.findPerpendicular(t.at(I))),A=T.distance(O);b<=A&&(b=A,o=T,s=O)}}}catch(t){e={error:t}}finally{try{h&&!h.done&&(f=u.return)&&f.call(u)}finally{if(e)throw e.error}}o&&s&&a&&(g=(y=o.findLine(s)).findPerpendicular(o),(m=new N([o,s,(v=y.findPerpendicular(s)).findPoint(v.findPerpendicular(a)),g.findPoint(g.findPerpendicular(a))]).close()).area<d&&(d=(p=m).area))}}catch(t){c={error:t}}finally{try{n&&!n.done&&(l=r.return)&&l.call(r)}finally{if(c)throw c.error}}return p},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,i=t.second}while(((u=n.findInnerAngle(r,i))>Math.PI||h.likeZero(h.rad2Deg(u))||h.likePI(u)||h.like2PI(u))&&(t.removePart(-1,1),t.length));t.close();var o=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),i=t.at(a+1);((u=n.findInnerAngle(r,i))>Math.PI||h.likeZero(h.rad2Deg(u))||h.likePI(u)||h.like2PI(u))&&t.removePart(--a,1)}}while(o++,t.length!==s&&o<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=S(this.clone().close().loopPointsGenerator()()),i=n.next();!i.done;i=n.next()){var o=z(i.value,2),s=o[0],a=s.x,u=s.y,h=o[1];r+=(h.x-a)*(h.y+u)}}catch(t){e={error:t}}finally{try{i&&!i.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,i=[];try{for(var o=S(this.loopPointsGenerator(!0)()),s=o.next();!s.done;s=o.next()){var a=z(s.value,3)[2].intersection(t,0,e);a&&i.push(a)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},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=", "+this.holes.map(function(t){return t.toString()}).join(", ")),"POLYGON (("+this.deintersection.mapArray(function(t){return t.x+" "+t.y+(e?" "+t.z:"")}).join(", ")+")"+t+")"):"LINESTRING ("+this.mapArray(function(t){return t.x+" "+t.y+(e?" "+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,O([],z(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,O([],z(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"("+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(O(O([],z(this.points),!1),z(t.points),!1)).close();return e.holes=O(O([],z(this.holes),!1),z(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=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 M?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,O([t+1,0],z(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,i,o){return void 0===i&&(i=1),void 0===o&&(o=this.length-1),1<this.length&&(t=t.getContext("2d"),e&&(t.fillStyle=e),r&&(t.strokeStyle=r),i&&(t.lineWidth=i),(e||r)&&t.beginPath(),this.goByPath(t,o%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 i=S(e.loopPointsGenerator()()),o=i.next();!o.done;o=i.next()){var s=z(o.value,2),a=s[0],c=a.x,l=a.y,u=s[1],f=u.x,p=u.y,d=new k(c-t.x,l-t.y,0),y=new k(f-t.x,p-t.y,0),g=d.findFi(y);0<d.vectorProduct(y).c?n+=g:n-=g}}catch(t){r={error:t}}finally{try{o&&!o.done&&(h=i.return)&&h.call(i)}finally{if(r)throw r.error}}var e=Math.PI/1e4,h=Math.abs(n);if(h<e)return!1;if(Math.abs(2*Math.PI-h)<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 i=S(n.loopPointsGenerator(!0)()),o=i.next();!o.done;o=i.next()){var s=z(o.value,3)[2];if(s.x(e).equal(e)&&s.inRange(e))return!0}}catch(t){r={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}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.parse=function(t){return new N(t.map(function(t){return M.parse(t)}))},N.prototype.toArrayOfCoords=function(){return this.mapArray(function(t){return t.toCoords()})},N.prototype.divideToPieces=function(t){var e,r,s=this.fullLength/t,a=s,u=this;try{for(var n=S(this.loopPointsGenerator()()),i=n.next();!i.done;i=n.next()){var o=z(i.value,4);!function(t,e,r){var n,i,o=t.distance(e);o===a?(e.properties.pieceBorder=!0,a=s):0<o-a?(n=new _(t,a),(t=(i=t.findLine(e)).intersectionWithCircle(n).filter(function(t){return i.inRange(t,.001)})[0]).properties.pieceBorder=!0,u.insertAfter(r,t),a=s):a-=o}(o[0],o[1],o[3])}}catch(t){e={error:t}}finally{try{i&&!i.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=S(this.points),n=r.next();!n.done;n=r.next()){var i=n.value,o=i.x,s=i.y,a=i.z;this.searchStore[o]||(this.searchStore[o]={}),this.searchStore[o][s]||(this.searchStore[o][s]={}),this.searchStore[o][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,i,o,s;return I(this,function(t){switch(t.label){case 0:e=new N,t.label=1;case 1:t.trys.push([1,6,7,8]),r=S(a.pPoints),n=r.next(),t.label=2;case 2:return n.done?[3,5]:(i=n.value,e.push(i),i.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 i=t.sent(),o={error:i},[3,8];case 7:try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(o)throw o.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 o=O(O(O([],z(this.holes),!1),z(t.holes),!1),z(n.holes),!1).map(function(t){return t.clone()}),i=function(r){var e,t;try{e=void 0;for(var n=S(o),i=n.next();!i.done;i=n.next())!function(e){if(r.equal(e))return;var t=r.simpleUnion(e);t&&(o=o.filter(function(t){return!t.equal(r)&&!t.equal(e)})).push(t)}(i.value)}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}};try{for(var s=S(o),a=s.next();!a.done;a=s.next())i(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=o}return n},N.prototype.toTriangles=function(){for(var o=function(t,e,r){var n=e.findLine(r),i=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(i)},t.contain(i));return!e&&r},t=this.clone().clockWise.open();t.holes.length;)for(var e=t.holes.shift().clone().clockWise.reverse().close(),r=0;r<t.length;r++){if(o(t,t.first,e.first)){t.insertAfter.apply(t,O(O([0],z(e.points),!1),[t.first],!1));break}t.push(t.shift())}for(var n=[];3<t.length;){var i=function(t){for(var e=0;e<t.length;e++){var r=t.at(0),n=t.at(1),i=t.at(2);if(o(t,r,i))return t.removePart(0,1),new N([r.clone(),n.clone(),i.clone()]);t.push(t.shift())}}(t);i&&n.push(i)}return n.push(t),n},N.prototype.getTrianglesPointIndexes=function(){var o=function(t,e,r){var n=e.findLine(r),i=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(i)},t.contain(i));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(o(t,t.first,r.first)){t.insertAfter.apply(t,O(O([0],z(r.points),!1),[t.first],!1));break}t.push(t.shift())}for(var i=[];3<t.length;){var s=function(t){for(var e=0;e<t.length;e++){var r=t.at(0),n=t.at(1),i=t.at(2);if(o(t,r,i))return t.removePart(0,1),[r.properties.index,n.properties.index,i.properties.index];t.push(t.shift())}}(t);s&&i.push.apply(i,O([],z(s),!1))}return i.push.apply(i,O([],z(t.points.map(function(t){return t.properties.index})),!1)),i},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 c.io.WKTReader,i=this.noHoles,o=this.closed;return new N(n.read(i.toWKT(o?N.WKT_POLYGON:N.WKT_LINESTRING)).buffer(t,e,r).getCoordinates().map(function(t){var e=t.x,t=t.y;return new M(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=z(r.sortByDistance(t).points.map(function(t){return t.properties.index}),2),r=e[0],e=e[1],n=z(n.sortByDistance(t).points.map(function(t){return t.properties.index}),2),i=n[0],n=n[1],o=Math.min(Math.max(r,e),Math.max(i,n)),r=Math.max(Math.min(r,e),Math.min(i,n)),e=new N(t.removePart(o-1,r-o+1));return t.unshift(t.pop()),[e.reverse(),t]},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,i=t-e,o=0;return this.loop().setZ(function(t){return o+=n.distance(t),n=t,e+o/r*i}).run(),this},N.prototype.loopPointsGenerator=function(i){void 0===i&&(i=!1);var o=this;return function(){var e,r,n;return I(this,function(t){switch(t.label){case 0:e=0,t.label=1;case 1:return e<o.length-1?(r=o.at(e),n=o.at(e+1),[4,[r,n,i?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=S(this.loopPointsGenerator()()),i=n.next();!i.done;i=n.next()){var o=z(i.value,2),s=o[0],a=o[1];s.move(a.clone().move(s.clone().minus()).scale(t))}}catch(t){e={error:t}}finally{try{i&&!i.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,i=0,o=t.length-1,s=t[0].findLine(t[o]),a=1;a<o;a++){var u=s.perpendicularDistance(t[a]);n<u&&(i=a,n=u)}return e<=n?(r=this.douglasPeucker(t.slice(0,i+1),e),e=this.douglasPeucker(t.slice(i),e),r.pop(),O(O([],z(r),!1),z(e),!1)):[t[0],t[o]]},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 i=this.at(n),o=i.x,i=i.y;t.lineTo(o,i)}},N.prototype.getJSTSGeometry=function(t,e,r){var r=r===e,n=new c.io.WKTReader,i=n.read(this.noHoles.toWKT()),n=n.read(t.noHoles.toWKT());return r?e?i.union(n):i.intersection(n):i.difference(n)},N.prototype.simpleLogicFunction=function(c,l,f){var p,d,e,y,g,v,r,m,c=this.getJSTSGeometry(c,l,f);if(c){var o=c.getCoordinates();if(o.length){var n=o.reduce(function(t,e,r){var n=e.x,e=e.y,i=t.length-1,n=new M(n,e),e=t[i].first;return n.equal(e)?o[r+1]&&(e=new M(o[r+1].x,o[r+1].y),1<t[i].length&&t.push(new N([e]))):t[i].push(n),t},[new N([new M(o[0].x,o[0].y)])]);if(f&&l&&1<n.length)try{for(var t=S(n),i=t.next();!i.done;i=t.next()){var s=i.value;try{e=void 0;for(var b=S(n),a=b.next();!a.done;a=b.next())if("break"===function(e){var t,r;return s.has(e.first)&&!s.equal(e)?(r=s.findIndex(e.first),(t=s.points).splice.apply(t,O([r,0],z(e.points),!1)),n=n.filter(function(t){return!t.equal(e)}),"continue"):n.length<2?"break":void 0}(a.value))break}catch(t){e={error:t}}finally{try{a&&!a.done&&(y=b.return)&&y.call(b)}finally{if(e)throw e.error}}if(n.length<2)break}}catch(t){p={error:t}}finally{try{i&&!i.done&&(d=t.return)&&d.call(t)}finally{if(p)throw p.error}}n=n.filter(function(t){return 2<t.length}).map(function(t){return t.close()});try{for(var x=S(n),u=x.next();!u.done;u=x.next()){s=u.value;try{r=void 0;for(var P=S(n),h=P.next();!h.done;h=P.next())if("break"===function(e){if(n.length<2)return"break";s.equal(e)||s.contain(e.first,!0)&&(s.holes.push(e),n=n.filter(function(t){return!t.equal(e)}))}(h.value))break}catch(t){r={error:t}}finally{try{h&&!h.done&&(m=P.return)&&m.call(P)}finally{if(r)throw r.error}}if(n.length<2)break}}catch(t){g={error:t}}finally{try{u&&!u.done&&(v=x.return)&&v.call(x)}finally{if(g)throw g.error}}return 0===n.length?null:1===n.length?n[0].close():n.map(function(t){return t.close()})}}return null},N.CAP_ROUND=A,N.CAP_FLAT=B,N.CAP_SQUARE=e,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={}}var D=function(){return(D=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},R=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},C=new j,G=new j,L=new j,F=6371008.8,A=20037508.34,Y=A/180,E=180,q=360,X=Math.PI/E,V=E/Math.PI,M=(s.zero=function(){return new s},s.parse=function(t){var e=t.lat,r=t.lng;if(e&&r)return new s(e,r,0);e=R(t,3);return new s(e[0],e[1],e[2])},s.parseFromWKT=function(t){t=t.trim().toUpperCase(),t=/POINT \((?<data>(?:(?!\)).)*?)\)$/imu.exec(t),t=R(t.groups.data.split(" ").map(Number),3);return new s(t[0],t[1],t[2])},s.random=function(){return new s(Math.random(),Math.random())},s.prototype.getTileFromCoords=function(t){return void 0===t&&(t=this.z),l("getTileFromCoords").checkArgument("this").shouldBeDegree(this),new s(Math.floor((this.x+E)/q*Math.pow(2,t)),Math.floor((1-Math.log(Math.tan(this.y*X)+1/Math.cos(this.y*X))/Math.PI)/2*Math.pow(2,t)),t)},s.prototype.getCoordsFromTile=function(t){void 0===t&&(t=this.z),l("getCoordsFromTile").checkArgument("this").shouldBeUInt(this);var e=Math.PI-2*Math.PI*this.y/Math.pow(2,t);return new s(this.x/Math.pow(2,t)*q-E,E/Math.PI*Math.atan((Math.exp(e)-Math.exp(-e))/2),t)},s.prototype.toCoords=function(){return void 0===this.z?[this.x,this.y]:[this.x,this.y,this.z]},s.prototype.findLine=function(t){if(l("findLine").checkArgument("this").shouldBeMeters(this).checkArgument("p").shouldBeMeters(t),this.equal(t))return this.findLine(t.clone().move(0,1));var e=this.y-t.y,r=t.x-this.x,n=this.x*t.y-t.x*this.y;return 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)},s.prototype.findInnerAngle=function(t,e){l("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},s.prototype.toString=function(){return this.x+" "+this.y},s.prototype.getValue=function(){return[this.x,this.y]},s.prototype.height=function(t){return this.z=t,this},s.prototype.toWKT=function(){return"POINT ("+this.x+" "+this.y+")"},s.prototype.distance=function(t){l("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)},s.prototype.distance3d=function(t){l("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)},s.prototype.setX=function(t){return this.x="number"==typeof t?t:t(this),this},s.prototype.setZ=function(t){return this.z="number"==typeof t?t:t(this),this},s.prototype.setY=function(t){return this.y="number"==typeof t?t:t(this),this},s.prototype.clone=function(){var t=new s(this.x,this.y,this.z);return t.properties=D({},this.properties),t},s.prototype.gt=function(t){return this.x>t.x&&this.y>t.y},s.prototype.lt=function(t){return this.x<t.x&&this.y<t.y},s.prototype.gtOrEqual=function(t){return this.gt(t)||this.equal(t)},s.prototype.ltOrEqual=function(t){return this.lt(t)||this.equal(t)},s.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},s.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},s.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},s.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},s.prototype.move=function(t,e,r){void 0===e&&(e=t);var n=0,i=0,o=void 0;return t instanceof s?(n=this.x+t.x,i=this.y+t.y,T(this.z)&&T(t.z)&&(o=this.z+t.z)):(n=this.x+t,i=this.y+e,T(this.z)&&T(r)&&(o=this.z+r)),this.x=n,this.y=i,T(o)&&(this.z=o),this},s.prototype.degreeToMeters=function(){l("degreeToMeters").checkArgument("this").shouldBeDegree(this);var t=((this.x+E)%q-E)*Y,e=Math.log(Math.tan((this.y+90)%E*(Math.PI/q)))/X*Y;return this.x=t,this.y=e,this},s.prototype.metersToDegree=function(){l("metersToDegree").checkArgument("this").shouldBeMeters(this);var t=8983152842445679e-21*this.x,e=Math.atan(Math.pow(Math.E,this.y/Y*X))*(q/Math.PI)-90;return this.x=t,this.y=e,this},s.prototype.degreeToRadians=function(){return l("degreeToRadians").checkArgument("this").shouldBeDegree(this),this.scale(X)},s.prototype.radiansToDegrees=function(){return l("radiansToDegrees").checkArgument("this").shouldBeRadians(this),this.scale(V)},s.prototype.radiansToMeters=function(){return l("radiansToMeters").checkArgument("this").shouldBeRadians(this),this.radiansToDegrees().degreeToMeters()},s.prototype.metersToRadians=function(){return l("metersToRadians").checkArgument("this").shouldBeMeters(this),this.metersToDegree().degreeToRadians()},s.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},s.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},s.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},s.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},s.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},s.prototype.scale=function(t,e,r){void 0===e&&(e=t);var n=0,i=0,o=void 0;return t instanceof s?(n=this.x*t.x,i=this.y*t.y,T(this.z)&&T(t.z)&&(o=this.z*t.z)):(n=this.x*t,i=this.y*e,T(this.z)&&T(r)&&(o=this.z*r)),this.x=n,this.y=i,T(o)&&(this.z=o),this},s.prototype.divide=function(t,e,r){void 0===e&&(e=t);var n=0,i=0,o=void 0;return t instanceof s?(n=this.x/t.x,i=this.y/t.y,T(this.z)&&T(t.z)&&(o=this.z/t.z)):(n=this.x/t,i=this.y/e,T(this.z)&&T(r)&&(o=this.z/r)),this.x=n,this.y=i,T(o)&&(this.z=o),this},s.prototype.equal=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},s.prototype.like=function(t,e){if(void 0===e&&(e=.001),this.equal(t))return!0;var r=Math.abs(this.x-t.x)<e,n=Math.abs(this.y-t.y)<e,i=Math.abs((null!==(i=null!==(i=this.z)&&void 0!==i?i:t.z)&&void 0!==i?i:0)-(null!==(t=null!==(i=t.z)&&void 0!==i?i:this.z)&&void 0!==t?t:0))<e;return r&&n&&i},s.prototype.flipVertically=function(t){var e=t;return t instanceof s&&(e=t.y),this.y=e-this.y,this},Object.defineProperty(s.prototype,"likeRadians",{get:function(){return 0===C.length&&C.push(new s(-Math.PI,-Math.PI/2),new s(Math.PI,Math.PI/2)),C.simpleInclude(this)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"likeWorldGeodeticSystem",{get:function(){return 0===L.length&&L.push(new s(-180,-90),new s(180,90)),!this.likeRadians&&L.simpleInclude(this)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"likePseudoMercator",{get:function(){return 0===G.length&&G.push(new s(-20026376.39,-20048966.1),new s(20026376.39,20048966.1)),!this.likeRadians&&!this.likeWorldGeodeticSystem&&G.simpleInclude(this)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"w",{get:function(){return this.x},set:function(t){this.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"h",{get:function(){return this.y},set:function(t){this.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"area",{get:function(){return l("area").checkArgument("this").shouldBeMeters(this),this.w*this.h},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hip",{get:function(){return l("hip").checkArgument("this").shouldBeMeters(this),Math.sqrt(this.w*this.w+this.h*this.h)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"min",{get:function(){return Math.min(this.x,this.y)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"max",{get:function(){return Math.max(this.x,this.y)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hipPoint",{get:function(){var t=this.hip;return new s(t,t)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"xPoint",{get:function(){var t=this.x;return new s(t,t)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"yPoint",{get:function(){var t=this.y;return new s(t,t)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"wPoint",{get:function(){return this.xPoint},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hPoint",{get:function(){return this.yPoint},enumerable:!1,configurable:!0}),s.prototype.simple=function(t,e){var r;return void 0===e&&(e="y"),(r={})[t=void 0===t?"x":t]=this.x,r[e]=this.y,r},s.prototype.setIfLessThan=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},s.prototype.minus=function(){return this.scale(-1)},s.prototype.orthodromicPath=function(t,e){void 0===e&&(e=360),l("orthodromicPath").checkArgument("this").shouldBeDegree(this).checkArgument("point").shouldBeDegree(t);var r=this.clone().degreeToRadians(),n=t.clone().degreeToRadians(),i=Math.sin(n.x-r.x),o=(n.x-r.x)/(e-1);return new j(b(e).map(function(t,e){e=r.x+o*e;return new s(e,Math.atan(Math.tan(r.y)*Math.sin(n.x-e)/i+Math.tan(n.y)*Math.sin(e-r.x)/i)).radiansToDegrees()}))},s.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})},s);function s(t,e,r){void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this.z=r,this.properties={}}W.prototype.toString=function(){return"("+this.center.toString()+", "+this.r+")"},W.prototype.getValue=function(){return{center:this.center,r:this.r}},W.prototype.clone=function(){return new W(this.center,this.r)},W.prototype.findPoints=function(t){if(this.equal(t))return 1/0;var e=this.center,r=e.x,e=e.y,n=this.r,i=t.center,o=i.x,i=i.y,s=t.r,n=n*n,t=this.center.distance(t.center),s=(n-s*s+t*t)/(2*t),a=s/t,u=i-e,h=o-r,n=Math.sqrt(n-s*s)/t,s=r+a*(o-r),t=e+a*(i-e),o=s+n*u,r=t-n*h,a=s-n*u,i=t+n*h,e=[];return isNaN(o)||isNaN(r)||e.push(new M(o,r)),isNaN(a)||isNaN(i)||o===a&&r===i||e.push(new M(a,i)),e},W.prototype.equal=function(t){var e=t.center,t=t.r;return this.center.equal(e)&&this.r===t},W.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,i=[],o=e;o<r-n;)i.push(new M(this.r).scale(Math.cos(o),Math.sin(o)).move(this.center)),o+=n;t=this.r*Math.cos(r)+this.center.x,e=this.r*Math.sin(r)+this.center.y;return i.push(new M(t,e)),new j(i)},W.prototype.findPolygonInsideOnSphere=function(t,e,r){void 0===t&&(t=64),void 0===e&&(e=0),void 0===r&&(r=2*Math.PI),l("findPolygonInsideOnSphere").checkArgument("center").shouldBeDegree(this.center);for(var n=2*Math.PI/t,i=[],o=e;o<r-n;)i.push(this.sphereOffset(o)),o+=n;return i.push(this.sphereOffset(r)),new j(i)},W.prototype.sphereOffset=function(t,e){void 0===e&&(e=F);var r=this.center.clone().degreeToRadians(),n=r.x,r=r.y,e=this.r/e,i=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(i));return new M(n,i).radiansToDegrees()};var _=W;function W(t,e){void 0===t&&(t=M.zero()),void 0===e&&(e=0),this.center=t,this.r=e}var U=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.")},Z=(K.prototype.add=function(t){var e,r;try{for(var n=U(t),i=n.next();!i.done;i=n.next()){var o=i.value,s=o.x,a=o.y,u=o.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{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},K.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"])},K);function K(){this.searchStore={}}function H(t,e,r){return void 0===r&&(r=d.TraceMatrixValues.f),void 0===t[e.y]||void 0===t[e.y][e.x]?r:t[e.y][e.x]}function $(t,e,r){return void 0===t[e.y]||void 0===t[e.y][e.x]?r:(t[e.y][e.x]=r,t[e.y][e.x])}var J=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},Q=function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||((n=n||Array.prototype.slice.call(e,0,i))[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},tt=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.")},e=(d.TraceMatrixValues=void 0,(B=d.TraceMatrixValues||(d.TraceMatrixValues={}))[B.f=0]="f",B[B.t=1]="t",et.prototype.fullMatrixTrace=function(){var r=this,t=this.findAllGroupsInMatrix(this.m),n=t.map(function(t){return r.traceGroup(r.m,t)}),i=t.map(this.createHoleMatrix),o=i.map(function(t){return t&&r.findAllGroupsInMatrix(t)}),s=o.map(function(t,e){return t&&t.map(function(t){return r.traceGroup(i[e],t)}).filter(function(t){return 3<t.length})});return t.map(function(t,e){var r=n[e];return o[e]&&o[e].length&&(r.holes=s[e]),r})},et.prototype.reverseMatrix=function(e){return et.createMatrix(this.size,function(t){return H(e,t)===d.TraceMatrixValues.f?d.TraceMatrixValues.t:d.TraceMatrixValues.f})},et.prototype.findMarked=function(t,e){for(var r=this.size,n=!1,i=0;i<r.w;i++)for(var o=0;o<r.h;o++)if(n||!e){if(H(t,new M(i,o))===d.TraceMatrixValues.t)return new M(i,o)}else i=e.x,o=e.y,n=!0;return null},et.prototype.totalCountInMatrix=function(t){for(var e=0,r=this.size,n=0;n<r.w;n++)for(var i=0;i<r.h;i++)H(t,new M(n,i))&&e++;return e},et.createMatrix=function(e,n){return void 0===n&&(n=function(){return d.TraceMatrixValues.f}),b(e.h).map(function(t,r){return b(e.w).map(function(t,e){return n(new M(e,r))})})},et);function et(t,e){var p=this;this.size=t,this.findGroupByIndex=function(t,e){var r=new j;if(e&&H(t,e)===d.TraceMatrixValues.t){r.push(e);var n=0,i=et.createMatrix(p.size,function(){return d.TraceMatrixValues.f});for($(i,e,d.TraceMatrixValues.t);n<r.length;){for(var o=r.at(n),s=-1;s<2;s++)for(var a=-1;a<2;a++){var u=new M(o.x+s,o.y+a);H(i,u,d.TraceMatrixValues.t)===d.TraceMatrixValues.f&&H(t,u,d.TraceMatrixValues.f)===d.TraceMatrixValues.t&&(r.push(u),$(i,u,d.TraceMatrixValues.t))}n++}}return r},this.findAllGroupsInMatrix=function(t){var e=p.findMarked(t);if(!e)return[];var e=p.findGroupByIndex(t,e),r=[e],n=e.length,i=Q([],J(e.points),!1),o=new Z;for(o.add(i);n<p.totalCountInMatrix(t);){for(var s=p.findMarked(t);s&&o.find(s);)s=p.findMarked(t,s);var a=p.findGroupByIndex(t,s);n+=a.length,i=Q(Q([],J(i),!1),J(a.points),!1),o.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+i.length+1)%i.length}var n,i=[new M(-1,-1),new M(-1,0),new M(-1,1),new M(0,1),new M(1,1),new M(1,0),new M(1,-1),new M(0,-1)];if(e.length<2)return n=e.at(0).clone(),new j([n,n,n]);for(var o=new j,s=0,a=1/0,u=e.at(0);!u.equal(e.at(0))||o.length<2;){for(;;){var h=H(t,u.clone().move(i[s])),c=H(t,u.clone().move(i[r(s)]));if(h===d.TraceMatrixValues.t&&c===d.TraceMatrixValues.f)break;s=(s+i.length-1)%i.length}a!==s&&(o.push(u),a=s),u=u.clone().move(i[s]),s=r(r(s))}return o.approximation().close()},this.createHoleMatrix=function(e){for(var r,t,c=[new M(-1,0),new M(0,1),new M(1,0),new M(0,-1)],n=(e.prepareToFastSearch(),et.createMatrix(p.size,function(t){return e.fastHas(t)?d.TraceMatrixValues.t:d.TraceMatrixValues.f})),i=new j,o=0;o<p.size.w;o++)i.push(new M(o,-1)),i.push(new M(o,p.size.h));for(o=0;o<p.size.h;o++)i.push(new M(-1,o)),i.push(new M(p.size.w,o));for(;i.length;){var l=i.pop();try{r=void 0;for(var s=tt(c),a=s.next();!a.done;a=s.next()){var f=a.value,u=l.clone().move(f);H(n,u,d.TraceMatrixValues.t)===d.TraceMatrixValues.f&&($(n,u,d.TraceMatrixValues.t),i.push(u))}}catch(t){r={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(r)throw r.error}}}var h=p.reverseMatrix(n);return p.totalCountInMatrix(h)?h:null},this.m=et.createMatrix(this.size,e)}var rt=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},A=(nt.find=function(t,e,r){if(t.x===e.x&&e.x===r.x)return new nt(1,0,0,-t.x,t,e,r);if(t.y===e.y&&e.y===r.y)return new nt(0,1,0,-t.y,t,e,r);if(t.z===e.z&&e.z===r.z)return new nt(0,0,1,-t.z,t,e,r);var n=rt(p([[t.x,t.y,t.z,-1],[e.x,e.y,e.z,-1],[r.x,r.y,r.z,-1]]),3);return new nt(n[0],n[1],n[2],1,t,e,r)},nt.prototype.x=function(t){var e,r,n,i,o,s,a=this;return t instanceof M?(e=this.a,r=this.b,n=this.c,i=this.d,o=t.y,s=t.z,t.x=-(r*o+n*s+i)/e,t):t.map(function(t){return a.x(t)})},nt.prototype.y=function(t){var e,r,n,i,o,s,a=this;return t instanceof M?(e=this.a,r=this.b,n=this.c,i=this.d,o=t.x,s=t.z,t.y=-(e*o+n*s+i)/r,t):t.map(function(t){return a.y(t)})},nt.prototype.z=function(t){var e,r,n,i,o,s,a=this;return t instanceof M?(e=this.a,r=this.b,n=this.c,i=this.d,o=t.x,s=t.y,t.z=-(e*o+r*s+i)/n,t):t.map(function(t){return a.z(t)})},nt.prototype.clone=function(){var t=this;return new nt(t.a,t.b,t.c,t.d,t.p1,t.p2,t.p3)},nt.prototype.distance=function(t){var e,r;if(t instanceof M)return n=t.x,i=t.y,o=t.z,a=this.a,e=this.b,r=this.c,s=this.d,Math.abs(a*n+e*i+r*o+s)/Math.sqrt(a*a+e*e+r*r);var n=t.a,i=t.b,o=t.c,s=t.d,a=this.d;return Math.abs(s-a)/Math.sqrt(n*n+i*i+o*o)},nt.prototype.equal=function(t){var e=t.a,r=t.b,n=t.c,t=t.d,i=this.a,o=this.b,s=this.c,a=this.d;return h.like(e,i)&&h.like(r,o)&&h.like(n,s)&&h.like(t,a)},nt.prototype.same=function(t){var e=t.a,r=t.b,n=t.c,t=t.d,i=this.a,o=this.b,e=e/i,i=n/this.c,t=t/this.d;return h.like(e,r/o)&&h.like(e,i)&&h.like(e,n)&&h.like(e,t)},nt.prototype.parallel=function(t){var e=t.a,r=t.b,n=t.c,t=t.d,i=this.a,o=this.b,e=e/i,i=n/this.c,t=t/this.d;return h.like(e,r/o)&&h.like(e,i)&&h.like(e,n)&&!h.like(e,t)},nt);function nt(t,e,r,n,i,o,s){void 0===i&&(i=M.zero()),void 0===o&&(o=M.zero()),void 0===s&&(s=M.zero()),this.a=t,this.b=e,this.c=r,this.d=n,this.p1=i,this.p2=o,this.p3=s}d.DCircle=_,d.DEGREE_TO_PI=V,d.DGeo=P,d.DLine=k,d.DNumbers=h,d.DOUBLE_PI_IN_DEGREE=q,d.DPlane=A,d.DPoint=M,d.DPolygon=j,d.DPolygonLoop=i,d.EARTH_RADIUS_IN_METERS=F,d.FastSearch=Z,d.HALF_PI_IN_DEGREE=90,d.MIN_POINTS_IN_VALID_POLYGON=3,d.PI_IN_DEGREE=E,d.PI_TO_DEGREE=X,d.TraceMatrix=e,d.cartesianProduct=g,d.createArray=b,d.createCanvas=y,d.createMatrix=f,d.gaussianElimination=p,d.getCombinations=o,d.isDefAndNotNull=T,Object.defineProperty(d,"__esModule",{value:!0})});
|