!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).turf=t()}}((function(){return function t(e,i,r){function n(a,o){if(!i[a]){if(!e[a]){var h="function"==typeof require&&require;if(!o&&h)return h(a,!0);if(s)return s(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=i[a]={exports:{}};e[a][0].call(l.exports,(function(t){return n(e[a][1][t]||t)}),l,l.exports,t,e,i,r)}return i[a].exports}for(var s="function"==typeof require&&require,a=0;a=u&&l===r.length-1);l++){if(u>=e){var c=e-u;if(c){var f=n.default(r[l],r[l-1])-180;return s.default(r[l],c,f,i)}return o.point(r[l])}u+=a.default(r[l],r[l+1],i)}return o.point(r[r.length-1])}},{"@turf/bearing":4,"@turf/destination":8,"@turf/distance":9,"@turf/helpers":11,"@turf/invariant":12}],3:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=t("@turf/meta");function n(t){var e=[1/0,1/0,-1/0,-1/0];r.coordEach(t,(function(t){e[0]>t[0]&&(e[0]=t[0]);e[1]>t[1]&&(e[1]=t[1]);e[2]=t[0]&&e[3]>=t[1]}(s,h))return!1;"Polygon"===o&&(u=[u]);for(var l=!1,c=0;ct[1]!=u>t[1]&&t[0]<(h-a)*(t[1]-o)/(u-o)+a&&(r=!r)}return r}},{"@turf/invariant":12}],6:[function(t,e,i){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(i,"__esModule",{value:!0});var n=r(t("@turf/bbox")),s=t("@turf/helpers");i.default=function(t,e){void 0===e&&(e={});var i=n.default(t),r=(i[0]+i[2])/2,a=(i[1]+i[3])/2;return s.point([r,a],e.properties,e)}},{"@turf/bbox":3,"@turf/helpers":11}],7:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});function r(t){var e={type:"Feature"};Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}}));e.properties=n(t.properties);e.geometry=s(t.geometry);return e}function n(t){var e={};if(!t)return e;Object.keys(t).forEach((function(i){var r=t[i];"object"==typeof r?null===r?e[i]=null:Array.isArray(r)?e[i]=r.map((function(t){return t})):e[i]=n(r):e[i]=r}));return e}function s(t){var e={type:t.type};t.bbox&&(e.bbox=t.bbox);if("GeometryCollection"===t.type){e.geometries=t.geometries.map((function(t){return s(t)}));return e}e.coordinates=a(t.coordinates);return e}function a(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return a(t)}))}i.default=function(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return r(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}}));e.features=t.features.map((function(t){return r(t)}));return e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return s(t);default:throw new Error("unknown GeoJSON type")}}},{}],8:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=t("@turf/helpers"),n=t("@turf/invariant");i.default=function(t,e,i,s){void 0===s&&(s={});var a=n.getCoord(t),o=r.degreesToRadians(a[0]),h=r.degreesToRadians(a[1]),u=r.degreesToRadians(i),l=r.lengthToRadians(e,s.units),c=Math.asin(Math.sin(h)*Math.cos(l)+Math.cos(h)*Math.sin(l)*Math.cos(u)),f=o+Math.atan2(Math.sin(u)*Math.sin(l)*Math.cos(h),Math.cos(l)-Math.sin(h)*Math.sin(c)),p=r.radiansToDegrees(f),d=r.radiansToDegrees(c);return r.point([p,d],s.properties)}},{"@turf/helpers":11,"@turf/invariant":12}],9:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=t("@turf/invariant"),n=t("@turf/helpers");i.default=function(t,e,i){void 0===i&&(i={});var s=r.getCoord(t),a=r.getCoord(e),o=n.degreesToRadians(a[1]-s[1]),h=n.degreesToRadians(a[0]-s[0]),u=n.degreesToRadians(s[1]),l=n.degreesToRadians(a[1]),c=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(h/2),2)*Math.cos(u)*Math.cos(l);return n.radiansToLength(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),i.units)}},{"@turf/helpers":11,"@turf/invariant":12}],10:[function(t,e,i){"use strict";var r=t("@turf/meta"),n=t("@turf/helpers");function s(t){var e=[];"FeatureCollection"===t.type?r.featureEach(t,(function(t){r.coordEach(t,(function(i){e.push(n.point(i,t.properties))}))})):r.coordEach(t,(function(i){e.push(n.point(i,t.properties))}));return n.featureCollection(e)}e.exports=s;e.exports.default=s},{"@turf/helpers":11,"@turf/meta":16}],11:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.earthRadius=6371008.8;i.factors={centimeters:100*i.earthRadius,centimetres:100*i.earthRadius,degrees:i.earthRadius/111325,feet:3.28084*i.earthRadius,inches:39.37*i.earthRadius,kilometers:i.earthRadius/1e3,kilometres:i.earthRadius/1e3,meters:i.earthRadius,metres:i.earthRadius,miles:i.earthRadius/1609.344,millimeters:1e3*i.earthRadius,millimetres:1e3*i.earthRadius,nauticalmiles:i.earthRadius/1852,radians:1,yards:1.0936*i.earthRadius};i.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/i.earthRadius,yards:1.0936133};i.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function r(t,e,i){void 0===i&&(i={});var r={type:"Feature"};(0===i.id||i.id)&&(r.id=i.id);i.bbox&&(r.bbox=i.bbox);r.properties=e||{};r.geometry=t;return r}i.feature=r;i.geometry=function(t,e,i){void 0===i&&(i={});switch(t){case"Point":return n(e).geometry;case"LineString":return a(e).geometry;case"Polygon":return s(e).geometry;case"MultiPoint":return u(e).geometry;case"MultiLineString":return h(e).geometry;case"MultiPolygon":return l(e).geometry;default:throw new Error(t+" is invalid")}};function n(t,e,i){void 0===i&&(i={});if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!d(t[0])||!d(t[1]))throw new Error("coordinates must contain numbers");return r({type:"Point",coordinates:t},e,i)}i.point=n;i.points=function(t,e,i){void 0===i&&(i={});return o(t.map((function(t){return n(t,e)})),i)};function s(t,e,i){void 0===i&&(i={});for(var n=0,s=t;n=0))throw new Error("precision must be a positive number");var i=Math.pow(10,e||0);return Math.round(t*i)/i};function c(t,e){void 0===e&&(e="kilometers");var r=i.factors[e];if(!r)throw new Error(e+" units is invalid");return t*r}i.radiansToLength=c;function f(t,e){void 0===e&&(e="kilometers");var r=i.factors[e];if(!r)throw new Error(e+" units is invalid");return t/r}i.lengthToRadians=f;i.lengthToDegrees=function(t,e){return p(f(t,e))};i.bearingToAzimuth=function(t){var e=t%360;e<0&&(e+=360);return e};function p(t){return 180*(t%(2*Math.PI))/Math.PI}i.radiansToDegrees=p;i.degreesToRadians=function(t){return t%360*Math.PI/180};i.convertLength=function(t,e,i){void 0===e&&(e="kilometers");void 0===i&&(i="kilometers");if(!(t>=0))throw new Error("length must be a positive number");return c(f(t,e),i)};i.convertArea=function(t,e,r){void 0===e&&(e="meters");void 0===r&&(r="kilometers");if(!(t>=0))throw new Error("area must be a positive number");var n=i.areaFactors[e];if(!n)throw new Error("invalid original units");var s=i.areaFactors[r];if(!s)throw new Error("invalid final units");return t/n*s};function d(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}i.isNumber=d;i.isObject=function(t){return!!t&&t.constructor===Object};i.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!d(t))throw new Error("bbox must only contain numbers")}))};i.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}},{}],12:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=t("@turf/helpers");i.getCoord=function(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")};i.getCoords=function(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")};i.containsNumber=function t(e){if(e.length>1&&r.isNumber(e[0])&&r.isNumber(e[1]))return!0;if(Array.isArray(e[0])&&e[0].length)return t(e[0]);throw new Error("coordinates must only contain numbers")};i.geojsonType=function(t,e,i){if(!e||!i)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+i+": must be a "+e+", given "+t.type)};i.featureOf=function(t,e,i){if(!t)throw new Error("No feature passed");if(!i)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+i+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+i+": must be a "+e+", given "+t.geometry.type)};i.collectionOf=function(t,e,i){if(!t)throw new Error("No featureCollection passed");if(!i)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+i+", FeatureCollection required");for(var r=0,n=t.features;r line1 must only contain 2 coordinates");if(2!==r.length)throw new Error(" line2 must only contain 2 coordinates");var a=i[0][0],o=i[0][1],h=i[1][0],u=i[1][1],l=r[0][0],c=r[0][1],f=r[1][0],p=r[1][1],d=(p-c)*(h-a)-(f-l)*(u-o),m=(f-l)*(o-c)-(p-c)*(a-l),y=(h-a)*(o-c)-(u-o)*(a-l);if(0===d)return null;var g=m/d,_=y/d;if(g>=0&&g<=1&&_>=0&&_<=1){var v=a+g*(h-a),b=o+g*(u-o);return n.point([v,b])}return null}i.default=function(t,e){var i={},r=[];"LineString"===t.type&&(t=n.feature(t));"LineString"===e.type&&(e=n.feature(e));if("Feature"===t.type&&"Feature"===e.type&&null!==t.geometry&&null!==e.geometry&&"LineString"===t.geometry.type&&"LineString"===e.geometry.type&&2===t.geometry.coordinates.length&&2===e.geometry.coordinates.length){var l=u(t,e);l&&r.push(l);return n.featureCollection(r)}var c=h.default();c.load(a.default(e));o.featureEach(a.default(t),(function(t){o.featureEach(c.search(t),(function(e){var n=u(t,e);if(n){var a=s.getCoords(n).join(",");if(!i[a]){i[a]=!0;r.push(n)}}}))}));return n.featureCollection(r)}},{"@turf/helpers":11,"@turf/invariant":12,"@turf/line-segment":15,"@turf/meta":16,"geojson-rbush":20}],15:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=t("@turf/helpers"),n=t("@turf/invariant"),s=t("@turf/meta");i.default=function(t){if(!t)throw new Error("geojson is required");var e=[];s.flattenEach(t,(function(t){!function(t,e){var i=[],s=t.geometry;if(null!==s){switch(s.type){case"Polygon":i=n.getCoords(s);break;case"LineString":i=[n.getCoords(s)]}i.forEach((function(i){var n=function(t,e){var i=[];t.reduce((function(t,n){var s,a,o,h,u,l,c=r.lineString([t,n],e);c.bbox=(a=n,o=(s=t)[0],h=s[1],u=a[0],l=a[1],[ou?o:u,h>l?h:l]);i.push(c);return n}));return i}(i,t.properties);n.forEach((function(t){t.id=e.length;e.push(t)}))}))}}(t,e)}));return r.featureCollection(e)}},{"@turf/helpers":11,"@turf/invariant":12,"@turf/meta":16}],16:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=t("@turf/helpers");function n(t,e,i){if(null!==t)for(var r,s,a,o,h,u,l,c,f=0,p=0,d=t.type,m="FeatureCollection"===d,y="Feature"===d,g=m?t.features.length:1,_=0;_u||p>l||d>c){h=n;u=i;l=p;c=d;a=0}else{var m=r.lineString([h,n],t.properties);if(!1===e(m,i,s,d,a))return!1;a++;h=n}}))&&void 0}}}))}function l(t,e){if(!t)throw new Error("geojson is required");h(t,(function(t,i,n){if(null!==t.geometry){var s=t.geometry.type,a=t.geometry.coordinates;switch(s){case"LineString":if(!1===e(t,i,n,0,0))return!1;break;case"Polygon":for(var o=0;o0){(w=b.features[0]).properties.dist=s.default(e,w,i);w.properties.location=c+s.default(p,w,i)}if(p.properties.distn;){if(s-n>600){var o=s-n+1,h=r-n+1,u=Math.log(o),l=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*l*(o-l)/o)*(h-o/2<0?-1:1);t(i,r,Math.max(n,Math.floor(r-h*l/o+c)),Math.min(s,Math.floor(r+(o-h)*l/o+c)),a)}var f=i[r],p=n,d=s;for(e(i,n,r),a(i[s],f)>0&&e(i,n,s);p0;)d--}0===a(i[n],f)?e(i,n,d):e(i,++d,s),d<=r&&(n=d+1),r<=d&&(s=d-1)}}(t,r,n||0,s||t.length-1,a||i)}function e(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function i(t,e){return te?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function n(t,e,i){if(!i)return e.indexOf(t);for(var r=0;r=t.minX&&e.maxY>=t.minY}function d(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function m(e,i,r,n,s){for(var a=[i,r];a.length;)if(!((r=a.pop())-(i=a.pop())<=n)){var o=i+Math.ceil((r-i)/n/2)*n;t(e,o,i,r,s),a.push(i,o,o,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var e=this.data,i=[];if(!p(t,e))return i;for(var r=this.toBBox,n=[];e;){for(var s=0;s=0&&n[e].children.length>this._maxEntries;)this._split(n,e),e--;this._adjustParentBBoxes(r,n,e)},r.prototype._split=function(t,e){var i=t[e],r=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,r);var a=this._chooseSplitIndex(i,n,r),o=d(i.children.splice(a,i.children.length-a));o.height=i.height,o.leaf=i.leaf,s(i,this.toBBox),s(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)},r.prototype._splitRoot=function(t,e){this.data=d([t,e]),this.data.height=t.height+1,this.data.leaf=!1,s(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,e,i){for(var r,n,s,o,h,u,c,f=1/0,p=1/0,d=e;d<=i-e;d++){var m=a(t,0,d,this.toBBox),y=a(t,d,i,this.toBBox),g=(n=m,s=y,o=Math.max(n.minX,s.minX),h=Math.max(n.minY,s.minY),u=Math.min(n.maxX,s.maxX),c=Math.min(n.maxY,s.maxY),Math.max(0,u-o)*Math.max(0,c-h)),_=l(m)+l(y);g=e;p--){var d=t.children[p];o(h,t.leaf?n(d):d),u+=c(h)}return u},r.prototype._adjustParentBBoxes=function(t,e,i){for(var r=i;r>=0;r--)o(e[r],t)},r.prototype._condense=function(t){for(var e=t.length-1,i=void 0;e>=0;e--)0===t[e].children.length?e>0?(i=t[e-1].children).splice(i.indexOf(t[e]),1):this.clear():s(t[e],this.toBBox)},r},"object"==typeof i&&void 0!==e?e.exports=n():(r=r||self).RBush=n();var r,n},{}]},{},[1])(1)}));window.csv=function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=32)}([function(t,e){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){"use strict";var r=i(6),n=Object.keys||function(t){var e=[];for(var i in t)e.push(i);return e};t.exports=c;var s=i(5);s.inherits=i(2);var a=i(22),o=i(13);s.inherits(c,a);for(var h=n(o.prototype),u=0;u=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function d(t,e){if(h.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return U(t).length;default:if(r)return z(t).length;e=(""+e).toLowerCase(),r=!0}}function m(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function y(t,e,i,r,n){if(0===t.length)return-1;if("string"==typeof i?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=n?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(n)return-1;i=t.length-1}else if(i<0){if(!n)return-1;i=0}if("string"==typeof e&&(e=h.from(e,r)),h.isBuffer(e))return 0===e.length?-1:g(t,e,i,r,n);if("number"==typeof e)return e&=255,h.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):g(t,[e],i,r,n);throw new TypeError("val must be string, number or Buffer")}function g(t,e,i,r,n){var s,a=1,o=t.length,h=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,o/=2,h/=2,i/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(n){var l=-1;for(s=i;so&&(i=o-h),s=i;s>=0;s--){for(var c=!0,f=0;fn&&(r=n):r=n;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var a=0;a>8,n=i%256,s.push(n),s.push(r);return s}(e,t.length-i),t,i,r)}function E(t,e,i){return 0===e&&i===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,i))}function k(t,e,i){i=Math.min(t.length,i);for(var r=[],n=e;n239?4:u>223?3:u>191?2:1;if(n+c<=i)switch(c){case 1:u<128&&(l=u);break;case 2:128==(192&(s=t[n+1]))&&(h=(31&u)<<6|63&s)>127&&(l=h);break;case 3:s=t[n+1],a=t[n+2],128==(192&s)&&128==(192&a)&&(h=(15&u)<<12|(63&s)<<6|63&a)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:s=t[n+1],a=t[n+2],o=t[n+3],128==(192&s)&&128==(192&a)&&128==(192&o)&&(h=(15&u)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&h<1114112&&(l=h)}null===l?(l=65533,c=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),n+=c}return function(t){var e=t.length;if(e<=C)return String.fromCharCode.apply(String,t);for(var i="",r=0;rthis.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,i);case"utf8":case"utf-8":return k(this,e,i);case"ascii":return S(this,e,i);case"latin1":case"binary":return A(this,e,i);case"base64":return E(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},h.prototype.equals=function(t){if(!h.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===h.compare(this,t)},h.prototype.inspect=function(){var t="",i=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(t+=" ... ")),""},h.prototype.compare=function(t,e,i,r,n){if(!h.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),e<0||i>t.length||r<0||n>this.length)throw new RangeError("out of range index");if(r>=n&&e>=i)return 0;if(r>=n)return-1;if(e>=i)return 1;if(this===t)return 0;for(var s=(n>>>=0)-(r>>>=0),a=(i>>>=0)-(e>>>=0),o=Math.min(s,a),u=this.slice(r,n),l=t.slice(e,i),c=0;cn)&&(i=n),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return _(this,t,e,i);case"utf8":case"utf-8":return v(this,t,e,i);case"ascii":return b(this,t,e,i);case"latin1":case"binary":return w(this,t,e,i);case"base64":return M(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,i);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function S(t,e,i){var r="";i=Math.min(t.length,i);for(var n=e;nr)&&(i=r);for(var n="",s=e;si)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,i,r,n,s){if(!h.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function T(t,e,i,r){e<0&&(e=65535+e+1);for(var n=0,s=Math.min(t.length-i,2);n>>8*(r?n:1-n)}function I(t,e,i,r){e<0&&(e=4294967295+e+1);for(var n=0,s=Math.min(t.length-i,4);n>>8*(r?n:3-n)&255}function N(t,e,i,r,n,s){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function L(t,e,i,r,s){return s||N(t,0,i,4),n.write(t,e,i,r,23,4),i+4}function B(t,e,i,r,s){return s||N(t,0,i,8),n.write(t,e,i,r,52,8),i+8}h.prototype.slice=function(t,e){var i,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(n*=256);)r+=this[t+--e]*n;return r},h.prototype.readUInt8=function(t,e){return e||O(t,1,this.length),this[t]},h.prototype.readUInt16LE=function(t,e){return e||O(t,2,this.length),this[t]|this[t+1]<<8},h.prototype.readUInt16BE=function(t,e){return e||O(t,2,this.length),this[t]<<8|this[t+1]},h.prototype.readUInt32LE=function(t,e){return e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},h.prototype.readUInt32BE=function(t,e){return e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},h.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||O(t,e,this.length);for(var r=this[t],n=1,s=0;++s=(n*=128)&&(r-=Math.pow(2,8*e)),r},h.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||O(t,e,this.length);for(var r=e,n=1,s=this[t+--r];r>0&&(n*=256);)s+=this[t+--r]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*e)),s},h.prototype.readInt8=function(t,e){return e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},h.prototype.readInt16LE=function(t,e){e||O(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},h.prototype.readInt16BE=function(t,e){e||O(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},h.prototype.readInt32LE=function(t,e){return e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},h.prototype.readInt32BE=function(t,e){return e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},h.prototype.readFloatLE=function(t,e){return e||O(t,4,this.length),n.read(this,t,!0,23,4)},h.prototype.readFloatBE=function(t,e){return e||O(t,4,this.length),n.read(this,t,!1,23,4)},h.prototype.readDoubleLE=function(t,e){return e||O(t,8,this.length),n.read(this,t,!0,52,8)},h.prototype.readDoubleBE=function(t,e){return e||O(t,8,this.length),n.read(this,t,!1,52,8)},h.prototype.writeUIntLE=function(t,e,i,r){t=+t,e|=0,i|=0,r||R(this,t,e,i,Math.pow(2,8*i)-1,0);var n=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+n]=t/s&255;return e+i},h.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,1,255,0),h.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},h.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):T(this,t,e,!0),e+2},h.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):T(this,t,e,!1),e+2},h.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):I(this,t,e,!0),e+4},h.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):I(this,t,e,!1),e+4},h.prototype.writeIntLE=function(t,e,i,r){if(t=+t,e|=0,!r){var n=Math.pow(2,8*i-1);R(this,t,e,i,n-1,-n)}var s=0,a=1,o=0;for(this[e]=255&t;++s>0)-o&255;return e+i},h.prototype.writeIntBE=function(t,e,i,r){if(t=+t,e|=0,!r){var n=Math.pow(2,8*i-1);R(this,t,e,i,n-1,-n)}var s=i-1,a=1,o=0;for(this[e+s]=255&t;--s>=0&&(a*=256);)t<0&&0===o&&0!==this[e+s+1]&&(o=1),this[e+s]=(t/a>>0)-o&255;return e+i},h.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,1,127,-128),h.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},h.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):T(this,t,e,!0),e+2},h.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):T(this,t,e,!1),e+2},h.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):I(this,t,e,!0),e+4},h.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):I(this,t,e,!1),e+4},h.prototype.writeFloatLE=function(t,e,i){return L(this,t,e,!0,i)},h.prototype.writeFloatBE=function(t,e,i){return L(this,t,e,!1,i)},h.prototype.writeDoubleLE=function(t,e,i){return B(this,t,e,!0,i)},h.prototype.writeDoubleBE=function(t,e,i){return B(this,t,e,!1,i)},h.prototype.copy=function(t,e,i,r){if(i||(i=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e=0;--n)t[n+e]=this[n+i];else if(s<1e3||!h.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(s=e;s55295&&i<57344){if(!n){if(i>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&s.push(239,191,189);continue}n=i;continue}if(i<56320){(e-=3)>-1&&s.push(239,191,189),n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,i<128){if((e-=1)<0)break;s.push(i)}else if(i<2048){if((e-=2)<0)break;s.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;s.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return s}function U(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(F,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(t,e,i,r){for(var n=0;n=e.length||n>=t.length);++n)e[n+i]=t[n];return n}}).call(this,i(0))},function(t,e){var i,r,n=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(i===setTimeout)return setTimeout(t,0);if((i===s||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:s}catch(t){i=s}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var h,u=[],l=!1,c=-1;function f(){l&&h&&(l=!1,h.length?u=h.concat(u):c=-1,u.length&&p())}function p(){if(!l){var t=o(f);l=!0;for(var e=u.length;e;){for(h=u,u=[];++c1)for(var i=1;i0&&this._events[t].length>a&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(t,e){if(!r(e))throw TypeError("listener must be a function");var i=!1;function n(){this.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}return n.listener=e,this.on(t,n),this},i.prototype.removeListener=function(t,e){var i,s,a,o;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(a=(i=this._events[t]).length,s=-1,i===e||r(i.listener)&&i.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(n(i)){for(o=a;o-- >0;)if(i[o]===e||i[o].listener&&i[o].listener===e){s=o;break}if(s<0)return this;1===i.length?(i.length=0,delete this._events[t]):i.splice(s,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},i.prototype.removeAllListeners=function(t){var e,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r(i=this._events[t]))this.removeListener(t,i);else if(i)for(;i.length;)this.removeListener(t,i[i.length-1]);return delete this._events[t],this},i.prototype.listeners=function(t){return this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},i.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},i.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,i){(e=t.exports=i(22)).Stream=e,e.Readable=e,e.Writable=i(13),e.Duplex=i(1),e.Transform=i(27),e.PassThrough=i(45)},function(t,e,i){"use strict";(function(e,r,n){var s=i(6);function a(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,i){var r=t.entry;for(t.entry=null;r;){var n=r.callback;e.pendingcb--,n(void 0),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=_;var o,h=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?r:s.nextTick;_.WritableState=g;var u=i(5);u.inherits=i(2);var l,c={deprecate:i(44)},f=i(23),p=i(7).Buffer,d=n.Uint8Array||function(){},m=i(24);function y(){}function g(t,e){o=o||i(1),t=t||{};var r=e instanceof o;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,u=t.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r&&(u||0===u)?u:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===t.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var i=t._writableState,r=i.sync,n=i.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(i),e)!function(t,e,i,r,n){--e.pendingcb,i?(s.nextTick(n,r),s.nextTick(E,t,e),t._writableState.errorEmitted=!0,t.emit("error",r)):(n(r),t._writableState.errorEmitted=!0,t.emit("error",r),E(t,e))}(t,i,r,e,n);else{var a=M(i);a||i.corked||i.bufferProcessing||!i.bufferedRequest||w(t,i),r?h(b,t,i,a,n):b(t,i,a,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function _(t){if(o=o||i(1),!(l.call(_,this)||this instanceof o))return new _(t);this._writableState=new g(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),f.call(this)}function v(t,e,i,r,n,s,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,i?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function b(t,e,i,r){i||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),E(t,e)}function w(t,e){e.bufferProcessing=!0;var i=e.bufferedRequest;if(t._writev&&i&&i.next){var r=e.bufferedRequestCount,n=new Array(r),s=e.corkedRequestsFree;s.entry=i;for(var o=0,h=!0;i;)n[o]=i,i.isBuf||(h=!1),i=i.next,o+=1;n.allBuffers=h,v(t,e,!0,e.length,n,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new a(e),e.bufferedRequestCount=0}else{for(;i;){var u=i.chunk,l=i.encoding,c=i.callback;if(v(t,e,!1,e.objectMode?1:u.length,u,l,c),i=i.next,e.bufferedRequestCount--,e.writing)break}null===i&&(e.lastBufferedRequest=null)}e.bufferedRequest=i,e.bufferProcessing=!1}function M(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function x(t,e){t._final((function(i){e.pendingcb--,i&&t.emit("error",i),e.prefinished=!0,t.emit("prefinish"),E(t,e)}))}function E(t,e){var i=M(e);return i&&(function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,s.nextTick(x,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),i}u.inherits(_,f),g.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(g.prototype,"buffer",{get:c.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(_,Symbol.hasInstance,{value:function(t){return!!l.call(this,t)||this===_&&t&&t._writableState instanceof g}})):l=function(t){return t instanceof this},_.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},_.prototype.write=function(t,e,i){var r=this._writableState,n=!1,a=!r.objectMode&&function(t){return p.isBuffer(t)||t instanceof d}(t);return a&&!p.isBuffer(t)&&(t=function(t){return p.from(t)}(t)),"function"==typeof e&&(i=e,e=null),a?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof i&&(i=y),r.ended?function(t,e){var i=new Error("write after end");t.emit("error",i),s.nextTick(e,i)}(this,i):(a||function(t,e,i,r){var n=!0,a=!1;return null===i?a=new TypeError("May not write null values to stream"):"string"==typeof i||void 0===i||e.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),s.nextTick(r,a),n=!1),n}(this,r,t,i))&&(r.pendingcb++,n=function(t,e,i,r,n,s){if(!i){var a=function(t,e,i){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=p.from(e,i)),e}(e,r,n);r!==a&&(i=!0,n="buffer",r=a)}var o=e.objectMode?1:r.length;e.length+=o;var h=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(t,e,i){i(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(t,e,i){var r=this._writableState;"function"==typeof t?(i=t,t=null,e=null):"function"==typeof e&&(i=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,i){e.ending=!0,E(t,e),i&&(e.finished?s.nextTick(i):t.once("finish",i)),e.ended=!0,t.writable=!1}(this,r,i)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,i(4),i(25).setImmediate,i(0))},function(t,e,i){(function(e,i,r){t.exports=function t(e,i,r){function n(a,o){if(!i[a]){if(!e[a]){var h="function"==typeof _dereq_&&_dereq_;if(!o&&h)return h(a,!0);if(s)return s(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=i[a]={exports:{}};e[a][0].call(l.exports,(function(t){return n(e[a][1][t]||t)}),l,l.exports,t,e,i,r)}return i[a].exports}for(var s="function"==typeof _dereq_&&_dereq_,a=0;a0;){var e=t.shift();if("function"==typeof e){var i=t.shift(),r=t.shift();e.call(i,r)}else e._settlePromises()}},h.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},h.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},h.prototype._reset=function(){this._isTickUsed=!1},i.exports=h,i.exports.firstLineError=n},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,i){"use strict";e.exports=function(t,e,i,r){var n=!1,s=function(t,e){this._reject(e)},a=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(s,s,null,this,t)},o=function(t,e){0==(50397184&this._bitField)&&this._resolveCallback(e.target)},h=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(s){n||(n=!0,t.prototype._propagateFrom=r.propagateFromFunction(),t.prototype._boundValue=r.boundValueFunction());var u=i(s),l=new t(e);l._propagateFrom(this,1);var c=this._target();if(l._setBoundTo(u),u instanceof t){var f={promiseRejectionQueued:!1,promise:l,target:c,bindingPromise:u};c._then(e,a,void 0,l,f),u._then(o,h,void 0,l,f),l._setOnCancel(u)}else l._resolveCallback(c);return l},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},t.bind=function(e,i){return t.resolve(i).bind(e)}}},{}],4:[function(t,e,i){"use strict";var r;"undefined"!=typeof Promise&&(r=Promise);var n=t("./promise")();n.noConflict=function(){try{Promise===n&&(Promise=r)}catch(t){}return n},e.exports=n},{"./promise":22}],5:[function(t,e,i){"use strict";var r=Object.create;if(r){var n=r(null),s=r(null);n[" size"]=s[" size"]=0}e.exports=function(e){var i=t("./util"),r=i.canEvaluate;function n(t){return function(t,r){var n;if(null!=t&&(n=t[r]),"function"!=typeof n){var s="Object "+i.classString(t)+" has no method '"+i.toString(r)+"'";throw new e.TypeError(s)}return n}(t,this.pop()).apply(t,this)}function s(t){return t[this]}function a(t){var e=+this;return e<0&&(e=Math.max(0,e+t.length)),t[e]}i.isIdentifier,e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(n,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e;if("number"==typeof t)e=a;else if(r){var i=(void 0)(t);e=null!==i?i:s}else e=s;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,i){"use strict";e.exports=function(e,i,r,n){var s=t("./util"),a=s.tryCatch,o=s.errorObj,h=e._async;e.prototype.break=e.prototype.cancel=function(){if(!n.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var i=t._cancellationParent;if(null==i||!i._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=i}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),h.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(s.isArray(t))for(var i=0;i=0)return i[t]}return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},r.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,i.push(this._trace))},r.prototype._popContext=function(){if(void 0!==this._trace){var t=i.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},r.CapturedTrace=null,r.create=function(){if(e)return new r},r.deactivateLongStackTraces=function(){},r.activateLongStackTraces=function(){var i=t.prototype._pushContext,s=t.prototype._popContext,a=t._peekContext,o=t.prototype._peekContext,h=t.prototype._promiseCreated;r.deactivateLongStackTraces=function(){t.prototype._pushContext=i,t.prototype._popContext=s,t._peekContext=a,t.prototype._peekContext=o,t.prototype._promiseCreated=h,e=!1},e=!0,t.prototype._pushContext=r.prototype._pushContext,t.prototype._popContext=r.prototype._popContext,t._peekContext=t.prototype._peekContext=n,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},r}},{}],9:[function(t,i,r){"use strict";i.exports=function(i,r){var n,s,a,o=i._getDomain,h=i._async,u=t("./errors").Warning,l=t("./util"),c=l.canAttachTrace,f=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,p=/\((?:timers\.js):\d+:\d+\)/,d=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,m=null,y=null,g=!1,_=!(0==l.env("BLUEBIRD_DEBUG")),v=!(0==l.env("BLUEBIRD_WARNINGS")||!_&&!l.env("BLUEBIRD_WARNINGS")),b=!(0==l.env("BLUEBIRD_LONG_STACK_TRACES")||!_&&!l.env("BLUEBIRD_LONG_STACK_TRACES")),w=0!=l.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(v||!!l.env("BLUEBIRD_W_FORGOTTEN_RETURN"));i.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},i.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var t=this;setTimeout((function(){t._notifyUnhandledRejection()}),1)}},i.prototype._notifyUnhandledRejectionIsHandled=function(){G("rejectionHandled",n,void 0,this)},i.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},i.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},i.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),G("unhandledRejection",s,t,this)}},i.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},i.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},i.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},i.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},i.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},i.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},i.prototype._warn=function(t,e,i){return D(t,e,i||this)},i.onPossiblyUnhandledRejection=function(t){var e=o();s="function"==typeof t?null===e?t:l.domainBind(e,t):void 0},i.onUnhandledRejectionHandled=function(t){var e=o();n="function"==typeof t?null===e?t:l.domainBind(e,t):void 0};var M=function(){};i.longStackTraces=function(){if(h.haveItemsQueued()&&!Y.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!Y.longStackTraces&&H()){var t=i.prototype._captureStackTrace,e=i.prototype._attachExtraTrace;Y.longStackTraces=!0,M=function(){if(h.haveItemsQueued()&&!Y.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");i.prototype._captureStackTrace=t,i.prototype._attachExtraTrace=e,r.deactivateLongStackTraces(),h.enableTrampoline(),Y.longStackTraces=!1},i.prototype._captureStackTrace=B,i.prototype._attachExtraTrace=F,r.activateLongStackTraces(),h.disableTrampolineIfNecessary()}},i.hasLongStackTraces=function(){return Y.longStackTraces&&H()};var x=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return l.global.dispatchEvent(t),function(t,e){var i=new CustomEvent(t.toLowerCase(),{detail:e,cancelable:!0});return!l.global.dispatchEvent(i)}}return"function"==typeof Event?(t=new Event("CustomEvent"),l.global.dispatchEvent(t),function(t,e){var i=new Event(t.toLowerCase(),{cancelable:!0});return i.detail=e,!l.global.dispatchEvent(i)}):((t=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),l.global.dispatchEvent(t),function(t,e){var i=document.createEvent("CustomEvent");return i.initCustomEvent(t.toLowerCase(),!1,!0,e),!l.global.dispatchEvent(i)})}catch(t){}return function(){return!1}}(),E=l.isNode?function(){return e.emit.apply(e,arguments)}:l.global?function(t){var e="on"+t.toLowerCase(),i=l.global[e];return!!i&&(i.apply(l.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function k(t,e){return{promise:e}}var C={promiseCreated:k,promiseFulfilled:k,promiseRejected:k,promiseResolved:k,promiseCancelled:k,promiseChained:function(t,e,i){return{promise:e,child:i}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,i){return{reason:e,promise:i}},rejectionHandled:k},S=function(t){var e=!1;try{e=E.apply(null,arguments)}catch(t){h.throwLater(t),e=!0}var i=!1;try{i=x(t,C[t].apply(null,arguments))}catch(t){h.throwLater(t),i=!0}return i||e};function A(){return!1}function P(t,e,i){var r=this;try{t(e,i,(function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+l.toString(t));r._attachCancellationCallback(t)}))}catch(t){return t}}function j(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?l.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function O(){return this._onCancelField}function R(t){this._onCancelField=t}function T(){this._cancellationParent=void 0,this._onCancelField=void 0}function I(t,e){if(0!=(1&e)){this._cancellationParent=t;var i=t._branchesRemainingToCancel;void 0===i&&(i=0),t._branchesRemainingToCancel=i+1}0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}i.config=function(t){if("longStackTraces"in(t=Object(t))&&(t.longStackTraces?i.longStackTraces():!t.longStackTraces&&i.hasLongStackTraces()&&M()),"warnings"in t){var e=t.warnings;Y.warnings=!!e,w=Y.warnings,l.isObject(e)&&"wForgottenReturn"in e&&(w=!!e.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!Y.cancellation){if(h.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");i.prototype._clearCancellationData=T,i.prototype._propagateFrom=I,i.prototype._onCancel=O,i.prototype._setOnCancel=R,i.prototype._attachCancellationCallback=j,i.prototype._execute=P,N=I,Y.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!Y.monitoring?(Y.monitoring=!0,i.prototype._fireEvent=S):!t.monitoring&&Y.monitoring&&(Y.monitoring=!1,i.prototype._fireEvent=A)),i},i.prototype._fireEvent=A,i.prototype._execute=function(t,e,i){try{t(e,i)}catch(t){return t}},i.prototype._onCancel=function(){},i.prototype._setOnCancel=function(t){},i.prototype._attachCancellationCallback=function(t){},i.prototype._captureStackTrace=function(){},i.prototype._attachExtraTrace=function(){},i.prototype._clearCancellationData=function(){},i.prototype._propagateFrom=function(t,e){};var N=function(t,e){0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)};function L(){var t=this._boundTo;return void 0!==t&&t instanceof i?t.isFulfilled()?t.value():void 0:t}function B(){this._trace=new Z(this._peekContext())}function F(t,e){if(c(t)){var i=this._trace;if(void 0!==i&&e&&(i=i._parent),void 0!==i)i.attachExtraTrace(t);else if(!t.__stackCleaned__){var r=U(t);l.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),l.notEnumerableProp(t,"__stackCleaned__",!0)}}}function D(t,e,r){if(Y.warnings){var n,s=new u(t);if(e)r._attachExtraTrace(s);else if(Y.longStackTraces&&(n=i._peekContext()))n.attachExtraTrace(s);else{var a=U(s);s.stack=a.message+"\n"+a.stack.join("\n")}S("warning",s)||q(s,"",!0)}}function z(t){for(var e=[],i=0;i0?function(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),i=0;i0&&"SyntaxError"!=t.name&&(e=e.slice(i)),e}(t):[" (No stack trace)"],{message:i,stack:"SyntaxError"==t.name?e:z(e)}}function q(t,e,i){if("undefined"!=typeof console){var r;if(l.isObject(t)){var n=t.stack;r=e+y(n,t)}else r=e+String(t);"function"==typeof a?a(r,i):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(r)}}function G(t,e,i,r){var n=!1;try{"function"==typeof e&&(n=!0,"rejectionHandled"===t?e(r):e(i,r))}catch(t){h.throwLater(t)}"unhandledRejection"===t?S(t,i,r)||n||q(i,"Unhandled rejection "):S(t,r)}function W(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{if(e=t&&"function"==typeof t.toString?t.toString():l.toString(t),/\[object [a-zA-Z0-9$_]+\]/.test(e))try{e=JSON.stringify(t)}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+function(t){return t.length<41?t:t.substr(0,38)+"..."}(e)+">, no stack trace)"}function H(){return"function"==typeof J}var Q=function(){return!1},X=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function V(t){var e=t.match(X);if(e)return{fileName:e[1],line:parseInt(e[2],10)}}function Z(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);J(this,Z),e>32&&this.uncycle()}l.inherits(Z,Error),r.CapturedTrace=Z,Z.prototype.uncycle=function(){var t=this._length;if(!(t<2)){for(var e=[],i={},r=0,n=this;void 0!==n;++r)e.push(n),n=n._parent;for(r=(t=this._length=r)-1;r>=0;--r){var s=e[r].stack;void 0===i[s]&&(i[s]=r)}for(r=0;r0&&(e[a-1]._parent=void 0,e[a-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var o=r>0?e[r-1]:this;a=0;--u)e[u]._length=h,h++;return}}}},Z.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=U(t),i=e.message,r=[e.stack],n=this;void 0!==n;)r.push(z(n.stack.split("\n"))),n=n._parent;!function(t){for(var e=t[0],i=1;i=0;--o)if(r[o]===s){a=o;break}for(o=a;o>=0;--o){var h=r[o];if(e[n]!==h)break;e.pop(),n--}e=r}}(r),function(t){for(var e=0;e=0)return m=/@/,y=e,g=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){r="stack"in t}return"stack"in n||!r||"number"!=typeof Error.stackTraceLimit?(y=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?W(e):e.toString()},null):(m=t,y=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(a=function(t){console.warn(t)},l.isNode&&e.stderr.isTTY?a=function(t,e){var i=e?"":"";console.warn(i+t+"\n")}:l.isNode||"string"!=typeof(new Error).stack||(a=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var Y={warnings:v,longStackTraces:!1,cancellation:!1,monitoring:!1};return b&&i.longStackTraces(),{longStackTraces:function(){return Y.longStackTraces},warnings:function(){return Y.warnings},cancellation:function(){return Y.cancellation},monitoring:function(){return Y.monitoring},propagateFromFunction:function(){return N},boundValueFunction:function(){return L},checkForgottenReturns:function(t,e,i,r,n){if(void 0===t&&null!==e&&w){if(void 0!==n&&n._returnedNonUndefined())return;if(0==(65535&r._bitField))return;i&&(i+=" ");var s="",a="";if(e._trace){for(var o=e._trace.stack.split("\n"),h=z(o),u=h.length-1;u>=0;--u){var l=h[u];if(!p.test(l)){var c=l.match(d);c&&(s="at "+c[1]+":"+c[2]+":"+c[3]+" ");break}}if(h.length>0){var f=h[0];for(u=0;u0&&(a="\n"+o[u-1]);break}}}var m="a promise was created in a "+i+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+a;r._warn(m,!0,e)}},setBounds:function(t,e){if(H()){for(var i,r,n=t.stack.split("\n"),s=e.stack.split("\n"),a=-1,o=-1,h=0;h=o||(Q=function(t){if(f.test(t))return!0;var e=V(t);return!!(e&&e.fileName===i&&a<=e.line&&e.line<=o)})}},warn:D,deprecated:function(t,e){var i=t+" is deprecated and will be removed in a future version.";return e&&(i+=" Use "+e+" instead."),D(i)},CapturedTrace:Z,fireDomEvent:x,fireGlobalEvent:E}}},{"./errors":12,"./util":36}],10:[function(t,e,i){"use strict";e.exports=function(t){function e(){return this.value}function i(){throw this.reason}t.prototype.return=t.prototype.thenReturn=function(i){return i instanceof t&&i.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:i},void 0)},t.prototype.throw=t.prototype.thenThrow=function(t){return this._then(i,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,i,void 0,{reason:t},void 0);var e=arguments[1];return this.caught(t,(function(){throw e}))},t.prototype.catchReturn=function(i){if(arguments.length<=1)return i instanceof t&&i.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:i},void 0);var r=arguments[1];return r instanceof t&&r.suppressUnhandledRejections(),this.caught(i,(function(){return r}))}}},{}],11:[function(t,e,i){"use strict";e.exports=function(t,e){var i=t.reduce,r=t.all;function n(){return r(this)}t.prototype.each=function(t){return i(this,t,e,0)._then(n,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return i(this,t,e,e)},t.each=function(t,r){return i(t,r,e,0)._then(n,void 0,void 0,t,void 0)},t.mapSeries=function(t,r){return i(t,r,e,e)}}},{}],12:[function(t,e,i){"use strict";var r,n,s=t("./es5"),a=s.freeze,o=t("./util"),h=o.inherits,u=o.notEnumerableProp;function l(t,e){function i(r){if(!(this instanceof i))return new i(r);u(this,"message","string"==typeof r?r:e),u(this,"name",t),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return h(i,Error),i}var c=l("Warning","warning"),f=l("CancellationError","cancellation error"),p=l("TimeoutError","timeout error"),d=l("AggregateError","aggregate error");try{r=TypeError,n=RangeError}catch(t){r=l("TypeError","type error"),n=l("RangeError","range error")}for(var m="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),y=0;y1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function c(){return p.call(this,this.promise._target()._settledValue())}function f(t){if(!l(this,t))return a.e=t,a}function p(t){var n=this.promise,o=this.handler;if(!this.called){this.called=!0;var h=this.isFinallyHandler()?o.call(n._boundValue()):o.call(n._boundValue(),t);if(h===r)return h;if(void 0!==h){n._setReturnedNonUndefined();var p=i(h,n);if(p instanceof e){if(null!=this.cancelPromise){if(p._isCancelled()){var d=new s("late cancellation observer");return n._attachExtraTrace(d),a.e=d,a}p.isPending()&&p._attachCancellationCallback(new u(this))}return p._then(c,f,void 0,this,void 0)}}}return n.isRejected()?(l(this),a.e=t,a):(l(this),t)}return h.prototype.isFinallyHandler=function(){return 0===this.type},u.prototype._resultCancelled=function(){l(this.finallyHandler)},e.prototype._passThrough=function(t,e,i,r){return"function"!=typeof t?this.then():this._then(i,r,void 0,new h(this,e,t),void 0)},e.prototype.lastly=e.prototype.finally=function(t){return this._passThrough(t,0,p,p)},e.prototype.tap=function(t){return this._passThrough(t,1,p)},e.prototype.tapCatch=function(t){var i=arguments.length;if(1===i)return this._passThrough(t,1,void 0,p);var r,s=new Array(i-1),a=0;for(r=0;r0&&"function"==typeof arguments[e]&&(t=arguments[e]);var r=[].slice.call(arguments);t&&r.pop();var n=new i(r).promise();return void 0!==t?n.spread(t):n}}},{"./util":36}],18:[function(t,e,i){"use strict";e.exports=function(e,i,r,n,s,a){var o=e._getDomain,h=t("./util"),u=h.tryCatch,l=h.errorObj,c=e._async;function f(t,e,i,r){this.constructor$(t),this._promise._captureStackTrace();var n=o();this._callback=null===n?e:h.domainBind(n,e),this._preservedValues=r===s?new Array(this.length()):null,this._limit=i,this._inFlight=0,this._queue=[],c.invoke(this._asyncInit,this,void 0)}function p(t,i,n,s){if("function"!=typeof i)return r("expecting a function but got "+h.classString(i));var a=0;if(void 0!==n){if("object"!=typeof n||null===n)return e.reject(new TypeError("options argument must be an object but it is "+h.classString(n)));if("number"!=typeof n.concurrency)return e.reject(new TypeError("'concurrency' must be a number but it is "+h.classString(n.concurrency)));a=n.concurrency}return new f(t,i,a="number"==typeof a&&isFinite(a)&&a>=1?a:0,s).promise()}h.inherits(f,i),f.prototype._asyncInit=function(){this._init$(void 0,-2)},f.prototype._init=function(){},f.prototype._promiseFulfilled=function(t,i){var r=this._values,s=this.length(),o=this._preservedValues,h=this._limit;if(i<0){if(r[i=-1*i-1]=t,h>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(h>=1&&this._inFlight>=h)return r[i]=t,this._queue.push(i),!1;null!==o&&(o[i]=t);var c=this._promise,f=this._callback,p=c._boundValue();c._pushContext();var d=u(f).call(p,t,i,s),m=c._popContext();if(a.checkForgottenReturns(d,m,null!==o?"Promise.filter":"Promise.map",c),d===l)return this._reject(d.e),!0;var y=n(d,this._promise);if(y instanceof e){var g=(y=y._target())._bitField;if(0==(50397184&g))return h>=1&&this._inFlight++,r[i]=y,y._proxy(this,-1*(i+1)),!1;if(0==(33554432&g))return 0!=(16777216&g)?(this._reject(y._reason()),!0):(this._cancel(),!0);d=y._value()}r[i]=d}return++this._totalResolved>=s&&(null!==o?this._filter(r,o):this._resolve(r),!0)},f.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,i=this._values;t.length>0&&this._inFlight1){s.deprecated("calling Promise.try with more than 1 argument");var u=arguments[1],l=arguments[2];r=a.isArray(u)?o(t).apply(l,u):o(t).call(l,u)}else r=o(t)();var c=h._popContext();return s.checkForgottenReturns(r,c,"Promise.try",h),h._resolveFromSyncValue(r),h},e.prototype._resolveFromSyncValue=function(t){t===a.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,i){"use strict";var r=t("./util"),n=r.maybeWrapAsError,s=t("./errors").OperationalError,a=t("./es5"),o=/^(?:name|message|stack|cause)$/;function h(t){var e;if(function(t){return t instanceof Error&&a.getPrototypeOf(t)===Error.prototype}(t)){(e=new s(t)).name=t.name,e.message=t.message,e.stack=t.stack;for(var i=a.keys(t),n=0;n1){var i,r=new Array(e-1),n=0;for(i=0;i0&&"function"!=typeof t&&"function"!=typeof e){var i=".then() only accepts functions but was passed: "+u.classString(t);arguments.length>1&&(i+=", "+u.classString(e)),this._warn(i)}return this._then(t,e,void 0,void 0,void 0)},P.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},P.prototype.spread=function(t){return"function"!=typeof t?s("expecting a function but got "+u.classString(t)):this.all()._then(t,void 0,void 0,g,void 0)},P.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},P.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new b(this).promise()},P.prototype.error=function(t){return this.caught(u.originatesFromRejection,t)},P.getNewLibraryCopy=i.exports,P.is=function(t){return t instanceof P},P.fromNode=P.fromCallback=function(t){var e=new P(y);e._captureStackTrace();var i=arguments.length>1&&!!Object(arguments[1]).multiArgs,r=A(t)(C(e,i));return r===S&&e._rejectCallback(r.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},P.all=function(t){return new b(t).promise()},P.cast=function(t){var e=v(t);return e instanceof P||((e=new P(y))._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},P.resolve=P.fulfilled=P.cast,P.reject=P.rejected=function(t){var e=new P(y);return e._captureStackTrace(),e._rejectCallback(t,!0),e},P.setScheduler=function(t){if("function"!=typeof t)throw new d("expecting a function but got "+u.classString(t));return f.setScheduler(t)},P.prototype._then=function(t,e,i,r,n){var s=void 0!==n,a=s?n:new P(y),h=this._target(),l=h._bitField;s||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===r&&0!=(2097152&this._bitField)&&(r=0!=(50397184&l)?this._boundValue():h===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var c=o();if(0!=(50397184&l)){var p,d,g=h._settlePromiseCtx;0!=(33554432&l)?(d=h._rejectionHandler0,p=t):0!=(16777216&l)?(d=h._fulfillmentHandler0,p=e,h._unsetRejectionIsUnhandled()):(g=h._settlePromiseLateCancellationObserver,d=new m("late cancellation observer"),h._attachExtraTrace(d),p=e),f.invoke(g,h,{handler:null===c?p:"function"==typeof p&&u.domainBind(c,p),promise:a,receiver:r,value:d})}else h._addCallbacks(t,e,a,r,c);return a},P.prototype._length=function(){return 65535&this._bitField},P.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},P.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},P.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},P.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},P.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},P.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},P.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},P.prototype._isFinal=function(){return(4194304&this._bitField)>0},P.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},P.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},P.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},P.prototype._setAsyncGuaranteed=function(){f.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},P.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];if(e!==h)return void 0===e&&this._isBound()?this._boundValue():e},P.prototype._promiseAt=function(t){return this[4*t-4+2]},P.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},P.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},P.prototype._boundValue=function(){},P.prototype._migrateCallback0=function(t){t._bitField;var e=t._fulfillmentHandler0,i=t._rejectionHandler0,r=t._promise0,n=t._receiverAt(0);void 0===n&&(n=h),this._addCallbacks(e,i,r,n,null)},P.prototype._migrateCallbackAt=function(t,e){var i=t._fulfillmentHandlerAt(e),r=t._rejectionHandlerAt(e),n=t._promiseAt(e),s=t._receiverAt(e);void 0===s&&(s=h),this._addCallbacks(i,r,n,s,null)},P.prototype._addCallbacks=function(t,e,i,r,n){var s=this._length();if(s>=65531&&(s=0,this._setLength(0)),0===s)this._promise0=i,this._receiver0=r,"function"==typeof t&&(this._fulfillmentHandler0=null===n?t:u.domainBind(n,t)),"function"==typeof e&&(this._rejectionHandler0=null===n?e:u.domainBind(n,e));else{var a=4*s-4;this[a+2]=i,this[a+3]=r,"function"==typeof t&&(this[a+0]=null===n?t:u.domainBind(n,t)),"function"==typeof e&&(this[a+1]=null===n?e:u.domainBind(n,e))}return this._setLength(s+1),s},P.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},P.prototype._resolveCallback=function(t,e){if(0==(117506048&this._bitField)){if(t===this)return this._rejectCallback(r(),!1);var i=v(t,this);if(!(i instanceof P))return this._fulfill(t);e&&this._propagateFrom(i,2);var n=i._target();if(n!==this){var s=n._bitField;if(0==(50397184&s)){var a=this._length();a>0&&n._migrateCallback0(this);for(var o=1;o>>16)){if(t===this){var i=r();return this._attachExtraTrace(i),this._reject(i)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!=(134217728&e)?this._settlePromises():f.settlePromises(this))}},P.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=t,this._isFinal())return f.fatalError(t,u.isNode);(65535&e)>0?f.settlePromises(this):this._ensurePossibleRejectionHandled()}},P.prototype._fulfillPromises=function(t,e){for(var i=1;i0){if(0!=(16842752&t)){var i=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,i,t),this._rejectPromises(e,i)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,t),this._fulfillPromises(e,r)}this._setLength(0)}this._clearCancellationData()},P.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},P.defer=P.pending=function(){return x.deprecated("Promise.defer","new Promise"),{promise:new P(y),resolve:j,reject:O}},u.notEnumerableProp(P,"_makeSelfResolutionError",r),t("./method")(P,y,v,s,x),t("./bind")(P,y,v,x),t("./cancel")(P,b,s,x),t("./direct_resolve")(P),t("./synchronous_inspection")(P),t("./join")(P,b,v,y,f,o),P.Promise=P,P.version="3.5.1",t("./map.js")(P,b,s,v,y,x),t("./call_get.js")(P),t("./using.js")(P,s,v,M,y,x),t("./timers.js")(P,y,x),t("./generators.js")(P,s,y,v,a,x),t("./nodeify.js")(P),t("./promisify.js")(P,y),t("./props.js")(P,b,v,s),t("./race.js")(P,y,v,s),t("./reduce.js")(P,b,s,v,y,x),t("./settle.js")(P,b,x),t("./some.js")(P,b,s),t("./filter.js")(P,y),t("./each.js")(P,y),t("./any.js")(P),u.toFastProperties(P),u.toFastProperties(P.prototype),R({a:1}),R({b:2}),R({c:3}),R(1),R((function(){})),R(void 0),R(!1),R(new P(y)),x.setBounds(c.firstLineError,u.lastLineError),P}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(t,e,i){"use strict";e.exports=function(e,i,r,n,s){var a=t("./util");function o(t){var r=this._promise=new e(i);t instanceof e&&r._propagateFrom(t,3),r._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return a.isArray,a.inherits(o,s),o.prototype.length=function(){return this._length},o.prototype.promise=function(){return this._promise},o.prototype._init=function t(i,s){var o=r(this._values,this._promise);if(o instanceof e){var h=(o=o._target())._bitField;if(this._values=o,0==(50397184&h))return this._promise._setAsyncGuaranteed(),o._then(t,this._reject,void 0,this,s);if(0==(33554432&h))return 0!=(16777216&h)?this._reject(o._reason()):this._cancel();o=o._value()}if(null!==(o=a.asArray(o)))0!==o.length?this._iterate(o):-5===s?this._resolveEmptyArray():this._resolve(function(t){switch(s){case-2:return[];case-3:return{};case-6:return new Map}}());else{var u=n("expecting an array or an iterable object but got "+a.classString(o)).reason();this._promise._rejectCallback(u,!1)}},o.prototype._iterate=function(t){var i=this.getActualLength(t.length);this._length=i,this._values=this.shouldCopyValues()?new Array(i):this._values;for(var n=this._promise,s=!1,a=null,o=0;o=this._length&&(this._resolve(this._values),!0)},o.prototype._promiseCancelled=function(){return this._cancel(),!0},o.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},o.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var i=0;i=this._length){var i;if(this._isMap)i=function(t){for(var e=new s,i=t.length/2|0,r=0;r>1},e.prototype.props=function(){return c(this)},e.props=function(t){return c(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,i){"use strict";function r(t){this._capacity=t,this._length=0,this._front=0}r.prototype._willBeOverCapacity=function(t){return this._capacity=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseFulfilled=function(t,e){var i=new n;return i._bitField=33554432,i._settledValueField=t,this._promiseResolved(e,i)},s.prototype._promiseRejected=function(t,e){var i=new n;return i._bitField=16777216,i._settledValueField=t,this._promiseResolved(e,i)},e.settle=function(t){return r.deprecated(".settle()",".reflect()"),new s(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,i){"use strict";e.exports=function(e,i,r){var n=t("./util"),s=t("./errors").RangeError,a=t("./errors").AggregateError,o=n.isArray,h={};function u(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function l(t,e){if((0|e)!==e||e<0)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var i=new u(t),n=i.promise();return i.setHowMany(e),i.init(),n}n.inherits(u,i),u.prototype._init=function(){if(this._initialized)if(0!==this._howMany){this._init$(void 0,-5);var t=o(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}else this._resolve([])},u.prototype.init=function(){this._initialized=!0,this._init()},u.prototype.setUnwrap=function(){this._unwrap=!0},u.prototype.howMany=function(){return this._howMany},u.prototype.setHowMany=function(t){this._howMany=t},u.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},u.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},u.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(h),this._checkOutcome())},u.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new a,e=this.length();e0?this._reject(t):this._cancel(),!0}return!1},u.prototype._fulfilled=function(){return this._totalResolved},u.prototype._rejected=function(){return this._values.length-this.length()},u.prototype._addRejected=function(t){this._values.push(t)},u.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},u.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},u.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new s(e)},u.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return l(t,e)},e.prototype.some=function(t){return l(this,t)},e._SomePromiseArray=u}},{"./errors":12,"./util":36}],32:[function(t,e,i){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var i=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},n=e.prototype.isFulfilled=function(){return 0!=(33554432&this._bitField)},s=e.prototype.isRejected=function(){return 0!=(16777216&this._bitField)},a=e.prototype.isPending=function(){return 0==(50397184&this._bitField)},o=e.prototype.isResolved=function(){return 0!=(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!=(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536==(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!=(8454144&this._target()._bitField)},t.prototype.isPending=function(){return a.call(this._target())},t.prototype.isRejected=function(){return s.call(this._target())},t.prototype.isFulfilled=function(){return n.call(this._target())},t.prototype.isResolved=function(){return o.call(this._target())},t.prototype.value=function(){return i.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),r.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,i){"use strict";e.exports=function(e,i){var r=t("./util"),n=r.errorObj,s=r.isObject,a={}.hasOwnProperty;return function(t,o){if(s(t)){if(t instanceof e)return t;var h=function(t){try{return function(t){return t.then}(t)}catch(t){return n.e=t,n}}(t);if(h===n){o&&o._pushContext();var u=e.reject(h.e);return o&&o._popContext(),u}if("function"==typeof h)return function(t){try{return a.call(t,"_promise0")}catch(t){return!1}}(t)?(u=new e(i),t._then(u._fulfill,u._reject,void 0,u,null),u):function(t,s,a){var o=new e(i),h=o;a&&a._pushContext(),o._captureStackTrace(),a&&a._popContext();var u=!0,l=r.tryCatch(s).call(t,(function(t){o&&(o._resolveCallback(t),o=null)}),(function(t){o&&(o._rejectCallback(t,u,!0),o=null)}));return u=!1,o&&l===n&&(o._rejectCallback(l.e,!0,!0),o=null),h}(t,h,o)}return t}}},{"./util":36}],34:[function(t,e,i){"use strict";e.exports=function(e,i,r){var n=t("./util"),s=e.TimeoutError;function a(t){this.handle=t}a.prototype._resultCancelled=function(){clearTimeout(this.handle)};var o=function(t){return h(+this).thenReturn(t)},h=e.delay=function(t,n){var s,h;return void 0!==n?(s=e.resolve(n)._then(o,null,null,t,void 0),r.cancellation()&&n instanceof e&&s._setOnCancel(n)):(s=new e(i),h=setTimeout((function(){s._fulfill()}),+t),r.cancellation()&&s._setOnCancel(new a(h)),s._captureStackTrace()),s._setAsyncGuaranteed(),s};function u(t){return clearTimeout(this.handle),t}function l(t){throw clearTimeout(this.handle),t}e.prototype.delay=function(t){return h(t,this)},e.prototype.timeout=function(t,e){var i,o;t=+t;var h=new a(setTimeout((function(){i.isPending()&&function(t,e,i){var r;r="string"!=typeof e?e instanceof Error?e:new s("operation timed out"):new s(e),n.markAsOriginatingFromRejection(r),t._attachExtraTrace(r),t._reject(r),null!=i&&i.cancel()}(i,e,o)}),t));return r.cancellation()?(o=this.then(),(i=o._then(u,l,void 0,h,void 0))._setOnCancel(h)):i=this._then(u,l,void 0,h,void 0),i}}},{"./util":36}],35:[function(t,e,i){"use strict";e.exports=function(e,i,r,n,s,a){var o=t("./util"),h=t("./errors").TypeError,u=t("./util").inherits,l=o.errorObj,c=o.tryCatch,f={};function p(t){setTimeout((function(){throw t}),0)}function d(t,i){var n=0,a=t.length,o=new e(s);return function s(){if(n>=a)return o._fulfill();var h=function(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}(t[n++]);if(h instanceof e&&h._isDisposable()){try{h=r(h._getDisposer().tryDispose(i),t.promise)}catch(t){return p(t)}if(h instanceof e)return h._then(s,p,null,null,null)}s()}(),o}function m(t,e,i){this._data=t,this._promise=e,this._context=i}function y(t,e,i){this.constructor$(t,e,i)}function g(t){return m.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function _(t){this.length=t,this.promise=null,this[t-1]=null}m.prototype.data=function(){return this._data},m.prototype.promise=function(){return this._promise},m.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():f},m.prototype.tryDispose=function(t){var e=this.resource(),i=this._context;void 0!==i&&i._pushContext();var r=e!==f?this.doDispose(e,t):null;return void 0!==i&&i._popContext(),this._promise._unsetDisposable(),this._data=null,r},m.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},u(y,m),y.prototype.doDispose=function(t,e){return this.data().call(t,t,e)},_.prototype._resultCancelled=function(){for(var t=this.length,i=0;i0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new y(t,this,n());throw new h}}},{"./errors":12,"./util":36}],36:[function(t,r,n){"use strict";var s,a=t("./es5"),o="undefined"==typeof navigator,h={e:{}},u="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==i?i:void 0!==this?this:null;function l(){try{var t=s;return s=null,t.apply(this,arguments)}catch(t){return h.e=t,h}}function c(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function f(t,e,i){if(c(t))return t;var r={value:i,configurable:!0,enumerable:!1,writable:!0};return a.defineProperty(t,e,r),t}var p=function(){var t=[Array.prototype,Object.prototype,Function.prototype],e=function(e){for(var i=0;i1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),n=d.test(t+"")&&a.names(t).length>0;if(i||r||n)return!0}return!1}catch(t){return!1}},isIdentifier:function(t){return m.test(t)},inheritedDataKeys:p,getDataPropertyOrDefault:function(t,e,i){if(!a.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var r=Object.getOwnPropertyDescriptor(t,e);return null!=r?null==r.get&&null==r.set?r.value:i:void 0},thrower:function(t){throw t},isArray:a.isArray,asArray:w,notEnumerableProp:f,isPrimitive:c,isObject:function(t){return"function"==typeof t||"object"==typeof t&&null!==t},isError:g,canEvaluate:o,errorObj:h,tryCatch:function(t){return s=t,l},inherits:function(t,e){var i={}.hasOwnProperty;function r(){for(var r in this.constructor=t,this.constructor$=e,e.prototype)i.call(e.prototype,r)&&"$"!==r.charAt(r.length-1)&&(this[r+"$"]=e.prototype[r])}return r.prototype=e.prototype,t.prototype=new r,t.prototype},withAppended:function(t,e){var i,r=t.length,n=new Array(r+1);for(i=0;i10||t[0]>0}(),k.isNode&&k.toFastProperties(e);try{throw new Error}catch(t){k.lastLineError=t}r.exports=k},{"./es5":13}]},{},[4])(4),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,i(4),i(0),i(25).setImmediate)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if(!e.eol&&t)for(var i=0,r=t.length;i0?("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),r?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):w(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!i?(e=a.decoder.write(e),a.objectMode||0!==e.length?w(t,a,e,!1):C(t,a)):w(t,a,e,!1))):r||(a.reading=!1)),function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=M?t=M:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function E(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(p("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(k,t):k(t))}function k(t){p("emit readable"),t.emit("readable"),j(t)}function C(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(S,t,e))}function S(t,e){for(var i=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(i=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):i=function(t,e,i){var r;return ts.length?s.length:t;if(a===s.length?n+=s:n+=s.slice(0,t),0==(t-=a)){a===s.length?(++r,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=s.slice(a));break}++r}return e.length-=r,n}(t,e):function(t,e){var i=u.allocUnsafe(t),r=e.head,n=1;for(r.data.copy(i),t-=r.data.length;r=r.next;){var s=r.data,a=t>s.length?s.length:t;if(s.copy(i,i.length-t,0,a),0==(t-=a)){a===s.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(a));break}++n}return e.length-=n,i}(t,e),r}(t,e.buffer,e.decoder),i);var i}function R(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,n.nextTick(T,e,t))}function T(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function I(t,e){for(var i=0,r=t.length;i=e.highWaterMark||e.ended))return p("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?R(this):E(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&R(this),null;var r,n=e.needReadable;return p("need readable",n),(0===e.length||e.length-t0?O(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),i!==t&&e.ended&&R(this)),null!==r&&this.emit("data",r),r},v.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(t,e){var i=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=t;break;case 1:s.pipes=[s.pipes,t];break;default:s.pipes.push(t)}s.pipesCount+=1,p("pipe count=%d opts=%j",s.pipesCount,e);var h=e&&!1===e.end||t===r.stdout||t===r.stderr?_:u;function u(){p("onend"),t.end()}s.endEmitted?n.nextTick(h):i.once("end",h),t.on("unpipe",(function e(r,n){p("onunpipe"),r===i&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,p("cleanup"),t.removeListener("close",y),t.removeListener("finish",g),t.removeListener("drain",l),t.removeListener("error",m),t.removeListener("unpipe",e),i.removeListener("end",u),i.removeListener("end",_),i.removeListener("data",d),c=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}));var l=function(t){return function(){var e=t._readableState;p("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,j(t))}}(i);t.on("drain",l);var c=!1,f=!1;function d(e){p("ondata"),f=!1,!1!==t.write(e)||f||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==I(s.pipes,t))&&!c&&(p("false write response, pause",i._readableState.awaitDrain),i._readableState.awaitDrain++,f=!0),i.pause())}function m(e){p("onerror",e),_(),t.removeListener("error",m),0===o(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",g),_()}function g(){p("onfinish"),t.removeListener("close",y),_()}function _(){p("unpipe"),i.unpipe(t)}return i.on("data",d),function(t,e,i){if("function"==typeof t.prependListener)return t.prependListener(e,i);t._events&&t._events[e]?a(t._events[e])?t._events[e].unshift(i):t._events[e]=[i,t._events[e]]:t.on(e,i)}(t,"error",m),t.once("close",y),t.once("finish",g),t.emit("pipe",i),s.flowing||(p("pipe resume"),i.resume()),t},v.prototype.unpipe=function(t){var e=this._readableState,i={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,i)),this;if(!t){var r=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},i(43),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,i(0))},function(t,e,i){"use strict";var r=i(7).Buffer,n=r.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===n||!n(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=h,this.end=u,e=4;break;case"utf8":this.fillLast=o,e=4;break;case"base64":this.text=l,this.end=c,e=3;break;default:return this.write=f,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function o(t){var e=this.lastTotal-this.lastNeed,i=function(t,e,i){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==i?i:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function h(t,e){if((t.length-e)%2==0){var i=t.toString("utf16le",e);if(i){var r=i.charCodeAt(i.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,i)}return e}function l(t,e){var i=(t.length-e)%3;return 0===i?t.toString("base64",e):(this.lastNeed=3-i,this.lastTotal=3,1===i?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-i))}function c(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function f(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}e.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,i;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i=0?(n>0&&(t.lastNeed=n-1),n):--r=0?(n>0&&(t.lastNeed=n-2),n):--r=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=i;var r=t.length-(i-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},s.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,i){"use strict";t.exports=s;var r=i(1),n=i(5);function s(t){if(!(this instanceof s))return new s(t);r.call(this,t),this._transformState={afterTransform:function(t,e){var i=this._transformState;i.transforming=!1;var r=i.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));i.writechunk=null,i.writecb=null,null!=e&&this.push(e),r(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length-1&&i.push(t[r]);return i},e.trimLeft=String.prototype.trimLeft?function(t){return t.trimLeft()}:function(t){return t.replace(/^\s+/,"")},e.trimRight=String.prototype.trimRight?function(t){return t.trimRight()}:function(t){return t.replace(/\s+$/,"")}}).call(this,i(3).Buffer)},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var n=function(t){function e(e,i,r){var n=t.call(this,"Error: "+e+". JSON Line number: "+i+(r?" near: "+r:""))||this;return n.err=e,n.line=i,n.extra=r,n.name="CSV Parse Error",n}return r(e,t),e.column_mismatched=function(t,i){return new e("column_mismatched",t,i)},e.unclosed_quote=function(t,i){return new e("unclosed_quote",t,i)},e.fromJSON=function(t){return new e(t.err,t.line,t.extra)},e.prototype.toJSON=function(){return{err:this.err,line:this.line,extra:this.extra}},e}(Error);e.default=n},function(t,e,i){var r=i(17),n=i(68),s=i(69),a=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?n(t):s(t)}},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e,i){t.exports=i(33)},function(t,e,i){"use strict";var r=i(34),n=function(t,e){return new r.Converter(t,e)};n.csv=n,n.Converter=r.Converter,t.exports=n},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var s=i(35),a=i(50),o=i(51),h=n(i(14)),u=i(52),l=i(105),c=function(t){function e(e,i){void 0===i&&(i={});var r=t.call(this,i)||this;return r.options=i,r.params=a.mergeParams(e),r.runtime=o.initParseRuntime(r),r.result=new l.Result(r),r.processor=new u.ProcessorLocal(r),r.once("error",(function(t){setTimeout((function(){r.result.processError(t),r.emit("done",t)}),0)})),r.once("done",(function(){r.processor.destroy()})),r}return r(e,t),e.prototype.preRawData=function(t){return this.runtime.preRawDataHook=t,this},e.prototype.preFileLine=function(t){return this.runtime.preFileLineHook=t,this},e.prototype.subscribe=function(t,e,i){return this.parseRuntime.subscribe={onNext:t,onError:e,onCompleted:i},this},e.prototype.fromFile=function(t,e){var r=this,n=i(!function(){var t=new Error("Cannot find module 'fs'");throw t.code="MODULE_NOT_FOUND",t}());return n.exists(t,(function(i){i?n.createReadStream(t,e).pipe(r):r.emit("error",new Error("File does not exist. Check to make sure the file path to your csv is correct."))})),this},e.prototype.fromStream=function(t){return t.pipe(this),this},e.prototype.fromString=function(t){t.toString();var e=new s.Readable,i=0;return e._read=function(e){if(i>=t.length)this.push(null);else{var r=t.substr(i,e);this.push(r),i+=e}},this.fromStream(e)},e.prototype.then=function(t,e){var i=this;return new h.default((function(r,n){i.parseRuntime.then={onfulfilled:function(e){r(t?t(e):e)},onrejected:function(t){e?r(e(t)):n(t)}}}))},Object.defineProperty(e.prototype,"parseParam",{get:function(){return this.params},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parseRuntime",{get:function(){return this.runtime},enumerable:!0,configurable:!0}),e.prototype._transform=function(t,e,i){var r=this;this.processor.process(t).then((function(t){if(t.length>0)return r.runtime.started=!0,r.result.processResult(t)})).then((function(){r.emit("drained"),i()}),(function(t){r.runtime.hasError=!0,r.runtime.error=t,r.emit("error",t),i()}))},e.prototype._flush=function(t){var e=this;this.processor.flush().then((function(t){if(t.length>0)return e.result.processResult(t)})).then((function(){e.processEnd(t)}),(function(i){e.emit("error",i),t()}))},e.prototype.processEnd=function(t){this.result.endProcess(),this.emit("done"),t()},Object.defineProperty(e.prototype,"parsedLineNumber",{get:function(){return this.runtime.parsedLineNumber},enumerable:!0,configurable:!0}),e}(s.Transform);e.Converter=c},function(t,e,i){t.exports=n;var r=i(11).EventEmitter;function n(){r.call(this)}i(2)(n,r),n.Readable=i(12),n.Writable=i(46),n.Duplex=i(47),n.Transform=i(48),n.PassThrough=i(49),n.Stream=n,n.prototype.pipe=function(t,e){var i=this;function n(e){t.writable&&!1===t.write(e)&&i.pause&&i.pause()}function s(){i.readable&&i.resume&&i.resume()}i.on("data",n),t.on("drain",s),t._isStdio||e&&!1===e.end||(i.on("end",o),i.on("close",h));var a=!1;function o(){a||(a=!0,t.end())}function h(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function u(t){if(l(),0===r.listenerCount(this,"error"))throw t}function l(){i.removeListener("data",n),t.removeListener("drain",s),i.removeListener("end",o),i.removeListener("close",h),i.removeListener("error",u),t.removeListener("error",u),i.removeListener("end",l),i.removeListener("close",l),t.removeListener("close",l)}return i.on("error",u),t.on("error",u),i.on("end",l),i.on("close",l),t.on("close",l),t.emit("pipe",i),t}},function(t,e){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,e,i){"use strict";e.byteLength=function(t){var e=u(t),i=e[0],r=e[1];return 3*(i+r)/4-r},e.toByteArray=function(t){for(var e,i=u(t),r=i[0],a=i[1],o=new s(3*(r+a)/4-a),h=0,l=a>0?r-4:r,c=0;c>16&255,o[h++]=e>>8&255,o[h++]=255&e;return 2===a&&(e=n[t.charCodeAt(c)]<<2|n[t.charCodeAt(c+1)]>>4,o[h++]=255&e),1===a&&(e=n[t.charCodeAt(c)]<<10|n[t.charCodeAt(c+1)]<<4|n[t.charCodeAt(c+2)]>>2,o[h++]=e>>8&255,o[h++]=255&e),o},e.fromByteArray=function(t){for(var e,i=t.length,n=i%3,s=[],a=0,o=i-n;ao?o:a+16383));return 1===n?(e=t[i-1],s.push(r[e>>2]+r[e<<4&63]+"==")):2===n&&(e=(t[i-2]<<8)+t[i-1],s.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),s.join("")};for(var r=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,h=a.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");return-1===i&&(i=e),[i,i===e?0:4-i%4]}function l(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function c(t,e,i){for(var r,n=[],s=e;s>1,l=-7,c=i?n-1:0,f=i?-1:1,p=t[e+c];for(c+=f,s=p&(1<<-l)-1,p>>=-l,l+=o;l>0;s=256*s+t[e+c],c+=f,l-=8);for(a=s&(1<<-l)-1,s>>=-l,l+=r;l>0;a=256*a+t[e+c],c+=f,l-=8);if(0===s)s=1-u;else{if(s===h)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),s-=u}return(p?-1:1)*a*Math.pow(2,s-r)},e.write=function(t,e,i,r,n,s){var a,o,h,u=8*s-n-1,l=(1<>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:s-1,d=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-a))<1&&(a--,h*=2),(e+=a+c>=1?f/h:f*Math.pow(2,1-c))*h>=2&&(a++,h/=2),a+c>=l?(o=0,a=l):a+c>=1?(o=(e*h-1)*Math.pow(2,n),a+=c):(o=e*Math.pow(2,c-1)*Math.pow(2,n),a=0));n>=8;t[i+p]=255&o,p+=d,o/=256,n-=8);for(a=a<0;t[i+p]=255&a,p+=d,a/=256,u-=8);t[i+p-d]|=128*m}},function(t,e){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,e){},function(t,e,i){"use strict";var r=i(7).Buffer,n=i(42);function s(t,e,i){t.copy(e,i)}t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,i=""+e.data;e=e.next;)i+=t+e.data;return i},t.prototype.concat=function(t){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var e=r.allocUnsafe(t>>>0),i=this.head,n=0;i;)s(i.data,e,n),n+=i.data.length,i=i.next;return e},t}(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var t=n.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,i){(function(t,e){!function(t,i){"use strict";if(!t.setImmediate){var r,n=1,s={},a=!1,o=t.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(t);h=h&&h.setTimeout?h:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){l(t)}))}:function(){if(t.postMessage&&!t.importScripts){var e=!0,i=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=i,e}}()?function(){var e="setImmediate$"+Math.random()+"$",i=function(i){i.source===t&&"string"==typeof i.data&&0===i.data.indexOf(e)&&l(+i.data.slice(e.length))};t.addEventListener?t.addEventListener("message",i,!1):t.attachEvent("onmessage",i),r=function(i){t.postMessage(e+i,"*")}}():t.MessageChannel?function(){var t=new MessageChannel;t.port1.onmessage=function(t){l(t.data)},r=function(e){t.port2.postMessage(e)}}():o&&"onreadystatechange"in o.createElement("script")?function(){var t=o.documentElement;r=function(e){var i=o.createElement("script");i.onreadystatechange=function(){l(e),i.onreadystatechange=null,t.removeChild(i),i=null},t.appendChild(i)}}():r=function(t){setTimeout(l,0,t)},h.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),i=0;i0){var e=this.runtime.csvLineBuffer;return this.runtime.csvLineBuffer=void 0,this.process(e,!0).then((function(e){return t.runtime.csvLineBuffer&&t.runtime.csvLineBuffer.length>0?a.default.reject(p.default.unclosed_quote(t.runtime.parsedLineNumber,t.runtime.csvLineBuffer.toString())):a.default.resolve(e)}))}return a.default.resolve([])},i.prototype.destroy=function(){return a.default.resolve()},Object.defineProperty(i.prototype,"needEmitEol",{get:function(){return void 0===this._needEmitEol&&(this._needEmitEol=this.converter.listeners("eol").length>0),this._needEmitEol},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"needEmitHead",{get:function(){return void 0===this._needEmitHead&&(this._needEmitHead=this.converter.listeners("header").length>0),this._needEmitHead},enumerable:!0,configurable:!0}),i.prototype.process=function(t,e){var i,r=this;return void 0===e&&(e=!1),i=e?t.toString():o.prepareData(t,this.converter.parseRuntime),a.default.resolve().then((function(){return r.runtime.preRawDataHook?r.runtime.preRawDataHook(i):i})).then((function(t){return t&&t.length>0?r.processCSV(t,e):a.default.resolve([])}))},i.prototype.processCSV=function(t,e){var i=this,r=this.params,n=this.runtime;n.eol||h.default(t,n),this.needEmitEol&&!this.eolEmitted&&n.eol&&(this.converter.emit("eol",n.eol),this.eolEmitted=!0),r.ignoreEmpty&&!n.started&&(t=l.trimLeft(t));var s=u.stringToLines(t,n);return e?(s.lines.push(s.partial),s.partial=""):this.prependLeftBuf(l.bufFromString(s.partial)),s.lines.length>0?(n.preFileLineHook?this.runPreLineHook(s.lines):a.default.resolve(s.lines)).then((function(t){return n.started||i.runtime.headers?i.processCSVBody(t):i.processDataWithHead(t)})):a.default.resolve([])},i.prototype.processDataWithHead=function(t){if(this.params.noheader)this.params.headers?this.runtime.headers=this.params.headers:this.runtime.headers=[];else{for(var e="",i=[];t.length;){var r=e+t.shift(),n=this.rowSplit.parse(r);if(n.closed){i=n.cells,e="";break}e=r+h.default(r,this.runtime)}if(this.prependLeftBuf(l.bufFromString(e)),0===i.length)return[];this.params.headers?this.runtime.headers=this.params.headers:this.runtime.headers=i}return(this.runtime.needProcessIgnoreColumn||this.runtime.needProcessIncludeColumn)&&this.filterHeader(),this.needEmitHead&&!this.headEmitted&&(this.converter.emit("header",this.runtime.headers),this.headEmitted=!0),this.processCSVBody(t)},i.prototype.filterHeader=function(){if(this.runtime.selectedColumns=[],this.runtime.headers){for(var t=this.runtime.headers,e=0;e=e.length)n();else if(i.preFileLineHook){var s=e[r],a=i.preFileLineHook(s,i.parsedLineNumber+r);if(r++,a&&a.then)a.then((function(s){e[r-1]=s,t(e,i,r,n)}));else{for(e[r-1]=a;r0?t.concat([i.csvLineBuffer,e]):e}(e,i);i.csvLineBuffer=void 0;var s=function(t,e){var i=t.length-1;if(0!=(128&t[i])){for(;128==(192&t[i]);)i--;i--}return i!=t.length-1?(e.csvLineBuffer=t.slice(i+1),t.slice(0,i+1)):t}(r,i).toString("utf8");return!1===i.started?n.default(s):s}}).call(this,i(3).Buffer)},function(t,e,i){"use strict";(function(e){var r=i(56);t.exports=function(t){return"string"==typeof t&&65279===t.charCodeAt(0)?t.slice(1):e.isBuffer(t)&&r(t)&&239===t[0]&&187===t[1]&&191===t[2]?t.slice(3):t}}).call(this,i(3).Buffer)},function(t,e){t.exports=function(t){for(var e=0;e0),this._needEmitDelimiter},enumerable:!0,configurable:!0}),t.prototype.parse=function(t){if(0===t.length||this.conv.parseParam.ignoreEmpty&&0===t.trim().length)return{cells:[],closed:!0};var e=this.quote,i=this.trim;this.escape,(this.conv.parseRuntime.delimiter instanceof Array||"auto"===this.conv.parseRuntime.delimiter.toLowerCase())&&(this.conv.parseRuntime.delimiter=this.getDelimiter(t)),this.needEmitDelimiter&&!this.delimiterEmitted&&(this.conv.emit("delimiter",this.conv.parseRuntime.delimiter),this.delimiterEmitted=!0);var r=this.conv.parseRuntime.delimiter,n=t.split(r);if("off"===e){if(i)for(var s=0;si&&(r=e,i=n)})),r},t.prototype.isQuoteOpen=function(t){var e=this.quote,i=this.escape;return t[0]===e&&(t[1]!==e||t[1]===i&&(t[2]===e||2===t.length))},t.prototype.isQuoteClose=function(t){var e=this.quote,i=this.escape;this.conv.parseParam.trim&&(t=s.trimRight(t));for(var r=0,n=t.length-1;t[n]===e||t[n]===i;)n--,r++;return r%2!=0},t.prototype.escapeQuote=function(t){var e="es|"+this.quote+"|"+this.escape;void 0===this.cachedRegExp[e]&&(this.cachedRegExp[e]=new RegExp("\\"+this.escape+"\\"+this.quote,"g"));var i=this.cachedRegExp[e];return t.replace(i,this.quote)},t.prototype.parseMultiLines=function(t){for(var e=[],i="";t.length;){var r=i+t.shift(),a=this.parse(r);0===a.cells.length&&this.conv.parseParam.ignoreEmpty||(a.closed||this.conv.parseParam.alwaysSplitAtEOL?(this.conv.parseRuntime.selectedColumns?e.push(s.filterArray(a.cells,this.conv.parseRuntime.selectedColumns)):e.push(a.cells),i=""):i=r+(n.default(r,this.conv.parseRuntime)||"\n"))}return{rowsCells:e,partial:i}},t}();e.RowSplit=o},function(t,e,i){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var n=r(i(29)),s=r(i(60)),a=/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/;function o(t,e,i){if(e.parseParam.checkColumn&&e.parseRuntime.headers&&t.length!==e.parseRuntime.headers.length)throw n.default.column_mismatched(e.parseRuntime.parsedLineNumber+i);return function(t,e,i){for(var r=!1,n={},s=0,a=t.length;s-1?r.parseParam.colParser[e]&&r.parseParam.colParser[e].flat?r.parseRuntime.columnValueSetter[n]=c:r.parseRuntime.columnValueSetter[n]=f:r.parseRuntime.columnValueSetter[n]=c),r.parseRuntime.columnValueSetter[n](t,e,i)}function c(t,e,i){t[e]=i}function f(t,e,i){s.default(t,e,i)}function p(t,e,i,r){return r.parseRuntime.headerType[i]?r.parseRuntime.headerType[i]:e.indexOf("number#!")>-1?r.parseRuntime.headerType[i]=d:e.indexOf("string#!")>-1?r.parseRuntime.headerType[i]=m:r.parseParam.checkType?r.parseRuntime.headerType[i]=y:r.parseRuntime.headerType[i]=m}function d(t){var e=parseFloat(t);return isNaN(e)?t:e}function m(t){return t.toString()}function y(t){var e=t.trim();return""===e?m(t):a.test(e)?d(t):5===e.length&&"false"===e.toLowerCase()||4===e.length&&"true"===e.toLowerCase()?function(t){var e=t.trim();return 5!==e.length||"false"!==e.toLowerCase()}(t):"{"===e[0]&&"}"===e[e.length-1]||"["===e[0]&&"]"===e[e.length-1]?function(t){try{return JSON.parse(t)}catch(e){return t}}(t):m(t)}},function(t,e,i){var r=i(61);t.exports=function(t,e,i){return null==t?t:r(t,e,i)}},function(t,e,i){var r=i(62),n=i(74),s=i(103),a=i(19),o=i(104);t.exports=function(t,e,i,h){if(!a(t))return t;for(var u=-1,l=(e=n(e,t)).length,c=l-1,f=t;null!=f&&++u-1}},function(t,e,i){var r=i(9);t.exports=function(t,e){var i=this.__data__,n=r(i,t);return n<0?(++this.size,i.push([t,e])):i[n][1]=e,this}},function(t,e,i){var r=i(16)(i(18),"Map");t.exports=r},function(t,e,i){var r=i(10);t.exports=function(t){var e=r(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,i){var r=i(10);t.exports=function(t){return r(this,t).get(t)}},function(t,e,i){var r=i(10);t.exports=function(t){return r(this,t).has(t)}},function(t,e,i){var r=i(10);t.exports=function(t,e){var i=r(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this}},function(t,e,i){var r=i(101);t.exports=function(t){return null==t?"":r(t)}},function(t,e,i){var r=i(17),n=i(102),s=i(20),a=i(21),o=r?r.prototype:void 0,h=o?o.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(s(e))return n(e,t)+"";if(a(e))return h?h.call(e):"";var i=e+"";return"0"==i&&1/e==-1/0?"-0":i}},function(t,e){t.exports=function(t,e){for(var i=-1,r=null==t?0:t.length,n=Array(r);++i-1&&t%1==0&&t0||this.converter.listeners("readable").length>0),this._needPushDownstream},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"needEmitAll",{get:function(){return!!this.converter.parseRuntime.then},enumerable:!0,configurable:!0}),t.prototype.processResult=function(t){var e=this;return this.converter.parseRuntime.parsedLineNumber,new n.default((function(i,r){e.needEmitLine?function t(e,i,r,n,s){if(r>=e.length)s();else if(i.parseRuntime.subscribe&&i.parseRuntime.subscribe.onNext){var o=i.parseRuntime.subscribe.onNext,h=e[r],u=o(h,i.parseRuntime.parsedLineNumber+r);if(r++,u&&u.then)u.then((function(){!function(e,i,r,n,s,o,h){s&&a(r,h),t(e,r,n,s,o)}(e,0,i,r,n,s,h)}),s);else{for(n&&a(i,h);r0?90:-90),t.lat_ts=t.lat1)}function o(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?o[t]=ut(arguments[1]):o[t]=gt(arguments[1]):o[t]=i}else if(1===arguments.length){if(Array.isArray(t))return t.map((function(t){Array.isArray(t)?o.apply(e,t):o(t)}));if("string"==typeof t){if(t in o)return o[t]}else"EPSG"in t?o["EPSG:"+t.EPSG]=t:"ESRI"in t?o["ESRI:"+t.ESRI]=t:"IAU2000"in t?o["IAU2000:"+t.IAU2000]=t:console.log(t);return}}function h(e){var i=t(e,"authority");if(i){var r=t(i,"epsg");return r&&vt.indexOf(r)>-1}}function u(e){var i=t(e,"extension");if(i)return t(i,"proj4")}function l(t){if(!function(t){return"string"==typeof t}(t))return t;if(function(t){return t in o}(t))return o[t];if(function(t){return _t.some((function(e){return t.indexOf(e)>-1}))}(t)){var e=gt(t);if(h(e))return o["EPSG:3857"];var i=u(e);return i?ut(i):e}return function(t){return"+"===t[0]}(t)?ut(t):void 0}function c(t){return t}function f(t,e){var i=At.length;return t.names?(At[i]=t,t.names.forEach((function(t){St[t.toLowerCase()]=i})),this):(console.log(e),!0)}function p(t){if(0===t.length)return null;var e="@"===t[0];return e&&(t=t.slice(1)),"null"===t?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:t,mandatory:!e,grid:Tt[t]||null,isNull:!1}}function d(t){return t/3600*Math.PI/180}function m(t,e,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,i)))}function y(t,e,i){for(var r=[],n=0;n3&&(0===o.datum_params[3]&&0===o.datum_params[4]&&0===o.datum_params[5]&&0===o.datum_params[6]||(o.datum_type=H,o.datum_params[3]*=Z,o.datum_params[4]*=Z,o.datum_params[5]*=Z,o.datum_params[6]=o.datum_params[6]/1e6+1))),a&&(o.datum_type=Q,o.grids=a),o.a=i,o.b=r,o.es=n,o.ep2=s,o}(r.datumCode,r.datum_params,a.a,a.b,o.es,o.ep2,h);bt(this,r),bt(this,n),this.a=a.a,this.b=a.b,this.rf=a.rf,this.sphere=a.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=u,this.init(),i(null,this)}else i(e)}else i(e)}function w(t,e,i){var r,n,s,a,o=t.x,h=t.y,u=t.z?t.z:0;if(h<-J&&h>-1.001*J)h=-J;else if(h>J&&h<1.001*J)h=J;else{if(h<-J)return{x:-1/0,y:-1/0,z:t.z};if(h>J)return{x:1/0,y:1/0,z:t.z}}return o>Math.PI&&(o-=2*Math.PI),n=Math.sin(h),a=Math.cos(h),s=n*n,{x:((r=i/Math.sqrt(1-e*s))+u)*a*Math.cos(o),y:(r+u)*a*Math.sin(o),z:(r*(1-e)+u)*n}}function M(t,e,i,r){var n,s,a,o,h,u,l,c,f,p,d,m,y,g,_,v=t.x,b=t.y,w=t.z?t.z:0;if(n=Math.sqrt(v*v+b*b),s=Math.sqrt(v*v+b*b+w*w),n/i<1e-12){if(g=0,s/i<1e-12)return J,_=-r,{x:t.x,y:t.y,z:t.z}}else g=Math.atan2(b,v);a=w/s,c=(o=n/s)*(1-e)*(h=1/Math.sqrt(1-e*(2-e)*o*o)),f=a*h,y=0;do{y++,u=e*(l=i/Math.sqrt(1-e*f*f))/(l+(_=n*c+w*f-l*(1-e*f*f))),m=(d=a*(h=1/Math.sqrt(1-u*(2-u)*o*o)))*c-(p=o*(1-u)*h)*f,c=p,f=d}while(m*m>1e-24&&y<30);return{x:g,y:Math.atan(d/Math.abs(p)),z:_}}function x(t){return t===W||t===H}function E(t,e,i){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;for(var r={x:-i.x,y:i.y},n={x:Number.NaN,y:Number.NaN},s=[],a=0;ar.y||l>r.x||p1e-12&&Math.abs(a.y)>1e-12);if(h<0)return console.log("Inverse grid shift iterator failed to converge."),r;r.x=xt(s.x+i.ll[0]),r.y=s.y+i.ll[1]}else isNaN(s.x)||(r.x=t.x+s.x,r.y=t.y+s.y);return r}function C(t,e){var i,r={x:t.x/e.del[0],y:t.y/e.del[1]},n=Math.floor(r.x),s=Math.floor(r.y),a=r.x-1*n,o=r.y-1*s,h={x:Number.NaN,y:Number.NaN};if(n<0||n>=e.lim[0])return h;if(s<0||s>=e.lim[1])return h;i=s*e.lim[0]+n;var u=e.cvs[i][0],l=e.cvs[i][1];i++;var c=e.cvs[i][0],f=e.cvs[i][1];i+=e.lim[0];var p=e.cvs[i][0],d=e.cvs[i][1];i--;var m=e.cvs[i][0],y=e.cvs[i][1],g=a*o,_=a*(1-o),v=(1-a)*(1-o),b=(1-a)*o;return h.x=v*u+_*c+b*m+g*p,h.y=v*l+_*f+b*y+g*d,h}function S(t){if("function"==typeof Number.isFinite){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if("number"!=typeof t||t!=t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function A(t,e,i,r){var n;if(Array.isArray(i)&&(i=Lt(i)),Bt(i),t.datum&&e.datum&&function(t,e){return(t.datum.datum_type===W||t.datum.datum_type===H)&&"WGS84"!==e.datumCode||(e.datum.datum_type===W||e.datum.datum_type===H)&&"WGS84"!==t.datumCode}(t,e)&&(i=A(t,n=new b("WGS84"),i,r),t=n),r&&"enu"!==t.axis&&(i=Nt(t,!1,i)),"longlat"===t.projName)i={x:i.x*et,y:i.y*et,z:i.z||0};else if(t.to_meter&&(i={x:i.x*t.to_meter,y:i.y*t.to_meter,z:i.z||0}),!(i=t.inverse(i)))return;if(t.from_greenwich&&(i.x+=t.from_greenwich),i=It(t.datum,e.datum,i))return e.from_greenwich&&(i={x:i.x-e.from_greenwich,y:i.y,z:i.z||0}),"longlat"===e.projName?i={x:i.x*it,y:i.y*it,z:i.z||0}:(i=e.forward(i),e.to_meter&&(i={x:i.x/e.to_meter,y:i.y/e.to_meter,z:i.z||0})),r&&"enu"!==e.axis?Nt(e,!0,i):i}function P(t,e,i,r){var n,s,a;return Array.isArray(i)?(n=A(t,e,i,r)||{x:NaN,y:NaN},i.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name?"number"==typeof n.z?[n.x,n.y,n.z].concat(i.splice(3)):[n.x,n.y,i[2]].concat(i.splice(3)):[n.x,n.y].concat(i.splice(2)):[n.x,n.y]):(s=A(t,e,i,r),2===(a=Object.keys(i)).length||a.forEach((function(r){if(void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name){if("x"===r||"y"===r||"z"===r)return}else if("x"===r||"y"===r)return;s[r]=i[r]})),s)}function j(t){return t instanceof b?t:t.oProj?t.oProj:b(t)}function O(t,e,i){t=j(t);var r,n=!1;return void 0===e?(e=t,t=Ft,n=!0):(void 0!==e.x||Array.isArray(e))&&(i=e,e=t,t=Ft,n=!0),e=j(e),i?P(t,e,i):(r={forward:function(i,r){return P(t,e,i,r)},inverse:function(i,r){return P(e,t,i,r)}},n&&(r.oProj=e),r)}function R(t,e){return e=e||5,function(t,e){var i="00000"+t.easting,r="00000"+t.northing;return t.zoneNumber+t.zoneLetter+function(t,e,i){var r=F(i);return function(t,e,i){var r=i-1,n=zt.charCodeAt(r),s=Ut.charCodeAt(r),a=n+t-1,o=s+e,h=!1;return a>Qt&&(a=a-Qt+qt-1,h=!0),(a===Gt||nGt||(a>Gt||nWt||(a>Wt||nQt&&(a=a-Qt+qt-1),o>Ht?(o=o-Ht+qt-1,h=!0):h=!1,(o===Gt||sGt||(o>Gt||sWt||(o>Wt||sHt&&(o=o-Ht+qt-1),String.fromCharCode(a)+String.fromCharCode(o)}(Math.floor(t/1e5),Math.floor(e/1e5)%20,r)}(t.easting,t.northing,t.zoneNumber)+i.substr(i.length-5,e)+r.substr(r.length-5,e)}(function(t){var e,i,r,n,s,a,o=t.lat,h=t.lon,u=6378137,l=I(o),c=I(h);a=Math.floor((h+180)/6)+1,180===h&&(a=60),o>=56&&o<64&&h>=3&&h<12&&(a=32),o>=72&&o<84&&(h>=0&&h<9?a=31:h>=9&&h<21?a=33:h>=21&&h<33?a=35:h>=33&&h<42&&(a=37)),s=I(6*(a-1)-180+3),e=u/Math.sqrt(1-.00669438*Math.sin(l)*Math.sin(l)),i=Math.tan(l)*Math.tan(l),r=.006739496752268451*Math.cos(l)*Math.cos(l);var f=.9996*e*((n=Math.cos(l)*(c-s))+(1-i+r)*n*n*n/6+(5-18*i+i*i+72*r-.39089081163157013)*n*n*n*n*n/120)+5e5,p=.9996*(u*(.9983242984503243*l-.002514607064228144*Math.sin(2*l)+2639046602129982e-21*Math.sin(4*l)-3.418046101696858e-9*Math.sin(6*l))+e*Math.tan(l)*(n*n/2+(5-i+9*r+4*r*r)*n*n*n*n/24+(61-58*i+i*i+600*r-2.2240339282485886)*n*n*n*n*n*n/720));return o<0&&(p+=1e7),{northing:Math.round(p),easting:Math.round(f),zoneNumber:a,zoneLetter:B(o)}}({lat:t[1],lon:t[0]}),e)}function T(t){var e=L(D(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function I(t){return t*(Math.PI/180)}function N(t){return t/Math.PI*180}function L(t){var e=t.northing,i=t.easting,r=t.zoneLetter,n=t.zoneNumber;if(n<0||n>60)return null;var s,a,o,h,u,l,c,f,p=6378137,d=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),m=i-5e5,y=e;r<"N"&&(y-=1e7),l=6*(n-1)-180+3,f=(c=y/.9996/6367449.145945056)+(3*d/2-27*d*d*d/32)*Math.sin(2*c)+(21*d*d/16-55*d*d*d*d/32)*Math.sin(4*c)+151*d*d*d/96*Math.sin(6*c),s=p/Math.sqrt(1-.00669438*Math.sin(f)*Math.sin(f)),a=Math.tan(f)*Math.tan(f),o=.006739496752268451*Math.cos(f)*Math.cos(f),h=.99330562*p/Math.pow(1-.00669438*Math.sin(f)*Math.sin(f),1.5),u=m/(.9996*s);var g=f-s*Math.tan(f)/h*(u*u/2-(5+3*a+10*o-4*o*o-.06065547077041606)*u*u*u*u/24+(61+90*a+298*o+45*a*a-1.6983531815716497-3*o*o)*u*u*u*u*u*u/720);g=N(g);var _,v=(u-(1+2*a+o)*u*u*u/6+(5-2*o+28*a-3*o*o+.05391597401814761+24*a*a)*u*u*u*u*u/120)/Math.cos(f);v=l+N(v);if(t.accuracy){var b=L({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});_={top:b.lat,right:b.lon,bottom:g,left:v}}else _={lat:g,lon:v};return _}function B(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function F(t){var e=t%Dt;return 0===e&&(e=Dt),e}function D(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,r=null,n="",s=0;!/[A-Z]/.test(e=t.charAt(s));){if(s>=2)throw"MGRSPoint bad conversion from: "+t;n+=e,s++}var a=parseInt(n,10);if(0===s||s+3>i)throw"MGRSPoint bad conversion from: "+t;var o=t.charAt(s++);if(o<="A"||"B"===o||"Y"===o||o>="Z"||"I"===o||"O"===o)throw"MGRSPoint zone letter "+o+" not handled: "+t;r=t.substring(s,s+=2);for(var h=F(a),u=function(t,e){for(var i=zt.charCodeAt(e-1),r=1e5,n=!1;i!==t.charCodeAt(0);){if(++i===Gt&&i++,i===Wt&&i++,i>Qt){if(n)throw"Bad character: "+t;i=qt,n=!0}r+=1e5}return r}(r.charAt(0),h),l=function(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var i=Ut.charCodeAt(e-1),r=0,n=!1;i!==t.charCodeAt(0);){if(++i===Gt&&i++,i===Wt&&i++,i>Ht){if(n)throw"Bad character: "+t;i=qt,n=!0}r+=1e5}return r}(r.charAt(1),h);l0&&(f=1e5/Math.pow(10,m),p=t.substring(s,s+m),y=parseFloat(p)*f,d=t.substring(s+m),g=parseFloat(d)*f),{easting:y+u,northing:g+l,zoneLetter:o,zoneNumber:a,accuracy:f}}function z(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function U(t,e,i){if(!(this instanceof U))return new U(t,e,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&void 0===e){var r=t.split(",");this.x=parseFloat(r[0],10),this.y=parseFloat(r[1],10),this.z=parseFloat(r[2],10)||0}else this.x=t,this.y=e,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}function q(t,e,i,r){var n;return trt&&n<=J+rt?(r.value=Ke.AREA_1,n-=J):n>J+rt||n<=-(J+rt)?(r.value=Ke.AREA_2,n=n>=0?n-st:n+st):(r.value=Ke.AREA_3,n+=J)),n}function G(t,e){var i=t+e;return i<-st?i+=nt:i>+st&&(i-=nt),i}var W=1,H=2,Q=3,X=4,V=5,Z=484813681109536e-20,J=Math.PI/2,Y=.16666666666666666,K=.04722222222222222,$=.022156084656084655,tt=1e-10,et=.017453292519943295,it=57.29577951308232,rt=Math.PI/4,nt=2*Math.PI,st=3.14159265359,at={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667},ot={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},ht=/[\s_\-\/\(\)]/g,ut=function(e){var i,r,n,s={},a=e.split("+").map((function(t){return t.trim()})).filter((function(t){return t})).reduce((function(t,e){var i=e.split("=");return i.push(!0),t[i[0].toLowerCase()]=i[1],t}),{}),o={proj:"projName",datum:"datumCode",rf:function(t){s.rf=parseFloat(t)},lat_0:function(t){s.lat0=t*et},lat_1:function(t){s.lat1=t*et},lat_2:function(t){s.lat2=t*et},lat_ts:function(t){s.lat_ts=t*et},lon_0:function(t){s.long0=t*et},lon_1:function(t){s.long1=t*et},lon_2:function(t){s.long2=t*et},alpha:function(t){s.alpha=parseFloat(t)*et},gamma:function(t){s.rectified_grid_angle=parseFloat(t)},lonc:function(t){s.longc=t*et},x_0:function(t){s.x0=parseFloat(t)},y_0:function(t){s.y0=parseFloat(t)},k_0:function(t){s.k0=parseFloat(t)},k:function(t){s.k0=parseFloat(t)},a:function(t){s.a=parseFloat(t)},b:function(t){s.b=parseFloat(t)},r_a:function(){s.R_A=!0},zone:function(t){s.zone=parseInt(t,10)},south:function(){s.utmSouth=!0},towgs84:function(t){s.datum_params=t.split(",").map((function(t){return parseFloat(t)}))},to_meter:function(t){s.to_meter=parseFloat(t)},units:function(e){s.units=e;var i=t(ot,e);i&&(s.to_meter=i.to_meter)},from_greenwich:function(t){s.from_greenwich=t*et},pm:function(e){var i=t(at,e);s.from_greenwich=(i||parseFloat(e))*et},nadgrids:function(t){"@null"===t?s.datumCode="none":s.nadgrids=t},axis:function(t){3===t.length&&-1!=="ewnsud".indexOf(t.substr(0,1))&&-1!=="ewnsud".indexOf(t.substr(1,1))&&-1!=="ewnsud".indexOf(t.substr(2,1))&&(s.axis=t)},approx:function(){s.approx=!0}};for(i in a)r=a[i],i in o?"function"==typeof(n=o[i])?n(r):s[n]=r:s[i]=r;return"string"==typeof s.datumCode&&"WGS84"!==s.datumCode&&(s.datumCode=s.datumCode.toLowerCase()),s},lt=1,ct=/\s/,ft=/[A-Za-z]/,pt=/[A-Za-z84]/,dt=/[,\]]/,mt=/[\d\.E\-\+]/;e.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;ct.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case lt:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},e.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(dt.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},e.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=lt)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=lt,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},e.prototype.number=function(t){if(!mt.test(t)){if(dt.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},e.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},e.prototype.keyword=function(t){if(pt.test(t))this.word+=t;else{if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=lt)}if(!dt.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},e.prototype.neutral=function(t){if(ft.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(mt.test(t))return this.word=t,void(this.state=3);if(!dt.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},e.prototype.output=function(){for(;this.place90&&n*it<-90&&r*it>180&&r*it<-180)return null;if(Math.abs(Math.abs(n)-J)<=tt)return null;if(this.sphere)e=this.x0+this.a*this.k0*xt(r-this.long0),i=this.y0+this.a*this.k0*Math.log(Math.tan(rt+.5*n));else{var s=Math.sin(n),a=Et(this.e,n,s);e=this.x0+this.a*this.k0*xt(r-this.long0),i=this.y0-this.a*this.k0*Math.log(a)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,r=t.x-this.x0,n=t.y-this.y0;if(this.sphere)i=J-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var s=Math.exp(-n/(this.a*this.k0));if(-9999===(i=kt(this.e,s)))return null}return e=xt(this.long0+r/(this.a*this.k0)),t.x=e,t.y=i,t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"]},{init:function(){},forward:c,inverse:c,names:["longlat","identity"]}],St={},At=[],Pt={start:function(){Ct.forEach(f)},add:f,get:function(t){if(!t)return!1;var e=t.toLowerCase();return void 0!==St[e]&&At[St[e]]?At[St[e]]:void 0}},jt={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"}},Ot=jt.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};jt.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};var Rt={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"}},Tt={};b.projections=Pt,b.projections.start();var It=function(t,e,i){if(function(t,e){return t.datum_type===e.datum_type&&!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(t.datum_type===W?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type!==H||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6])}(t,e))return i;if(t.datum_type===V||e.datum_type===V)return i;var r=t.a,n=t.es;if(t.datum_type===Q){if(0!==E(t,!1,i))return;r=6378137,n=.0066943799901413165}var s=e.a,a=e.b,o=e.es;return e.datum_type===Q&&(s=6378137,a=6356752.314,o=.0066943799901413165),n!==o||r!==s||x(t.datum_type)||x(e.datum_type)?(i=w(i,n,r),x(t.datum_type)&&(i=function(t,e,i){if(e===W)return{x:t.x+i[0],y:t.y+i[1],z:t.z+i[2]};if(e===H){var r=i[0],n=i[1],s=i[2],a=i[3],o=i[4],h=i[5],u=i[6];return{x:u*(t.x-h*t.y+o*t.z)+r,y:u*(h*t.x+t.y-a*t.z)+n,z:u*(-o*t.x+a*t.y+t.z)+s}}}(i,t.datum_type,t.datum_params)),x(e.datum_type)&&(i=function(t,e,i){if(e===W)return{x:t.x-i[0],y:t.y-i[1],z:t.z-i[2]};if(e===H){var r=i[0],n=i[1],s=i[2],a=i[3],o=i[4],h=i[5],u=i[6],l=(t.x-r)/u,c=(t.y-n)/u,f=(t.z-s)/u;return{x:l+h*c-o*f,y:-h*l+c+a*f,z:o*l-a*c+f}}}(i,e.datum_type,e.datum_params)),i=M(i,o,s,a),e.datum_type!==Q||0===E(e,!0,i)?i:void 0):i},Nt=function(t,e,i){var r,n,s,a=i.x,o=i.y,h=i.z||0,u={};for(s=0;s<3;s++)if(!e||2!==s||void 0!==i.z)switch(0===s?(r=a,n=-1!=="ew".indexOf(t.axis[s])?"x":"y"):1===s?(r=o,n=-1!=="ns".indexOf(t.axis[s])?"y":"x"):(r=h,n="z"),t.axis[s]){case"e":case"n":u[n]=r;break;case"w":case"s":u[n]=-r;break;case"u":void 0!==i[n]&&(u.z=r);break;case"d":void 0!==i[n]&&(u.z=-r);break;default:return null}return u},Lt=function(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e},Bt=function(t){S(t.x),S(t.y)},Ft=b("WGS84"),Dt=6,zt="AJSAJS",Ut="AFAFAF",qt=65,Gt=73,Wt=79,Ht=86,Qt=90,Xt={forward:R,inverse:function(t){var e=L(D(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]},toPoint:T};U.fromMGRS=function(t){return new U(T(t))},U.prototype.toMGRS=function(t){return R([this.x,this.y],t)};var Vt=.01068115234375,Zt=function(t){var e=[];e[0]=1-t*(.25+t*(.046875+t*(.01953125+t*Vt))),e[1]=t*(.75-t*(.046875+t*(.01953125+t*Vt)));var i=t*t;return e[2]=i*(.46875-t*(.013020833333333334+.007120768229166667*t)),i*=t,e[3]=i*(.3645833333333333-.005696614583333333*t),e[4]=i*t*.3076171875,e},Jt=function(t,e,i,r){return i*=e,e*=e,r[0]*t-i*(r[1]+e*(r[2]+e*(r[3]+e*r[4])))},Yt=function(t,e,i){for(var r=1/(1-e),n=t,s=20;s;--s){var a=Math.sin(n),o=1-e*a*a;if(n-=o=(Jt(n,a,Math.cos(n),i)-t)*(o*Math.sqrt(o))*r,Math.abs(o)tt?Math.tan(s):0,d=Math.pow(p,2),m=Math.pow(d,2);e=1-this.es*Math.pow(o,2),u/=Math.sqrt(e);var y=Jt(s,o,h,this.en);i=this.a*(this.k0*u*(1+l/6*(1-d+c+l/20*(5-18*d+m+14*c-58*d*c+l/42*(61+179*m-m*d-479*d)))))+this.x0,r=this.a*(this.k0*(y-this.ml0+o*a*u/2*(1+l/12*(5-d+9*c+4*f+l/30*(61+m-58*d+270*c-330*d*c+l/56*(1385+543*m-m*d-3111*d))))))+this.y0}else{var g=h*Math.sin(a);if(Math.abs(Math.abs(g)-1)=1){if(g-1>tt)return 93;r=0}else r=Math.acos(r);s<0&&(r=-r),r=this.a*this.k0*(r-this.lat0)+this.y0}return t.x=i,t.y=r,t},inverse:function(t){var e,i,r,n,s=(t.x-this.x0)*(1/this.a),a=(t.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+a/this.k0,i=Yt(e,this.es,this.en),Math.abs(i)tt?Math.tan(i):0,l=this.ep2*Math.pow(h,2),c=Math.pow(l,2),f=Math.pow(u,2),p=Math.pow(f,2);e=1-this.es*Math.pow(o,2);var d=s*Math.sqrt(e)/this.k0,m=Math.pow(d,2);r=i-(e*=u)*m/(1-this.es)*.5*(1-m/12*(5+3*f-9*l*f+l-4*c-m/30*(61+90*f-252*l*f+45*p+46*l-m/56*(1385+3633*f+4095*p+1574*p*f)))),n=xt(this.long0+d*(1-m/6*(1+2*f+l-m/20*(5+28*f+24*p+8*l*f+6*l-m/42*(61+662*f+1320*p+720*p*f))))/h)}else r=J*Mt(a),n=0;else{var y=Math.exp(s/this.k0),g=.5*(y-1/y),_=this.lat0+a/this.k0,v=Math.cos(_);e=Math.sqrt((1-Math.pow(v,2))/(1+Math.pow(g,2))),r=Math.asin(e),a<0&&(r=-r),n=0===g&&0===v?0:xt(Math.atan2(g,v)+this.long0)}return t.x=n,t.y=r,t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]},$t=function(t){var e=Math.exp(t);return(e-1/e)/2},te=function(t,e){t=Math.abs(t),e=Math.abs(e);var i=Math.max(t,e),r=Math.min(t,e)/(i||1);return i*Math.sqrt(1+Math.pow(r,2))},ee=function(t){var e=Math.abs(t);return e=function(t){var e=1+t,i=e-1;return 0===i?t:t*Math.log(e)/i}(e*(1+e/(te(1,e)+1))),t<0?-e:e},ie=function(t,e){for(var i,r=2*Math.cos(2*e),n=t.length-1,s=t[n],a=0;--n>=0;)i=r*s-a+t[n],a=s,s=i;return e+i*Math.sin(2*e)},re=function(t,e,i){for(var r,n,s=Math.sin(e),a=Math.cos(e),o=$t(i),h=function(t){var e=Math.exp(t);return(e+1/e)/2}(i),u=2*a*h,l=-2*s*o,c=t.length-1,f=t[c],p=0,d=0,m=0;--c>=0;)r=d,n=p,f=u*(d=f)-r-l*(p=m)+t[c],m=l*d-n+u*p;return[(u=s*h)*f-(l=a*o)*m,u*m+l*f]},ne={init:function(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(Kt.init.apply(this),this.forward=Kt.forward,this.inverse=Kt.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2))),this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2),i*=e,this.cgb[1]=i*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),i*=e,this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),i*=e,this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=i*(1237/630+e*(e*(-24832/14175)-2.4)),i*=e,this.cgb[4]=i*(4174/315+e*(-144838/6237)),this.cbg[4]=i*(-734/315+e*(109598/31185)),i*=e,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+i*(.25+i*(1/64+i/256))),this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=i*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6)),i*=e,this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),i*=e,this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600))),i*=e,this.utg[4]=i*(-4583/161280+e*(108847/3991680)),this.gtu[4]=i*(34729/80640+e*(-3418889/1995840)),i*=e,this.utg[5]=-.03233083094085698*i,this.gtu[5]=.6650675310896665*i;var r=ie(this.cbg,this.lat0);this.Zb=-this.Qn*(r+function(t,e){for(var i,r=2*Math.cos(e),n=t.length-1,s=t[n],a=0;--n>=0;)i=r*s-a+t[n],a=s,s=i;return Math.sin(e)*i}(this.gtu,2*r))},forward:function(t){var e=xt(t.x-this.long0),i=t.y;i=ie(this.cbg,i);var r=Math.sin(i),n=Math.cos(i),s=Math.sin(e),a=Math.cos(e);i=Math.atan2(r,a*n),e=Math.atan2(s*n,te(r,n*a)),e=ee(Math.tan(e));var o,h,u=re(this.gtu,2*i,2*e);i+=u[0],e+=u[1];return Math.abs(e)<=2.623395162778?(o=this.a*(this.Qn*e)+this.x0,h=this.a*(this.Qn*i+this.Zb)+this.y0):(o=1/0,h=1/0),t.x=o,t.y=h,t},inverse:function(t){var e,i,r=(t.x-this.x0)*(1/this.a),n=(t.y-this.y0)*(1/this.a);n=(n-this.Zb)/this.Qn,r/=this.Qn;if(Math.abs(r)<=2.623395162778){var s=re(this.utg,2*n,2*r);n+=s[0],r+=s[1],r=Math.atan($t(r));var a=Math.sin(n),o=Math.cos(n),h=Math.sin(r),u=Math.cos(r);n=Math.atan2(a*u,te(h,u*o)),r=Math.atan2(h,u*o),e=xt(r+this.long0),i=ie(this.cgb,n)}else e=1/0,i=1/0;return t.x=e,t.y=i,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"]},se={init:function(){var t=function(t,e){if(void 0===t){if((t=Math.floor(30*(xt(e)+Math.PI)/Math.PI)+1)<0)return 0;if(t>60)return 60}return t}(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*et,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,ne.init.apply(this),this.forward=ne.forward,this.inverse=ne.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"},ae=function(t,e){return Math.pow((1-t)/(1+t),e)},oe={init:function(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+rt)/(Math.pow(Math.tan(.5*this.lat0+rt),this.C)*ae(this.e*t,this.ratexp))},forward:function(t){var e=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+rt),this.C)*ae(this.e*Math.sin(i),this.ratexp))-J,t.x=this.C*e,t},inverse:function(t){for(var e=t.x/this.C,i=t.y,r=Math.pow(Math.tan(.5*i+rt)/this.K,1/this.C),n=20;n>0&&(i=2*Math.atan(r*ae(this.e*Math.sin(t.y),-.5*this.e))-J,!(Math.abs(i-t.y)<1e-14));--n)t.y=i;return n?(t.x=e,t.y=i,t):null},names:["gauss"]},he={init:function(){oe.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},forward:function(t){var e,i,r,n;return t.x=xt(t.x-this.long0),oe.forward.apply(this,[t]),e=Math.sin(t.y),i=Math.cos(t.y),r=Math.cos(t.x),n=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*i*r),t.x=n*i*Math.sin(t.x),t.y=n*(this.cosc0*e-this.sinc0*i*r),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){var e,i,r,n,s;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,s=Math.sqrt(t.x*t.x+t.y*t.y)){var a=2*Math.atan2(s,this.R2);e=Math.sin(a),i=Math.cos(a),n=Math.asin(i*this.sinc0+t.y*e*this.cosc0/s),r=Math.atan2(t.x*e,s*this.cosc0*i-t.y*this.sinc0*e)}else n=this.phic0,r=0;return t.x=r,t.y=n,oe.inverse.apply(this,[t]),t.x=xt(t.x+this.long0),t},names:["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]},ue={init:function(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=tt&&(this.k0=.5*(1+Mt(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=tt&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=tt&&(this.k0=.5*this.cons*wt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Et(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=wt(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-J,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var e,i,r,n,s,a,o=t.x,h=t.y,u=Math.sin(h),l=Math.cos(h),c=xt(o-this.long0);return Math.abs(Math.abs(o-this.long0)-Math.PI)<=tt&&Math.abs(h+this.lat0)<=tt?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*u+this.coslat0*l*Math.cos(c)),t.x=this.a*e*l*Math.sin(c)+this.x0,t.y=this.a*e*(this.coslat0*u-this.sinlat0*l*Math.cos(c))+this.y0,t):(i=2*Math.atan(this.ssfn_(h,u,this.e))-J,n=Math.cos(i),r=Math.sin(i),Math.abs(this.coslat0)<=tt?(s=Et(this.e,h*this.con,this.con*u),a=2*this.a*this.k0*s/this.cons,t.x=this.x0+a*Math.sin(o-this.long0),t.y=this.y0-this.con*a*Math.cos(o-this.long0),t):(Math.abs(this.sinlat0)0?this.long0+Math.atan2(t.x,-1*t.y):this.long0+Math.atan2(t.x,t.y):this.long0+Math.atan2(t.x*Math.sin(o),a*this.coslat0*Math.cos(o)-t.y*this.sinlat0*Math.sin(o))),t.x=e,t.y=i,t)}if(Math.abs(this.coslat0)<=tt){if(a<=tt)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,r=a*this.cons/(2*this.a*this.k0),i=this.con*kt(this.e,r),e=this.con*xt(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else n=2*Math.atan(a*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,a<=tt?s=this.X0:(s=Math.asin(Math.cos(n)*this.sinX0+t.y*Math.sin(n)*this.cosX0/a),e=xt(this.long0+Math.atan2(t.x*Math.sin(n),a*this.cosX0*Math.cos(n)-t.y*this.sinX0*Math.sin(n)))),i=-1*kt(this.e,Math.tan(.5*(J+s)));return t.x=e,t.y=i,t},names:["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],ssfn_:function(t,e,i){return e*=i,Math.tan(.5*(J+t))*Math.pow((1-e)/(1+e),.5*i)}},le={init:function(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,r=1/this.rf,n=2*r-Math.pow(r,2),s=this.e=Math.sqrt(n);this.R=this.k0*i*Math.sqrt(1-n)/(1-n*Math.pow(e,2)),this.alpha=Math.sqrt(1+n/(1-n)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),o=Math.log(Math.tan(Math.PI/4+t/2)),h=Math.log((1+s*e)/(1-s*e));this.K=a-this.alpha*o+this.alpha*s/2*h},forward:function(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),r=-this.alpha*(e+i)+this.K,n=2*(Math.atan(Math.exp(r))-Math.PI/4),s=this.alpha*(t.x-this.lambda0),a=Math.atan(Math.sin(s)/(Math.sin(this.b0)*Math.tan(n)+Math.cos(this.b0)*Math.cos(s))),o=Math.asin(Math.cos(this.b0)*Math.sin(n)-Math.sin(this.b0)*Math.cos(n)*Math.cos(s));return t.y=this.R/2*Math.log((1+Math.sin(o))/(1-Math.sin(o)))+this.y0,t.x=this.R*a+this.x0,t},inverse:function(t){for(var e=t.x-this.x0,i=t.y-this.y0,r=e/this.R,n=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),s=Math.asin(Math.cos(this.b0)*Math.sin(n)+Math.sin(this.b0)*Math.cos(n)*Math.cos(r)),a=Math.atan(Math.sin(r)/(Math.cos(this.b0)*Math.cos(r)-Math.sin(this.b0)*Math.tan(n))),o=this.lambda0+a/this.alpha,h=0,u=s,l=-1e3,c=0;Math.abs(u-l)>1e-7;){if(++c>20)return;h=1/this.alpha*(Math.log(Math.tan(Math.PI/4+s/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(u))/2)),l=u,u=2*Math.atan(Math.exp(h))-Math.PI/2}return t.x=o,t.y=u,t},names:["somerc"]},ce=1e-7,fe={init:function(){var t,e,i,r,n,s,a,o,h,u,l,c=0,f=0,p=0,d=0,m=0,y=0,g=0;this.no_off=function(t){var e="object"==typeof t.PROJECTION?Object.keys(t.PROJECTION)[0]:t.PROJECTION;return"no_uoff"in t||"no_off"in t||-1!==["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"].indexOf(e)}(this),this.no_rot="no_rot"in this;var _=!1;"alpha"in this&&(_=!0);var v=!1;if("rectified_grid_angle"in this&&(v=!0),_&&(g=this.alpha),v&&(c=this.rectified_grid_angle*et),_||v)f=this.longc;else if(p=this.long1,m=this.lat1,d=this.long2,y=this.lat2,Math.abs(m-y)<=ce||(t=Math.abs(m))<=ce||Math.abs(t-J)<=ce||Math.abs(Math.abs(this.lat0)-J)<=ce||Math.abs(Math.abs(y)-J)<=ce)throw new Error;var b=1-this.es;e=Math.sqrt(b),Math.abs(this.lat0)>tt?(o=Math.sin(this.lat0),i=Math.cos(this.lat0),t=1-this.es*o*o,this.B=i*i,this.B=Math.sqrt(1+this.es*this.B*this.B/b),this.A=this.B*this.k0*e/t,(n=(r=this.B*e/(i*Math.sqrt(t)))*r-1)<=0?n=0:(n=Math.sqrt(n),this.lat0<0&&(n=-n)),this.E=n+=r,this.E*=Math.pow(Et(this.e,this.lat0,o),this.B)):(this.B=1/e,this.A=this.k0,this.E=r=n=1),_||v?(_?(l=Math.asin(Math.sin(g)/r),v||(c=g)):(l=c,g=Math.asin(r*Math.sin(l))),this.lam0=f-Math.asin(.5*(n-1/n)*Math.tan(l))/this.B):(s=Math.pow(Et(this.e,m,Math.sin(m)),this.B),a=Math.pow(Et(this.e,y,Math.sin(y)),this.B),n=this.E/s,h=(a-s)/(a+s),u=((u=this.E*this.E)-a*s)/(u+a*s),(t=p-d)<-Math.pi?d-=nt:t>Math.pi&&(d+=nt),this.lam0=xt(.5*(p+d)-Math.atan(u*Math.tan(.5*this.B*(p-d))/h)/this.B),l=Math.atan(2*Math.sin(this.B*xt(p-this.lam0))/(n-1/n)),c=g=Math.asin(r*Math.sin(l))),this.singam=Math.sin(l),this.cosgam=Math.cos(l),this.sinrot=Math.sin(c),this.cosrot=Math.cos(c),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(r*r-1)/Math.cos(g))),this.lat0<0&&(this.u_0=-this.u_0)),n=.5*l,this.v_pole_n=this.ArB*Math.log(Math.tan(rt-n)),this.v_pole_s=this.ArB*Math.log(Math.tan(rt+n))},forward:function(t){var e,i,r,n,s,a,o,h,u={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-J)>tt){if(e=.5*((s=this.E/Math.pow(Et(this.e,t.y,Math.sin(t.y)),this.B))-(a=1/s)),i=.5*(s+a),n=Math.sin(this.B*t.x),r=(e*this.singam-n*this.cosgam)/i,Math.abs(Math.abs(r)-1)0?this.v_pole_n:this.v_pole_s,o=this.ArB*t.y;return this.no_rot?(u.x=o,u.y=h):(o-=this.u_0,u.x=h*this.cosrot+o*this.sinrot,u.y=o*this.cosrot-h*this.sinrot),u.x=this.a*u.x+this.x0,u.y=this.a*u.y+this.y0,u},inverse:function(t){var e,i,r,n,s,a,o,h={};if(t.x=(t.x-this.x0)*(1/this.a),t.y=(t.y-this.y0)*(1/this.a),this.no_rot?(i=t.y,e=t.x):(i=t.x*this.cosrot-t.y*this.sinrot,e=t.y*this.cosrot+t.x*this.sinrot+this.u_0),n=.5*((r=Math.exp(-this.BrA*i))-1/r),s=.5*(r+1/r),o=((a=Math.sin(this.BrA*e))*this.cosgam+n*this.singam)/s,Math.abs(Math.abs(o)-1)tt?this.ns=Math.log(r/o)/Math.log(n/h):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=r/(this.ns*Math.pow(n,this.ns)),this.rh=this.a*this.f0*Math.pow(u,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=tt&&(i=Mt(i)*(J-2*tt));var r,n,s=Math.abs(Math.abs(i)-J);if(s>tt)r=Et(this.e,i,Math.sin(i)),n=this.a*this.f0*Math.pow(r,this.ns);else{if((s=i*this.ns)<=0)return null;n=0}var a=this.ns*xt(e-this.long0);return t.x=this.k0*(n*Math.sin(a))+this.x0,t.y=this.k0*(this.rh-n*Math.cos(a))+this.y0,t},inverse:function(t){var e,i,r,n,s,a=(t.x-this.x0)/this.k0,o=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(a*a+o*o),i=1):(e=-Math.sqrt(a*a+o*o),i=-1);var h=0;if(0!==e&&(h=Math.atan2(i*a,i*o)),0!==e||this.ns>0){if(i=1/this.ns,r=Math.pow(e/(this.a*this.f0),i),-9999===(n=kt(this.e,r)))return null}else n=-J;return s=xt(h/this.ns+this.long0),t.x=s,t.y=n,t},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"]},de={init:function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},forward:function(t){var e,i,r,n,s,a,o,h=t.x,u=t.y,l=xt(h-this.long0);return e=Math.pow((1+this.e*Math.sin(u))/(1-this.e*Math.sin(u)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(u/2+this.s45),this.alfa)/e)-this.s45),r=-l*this.alfa,n=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(r)),s=Math.asin(Math.cos(i)*Math.sin(r)/Math.cos(n)),a=this.n*s,o=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(n/2+this.s45),this.n),t.y=o*Math.cos(a)/1,t.x=o*Math.sin(a)/1,this.czech||(t.y*=-1,t.x*=-1),t},inverse:function(t){var e,i,r,n,s,a,o,h=t.x;t.x=t.y,t.y=h,this.czech||(t.y*=-1,t.x*=-1),s=Math.sqrt(t.x*t.x+t.y*t.y),n=Math.atan2(t.y,t.x)/Math.sin(this.s0),r=2*(Math.atan(Math.pow(this.ro0/s,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(r)-Math.sin(this.ad)*Math.cos(r)*Math.cos(n)),i=Math.asin(Math.cos(r)*Math.sin(n)/Math.cos(e)),t.x=this.long0-i/this.alfa,a=e,o=0;var u=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-t.y)<1e-10&&(o=1),a=t.y,u+=1}while(0===o&&u<15);return u>=15?null:t},names:["Krovak","krovak"]},me=function(t,e,i,r,n){return t*n-e*Math.sin(2*n)+i*Math.sin(4*n)-r*Math.sin(6*n)},ye=function(t){return 1-.25*t*(1+t/16*(3+1.25*t))},ge=function(t){return.375*t*(1+.25*t*(1+.46875*t))},_e=function(t){return.05859375*t*t*(1+.75*t)},ve=function(t){return t*t*t*(35/3072)},be=function(t,e,i){var r=e*i;return t/Math.sqrt(1-r*r)},we=function(t){return Math.abs(t)1e-7?(1-t*t)*(e/(1-(i=t*e)*i)-.5/t*Math.log((1-i)/(1+i))):2*e},ke=.3333333333333333,Ce=.17222222222222222,Se=.10257936507936508,Ae=.06388888888888888,Pe=.0664021164021164,je=.016415012942191543,Oe={init:function(){var t=Math.abs(this.lat0);if(Math.abs(t-J)0){var e;switch(this.qp=Ee(this.e,1),this.mmf=.5/(1-this.es),this.apa=function(t){var e,i=[];return i[0]=t*ke,e=t*t,i[0]+=e*Ce,i[1]=e*Ae,e*=t,i[0]+=e*Se,i[1]+=e*Pe,i[2]=e*je,i}(this.es),this.mode){case this.N_POLE:case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),e=Math.sin(this.lat0),this.sinb1=Ee(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},forward:function(t){var e,i,r,n,s,a,o,h,u,l,c=t.x,f=t.y;if(c=xt(c-this.long0),this.sphere){if(s=Math.sin(f),l=Math.cos(f),r=Math.cos(c),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+l*r:1+this.sinph0*s+this.cosph0*l*r)<=tt)return null;e=(i=Math.sqrt(2/i))*l*Math.sin(c),i*=this.mode===this.EQUIT?s:this.cosph0*s-this.sinph0*l*r}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),Math.abs(f+this.lat0)=0?(e=(u=Math.sqrt(a))*n,i=r*(this.mode===this.S_POLE?u:-u)):e=i=0}}return t.x=this.a*e+this.x0,t.y=this.a*i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i,r,n,s,a,o,h=t.x/this.a,u=t.y/this.a;if(this.sphere){var l,c=0,f=0;if((i=.5*(l=Math.sqrt(h*h+u*u)))>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(f=Math.sin(i),c=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(l)<=tt?0:Math.asin(u*f/l),h*=f,u=c*l;break;case this.OBLIQ:i=Math.abs(l)<=tt?this.lat0:Math.asin(c*this.sinph0+u*f*this.cosph0/l),h*=f*this.cosph0,u=(c-Math.sin(i)*this.sinph0)*l;break;case this.N_POLE:u=-u,i=J-i;break;case this.S_POLE:i-=J}e=0!==u||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(h,u):0}else{if(o=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(h/=this.dd,u*=this.dd,(a=Math.sqrt(h*h+u*u))1&&(t=t>1?1:-1),Math.asin(t)},Te={init:function(){Math.abs(this.lat1+this.lat2)tt?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var r=Ee(this.e3,this.sin_phi,this.cos_phi),n=this.a*Math.sqrt(this.c-this.ns0*r)/this.ns0,s=this.ns0*xt(e-this.long0),a=n*Math.sin(s)+this.x0,o=this.rh-n*Math.cos(s)+this.y0;return t.x=a,t.y=o,t},inverse:function(t){var e,i,r,n,s,a;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),r=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),r=-1),n=0,0!==e&&(n=Math.atan2(r*t.x,r*t.y)),r=e*this.ns0/this.a,this.sphere?a=Math.asin((this.c-r*r)/(2*this.ns0)):(i=(this.c-r*r)/this.ns0,a=this.phi1z(this.e3,i)),s=xt(n/this.ns0+this.long0),t.x=s,t.y=a,t},names:["Albers_Conic_Equal_Area","Albers","aea"],phi1z:function(t,e){var i,r,n,s,a=Re(.5*e);if(t0||Math.abs(s)<=tt?(a=this.x0+1*this.a*i*Math.sin(r)/s,o=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*n)/s):(a=this.x0+this.infinity_dist*i*Math.sin(r),o=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*n)),t.x=a,t.y=o,t},inverse:function(t){var e,i,r,n,s,a;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(n=Math.atan2(e,this.rc),i=Math.sin(n),r=Math.cos(n),a=Re(r*this.sin_p14+t.y*i*this.cos_p14/e),s=Math.atan2(t.x*i,e*this.cos_p14*r-t.y*this.sin_p14*i),s=xt(this.long0+s)):(a=this.phic0,s=0),t.x=s,t.y=a,t},names:["gnom"]},Ne={init:function(){this.sphere||(this.k0=wt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var e,i,r=t.x,n=t.y,s=xt(r-this.long0);if(this.sphere)e=this.x0+this.a*s*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts);else{var a=Ee(this.e,Math.sin(n));e=this.x0+this.a*this.k0*s,i=this.y0+this.a*a*.5/this.k0}return t.x=e,t.y=i,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i;return this.sphere?(e=xt(this.long0+t.x/this.a/Math.cos(this.lat_ts)),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=function(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*J:J;for(var r,n,s,a,o=Math.asin(.5*e),h=0;h<30;h++)if(n=Math.sin(o),s=Math.cos(o),a=t*n,o+=r=Math.pow(1-a*a,2)/(2*s)*(e/(1-t*t)-n/(1-a*a)+.5/t*Math.log((1-a)/(1+a))),Math.abs(r)<=1e-10)return o;return NaN}(this.e,2*t.y*this.k0/this.a),e=xt(this.long0+t.x/(this.a*this.k0))),t.x=e,t.y=i,t},names:["cea"]},Le={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},forward:function(t){var e=t.x,i=t.y,r=xt(e-this.long0),n=we(i-this.lat0);return t.x=this.x0+this.a*r*this.rc,t.y=this.y0+this.a*n,t},inverse:function(t){var e=t.x,i=t.y;return t.x=xt(this.long0+(e-this.x0)/(this.a*this.rc)),t.y=we(this.lat0+(i-this.y0)/this.a),t},names:["Equirectangular","Equidistant_Cylindrical","eqc"]},Be={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=ye(this.es),this.e1=ge(this.es),this.e2=_e(this.es),this.e3=ve(this.es),this.ml0=this.a*me(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var e,i,r,n=t.x,s=t.y,a=xt(n-this.long0);if(r=a*Math.sin(s),this.sphere)Math.abs(s)<=tt?(e=this.a*a,i=-1*this.a*this.lat0):(e=this.a*Math.sin(r)/Math.tan(s),i=this.a*(we(s-this.lat0)+(1-Math.cos(r))/Math.tan(s)));else if(Math.abs(s)<=tt)e=this.a*a,i=-1*this.ml0;else{var o=be(this.a,this.e,Math.sin(s))/Math.tan(s);e=o*Math.sin(r),i=this.a*me(this.e0,this.e1,this.e2,this.e3,s)-this.ml0+o*(1-Math.cos(r))}return t.x=e+this.x0,t.y=i+this.y0,t},inverse:function(t){var e,i,r,n,s,a,o,h,u;if(r=t.x-this.x0,n=t.y-this.y0,this.sphere)if(Math.abs(n+this.a*this.lat0)<=tt)e=xt(r/this.a+this.long0),i=0;else{a=this.lat0+n/this.a,o=r*r/this.a/this.a+a*a,h=a;var l;for(s=20;s;--s)if(h+=u=-1*(a*(h*(l=Math.tan(h))+1)-h-.5*(h*h+o)*l)/((h-a)/l-1),Math.abs(u)<=tt){i=h;break}e=xt(this.long0+Math.asin(r*Math.tan(h)/this.a)/Math.sin(i))}else if(Math.abs(n+this.ml0)<=tt)i=0,e=xt(this.long0+r/this.a);else{a=(this.ml0+n)/this.a,o=r*r/this.a/this.a+a*a,h=a;var c,f,p,d,m;for(s=20;s;--s)if(m=this.e*Math.sin(h),c=Math.sqrt(1-m*m)*Math.tan(h),f=this.a*me(this.e0,this.e1,this.e2,this.e3,h),p=this.e0-2*this.e1*Math.cos(2*h)+4*this.e2*Math.cos(4*h)-6*this.e3*Math.cos(6*h),h-=u=(a*(c*(d=f/this.a)+1)-d-.5*c*(d*d+o))/(this.es*Math.sin(2*h)*(d*d+o-2*a*d)/(4*c)+(a-d)*(c*p-2/Math.sin(2*h))-p),Math.abs(u)<=tt){i=h;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=xt(this.long0+Math.asin(r*c/this.a)/Math.sin(i))}return t.x=e,t.y=i,t},names:["Polyconic","poly"]},Fe={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(t){var e,i=t.x,r=t.y-this.lat0,n=i-this.long0,s=r/Z*1e-5,a=n,o=1,h=0;for(e=1;e<=10;e++)o*=s,h+=this.A[e]*o;var u,l=h,c=a,f=1,p=0,d=0,m=0;for(e=1;e<=6;e++)u=p*l+f*c,f=f*l-p*c,p=u,d=d+this.B_re[e]*f-this.B_im[e]*p,m=m+this.B_im[e]*f+this.B_re[e]*p;return t.x=m*this.a+this.x0,t.y=d*this.a+this.y0,t},inverse:function(t){var e,i,r=t.x,n=t.y,s=r-this.x0,a=(n-this.y0)/this.a,o=s/this.a,h=1,u=0,l=0,c=0;for(e=1;e<=6;e++)i=u*a+h*o,h=h*a-u*o,u=i,l=l+this.C_re[e]*h-this.C_im[e]*u,c=c+this.C_im[e]*h+this.C_re[e]*u;for(var f=0;f.999999999999&&(i=.999999999999),e=Math.asin(i);var r=xt(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));r<-Math.PI&&(r=-Math.PI),r>Math.PI&&(r=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var n=Math.asin(i);return t.x=r,t.y=n,t},names:["Mollweide","moll"]},qe={init:function(){Math.abs(this.lat1+this.lat2)=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var s=0;if(0!==i&&(s=Math.atan2(e*t.x,e*t.y)),this.sphere)return n=xt(this.long0+s/this.ns),r=we(this.g-i/this.a),t.x=n,t.y=r,t;var a=this.g-i/this.a;return r=Me(a,this.e0,this.e1,this.e2,this.e3),n=xt(this.long0+s/this.ns),t.x=n,t.y=r,t},names:["Equidistant_Conic","eqdc"]},Ge={init:function(){this.R=this.a},forward:function(t){var e,i,r=t.x,n=t.y,s=xt(r-this.long0);Math.abs(n)<=tt&&(e=this.x0+this.R*s,i=this.y0);var a=Re(2*Math.abs(n/Math.PI));(Math.abs(s)<=tt||Math.abs(Math.abs(n)-J)<=tt)&&(e=this.x0,i=n>=0?this.y0+Math.PI*this.R*Math.tan(.5*a):this.y0+Math.PI*this.R*-Math.tan(.5*a));var o=.5*Math.abs(Math.PI/s-s/Math.PI),h=o*o,u=Math.sin(a),l=Math.cos(a),c=l/(u+l-1),f=c*c,p=c*(2/u-1),d=p*p,m=Math.PI*this.R*(o*(c-d)+Math.sqrt(h*(c-d)*(c-d)-(d+h)*(f-d)))/(d+h);s<0&&(m=-m),e=this.x0+m;var y=h+c;return m=Math.PI*this.R*(p*y-o*Math.sqrt((d+h)*(h+1)-y*y))/(d+h),i=n>=0?this.y0+m:this.y0-m,t.x=e,t.y=i,t},inverse:function(t){var e,i,r,n,s,a,o,h,u,l,c,f;return t.x-=this.x0,t.y-=this.y0,c=Math.PI*this.R,s=(r=t.x/c)*r+(n=t.y/c)*n,c=3*(n*n/(h=-2*(a=-Math.abs(n)*(1+s))+1+2*n*n+s*s)+(2*(o=a-2*n*n+r*r)*o*o/h/h/h-9*a*o/h/h)/27)/(u=(a-o*o/3/h)/h)/(l=2*Math.sqrt(-u/3)),Math.abs(c)>1&&(c=c>=0?1:-1),f=Math.acos(c)/3,i=t.y>=0?(-l*Math.cos(f+Math.PI/3)-o/3/h)*Math.PI:-(-l*Math.cos(f+Math.PI/3)-o/3/h)*Math.PI,e=Math.abs(r)2*J*this.a)return;return i=e/this.a,r=Math.sin(i),n=Math.cos(i),s=this.long0,Math.abs(e)<=tt?a=this.lat0:(a=Re(n*this.sin_p12+t.y*r*this.cos_p12/e),o=Math.abs(this.lat0)-J,s=xt(Math.abs(o)<=tt?this.lat0>=0?this.long0+Math.atan2(t.x,-t.y):this.long0-Math.atan2(-t.x,t.y):this.long0+Math.atan2(t.x*r,e*this.cos_p12*n-t.y*this.sin_p12*r))),t.x=s,t.y=a,t}return h=ye(this.es),u=ge(this.es),l=_e(this.es),c=ve(this.es),Math.abs(this.sin_p12-1)<=tt?(f=this.a*me(h,u,l,c,J),e=Math.sqrt(t.x*t.x+t.y*t.y),a=Me((f-e)/this.a,h,u,l,c),s=xt(this.long0+Math.atan2(t.x,-1*t.y)),t.x=s,t.y=a,t):Math.abs(this.sin_p12+1)<=tt?(f=this.a*me(h,u,l,c,J),e=Math.sqrt(t.x*t.x+t.y*t.y),a=Me((e-f)/this.a,h,u,l,c),s=xt(this.long0+Math.atan2(t.x,t.y)),t.x=s,t.y=a,t):(e=Math.sqrt(t.x*t.x+t.y*t.y),m=Math.atan2(t.x,t.y),p=be(this.a,this.e,this.sin_p12),y=Math.cos(m),_=-(g=this.e*this.cos_p12*y)*g/(1-this.es),v=3*this.es*(1-_)*this.sin_p12*this.cos_p12*y/(1-this.es),M=1-_*(w=(b=e/p)-_*(1+_)*Math.pow(b,3)/6-v*(1+3*_)*Math.pow(b,4)/24)*w/2-b*w*w*w/6,d=Math.asin(this.sin_p12*Math.cos(w)+this.cos_p12*Math.sin(w)*y),s=xt(this.long0+Math.asin(Math.sin(m)*Math.sin(w)/Math.cos(d))),x=Math.sin(d),a=Math.atan2((x-this.es*M*this.sin_p12)*Math.tan(d),x*(1-this.es)),t.x=s,t.y=a,t)},names:["Azimuthal_Equidistant","aeqd"]},He={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)},forward:function(t){var e,i,r,n,s,a,o,h=t.x,u=t.y;return r=xt(h-this.long0),e=Math.sin(u),i=Math.cos(u),n=Math.cos(r),((s=this.sin_p14*e+this.cos_p14*i*n)>0||Math.abs(s)<=tt)&&(a=1*this.a*i*Math.sin(r),o=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*n)),t.x=a,t.y=o,t},inverse:function(t){var e,i,r,n,s,a,o;return t.x-=this.x0,t.y-=this.y0,e=Math.sqrt(t.x*t.x+t.y*t.y),i=Re(e/this.a),r=Math.sin(i),n=Math.cos(i),a=this.long0,Math.abs(e)<=tt?(o=this.lat0,t.x=a,t.y=o,t):(o=Re(n*this.sin_p14+t.y*r*this.cos_p14/e),s=Math.abs(this.lat0)-J,Math.abs(s)<=tt?(a=xt(this.lat0>=0?this.long0+Math.atan2(t.x,-t.y):this.long0-Math.atan2(-t.x,t.y)),t.x=a,t.y=o,t):(a=xt(this.long0+Math.atan2(t.x*r,e*this.cos_p14*n-t.y*this.sin_p14*r)),t.x=a,t.y=o,t))},names:["ortho"]},Qe=1,Xe=2,Ve=3,Ze=4,Je=5,Ye=6,Ke={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4},$e={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=J-rt/2?this.face=Je:this.lat0<=-(J-rt/2)?this.face=Ye:Math.abs(this.long0)<=rt?this.face=Qe:Math.abs(this.long0)<=J+rt?this.face=this.long0>0?Xe:Ze:this.face=Ve,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)},forward:function(t){var e,i,r,n,s,a,o={x:0,y:0},h={value:0};if(t.x-=this.long0,e=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y,i=t.x,this.face===Je)n=J-e,i>=rt&&i<=J+rt?(h.value=Ke.AREA_0,r=i-J):i>J+rt||i<=-(J+rt)?(h.value=Ke.AREA_1,r=i>0?i-st:i+st):i>-(J+rt)&&i<=-rt?(h.value=Ke.AREA_2,r=i+J):(h.value=Ke.AREA_3,r=i);else if(this.face===Ye)n=J+e,i>=rt&&i<=J+rt?(h.value=Ke.AREA_0,r=-i+J):i=-rt?(h.value=Ke.AREA_1,r=-i):i<-rt&&i>=-(J+rt)?(h.value=Ke.AREA_2,r=-i-J):(h.value=Ke.AREA_3,r=i>0?-i+st:-i-st);else{var u,l,c,f,p,d;this.face===Xe?i=G(i,+J):this.face===Ve?i=G(i,+st):this.face===Ze&&(i=G(i,-J)),f=Math.sin(e),p=Math.cos(e),d=Math.sin(i),u=p*Math.cos(i),l=p*d,c=f,this.face===Qe?r=q(n=Math.acos(u),c,l,h):this.face===Xe?r=q(n=Math.acos(l),c,-u,h):this.face===Ve?r=q(n=Math.acos(-u),c,-l,h):this.face===Ze?r=q(n=Math.acos(-l),c,u,h):(n=r=0,h.value=Ke.AREA_0)}return a=Math.atan(12/st*(r+Math.acos(Math.sin(r)*Math.cos(rt))-J)),s=Math.sqrt((1-Math.cos(n))/(Math.cos(a)*Math.cos(a))/(1-Math.cos(Math.atan(1/Math.cos(r))))),h.value===Ke.AREA_1?a+=J:h.value===Ke.AREA_2?a+=st:h.value===Ke.AREA_3&&(a+=1.5*st),o.x=s*Math.cos(a),o.y=s*Math.sin(a),o.x=o.x*this.a+this.x0,o.y=o.y*this.a+this.y0,t.x=o.x,t.y=o.y,t},inverse:function(t){var e,i,r,n,s,a,o,h,u,l={lam:0,phi:0},c={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),e=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?c.value=Ke.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(c.value=Ke.AREA_1,e-=J):t.x<0&&-t.x>=Math.abs(t.y)?(c.value=Ke.AREA_2,e=e<0?e+st:e-st):(c.value=Ke.AREA_3,e+=J),u=st/12*Math.tan(e),s=Math.sin(u)/(Math.cos(u)-1/Math.sqrt(2)),a=Math.atan(s),(o=1-(r=Math.cos(e))*r*(n=Math.tan(i))*n*(1-Math.cos(Math.atan(1/Math.cos(a)))))<-1?o=-1:o>1&&(o=1),this.face===Je)h=Math.acos(o),l.phi=J-h,c.value===Ke.AREA_0?l.lam=a+J:c.value===Ke.AREA_1?l.lam=a<0?a+st:a-st:c.value===Ke.AREA_2?l.lam=a-J:l.lam=a;else if(this.face===Ye)h=Math.acos(o),l.phi=h-J,c.value===Ke.AREA_0?l.lam=-a+J:c.value===Ke.AREA_1?l.lam=-a:c.value===Ke.AREA_2?l.lam=-a-J:l.lam=a<0?-a-st:-a+st;else{var f,p,d;u=(f=o)*f,p=(u+=(d=u>=1?0:Math.sqrt(1-u)*Math.sin(a))*d)>=1?0:Math.sqrt(1-u),c.value===Ke.AREA_1?(u=p,p=-d,d=u):c.value===Ke.AREA_2?(p=-p,d=-d):c.value===Ke.AREA_3&&(u=p,p=d,d=-u),this.face===Xe?(u=f,f=-p,p=u):this.face===Ve?(f=-f,p=-p):this.face===Ze&&(u=f,f=p,p=-u),l.phi=Math.acos(-d)-J,l.lam=Math.atan2(p,f),this.face===Xe?l.lam=G(l.lam,-J):this.face===Ve?l.lam=G(l.lam,-st):this.face===Ze&&(l.lam=G(l.lam,+J))}if(0!==this.es){var m,y,g;m=l.phi<0?1:0,y=Math.tan(l.phi),g=this.b/Math.sqrt(y*y+this.one_minus_f_squared),l.phi=Math.atan(Math.sqrt(this.a*this.a-g*g)/(this.one_minus_f*g)),m&&(l.phi=-l.phi)}return l.lam+=this.long0,t.x=l.lam,t.y=l.phi,t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]},ti=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],ei=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],ii=.8487,ri=1.3523,ni=it/5,si=1/ni,ai=18,oi=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))},hi={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(t){var e=xt(t.x-this.long0),i=Math.abs(t.y),r=Math.floor(i*ni);r<0?r=0:r>=ai&&(r=17);var n={x:oi(ti[r],i=it*(i-si*r))*e,y:oi(ei[r],i)};return t.y<0&&(n.y=-n.y),n.x=n.x*this.a*ii+this.x0,n.y=n.y*this.a*ri+this.y0,n},inverse:function(t){var e={x:(t.x-this.x0)/(this.a*ii),y:Math.abs(t.y-this.y0)/(this.a*ri)};if(e.y>=1)e.x/=ti[ai][0],e.y=t.y<0?-J:J;else{var i=Math.floor(e.y*ai);for(i<0?i=0:i>=ai&&(i=17);;)if(ei[i][0]>e.y)--i;else{if(!(ei[i+1][0]<=e.y))break;++i}var r=ei[i],n=5*(e.y-r[0])/(ei[i+1][0]-r[0]);n=function(t,e,i,r){for(var n=e;r;--r){var s=t(n);if(n-=s,Math.abs(s)1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,0!==this.es){var t=1-this.es,e=1/t;this.radius_p=Math.sqrt(t),this.radius_p2=t,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")},forward:function(t){var e,i,r,n,s=t.x,a=t.y;if(s-=this.long0,"ellipse"===this.shape){a=Math.atan(this.radius_p2*Math.tan(a));var o=this.radius_p/te(this.radius_p*Math.cos(a),Math.sin(a));if(i=o*Math.cos(s)*Math.cos(a),r=o*Math.sin(s)*Math.cos(a),n=o*Math.sin(a),(this.radius_g-i)*i-r*r-n*n*this.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(r/te(n,e)),t.y=this.radius_g_1*Math.atan(n/e)):(t.x=this.radius_g_1*Math.atan(r/e),t.y=this.radius_g_1*Math.atan(n/te(r,e)))}else"sphere"===this.shape&&(e=Math.cos(a),i=Math.cos(s)*e,r=Math.sin(s)*e,n=Math.sin(a),e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(r/te(n,e)),t.y=this.radius_g_1*Math.atan(n/e)):(t.x=this.radius_g_1*Math.atan(r/e),t.y=this.radius_g_1*Math.atan(n/te(r,e))));return t.x=t.x*this.a,t.y=t.y*this.a,t},inverse:function(t){var e,i,r,n,s=-1,a=0,o=0;if(t.x=t.x/this.a,t.y=t.y/this.a,"ellipse"===this.shape){this.flip_axis?(o=Math.tan(t.y/this.radius_g_1),a=Math.tan(t.x/this.radius_g_1)*te(1,o)):(a=Math.tan(t.x/this.radius_g_1),o=Math.tan(t.y/this.radius_g_1)*te(1,a));var h=o/this.radius_p;if(e=a*a+h*h+s*s,(r=(i=2*this.radius_g*s)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;n=(-i-Math.sqrt(r))/(2*e),s=this.radius_g+n*s,a*=n,o*=n,t.x=Math.atan2(a,s),t.y=Math.atan(o*Math.cos(t.x)/s),t.y=Math.atan(this.radius_p_inv2*Math.tan(t.y))}else if("sphere"===this.shape){if(this.flip_axis?(o=Math.tan(t.y/this.radius_g_1),a=Math.tan(t.x/this.radius_g_1)*Math.sqrt(1+o*o)):(a=Math.tan(t.x/this.radius_g_1),o=Math.tan(t.y/this.radius_g_1)*Math.sqrt(1+a*a)),e=a*a+o*o+s*s,(r=(i=2*this.radius_g*s)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;n=(-i-Math.sqrt(r))/(2*e),s=this.radius_g+n*s,a*=n,o*=n,t.x=Math.atan2(a,s),t.y=Math.atan(o*Math.cos(t.x)/s)}return t.x=t.x+this.long0,t},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]};return O.defaultDatum="WGS84",O.Proj=b,O.WGS84=new O.Proj("WGS84"),O.Point=U,O.toPoint=Lt,O.defs=o,O.nadgrid=function(t,e){var i=new DataView(e),r=function(t){var e=t.getInt32(8,!1);return 11!==e&&(11!==(e=t.getInt32(8,!0))&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}(i),n=function(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:m(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}(i,r);n.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var s={header:n,subgrids:y(i,n,r)};return Tt[t]=s,s},O.transform=A,O.mgrs=Xt,O.version="2.8.0",function(t){t.Proj.projections.add(Kt),t.Proj.projections.add(ne),t.Proj.projections.add(se),t.Proj.projections.add(he),t.Proj.projections.add(ue),t.Proj.projections.add(le),t.Proj.projections.add(fe),t.Proj.projections.add(pe),t.Proj.projections.add(de),t.Proj.projections.add(xe),t.Proj.projections.add(Oe),t.Proj.projections.add(Te),t.Proj.projections.add(Ie),t.Proj.projections.add(Ne),t.Proj.projections.add(Le),t.Proj.projections.add(Be),t.Proj.projections.add(Fe),t.Proj.projections.add(De),t.Proj.projections.add(ze),t.Proj.projections.add(Ue),t.Proj.projections.add(qe),t.Proj.projections.add(Ge),t.Proj.projections.add(We),t.Proj.projections.add(He),t.Proj.projections.add($e),t.Proj.projections.add(hi),t.Proj.projections.add(ui),t.Proj.projections.add(mi),t.Proj.projections.add(yi)}(O),O}));!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).shp=t()}}((function(){return function t(e,i,r){function n(a,o){if(!i[a]){if(!e[a]){var h="function"==typeof require&&require;if(!o&&h)return h(a,!0);if(s)return s(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=i[a]={exports:{}};e[a][0].call(l.exports,(function(t){return n(e[a][1][t]||t)}),l,l.exports,t,e,i,r)}return i[a].exports}for(var s="function"==typeof require&&require,a=0;a0&&65279===t[0]){this._BOMseen=!0;t.shift()}else t.length>0&&(this._BOMseen=!0);var e,i;return function(t){for(var e="",i=0;i>10),56320+(1023&r))}}return e}(t)}.call(this,a)};function k(t,e){if(!(this instanceof k))throw TypeError("Called as a function. Did you forget 'new'?");e=s(e);this._encoding=null;this._encoder=null;this._do_not_flush=!1;this._fatal=Boolean(e.fatal)?"fatal":"replacement";var r=this;if(Boolean(e.NONSTANDARD_allowLegacyEncoding)){var n=p(t=void 0!==t?String(t):x);if(null===n||"replacement"===n.name)throw RangeError("Unknown encoding: "+t);if(!_[n.name])throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?");r._encoding=n}else{r._encoding=p("utf-8");void 0!==t&&"console"in i&&console.warn("TextEncoder constructor called with encoding label, which is ignored.")}Object.defineProperty||(this.encoding=r._encoding.name.toLowerCase());return r}Object.defineProperty&&Object.defineProperty(k.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}});k.prototype.encode=function(t,e){t=void 0===t?"":String(t);e=s(e);this._do_not_flush||(this._encoder=_[this._encoding.name]({fatal:"fatal"===this._fatal}));this._do_not_flush=Boolean(e.stream);for(var i,r=new u(function(t){for(var e=String(t),i=e.length,r=0,n=[];r57343)n.push(s);else if(56320<=s&&s<=57343)n.push(65533);else if(55296<=s&&s<=56319)if(r===i-1)n.push(65533);else{var a=e.charCodeAt(r+1);if(56320<=a&&a<=57343){var o=1023&s,h=1023&a;n.push(65536+(o<<10)+h);r+=1}else n.push(65533)}r+=1}return n}(t)),n=[];;){var a=r.read();if(a===h)break;if((i=this._encoder.handler(r,a))===l)break;Array.isArray(i)?n.push.apply(n,i):n.push(i)}if(!this._do_not_flush){for(;(i=this._encoder.handler(r,r.read()))!==l;)Array.isArray(i)?n.push.apply(n,i):n.push(i);this._encoder=null}return new Uint8Array(n)};function C(t){var e=t.fatal,i=0,n=0,s=0,a=128,o=191;this.handler=function(t,u){if(u===h&&0!==s){s=0;return c(e)}if(u===h)return l;if(0===s){if(r(u,0,127))return u;if(r(u,194,223)){s=1;i=31&u}else if(r(u,224,239)){224===u&&(a=160);237===u&&(o=159);s=2;i=15&u}else{if(!r(u,240,244))return c(e);240===u&&(a=144);244===u&&(o=143);s=3;i=7&u}return null}if(!r(u,a,o)){i=s=n=0;a=128;o=191;t.prepend(u);return c(e)}a=128;o=191;i=i<<6|63&u;if((n+=1)!==s)return null;var f=i;i=s=n=0;return f}}function S(t){t.fatal;this.handler=function(t,e){if(e===h)return l;if(o(e))return e;var i,n;if(r(e,128,2047)){i=1;n=192}else if(r(e,2048,65535)){i=2;n=224}else if(r(e,65536,1114111)){i=3;n=240}for(var s=[(e>>6*i)+n];i>0;){var a=e>>6*(i-1);s.push(128|63&a);i-=1}return s}}_["UTF-8"]=function(t){return new S(t)};v["UTF-8"]=function(t){return new C(t)};function A(t,e){var i=e.fatal;this.handler=function(e,r){if(r===h)return l;if(a(r))return r;var n=t[r-128];return null===n?c(i):n}}function P(t,e){e.fatal;this.handler=function(e,i){if(i===h)return l;if(o(i))return i;var r=w(i,t);null===r&&f(i);return r+128}}"encoding-indexes"in i&&d.forEach((function(t){"Legacy single-byte encodings"===t.heading&&t.encodings.forEach((function(t){var e=t.name,i=M(e.toLowerCase());v[e]=function(t){return new A(i,t)};_[e]=function(t){return new P(i,t)}}))}));v.GBK=function(t){return new j(t)};_.GBK=function(t){return new O(t,!0)};function j(t){var e=t.fatal,i=0,n=0,s=0;this.handler=function(t,o){if(o===h&&0===i&&0===n&&0===s)return l;if(o===h&&(0!==i||0!==n||0!==s)){i=0;n=0;s=0;c(e)}var u;if(0!==s){u=null;r(o,48,57)&&(u=function(t){if(t>39419&&t<189e3||t>1237575)return null;if(7457===t)return 59335;var e,i=0,r=0,n=M("gb18030-ranges");for(e=0;e>8,r=255&t;return e?[i,r]:[r,i]}function G(t,e){var i=e.fatal,n=null,s=null;this.handler=function(e,a){if(a===h&&(null!==n||null!==s))return c(i);if(a===h&&null===n&&null===s)return l;if(null===n){n=a;return null}var o;o=t?(n<<8)+a:(a<<8)+n;n=null;if(null!==s){var u=s;s=null;if(r(o,56320,57343))return 65536+1024*(u-55296)+(o-56320);e.prepend(q(o,t));return c(i)}if(r(o,55296,56319)){s=o;return null}return r(o,56320,57343)?c(i):o}}function W(t,e){e.fatal;this.handler=function(e,i){if(i===h)return l;if(r(i,0,65535))return q(i,t);var n=q(55296+(i-65536>>10),t),s=q(56320+(i-65536&1023),t);return n.concat(s)}}_["UTF-16BE"]=function(t){return new W(!0,t)};v["UTF-16BE"]=function(t){return new G(!0,t)};_["UTF-16LE"]=function(t){return new W(!1,t)};v["UTF-16LE"]=function(t){return new G(!1,t)};function H(t){t.fatal;this.handler=function(t,e){return e===h?l:a(e)?e:63360+e-128}}function Q(t){t.fatal;this.handler=function(t,e){return e===h?l:o(e)?e:r(e,63360,63487)?e-63360+128:f(e)}}_["x-user-defined"]=function(t){return new Q(t)};v["x-user-defined"]=function(t){return new H(t)};i.TextEncoder||(i.TextEncoder=k);i.TextDecoder||(i.TextDecoder=E);void 0!==e&&e.exports&&(e.exports={TextEncoder:i.TextEncoder,TextDecoder:i.TextDecoder,EncodingIndexes:i["encoding-indexes"]})}(this||{})},{"./encoding-indexes.js":11}],5:[function(t,e,i){"use strict";const r=t("lie"),n=t("./combine"),s=t("buffer").Buffer;e.exports=function(t,e){return new r((function(i,r){const a=n(t,e),o=new XMLHttpRequest;o.open("GET",a,!0);"prj"!==e&&"cpg"!==e&&(o.responseType="arraybuffer");o.addEventListener("load",(function(){return o.status>399?"prj"===e||"cpg"===e?i(!1):r(new Error(o.status)):i("prj"!==e&&"cpg"!==e?s.from(o.response):o.response)}),!1);o.send()}))}},{"./combine":7,buffer:12,lie:16}],6:[function(t,e,i){(function(i){(function(){"use strict";const r=t("./binaryajax-browser"),n=t("./combine"),s=t("buffer").Buffer;e.exports=async function(t,e){if(!i.fetch)return r(t,e);const a=n(t,e),o="prj"===e||"cpg"===e;try{const t=await fetch(a);if(t.status>399)throw new Error(t.statusText);if(o)return t.text();const e=await t.arrayBuffer();return s.from(e)}catch(t){if(o)return!1;throw t}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./binaryajax-browser":5,"./combine":7,buffer:12}],7:[function(t,e,i){(function(t){(function(){const i=t.URL;e.exports=(t,e)=>{if(!e)return t;const r=new i(t);r.pathname=`${r.pathname}.${e}`;return r.href}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],8:[function(t,e,i){"use strict";function r(t,e){!function(t){let e=0,i=1;const r=t.length;let n,s;for(;i0}(e)&&t.length?t[t.length-1].push(e):t.push([e]);return t}s.prototype.parsePoint=function(t){return{type:"Point",coordinates:this.parseCoord(t,0)}};s.prototype.parseZPoint=function(t){const e=this.parsePoint(t);e.coordinates.push(t.readDoubleLE(16));return e};s.prototype.parsePointArray=function(t,e,i){const r=[];let n=0;for(;n20&&(e-=20);if(!(e in n))throw new Error("I don't know that shp type");this.parseFunc=this[n[e]];this.parseCoord=(i=t)?function(t,e){return i.inverse([t.readDoubleLE(e),t.readDoubleLE(e+8)])}:function(t,e){return[t.readDoubleLE(e),t.readDoubleLE(e+8)]};var i};s.prototype.getShpCode=function(){return this.parseHeader().shpCode};s.prototype.parseHeader=function(){const t=this.buffer.slice(0,100);return{length:t.readInt32BE(24)<<1,version:t.readInt32LE(28),shpCode:t.readInt32LE(32),bbox:[t.readDoubleLE(36),t.readDoubleLE(44),t.readDoubleLE(52),t.readDoubleLE(52)]}};s.prototype.getRows=function(){let t=100;const e=this.buffer.byteLength,i=[];let r;for(;t{const e=new r;await e.loadAsync(t);const i=e.file(/.+/),n={};await Promise.all(i.map((async t=>{let e;e="shp"===t.name.slice(-3).toLowerCase()||"dbf"===t.name.slice(-3).toLowerCase()?await t.async("nodebuffer"):await t.async("text");n[t.name]=e})));return n}},{jszip:15}],10:[function(t,e,i){"use strict";i.byteLength=function(t){var e=u(t),i=e[0],r=e[1];return 3*(i+r)/4-r};i.toByteArray=function(t){var e,i,r=u(t),a=r[0],o=r[1],h=new s(function(t,e,i){return 3*(e+i)/4-i}(0,a,o)),l=0,c=o>0?a-4:a;for(i=0;i>16&255;h[l++]=e>>8&255;h[l++]=255&e}if(2===o){e=n[t.charCodeAt(i)]<<2|n[t.charCodeAt(i+1)]>>4;h[l++]=255&e}if(1===o){e=n[t.charCodeAt(i)]<<10|n[t.charCodeAt(i+1)]<<4|n[t.charCodeAt(i+2)]>>2;h[l++]=e>>8&255;h[l++]=255&e}return h};i.fromByteArray=function(t){for(var e,i=t.length,n=i%3,s=[],a=16383,o=0,h=i-n;oh?h:o+a));if(1===n){e=t[i-1];s.push(r[e>>2]+r[e<<4&63]+"==")}else if(2===n){e=(t[i-2]<<8)+t[i-1];s.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")}return s.join("")};for(var r=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,h=a.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");-1===i&&(i=e);return[i,i===e?0:4-i%4]}function l(t,e,i){for(var n,s,a=[],o=e;o>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s])}return a.join("")}},{}],11:[function(t,e,i){},{}],12:[function(t,e,i){(function(e){(function(){"use strict";var e=t("base64-js"),r=t("ieee754");i.Buffer=a;i.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)};i.INSPECT_MAX_BYTES=50;var n=2147483647;i.kMaxLength=n;a.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return 42===t.foo()}catch(t){return!1}}();a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}});Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function s(t){if(t>n)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);e.__proto__=a.prototype;return e}function a(t,e,i){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return o(t,e,i)}"undefined"!=typeof Symbol&&null!=Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1});a.poolSize=8192;function o(t,e,i){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var i=0|f(t,e),r=s(i),n=r.write(t,e);n!==i&&(r=r.slice(0,n));return r}(t,e);if(ArrayBuffer.isView(t))return l(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(z(t,ArrayBuffer)||t&&z(t.buffer,ArrayBuffer))return function(t,e,i){if(e<0||t.byteLength=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|t}a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype};a.compare=function(t,e){z(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength));z(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength));if(!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var i=t.length,r=e.length,n=0,s=Math.min(i,r);n2&&!0===arguments[2];if(!r&&0===i)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return F(t).length;default:if(n)return r?-1:B(t).length;e=(""+e).toLowerCase();n=!0}}a.byteLength=f;function p(t,e,i){var r=!1;(void 0===e||e<0)&&(e=0);if(e>this.length)return"";(void 0===i||i>this.length)&&(i=this.length);if(i<=0)return"";if((i>>>=0)<=(e>>>=0))return"";t||(t="utf8");for(;;)switch(t){case"hex":return A(this,e,i);case"utf8":case"utf-8":return E(this,e,i);case"ascii":return C(this,e,i);case"latin1":case"binary":return S(this,e,i);case"base64":return x(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase();r=!0}}a.prototype._isBuffer=!0;function d(t,e,i){var r=t[e];t[e]=t[i];t[i]=r}a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;ee&&(t+=" ... ");return""};a.prototype.compare=function(t,e,i,r,n){z(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength));if(!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);void 0===e&&(e=0);void 0===i&&(i=t?t.length:0);void 0===r&&(r=0);void 0===n&&(n=this.length);if(e<0||i>t.length||r<0||n>this.length)throw new RangeError("out of range index");if(r>=n&&e>=i)return 0;if(r>=n)return-1;if(e>=i)return 1;if(this===t)return 0;for(var s=(n>>>=0)-(r>>>=0),o=(i>>>=0)-(e>>>=0),h=Math.min(s,o),u=this.slice(r,n),l=t.slice(e,i),c=0;c2147483647?i=2147483647:i<-2147483648&&(i=-2147483648);U(i=+i)&&(i=n?0:t.length-1);i<0&&(i=t.length+i);if(i>=t.length){if(n)return-1;i=t.length-1}else if(i<0){if(!n)return-1;i=0}"string"==typeof e&&(e=a.from(e,r));if(a.isBuffer(e))return 0===e.length?-1:y(t,e,i,r,n);if("number"==typeof e){e&=255;return"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):y(t,[e],i,r,n)}throw new TypeError("val must be string, number or Buffer")}function y(t,e,i,r,n){var s,a=1,o=t.length,h=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2;o/=2;h/=2;i/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(n){var l=-1;for(s=i;so&&(i=o-h);for(s=i;s>=0;s--){for(var c=!0,f=0;fn&&(r=n):r=n;var s=e.length;r>s/2&&(r=s/2);for(var a=0;a>8;n=i%256;s.push(n);s.push(r)}return s}(e,t.length-i),t,i,r)}a.prototype.write=function(t,e,i,r){if(void 0===e){r="utf8";i=this.length;e=0}else if(void 0===i&&"string"==typeof e){r=e;i=this.length;e=0}else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0;if(isFinite(i)){i>>>=0;void 0===r&&(r="utf8")}else{r=i;i=void 0}}var n=this.length-e;(void 0===i||i>n)&&(i=n);if(t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return g(this,t,e,i);case"utf8":case"utf-8":return _(this,t,e,i);case"ascii":return v(this,t,e,i);case"latin1":case"binary":return b(this,t,e,i);case"base64":return w(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,i);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase();s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function x(t,i,r){return 0===i&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(i,r))}function E(t,e,i){i=Math.min(t.length,i);for(var r=[],n=e;n239?4:s>223?3:s>191?2:1;if(n+o<=i){var h,u,l,c;switch(o){case 1:s<128&&(a=s);break;case 2:128==(192&(h=t[n+1]))&&(c=(31&s)<<6|63&h)>127&&(a=c);break;case 3:h=t[n+1];u=t[n+2];128==(192&h)&&128==(192&u)&&(c=(15&s)<<12|(63&h)<<6|63&u)>2047&&(c<55296||c>57343)&&(a=c);break;case 4:h=t[n+1];u=t[n+2];l=t[n+3];128==(192&h)&&128==(192&u)&&128==(192&l)&&(c=(15&s)<<18|(63&h)<<12|(63&u)<<6|63&l)>65535&&c<1114112&&(a=c)}}if(null===a){a=65533;o=1}else if(a>65535){a-=65536;r.push(a>>>10&1023|55296);a=56320|1023&a}r.push(a);n+=o}return function(t){var e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);var i="",r=0;for(;rr)&&(i=r);for(var n="",s=e;si&&(t=i);(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i);ei)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUIntLE=function(t,e,i){t>>>=0;e>>>=0;i||j(t,e,this.length);for(var r=this[t],n=1,s=0;++s>>=0;e>>>=0;i||j(t,e,this.length);for(var r=this[t+--e],n=1;e>0&&(n*=256);)r+=this[t+--e]*n;return r};a.prototype.readUInt8=function(t,e){t>>>=0;e||j(t,1,this.length);return this[t]};a.prototype.readUInt16LE=function(t,e){t>>>=0;e||j(t,2,this.length);return this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function(t,e){t>>>=0;e||j(t,2,this.length);return this[t]<<8|this[t+1]};a.prototype.readUInt32LE=function(t,e){t>>>=0;e||j(t,4,this.length);return(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]};a.prototype.readUInt32BE=function(t,e){t>>>=0;e||j(t,4,this.length);return 16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readIntLE=function(t,e,i){t>>>=0;e>>>=0;i||j(t,e,this.length);for(var r=this[t],n=1,s=0;++s=(n*=128)&&(r-=Math.pow(2,8*e));return r};a.prototype.readIntBE=function(t,e,i){t>>>=0;e>>>=0;i||j(t,e,this.length);for(var r=e,n=1,s=this[t+--r];r>0&&(n*=256);)s+=this[t+--r]*n;s>=(n*=128)&&(s-=Math.pow(2,8*e));return s};a.prototype.readInt8=function(t,e){t>>>=0;e||j(t,1,this.length);return 128&this[t]?-1*(255-this[t]+1):this[t]};a.prototype.readInt16LE=function(t,e){t>>>=0;e||j(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i};a.prototype.readInt16BE=function(t,e){t>>>=0;e||j(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i};a.prototype.readInt32LE=function(t,e){t>>>=0;e||j(t,4,this.length);return this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};a.prototype.readInt32BE=function(t,e){t>>>=0;e||j(t,4,this.length);return this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};a.prototype.readFloatLE=function(t,e){t>>>=0;e||j(t,4,this.length);return r.read(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){t>>>=0;e||j(t,4,this.length);return r.read(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){t>>>=0;e||j(t,8,this.length);return r.read(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){t>>>=0;e||j(t,8,this.length);return r.read(this,t,!1,52,8)};function O(t,e,i,r,n,s){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}a.prototype.writeUIntLE=function(t,e,i,r){t=+t;e>>>=0;i>>>=0;if(!r){O(this,t,e,i,Math.pow(2,8*i)-1,0)}var n=1,s=0;this[e]=255&t;for(;++s>>=0;i>>>=0;if(!r){O(this,t,e,i,Math.pow(2,8*i)-1,0)}var n=i-1,s=1;this[e+n]=255&t;for(;--n>=0&&(s*=256);)this[e+n]=t/s&255;return e+i};a.prototype.writeUInt8=function(t,e,i){t=+t;e>>>=0;i||O(this,t,e,1,255,0);this[e]=255&t;return e+1};a.prototype.writeUInt16LE=function(t,e,i){t=+t;e>>>=0;i||O(this,t,e,2,65535,0);this[e]=255&t;this[e+1]=t>>>8;return e+2};a.prototype.writeUInt16BE=function(t,e,i){t=+t;e>>>=0;i||O(this,t,e,2,65535,0);this[e]=t>>>8;this[e+1]=255&t;return e+2};a.prototype.writeUInt32LE=function(t,e,i){t=+t;e>>>=0;i||O(this,t,e,4,4294967295,0);this[e+3]=t>>>24;this[e+2]=t>>>16;this[e+1]=t>>>8;this[e]=255&t;return e+4};a.prototype.writeUInt32BE=function(t,e,i){t=+t;e>>>=0;i||O(this,t,e,4,4294967295,0);this[e]=t>>>24;this[e+1]=t>>>16;this[e+2]=t>>>8;this[e+3]=255&t;return e+4};a.prototype.writeIntLE=function(t,e,i,r){t=+t;e>>>=0;if(!r){var n=Math.pow(2,8*i-1);O(this,t,e,i,n-1,-n)}var s=0,a=1,o=0;this[e]=255&t;for(;++s>0)-o&255}return e+i};a.prototype.writeIntBE=function(t,e,i,r){t=+t;e>>>=0;if(!r){var n=Math.pow(2,8*i-1);O(this,t,e,i,n-1,-n)}var s=i-1,a=1,o=0;this[e+s]=255&t;for(;--s>=0&&(a*=256);){t<0&&0===o&&0!==this[e+s+1]&&(o=1);this[e+s]=(t/a>>0)-o&255}return e+i};a.prototype.writeInt8=function(t,e,i){t=+t;e>>>=0;i||O(this,t,e,1,127,-128);t<0&&(t=255+t+1);this[e]=255&t;return e+1};a.prototype.writeInt16LE=function(t,e,i){t=+t;e>>>=0;i||O(this,t,e,2,32767,-32768);this[e]=255&t;this[e+1]=t>>>8;return e+2};a.prototype.writeInt16BE=function(t,e,i){t=+t;e>>>=0;i||O(this,t,e,2,32767,-32768);this[e]=t>>>8;this[e+1]=255&t;return e+2};a.prototype.writeInt32LE=function(t,e,i){t=+t;e>>>=0;i||O(this,t,e,4,2147483647,-2147483648);this[e]=255&t;this[e+1]=t>>>8;this[e+2]=t>>>16;this[e+3]=t>>>24;return e+4};a.prototype.writeInt32BE=function(t,e,i){t=+t;e>>>=0;i||O(this,t,e,4,2147483647,-2147483648);t<0&&(t=4294967295+t+1);this[e]=t>>>24;this[e+1]=t>>>16;this[e+2]=t>>>8;this[e+3]=255&t;return e+4};function R(t,e,i,r,n,s){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function T(t,e,i,n,s){e=+e;i>>>=0;s||R(t,0,i,4);r.write(t,e,i,n,23,4);return i+4}a.prototype.writeFloatLE=function(t,e,i){return T(this,t,e,!0,i)};a.prototype.writeFloatBE=function(t,e,i){return T(this,t,e,!1,i)};function I(t,e,i,n,s){e=+e;i>>>=0;s||R(t,0,i,8);r.write(t,e,i,n,52,8);return i+8}a.prototype.writeDoubleLE=function(t,e,i){return I(this,t,e,!0,i)};a.prototype.writeDoubleBE=function(t,e,i){return I(this,t,e,!1,i)};a.prototype.copy=function(t,e,i,r){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");i||(i=0);r||0===r||(r=this.length);e>=t.length&&(e=t.length);e||(e=0);r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length);t.length-e=0;--s)t[s+e]=this[s+i];else Uint8Array.prototype.set.call(t,this.subarray(i,r),e);return n};a.prototype.fill=function(t,e,i,r){if("string"==typeof t){if("string"==typeof e){r=e;e=0;i=this.length}else if("string"==typeof i){r=i;i=this.length}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){var n=t.charCodeAt(0);("utf8"===r&&n<128||"latin1"===r)&&(t=n)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0;i=void 0===i?this.length:i>>>0;t||(t=0);var s;if("number"==typeof t)for(s=e;s55295&&i<57344){if(!n){if(i>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&s.push(239,191,189);continue}n=i;continue}if(i<56320){(e-=3)>-1&&s.push(239,191,189);n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&(e-=3)>-1&&s.push(239,191,189);n=null;if(i<128){if((e-=1)<0)break;s.push(i)}else if(i<2048){if((e-=2)<0)break;s.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;s.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return s}function F(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(N,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function D(t,e,i,r){for(var n=0;n=e.length||n>=t.length);++n)e[n+i]=t[n];return n}function z(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function U(t){return t!=t}}).call(this)}).call(this,t("buffer").Buffer)},{"base64-js":10,buffer:12,ieee754:13}],13:[function(t,e,i){i.read=function(t,e,i,r,n){var s,a,o=8*n-r-1,h=(1<>1,l=-7,c=i?n-1:0,f=i?-1:1,p=t[e+c];c+=f;s=p&(1<<-l)-1;p>>=-l;l+=o;for(;l>0;s=256*s+t[e+c],c+=f,l-=8);a=s&(1<<-l)-1;s>>=-l;l+=r;for(;l>0;a=256*a+t[e+c],c+=f,l-=8);if(0===s)s=1-u;else{if(s===h)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r);s-=u}return(p?-1:1)*a*Math.pow(2,s-r)};i.write=function(t,e,i,r,n,s){var a,o,h,u=8*s-n-1,l=(1<>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:s-1,d=r?1:-1,m=e<0||0===e&&1/e<0?1:0;e=Math.abs(e);if(isNaN(e)||e===1/0){o=isNaN(e)?1:0;a=l}else{a=Math.floor(Math.log(e)/Math.LN2);if(e*(h=Math.pow(2,-a))<1){a--;h*=2}if((e+=a+c>=1?f/h:f*Math.pow(2,1-c))*h>=2){a++;h/=2}if(a+c>=l){o=0;a=l}else if(a+c>=1){o=(e*h-1)*Math.pow(2,n);a+=c}else{o=e*Math.pow(2,c-1)*Math.pow(2,n);a=0}}for(;n>=8;t[i+p]=255&o,p+=d,o/=256,n-=8);a=a<0;t[i+p]=255&a,p+=d,a/=256,u-=8);t[i+p-d]|=128*m}},{}],14:[function(t,e,i){(function(t){(function(){"use strict";var i,r,n=t.MutationObserver||t.WebKitMutationObserver;if(n){var s=0,a=new n(l),o=t.document.createTextNode("");a.observe(o,{characterData:!0});i=function(){o.data=s=++s%2}}else if(t.setImmediate||void 0===t.MessageChannel)i="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){l();e.onreadystatechange=null;e.parentNode.removeChild(e);e=null};t.document.documentElement.appendChild(e)}:function(){setTimeout(l,0)};else{var h=new t.MessageChannel;h.port1.onmessage=l;i=function(){h.port2.postMessage(0)}}var u=[];function l(){r=!0;for(var t,e,i=u.length;i;){e=u;u=[];t=-1;for(;++t>2,o=(3&e)<<4|i>>4,h=1>6:64,u=2>4,i=(15&a)<<4|(o=s.indexOf(t.charAt(u++)))>>2,r=(3&o)<<6|(h=s.indexOf(t.charAt(u++))),c[l++]=e,64!==o&&(c[l++]=i),64!==h&&(c[l++]=r);return c}},{"./support":30,"./utils":32}],2:[function(t,e,i){"use strict";var r=t("./external"),n=t("./stream/DataWorker"),s=t("./stream/Crc32Probe"),a=t("./stream/DataLengthProbe");function o(t,e,i,r,n){this.compressedSize=t,this.uncompressedSize=e,this.crc32=i,this.compression=r,this.compressedContent=n}o.prototype={getContentWorker:function(){var t=new n(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),e=this;return t.on("end",(function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),t},getCompressedWorker:function(){return new n(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},o.createWorkerFrom=function(t,e,i){return t.pipe(new s).pipe(new a("uncompressedSize")).pipe(e.compressWorker(i)).pipe(new a("compressedSize")).withStreamInfo("compression",e)},e.exports=o},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,i){"use strict";var r=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(t){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,i){"use strict";var r=t("./utils"),n=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();e.exports=function(t,e){return void 0!==t&&t.length?"string"!==r.getTypeOf(t)?function(t,e,i){var r=n,s=0+i;t^=-1;for(var a=0;a>>8^r[255&(t^e[a])];return-1^t}(0|e,t,t.length):function(t,e,i){var r=n,s=0+i;t^=-1;for(var a=0;a>>8^r[255&(t^e.charCodeAt(a))];return-1^t}(0|e,t,t.length):0}},{"./utils":32}],5:[function(t,e,i){"use strict";i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,e,i){"use strict";var r;r="undefined"!=typeof Promise?Promise:t("lie"),e.exports={Promise:r}},{lie:37}],7:[function(t,e,i){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=t("pako"),s=t("./utils"),a=t("./stream/GenericWorker"),o=r?"uint8array":"array";function h(t,e){a.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}i.magic="\b\0",s.inherits(h,a),h.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(o,t.data),!1)},h.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},i.compressWorker=function(t){return new h("Deflate",t)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,i){"use strict";function r(t,e){var i,r="";for(i=0;i>>=8;return r}function n(t,e,i,n,a,l){var c,f,p=t.file,d=t.compression,m=l!==o.utf8encode,y=s.transformTo("string",l(p.name)),g=s.transformTo("string",o.utf8encode(p.name)),_=p.comment,v=s.transformTo("string",l(_)),b=s.transformTo("string",o.utf8encode(_)),w=g.length!==p.name.length,M=b.length!==_.length,x="",E="",k="",C=p.dir,S=p.date,A={crc32:0,compressedSize:0,uncompressedSize:0};e&&!i||(A.crc32=t.crc32,A.compressedSize=t.compressedSize,A.uncompressedSize=t.uncompressedSize);var P=0;e&&(P|=8),m||!w&&!M||(P|=2048);var j,O=0,R=0;C&&(O|=16),"UNIX"===a?(R=798,O|=((j=p.unixPermissions)||(j=C?16893:33204),(65535&j)<<16)):(R=20,O|=63&(p.dosPermissions||0)),c=S.getUTCHours(),c<<=6,c|=S.getUTCMinutes(),c<<=5,c|=S.getUTCSeconds()/2,f=S.getUTCFullYear()-1980,f<<=4,f|=S.getUTCMonth()+1,f<<=5,f|=S.getUTCDate(),w&&(x+="up"+r((E=r(1,1)+r(h(y),4)+g).length,2)+E),M&&(x+="uc"+r((k=r(1,1)+r(h(v),4)+b).length,2)+k);var T="";return T+="\n\0",T+=r(P,2),T+=d.magic,T+=r(c,2),T+=r(f,2),T+=r(A.crc32,4),T+=r(A.compressedSize,4),T+=r(A.uncompressedSize,4),T+=r(y.length,2),T+=r(x.length,2),{fileRecord:u.LOCAL_FILE_HEADER+T+y+x,dirRecord:u.CENTRAL_FILE_HEADER+r(R,2)+T+r(v.length,2)+"\0\0\0\0"+r(O,4)+r(n,4)+y+x+v}}var s=t("../utils"),a=t("../stream/GenericWorker"),o=t("../utf8"),h=t("../crc32"),u=t("../signature");function l(t,e,i,r){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=i,this.encodeFileName=r,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(l,a),l.prototype.push=function(t){var e=t.meta.percent||0,i=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,a.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:i?(e+100*(i-r-1))/i:100}}))},l.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var i=n(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},l.prototype.closedSource=function(t){this.accumulate=!1;var e,i=this.streamFiles&&!t.file.dir,s=n(t,i,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(s.dirRecord),i)this.push({data:(e=t,u.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:s.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},l.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e=this.index;e--)i=(i<<8)+this.byteAt(e);return this.index+=t,i},readString:function(t){return r.transformTo("string",this.readData(t))},readData:function(t){},lastIndexOfSignature:function(t){},readAndCheckSignature:function(t){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},e.exports=n},{"../utils":32}],19:[function(t,e,i){"use strict";var r=t("./Uint8ArrayReader");function n(t){r.call(this,t)}t("../utils").inherits(n,r),n.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,i){"use strict";var r=t("./DataReader");function n(t){r.call(this,t)}t("../utils").inherits(n,r),n.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},n.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},n.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},n.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=n},{"../utils":32,"./DataReader":18}],21:[function(t,e,i){"use strict";var r=t("./ArrayReader");function n(t){r.call(this,t)}t("../utils").inherits(n,r),n.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(t,e,i){"use strict";var r=t("../utils"),n=t("../support"),s=t("./ArrayReader"),a=t("./StringReader"),o=t("./NodeBufferReader"),h=t("./Uint8ArrayReader");e.exports=function(t){var e=r.getTypeOf(t);return r.checkSupport(e),"string"!==e||n.uint8array?"nodebuffer"===e?new o(t):n.uint8array?new h(r.transformTo("uint8array",t)):new s(r.transformTo("array",t)):new a(t)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,i){"use strict";i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(t,e,i){"use strict";var r=t("./GenericWorker"),n=t("../utils");function s(t){r.call(this,"ConvertWorker to "+t),this.destType=t}n.inherits(s,r),s.prototype.processChunk=function(t){this.push({data:n.transformTo(this.destType,t.data),meta:t.meta})},e.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,i){"use strict";var r=t("./GenericWorker"),n=t("../crc32");function s(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(s,r),s.prototype.processChunk=function(t){this.streamInfo.crc32=n(t.data,this.streamInfo.crc32||0),this.push(t)},e.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,i){"use strict";var r=t("../utils"),n=t("./GenericWorker");function s(t){n.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}r.inherits(s,n),s.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length}n.prototype.processChunk.call(this,t)},e.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,i){"use strict";var r=t("../utils"),n=t("./GenericWorker");function s(t){n.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then((function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=r.getTypeOf(t),e.isPaused||e._tickAndRepeat()}),(function(t){e.error(t)}))}r.inherits(s,n),s.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,i){"use strict";function r(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var i=0;i "+t:t}},e.exports=r},{}],29:[function(t,e,i){"use strict";var r=t("../utils"),s=t("./ConvertWorker"),a=t("./GenericWorker"),o=t("../base64"),h=t("../support"),u=t("../external"),l=null;if(h.nodestream)try{l=t("../nodejs/NodejsStreamOutputAdapter")}catch(t){}function c(t,e,i){var n=e;switch(e){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=e,this._mimeType=i,r.checkSupport(n),this._worker=t.pipe(new s(n)),t.lock()}catch(t){this._worker=new a("error"),this._worker.error(t)}}c.prototype={accumulate:function(t){return e=this,i=t,new u.Promise((function(t,s){var a=[],h=e._internalType,u=e._outputType,l=e._mimeType;e.on("data",(function(t,e){a.push(t),i&&i(e)})).on("error",(function(t){a=[],s(t)})).on("end",(function(){try{var e=function(t,e,i){switch(t){case"blob":return r.newBlob(r.transformTo("arraybuffer",e),i);case"base64":return o.encode(e);default:return r.transformTo(t,e)}}(u,function(t,e){var i,r=0,s=null,a=0;for(i=0;i>>6:(i<65536?e[a++]=224|i>>>12:(e[a++]=240|i>>>18,e[a++]=128|i>>>12&63),e[a++]=128|i>>>6&63),e[a++]=128|63&i);return e}(t)},i.utf8decode=function(t){return n.nodebuffer?r.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,i,n,s,a=t.length,h=new Array(2*a);for(e=i=0;e>10&1023,h[i++]=56320|1023&n)}return h.length!==i&&(h.subarray?h=h.subarray(0,i):h.length=i),r.applyFromCharCode(h)}(t=r.transformTo(n.uint8array?"uint8array":"array",t))},r.inherits(u,a),u.prototype.processChunk=function(t){var e=r.transformTo(n.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var s=e;(e=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),e.set(s,this.leftOver.length)}else e=this.leftOver.concat(e);this.leftOver=null}var a=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;0<=i&&128==(192&t[i]);)i--;return i<0||0===i?e:i+o[t[i]]>e?i:e}(e),h=e;a!==e.length&&(n.uint8array?(h=e.subarray(0,a),this.leftOver=e.subarray(a,e.length)):(h=e.slice(0,a),this.leftOver=e.slice(a,e.length))),this.push({data:i.utf8decode(h),meta:t.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=u,r.inherits(l,a),l.prototype.processChunk=function(t){this.push({data:i.utf8encode(t.data),meta:t.meta})},i.Utf8EncodeWorker=l},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,i){"use strict";var r=t("./support"),n=t("./base64"),s=t("./nodejsUtils"),a=t("set-immediate-shim"),o=t("./external");function h(t){return t}function u(t,e){for(var i=0;i>8;this.dir=!!(16&this.externalFileAttributes),0==t&&(this.dosPermissions=63&this.externalFileAttributes),3==t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(t){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(t){var e,i,r,n=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index+4>>6:(i<65536?e[a++]=224|i>>>12:(e[a++]=240|i>>>18,e[a++]=128|i>>>12&63),e[a++]=128|i>>>6&63),e[a++]=128|63&i);return e},i.buf2binstring=function(t){return h(t,t.length)},i.binstring2buf=function(t){for(var e=new r.Buf8(t.length),i=0,n=e.length;i>10&1023,u[r++]=56320|1023&n)}return h(u,r)},i.utf8border=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;0<=i&&128==(192&t[i]);)i--;return i<0||0===i?e:i+a[t[i]]>e?i:e}},{"./common":41}],43:[function(t,e,i){"use strict";e.exports=function(t,e,i,r){for(var n=65535&t|0,s=t>>>16&65535|0,a=0;0!==i;){for(i-=a=2e3>>1:t>>>1;e[i]=t}return e}();e.exports=function(t,e,i,n){var s=r,a=n+i;t^=-1;for(var o=n;o>>8^s[255&(t^e[o])];return-1^t}},{}],46:[function(t,e,i){"use strict";var r,n=t("../utils/common"),s=t("./trees"),a=t("./adler32"),o=t("./crc32"),h=t("./messages"),u=0,l=0,c=-2,f=2,p=8,d=286,m=30,y=19,g=2*d+1,_=15,v=3,b=258,w=b+v+1,M=42,x=113;function E(t,e){return t.msg=h[e],e}function k(t){return(t<<1)-(4t.avail_out&&(i=t.avail_out),0!==i&&(n.arraySet(t.output,e.pending_buf,e.pending_out,i,t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))}function A(t,e){s._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,S(t.strm)}function P(t,e){t.pending_buf[t.pending++]=e}function j(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function O(t,e){var i,r,n=t.max_chain_length,s=t.strstart,a=t.prev_length,o=t.nice_match,h=t.strstart>t.w_size-w?t.strstart-(t.w_size-w):0,u=t.window,l=t.w_mask,c=t.prev,f=t.strstart+b,p=u[s+a-1],d=u[s+a];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(u[(i=e)+a]===d&&u[i+a-1]===p&&u[i]===u[s]&&u[++i]===u[s+1]){s+=2,i++;do{}while(u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&u[++s]===u[++i]&&sh&&0!=--n);return a<=t.lookahead?a:t.lookahead}function R(t){var e,i,r,s,h,u,l,c,f,p,d=t.w_size;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=d+(d-w)){for(n.arraySet(t.window,t.window,d,d,0),t.match_start-=d,t.strstart-=d,t.block_start-=d,e=i=t.hash_size;r=t.head[--e],t.head[e]=d<=r?r-d:0,--i;);for(e=i=d;r=t.prev[--e],t.prev[e]=d<=r?r-d:0,--i;);s+=d}if(0===t.strm.avail_in)break;if(u=t.strm,l=t.window,c=t.strstart+t.lookahead,p=void 0,(f=s)<(p=u.avail_in)&&(p=f),i=0===p?0:(u.avail_in-=p,n.arraySet(l,u.input,u.next_in,p,c),1===u.state.wrap?u.adler=a(u.adler,l,p,c):2===u.state.wrap&&(u.adler=o(u.adler,l,p,c)),u.next_in+=p,u.total_in+=p,p),t.lookahead+=i,t.lookahead+t.insert>=v)for(h=t.strstart-t.insert,t.ins_h=t.window[h],t.ins_h=(t.ins_h<=v&&(t.ins_h=(t.ins_h<=v)if(r=s._tr_tally(t,t.strstart-t.match_start,t.match_length-v),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=v){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<=v&&(t.ins_h=(t.ins_h<=v&&t.match_length<=t.prev_length){for(n=t.strstart+t.lookahead-v,r=s._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-v),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=n&&(t.ins_h=(t.ins_h<t.pending_buf_size-5&&(i=t.pending_buf_size-5);;){if(t.lookahead<=1){if(R(t),0===t.lookahead&&e===u)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+i;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,A(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-w&&(A(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(A(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(A(t,!1),t.strm.avail_out),1)})),new N(4,4,8,4,T),new N(4,5,16,8,T),new N(4,6,32,32,T),new N(4,4,16,16,I),new N(8,16,32,32,I),new N(8,16,128,128,I),new N(8,32,128,256,I),new N(32,128,258,1024,I),new N(32,258,258,4096,I)],i.deflateInit=function(t,e){return D(t,e,p,15,8,0)},i.deflateInit2=D,i.deflateReset=F,i.deflateResetKeep=B,i.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?c:(t.state.gzhead=e,l):c},i.deflate=function(t,e){var i,n,a,h;if(!t||!t.state||5>8&255),P(n,n.gzhead.time>>16&255),P(n,n.gzhead.time>>24&255),P(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),P(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(P(n,255&n.gzhead.extra.length),P(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=o(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(P(n,0),P(n,0),P(n,0),P(n,0),P(n,0),P(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),P(n,3),n.status=x);else{var f=p+(n.w_bits-8<<4)<<8;f|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(f|=32),f+=31-f%31,n.status=x,j(n,f),0!==n.strstart&&(j(n,t.adler>>>16),j(n,65535&t.adler)),t.adler=1}if(69===n.status)if(n.gzhead.extra){for(a=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>a&&(t.adler=o(t.adler,n.pending_buf,n.pending-a,a)),S(t),a=n.pending,n.pending!==n.pending_buf_size));)P(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>a&&(t.adler=o(t.adler,n.pending_buf,n.pending-a,a)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){a=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>a&&(t.adler=o(t.adler,n.pending_buf,n.pending-a,a)),S(t),a=n.pending,n.pending===n.pending_buf_size)){h=1;break}h=n.gzindexa&&(t.adler=o(t.adler,n.pending_buf,n.pending-a,a)),0===h&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){a=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>a&&(t.adler=o(t.adler,n.pending_buf,n.pending-a,a)),S(t),a=n.pending,n.pending===n.pending_buf_size)){h=1;break}h=n.gzindexa&&(t.adler=o(t.adler,n.pending_buf,n.pending-a,a)),0===h&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&S(t),n.pending+2<=n.pending_buf_size&&(P(n,255&t.adler),P(n,t.adler>>8&255),t.adler=0,n.status=x)):n.status=x),0!==n.pending){if(S(t),0===t.avail_out)return n.last_flush=-1,l}else if(0===t.avail_in&&k(e)<=k(i)&&4!==e)return E(t,-5);if(666===n.status&&0!==t.avail_in)return E(t,-5);if(0!==t.avail_in||0!==n.lookahead||e!==u&&666!==n.status){var d=2===n.strategy?function(t,e){for(var i;;){if(0===t.lookahead&&(R(t),0===t.lookahead)){if(e===u)return 1;break}if(t.match_length=0,i=s._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(A(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(A(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(A(t,!1),0===t.strm.avail_out)?1:2}(n,e):3===n.strategy?function(t,e){for(var i,r,n,a,o=t.window;;){if(t.lookahead<=b){if(R(t),t.lookahead<=b&&e===u)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=v&&0t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=v?(i=s._tr_tally(t,1,t.match_length-v),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=s._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(A(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(A(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(A(t,!1),0===t.strm.avail_out)?1:2}(n,e):r[n.level].func(n,e);if(3!==d&&4!==d||(n.status=666),1===d||3===d)return 0===t.avail_out&&(n.last_flush=-1),l;if(2===d&&(1===e?s._tr_align(n):5!==e&&(s._tr_stored_block(n,0,0,!1),3===e&&(C(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),S(t),0===t.avail_out))return n.last_flush=-1,l}return 4!==e?l:n.wrap<=0?1:(2===n.wrap?(P(n,255&t.adler),P(n,t.adler>>8&255),P(n,t.adler>>16&255),P(n,t.adler>>24&255),P(n,255&t.total_in),P(n,t.total_in>>8&255),P(n,t.total_in>>16&255),P(n,t.total_in>>24&255)):(j(n,t.adler>>>16),j(n,65535&t.adler)),S(t),0=i.w_size&&(0===o&&(C(i.head),i.strstart=0,i.block_start=0,i.insert=0),p=new n.Buf8(i.w_size),n.arraySet(p,e,d-i.w_size,i.w_size,0),e=p,d=i.w_size),h=t.avail_in,u=t.next_in,f=t.input,t.avail_in=d,t.next_in=0,t.input=e,R(i);i.lookahead>=v;){for(r=i.strstart,s=i.lookahead-(v-1);i.ins_h=(i.ins_h<>>=b=v>>>24,d-=b,0==(b=v>>>16&255))C[s++]=65535&v;else{if(!(16&b)){if(0==(64&b)){v=m[(65535&v)+(p&(1<>>=b,d-=b),d<15&&(p+=k[r++]<>>=b=v>>>24,d-=b,!(16&(b=v>>>16&255))){if(0==(64&b)){v=y[(65535&v)+(p&(1<>>=b,d-=b,(b=s-a)>3,p&=(1<<(d-=w<<3))-1,t.next_in=r,t.next_out=s,t.avail_in=r>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function y(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function g(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=f,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new r.Buf32(p),e.distcode=e.distdyn=new r.Buf32(d),e.sane=1,e.back=-1,l):c}function _(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,g(t)):c}function v(t,e){var i,r;return t&&t.state?(r=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15=a.wsize?(r.arraySet(a.window,e,i-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(n<(s=a.wsize-a.wnext)&&(s=n),r.arraySet(a.window,e,i-n,s,a.wnext),(n-=s)?(r.arraySet(a.window,e,i-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=s,a.wnext===a.wsize&&(a.wnext=0),a.whave>>8&255,i.check=s(i.check,z,2,0),w=b=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&b)<<8)+(b>>8))%31){t.msg="incorrect header check",i.mode=30;break}if(8!=(15&b)){t.msg="unknown compression method",i.mode=30;break}if(w-=4,N=8+(15&(b>>>=4)),0===i.wbits)i.wbits=N;else if(N>i.wbits){t.msg="invalid window size",i.mode=30;break}i.dmax=1<>8&1),512&i.flags&&(z[0]=255&b,z[1]=b>>>8&255,i.check=s(i.check,z,2,0)),w=b=0,i.mode=3;case 3:for(;w<32;){if(0===_)break t;_--,b+=p[y++]<>>8&255,z[2]=b>>>16&255,z[3]=b>>>24&255,i.check=s(i.check,z,4,0)),w=b=0,i.mode=4;case 4:for(;w<16;){if(0===_)break t;_--,b+=p[y++]<>8),512&i.flags&&(z[0]=255&b,z[1]=b>>>8&255,i.check=s(i.check,z,2,0)),w=b=0,i.mode=5;case 5:if(1024&i.flags){for(;w<16;){if(0===_)break t;_--,b+=p[y++]<>>8&255,i.check=s(i.check,z,2,0)),w=b=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(_<(C=i.length)&&(C=_),C&&(i.head&&(N=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),r.arraySet(i.head.extra,p,y,C,N)),512&i.flags&&(i.check=s(i.check,p,C,y)),_-=C,y+=C,i.length-=C),i.length))break t;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===_)break t;for(C=0;N=p[y+C++],i.head&&N&&i.length<65536&&(i.head.name+=String.fromCharCode(N)),N&&C<_;);if(512&i.flags&&(i.check=s(i.check,p,C,y)),_-=C,y+=C,N)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===_)break t;for(C=0;N=p[y+C++],i.head&&N&&i.length<65536&&(i.head.comment+=String.fromCharCode(N)),N&&C<_;);if(512&i.flags&&(i.check=s(i.check,p,C,y)),_-=C,y+=C,N)break t}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;w<16;){if(0===_)break t;_--,b+=p[y++]<>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=12;break;case 10:for(;w<32;){if(0===_)break t;_--,b+=p[y++]<>>=7&w,w-=7&w,i.mode=27;break}for(;w<3;){if(0===_)break t;_--,b+=p[y++]<>>=1)){case 0:i.mode=14;break;case 1:if(E(i),i.mode=20,6!==e)break;b>>>=2,w-=2;break t;case 2:i.mode=17;break;case 3:t.msg="invalid block type",i.mode=30}b>>>=2,w-=2;break;case 14:for(b>>>=7&w,w-=7&w;w<32;){if(0===_)break t;_--,b+=p[y++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&b,w=b=0,i.mode=15,6===e)break t;case 15:i.mode=16;case 16:if(C=i.length){if(_>>=5,w-=5,i.ndist=1+(31&b),b>>>=5,w-=5,i.ncode=4+(15&b),b>>>=4,w-=4,286>>=3,w-=3}for(;i.have<19;)i.lens[U[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,B={bits:i.lenbits},L=o(0,i.lens,0,19,i.lencode,0,i.work,B),i.lenbits=B.bits,L){t.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have>>16&255,O=65535&D,!((P=D>>>24)<=w);){if(0===_)break t;_--,b+=p[y++]<>>=P,w-=P,i.lens[i.have++]=O;else{if(16===O){for(F=P+2;w>>=P,w-=P,0===i.have){t.msg="invalid bit length repeat",i.mode=30;break}N=i.lens[i.have-1],C=3+(3&b),b>>>=2,w-=2}else if(17===O){for(F=P+3;w>>=P)),b>>>=3,w-=3}else{for(F=P+7;w>>=P)),b>>>=7,w-=7}if(i.have+C>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=30;break}for(;C--;)i.lens[i.have++]=N}}if(30===i.mode)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,B={bits:i.lenbits},L=o(h,i.lens,0,i.nlen,i.lencode,0,i.work,B),i.lenbits=B.bits,L){t.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,B={bits:i.distbits},L=o(u,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,B),i.distbits=B.bits,L){t.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===e)break t;case 20:i.mode=21;case 21:if(6<=_&&258<=v){t.next_out=g,t.avail_out=v,t.next_in=y,t.avail_in=_,i.hold=b,i.bits=w,a(t,x),g=t.next_out,d=t.output,v=t.avail_out,y=t.next_in,p=t.input,_=t.avail_in,b=i.hold,w=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;j=(D=i.lencode[b&(1<>>16&255,O=65535&D,!((P=D>>>24)<=w);){if(0===_)break t;_--,b+=p[y++]<>R)])>>>16&255,O=65535&D,!(R+(P=D>>>24)<=w);){if(0===_)break t;_--,b+=p[y++]<>>=R,w-=R,i.back+=R}if(b>>>=P,w-=P,i.back+=P,i.length=O,0===j){i.mode=26;break}if(32&j){i.back=-1,i.mode=12;break}if(64&j){t.msg="invalid literal/length code",i.mode=30;break}i.extra=15&j,i.mode=22;case 22:if(i.extra){for(F=i.extra;w>>=i.extra,w-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;j=(D=i.distcode[b&(1<>>16&255,O=65535&D,!((P=D>>>24)<=w);){if(0===_)break t;_--,b+=p[y++]<>R)])>>>16&255,O=65535&D,!(R+(P=D>>>24)<=w);){if(0===_)break t;_--,b+=p[y++]<>>=R,w-=R,i.back+=R}if(b>>>=P,w-=P,i.back+=P,64&j){t.msg="invalid distance code",i.mode=30;break}i.offset=O,i.extra=15&j,i.mode=24;case 24:if(i.extra){for(F=i.extra;w>>=i.extra,w-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===v)break t;if(C=x-v,i.offset>C){if((C=i.offset-C)>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=30;break}S=C>i.wnext?(C-=i.wnext,i.wsize-C):i.wnext-C,C>i.length&&(C=i.length),A=i.window}else A=d,S=g-i.offset,C=i.length;for(v_?(b=B[F+c[E]],T[I+c[E]]):(b=96,0),p=1<>P)+(d-=p)]=v<<24|b<<16|w|0,0!==d;);for(p=1<>=1;if(0!==p?(R&=p-1,R+=p):R=0,E++,0==--N[x]){if(x===C)break;x=e[i+c[E]]}if(S>>7)]}function x(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function E(t,e,i){t.bi_valid>a-i?(t.bi_buf|=e<>a-t.bi_valid,t.bi_valid+=i-a):(t.bi_buf|=e<>>=1,i<<=1,0<--e;);return i>>>1}function S(t,e,i){var r,n,a=new Array(s+1),o=0;for(r=1;r<=s;r++)a[r]=o=o+i[r-1]<<1;for(n=0;n<=e;n++){var h=t[2*n+1];0!==h&&(t[2*n]=C(a[h]++,h))}}function A(t){var e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function P(t){8>1;1<=i;i--)O(t,a,i);for(n=u;i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],O(t,a,1),r=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=r,a[2*n]=a[2*i]+a[2*r],t.depth[n]=(t.depth[i]>=t.depth[r]?t.depth[i]:t.depth[r])+1,a[2*i+1]=a[2*r+1]=n,t.heap[1]=n++,O(t,a,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var i,r,n,a,o,h,u=e.dyn_tree,l=e.max_code,c=e.stat_desc.static_tree,f=e.stat_desc.has_stree,p=e.stat_desc.extra_bits,d=e.stat_desc.extra_base,m=e.stat_desc.max_length,y=0;for(a=0;a<=s;a++)t.bl_count[a]=0;for(u[2*t.heap[t.heap_max]+1]=0,i=t.heap_max+1;i<573;i++)m<(a=u[2*u[2*(r=t.heap[i])+1]+1]+1)&&(a=m,y++),u[2*r+1]=a,l>=7;r<30;r++)for(v[r]=n<<7,t=0;t<1<>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),T(t,t.l_desc),T(t,t.d_desc),a=function(t){var e;for(I(t,t.dyn_ltree,t.l_desc.max_code),I(t,t.dyn_dtree,t.d_desc.max_code),T(t,t.bl_desc),e=18;3<=e&&0===t.bl_tree[2*l[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),n=t.opt_len+3+7>>>3,(s=t.static_len+3+7>>>3)<=n&&(n=s)):n=s=i+5,i+4<=n&&-1!==e?B(t,e,i,r):4===t.strategy||s===n?(E(t,2+(r?1:0),3),R(t,c,f)):(E(t,4+(r?1:0),3),function(t,e,i,r){var n;for(E(t,e-257,5),E(t,i-1,5),E(t,r-4,4),n=0;n>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&i,t.last_lit++,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(d[i]+256+1)]++,t.dyn_dtree[2*M(e)]++),t.last_lit===t.lit_bufsize-1},i._tr_align=function(t){var e;E(t,2,3),k(t,256,c),16===(e=t).bi_valid?(x(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":41}],53:[function(t,e,i){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,e,i){"use strict";e.exports="function"==typeof s?s:function(){var t=[].slice.apply(arguments);t.splice(1,0,0),setTimeout.apply(null,t)}},{}]},{},[10])(10)}))}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}))}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}))}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}))}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}))}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,t("timers").setImmediate)},{buffer:12,timers:22}],16:[function(t,e,i){"use strict";var r=t("immediate");function n(){}var s={},a=["REJECTED"],o=["FULFILLED"],h=["PENDING"];e.exports=u;function u(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=h;this.queue=[];this.outcome=void 0;t!==n&&p(this,t)}u.prototype.finally=function(t){if("function"!=typeof t)return this;var e=this.constructor;return this.then((function(i){return e.resolve(t()).then((function(){return i}))}),(function(i){return e.resolve(t()).then((function(){throw i}))}))};u.prototype.catch=function(t){return this.then(null,t)};u.prototype.then=function(t,e){if("function"!=typeof t&&this.state===o||"function"!=typeof e&&this.state===a)return this;var i=new this.constructor(n);if(this.state!==h){c(i,this.state===o?t:e,this.outcome)}else this.queue.push(new l(i,t,e));return i};function l(t,e,i){this.promise=t;if("function"==typeof e){this.onFulfilled=e;this.callFulfilled=this.otherCallFulfilled}if("function"==typeof i){this.onRejected=i;this.callRejected=this.otherCallRejected}}l.prototype.callFulfilled=function(t){s.resolve(this.promise,t)};l.prototype.otherCallFulfilled=function(t){c(this.promise,this.onFulfilled,t)};l.prototype.callRejected=function(t){s.reject(this.promise,t)};l.prototype.otherCallRejected=function(t){c(this.promise,this.onRejected,t)};function c(t,e,i){r((function(){var r;try{r=e(i)}catch(e){return s.reject(t,e)}r===t?s.reject(t,new TypeError("Cannot resolve promise with itself")):s.resolve(t,r)}))}s.resolve=function(t,e){var i=d(f,e);if("error"===i.status)return s.reject(t,i.value);var r=i.value;if(r)p(t,r);else{t.state=o;t.outcome=e;for(var n=-1,a=t.queue.length;++nthis._max&&h(this)},get:function(){return this._max},enumerable:!0});Object.defineProperty(s.prototype,"lengthCalculator",{set:function(t){if("function"!=typeof t){this._lengthCalculator=i;this._length=this._itemCount;for(var e in this._cache)this._cache[e].length=1}else{this._lengthCalculator=t;this._length=0;for(var e in this._cache){this._cache[e].length=this._lengthCalculator(this._cache[e].value);this._length+=this._cache[e].length}}this._length>this._max&&h(this)},get:function(){return this._lengthCalculator},enumerable:!0});Object.defineProperty(s.prototype,"length",{get:function(){return this._length},enumerable:!0});Object.defineProperty(s.prototype,"itemCount",{get:function(){return this._itemCount},enumerable:!0});s.prototype.forEach=function(t,e){e=e||this;for(var i=0,r=this._itemCount,n=this._mru-1;n>=0&&i=0&&e=0&&e=0&&ethis._max){l(this,this._cache[e]);return!1}this._dispose&&this._dispose(e,this._cache[e].value);this._cache[e].now=s;this._cache[e].maxAge=r;this._cache[e].value=i;this._length+=a-this._cache[e].length;this._cache[e].length=a;this.get(e);this._length>this._max&&h(this);return!0}var o=new c(e,i,this._mru++,a,s,r);if(o.length>this._max){this._dispose&&this._dispose(e,i);return!1}this._length+=o.length;this._lruList[o.lu]=this._cache[e]=o;this._itemCount++;this._length>this._max&&h(this);return!0};s.prototype.has=function(e){n(e);return!!t(this._cache,e)&&!o(this,this._cache[e])};s.prototype.get=function(t){n(t);return a(this,t,!0)};s.prototype.peek=function(t){n(t);return a(this,t,!1)};s.prototype.pop=function(){var t=this._lruList[this._lru];l(this,t);return t||null};s.prototype.del=function(t){n(t);l(this,this._cache[t])};s.prototype.load=function(t){this.reset();for(var e=Date.now(),i=t.length-1;i>=0;i--){var r=t[i];n(r.k);var s=r.e||0;if(0===s)this.set(r.k,r.v);else{var a=s-e;a>0&&this.set(r.k,r.v,a)}}};function a(t,e,i){n(e);var r=t._cache[e];if(r){if(o(t,r)){l(t,r);t._allowStale||(r=void 0)}else i&&function(t,e){u(t,e);e.lu=t._mru++;t._lruList[e.lu]=e}(t,r);r&&(r=r.value)}return r}function o(t,e){if(!e||!e.maxAge&&!t._maxAge)return!1;var i=Date.now()-e.now;return e.maxAge?i>e.maxAge:t._maxAge&&i>t._maxAge}function h(t){for(;t._lrut._max;)l(t,t._lruList[t._lru])}function u(t,e){delete t._lruList[e.lu];for(;t._lru1)for(var i=1;i=this.text.length)return;t=this.text[this.place++]}switch(this.state){case x:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}};P.prototype.afterquote=function(t){if('"'!==t){if(!S.test(t))throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place);this.word=this.word.trim();this.afterItem(t)}else{this.word+='"';this.state=4}};P.prototype.afterItem=function(t){if(","!==t)if("]"!==t);else{this.level--;if(null!==this.word){this.currentObject.push(this.word);this.word=null}this.state=x;this.currentObject=this.stack.pop();this.currentObject||(this.state=-1)}else{null!==this.word&&this.currentObject.push(this.word);this.word=null;this.state=x}};P.prototype.number=function(t){if(A.test(t))this.word+=t;else{if(!S.test(t))throw new Error("havn't handled \""+t+'" in number yet, index '+this.place);this.word=parseFloat(this.word);this.afterItem(t)}};P.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5};P.prototype.keyword=function(t){if(C.test(t))this.word+=t;else if("["!==t){if(!S.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}else{var e=[];e.push(this.word);this.level++;null===this.root?this.root=e:this.currentObject.push(e);this.stack.push(this.currentObject);this.currentObject=e;this.state=x}};P.prototype.neutral=function(t){if(k.test(t)){this.word=t;this.state=2}else if('"'!==t)if(A.test(t)){this.word=t;this.state=3}else{if(!S.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)}else{this.word="";this.state=4}};P.prototype.output=function(){for(;this.place0?90:-90);t.lat_ts=t.lat1}}(n);return n};function N(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?N[t]=M(arguments[1]):N[t]=I(arguments[1]):N[t]=i}else if(1===arguments.length){if(Array.isArray(t))return t.map((function(t){Array.isArray(t)?N.apply(e,t):N(t)}));if("string"==typeof t){if(t in N)return N[t]}else"EPSG"in t?N["EPSG:"+t.EPSG]=t:"ESRI"in t?N["ESRI:"+t.ESRI]=t:"IAU2000"in t?N["IAU2000:"+t.IAU2000]=t:console.log(t);return}}!function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees");t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees");t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");t.WGS84=t["EPSG:4326"];t["EPSG:3785"]=t["EPSG:3857"];t.GOOGLE=t["EPSG:3857"];t["EPSG:900913"]=t["EPSG:3857"];t["EPSG:102113"]=t["EPSG:3857"]}(N);var L=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];var B=["3857","900913","3785","102113"];function F(t){if(!function(t){return"string"==typeof t}(t))return t;if(function(t){return t in N}(t))return N[t];if(function(t){return L.some((function(e){return t.indexOf(e)>-1}))}(t)){var e=I(t);if(function(t){var e=w(t,"authority");if(e){var i=w(e,"epsg");return i&&B.indexOf(i)>-1}}(e))return N["EPSG:3857"];var i=function(t){var e=w(t,"extension");if(e)return w(e,"proj4")}(e);return i?M(i):e}return function(t){return"+"===t[0]}(t)?M(t):void 0}var D=function(t,e){t=t||{};var i,r;if(!e)return t;for(r in e)void 0!==(i=e[r])&&(t[r]=i);return t},z=function(t,e,i){var r=t*e;return i/Math.sqrt(1-r*r)},U=function(t){return t<0?-1:1},q=function(t){return Math.abs(t)<=g?t:t-U(t)*y},G=function(t,e,i){var r=t*i,n=.5*t;r=Math.pow((1-r)/(1+r),n);return Math.tan(.5*(h-e))/r},W=function(t,e){for(var i,r,n=.5*t,s=h-2*Math.atan(e),a=0;a<=15;a++){i=t*Math.sin(s);s+=r=h-2*Math.atan(e*Math.pow((1-i)/(1+i),n))-s;if(Math.abs(r)<=1e-10)return s}return-9999};function H(t){return t}var Q=[{init:function(){var t=this.b/this.a;this.es=1-t*t;"x0"in this||(this.x0=0);"y0"in this||(this.y0=0);this.e=Math.sqrt(this.es);this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=z(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},forward:function(t){var e,i,r=t.x,n=t.y;if(n*d>90&&n*d<-90&&r*d>180&&r*d<-180)return null;if(Math.abs(Math.abs(n)-h)<=f)return null;if(this.sphere){e=this.x0+this.a*this.k0*q(r-this.long0);i=this.y0+this.a*this.k0*Math.log(Math.tan(m+.5*n))}else{var s=Math.sin(n),a=G(this.e,n,s);e=this.x0+this.a*this.k0*q(r-this.long0);i=this.y0-this.a*this.k0*Math.log(a)}t.x=e;t.y=i;return t},inverse:function(t){var e,i,r=t.x-this.x0,n=t.y-this.y0;if(this.sphere)i=h-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var s=Math.exp(-n/(this.a*this.k0));if(-9999===(i=W(this.e,s)))return null}e=q(this.long0+r/(this.a*this.k0));t.x=e;t.y=i;return t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"]},{init:function(){},forward:H,inverse:H,names:["longlat","identity"]}],X={},V=[];function Z(t,e){var i=V.length;if(!t.names){console.log(e);return!0}V[i]=t;t.names.forEach((function(t){X[t.toLowerCase()]=i}));return this}var J={start:function(){Q.forEach(Z)},add:Z,get:function(t){if(!t)return!1;var e=t.toLowerCase();return void 0!==X[e]&&V[X[e]]?V[X[e]]:void 0}},Y={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"}},K=Y.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};Y.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};var $={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"}};var tt={};function et(t){if(0===t.length)return null;var e="@"===t[0];e&&(t=t.slice(1));return"null"===t?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:t,mandatory:!e,grid:tt[t]||null,isNull:!1}}function it(t){return t/3600*Math.PI/180}function rt(t,e,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,i)))}function nt(t){return t.map((function(t){return[it(t.longitudeShift),it(t.latitudeShift)]}))}function st(t,e,i){return{name:rt(t,e+8,e+16).trim(),parent:rt(t,e+24,e+24+8).trim(),lowerLatitude:t.getFloat64(e+72,i),upperLatitude:t.getFloat64(e+88,i),lowerLongitude:t.getFloat64(e+104,i),upperLongitude:t.getFloat64(e+120,i),latitudeInterval:t.getFloat64(e+136,i),longitudeInterval:t.getFloat64(e+152,i),gridNodeCount:t.getInt32(e+168,i)}}function at(t,e,i,r){for(var n=e+176,s=[],a=0;a3&&(0!==p.datum_params[3]||0!==p.datum_params[4]||0!==p.datum_params[5]||0!==p.datum_params[6])){p.datum_type=e;p.datum_params[3]*=o;p.datum_params[4]*=o;p.datum_params[5]*=o;p.datum_params[6]=p.datum_params[6]/1e6+1}}if(f){p.datum_type=i;p.grids=f}p.a=h;p.b=u;p.es=l;p.ep2=c;return p}(h.datumCode,h.datum_params,m.a,m.b,y.es,y.ep2,g);D(this,h);D(this,p);this.a=m.a;this.b=m.b;this.rf=m.rf;this.sphere=m.sphere;this.es=y.es;this.e=y.e;this.ep2=y.ep2;this.datum=_;this.init();a(null,this)}else a(s)}else a(s)}ot.projections=J;ot.projections.start();function ht(t,e,i){var r,n,s,a,o=t.x,u=t.y,l=t.z?t.z:0;if(u<-h&&u>-1.001*h)u=-h;else if(u>h&&u<1.001*h)u=h;else{if(u<-h)return{x:-1/0,y:-1/0,z:t.z};if(u>h)return{x:1/0,y:1/0,z:t.z}}o>Math.PI&&(o-=2*Math.PI);n=Math.sin(u);a=Math.cos(u);s=n*n;return{x:((r=i/Math.sqrt(1-e*s))+l)*a*Math.cos(o),y:(r+l)*a*Math.sin(o),z:(r*(1-e)+l)*n}}function ut(t,e,i,r){var n,s,a,o,u,l,c,f,p,d,m,y,g,_,v,b=1e-12,w=t.x,M=t.y,x=t.z?t.z:0;n=Math.sqrt(w*w+M*M);s=Math.sqrt(w*w+M*M+x*x);if(n/i1e-24&&g<30);return{x:_,y:Math.atan(m/Math.abs(d)),z:v}}function lt(i){return i===t||i===e}var ct=function(r,o,h){if(function(i,r){return i.datum_type===r.datum_type&&!(i.a!==r.a||Math.abs(i.es-r.es)>5e-11)&&(i.datum_type===t?i.datum_params[0]===r.datum_params[0]&&i.datum_params[1]===r.datum_params[1]&&i.datum_params[2]===r.datum_params[2]:i.datum_type!==e||i.datum_params[0]===r.datum_params[0]&&i.datum_params[1]===r.datum_params[1]&&i.datum_params[2]===r.datum_params[2]&&i.datum_params[3]===r.datum_params[3]&&i.datum_params[4]===r.datum_params[4]&&i.datum_params[5]===r.datum_params[5]&&i.datum_params[6]===r.datum_params[6])}(r,o))return h;if(r.datum_type===n||o.datum_type===n)return h;var u=r.a,l=r.es;if(r.datum_type===i){if(0!==ft(r,!1,h))return;u=s;l=a}var c=o.a,f=o.b,p=o.es;if(o.datum_type===i){c=s;f=6356752.314;p=a}if(l===p&&u===c&&!lt(r.datum_type)&&!lt(o.datum_type))return h;h=ht(h,l,u);lt(r.datum_type)&&(h=function(i,r,n){if(r===t)return{x:i.x+n[0],y:i.y+n[1],z:i.z+n[2]};if(r===e){var s=n[0],a=n[1],o=n[2],h=n[3],u=n[4],l=n[5],c=n[6];return{x:c*(i.x-l*i.y+u*i.z)+s,y:c*(l*i.x+i.y-h*i.z)+a,z:c*(-u*i.x+h*i.y+i.z)+o}}}(h,r.datum_type,r.datum_params));lt(o.datum_type)&&(h=function(i,r,n){if(r===t)return{x:i.x-n[0],y:i.y-n[1],z:i.z-n[2]};if(r===e){var s=n[0],a=n[1],o=n[2],h=n[3],u=n[4],l=n[5],c=n[6],f=(i.x-s)/c,p=(i.y-a)/c,d=(i.z-o)/c;return{x:f+l*p-u*d,y:-l*f+p+h*d,z:u*f-h*p+d}}}(h,o.datum_type,o.datum_params));h=ut(h,p,c,f);if(o.datum_type===i){if(0!==ft(o,!0,h))return}return h};function ft(t,e,i){if(null===t.grids||0===t.grids.length){console.log("Grid shift grids not found");return-1}for(var r={x:-i.x,y:i.y},n={x:Number.NaN,y:Number.NaN},s=[],a=0;ar.y||l>r.x||p1e-12&&Math.abs(a.y)>1e-12);if(h<0){console.log("Inverse grid shift iterator failed to converge.");return r}r.x=q(s.x+i.ll[0]);r.y=s.y+i.ll[1]}else if(!isNaN(s.x)){r.x=t.x+s.x;r.y=t.y+s.y}return r}function dt(t,e){var i,r={x:t.x/e.del[0],y:t.y/e.del[1]},n=Math.floor(r.x),s=Math.floor(r.y),a=r.x-1*n,o=r.y-1*s,h={x:Number.NaN,y:Number.NaN};if(n<0||n>=e.lim[0])return h;if(s<0||s>=e.lim[1])return h;i=s*e.lim[0]+n;var u=e.cvs[i][0],l=e.cvs[i][1];i++;var c=e.cvs[i][0],f=e.cvs[i][1];i+=e.lim[0];var p=e.cvs[i][0],d=e.cvs[i][1];i--;var m=e.cvs[i][0],y=e.cvs[i][1],g=a*o,_=a*(1-o),v=(1-a)*(1-o),b=(1-a)*o;h.x=v*u+_*c+b*m+g*p;h.y=v*l+_*f+b*y+g*d;return h}var mt=function(t,e,i){var r,n,s,a=i.x,o=i.y,h=i.z||0,u={};for(s=0;s<3;s++)if(!e||2!==s||void 0!==i.z){if(0===s){r=a;n=-1!=="ew".indexOf(t.axis[s])?"x":"y"}else if(1===s){r=o;n=-1!=="ns".indexOf(t.axis[s])?"y":"x"}else{r=h;n="z"}switch(t.axis[s]){case"e":case"n":u[n]=r;break;case"w":case"s":u[n]=-r;break;case"u":void 0!==i[n]&&(u.z=r);break;case"d":void 0!==i[n]&&(u.z=-r);break;default:return null}}return u},yt=function(t){var e={x:t[0],y:t[1]};t.length>2&&(e.z=t[2]);t.length>3&&(e.m=t[3]);return e},gt=function(t){_t(t.x);_t(t.y)};function _t(t){if("function"==typeof Number.isFinite){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if("number"!=typeof t||t!=t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function vt(i,r,n){var s;Array.isArray(n)&&(n=yt(n));gt(n);if(i.datum&&r.datum&&function(i,r){return(i.datum.datum_type===t||i.datum.datum_type===e)&&"WGS84"!==r.datumCode||(r.datum.datum_type===t||r.datum.datum_type===e)&&"WGS84"!==i.datumCode}(i,r)){n=vt(i,s=new ot("WGS84"),n);i=s}"enu"!==i.axis&&(n=mt(i,!1,n));if("longlat"===i.projName)n={x:n.x*p,y:n.y*p,z:n.z||0};else{i.to_meter&&(n={x:n.x*i.to_meter,y:n.y*i.to_meter,z:n.z||0});if(!(n=i.inverse(n)))return}i.from_greenwich&&(n.x+=i.from_greenwich);if(n=ct(i.datum,r.datum,n)){r.from_greenwich&&(n={x:n.x-r.from_greenwich,y:n.y,z:n.z||0});if("longlat"===r.projName)n={x:n.x*d,y:n.y*d,z:n.z||0};else{n=r.forward(n);r.to_meter&&(n={x:n.x/r.to_meter,y:n.y/r.to_meter,z:n.z||0})}return"enu"!==r.axis?mt(r,!0,n):n}}var bt=ot("WGS84");function wt(t,e,i){var r,n,s;if(Array.isArray(i)){r=vt(t,e,i)||{x:NaN,y:NaN};return i.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name?"number"==typeof r.z?[r.x,r.y,r.z].concat(i.splice(3)):[r.x,r.y,i[2]].concat(i.splice(3)):[r.x,r.y].concat(i.splice(2)):[r.x,r.y]}n=vt(t,e,i);if(2===(s=Object.keys(i)).length)return n;s.forEach((function(r){if(void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name){if("x"===r||"y"===r||"z"===r)return}else if("x"===r||"y"===r)return;n[r]=i[r]}));return n}function Mt(t){return t instanceof ot?t:t.oProj?t.oProj:ot(t)}function xt(t,e,i){t=Mt(t);var r,n=!1;if(void 0===e){e=t;t=bt;n=!0}else if(void 0!==e.x||Array.isArray(e)){i=e;e=t;t=bt;n=!0}e=Mt(e);if(i)return wt(t,e,i);r={forward:function(i){return wt(t,e,i)},inverse:function(i){return wt(e,t,i)}};n&&(r.oProj=e);return r}var Et=6,kt="AJSAJS",Ct="AFAFAF",St=65,At=73,Pt=79,jt=86,Ot=90,Rt={forward:Tt,inverse:function(t){var e=Bt(zt(t.toUpperCase()));if(e.lat&&e.lon)return[e.lon,e.lat,e.lon,e.lat];return[e.left,e.bottom,e.right,e.top]},toPoint:It};function Tt(t,e){e=e||5;return function(t,e){var i="00000"+t.easting,r="00000"+t.northing;return t.zoneNumber+t.zoneLetter+(n=t.easting,s=t.northing,a=t.zoneNumber,o=Dt(a),h=Math.floor(n/1e5),u=Math.floor(s/1e5)%20,function(t,e,i){var r=i-1,n=kt.charCodeAt(r),s=Ct.charCodeAt(r),a=n+t-1,o=s+e,h=!1;if(a>Ot){a=a-Ot+St-1;h=!0}(a===At||nAt||(a>At||nPt||(a>Pt||nOt&&(a=a-Ot+St-1);if(o>jt){o=o-jt+St-1;h=!0}else h=!1;(o===At||sAt||(o>At||sPt||(o>Pt||sjt&&(o=o-jt+St-1);return String.fromCharCode(a)+String.fromCharCode(o)}(h,u,o))+i.substr(i.length-5,e)+r.substr(r.length-5,e);var n,s,a,o,h,u}(function(t){var e,i,r,n,s,a,o,h,u=t.lat,l=t.lon,c=6378137,f=.00669438,p=.9996,d=Nt(u),m=Nt(l);h=Math.floor((l+180)/6)+1;180===l&&(h=60);u>=56&&u<64&&l>=3&&l<12&&(h=32);u>=72&&u<84&&(l>=0&&l<9?h=31:l>=9&&l<21?h=33:l>=21&&l<33?h=35:l>=33&&l<42&&(h=37));o=Nt(6*(h-1)-180+3);e=f/(1-f);i=c/Math.sqrt(1-f*Math.sin(d)*Math.sin(d));r=Math.tan(d)*Math.tan(d);n=e*Math.cos(d)*Math.cos(d);s=Math.cos(d)*(m-o);a=c*((1-f/4-3*f*f/64-5*f*f*f/256)*d-(3*f/8+3*f*f/32+45*f*f*f/1024)*Math.sin(2*d)+(15*f*f/256+45*f*f*f/1024)*Math.sin(4*d)-35*f*f*f/3072*Math.sin(6*d));var y=p*i*(s+(1-r+n)*s*s*s/6+(5-18*r+r*r+72*n-58*e)*s*s*s*s*s/120)+5e5,g=p*(a+i*Math.tan(d)*(s*s/2+(5-r+9*n+4*n*n)*s*s*s*s/24+(61-58*r+r*r+600*n-330*e)*s*s*s*s*s*s/720));u<0&&(g+=1e7);return{northing:Math.round(g),easting:Math.round(y),zoneNumber:h,zoneLetter:Ft(u)}}({lat:t[1],lon:t[0]}),e)}function It(t){var e=Bt(zt(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function Nt(t){return t*(Math.PI/180)}function Lt(t){return t/Math.PI*180}function Bt(t){var e=t.northing,i=t.easting,r=t.zoneLetter,n=t.zoneNumber;if(n<0||n>60)return null;var s,a,o,h,u,l,c,f,p,d=.9996,m=6378137,y=.00669438,g=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),_=i-5e5,v=e;r<"N"&&(v-=1e7);c=6*(n-1)-180+3;s=.006739496752268451;p=(f=v/d/6367449.145945056)+(3*g/2-27*g*g*g/32)*Math.sin(2*f)+(21*g*g/16-55*g*g*g*g/32)*Math.sin(4*f)+151*g*g*g/96*Math.sin(6*f);a=m/Math.sqrt(1-y*Math.sin(p)*Math.sin(p));o=Math.tan(p)*Math.tan(p);h=s*Math.cos(p)*Math.cos(p);u=.99330562*m/Math.pow(1-y*Math.sin(p)*Math.sin(p),1.5);l=_/(a*d);var b=p-a*Math.tan(p)/u*(l*l/2-(5+3*o+10*h-4*h*h-9*s)*l*l*l*l/24+(61+90*o+298*h+45*o*o-1.6983531815716497-3*h*h)*l*l*l*l*l*l/720);b=Lt(b);var w,M=(l-(1+2*o+h)*l*l*l/6+(5-2*h+28*o-3*h*h+8*s+24*o*o)*l*l*l*l*l/120)/Math.cos(p);M=c+Lt(M);if(t.accuracy){var x=Bt({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});w={top:x.lat,right:x.lon,bottom:b,left:M}}else w={lat:b,lon:M};return w}function Ft(t){var e="Z";84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C");return e}function Dt(t){var e=t%Et;0===e&&(e=Et);return e}function zt(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,r=null,n="",s=0;!/[A-Z]/.test(e=t.charAt(s));){if(s>=2)throw"MGRSPoint bad conversion from: "+t;n+=e;s++}var a=parseInt(n,10);if(0===s||s+3>i)throw"MGRSPoint bad conversion from: "+t;var o=t.charAt(s++);if(o<="A"||"B"===o||"Y"===o||o>="Z"||"I"===o||"O"===o)throw"MGRSPoint zone letter "+o+" not handled: "+t;r=t.substring(s,s+=2);for(var h=Dt(a),u=function(t,e){var i=kt.charCodeAt(e-1),r=1e5,n=!1;for(;i!==t.charCodeAt(0);){++i===At&&i++;i===Pt&&i++;if(i>Ot){if(n)throw"Bad character: "+t;i=St;n=!0}r+=1e5}return r}(r.charAt(0),h),l=function(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;var i=Ct.charCodeAt(e-1),r=0,n=!1;for(;i!==t.charCodeAt(0);){++i===At&&i++;i===Pt&&i++;if(i>jt){if(n)throw"Bad character: "+t;i=St;n=!0}r+=1e5}return r}(r.charAt(1),h);l0){f=1e5/Math.pow(10,m);p=t.substring(s,s+m);y=parseFloat(p)*f;d=t.substring(s+m);g=parseFloat(d)*f}return{easting:y+u,northing:g+l,zoneLetter:o,zoneNumber:a,accuracy:f}}function Ut(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function qt(t,e,i){if(!(this instanceof qt))return new qt(t,e,i);if(Array.isArray(t)){this.x=t[0];this.y=t[1];this.z=t[2]||0}else if("object"==typeof t){this.x=t.x;this.y=t.y;this.z=t.z||0}else if("string"==typeof t&&void 0===e){var r=t.split(",");this.x=parseFloat(r[0],10);this.y=parseFloat(r[1],10);this.z=parseFloat(r[2],10)||0}else{this.x=t;this.y=e;this.z=i||0}console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}qt.fromMGRS=function(t){return new qt(It(t))};qt.prototype.toMGRS=function(t){return Tt([this.x,this.y],t)};var Gt=.046875,Wt=.01953125,Ht=.01068115234375,Qt=function(t){var e=[];e[0]=1-t*(.25+t*(Gt+t*(Wt+t*Ht)));e[1]=t*(.75-t*(Gt+t*(Wt+t*Ht)));var i=t*t;e[2]=i*(.46875-t*(.013020833333333334+.007120768229166667*t));i*=t;e[3]=i*(.3645833333333333-.005696614583333333*t);e[4]=i*t*.3076171875;return e},Xt=function(t,e,i,r){i*=e;e*=e;return r[0]*t-i*(r[1]+e*(r[2]+e*(r[3]+e*r[4])))},Vt=function(t,e,i){for(var r=1/(1-e),n=t,s=20;s;--s){var a=Math.sin(n),o=1-e*a*a;n-=o=(Xt(n,a,Math.cos(n),i)-t)*(o*Math.sqrt(o))*r;if(Math.abs(o)f?Math.tan(s):0,m=Math.pow(d,2),y=Math.pow(m,2);e=1-this.es*Math.pow(o,2);u/=Math.sqrt(e);var g=Xt(s,o,h,this.en);i=this.a*(this.k0*u*(1+l/6*(1-m+c+l/20*(5-18*m+y+14*c-58*m*c+l/42*(61+179*y-y*m-479*m)))))+this.x0;r=this.a*(this.k0*(g-this.ml0+o*a*u/2*(1+l/12*(5-m+9*c+4*p+l/30*(61+y-58*m+270*c-330*m*c+l/56*(1385+543*y-y*m-3111*m))))))+this.y0}else{var _=h*Math.sin(a);if(Math.abs(Math.abs(_)-1)=1){if(_-1>f)return 93;r=0}else r=Math.acos(r);s<0&&(r=-r);r=this.a*this.k0*(r-this.lat0)+this.y0}t.x=i;t.y=r;return t},inverse:function(t){var e,i,r,n,s=(t.x-this.x0)*(1/this.a),a=(t.y-this.y0)*(1/this.a);if(this.es){e=this.ml0+a/this.k0;i=Vt(e,this.es,this.en);if(Math.abs(i)f?Math.tan(i):0,c=this.ep2*Math.pow(u,2),p=Math.pow(c,2),d=Math.pow(l,2),m=Math.pow(d,2);e=1-this.es*Math.pow(o,2);var y=s*Math.sqrt(e)/this.k0,g=Math.pow(y,2);r=i-(e*=l)*g/(1-this.es)*.5*(1-g/12*(5+3*d-9*c*d+c-4*p-g/30*(61+90*d-252*c*d+45*m+46*c-g/56*(1385+3633*d+4095*m+1574*m*d))));n=q(this.long0+y*(1-g/6*(1+2*d+c-g/20*(5+28*d+24*m+8*c*d+6*c-g/42*(61+662*d+1320*m+720*m*d))))/u)}else{r=h*U(a);n=0}}else{var _=Math.exp(s/this.k0),v=.5*(_-1/_),b=this.lat0+a/this.k0,w=Math.cos(b);e=Math.sqrt((1-Math.pow(w,2))/(1+Math.pow(v,2)));r=Math.asin(e);a<0&&(r=-r);n=0===v&&0===w?0:q(Math.atan2(v,w)+this.long0)}t.x=n;t.y=r;return t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]},Jt=function(t){var e=Math.exp(t);return e=(e-1/e)/2},Yt=function(t,e){t=Math.abs(t);e=Math.abs(e);var i=Math.max(t,e),r=Math.min(t,e)/(i||1);return i*Math.sqrt(1+Math.pow(r,2))},Kt=function(t){var e=Math.abs(t);e=function(t){var e=1+t,i=e-1;return 0===i?t:t*Math.log(e)/i}(e*(1+e/(Yt(1,e)+1)));return t<0?-e:e},$t=function(t,e){for(var i,r=2*Math.cos(2*e),n=t.length-1,s=t[n],a=0;--n>=0;){i=r*s-a+t[n];a=s;s=i}return e+i*Math.sin(2*e)},te=function(t,e,i){for(var r,n,s=Math.sin(e),a=Math.cos(e),o=Jt(i),h=function(t){var e=Math.exp(t);return(e+1/e)/2}(i),u=2*a*h,l=-2*s*o,c=t.length-1,f=t[c],p=0,d=0,m=0;--c>=0;){r=d;n=p;f=u*(d=f)-r-l*(p=m)+t[c];m=l*d-n+u*p}return[(u=s*h)*f-(l=a*o)*m,u*m+l*f]};var ee={init:function(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');if(this.approx){Zt.init.apply(this);this.forward=Zt.forward;this.inverse=Zt.inverse}this.x0=void 0!==this.x0?this.x0:0;this.y0=void 0!==this.y0?this.y0:0;this.long0=void 0!==this.long0?this.long0:0;this.lat0=void 0!==this.lat0?this.lat0:0;this.cgb=[];this.cbg=[];this.utg=[];this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2)));this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2);i*=e;this.cgb[1]=i*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6));this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945)))));i*=e;this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835))));this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835))));i*=e;this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175)));this.cbg[3]=i*(1237/630+e*(e*(-24832/14175)-2.4));i*=e;this.cgb[4]=i*(4174/315+e*(-144838/6237));this.cbg[4]=i*(-734/315+e*(109598/31185));i*=e;this.cgb[5]=i*(601676/22275);this.cbg[5]=i*(444337/155925);i=Math.pow(e,2);this.Qn=this.k0/(1+e)*(1+i*(1/4+i*(1/64+i/256)));this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5);this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800))))));this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720)))));this.gtu[1]=i*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6));i*=e;this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720))));this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440))));i*=e;this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600)));this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600)));i*=e;this.utg[4]=i*(-4583/161280+e*(108847/3991680));this.gtu[4]=i*(34729/80640+e*(-3418889/1995840));i*=e;this.utg[5]=i*(-20648693/638668800);this.gtu[5]=.6650675310896665*i;var r=$t(this.cbg,this.lat0);this.Zb=-this.Qn*(r+function(t,e){for(var i,r=2*Math.cos(e),n=t.length-1,s=t[n],a=0;--n>=0;){i=r*s-a+t[n];a=s;s=i}return Math.sin(e)*i}(this.gtu,2*r))},forward:function(t){var e=q(t.x-this.long0),i=t.y;i=$t(this.cbg,i);var r=Math.sin(i),n=Math.cos(i),s=Math.sin(e),a=Math.cos(e);i=Math.atan2(r,a*n);e=Math.atan2(s*n,Yt(r,n*a));e=Kt(Math.tan(e));var o,h,u=te(this.gtu,2*i,2*e);i+=u[0];e+=u[1];if(Math.abs(e)<=2.623395162778){o=this.a*(this.Qn*e)+this.x0;h=this.a*(this.Qn*i+this.Zb)+this.y0}else{o=1/0;h=1/0}t.x=o;t.y=h;return t},inverse:function(t){var e,i,r=(t.x-this.x0)*(1/this.a),n=(t.y-this.y0)*(1/this.a);n=(n-this.Zb)/this.Qn;r/=this.Qn;if(Math.abs(r)<=2.623395162778){var s=te(this.utg,2*n,2*r);n+=s[0];r+=s[1];r=Math.atan(Jt(r));var a=Math.sin(n),o=Math.cos(n),h=Math.sin(r),u=Math.cos(r);n=Math.atan2(a*u,Yt(h,u*o));r=Math.atan2(h,u*o);e=q(r+this.long0);i=$t(this.cgb,n)}else{e=1/0;i=1/0}t.x=e;t.y=i;return t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"]};var ie={init:function(){var t=function(t,e){if(void 0===t){if((t=Math.floor(30*(q(e)+Math.PI)/Math.PI)+1)<0)return 0;if(t>60)return 60}return t}(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0;this.long0=(6*Math.abs(t)-183)*p;this.x0=5e5;this.y0=this.utmSouth?1e7:0;this.k0=.9996;ee.init.apply(this);this.forward=ee.forward;this.inverse=ee.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"},re=function(t,e){return Math.pow((1-t)/(1+t),e)};var ne={init:function(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e;this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t);this.C=Math.sqrt(1+this.es*e*e/(1-this.es));this.phic0=Math.asin(t/this.C);this.ratexp=.5*this.C*this.e;this.K=Math.tan(.5*this.phic0+m)/(Math.pow(Math.tan(.5*this.lat0+m),this.C)*re(this.e*t,this.ratexp))},forward:function(t){var e=t.x,i=t.y;t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+m),this.C)*re(this.e*Math.sin(i),this.ratexp))-h;t.x=this.C*e;return t},inverse:function(t){for(var e=t.x/this.C,i=t.y,r=Math.pow(Math.tan(.5*i+m)/this.K,1/this.C),n=20;n>0;--n){i=2*Math.atan(r*re(this.e*Math.sin(t.y),-.5*this.e))-h;if(Math.abs(i-t.y)<1e-14)break;t.y=i}if(!n)return null;t.x=e;t.y=i;return t},names:["gauss"]};var se={init:function(){ne.init.apply(this);if(this.rc){this.sinc0=Math.sin(this.phic0);this.cosc0=Math.cos(this.phic0);this.R2=2*this.rc;this.title||(this.title="Oblique Stereographic Alternative")}},forward:function(t){var e,i,r,n;t.x=q(t.x-this.long0);ne.forward.apply(this,[t]);e=Math.sin(t.y);i=Math.cos(t.y);r=Math.cos(t.x);n=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*i*r);t.x=n*i*Math.sin(t.x);t.y=n*(this.cosc0*e-this.sinc0*i*r);t.x=this.a*t.x+this.x0;t.y=this.a*t.y+this.y0;return t},inverse:function(t){var e,i,r,n,s;t.x=(t.x-this.x0)/this.a;t.y=(t.y-this.y0)/this.a;t.x/=this.k0;t.y/=this.k0;if(s=Math.sqrt(t.x*t.x+t.y*t.y)){var a=2*Math.atan2(s,this.R2);e=Math.sin(a);i=Math.cos(a);n=Math.asin(i*this.sinc0+t.y*e*this.cosc0/s);r=Math.atan2(t.x*e,s*this.cosc0*i-t.y*this.sinc0*e)}else{n=this.phic0;r=0}t.x=r;t.y=n;ne.inverse.apply(this,[t]);t.x=q(t.x+this.long0);return t},names:["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};var ae={init:function(){this.coslat0=Math.cos(this.lat0);this.sinlat0=Math.sin(this.lat0);if(this.sphere)1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=f&&(this.k0=.5*(1+U(this.lat0)*Math.sin(this.lat_ts)));else{Math.abs(this.coslat0)<=f&&(this.lat0>0?this.con=1:this.con=-1);this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e));1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=f&&(this.k0=.5*this.cons*z(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/G(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts)));this.ms1=z(this.e,this.sinlat0,this.coslat0);this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-h;this.cosX0=Math.cos(this.X0);this.sinX0=Math.sin(this.X0)}},forward:function(t){var e,i,r,n,s,a,o=t.x,u=t.y,l=Math.sin(u),c=Math.cos(u),p=q(o-this.long0);if(Math.abs(Math.abs(o-this.long0)-Math.PI)<=f&&Math.abs(u+this.lat0)<=f){t.x=NaN;t.y=NaN;return t}if(this.sphere){e=2*this.k0/(1+this.sinlat0*l+this.coslat0*c*Math.cos(p));t.x=this.a*e*c*Math.sin(p)+this.x0;t.y=this.a*e*(this.coslat0*l-this.sinlat0*c*Math.cos(p))+this.y0;return t}i=2*Math.atan(this.ssfn_(u,l,this.e))-h;n=Math.cos(i);r=Math.sin(i);if(Math.abs(this.coslat0)<=f){s=G(this.e,u*this.con,this.con*l);a=2*this.a*this.k0*s/this.cons;t.x=this.x0+a*Math.sin(o-this.long0);t.y=this.y0-this.con*a*Math.cos(o-this.long0);return t}if(Math.abs(this.sinlat0)0?q(this.long0+Math.atan2(t.x,-1*t.y)):q(this.long0+Math.atan2(t.x,t.y)):q(this.long0+Math.atan2(t.x*Math.sin(o),a*this.coslat0*Math.cos(o)-t.y*this.sinlat0*Math.sin(o)));t.x=e;t.y=i;return t}if(Math.abs(this.coslat0)<=f){if(a<=f){i=this.lat0;e=this.long0;t.x=e;t.y=i;return t}t.x*=this.con;t.y*=this.con;r=a*this.cons/(2*this.a*this.k0);i=this.con*W(this.e,r);e=this.con*q(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else{n=2*Math.atan(a*this.cosX0/(2*this.a*this.k0*this.ms1));e=this.long0;if(a<=f)s=this.X0;else{s=Math.asin(Math.cos(n)*this.sinX0+t.y*Math.sin(n)*this.cosX0/a);e=q(this.long0+Math.atan2(t.x*Math.sin(n),a*this.cosX0*Math.cos(n)-t.y*this.sinX0*Math.sin(n)))}i=-1*W(this.e,Math.tan(.5*(h+s)))}t.x=e;t.y=i;return t},names:["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],ssfn_:function(t,e,i){e*=i;return Math.tan(.5*(h+t))*Math.pow((1-e)/(1+e),.5*i)}};var oe={init:function(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,r=1/this.rf,n=2*r-Math.pow(r,2),s=this.e=Math.sqrt(n);this.R=this.k0*i*Math.sqrt(1-n)/(1-n*Math.pow(e,2));this.alpha=Math.sqrt(1+n/(1-n)*Math.pow(Math.cos(t),4));this.b0=Math.asin(e/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),o=Math.log(Math.tan(Math.PI/4+t/2)),h=Math.log((1+s*e)/(1-s*e));this.K=a-this.alpha*o+this.alpha*s/2*h},forward:function(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),r=-this.alpha*(e+i)+this.K,n=2*(Math.atan(Math.exp(r))-Math.PI/4),s=this.alpha*(t.x-this.lambda0),a=Math.atan(Math.sin(s)/(Math.sin(this.b0)*Math.tan(n)+Math.cos(this.b0)*Math.cos(s))),o=Math.asin(Math.cos(this.b0)*Math.sin(n)-Math.sin(this.b0)*Math.cos(n)*Math.cos(s));t.y=this.R/2*Math.log((1+Math.sin(o))/(1-Math.sin(o)))+this.y0;t.x=this.R*a+this.x0;return t},inverse:function(t){for(var e=t.x-this.x0,i=t.y-this.y0,r=e/this.R,n=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),s=Math.asin(Math.cos(this.b0)*Math.sin(n)+Math.sin(this.b0)*Math.cos(n)*Math.cos(r)),a=Math.atan(Math.sin(r)/(Math.cos(this.b0)*Math.cos(r)-Math.sin(this.b0)*Math.tan(n))),o=this.lambda0+a/this.alpha,h=0,u=s,l=-1e3,c=0;Math.abs(u-l)>1e-7;){if(++c>20)return;h=1/this.alpha*(Math.log(Math.tan(Math.PI/4+s/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(u))/2));l=u;u=2*Math.atan(Math.exp(h))-Math.PI/2}t.x=o;t.y=u;return t},names:["somerc"]},he=1e-7;var ue={init:function(){var t,e,i,r,n,s,a,o,u,l,c,d,g,_=0,v=0,b=0,w=0,M=0,x=0,E=0;this.no_off=(g="object"==typeof(d=this).PROJECTION?Object.keys(d.PROJECTION)[0]:d.PROJECTION,"no_uoff"in d||"no_off"in d||-1!==["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"].indexOf(g));this.no_rot="no_rot"in this;var k=!1;"alpha"in this&&(k=!0);var C=!1;"rectified_grid_angle"in this&&(C=!0);k&&(E=this.alpha);C&&(_=this.rectified_grid_angle*p);if(k||C)v=this.longc;else{b=this.long1;M=this.lat1;w=this.long2;x=this.lat2;if(Math.abs(M-x)<=he||(t=Math.abs(M))<=he||Math.abs(t-h)<=he||Math.abs(Math.abs(this.lat0)-h)<=he||Math.abs(Math.abs(x)-h)<=he)throw new Error}var S=1-this.es;e=Math.sqrt(S);if(Math.abs(this.lat0)>f){o=Math.sin(this.lat0);i=Math.cos(this.lat0);t=1-this.es*o*o;this.B=i*i;this.B=Math.sqrt(1+this.es*this.B*this.B/S);this.A=this.B*this.k0*e/t;if((n=(r=this.B*e/(i*Math.sqrt(t)))*r-1)<=0)n=0;else{n=Math.sqrt(n);this.lat0<0&&(n=-n)}this.E=n+=r;this.E*=Math.pow(G(this.e,this.lat0,o),this.B)}else{this.B=1/e;this.A=this.k0;this.E=r=n=1}if(k||C){if(k){c=Math.asin(Math.sin(E)/r);C||(_=E)}else{c=_;E=Math.asin(r*Math.sin(c))}this.lam0=v-Math.asin(.5*(n-1/n)*Math.tan(c))/this.B}else{s=Math.pow(G(this.e,M,Math.sin(M)),this.B);a=Math.pow(G(this.e,x,Math.sin(x)),this.B);n=this.E/s;u=(a-s)/(a+s);l=((l=this.E*this.E)-a*s)/(l+a*s);(t=b-w)<-Math.pi?w-=y:t>Math.pi&&(w+=y);this.lam0=q(.5*(b+w)-Math.atan(l*Math.tan(.5*this.B*(b-w))/u)/this.B);c=Math.atan(2*Math.sin(this.B*q(b-this.lam0))/(n-1/n));_=E=Math.asin(r*Math.sin(c))}this.singam=Math.sin(c);this.cosgam=Math.cos(c);this.sinrot=Math.sin(_);this.cosrot=Math.cos(_);this.rB=1/this.B;this.ArB=this.A*this.rB;this.BrA=1/this.ArB;if(this.no_off)this.u_0=0;else{this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(r*r-1)/Math.cos(E)));this.lat0<0&&(this.u_0=-this.u_0)}n=.5*c;this.v_pole_n=this.ArB*Math.log(Math.tan(m-n));this.v_pole_s=this.ArB*Math.log(Math.tan(m+n))},forward:function(t){var e,i,r,n,s,a,o,u,l={};t.x=t.x-this.lam0;if(Math.abs(Math.abs(t.y)-h)>f){e=.5*((s=this.E/Math.pow(G(this.e,t.y,Math.sin(t.y)),this.B))-(a=1/s));i=.5*(s+a);n=Math.sin(this.B*t.x);r=(e*this.singam-n*this.cosgam)/i;if(Math.abs(Math.abs(r)-1)0?this.v_pole_n:this.v_pole_s;o=this.ArB*t.y}if(this.no_rot){l.x=o;l.y=u}else{o-=this.u_0;l.x=u*this.cosrot+o*this.sinrot;l.y=o*this.cosrot-u*this.sinrot}l.x=this.a*l.x+this.x0;l.y=this.a*l.y+this.y0;return l},inverse:function(t){var e,i,r,n,s,a,o,u={};t.x=(t.x-this.x0)*(1/this.a);t.y=(t.y-this.y0)*(1/this.a);if(this.no_rot){i=t.y;e=t.x}else{i=t.x*this.cosrot-t.y*this.sinrot;e=t.y*this.cosrot+t.x*this.sinrot+this.u_0}n=.5*((r=Math.exp(-this.BrA*i))-1/r);s=.5*(r+1/r);o=((a=Math.sin(this.BrA*e))*this.cosgam+n*this.singam)/s;if(Math.abs(Math.abs(o)-1)f?this.ns=Math.log(r/o)/Math.log(n/h):this.ns=e;isNaN(this.ns)&&(this.ns=e);this.f0=r/(this.ns*Math.pow(n,this.ns));this.rh=this.a*this.f0*Math.pow(u,this.ns);this.title||(this.title="Lambert Conformal Conic")}},forward:function(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=f&&(i=U(i)*(h-2*f));var r,n,s=Math.abs(Math.abs(i)-h);if(s>f){r=G(this.e,i,Math.sin(i));n=this.a*this.f0*Math.pow(r,this.ns)}else{if((s=i*this.ns)<=0)return null;n=0}var a=this.ns*q(e-this.long0);t.x=this.k0*(n*Math.sin(a))+this.x0;t.y=this.k0*(this.rh-n*Math.cos(a))+this.y0;return t},inverse:function(t){var e,i,r,n,s,a=(t.x-this.x0)/this.k0,o=this.rh-(t.y-this.y0)/this.k0;if(this.ns>0){e=Math.sqrt(a*a+o*o);i=1}else{e=-Math.sqrt(a*a+o*o);i=-1}var u=0;0!==e&&(u=Math.atan2(i*a,i*o));if(0!==e||this.ns>0){i=1/this.ns;r=Math.pow(e/(this.a*this.f0),i);if(-9999===(n=W(this.e,r)))return null}else n=-h;s=q(u/this.ns+this.long0);t.x=s;t.y=n;return t},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc"]};var ce={init:function(){this.a=6377397.155;this.es=.006674372230614;this.e=Math.sqrt(this.es);this.lat0||(this.lat0=.863937979737193);this.long0||(this.long0=.4334234309119251);this.k0||(this.k0=.9999);this.s45=.785398163397448;this.s90=2*this.s45;this.fi0=this.lat0;this.e2=this.es;this.e=Math.sqrt(this.e2);this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2));this.uq=1.04216856380474;this.u0=Math.asin(Math.sin(this.fi0)/this.alfa);this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2);this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g;this.k1=this.k0;this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2));this.s0=1.37008346281555;this.n=Math.sin(this.s0);this.ro0=this.k1*this.n0/Math.tan(this.s0);this.ad=this.s90-this.uq},forward:function(t){var e,i,r,n,s,a,o,h=t.x,u=t.y,l=q(h-this.long0);e=Math.pow((1+this.e*Math.sin(u))/(1-this.e*Math.sin(u)),this.alfa*this.e/2);i=2*(Math.atan(this.k*Math.pow(Math.tan(u/2+this.s45),this.alfa)/e)-this.s45);r=-l*this.alfa;n=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(r));s=Math.asin(Math.cos(i)*Math.sin(r)/Math.cos(n));a=this.n*s;o=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(n/2+this.s45),this.n);t.y=o*Math.cos(a)/1;t.x=o*Math.sin(a)/1;if(!this.czech){t.y*=-1;t.x*=-1}return t},inverse:function(t){var e,i,r,n,s,a,o,h=t.x;t.x=t.y;t.y=h;if(!this.czech){t.y*=-1;t.x*=-1}s=Math.sqrt(t.x*t.x+t.y*t.y);n=Math.atan2(t.y,t.x)/Math.sin(this.s0);r=2*(Math.atan(Math.pow(this.ro0/s,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45);e=Math.asin(Math.cos(this.ad)*Math.sin(r)-Math.sin(this.ad)*Math.cos(r)*Math.cos(n));i=Math.asin(Math.cos(r)*Math.sin(n)/Math.cos(e));t.x=this.long0-i/this.alfa;a=e;o=0;var u=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45);Math.abs(a-t.y)<1e-10&&(o=1);a=t.y;u+=1}while(0===o&&u<15);return u>=15?null:t},names:["Krovak","krovak"]},fe=function(t,e,i,r,n){return t*n-e*Math.sin(2*n)+i*Math.sin(4*n)-r*Math.sin(6*n)},pe=function(t){return 1-.25*t*(1+t/16*(3+1.25*t))},de=function(t){return.375*t*(1+.25*t*(1+.46875*t))},me=function(t){return.05859375*t*t*(1+.75*t)},ye=function(t){return t*t*t*(35/3072)},ge=function(t,e,i){var r=e*i;return t/Math.sqrt(1-r*r)},_e=function(t){return Math.abs(t)1e-7?(1-t*t)*(e/(1-(i=t*e)*i)-.5/t*Math.log((1-i)/(1+i))):2*e};var Me=.3333333333333333,xe=.17222222222222222,Ee=.10257936507936508,ke=.06388888888888888,Ce=.0664021164021164,Se=.016415012942191543;var Ae={init:function(){var t=Math.abs(this.lat0);Math.abs(t-h)0){var e;this.qp=we(this.e,1);this.mmf=.5/(1-this.es);this.apa=function(t){var e,i=[];i[0]=t*Me;e=t*t;i[0]+=e*xe;i[1]=e*ke;e*=t;i[0]+=e*Ee;i[1]+=e*Ce;i[2]=e*Se;return i}(this.es);switch(this.mode){case this.N_POLE:case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp);this.dd=1/this.rq;this.xmf=1;this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp);e=Math.sin(this.lat0);this.sinb1=we(this.e,e)/this.qp;this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1);this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1);this.ymf=(this.xmf=this.rq)/this.dd;this.xmf*=this.dd}}else if(this.mode===this.OBLIQ){this.sinph0=Math.sin(this.lat0);this.cosph0=Math.cos(this.lat0)}},forward:function(t){var e,i,r,n,s,a,o,u,l,c,p=t.x,d=t.y;p=q(p-this.long0);if(this.sphere){s=Math.sin(d);c=Math.cos(d);r=Math.cos(p);if(this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+c*r:1+this.sinph0*s+this.cosph0*c*r)<=f)return null;e=(i=Math.sqrt(2/i))*c*Math.sin(p);i*=this.mode===this.EQUIT?s:this.cosph0*s-this.sinph0*c*r}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){this.mode===this.N_POLE&&(r=-r);if(Math.abs(d+this.lat0)=0){e=(l=Math.sqrt(a))*n;i=r*(this.mode===this.S_POLE?l:-l)}else e=i=0}}t.x=this.a*e+this.x0;t.y=this.a*i+this.y0;return t},inverse:function(t){t.x-=this.x0;t.y-=this.y0;var e,i,r,n,s,a,o,u,l,c,p=t.x/this.a,d=t.y/this.a;if(this.sphere){var m,y=0,g=0;if((i=.5*(m=Math.sqrt(p*p+d*d)))>1)return null;i=2*Math.asin(i);if(this.mode===this.OBLIQ||this.mode===this.EQUIT){g=Math.sin(i);y=Math.cos(i)}switch(this.mode){case this.EQUIT:i=Math.abs(m)<=f?0:Math.asin(d*g/m);p*=g;d=y*m;break;case this.OBLIQ:i=Math.abs(m)<=f?this.lat0:Math.asin(y*this.sinph0+d*g*this.cosph0/m);p*=g*this.cosph0;d=(y-Math.sin(i)*this.sinph0)*m;break;case this.N_POLE:d=-d;i=h-i;break;case this.S_POLE:i-=h}e=0!==d||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(p,d):0}else{o=0;if(this.mode===this.OBLIQ||this.mode===this.EQUIT){p/=this.dd;d*=this.dd;if((a=Math.sqrt(p*p+d*d))1&&(t=t>1?1:-1);return Math.asin(t)};var je={init:function(){if(!(Math.abs(this.lat1+this.lat2)f?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con;this.c=this.ms1*this.ms1+this.ns0*this.qs1;this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0}},forward:function(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i);this.cos_phi=Math.cos(i);var r=we(this.e3,this.sin_phi,this.cos_phi),n=this.a*Math.sqrt(this.c-this.ns0*r)/this.ns0,s=this.ns0*q(e-this.long0),a=n*Math.sin(s)+this.x0,o=this.rh-n*Math.cos(s)+this.y0;t.x=a;t.y=o;return t},inverse:function(t){var e,i,r,n,s,a;t.x-=this.x0;t.y=this.rh-t.y+this.y0;if(this.ns0>=0){e=Math.sqrt(t.x*t.x+t.y*t.y);r=1}else{e=-Math.sqrt(t.x*t.x+t.y*t.y);r=-1}n=0;0!==e&&(n=Math.atan2(r*t.x,r*t.y));r=e*this.ns0/this.a;if(this.sphere)a=Math.asin((this.c-r*r)/(2*this.ns0));else{i=(this.c-r*r)/this.ns0;a=this.phi1z(this.e3,i)}s=q(n/this.ns0+this.long0);t.x=s;t.y=a;return t},names:["Albers_Conic_Equal_Area","Albers","aea"],phi1z:function(t,e){var i,r,n,s,a=Pe(.5*e);if(t0||Math.abs(s)<=f){a=this.x0+1*this.a*i*Math.sin(r)/s;o=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*n)/s}else{a=this.x0+this.infinity_dist*i*Math.sin(r);o=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*n)}t.x=a;t.y=o;return t},inverse:function(t){var e,i,r,n,s,a;t.x=(t.x-this.x0)/this.a;t.y=(t.y-this.y0)/this.a;t.x/=this.k0;t.y/=this.k0;if(e=Math.sqrt(t.x*t.x+t.y*t.y)){n=Math.atan2(e,this.rc);i=Math.sin(n);r=Math.cos(n);a=Pe(r*this.sin_p14+t.y*i*this.cos_p14/e);s=Math.atan2(t.x*i,e*this.cos_p14*r-t.y*this.sin_p14*i);s=q(this.long0+s)}else{a=this.phic0;s=0}t.x=s;t.y=a;return t},names:["gnom"]};var Re={init:function(){this.sphere||(this.k0=z(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var e,i,r=t.x,n=t.y,s=q(r-this.long0);if(this.sphere){e=this.x0+this.a*s*Math.cos(this.lat_ts);i=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts)}else{var a=we(this.e,Math.sin(n));e=this.x0+this.a*this.k0*s;i=this.y0+this.a*a*.5/this.k0}t.x=e;t.y=i;return t},inverse:function(t){t.x-=this.x0;t.y-=this.y0;var e,i;if(this.sphere){e=q(this.long0+t.x/this.a/Math.cos(this.lat_ts));i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))}else{i=function(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*h:h;for(var r,n,s,a,o=Math.asin(.5*e),u=0;u<30;u++){n=Math.sin(o);s=Math.cos(o);a=t*n;o+=r=Math.pow(1-a*a,2)/(2*s)*(e/(1-t*t)-n/(1-a*a)+.5/t*Math.log((1-a)/(1+a)));if(Math.abs(r)<=1e-10)return o}return NaN}(this.e,2*t.y*this.k0/this.a);e=q(this.long0+t.x/(this.a*this.k0))}t.x=e;t.y=i;return t},names:["cea"]};var Te={init:function(){this.x0=this.x0||0;this.y0=this.y0||0;this.lat0=this.lat0||0;this.long0=this.long0||0;this.lat_ts=this.lat_ts||0;this.title=this.title||"Equidistant Cylindrical (Plate Carre)";this.rc=Math.cos(this.lat_ts)},forward:function(t){var e=t.x,i=t.y,r=q(e-this.long0),n=_e(i-this.lat0);t.x=this.x0+this.a*r*this.rc;t.y=this.y0+this.a*n;return t},inverse:function(t){var e=t.x,i=t.y;t.x=q(this.long0+(e-this.x0)/(this.a*this.rc));t.y=_e(this.lat0+(i-this.y0)/this.a);return t},names:["Equirectangular","Equidistant_Cylindrical","eqc"]};var Ie={init:function(){this.temp=this.b/this.a;this.es=1-Math.pow(this.temp,2);this.e=Math.sqrt(this.es);this.e0=pe(this.es);this.e1=de(this.es);this.e2=me(this.es);this.e3=ye(this.es);this.ml0=this.a*fe(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var e,i,r,n=t.x,s=t.y,a=q(n-this.long0);r=a*Math.sin(s);if(this.sphere)if(Math.abs(s)<=f){e=this.a*a;i=-1*this.a*this.lat0}else{e=this.a*Math.sin(r)/Math.tan(s);i=this.a*(_e(s-this.lat0)+(1-Math.cos(r))/Math.tan(s))}else if(Math.abs(s)<=f){e=this.a*a;i=-1*this.ml0}else{var o=ge(this.a,this.e,Math.sin(s))/Math.tan(s);e=o*Math.sin(r);i=this.a*fe(this.e0,this.e1,this.e2,this.e3,s)-this.ml0+o*(1-Math.cos(r))}t.x=e+this.x0;t.y=i+this.y0;return t},inverse:function(t){var e,i,r,n,s,a,o,h,u;r=t.x-this.x0;n=t.y-this.y0;if(this.sphere)if(Math.abs(n+this.a*this.lat0)<=f){e=q(r/this.a+this.long0);i=0}else{a=this.lat0+n/this.a;o=r*r/this.a/this.a+a*a;h=a;var l;for(s=20;s;--s){h+=u=-1*(a*(h*(l=Math.tan(h))+1)-h-.5*(h*h+o)*l)/((h-a)/l-1);if(Math.abs(u)<=f){i=h;break}}e=q(this.long0+Math.asin(r*Math.tan(h)/this.a)/Math.sin(i))}else if(Math.abs(n+this.ml0)<=f){i=0;e=q(this.long0+r/this.a)}else{a=(this.ml0+n)/this.a;o=r*r/this.a/this.a+a*a;h=a;var c,p,d,m,y;for(s=20;s;--s){y=this.e*Math.sin(h);c=Math.sqrt(1-y*y)*Math.tan(h);p=this.a*fe(this.e0,this.e1,this.e2,this.e3,h);d=this.e0-2*this.e1*Math.cos(2*h)+4*this.e2*Math.cos(4*h)-6*this.e3*Math.cos(6*h);h-=u=(a*(c*(m=p/this.a)+1)-m-.5*c*(m*m+o))/(this.es*Math.sin(2*h)*(m*m+o-2*a*m)/(4*c)+(a-m)*(c*d-2/Math.sin(2*h))-d);if(Math.abs(u)<=f){i=h;break}}c=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i);e=q(this.long0+Math.asin(r*c/this.a)/Math.sin(i))}t.x=e;t.y=i;return t},names:["Polyconic","poly"]};var Ne={init:function(){this.A=[];this.A[1]=.6399175073;this.A[2]=-.1358797613;this.A[3]=.063294409;this.A[4]=-.02526853;this.A[5]=.0117879;this.A[6]=-.0055161;this.A[7]=.0026906;this.A[8]=-.001333;this.A[9]=67e-5;this.A[10]=-34e-5;this.B_re=[];this.B_im=[];this.B_re[1]=.7557853228;this.B_im[1]=0;this.B_re[2]=.249204646;this.B_im[2]=.003371507;this.B_re[3]=-.001541739;this.B_im[3]=.04105856;this.B_re[4]=-.10162907;this.B_im[4]=.01727609;this.B_re[5]=-.26623489;this.B_im[5]=-.36249218;this.B_re[6]=-.6870983;this.B_im[6]=-1.1651967;this.C_re=[];this.C_im=[];this.C_re[1]=1.3231270439;this.C_im[1]=0;this.C_re[2]=-.577245789;this.C_im[2]=-.007809598;this.C_re[3]=.508307513;this.C_im[3]=-.112208952;this.C_re[4]=-.15094762;this.C_im[4]=.18200602;this.C_re[5]=1.01418179;this.C_im[5]=1.64497696;this.C_re[6]=1.9660549;this.C_im[6]=2.5127645;this.D=[];this.D[1]=1.5627014243;this.D[2]=.5185406398;this.D[3]=-.03333098;this.D[4]=-.1052906;this.D[5]=-.0368594;this.D[6]=.007317;this.D[7]=.0122;this.D[8]=.00394;this.D[9]=-.0013},forward:function(t){var e,i=t.x,r=t.y-this.lat0,n=i-this.long0,s=r/o*1e-5,a=n,h=1,u=0;for(e=1;e<=10;e++){h*=s;u+=this.A[e]*h}var l,c=u,f=a,p=1,d=0,m=0,y=0;for(e=1;e<=6;e++){l=d*c+p*f;p=p*c-d*f;d=l;m=m+this.B_re[e]*p-this.B_im[e]*d;y=y+this.B_im[e]*p+this.B_re[e]*d}t.x=y*this.a+this.x0;t.y=m*this.a+this.y0;return t},inverse:function(t){var e,i,r=t.x,n=t.y,s=r-this.x0,a=(n-this.y0)/this.a,h=s/this.a,u=1,l=0,c=0,f=0;for(e=1;e<=6;e++){i=l*a+u*h;u=u*a-l*h;l=i;c=c+this.C_re[e]*u-this.C_im[e]*l;f=f+this.C_im[e]*u+this.C_re[e]*l}for(var p=0;p.999999999999&&(i=.999999999999);e=Math.asin(i);var r=q(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));r<-Math.PI&&(r=-Math.PI);r>Math.PI&&(r=Math.PI);i=(2*e+Math.sin(2*e))/Math.PI;Math.abs(i)>1&&(i=1);var n=Math.asin(i);t.x=r;t.y=n;return t},names:["Mollweide","moll"]};var De={init:function(){if(!(Math.abs(this.lat1+this.lat2)=0){i=Math.sqrt(t.x*t.x+t.y*t.y);e=1}else{i=-Math.sqrt(t.x*t.x+t.y*t.y);e=-1}var s=0;0!==i&&(s=Math.atan2(e*t.x,e*t.y));if(this.sphere){n=q(this.long0+s/this.ns);r=_e(this.g-i/this.a);t.x=n;t.y=r;return t}var a=this.g-i/this.a;r=ve(a,this.e0,this.e1,this.e2,this.e3);n=q(this.long0+s/this.ns);t.x=n;t.y=r;return t},names:["Equidistant_Conic","eqdc"]};var ze={init:function(){this.R=this.a},forward:function(t){var e,i,r=t.x,n=t.y,s=q(r-this.long0);if(Math.abs(n)<=f){e=this.x0+this.R*s;i=this.y0}var a=Pe(2*Math.abs(n/Math.PI));if(Math.abs(s)<=f||Math.abs(Math.abs(n)-h)<=f){e=this.x0;i=n>=0?this.y0+Math.PI*this.R*Math.tan(.5*a):this.y0+Math.PI*this.R*-Math.tan(.5*a)}var o=.5*Math.abs(Math.PI/s-s/Math.PI),u=o*o,l=Math.sin(a),c=Math.cos(a),p=c/(l+c-1),d=p*p,m=p*(2/l-1),y=m*m,g=Math.PI*this.R*(o*(p-y)+Math.sqrt(u*(p-y)*(p-y)-(y+u)*(d-y)))/(y+u);s<0&&(g=-g);e=this.x0+g;var _=u+p;g=Math.PI*this.R*(m*_-o*Math.sqrt((y+u)*(u+1)-_*_))/(y+u);i=n>=0?this.y0+g:this.y0-g;t.x=e;t.y=i;return t},inverse:function(t){var e,i,r,n,s,a,o,h,u,l,c,p;t.x-=this.x0;t.y-=this.y0;c=Math.PI*this.R;s=(r=t.x/c)*r+(n=t.y/c)*n;c=3*(n*n/(h=-2*(a=-Math.abs(n)*(1+s))+1+2*n*n+s*s)+(2*(o=a-2*n*n+r*r)*o*o/h/h/h-9*a*o/h/h)/27)/(u=(a-o*o/3/h)/h)/(l=2*Math.sqrt(-u/3));Math.abs(c)>1&&(c=c>=0?1:-1);p=Math.acos(c)/3;i=t.y>=0?(-l*Math.cos(p+Math.PI/3)-o/3/h)*Math.PI:-(-l*Math.cos(p+Math.PI/3)-o/3/h)*Math.PI;e=Math.abs(r)2*h*this.a)return;i=e/this.a;r=Math.sin(i);n=Math.cos(i);s=this.long0;if(Math.abs(e)<=f)a=this.lat0;else{a=Pe(n*this.sin_p12+t.y*r*this.cos_p12/e);o=Math.abs(this.lat0)-h;s=Math.abs(o)<=f?this.lat0>=0?q(this.long0+Math.atan2(t.x,-t.y)):q(this.long0-Math.atan2(-t.x,t.y)):q(this.long0+Math.atan2(t.x*r,e*this.cos_p12*n-t.y*this.sin_p12*r))}t.x=s;t.y=a;return t}u=pe(this.es);l=de(this.es);c=me(this.es);p=ye(this.es);if(Math.abs(this.sin_p12-1)<=f){d=this.a*fe(u,l,c,p,h);e=Math.sqrt(t.x*t.x+t.y*t.y);a=ve((d-e)/this.a,u,l,c,p);s=q(this.long0+Math.atan2(t.x,-1*t.y));t.x=s;t.y=a;return t}if(Math.abs(this.sin_p12+1)<=f){d=this.a*fe(u,l,c,p,h);e=Math.sqrt(t.x*t.x+t.y*t.y);a=ve((e-d)/this.a,u,l,c,p);s=q(this.long0+Math.atan2(t.x,t.y));t.x=s;t.y=a;return t}e=Math.sqrt(t.x*t.x+t.y*t.y);g=Math.atan2(t.x,t.y);m=ge(this.a,this.e,this.sin_p12);_=Math.cos(g);b=-(v=this.e*this.cos_p12*_)*v/(1-this.es);w=3*this.es*(1-b)*this.sin_p12*this.cos_p12*_/(1-this.es);E=1-b*(x=(M=e/m)-b*(1+b)*Math.pow(M,3)/6-w*(1+3*b)*Math.pow(M,4)/24)*x/2-M*x*x*x/6;y=Math.asin(this.sin_p12*Math.cos(x)+this.cos_p12*Math.sin(x)*_);s=q(this.long0+Math.asin(Math.sin(g)*Math.sin(x)/Math.cos(y)));k=Math.sin(y);a=Math.atan2((k-this.es*E*this.sin_p12)*Math.tan(y),k*(1-this.es));t.x=s;t.y=a;return t},names:["Azimuthal_Equidistant","aeqd"]};var qe={init:function(){this.sin_p14=Math.sin(this.lat0);this.cos_p14=Math.cos(this.lat0)},forward:function(t){var e,i,r,n,s,a,o,h=t.x,u=t.y;r=q(h-this.long0);e=Math.sin(u);i=Math.cos(u);n=Math.cos(r);1;if((s=this.sin_p14*e+this.cos_p14*i*n)>0||Math.abs(s)<=f){a=1*this.a*i*Math.sin(r);o=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*n)}t.x=a;t.y=o;return t},inverse:function(t){var e,i,r,n,s,a,o;t.x-=this.x0;t.y-=this.y0;e=Math.sqrt(t.x*t.x+t.y*t.y);i=Pe(e/this.a);r=Math.sin(i);n=Math.cos(i);a=this.long0;if(Math.abs(e)<=f){o=this.lat0;t.x=a;t.y=o;return t}o=Pe(n*this.sin_p14+t.y*r*this.cos_p14/e);s=Math.abs(this.lat0)-h;if(Math.abs(s)<=f){a=this.lat0>=0?q(this.long0+Math.atan2(t.x,-t.y)):q(this.long0-Math.atan2(-t.x,t.y));t.x=a;t.y=o;return t}a=q(this.long0+Math.atan2(t.x*r,e*this.cos_p14*n-t.y*this.sin_p14*r));t.x=a;t.y=o;return t},names:["ortho"]},Ge=1,We=2,He=3,Qe=4,Xe=5,Ve=6,Ze={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Je(t,e,i,r){var n;if(tm&&n<=h+m){r.value=Ze.AREA_1;n-=h}else if(n>h+m||n<=-(h+m)){r.value=Ze.AREA_2;n=n>=0?n-g:n+g}else{r.value=Ze.AREA_3;n+=h}}return n}function Ye(t,e){var i=t+e;i<-g?i+=y:i>+g&&(i-=y);return i}var Ke={init:function(){this.x0=this.x0||0;this.y0=this.y0||0;this.lat0=this.lat0||0;this.long0=this.long0||0;this.lat_ts=this.lat_ts||0;this.title=this.title||"Quadrilateralized Spherical Cube";this.lat0>=h-m/2?this.face=Xe:this.lat0<=-(h-m/2)?this.face=Ve:Math.abs(this.long0)<=m?this.face=Ge:Math.abs(this.long0)<=h+m?this.face=this.long0>0?We:Qe:this.face=He;if(0!==this.es){this.one_minus_f=1-(this.a-this.b)/this.a;this.one_minus_f_squared=this.one_minus_f*this.one_minus_f}},forward:function(t){var e,i,r,n,s,a,o={x:0,y:0},u={value:0};t.x-=this.long0;e=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y;i=t.x;if(this.face===Xe){n=h-e;if(i>=m&&i<=h+m){u.value=Ze.AREA_0;r=i-h}else if(i>h+m||i<=-(h+m)){u.value=Ze.AREA_1;r=i>0?i-g:i+g}else if(i>-(h+m)&&i<=-m){u.value=Ze.AREA_2;r=i+h}else{u.value=Ze.AREA_3;r=i}}else if(this.face===Ve){n=h+e;if(i>=m&&i<=h+m){u.value=Ze.AREA_0;r=-i+h}else if(i=-m){u.value=Ze.AREA_1;r=-i}else if(i<-m&&i>=-(h+m)){u.value=Ze.AREA_2;r=-i-h}else{u.value=Ze.AREA_3;r=i>0?-i+g:-i-g}}else{var l,c,f,p,d,y;this.face===We?i=Ye(i,+h):this.face===He?i=Ye(i,+g):this.face===Qe&&(i=Ye(i,-h));p=Math.sin(e);d=Math.cos(e);y=Math.sin(i);l=d*Math.cos(i);c=d*y;f=p;if(this.face===Ge)r=Je(n=Math.acos(l),f,c,u);else if(this.face===We)r=Je(n=Math.acos(c),f,-l,u);else if(this.face===He)r=Je(n=Math.acos(-l),f,-c,u);else if(this.face===Qe)r=Je(n=Math.acos(-c),f,l,u);else{n=r=0;u.value=Ze.AREA_0}}a=Math.atan(12/g*(r+Math.acos(Math.sin(r)*Math.cos(m))-h));s=Math.sqrt((1-Math.cos(n))/(Math.cos(a)*Math.cos(a))/(1-Math.cos(Math.atan(1/Math.cos(r)))));u.value===Ze.AREA_1?a+=h:u.value===Ze.AREA_2?a+=g:u.value===Ze.AREA_3&&(a+=1.5*g);o.x=s*Math.cos(a);o.y=s*Math.sin(a);o.x=o.x*this.a+this.x0;o.y=o.y*this.a+this.y0;t.x=o.x;t.y=o.y;return t},inverse:function(t){var e,i,r,n,s,a,o,u,l,c={lam:0,phi:0},f={value:0};t.x=(t.x-this.x0)/this.a;t.y=(t.y-this.y0)/this.a;i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y));e=Math.atan2(t.y,t.x);if(t.x>=0&&t.x>=Math.abs(t.y))f.value=Ze.AREA_0;else if(t.y>=0&&t.y>=Math.abs(t.x)){f.value=Ze.AREA_1;e-=h}else if(t.x<0&&-t.x>=Math.abs(t.y)){f.value=Ze.AREA_2;e=e<0?e+g:e-g}else{f.value=Ze.AREA_3;e+=h}l=g/12*Math.tan(e);s=Math.sin(l)/(Math.cos(l)-1/Math.sqrt(2));a=Math.atan(s);(o=1-(r=Math.cos(e))*r*(n=Math.tan(i))*n*(1-Math.cos(Math.atan(1/Math.cos(a)))))<-1?o=-1:o>1&&(o=1);if(this.face===Xe){u=Math.acos(o);c.phi=h-u;f.value===Ze.AREA_0?c.lam=a+h:f.value===Ze.AREA_1?c.lam=a<0?a+g:a-g:f.value===Ze.AREA_2?c.lam=a-h:c.lam=a}else if(this.face===Ve){u=Math.acos(o);c.phi=u-h;f.value===Ze.AREA_0?c.lam=-a+h:f.value===Ze.AREA_1?c.lam=-a:f.value===Ze.AREA_2?c.lam=-a-h:c.lam=a<0?-a-g:-a+g}else{var p,d,m;l=(p=o)*p;d=(l+=(m=l>=1?0:Math.sqrt(1-l)*Math.sin(a))*m)>=1?0:Math.sqrt(1-l);if(f.value===Ze.AREA_1){l=d;d=-m;m=l}else if(f.value===Ze.AREA_2){d=-d;m=-m}else if(f.value===Ze.AREA_3){l=d;d=m;m=-l}if(this.face===We){l=p;p=-d;d=l}else if(this.face===He){p=-p;d=-d}else if(this.face===Qe){l=p;p=d;d=-l}c.phi=Math.acos(-m)-h;c.lam=Math.atan2(d,p);this.face===We?c.lam=Ye(c.lam,-h):this.face===He?c.lam=Ye(c.lam,-g):this.face===Qe&&(c.lam=Ye(c.lam,+h))}if(0!==this.es){var y,_,v;y=c.phi<0?1:0;_=Math.tan(c.phi);v=this.b/Math.sqrt(_*_+this.one_minus_f_squared);c.phi=Math.atan(Math.sqrt(this.a*this.a-v*v)/(this.one_minus_f*v));y&&(c.phi=-c.phi)}c.lam+=this.long0;t.x=c.lam;t.y=c.phi;return t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]},$e=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],ti=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],ei=.8487,ii=1.3523,ri=d/5,ni=1/ri,si=18,ai=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))};var oi={init:function(){this.x0=this.x0||0;this.y0=this.y0||0;this.long0=this.long0||0;this.es=0;this.title=this.title||"Robinson"},forward:function(t){var e=q(t.x-this.long0),i=Math.abs(t.y),r=Math.floor(i*ri);r<0?r=0:r>=si&&(r=17);var n={x:ai($e[r],i=d*(i-ni*r))*e,y:ai(ti[r],i)};t.y<0&&(n.y=-n.y);n.x=n.x*this.a*ei+this.x0;n.y=n.y*this.a*ii+this.y0;return n},inverse:function(t){var e={x:(t.x-this.x0)/(this.a*ei),y:Math.abs(t.y-this.y0)/(this.a*ii)};if(e.y>=1){e.x/=$e[18][0];e.y=t.y<0?-h:h}else{var i=Math.floor(e.y*si);i<0?i=0:i>=si&&(i=17);for(;;)if(ti[i][0]>e.y)--i;else{if(!(ti[i+1][0]<=e.y))break;++i}var r=ti[i],n=5*(e.y-r[0])/(ti[i+1][0]-r[0]);n=function(t,e,i,r){for(var n=e;r;--r){var s=t(n);n-=s;if(Math.abs(s)1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var s=function(t,e,i){for(var r=176,n=[],s=0;s=0){n>0&&(t.lastNeed=n-1);return n}if(--r=0){n>0&&(t.lastNeed=n-2);return n}if(--r=0){n>0&&(2===n?n=0:t.lastNeed=n-3);return n}return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=i;var r=t.length-(i-this.lastNeed);t.copy(this.lastChar,0,r);return t.toString("utf8",e,r)};s.prototype.fillLast=function(t){if(this.lastNeed<=t.length){t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length);this.lastNeed-=t.length};function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function o(t){var e=this.lastTotal-this.lastNeed,i=function(t,e,i){if(128!=(192&e[0])){t.lastNeed=0;return"�"}if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1])){t.lastNeed=1;return"�"}if(t.lastNeed>2&&e.length>2&&128!=(192&e[2])){t.lastNeed=2;return"�"}}}(this,t);if(void 0!==i)return i;if(this.lastNeed<=t.length){t.copy(this.lastChar,e,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}t.copy(this.lastChar,e,0,t.length);this.lastNeed-=t.length}function h(t,e){if((t.length-e)%2==0){var i=t.toString("utf16le",e);if(i){var r=i.charCodeAt(i.length-1);if(r>=55296&&r<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=t[t.length-2];this.lastChar[1]=t[t.length-1];return i.slice(0,-1)}}return i}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=t[t.length-1];return t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,i)}return e}function l(t,e){var i=(t.length-e)%3;if(0===i)return t.toString("base64",e);this.lastNeed=3-i;this.lastTotal=3;if(1===i)this.lastChar[0]=t[t.length-1];else{this.lastChar[0]=t[t.length-2];this.lastChar[1]=t[t.length-1]}return t.toString("base64",e,t.length-i)}function c(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function f(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}},{"safe-buffer":20}],22:[function(t,e,i){(function(e,r){(function(){var n=t("process/browser.js").nextTick,s=Function.prototype.apply,a=Array.prototype.slice,o={},h=0;i.setTimeout=function(){return new u(s.call(setTimeout,window,arguments),clearTimeout)};i.setInterval=function(){return new u(s.call(setInterval,window,arguments),clearInterval)};i.clearTimeout=i.clearInterval=function(t){t.close()};function u(t,e){this._id=t;this._clearFn=e}u.prototype.unref=u.prototype.ref=function(){};u.prototype.close=function(){this._clearFn.call(window,this._id)};i.enroll=function(t,e){clearTimeout(t._idleTimeoutId);t._idleTimeout=e};i.unenroll=function(t){clearTimeout(t._idleTimeoutId);t._idleTimeout=-1};i._unrefActive=i.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))};i.setImmediate="function"==typeof e?e:function(t){var e=h++,r=!(arguments.length<2)&&a.call(arguments,1);o[e]=!0;n((function(){if(o[e]){r?t.apply(null,r):t.call(null);i.clearImmediate(e)}}));return e};i.clearImmediate="function"==typeof r?r:function(t){delete o[t]}}).call(this)}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":18,timers:22}],23:[function(t,e,i){(function(i){(function(){"use strict";let r=t("proj4");r.default&&(r=r.default);const n=t("./unzip"),s=t("./binaryajax"),a=t("./parseShp"),o=t("parsedbf"),h=t("lie"),u=t("lru-cache"),l=t("buffer").Buffer,c=i.URL,f=new u({max:20});function p(t){if(!t)throw new Error("forgot to pass buffer");return l.isBuffer(t)?t:t instanceof i.ArrayBuffer?l.from(t):t.buffer instanceof i.ArrayBuffer?1===t.BYTES_PER_ELEMENT?l.from(t):l.from(t.buffer):void 0}function d(t,e){return"string"==typeof t&&f.has(t)?h.resolve(f.get(t)):d.getShapefile(t,e).then((function(e){"string"==typeof t&&f.set(t,e);return e}))}d.combine=function(t){const e={type:"FeatureCollection",features:[]};let i=0;const r=t[0].length;for(;i-1?h.push(i.slice(0,-3)+i.slice(-3).toLowerCase()):"dbf"!==i.slice(-3).toLowerCase()&&"cpg"!==i.slice(-3).toLowerCase()||(s[i.slice(0,-3)+i.slice(-3).toLowerCase()]=s[i]);if(!h.length)throw new Error("no layers founds");const u=h.map((function(t){let i,r;const n=t.lastIndexOf(".");if(n>-1&&t.slice(n).indexOf("json")>-1){i=JSON.parse(s[t]);i.fileName=t.slice(0,n)}else if(e.indexOf(t.slice(n+1))>-1){i=s[t];i.fileName=t}else{s[t+".dbf"]&&(r=o(s[t+".dbf"],s[t+".cpg"]));i=d.combine([a(s[t+".shp"],s[t+".prj"]),r]);i.fileName=t}return i}));return 1===u.length?u[0]:u};const m=async t=>{const e=await h.all([s(t,"shp"),s(t,"prj")]);let i=!1;try{e[1]&&(i=r(e[1]))}catch(t){i=!1}return a(e[0],i)},y=async t=>{const[e,i]=await h.all([s(t,"dbf"),s(t,"cpg")]);return o(e,i)};d.getShapefile=async function(t,e){if("string"!=typeof t)return d.parseZip(t);if(((t,e)=>new c(t).pathname.slice(-4).toLowerCase()===e)(t,".zip"))return async function(t,e){const i=await s(t);return d.parseZip(i,e)}(t,e);const i=await h.all([m(t),y(t)]);return d.combine(i)};d.parseShp=function(t,e){t=p(t);l.isBuffer(e)&&(e=e.toString());if("string"==typeof e)try{e=r(e)}catch(t){e=!1}return a(t,e)};d.parseDbf=function(t,e){t=p(t);return o(t,e)};e.exports=d}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./binaryajax":6,"./parseShp":8,"./unzip":9,buffer:12,lie:16,"lru-cache":17,parsedbf:2,proj4:19}]},{},[23])(23)}));class MWM_Settings_Importer{constructor(){this.geojsondocumentToImport=!1;this.gljsdocumentToImport=!1;this.importInstallationFile=!1;this.featuresImported=0;this.upgradeMessage="";this.initializedInputs=[];this.jsonImport={categories:[],point:[],line:[],polygon:[]};this.postsImported=0;this.fetchedFields={};this.currentFile=!1;this.currentCSVImport=[];this.currentImportCategory=!1}setUpgradeMessage(t){this.upgradeMessage=window.mapster_settings.strings["Upgrade Message 1"]}async doGeoJSONImport(){if(this.geojsondocumentToImport)try{const t=await this.doGeoJSONImportPost(this.geojsondocumentToImport,this.jsonImport,this.currentImportCategory,this.featuresImported);this.displayAfterImport(t.count)}catch(t){jQuery(".mapster-import-error").html(window.mapster_settings.strings.Error+this.upgradeMessage)}else window.alert(window.mapster_settings.strings["Please Upload"])}async geoJSONUploaded(t){let e=this;jQuery("#geojson-import-data-summary h4 span").html(t.target.files[0].type);if(t.target.files[0].name.indexOf(".json")>-1||t.target.files[0].name.indexOf(".geojson")>-1){const i=await new Response(t.target.files[0]).json();e.importGeoJSON(i)}else if(t.target.files[0].name.indexOf(".kml")>-1){const t=new FileReader;t.readAsText(event.target.files[0]);t.onload=async()=>{const i=toGeoJSON.kml((new DOMParser).parseFromString(t.result,"text/xml"));e.importGeoJSON(i)}}else if(t.target.files[0].name.indexOf(".gpx")>-1){const t=new FileReader;t.readAsText(event.target.files[0]);t.onload=async()=>{const i=toGeoJSON.gpx((new DOMParser).parseFromString(t.result,"text/xml"));e.importGeoJSON(i)}}else{const t=new FileReader;t.readAsArrayBuffer(event.target.files[0]);t.onload=async()=>{const i=await shp(t.result);e.importGeoJSON(i)}}}importGeoJSON(t){if(t){this.showDataAboutImport(t);this.geojsondocumentToImport=t}else window.alert(window.mapster_settings.strings["Please Upload"])}isGoodProjection(t){let e=!0;t.filter((t=>this.centerProjection(turf.center(t).geometry.coordinates))).length>0&&(e=!1);return e}centerProjection(t){return t[0]<-180||t[0]>180||t[1]<-90||t[1]>90}tryReprojection(t){let e=JSON.parse(JSON.stringify(t));e.features.forEach((t=>{t.geometry.coordinates=this.recursiveReproject(t.geometry.coordinates)}));var i="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(e)),r=document.createElement("a");r.setAttribute("href",i);r.setAttribute("download","mapster-reprojection.json");r.click()}recursiveReproject(t){if(isNaN(t[0])){t.forEach(((e,i)=>{t[i]=recursiveReproject(e)}));return t}{const e=""!==jQuery("#mapster-from-projection").val()?jQuery("#mapster-from-projection").val():"EPSG:3857";return proj4(e,"EPSG:4326",t)}}showDataAboutImport(t){if(t.type){jQuery(".mapster-import-options").fadeIn();jQuery("#geojson-import-button").fadeIn();jQuery("#geojson-import-data-summary").fadeIn();this.currentFile=t;this.advancedOptions();const e=[...new Set(t.features.map((t=>t.geometry.type)))];jQuery("#geojson-import-data-summary table tbody").html("");if(!this.isGoodProjection(t.features)){jQuery("#mapster-projection-warning").fadeIn();jQuery(document).on("click","#mapster-try-reproject",(()=>{this.tryReprojection(t)}))}e.forEach((e=>{const i=t.features.filter((t=>t.geometry.type===e));let r={};i.forEach((t=>{for(let e in t.properties)r[e]=typeof t.properties[e]}));const n=i.every((t=>this.hasProperties(t,r))),s=i.every((t=>this.hasRightType(t,r)));jQuery("#geojson-import-data-summary table tbody").append(`\n \n ${e}\n ${i.length}\n ${window.mapster_settings.strings["Example Feature"]}\n ${n&&s?`\n \n ${window.mapster_settings.strings["Looks Good"]}\n `:`\n ${n?"":`\n ${window.mapster_settings.strings["Missing Properties"]}\n `}\n ${s?"":`\n ${window.mapster_settings.strings["Inconsistent Data"]}\n `}\n `}\n \n \n `);jQuery(document).on("click",`.mapster-example-feature-${e}`,(function(){let t=jQuery(this).data("index").replace("feature-","");alert(JSON.stringify(i[t],null,2))}))}))}}advancedOptions(t){}hasProperties(t,e){let i=!0;for(let r in e)t.properties[r]||(i=!1);return i}hasRightType(t,e){let i=!0;for(let r in e)t.properties[r]&&typeof t.properties[r]!==e[r]&&(i=!1);return i}doGeoJSONImportPost(t,e,i,r){jQuery(".mapster-map-loader").show();return fetch(window.mapster_settings.rest_url+"mapster-wp-maps/import-geojson",{headers:{"X-WP-Nonce":window.mapster_settings.nonce,"Content-Type":"application/json"},method:"POST",body:JSON.stringify({file:t,import_json:e,category:i,features_imported:r})}).then((t=>t.json()))}displayAfterImport(t){jQuery(".mapster-map-loader").hide();this.featuresImported=this.featuresImported+t;jQuery(".geojson-import-result span").html(this.featuresImported);jQuery(".geojson-import-result").fadeIn();jQuery(".geojson-import-progress").val(this.featuresImported/this.geojsondocumentToImport.features.length*100);jQuery(".mapster-import-error").html(window.mapster_settings.strings["Seem Wrong"]+this.upgradeMessage)}async glJSgeoJSONUploaded(t){const e=await new Response(t.target.files[0]).json();this.importGLJSGeoJSON(e)}importGLJSGeoJSON(t){t?this.gljsdocumentToImport=t:window.alert(window.mapster_settings.strings["Please Upload"])}doGLJSImport(){let t=this;this.gljsdocumentToImport?fetch(window.mapster_settings.rest_url+"mapster-wp-maps/import-gl-js",{headers:{"X-WP-Nonce":window.mapster_settings.nonce,"Content-Type":"application/json"},method:"POST",body:JSON.stringify({file:t.gljsdocumentToImport,category:jQuery("#gl-js-import-category").val()})}).then((t=>t.json())).then((t=>{jQuery("#gl-js-import-result span").html(t.count);jQuery("#gl-js-import-result").fadeIn()})):window.alert(window.mapster_settings.strings["Please Upload"])}createNewTileset(){}selectExistingTileset(){}updateTileset(){}exportMapster(){}uploadMapster(t){}importMapster(){}verifyCSV(){}doCSVImport(){}init(){let t=this;t.setUpgradeMessage();jQuery(document).on("change","#geojson-import-file",(function(e){t.geoJSONUploaded(e)}));jQuery(document).on("change","#gl-js-import-file",(function(e){t.glJSgeoJSONUploaded(e)}));jQuery(document).on("change","#geojson-import-category",(function(e){t.currentImportCategory=jQuery("#geojson-import-category").val()}));jQuery(document).on("change","#csv-import-category",(function(e){t.currentImportCategory=jQuery("#csv-import-category").val()}));jQuery(document).on("click","#geojson-import-button",(function(){t.doGeoJSONImport()}));jQuery(document).on("click","#gl-js-import-button",(function(){t.doGLJSImport()}));jQuery(document).on("click","#export-mapster-installation",(function(){t.exportMapster()}));jQuery(document).on("change","#upload-mapster-installation",(function(e){t.uploadMapster(e)}));jQuery(document).on("click","#import-mapster-installation",(function(){t.importMapster()}));jQuery(document).on("click","#existing-tileset-source",(function(){t.selectExistingTileset()}));jQuery(document).on("click","#new-tileset-source",(function(){t.createNewTileset()}));jQuery(document).on("click","#update-tileset-source-button",(function(){t.updateTileset()}));jQuery(document).on("click","#mapster-csv-verify",(function(){t.verifyCSV()}));jQuery(document).on("click","#mapster-csv-import",(function(){t.doCSVImport()}));jQuery(document).on("click",".nav-tab",(function(){jQuery(this).siblings().each((function(){jQuery(this).removeClass("nav-tab-active")}));jQuery(this).addClass("nav-tab-active");jQuery(this).parent().siblings().each((function(){jQuery(this).hasClass("nav-box")&&jQuery(this).removeClass("nav-box-active")}));jQuery("#"+jQuery(this).attr("id")+"-options").addClass("nav-box-active")}))}}