Newer
Older
smartwell_front_dz / smartwell / static / js / chunk-libs-902a5e40.4a00b5d9.js
wangxitong on 11 Sep 2023 25 KB first commit
(self["webpackChunknewfront"]=self["webpackChunknewfront"]||[]).push([[4404],{32676:function(t,e,n){var r=n(34155);(function(e,n){t.exports=n()})(0,(function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function n(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}
/**
   * splaytree v3.1.0
   * Fast Splay tree for Node and browser
   *
   * @author Alexander Milevski <info@w8r.name>
   * @license MIT
   * @preserve
   */var i=function(){function t(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null}return t}();function o(t,e){return t>e?1:t<e?-1:0}function s(t,e,n){var r=new i(null,null),o=r,s=r;while(1){var l=n(t,e.key);if(l<0){if(null===e.left)break;if(n(t,e.left.key)<0){var u=e.left;if(e.left=u.right,u.right=e,e=u,null===e.left)break}s.left=e,s=e,e=e.left}else{if(!(l>0))break;if(null===e.right)break;if(n(t,e.right.key)>0){u=e.right;if(e.right=u.left,u.left=e,e=u,null===e.right)break}o.right=e,o=e,e=e.right}}return o.right=e.left,s.left=e.right,e.left=r.right,e.right=r.left,e}function l(t,e,n,r){var o=new i(t,e);if(null===n)return o.left=o.right=null,o;n=s(t,n,r);var l=r(t,n.key);return l<0?(o.left=n.left,o.right=n,n.left=null):l>=0&&(o.right=n.right,o.left=n,n.right=null),o}function u(t,e,n){var r=null,i=null;if(e){e=s(t,e,n);var o=n(e.key,t);0===o?(r=e.left,i=e.right):o<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function h(t,e,n){return null===e?t:(null===t||(e=s(t.key,e,n),e.left=t),e)}function f(t,e,n,r,i){if(t){r(e+(n?"└── ":"├── ")+i(t)+"\n");var o=e+(n?"    ":"│   ");t.left&&f(t.left,o,!1,r,i),t.right&&f(t.right,o,!0,r,i)}}var a=function(){function t(t){void 0===t&&(t=o),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=l(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var n=new i(t,e);null===this._root&&(n.left=n.right=null,this._size++,this._root=n);var r=this._comparator,o=s(t,this._root,r),l=r(t,o.key);return 0===l?this._root=o:(l<0?(n.left=o.left,n.right=o,o.left=null):l>0&&(n.right=o.right,n.left=o,o.right=null),this._size++,this._root=n),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,n){var r;if(null===e)return null;e=s(t,e,n);var i=n(t,e.key);return 0===i?(null===e.left?r=e.right:(r=s(t,e.left,n),r.right=e.right),this._size--,r):e},t.prototype.pop=function(){var t=this._root;if(t){while(t.left)t=t.left;return this._root=s(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){var e=this._root,n=this._comparator;while(e){var r=n(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=s(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){var e=this._root,n=this._comparator;while(e){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){var n=this._root,r=[],i=!1;while(!i)null!==n?(r.push(n),n=n.left):0!==r.length?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this},t.prototype.range=function(t,e,n,r){var i,o=[],s=this._comparator,l=this._root;while(0!==o.length||l)if(l)o.push(l),l=l.left;else{if(l=o.pop(),i=s(l.key,e),i>0)break;if(s(l.key,t)>=0&&n.call(r,l))return this;l=l.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var n=e.key;return t.push(n)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var n=e.data;return t.push(n)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)while(t.left)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)while(t.right)t=t.right;return t},t.prototype.at=function(t){var e=this._root,n=!1,r=0,i=[];while(!n)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},t.prototype.next=function(t){var e=this._root,n=null;if(t.right){n=t.right;while(n.left)n=n.left;return n}var r=this._comparator;while(e){var i=r(t.key,e.key);if(0===i)break;i<0?(n=e,e=e.left):e=e.right}return n},t.prototype.prev=function(t){var e=this._root,n=null;if(null!==t.left){n=t.left;while(n.right)n=n.right;return n}var r=this._comparator;while(e){var i=r(t.key,e.key);if(0===i)break;i<0?e=e.left:(n=e,e=e.right)}return n},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return g(this._root)},t.prototype.load=function(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=!1);var r=t.length,i=this._comparator;if(n&&x(t,e,0,r-1,i),null===this._root)this._root=p(t,e,0,r),this._size=r;else{var o=c(this.toList(),y(t,e),i);r=this._size+r,this._root=v({head:o},0,r)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return f(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,n){var r=this._comparator,i=u(t,this._root,r),o=i.left,s=i.right;r(t,e)<0?s=l(e,n,s,r):o=l(e,n,o,r),this._root=h(o,s,r)},t.prototype.split=function(t){return u(t,this._root,this._comparator)},t}();function p(t,e,n,r){var o=r-n;if(o>0){var s=n+Math.floor(o/2),l=t[s],u=e[s],h=new i(l,u);return h.left=p(t,e,n,s),h.right=p(t,e,s+1,r),h}return null}function y(t,e){for(var n=new i(null,null),r=n,o=0;o<t.length;o++)r=r.next=new i(t[o],e[o]);return r.next=null,n.next}function g(t){var e=t,n=[],r=!1,o=new i(null,null),s=o;while(!r)e?(n.push(e),e=e.left):n.length>0?(e=s=s.next=n.pop(),e=e.right):r=!0;return s.next=null,o.next}function v(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=v(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=v(t,i+1,n),s}return null}function c(t,e,n){var r=new i(null,null),o=r,s=t,l=e;while(null!==s&&null!==l)n(s.key,l.key)<0?(o.next=s,s=s.next):(o.next=l,l=l.next),o=o.next;return null!==s?o.next=s:null!==l&&(o.next=l),r.next}function x(t,e,n,r,i){if(!(n>=r)){var o=t[n+r>>1],s=n-1,l=r+1;while(1){do{s++}while(i(t[s],o)<0);do{l--}while(i(t[l],o)>0);if(s>=l)break;var u=t[s];t[s]=t[l],t[l]=u,u=e[s],e[s]=e[l],e[l]=u}x(t,e,n,l,i),x(t,e,l+1,r,i)}}var b=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},m=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var n=t.ll.x<e.ll.x?e.ll.x:t.ll.x,r=t.ur.x<e.ur.x?t.ur.x:e.ur.x,i=t.ll.y<e.ll.y?e.ll.y:t.ll.y,o=t.ur.y<e.ur.y?t.ur.y:e.ur.y;return{ll:{x:n,y:i},ur:{x:r,y:o}}},E=Number.EPSILON;void 0===E&&(E=Math.pow(2,-52));var d=E*E,w=function(t,e){if(-E<t&&t<E&&-E<e&&e<E)return 0;var n=t-e;return n*n<d*t*e?0:t<e?-1:1},S=function(){function e(){t(this,e),this.reset()}return n(e,[{key:"reset",value:function(){this.xRounder=new _,this.yRounder=new _}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),e}(),_=function(){function e(){t(this,e),this.tree=new a,this.round(0)}return n(e,[{key:"round",value:function(t){var e=this.tree.add(t),n=this.tree.prev(e);if(null!==n&&0===w(e.key,n.key))return this.tree.remove(t),n.key;var r=this.tree.next(e);return null!==r&&0===w(e.key,r.key)?(this.tree.remove(t),r.key):t}}]),e}(),k=new S,R=function(t,e){return t.x*e.y-t.y*e.x},I=function(t,e){return t.x*e.x+t.y*e.y},P=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y},o=R(r,i);return w(o,0)},N=function(t){return Math.sqrt(I(t,t))},O=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return R(i,r)/N(i)/N(r)},A=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return I(i,r)/N(i)/N(r)},L=function(t,e,n){return 0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n}},z=function(t,e,n){return 0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)}},B=function(t,e,n,r){if(0===e.x)return z(n,r,t.x);if(0===r.x)return z(t,e,n.x);if(0===e.y)return L(n,r,t.y);if(0===r.y)return L(t,e,n.y);var i=R(e,r);if(0==i)return null;var o={x:n.x-t.x,y:n.y-t.y},s=R(o,e)/i,l=R(o,r)/i,u=t.x+l*e.x,h=n.x+s*r.x,f=t.y+l*e.y,a=n.y+s*r.y,p=(u+h)/2,y=(f+a)/2;return{x:p,y}},M=function(){function e(n,r){t(this,e),void 0===n.events?n.events=[this]:n.events.push(this),this.point=n,this.isLeft=r}return n(e,null,[{key:"compare",value:function(t,n){var r=e.comparePoints(t.point,n.point);return 0!==r?r:(t.point!==n.point&&t.link(n),t.isLeft!==n.isLeft?t.isLeft?1:-1:T.compare(t.segment,n.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),n(e,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,n=0,r=e.length;n<r;n++){var i=e[n];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var n=this.point.events[e];if(void 0===n.segment.consumedBy)for(var r=e+1;r<t;r++){var i=this.point.events[r];void 0===i.consumedBy&&(n.otherSE.point.events===i.otherSE.point.events&&n.segment.consume(i.segment))}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,n=this.point.events.length;e<n;e++){var r=this.point.events[e];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&t.push(r)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,n=new Map,r=function(r){var i=r.otherSE;n.set(r,{sine:O(e.point,t.point,i.point),cosine:A(e.point,t.point,i.point)})};return function(t,e){n.has(t)||r(t),n.has(e)||r(e);var i=n.get(t),o=i.sine,s=i.cosine,l=n.get(e),u=l.sine,h=l.cosine;return o>=0&&u>=0?s<h?1:s>h?-1:0:o<0&&u<0?s<h?-1:s>h?1:0:u<o?-1:u>o?1:0}}}]),e}(),G=0,T=function(){function e(n,r,i,o){t(this,e),this.id=++G,this.leftSE=n,n.segment=this,n.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=n,this.rings=i,this.windings=o}return n(e,null,[{key:"compare",value:function(t,e){var n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<n)return 1;if(i<r)return-1;var s=t.leftSE.point.y,l=e.leftSE.point.y,u=t.rightSE.point.y,h=e.rightSE.point.y;if(n<r){if(l<s&&l<u)return 1;if(l>s&&l>u)return-1;var f=t.comparePoint(e.leftSE.point);if(f<0)return 1;if(f>0)return-1;var a=e.comparePoint(t.rightSE.point);return 0!==a?a:-1}if(n>r){if(s<l&&s<h)return-1;if(s>l&&s>h)return 1;var p=e.comparePoint(t.leftSE.point);if(0!==p)return p;var y=t.comparePoint(e.rightSE.point);return y<0?1:y>0?-1:1}if(s<l)return-1;if(s>l)return 1;if(i<o){var g=e.comparePoint(t.rightSE.point);if(0!==g)return g}if(i>o){var v=t.comparePoint(e.rightSE.point);if(v<0)return 1;if(v>0)return-1}if(i!==o){var c=u-s,x=i-n,b=h-l,m=o-r;if(c>x&&b<m)return 1;if(c<x&&b>m)return-1}return i>o?1:i<o||u<h?-1:u>h?1:t.id<e.id?-1:t.id>e.id?1:0}}]),n(e,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,n=this.rightSE.point,r=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/r.y,o=e.x+i*r.x;if(t.x===o)return 0;var s=(t.x-e.x)/r.x,l=e.y+s*r.y;return t.y===l?0:t.y<l?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),n=t.bbox(),r=m(e,n);if(null===r)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,l=t.rightSE.point,u=b(e,s)&&0===this.comparePoint(s),h=b(n,i)&&0===t.comparePoint(i),f=b(e,l)&&0===this.comparePoint(l),a=b(n,o)&&0===t.comparePoint(o);if(h&&u)return a&&!f?o:!a&&f?l:null;if(h)return f&&i.x===l.x&&i.y===l.y?null:i;if(u)return a&&o.x===s.x&&o.y===s.y?null:s;if(a&&f)return null;if(a)return o;if(f)return l;var p=B(i,this.vector(),s,t.vector());return null===p?null:b(r,p)?k.round(p.x,p.y):null}},{key:"split",value:function(t){var n=[],r=void 0!==t.events,i=new M(t,!0),o=new M(t,!1),s=this.rightSE;this.replaceRightSE(o),n.push(o),n.push(i);var l=new e(i,s,this.rings.slice(),this.windings.slice());return M.comparePoints(l.leftSE.point,l.rightSE.point)>0&&l.swapEvents(),M.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,n=this.windings.length;e<n;e++)this.windings[e]*=-1}},{key:"consume",value:function(t){var n=this,r=t;while(n.consumedBy)n=n.consumedBy;while(r.consumedBy)r=r.consumedBy;var i=e.compare(n,r);if(0!==i){if(i>0){var o=n;n=r,r=o}if(n.prev===r){var s=n;n=r,r=s}for(var l=0,u=r.rings.length;l<u;l++){var h=r.rings[l],f=r.windings[l],a=n.rings.indexOf(h);-1===a?(n.rings.push(h),n.windings.push(f)):n.windings[a]+=f}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],l=this.windings[i],u=e.indexOf(s);-1===u?(e.push(s),n.push(l)):n[u]+=l}for(var h=[],f=[],a=0,p=e.length;a<p;a++)if(0!==n[a]){var y=e[a],g=y.poly;if(-1===f.indexOf(g))if(y.isExterior)h.push(g);else{-1===f.indexOf(g)&&f.push(g);var v=h.indexOf(y.poly);-1!==v&&h.splice(v,1)}}for(var c=0,x=h.length;c<x;c++){var b=h[c].multiPoly;-1===r.indexOf(b)&&r.push(b)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(W.type){case"union":var n=0===t.length,r=0===e.length;this._isInResult=n!==r;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===W.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2===1;break;case"difference":var l=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=l(t)!==l(e);break;default:throw new Error("Unrecognized operation type found ".concat(W.type))}return this._isInResult}}],[{key:"fromRing",value:function(t,n,r){var i,o,s,l=M.comparePoints(t,n);if(l<0)i=t,o=n,s=1;else{if(!(l>0))throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));i=n,o=t,s=-1}var u=new M(i,!0),h=new M(o,!1);return new e(u,h,[r],[s])}}]),e}(),C=function(){function e(n,r,i){if(t(this,e),!Array.isArray(n)||0===n.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=i,this.segments=[],"number"!==typeof n[0][0]||"number"!==typeof n[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var o=k.round(n[0][0],n[0][1]);this.bbox={ll:{x:o.x,y:o.y},ur:{x:o.x,y:o.y}};for(var s=o,l=1,u=n.length;l<u;l++){if("number"!==typeof n[l][0]||"number"!==typeof n[l][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var h=k.round(n[l][0],n[l][1]);h.x===s.x&&h.y===s.y||(this.segments.push(T.fromRing(s,h,this)),h.x<this.bbox.ll.x&&(this.bbox.ll.x=h.x),h.y<this.bbox.ll.y&&(this.bbox.ll.y=h.y),h.x>this.bbox.ur.x&&(this.bbox.ur.x=h.x),h.y>this.bbox.ur.y&&(this.bbox.ur.y=h.y),s=h)}o.x===s.x&&o.y===s.y||this.segments.push(T.fromRing(s,o,this))}return n(e,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.segments.length;e<n;e++){var r=this.segments[e];t.push(r.leftSE),t.push(r.rightSE)}return t}}]),e}(),q=function(){function e(n,r){if(t(this,e),!Array.isArray(n))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new C(n[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var i=1,o=n.length;i<o;i++){var s=new C(n[i],this,!1);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.interiorRings.push(s)}this.multiPoly=r}return n(e,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,n=this.interiorRings.length;e<n;e++)for(var r=this.interiorRings[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),e}(),F=function(){function e(n,r){if(t(this,e),!Array.isArray(n))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"===typeof n[0][0][0]&&(n=[n])}catch(l){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var i=0,o=n.length;i<o;i++){var s=new q(n[i],this);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.polys.push(s)}this.isSubject=r}return n(e,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++)for(var r=this.polys[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),e}(),U=function(){function e(n){t(this,e),this.events=n;for(var r=0,i=n.length;r<i;r++)n[r].segment.ringOut=this;this.poly=null}return n(e,null,[{key:"factory",value:function(t){for(var n=[],r=0,i=t.length;r<i;r++){var o=t[r];if(o.isInResult()&&!o.ringOut){var s=null,l=o.leftSE,u=o.rightSE,h=[l],f=l.point,a=[];while(1){if(s=l,l=u,h.push(l),l.point===f)break;while(1){var p=l.getAvailableLinkedEvents();if(0===p.length){var y=h[0].point,g=h[h.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(y.x,",")+" ".concat(y.y,"]. Last matching segment found ends at")+" [".concat(g.x,", ").concat(g.y,"]."))}if(1===p.length){u=p[0].otherSE;break}for(var v=null,c=0,x=a.length;c<x;c++)if(a[c].point===l.point){v=c;break}if(null===v){a.push({index:h.length,point:l.point});var b=l.getLeftmostComparator(s);u=p.sort(b)[0].otherSE;break}var m=a.splice(v)[0],E=h.splice(m.index);E.unshift(E[0].otherSE),n.push(new e(E.reverse()))}}n.push(new e(h))}}return n}}]),n(e,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],n=1,r=this.events.length-1;n<r;n++){var i=this.events[n].point,o=this.events[n+1].point;0!==P(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],l=e[1];0===P(s,t,l)&&e.shift(),e.push(e[0]);for(var u=this.isExteriorRing()?1:-1,h=this.isExteriorRing()?0:e.length-1,f=this.isExteriorRing()?e.length:-1,a=[],p=h;p!=f;p+=u)a.push([e[p].x,e[p].y]);return a}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,n=this.events.length;e<n;e++){var r=this.events[e];M.compare(t,r)>0&&(t=r)}var i=t.segment.prevInResult(),o=i?i.prevInResult():null;while(1){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),e}(),j=function(){function e(n){t(this,e),this.exteriorRing=n,n.poly=this,this.interiorRings=[]}return n(e,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,n=this.interiorRings.length;e<n;e++){var r=this.interiorRings[e].getGeom();null!==r&&t.push(r)}return t}}]),e}(),V=function(){function e(n){t(this,e),this.rings=n,this.polys=this._composePolys(n)}return n(e,[{key:"getGeom",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++){var r=this.polys[e].getGeom();null!==r&&t.push(r)}return t}},{key:"_composePolys",value:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];if(!i.poly)if(i.isExteriorRing())e.push(new j(i));else{var o=i.enclosingRing();o.poly||e.push(new j(o)),o.poly.addInterior(i)}}return e}}]),e}(),Y=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:T.compare;t(this,e),this.queue=n,this.tree=new a(r),this.segments=[]}return n(e,[{key:"process",value:function(t){var e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;var r=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!r)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");var i=r,o=r,s=void 0,l=void 0;while(void 0===s)i=this.tree.prev(i),null===i?s=null:void 0===i.key.consumedBy&&(s=i.key);while(void 0===l)o=this.tree.next(o),null===o?l=null:void 0===o.key.consumedBy&&(l=o.key);if(t.isLeft){var u=null;if(s){var h=s.getIntersection(e);if(null!==h&&(e.isAnEndpoint(h)||(u=h),!s.isAnEndpoint(h)))for(var f=this._splitSafely(s,h),a=0,p=f.length;a<p;a++)n.push(f[a])}var y=null;if(l){var g=l.getIntersection(e);if(null!==g&&(e.isAnEndpoint(g)||(y=g),!l.isAnEndpoint(g)))for(var v=this._splitSafely(l,g),c=0,x=v.length;c<x;c++)n.push(v[c])}if(null!==u||null!==y){var b=null;if(null===u)b=y;else if(null===y)b=u;else{var m=M.comparePoints(u,y);b=m<=0?u:y}this.queue.remove(e.rightSE),n.push(e.rightSE);for(var E=e.split(b),d=0,w=E.length;d<w;d++)n.push(E[d])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&l){var S=s.getIntersection(l);if(null!==S){if(!s.isAnEndpoint(S))for(var _=this._splitSafely(s,S),k=0,R=_.length;k<R;k++)n.push(_[k]);if(!l.isAnEndpoint(S))for(var I=this._splitSafely(l,S),P=0,N=I.length;P<N;P++)n.push(I[P])}}this.tree.remove(e)}return n}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var n=t.rightSE;this.queue.remove(n);var r=t.split(e);return r.push(n),void 0===t.consumedBy&&this.tree.insert(t),r}}]),e}(),D="undefined"!==typeof r&&{NODE_ENV:"production",BASE_URL:""}.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,X="undefined"!==typeof r&&{NODE_ENV:"production",BASE_URL:""}.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Q=function(){function e(){t(this,e)}return n(e,[{key:"run",value:function(t,e,n){W.type=t,k.reset();for(var r=[new F(e,!0)],i=0,o=n.length;i<o;i++)r.push(new F(n[i],!1));if(W.numMultiPolys=r.length,"difference"===W.type){var s=r[0],l=1;while(l<r.length)null!==m(r[l].bbox,s.bbox)?l++:r.splice(l,1)}if("intersection"===W.type)for(var u=0,h=r.length;u<h;u++)for(var f=r[u],p=u+1,y=r.length;p<y;p++)if(null===m(f.bbox,r[p].bbox))return[];for(var g=new a(M.compare),v=0,c=r.length;v<c;v++)for(var x=r[v].getSweepEvents(),b=0,E=x.length;b<E;b++)if(g.insert(x[b]),g.size>D)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");var d=new Y(g),w=g.size,S=g.pop();while(S){var _=S.key;if(g.size===w){var R=_.segment;throw new Error("Unable to pop() ".concat(_.isLeft?"left":"right"," SweepEvent ")+"[".concat(_.point.x,", ").concat(_.point.y,"] from segment #").concat(R.id," ")+"[".concat(R.leftSE.point.x,", ").concat(R.leftSE.point.y,"] -> ")+"[".concat(R.rightSE.point.x,", ").concat(R.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(g.size>D)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(d.segments.length>X)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var I=d.process(_),P=0,N=I.length;P<N;P++){var O=I[P];void 0===O.consumedBy&&g.insert(O)}w=g.size,S=g.pop()}k.reset();var A=U.factory(d.segments),L=new V(A);return L.getGeom()}}]),e}(),W=new Q,Z=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return W.run("union",t,n)},H=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return W.run("intersection",t,n)},J=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return W.run("xor",t,n)},K=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return W.run("difference",t,n)},$={union:Z,intersection:H,xor:J,difference:K};return $}))}}]);