bwsamern-ohne_standortplaner/libs/shp.min.js

2 lines
98 KiB
JavaScript

!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s():"function"==typeof define&&define.amd?define(s):(t="undefined"!=typeof globalThis?globalThis:t||self).shp=s()}(this,(function(){"use strict";var t=1,s=2,i=3,a=4,h=5,e=6378137,r=6356752.314,n=.0066943799901413165,o=484813681109536e-20,l=Math.PI/2,u=.16666666666666666,c=.04722222222222222,f=.022156084656084655,M=1e-10,p=.017453292519943295,d=57.29577951308232,y=Math.PI/4,m=2*Math.PI,_=3.14159265359,g={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},x={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},v=/[\s_\-\/\(\)]/g;function b(t,s){if(t[s])return t[s];for(var i,a=Object.keys(t),h=s.toLowerCase().replace(v,""),e=-1;++e<a.length;)if((i=a[e]).toLowerCase().replace(v,"")===h)return t[i]}function w(t){var s,i,a,h={},e=t.split("+").map((function(t){return t.trim()})).filter((function(t){return t})).reduce((function(t,s){var i=s.split("=");return i.push(!0),t[i[0].toLowerCase()]=i[1],t}),{}),r={proj:"projName",datum:"datumCode",rf:function(t){h.rf=parseFloat(t)},lat_0:function(t){h.lat0=t*p},lat_1:function(t){h.lat1=t*p},lat_2:function(t){h.lat2=t*p},lat_ts:function(t){h.lat_ts=t*p},lon_0:function(t){h.long0=t*p},lon_1:function(t){h.long1=t*p},lon_2:function(t){h.long2=t*p},alpha:function(t){h.alpha=parseFloat(t)*p},gamma:function(t){h.rectified_grid_angle=parseFloat(t)},lonc:function(t){h.longc=t*p},x_0:function(t){h.x0=parseFloat(t)},y_0:function(t){h.y0=parseFloat(t)},k_0:function(t){h.k0=parseFloat(t)},k:function(t){h.k0=parseFloat(t)},a:function(t){h.a=parseFloat(t)},b:function(t){h.b=parseFloat(t)},r_a:function(){h.R_A=!0},zone:function(t){h.zone=parseInt(t,10)},south:function(){h.utmSouth=!0},towgs84:function(t){h.datum_params=t.split(",").map((function(t){return parseFloat(t)}))},to_meter:function(t){h.to_meter=parseFloat(t)},units:function(t){h.units=t;var s=b(x,t);s&&(h.to_meter=s.to_meter)},from_greenwich:function(t){h.from_greenwich=t*p},pm:function(t){var s=b(g,t);h.from_greenwich=(s||parseFloat(t))*p},nadgrids:function(t){"@null"===t?h.datumCode="none":h.nadgrids=t},axis:function(t){var s="ewnsud";3===t.length&&-1!==s.indexOf(t.substr(0,1))&&-1!==s.indexOf(t.substr(1,1))&&-1!==s.indexOf(t.substr(2,1))&&(h.axis=t)},approx:function(){h.approx=!0}};for(s in e)i=e[s],s in r?"function"==typeof(a=r[s])?a(i):h[a]=i:h[s]=i;return"string"==typeof h.datumCode&&"WGS84"!==h.datumCode&&(h.datumCode=h.datumCode.toLowerCase()),h}var A=1,C=/\s/,N=/[A-Za-z]/,P=/[A-Za-z84_]/,E=/[,\]]/,S=/[\d\.E\-\+]/;function I(t){if("string"!=typeof t)throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=A}function k(t,s,i){Array.isArray(s)&&(i.unshift(s),s=null);var a=s?{}:t,h=i.reduce((function(t,s){return O(s,t),t}),a);s&&(t[s]=h)}function O(t,s){if(Array.isArray(t)){var i=t.shift();if("PARAMETER"===i&&(i=t.shift()),1===t.length)return Array.isArray(t[0])?(s[i]={},void O(t[0],s[i])):void(s[i]=t[0]);if(t.length)if("TOWGS84"!==i){if("AXIS"===i)return i in s||(s[i]=[]),void s[i].push(t);var a;switch(Array.isArray(i)||(s[i]={}),i){case"UNIT":case"PRIMEM":case"VERT_DATUM":return s[i]={name:t[0].toLowerCase(),convert:t[1]},void(3===t.length&&O(t[2],s[i]));case"SPHEROID":case"ELLIPSOID":return s[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&O(t[3],s[i]));case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":return t[0]=["name",t[0]],void k(s,i,t);default:for(a=-1;++a<t.length;)if(!Array.isArray(t[a]))return O(t,s[i]);return k(s,i,t)}}else s[i]=t;else s[i]=!0}else s[t]=!0}I.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;C.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case A: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}},I.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(E.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)},I.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=A)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=A,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},I.prototype.number=function(t){if(!S.test(t)){if(E.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},I.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},I.prototype.keyword=function(t){if(P.test(t))this.word+=t;else{if("["===t){var s=[];return s.push(this.word),this.level++,null===this.root?this.root=s:this.currentObject.push(s),this.stack.push(this.currentObject),this.currentObject=s,void(this.state=A)}if(!E.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},I.prototype.neutral=function(t){if(N.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(S.test(t))return this.word=t,void(this.state=3);if(!E.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},I.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(-1===this.state)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};var q=.017453292519943295;function R(t){return t*q}function L(t){var s=new I(t).output(),i=s.shift(),a=s.shift();s.unshift(["name",a]),s.unshift(["type",i]);var h={};return O(s,h),function(t){if("GEOGCS"===t.type?t.projName="longlat":"LOCAL_CS"===t.type?(t.projName="identity",t.local=!0):"object"==typeof t.PROJECTION?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.AXIS){for(var s="",i=0,a=t.AXIS.length;i<a;++i){var h=[t.AXIS[i][0].toLowerCase(),t.AXIS[i][1].toLowerCase()];-1!==h[0].indexOf("north")||("y"===h[0]||"lat"===h[0])&&"north"===h[1]?s+="n":-1!==h[0].indexOf("south")||("y"===h[0]||"lat"===h[0])&&"south"===h[1]?s+="s":-1!==h[0].indexOf("east")||("x"===h[0]||"lon"===h[0])&&"east"===h[1]?s+="e":-1===h[0].indexOf("west")&&("x"!==h[0]&&"lon"!==h[0]||"west"!==h[1])||(s+="w")}2===s.length&&(s+="u"),3===s.length&&(t.axis=s)}t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),"metre"===t.units&&(t.units="meter"),t.UNIT.convert&&("GEOGCS"===t.type?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var e=t.GEOGCS;function r(s){return s*(t.to_meter||1)}"GEOGCS"===t.type&&(e=t),e&&(e.DATUM?t.datumCode=e.DATUM.name.toLowerCase():t.datumCode=e.name.toLowerCase(),"d_"===t.datumCode.slice(0,2)&&(t.datumCode=t.datumCode.slice(2)),"new_zealand_geodetic_datum_1949"!==t.datumCode&&"new_zealand_1949"!==t.datumCode||(t.datumCode="nzgd49"),"wgs_1984"!==t.datumCode&&"world_geodetic_system_1984"!==t.datumCode||("Mercator_Auxiliary_Sphere"===t.PROJECTION&&(t.sphere=!0),t.datumCode="wgs84"),"_ferro"===t.datumCode.slice(-6)&&(t.datumCode=t.datumCode.slice(0,-6)),"_jakarta"===t.datumCode.slice(-8)&&(t.datumCode=t.datumCode.slice(0,-8)),~t.datumCode.indexOf("belge")&&(t.datumCode="rnb72"),e.DATUM&&e.DATUM.SPHEROID&&(t.ellps=e.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===t.ellps.toLowerCase().slice(0,13)&&(t.ellps="intl"),t.a=e.DATUM.SPHEROID.a,t.rf=parseFloat(e.DATUM.SPHEROID.rf,10)),e.DATUM&&e.DATUM.TOWGS84&&(t.datum_params=e.DATUM.TOWGS84),~t.datumCode.indexOf("osgb_1936")&&(t.datumCode="osgb36"),~t.datumCode.indexOf("osni_1952")&&(t.datumCode="osni52"),(~t.datumCode.indexOf("tm65")||~t.datumCode.indexOf("geodetic_datum_of_1965"))&&(t.datumCode="ire65"),"ch1903+"===t.datumCode&&(t.datumCode="ch1903"),~t.datumCode.indexOf("israel")&&(t.datumCode="isr93")),t.b&&!isFinite(t.b)&&(t.b=t.a),[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",R],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",R],["x0","false_easting",r],["y0","false_northing",r],["long0","central_meridian",R],["lat0","latitude_of_origin",R],["lat0","standard_parallel_1",R],["lat1","standard_parallel_1",R],["lat2","standard_parallel_2",R],["azimuth","Azimuth"],["alpha","azimuth",R],["srsCode","name"]].forEach((function(s){return function(t,s){var i=s[0],a=s[1];!(i in t)&&a in t&&(t[i]=t[a],3===s.length&&(t[i]=s[2](t[i])))}(t,s)})),t.long0||!t.longc||"Albers_Conic_Equal_Area"!==t.projName&&"Lambert_Azimuthal_Equal_Area"!==t.projName||(t.long0=t.longc),t.lat_ts||!t.lat1||"Stereographic_South_Pole"!==t.projName&&"Polar Stereographic (variant B)"!==t.projName?!t.lat_ts&&t.lat0&&"Polar_Stereographic"===t.projName&&(t.lat_ts=t.lat0,t.lat0=R(t.lat0>0?90:-90)):(t.lat0=R(t.lat1>0?90:-90),t.lat_ts=t.lat1)}(h),h}function j(t){var s=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?j[t]=w(arguments[1]):j[t]=L(arguments[1]):j[t]=i}else if(1===arguments.length){if(Array.isArray(t))return t.map((function(t){Array.isArray(t)?j.apply(s,t):j(t)}));if("string"==typeof t){if(t in j)return j[t]}else"EPSG"in t?j["EPSG:"+t.EPSG]=t:"ESRI"in t?j["ESRI:"+t.ESRI]=t:"IAU2000"in t?j["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"]}(j);var G=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];var T=["3857","900913","3785","102113"];function z(t){if(!function(t){return"string"==typeof t}(t))return t;if(function(t){return t in j}(t))return j[t];if(function(t){return G.some((function(s){return t.indexOf(s)>-1}))}(t)){var s=L(t);if(function(t){var s=b(t,"authority");if(s){var i=b(s,"epsg");return i&&T.indexOf(i)>-1}}(s))return j["EPSG:3857"];var i=function(t){var s=b(t,"extension");if(s)return b(s,"proj4")}(s);return i?w(i):s}return function(t){return"+"===t[0]}(t)?w(t):void 0}function B(t,s){var i,a;if(t=t||{},!s)return t;for(a in s)void 0!==(i=s[a])&&(t[a]=i);return t}function D(t,s,i){var a=t*s;return i/Math.sqrt(1-a*a)}function F(t){return t<0?-1:1}function U(t){return Math.abs(t)<=_?t:t-F(t)*m}function Q(t,s,i){var a=t*i,h=.5*t;return a=Math.pow((1-a)/(1+a),h),Math.tan(.5*(l-s))/a}function W(t,s){for(var i,a,h=.5*t,e=l-2*Math.atan(s),r=0;r<=15;r++)if(i=t*Math.sin(e),e+=a=l-2*Math.atan(s*Math.pow((1-i)/(1+i),h))-e,Math.abs(a)<=1e-10)return e;return-9999}var Z={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=D(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 s,i,a=t.x,h=t.y;if(h*d>90&&h*d<-90&&a*d>180&&a*d<-180)return null;if(Math.abs(Math.abs(h)-l)<=M)return null;if(this.sphere)s=this.x0+this.a*this.k0*U(a-this.long0),i=this.y0+this.a*this.k0*Math.log(Math.tan(y+.5*h));else{var e=Math.sin(h),r=Q(this.e,h,e);s=this.x0+this.a*this.k0*U(a-this.long0),i=this.y0-this.a*this.k0*Math.log(r)}return t.x=s,t.y=i,t},inverse:function(t){var s,i,a=t.x-this.x0,h=t.y-this.y0;if(this.sphere)i=l-2*Math.atan(Math.exp(-h/(this.a*this.k0)));else{var e=Math.exp(-h/(this.a*this.k0));if(-9999===(i=W(this.e,e)))return null}return s=U(this.long0+a/(this.a*this.k0)),t.x=s,t.y=i,t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"]};function H(t){return t}var V=[Z,{init:function(){},forward:H,inverse:H,names:["longlat","identity"]}],X={},J=[];function K(t,s){var i=J.length;return t.names?(J[i]=t,t.names.forEach((function(t){X[t.toLowerCase()]=i})),this):(console.log(s),!0)}var $={start:function(){V.forEach(K)},add:K,get:function(t){if(!t)return!1;var s=t.toLowerCase();return void 0!==X[s]&&J[X[s]]?J[X[s]]: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."},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},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"}},tt=Y.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};Y.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};var st={};st.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},st.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},st.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},st.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},st.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},st.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},st.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},st.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},st.militargeographische_institut={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},st.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},st.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},st.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},st.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},st.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},st.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},st.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},st.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},st.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};var it={};function at(t){if(0===t.length)return null;var s="@"===t[0];return s&&(t=t.slice(1)),"null"===t?{name:"null",mandatory:!s,grid:null,isNull:!0}:{name:t,mandatory:!s,grid:it[t]||null,isNull:!1}}function ht(t){return t/3600*Math.PI/180}function et(t,s,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(s,i)))}function rt(t){return t.map((function(t){return[ht(t.longitudeShift),ht(t.latitudeShift)]}))}function nt(t,s,i){return{name:et(t,s+8,s+16).trim(),parent:et(t,s+24,s+24+8).trim(),lowerLatitude:t.getFloat64(s+72,i),upperLatitude:t.getFloat64(s+88,i),lowerLongitude:t.getFloat64(s+104,i),upperLongitude:t.getFloat64(s+120,i),latitudeInterval:t.getFloat64(s+136,i),longitudeInterval:t.getFloat64(s+152,i),gridNodeCount:t.getInt32(s+168,i)}}function ot(t,s,i,a){for(var h=s+176,e=[],r=0;r<i.gridNodeCount;r++){var n={latitudeShift:t.getFloat32(h+16*r,a),longitudeShift:t.getFloat32(h+16*r+4,a),latitudeAccuracy:t.getFloat32(h+16*r+8,a),longitudeAccuracy:t.getFloat32(h+16*r+12,a)};e.push(n)}return e}function lt(e,r){if(!(this instanceof lt))return new lt(e);r=r||function(t){if(t)throw t};var n=z(e);if("object"==typeof n){var l=lt.projections.get(n.projName);if(l){if(n.datumCode&&"none"!==n.datumCode){var p=b(st,n.datumCode);p&&(n.datum_params=n.datum_params||(p.towgs84?p.towgs84.split(","):null),n.ellps=p.ellipse,n.datumName=p.datumName?p.datumName:n.datumCode)}n.k0=n.k0||1,n.axis=n.axis||"enu",n.ellps=n.ellps||"wgs84",n.lat1=n.lat1||n.lat0;var d,y,m,_,g,x,v,w=function(t,s,i,a,h){if(!t){var e=b(Y,a);e||(e=tt),t=e.a,s=e.b,i=e.rf}return i&&!s&&(s=(1-1/i)*t),(0===i||Math.abs(t-s)<M)&&(h=!0,s=t),{a:t,b:s,rf:i,sphere:h}}(n.a,n.b,n.rf,n.ellps,n.sphere),A=(d=w.a,y=w.b,w.rf,m=n.R_A,x=((_=d*d)-(g=y*y))/_,v=0,m?(_=(d*=1-x*(u+x*(c+x*f)))*d,x=0):v=Math.sqrt(x),{es:x,e:v,ep2:(_-g)/g}),C=function(t){return void 0===t?null:t.split(",").map(at)}(n.nadgrids),N=n.datum||function(e,r,n,l,u,c,f){var M={};return M.datum_type=void 0===e||"none"===e?h:a,r&&(M.datum_params=r.map(parseFloat),0===M.datum_params[0]&&0===M.datum_params[1]&&0===M.datum_params[2]||(M.datum_type=t),M.datum_params.length>3&&(0===M.datum_params[3]&&0===M.datum_params[4]&&0===M.datum_params[5]&&0===M.datum_params[6]||(M.datum_type=s,M.datum_params[3]*=o,M.datum_params[4]*=o,M.datum_params[5]*=o,M.datum_params[6]=M.datum_params[6]/1e6+1))),f&&(M.datum_type=i,M.grids=f),M.a=n,M.b=l,M.es=u,M.ep2=c,M}(n.datumCode,n.datum_params,w.a,w.b,A.es,A.ep2,C);B(this,n),B(this,l),this.a=w.a,this.b=w.b,this.rf=w.rf,this.sphere=w.sphere,this.es=A.es,this.e=A.e,this.ep2=A.ep2,this.datum=N,this.init(),r(null,this)}else r(e)}else r(e)}function ut(t,s,i){var a,h,e,r,n=t.x,o=t.y,u=t.z?t.z:0;if(o<-l&&o>-1.001*l)o=-l;else if(o>l&&o<1.001*l)o=l;else{if(o<-l)return{x:-1/0,y:-1/0,z:t.z};if(o>l)return{x:1/0,y:1/0,z:t.z}}return n>Math.PI&&(n-=2*Math.PI),h=Math.sin(o),r=Math.cos(o),e=h*h,{x:((a=i/Math.sqrt(1-s*e))+u)*r*Math.cos(n),y:(a+u)*r*Math.sin(n),z:(a*(1-s)+u)*h}}function ct(t,s,i,a){var h,e,r,n,o,u,c,f,M,p,d,y,m,_,g,x=1e-12,v=t.x,b=t.y,w=t.z?t.z:0;if(h=Math.sqrt(v*v+b*b),e=Math.sqrt(v*v+b*b+w*w),h/i<x){if(_=0,e/i<x)return l,g=-a,{x:t.x,y:t.y,z:t.z}}else _=Math.atan2(b,v);r=w/e,f=(n=h/e)*(1-s)*(o=1/Math.sqrt(1-s*(2-s)*n*n)),M=r*o,m=0;do{m++,u=s*(c=i/Math.sqrt(1-s*M*M))/(c+(g=h*f+w*M-c*(1-s*M*M))),y=(d=r*(o=1/Math.sqrt(1-u*(2-u)*n*n)))*f-(p=n*(1-u)*o)*M,f=p,M=d}while(y*y>1e-24&&m<30);return{x:_,y:Math.atan(d/Math.abs(p)),z:g}}function ft(i){return i===t||i===s}function Mt(a,o,l){if(function(i,a){return i.datum_type===a.datum_type&&!(i.a!==a.a||Math.abs(i.es-a.es)>5e-11)&&(i.datum_type===t?i.datum_params[0]===a.datum_params[0]&&i.datum_params[1]===a.datum_params[1]&&i.datum_params[2]===a.datum_params[2]:i.datum_type!==s||i.datum_params[0]===a.datum_params[0]&&i.datum_params[1]===a.datum_params[1]&&i.datum_params[2]===a.datum_params[2]&&i.datum_params[3]===a.datum_params[3]&&i.datum_params[4]===a.datum_params[4]&&i.datum_params[5]===a.datum_params[5]&&i.datum_params[6]===a.datum_params[6])}(a,o))return l;if(a.datum_type===h||o.datum_type===h)return l;var u=a.a,c=a.es;if(a.datum_type===i){if(0!==pt(a,!1,l))return;u=e,c=n}var f=o.a,M=o.b,p=o.es;if(o.datum_type===i&&(f=e,M=r,p=n),c===p&&u===f&&!ft(a.datum_type)&&!ft(o.datum_type))return l;if((l=ut(l,c,u),ft(a.datum_type)&&(l=function(i,a,h){if(a===t)return{x:i.x+h[0],y:i.y+h[1],z:i.z+h[2]};if(a===s){var e=h[0],r=h[1],n=h[2],o=h[3],l=h[4],u=h[5],c=h[6];return{x:c*(i.x-u*i.y+l*i.z)+e,y:c*(u*i.x+i.y-o*i.z)+r,z:c*(-l*i.x+o*i.y+i.z)+n}}}(l,a.datum_type,a.datum_params)),ft(o.datum_type)&&(l=function(i,a,h){if(a===t)return{x:i.x-h[0],y:i.y-h[1],z:i.z-h[2]};if(a===s){var e=h[0],r=h[1],n=h[2],o=h[3],l=h[4],u=h[5],c=h[6],f=(i.x-e)/c,M=(i.y-r)/c,p=(i.z-n)/c;return{x:f+u*M-l*p,y:-u*f+M+o*p,z:l*f-o*M+p}}}(l,o.datum_type,o.datum_params)),l=ct(l,p,f,M),o.datum_type===i)&&0!==pt(o,!0,l))return;return l}function pt(t,s,i){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;var a={x:-i.x,y:i.y},h={x:Number.NaN,y:Number.NaN},e=[];t:for(var r=0;r<t.grids.length;r++){var n=t.grids[r];if(e.push(n.name),n.isNull){h=a;break}if(n.mandatory,null!==n.grid)for(var o=n.grid.subgrids,l=0,u=o.length;l<u;l++){var c=o[l],f=(Math.abs(c.del[1])+Math.abs(c.del[0]))/1e4,M=c.ll[0]-f,p=c.ll[1]-f,y=c.ll[0]+(c.lim[0]-1)*c.del[0]+f,m=c.ll[1]+(c.lim[1]-1)*c.del[1]+f;if(!(p>a.y||M>a.x||m<a.y||y<a.x)&&(h=dt(a,s,c),!isNaN(h.x)))break t}else if(n.mandatory)return console.log("Unable to find mandatory grid '"+n.name+"'"),-1}return isNaN(h.x)?(console.log("Failed to find a grid shift table for location '"+-a.x*d+" "+a.y*d+" tried: '"+e+"'"),-1):(i.x=-h.x,i.y=h.y,0)}function dt(t,s,i){var a={x:Number.NaN,y:Number.NaN};if(isNaN(t.x))return a;var h={x:t.x,y:t.y};h.x-=i.ll[0],h.y-=i.ll[1],h.x=U(h.x-Math.PI)+Math.PI;var e=yt(h,i);if(s){if(isNaN(e.x))return a;e.x=h.x-e.x,e.y=h.y-e.y;var r,n,o=9;do{if(n=yt(e,i),isNaN(n.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}r={x:h.x-(n.x+e.x),y:h.y-(n.y+e.y)},e.x+=r.x,e.y+=r.y}while(o--&&Math.abs(r.x)>1e-12&&Math.abs(r.y)>1e-12);if(o<0)return console.log("Inverse grid shift iterator failed to converge."),a;a.x=U(e.x+i.ll[0]),a.y=e.y+i.ll[1]}else isNaN(e.x)||(a.x=t.x+e.x,a.y=t.y+e.y);return a}function yt(t,s){var i,a={x:t.x/s.del[0],y:t.y/s.del[1]},h=Math.floor(a.x),e=Math.floor(a.y),r=a.x-1*h,n=a.y-1*e,o={x:Number.NaN,y:Number.NaN};if(h<0||h>=s.lim[0])return o;if(e<0||e>=s.lim[1])return o;i=e*s.lim[0]+h;var l=s.cvs[i][0],u=s.cvs[i][1];i++;var c=s.cvs[i][0],f=s.cvs[i][1];i+=s.lim[0];var M=s.cvs[i][0],p=s.cvs[i][1];i--;var d=s.cvs[i][0],y=s.cvs[i][1],m=r*n,_=r*(1-n),g=(1-r)*(1-n),x=(1-r)*n;return o.x=g*l+_*c+x*d+m*M,o.y=g*u+_*f+x*y+m*p,o}function mt(t,s,i){var a,h,e,r=i.x,n=i.y,o=i.z||0,l={};for(e=0;e<3;e++)if(!s||2!==e||void 0!==i.z)switch(0===e?(a=r,h=-1!=="ew".indexOf(t.axis[e])?"x":"y"):1===e?(a=n,h=-1!=="ns".indexOf(t.axis[e])?"y":"x"):(a=o,h="z"),t.axis[e]){case"e":case"n":l[h]=a;break;case"w":case"s":l[h]=-a;break;case"u":void 0!==i[h]&&(l.z=a);break;case"d":void 0!==i[h]&&(l.z=-a);break;default:return null}return l}function _t(t){var s={x:t[0],y:t[1]};return t.length>2&&(s.z=t[2]),t.length>3&&(s.m=t[3]),s}function gt(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 xt(a,h,e,r){var n,o=void 0!==(e=Array.isArray(e)?_t(e):{x:e.x,y:e.y,z:e.z,m:e.m}).z;if(function(t){gt(t.x),gt(t.y)}(e),a.datum&&h.datum&&function(a,h){return(a.datum.datum_type===t||a.datum.datum_type===s||a.datum.datum_type===i)&&"WGS84"!==h.datumCode||(h.datum.datum_type===t||h.datum.datum_type===s||h.datum.datum_type===i)&&"WGS84"!==a.datumCode}(a,h)&&(e=xt(a,n=new lt("WGS84"),e,r),a=n),r&&"enu"!==a.axis&&(e=mt(a,!1,e)),"longlat"===a.projName)e={x:e.x*p,y:e.y*p,z:e.z||0};else if(a.to_meter&&(e={x:e.x*a.to_meter,y:e.y*a.to_meter,z:e.z||0}),!(e=a.inverse(e)))return;if(a.from_greenwich&&(e.x+=a.from_greenwich),e=Mt(a.datum,h.datum,e))return h.from_greenwich&&(e={x:e.x-h.from_greenwich,y:e.y,z:e.z||0}),"longlat"===h.projName?e={x:e.x*d,y:e.y*d,z:e.z||0}:(e=h.forward(e),h.to_meter&&(e={x:e.x/h.to_meter,y:e.y/h.to_meter,z:e.z||0})),r&&"enu"!==h.axis?mt(h,!0,e):(e&&!o&&delete e.z,e)}lt.projections=$,lt.projections.start();var vt=lt("WGS84");function bt(t,s,i,a){var h,e,r;return Array.isArray(i)?(h=xt(t,s,i,a)||{x:NaN,y:NaN},i.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==s.name&&"geocent"===s.name?"number"==typeof h.z?[h.x,h.y,h.z].concat(i.splice(3)):[h.x,h.y,i[2]].concat(i.splice(3)):[h.x,h.y].concat(i.splice(2)):[h.x,h.y]):(e=xt(t,s,i,a),2===(r=Object.keys(i)).length||r.forEach((function(a){if(void 0!==t.name&&"geocent"===t.name||void 0!==s.name&&"geocent"===s.name){if("x"===a||"y"===a||"z"===a)return}else if("x"===a||"y"===a)return;e[a]=i[a]})),e)}function wt(t){return t instanceof lt?t:t.oProj?t.oProj:lt(t)}function At(t,s,i){t=wt(t);var a,h=!1;return void 0===s?(s=t,t=vt,h=!0):(void 0!==s.x||Array.isArray(s))&&(i=s,s=t,t=vt,h=!0),s=wt(s),i?bt(t,s,i):(a={forward:function(i,a){return bt(t,s,i,a)},inverse:function(i,a){return bt(s,t,i,a)}},h&&(a.oProj=s),a)}var Ct=6,Nt="AJSAJS",Pt="AFAFAF",Et=65,St=73,It=79,kt=86,Ot=90,qt={forward:Rt,inverse:function(t){var s=Tt(Dt(t.toUpperCase()));if(s.lat&&s.lon)return[s.lon,s.lat,s.lon,s.lat];return[s.left,s.bottom,s.right,s.top]},toPoint:Lt};function Rt(t,s){return s=s||5,function(t,s){var i="00000"+t.easting,a="00000"+t.northing;return t.zoneNumber+t.zoneLetter+(M=t.easting,p=t.northing,d=t.zoneNumber,y=Bt(d),m=Math.floor(M/1e5),_=Math.floor(p/1e5)%20,h=m,e=_,r=y,n=r-1,o=Nt.charCodeAt(n),l=Pt.charCodeAt(n),u=o+h-1,c=l+e,f=!1,u>Ot&&(u=u-Ot+Et-1,f=!0),(u===St||o<St&&u>St||(u>St||o<St)&&f)&&u++,(u===It||o<It&&u>It||(u>It||o<It)&&f)&&++u===St&&u++,u>Ot&&(u=u-Ot+Et-1),c>kt?(c=c-kt+Et-1,f=!0):f=!1,(c===St||l<St&&c>St||(c>St||l<St)&&f)&&c++,(c===It||l<It&&c>It||(c>It||l<It)&&f)&&++c===St&&c++,c>kt&&(c=c-kt+Et-1),String.fromCharCode(u)+String.fromCharCode(c))+i.substr(i.length-5,s)+a.substr(a.length-5,s);var h,e,r,n,o,l,u,c,f;var M,p,d,y,m,_}(function(t){var s,i,a,h,e,r,n,o,l=t.lat,u=t.lon,c=6378137,f=.00669438,M=.9996,p=jt(l),d=jt(u);o=Math.floor((u+180)/6)+1,180===u&&(o=60);l>=56&&l<64&&u>=3&&u<12&&(o=32);l>=72&&l<84&&(u>=0&&u<9?o=31:u>=9&&u<21?o=33:u>=21&&u<33?o=35:u>=33&&u<42&&(o=37));n=jt(6*(o-1)-180+3),s=f/(1-f),i=c/Math.sqrt(1-f*Math.sin(p)*Math.sin(p)),a=Math.tan(p)*Math.tan(p),h=s*Math.cos(p)*Math.cos(p),e=Math.cos(p)*(d-n),r=c*((1-f/4-3*f*f/64-5*f*f*f/256)*p-(3*f/8+3*f*f/32+45*f*f*f/1024)*Math.sin(2*p)+(15*f*f/256+45*f*f*f/1024)*Math.sin(4*p)-35*f*f*f/3072*Math.sin(6*p));var y=M*i*(e+(1-a+h)*e*e*e/6+(5-18*a+a*a+72*h-58*s)*e*e*e*e*e/120)+5e5,m=M*(r+i*Math.tan(p)*(e*e/2+(5-a+9*h+4*h*h)*e*e*e*e/24+(61-58*a+a*a+600*h-330*s)*e*e*e*e*e*e/720));l<0&&(m+=1e7);return{northing:Math.round(m),easting:Math.round(y),zoneNumber:o,zoneLetter:zt(l)}}({lat:t[1],lon:t[0]}),s)}function Lt(t){var s=Tt(Dt(t.toUpperCase()));return s.lat&&s.lon?[s.lon,s.lat]:[(s.left+s.right)/2,(s.top+s.bottom)/2]}function jt(t){return t*(Math.PI/180)}function Gt(t){return t/Math.PI*180}function Tt(t){var s=t.northing,i=t.easting,a=t.zoneLetter,h=t.zoneNumber;if(h<0||h>60)return null;var e,r,n,o,l,u,c,f,M,p=.9996,d=6378137,y=.00669438,m=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),_=i-5e5,g=s;a<"N"&&(g-=1e7),c=6*(h-1)-180+3,e=.006739496752268451,M=(f=g/p/6367449.145945056)+(3*m/2-27*m*m*m/32)*Math.sin(2*f)+(21*m*m/16-55*m*m*m*m/32)*Math.sin(4*f)+151*m*m*m/96*Math.sin(6*f),r=d/Math.sqrt(1-y*Math.sin(M)*Math.sin(M)),n=Math.tan(M)*Math.tan(M),o=e*Math.cos(M)*Math.cos(M),l=.99330562*d/Math.pow(1-y*Math.sin(M)*Math.sin(M),1.5),u=_/(r*p);var x=M-r*Math.tan(M)/l*(u*u/2-(5+3*n+10*o-4*o*o-9*e)*u*u*u*u/24+(61+90*n+298*o+45*n*n-1.6983531815716497-3*o*o)*u*u*u*u*u*u/720);x=Gt(x);var v,b=(u-(1+2*n+o)*u*u*u/6+(5-2*o+28*n-3*o*o+8*e+24*n*n)*u*u*u*u*u/120)/Math.cos(M);if(b=c+Gt(b),t.accuracy){var w=Tt({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});v={top:w.lat,right:w.lon,bottom:x,left:b}}else v={lat:x,lon:b};return v}function zt(t){var s="Z";return 84>=t&&t>=72?s="X":72>t&&t>=64?s="W":64>t&&t>=56?s="V":56>t&&t>=48?s="U":48>t&&t>=40?s="T":40>t&&t>=32?s="S":32>t&&t>=24?s="R":24>t&&t>=16?s="Q":16>t&&t>=8?s="P":8>t&&t>=0?s="N":0>t&&t>=-8?s="M":-8>t&&t>=-16?s="L":-16>t&&t>=-24?s="K":-24>t&&t>=-32?s="J":-32>t&&t>=-40?s="H":-40>t&&t>=-48?s="G":-48>t&&t>=-56?s="F":-56>t&&t>=-64?s="E":-64>t&&t>=-72?s="D":-72>t&&t>=-80&&(s="C"),s}function Bt(t){var s=t%Ct;return 0===s&&(s=Ct),s}function Dt(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var s,i=t.length,a=null,h="",e=0;!/[A-Z]/.test(s=t.charAt(e));){if(e>=2)throw"MGRSPoint bad conversion from: "+t;h+=s,e++}var r=parseInt(h,10);if(0===e||e+3>i)throw"MGRSPoint bad conversion from: "+t;var n=t.charAt(e++);if(n<="A"||"B"===n||"Y"===n||n>="Z"||"I"===n||"O"===n)throw"MGRSPoint zone letter "+n+" not handled: "+t;a=t.substring(e,e+=2);for(var o=Bt(r),l=function(t,s){var i=Nt.charCodeAt(s-1),a=1e5,h=!1;for(;i!==t.charCodeAt(0);){if(++i===St&&i++,i===It&&i++,i>Ot){if(h)throw"Bad character: "+t;i=Et,h=!0}a+=1e5}return a}(a.charAt(0),o),u=function(t,s){if(t>"V")throw"MGRSPoint given invalid Northing "+t;var i=Pt.charCodeAt(s-1),a=0,h=!1;for(;i!==t.charCodeAt(0);){if(++i===St&&i++,i===It&&i++,i>kt){if(h)throw"Bad character: "+t;i=Et,h=!0}a+=1e5}return a}(a.charAt(1),o);u<Ft(n);)u+=2e6;var c=i-e;if(c%2!=0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+t;var f,M,p,d=c/2,y=0,m=0;return d>0&&(f=1e5/Math.pow(10,d),M=t.substring(e,e+d),y=parseFloat(M)*f,p=t.substring(e+d),m=parseFloat(p)*f),{easting:y+l,northing:m+u,zoneLetter:n,zoneNumber:r,accuracy:f}}function Ft(t){var s;switch(t){case"C":s=11e5;break;case"D":s=2e6;break;case"E":s=28e5;break;case"F":s=37e5;break;case"G":s=46e5;break;case"H":s=55e5;break;case"J":s=64e5;break;case"K":s=73e5;break;case"L":s=82e5;break;case"M":s=91e5;break;case"N":s=0;break;case"P":s=8e5;break;case"Q":s=17e5;break;case"R":s=26e5;break;case"S":s=35e5;break;case"T":s=44e5;break;case"U":s=53e5;break;case"V":s=62e5;break;case"W":s=7e6;break;case"X":s=79e5;break;default:s=-1}if(s>=0)return s;throw"Invalid zone letter: "+t}function Ut(t,s,i){if(!(this instanceof Ut))return new Ut(t,s,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===s){var a=t.split(",");this.x=parseFloat(a[0],10),this.y=parseFloat(a[1],10),this.z=parseFloat(a[2],10)||0}else this.x=t,this.y=s,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Ut.fromMGRS=function(t){return new Ut(Lt(t))},Ut.prototype.toMGRS=function(t){return Rt([this.x,this.y],t)};var Qt=1,Wt=.25,Zt=.046875,Ht=.01953125,Vt=.01068115234375,Xt=.75,Jt=.46875,Kt=.013020833333333334,$t=.007120768229166667,Yt=.3645833333333333,ts=.005696614583333333,ss=.3076171875;function is(t){var s=[];s[0]=Qt-t*(Wt+t*(Zt+t*(Ht+t*Vt))),s[1]=t*(Xt-t*(Zt+t*(Ht+t*Vt)));var i=t*t;return s[2]=i*(Jt-t*(Kt+t*$t)),i*=t,s[3]=i*(Yt-t*ts),s[4]=i*t*ss,s}function as(t,s,i,a){return i*=s,s*=s,a[0]*t-i*(a[1]+s*(a[2]+s*(a[3]+s*a[4])))}var hs=20;function es(t,s,i){for(var a=1/(1-s),h=t,e=hs;e;--e){var r=Math.sin(h),n=1-s*r*r;if(h-=n=(as(h,r,Math.cos(h),i)-t)*(n*Math.sqrt(n))*a,Math.abs(n)<M)return h}return h}var rs={init:function(){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.es&&(this.en=is(this.es),this.ml0=as(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))},forward:function(t){var s,i,a,h=t.x,e=t.y,r=U(h-this.long0),n=Math.sin(e),o=Math.cos(e);if(this.es){var l=o*r,u=Math.pow(l,2),c=this.ep2*Math.pow(o,2),f=Math.pow(c,2),p=Math.abs(o)>M?Math.tan(e):0,d=Math.pow(p,2),y=Math.pow(d,2);s=1-this.es*Math.pow(n,2),l/=Math.sqrt(s);var m=as(e,n,o,this.en);i=this.a*(this.k0*l*(1+u/6*(1-d+c+u/20*(5-18*d+y+14*c-58*d*c+u/42*(61+179*y-y*d-479*d)))))+this.x0,a=this.a*(this.k0*(m-this.ml0+n*r*l/2*(1+u/12*(5-d+9*c+4*f+u/30*(61+y-58*d+270*c-330*d*c+u/56*(1385+543*y-y*d-3111*d))))))+this.y0}else{var _=o*Math.sin(r);if(Math.abs(Math.abs(_)-1)<M)return 93;if(i=.5*this.a*this.k0*Math.log((1+_)/(1-_))+this.x0,a=o*Math.cos(r)/Math.sqrt(1-Math.pow(_,2)),(_=Math.abs(a))>=1){if(_-1>M)return 93;a=0}else a=Math.acos(a);e<0&&(a=-a),a=this.a*this.k0*(a-this.lat0)+this.y0}return t.x=i,t.y=a,t},inverse:function(t){var s,i,a,h,e=(t.x-this.x0)*(1/this.a),r=(t.y-this.y0)*(1/this.a);if(this.es)if(i=es(s=this.ml0+r/this.k0,this.es,this.en),Math.abs(i)<l){var n=Math.sin(i),o=Math.cos(i),u=Math.abs(o)>M?Math.tan(i):0,c=this.ep2*Math.pow(o,2),f=Math.pow(c,2),p=Math.pow(u,2),d=Math.pow(p,2);s=1-this.es*Math.pow(n,2);var y=e*Math.sqrt(s)/this.k0,m=Math.pow(y,2);a=i-(s*=u)*m/(1-this.es)*.5*(1-m/12*(5+3*p-9*c*p+c-4*f-m/30*(61+90*p-252*c*p+45*d+46*c-m/56*(1385+3633*p+4095*d+1574*d*p)))),h=U(this.long0+y*(1-m/6*(1+2*p+c-m/20*(5+28*p+24*d+8*c*p+6*c-m/42*(61+662*p+1320*d+720*d*p))))/o)}else a=l*F(r),h=0;else{var _=Math.exp(e/this.k0),g=.5*(_-1/_),x=this.lat0+r/this.k0,v=Math.cos(x);s=Math.sqrt((1-Math.pow(v,2))/(1+Math.pow(g,2))),a=Math.asin(s),r<0&&(a=-a),h=0===g&&0===v?0:U(Math.atan2(g,v)+this.long0)}return t.x=h,t.y=a,t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function ns(t){var s=Math.exp(t);return s=(s-1/s)/2}function os(t,s){t=Math.abs(t),s=Math.abs(s);var i=Math.max(t,s),a=Math.min(t,s)/(i||1);return i*Math.sqrt(1+Math.pow(a,2))}function ls(t){var s=Math.abs(t);return s=function(t){var s=1+t,i=s-1;return 0===i?t:t*Math.log(s)/i}(s*(1+s/(os(1,s)+1))),t<0?-s:s}function us(t,s){for(var i,a=2*Math.cos(2*s),h=t.length-1,e=t[h],r=0;--h>=0;)i=a*e-r+t[h],r=e,e=i;return s+i*Math.sin(2*s)}function cs(t,s,i){for(var a,h,e=Math.sin(s),r=Math.cos(s),n=ns(i),o=function(t){var s=Math.exp(t);return(s+1/s)/2}(i),l=2*r*o,u=-2*e*n,c=t.length-1,f=t[c],M=0,p=0,d=0;--c>=0;)a=p,h=M,f=l*(p=f)-a-u*(M=d)+t[c],d=u*p-h+l*M;return[(l=e*o)*f-(u=r*n)*d,l*d+u*f]}var fs={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&&(rs.init.apply(this),this.forward=rs.forward,this.inverse=rs.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)),s=t/(2-t),i=s;this.cgb[0]=s*(2+s*(-2/3+s*(s*(116/45+s*(26/45+s*(-2854/675)))-2))),this.cbg[0]=s*(s*(2/3+s*(4/3+s*(-82/45+s*(32/45+s*(4642/4725)))))-2),i*=s,this.cgb[1]=i*(7/3+s*(s*(-227/45+s*(2704/315+s*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+s*(-16/15+s*(-13/9+s*(904/315+s*(-1522/945))))),i*=s,this.cgb[2]=i*(56/15+s*(-136/35+s*(-1262/105+s*(73814/2835)))),this.cbg[2]=i*(-26/15+s*(34/21+s*(1.6+s*(-12686/2835)))),i*=s,this.cgb[3]=i*(4279/630+s*(-332/35+s*(-399572/14175))),this.cbg[3]=i*(1237/630+s*(s*(-24832/14175)-2.4)),i*=s,this.cgb[4]=i*(4174/315+s*(-144838/6237)),this.cbg[4]=i*(-734/315+s*(109598/31185)),i*=s,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(s,2),this.Qn=this.k0/(1+s)*(1+i*(1/4+i*(1/64+i/256))),this.utg[0]=s*(s*(2/3+s*(-37/96+s*(1/360+s*(81/512+s*(-96199/604800)))))-.5),this.gtu[0]=s*(.5+s*(-2/3+s*(5/16+s*(41/180+s*(-127/288+s*(7891/37800)))))),this.utg[1]=i*(-1/48+s*(-1/15+s*(437/1440+s*(-46/105+s*(1118711/3870720))))),this.gtu[1]=i*(13/48+s*(s*(557/1440+s*(281/630+s*(-1983433/1935360)))-.6)),i*=s,this.utg[2]=i*(-17/480+s*(37/840+s*(209/4480+s*(-5569/90720)))),this.gtu[2]=i*(61/240+s*(-103/140+s*(15061/26880+s*(167603/181440)))),i*=s,this.utg[3]=i*(-4397/161280+s*(11/504+s*(830251/7257600))),this.gtu[3]=i*(49561/161280+s*(-179/168+s*(6601661/7257600))),i*=s,this.utg[4]=i*(-4583/161280+s*(108847/3991680)),this.gtu[4]=i*(34729/80640+s*(-3418889/1995840)),i*=s,this.utg[5]=i*(-20648693/638668800),this.gtu[5]=.6650675310896665*i;var a=us(this.cbg,this.lat0);this.Zb=-this.Qn*(a+function(t,s){for(var i,a=2*Math.cos(s),h=t.length-1,e=t[h],r=0;--h>=0;)i=a*e-r+t[h],r=e,e=i;return Math.sin(s)*i}(this.gtu,2*a))},forward:function(t){var s=U(t.x-this.long0),i=t.y;i=us(this.cbg,i);var a=Math.sin(i),h=Math.cos(i),e=Math.sin(s),r=Math.cos(s);i=Math.atan2(a,r*h),s=Math.atan2(e*h,os(a,h*r)),s=ls(Math.tan(s));var n,o,l=cs(this.gtu,2*i,2*s);return i+=l[0],s+=l[1],Math.abs(s)<=2.623395162778?(n=this.a*(this.Qn*s)+this.x0,o=this.a*(this.Qn*i+this.Zb)+this.y0):(n=1/0,o=1/0),t.x=n,t.y=o,t},inverse:function(t){var s,i,a=(t.x-this.x0)*(1/this.a),h=(t.y-this.y0)*(1/this.a);if(h=(h-this.Zb)/this.Qn,a/=this.Qn,Math.abs(a)<=2.623395162778){var e=cs(this.utg,2*h,2*a);h+=e[0],a+=e[1],a=Math.atan(ns(a));var r=Math.sin(h),n=Math.cos(h),o=Math.sin(a),l=Math.cos(a);h=Math.atan2(r*l,os(o,l*n)),s=U((a=Math.atan2(o,l*n))+this.long0),i=us(this.cgb,h)}else s=1/0,i=1/0;return t.x=s,t.y=i,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"]};var Ms={init:function(){var t=function(t,s){if(void 0===t){if((t=Math.floor(30*(U(s)+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,fs.init.apply(this),this.forward=fs.forward,this.inverse=fs.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function ps(t,s){return Math.pow((1-t)/(1+t),s)}var ds={init:function(){var t=Math.sin(this.lat0),s=Math.cos(this.lat0);s*=s,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*s*s/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+y)/(Math.pow(Math.tan(.5*this.lat0+y),this.C)*ps(this.e*t,this.ratexp))},forward:function(t){var s=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+y),this.C)*ps(this.e*Math.sin(i),this.ratexp))-l,t.x=this.C*s,t},inverse:function(t){for(var s=t.x/this.C,i=t.y,a=Math.pow(Math.tan(.5*i+y)/this.K,1/this.C),h=20;h>0&&(i=2*Math.atan(a*ps(this.e*Math.sin(t.y),-.5*this.e))-l,!(Math.abs(i-t.y)<1e-14));--h)t.y=i;return h?(t.x=s,t.y=i,t):null},names:["gauss"]};var ys={init:function(){ds.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 s,i,a,h;return t.x=U(t.x-this.long0),ds.forward.apply(this,[t]),s=Math.sin(t.y),i=Math.cos(t.y),a=Math.cos(t.x),h=this.k0*this.R2/(1+this.sinc0*s+this.cosc0*i*a),t.x=h*i*Math.sin(t.x),t.y=h*(this.cosc0*s-this.sinc0*i*a),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){var s,i,a,h,e;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,e=os(t.x,t.y)){var r=2*Math.atan2(e,this.R2);s=Math.sin(r),i=Math.cos(r),h=Math.asin(i*this.sinc0+t.y*s*this.cosc0/e),a=Math.atan2(t.x*s,e*this.cosc0*i-t.y*this.sinc0*s)}else h=this.phic0,a=0;return t.x=a,t.y=h,ds.inverse.apply(this,[t]),t.x=U(t.x+this.long0),t},names:["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};var ms={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,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)<=M&&(this.k0=.5*(1+F(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=M&&(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)<=M&&Math.abs(Math.cos(this.lat_ts))>M&&(this.k0=.5*this.cons*D(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Q(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=D(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-l,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var s,i,a,h,e,r,n=t.x,o=t.y,u=Math.sin(o),c=Math.cos(o),f=U(n-this.long0);return Math.abs(Math.abs(n-this.long0)-Math.PI)<=M&&Math.abs(o+this.lat0)<=M?(t.x=NaN,t.y=NaN,t):this.sphere?(s=2*this.k0/(1+this.sinlat0*u+this.coslat0*c*Math.cos(f)),t.x=this.a*s*c*Math.sin(f)+this.x0,t.y=this.a*s*(this.coslat0*u-this.sinlat0*c*Math.cos(f))+this.y0,t):(i=2*Math.atan(this.ssfn_(o,u,this.e))-l,h=Math.cos(i),a=Math.sin(i),Math.abs(this.coslat0)<=M?(e=Q(this.e,o*this.con,this.con*u),r=2*this.a*this.k0*e/this.cons,t.x=this.x0+r*Math.sin(n-this.long0),t.y=this.y0-this.con*r*Math.cos(n-this.long0),t):(Math.abs(this.sinlat0)<M?(s=2*this.a*this.k0/(1+h*Math.cos(f)),t.y=s*a):(s=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*a+this.cosX0*h*Math.cos(f))),t.y=s*(this.cosX0*a-this.sinX0*h*Math.cos(f))+this.y0),t.x=s*h*Math.sin(f)+this.x0,t))},inverse:function(t){var s,i,a,h,e;t.x-=this.x0,t.y-=this.y0;var r=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var n=2*Math.atan(r/(2*this.a*this.k0));return s=this.long0,i=this.lat0,r<=M?(t.x=s,t.y=i,t):(i=Math.asin(Math.cos(n)*this.sinlat0+t.y*Math.sin(n)*this.coslat0/r),s=Math.abs(this.coslat0)<M?this.lat0>0?U(this.long0+Math.atan2(t.x,-1*t.y)):U(this.long0+Math.atan2(t.x,t.y)):U(this.long0+Math.atan2(t.x*Math.sin(n),r*this.coslat0*Math.cos(n)-t.y*this.sinlat0*Math.sin(n))),t.x=s,t.y=i,t)}if(Math.abs(this.coslat0)<=M){if(r<=M)return i=this.lat0,s=this.long0,t.x=s,t.y=i,t;t.x*=this.con,t.y*=this.con,a=r*this.cons/(2*this.a*this.k0),i=this.con*W(this.e,a),s=this.con*U(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else h=2*Math.atan(r*this.cosX0/(2*this.a*this.k0*this.ms1)),s=this.long0,r<=M?e=this.X0:(e=Math.asin(Math.cos(h)*this.sinX0+t.y*Math.sin(h)*this.cosX0/r),s=U(this.long0+Math.atan2(t.x*Math.sin(h),r*this.cosX0*Math.cos(h)-t.y*this.sinX0*Math.sin(h)))),i=-1*W(this.e,Math.tan(.5*(l+e)));return t.x=s,t.y=i,t},names:["stere","Stereographic_South_Pole","Polar Stereographic (variant B)","Polar_Stereographic"],ssfn_:function(t,s,i){return s*=i,Math.tan(.5*(l+t))*Math.pow((1-s)/(1+s),.5*i)}};var _s={init:function(){var t=this.lat0;this.lambda0=this.long0;var s=Math.sin(t),i=this.a,a=1/this.rf,h=2*a-Math.pow(a,2),e=this.e=Math.sqrt(h);this.R=this.k0*i*Math.sqrt(1-h)/(1-h*Math.pow(s,2)),this.alpha=Math.sqrt(1+h/(1-h)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(s/this.alpha);var r=Math.log(Math.tan(Math.PI/4+this.b0/2)),n=Math.log(Math.tan(Math.PI/4+t/2)),o=Math.log((1+e*s)/(1-e*s));this.K=r-this.alpha*n+this.alpha*e/2*o},forward:function(t){var s=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))),a=-this.alpha*(s+i)+this.K,h=2*(Math.atan(Math.exp(a))-Math.PI/4),e=this.alpha*(t.x-this.lambda0),r=Math.atan(Math.sin(e)/(Math.sin(this.b0)*Math.tan(h)+Math.cos(this.b0)*Math.cos(e))),n=Math.asin(Math.cos(this.b0)*Math.sin(h)-Math.sin(this.b0)*Math.cos(h)*Math.cos(e));return t.y=this.R/2*Math.log((1+Math.sin(n))/(1-Math.sin(n)))+this.y0,t.x=this.R*r+this.x0,t},inverse:function(t){for(var s=t.x-this.x0,i=t.y-this.y0,a=s/this.R,h=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),e=Math.asin(Math.cos(this.b0)*Math.sin(h)+Math.sin(this.b0)*Math.cos(h)*Math.cos(a)),r=Math.atan(Math.sin(a)/(Math.cos(this.b0)*Math.cos(a)-Math.sin(this.b0)*Math.tan(h))),n=this.lambda0+r/this.alpha,o=0,l=e,u=-1e3,c=0;Math.abs(l-u)>1e-7;){if(++c>20)return;o=1/this.alpha*(Math.log(Math.tan(Math.PI/4+e/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),u=l,l=2*Math.atan(Math.exp(o))-Math.PI/2}return t.x=n,t.y=l,t},names:["somerc"]},gs=1e-7;var xs={init:function(){var t,s,i,a,h,e,r,n,o,u,c,f,d,_=0,g=0,x=0,v=0,b=0,w=0,A=0;this.no_off=(d="object"==typeof(f=this).PROJECTION?Object.keys(f.PROJECTION)[0]:f.PROJECTION,"no_uoff"in f||"no_off"in f||-1!==["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"].indexOf(d)),this.no_rot="no_rot"in this;var C=!1;"alpha"in this&&(C=!0);var N=!1;if("rectified_grid_angle"in this&&(N=!0),C&&(A=this.alpha),N&&(_=this.rectified_grid_angle*p),C||N)g=this.longc;else if(x=this.long1,b=this.lat1,v=this.long2,w=this.lat2,Math.abs(b-w)<=gs||(t=Math.abs(b))<=gs||Math.abs(t-l)<=gs||Math.abs(Math.abs(this.lat0)-l)<=gs||Math.abs(Math.abs(w)-l)<=gs)throw new Error;var P=1-this.es;s=Math.sqrt(P),Math.abs(this.lat0)>M?(n=Math.sin(this.lat0),i=Math.cos(this.lat0),t=1-this.es*n*n,this.B=i*i,this.B=Math.sqrt(1+this.es*this.B*this.B/P),this.A=this.B*this.k0*s/t,(h=(a=this.B*s/(i*Math.sqrt(t)))*a-1)<=0?h=0:(h=Math.sqrt(h),this.lat0<0&&(h=-h)),this.E=h+=a,this.E*=Math.pow(Q(this.e,this.lat0,n),this.B)):(this.B=1/s,this.A=this.k0,this.E=a=h=1),C||N?(C?(c=Math.asin(Math.sin(A)/a),N||(_=A)):(c=_,A=Math.asin(a*Math.sin(c))),this.lam0=g-Math.asin(.5*(h-1/h)*Math.tan(c))/this.B):(e=Math.pow(Q(this.e,b,Math.sin(b)),this.B),r=Math.pow(Q(this.e,w,Math.sin(w)),this.B),h=this.E/e,o=(r-e)/(r+e),u=((u=this.E*this.E)-r*e)/(u+r*e),(t=x-v)<-Math.pi?v-=m:t>Math.pi&&(v+=m),this.lam0=U(.5*(x+v)-Math.atan(u*Math.tan(.5*this.B*(x-v))/o)/this.B),c=Math.atan(2*Math.sin(this.B*U(x-this.lam0))/(h-1/h)),_=A=Math.asin(a*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,this.A,this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(a*a-1)/Math.cos(A))),this.lat0<0&&(this.u_0=-this.u_0)),h=.5*c,this.v_pole_n=this.ArB*Math.log(Math.tan(y-h)),this.v_pole_s=this.ArB*Math.log(Math.tan(y+h))},forward:function(t){var s,i,a,h,e,r,n,o,u={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-l)>M){if(s=.5*((e=this.E/Math.pow(Q(this.e,t.y,Math.sin(t.y)),this.B))-(r=1/e)),i=.5*(e+r),h=Math.sin(this.B*t.x),a=(s*this.singam-h*this.cosgam)/i,Math.abs(Math.abs(a)-1)<M)throw new Error;o=.5*this.ArB*Math.log((1-a)/(1+a)),r=Math.cos(this.B*t.x),n=Math.abs(r)<gs?this.A*t.x:this.ArB*Math.atan2(s*this.cosgam+h*this.singam,r)}else o=t.y>0?this.v_pole_n:this.v_pole_s,n=this.ArB*t.y;return this.no_rot?(u.x=n,u.y=o):(n-=this.u_0,u.x=o*this.cosrot+n*this.sinrot,u.y=n*this.cosrot-o*this.sinrot),u.x=this.a*u.x+this.x0,u.y=this.a*u.y+this.y0,u},inverse:function(t){var s,i,a,h,e,r,n,o={};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,s=t.x):(i=t.x*this.cosrot-t.y*this.sinrot,s=t.y*this.cosrot+t.x*this.sinrot+this.u_0),h=.5*((a=Math.exp(-this.BrA*i))-1/a),e=.5*(a+1/a),n=((r=Math.sin(this.BrA*s))*this.cosgam+h*this.singam)/e,Math.abs(Math.abs(n)-1)<M)o.x=0,o.y=n<0?-l:l;else{if(o.y=this.E/Math.sqrt((1+n)/(1-n)),o.y=W(this.e,Math.pow(o.y,1/this.B)),o.y===1/0)throw new Error;o.x=-this.rB*Math.atan2(h*this.cosgam-r*this.singam,Math.cos(this.BrA*s))}return o.x+=this.lam0,o},names:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"]};var vs={init:function(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<M)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var s=Math.sin(this.lat1),i=Math.cos(this.lat1),a=D(this.e,s,i),h=Q(this.e,this.lat1,s),e=Math.sin(this.lat2),r=Math.cos(this.lat2),n=D(this.e,e,r),o=Q(this.e,this.lat2,e),l=Q(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>M?this.ns=Math.log(a/n)/Math.log(h/o):this.ns=s,isNaN(this.ns)&&(this.ns=s),this.f0=a/(this.ns*Math.pow(h,this.ns)),this.rh=this.a*this.f0*Math.pow(l,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(t){var s=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=M&&(i=F(i)*(l-2*M));var a,h,e=Math.abs(Math.abs(i)-l);if(e>M)a=Q(this.e,i,Math.sin(i)),h=this.a*this.f0*Math.pow(a,this.ns);else{if((e=i*this.ns)<=0)return null;h=0}var r=this.ns*U(s-this.long0);return t.x=this.k0*(h*Math.sin(r))+this.x0,t.y=this.k0*(this.rh-h*Math.cos(r))+this.y0,t},inverse:function(t){var s,i,a,h,e,r=(t.x-this.x0)/this.k0,n=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(s=Math.sqrt(r*r+n*n),i=1):(s=-Math.sqrt(r*r+n*n),i=-1);var o=0;if(0!==s&&(o=Math.atan2(i*r,i*n)),0!==s||this.ns>0){if(i=1/this.ns,a=Math.pow(s/(this.a*this.f0),i),-9999===(h=W(this.e,a)))return null}else h=-l;return e=U(o/this.ns+this.long0),t.x=e,t.y=h,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)"]};var bs={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 s,i,a,h,e,r,n,o=t.x,l=t.y,u=U(o-this.long0);return s=Math.pow((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(l/2+this.s45),this.alfa)/s)-this.s45),a=-u*this.alfa,h=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(a)),e=Math.asin(Math.cos(i)*Math.sin(a)/Math.cos(h)),r=this.n*e,n=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(h/2+this.s45),this.n),t.y=n*Math.cos(r)/1,t.x=n*Math.sin(r)/1,this.czech||(t.y*=-1,t.x*=-1),t},inverse:function(t){var s,i,a,h,e,r,n,o=t.x;t.x=t.y,t.y=o,this.czech||(t.y*=-1,t.x*=-1),e=Math.sqrt(t.x*t.x+t.y*t.y),h=Math.atan2(t.y,t.x)/Math.sin(this.s0),a=2*(Math.atan(Math.pow(this.ro0/e,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),s=Math.asin(Math.cos(this.ad)*Math.sin(a)-Math.sin(this.ad)*Math.cos(a)*Math.cos(h)),i=Math.asin(Math.cos(a)*Math.sin(h)/Math.cos(s)),t.x=this.long0-i/this.alfa,r=s,n=0;var l=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(s/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(r))/(1-this.e*Math.sin(r)),this.e/2))-this.s45),Math.abs(r-t.y)<1e-10&&(n=1),r=t.y,l+=1}while(0===n&&l<15);return l>=15?null:t},names:["Krovak","krovak"]};function ws(t,s,i,a,h){return t*h-s*Math.sin(2*h)+i*Math.sin(4*h)-a*Math.sin(6*h)}function As(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function Cs(t){return.375*t*(1+.25*t*(1+.46875*t))}function Ns(t){return.05859375*t*t*(1+.75*t)}function Ps(t){return t*t*t*(35/3072)}function Es(t,s,i){var a=s*i;return t/Math.sqrt(1-a*a)}function Ss(t){return Math.abs(t)<l?t:t-F(t)*Math.PI}function Is(t,s,i,a,h){var e,r;e=t/s;for(var n=0;n<15;n++)if(e+=r=(t-(s*e-i*Math.sin(2*e)+a*Math.sin(4*e)-h*Math.sin(6*e)))/(s-2*i*Math.cos(2*e)+4*a*Math.cos(4*e)-6*h*Math.cos(6*e)),Math.abs(r)<=1e-10)return e;return NaN}var ks={init:function(){this.sphere||(this.e0=As(this.es),this.e1=Cs(this.es),this.e2=Ns(this.es),this.e3=Ps(this.es),this.ml0=this.a*ws(this.e0,this.e1,this.e2,this.e3,this.lat0))},forward:function(t){var s,i,a=t.x,h=t.y;if(a=U(a-this.long0),this.sphere)s=this.a*Math.asin(Math.cos(h)*Math.sin(a)),i=this.a*(Math.atan2(Math.tan(h),Math.cos(a))-this.lat0);else{var e=Math.sin(h),r=Math.cos(h),n=Es(this.a,this.e,e),o=Math.tan(h)*Math.tan(h),l=a*Math.cos(h),u=l*l,c=this.es*r*r/(1-this.es);s=n*l*(1-u*o*(1/6-(8-o+8*c)*u/120)),i=this.a*ws(this.e0,this.e1,this.e2,this.e3,h)-this.ml0+n*e/r*u*(.5+(5-o+6*c)*u/24)}return t.x=s+this.x0,t.y=i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var s,i,a=t.x/this.a,h=t.y/this.a;if(this.sphere){var e=h+this.lat0;s=Math.asin(Math.sin(e)*Math.cos(a)),i=Math.atan2(Math.tan(a),Math.cos(e))}else{var r=Is(this.ml0/this.a+h,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(r)-l)<=M)return t.x=this.long0,t.y=l,h<0&&(t.y*=-1),t;var n=Es(this.a,this.e,Math.sin(r)),o=n*n*n/this.a/this.a*(1-this.es),u=Math.pow(Math.tan(r),2),c=a*this.a/n,f=c*c;s=r-n*Math.tan(r)/o*c*c*(.5-(1+3*u)*c*c/24),i=c*(1-f*(u/3+(1+3*u)*u*f/15))/Math.cos(r)}return t.x=U(i+this.long0),t.y=Ss(s),t},names:["Cassini","Cassini_Soldner","cass"]};function Os(t,s){var i;return t>1e-7?(1-t*t)*(s/(1-(i=t*s)*i)-.5/t*Math.log((1-i)/(1+i))):2*s}var qs=.3333333333333333,Rs=.17222222222222222,Ls=.10257936507936508,js=.06388888888888888,Gs=.0664021164021164,Ts=.016415012942191543;var zs={init:function(){var t,s=Math.abs(this.lat0);if(Math.abs(s-l)<M?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(s)<M?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0)switch(this.qp=Os(this.e,1),this.mmf=.5/(1-this.es),this.apa=function(t){var s,i=[];return i[0]=t*qs,s=t*t,i[0]+=s*Rs,i[1]=s*js,s*=t,i[0]+=s*Ls,i[1]+=s*Gs,i[2]=s*Ts,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),t=Math.sin(this.lat0),this.sinb1=Os(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*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 s,i,a,h,e,r,n,o,u,c,f=t.x,p=t.y;if(f=U(f-this.long0),this.sphere){if(e=Math.sin(p),c=Math.cos(p),a=Math.cos(f),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+c*a:1+this.sinph0*e+this.cosph0*c*a)<=M)return null;s=(i=Math.sqrt(2/i))*c*Math.sin(f),i*=this.mode===this.EQUIT?e:this.cosph0*e-this.sinph0*c*a}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(a=-a),Math.abs(p+this.lat0)<M)return null;i=y-.5*p,s=(i=2*(this.mode===this.S_POLE?Math.cos(i):Math.sin(i)))*Math.sin(f),i*=a}}else{switch(n=0,o=0,u=0,a=Math.cos(f),h=Math.sin(f),e=Math.sin(p),r=Os(this.e,e),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(n=r/this.qp,o=Math.sqrt(1-n*n)),this.mode){case this.OBLIQ:u=1+this.sinb1*n+this.cosb1*o*a;break;case this.EQUIT:u=1+o*a;break;case this.N_POLE:u=l+p,r=this.qp-r;break;case this.S_POLE:u=p-l,r=this.qp+r}if(Math.abs(u)<M)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:u=Math.sqrt(2/u),i=this.mode===this.OBLIQ?this.ymf*u*(this.cosb1*n-this.sinb1*o*a):(u=Math.sqrt(2/(1+o*a)))*n*this.ymf,s=this.xmf*u*o*h;break;case this.N_POLE:case this.S_POLE:r>=0?(s=(u=Math.sqrt(r))*h,i=a*(this.mode===this.S_POLE?u:-u)):s=i=0}}return t.x=this.a*s+this.x0,t.y=this.a*i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var s,i,a,h,e,r,n,o,u,c,f=t.x/this.a,p=t.y/this.a;if(this.sphere){var d,y=0,m=0;if((i=.5*(d=Math.sqrt(f*f+p*p)))>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(m=Math.sin(i),y=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(d)<=M?0:Math.asin(p*m/d),f*=m,p=y*d;break;case this.OBLIQ:i=Math.abs(d)<=M?this.lat0:Math.asin(y*this.sinph0+p*m*this.cosph0/d),f*=m*this.cosph0,p=(y-Math.sin(i)*this.sinph0)*d;break;case this.N_POLE:p=-p,i=l-i;break;case this.S_POLE:i-=l}s=0!==p||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(f,p):0}else{if(n=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(f/=this.dd,p*=this.dd,(r=Math.sqrt(f*f+p*p))<M)return t.x=this.long0,t.y=this.lat0,t;h=2*Math.asin(.5*r/this.rq),a=Math.cos(h),f*=h=Math.sin(h),this.mode===this.OBLIQ?(n=a*this.sinb1+p*h*this.cosb1/r,e=this.qp*n,p=r*this.cosb1*a-p*this.sinb1*h):(n=p*h/r,e=this.qp*n,p=r*a)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(p=-p),!(e=f*f+p*p))return t.x=this.long0,t.y=this.lat0,t;n=1-e/this.qp,this.mode===this.S_POLE&&(n=-n)}s=Math.atan2(f,p),o=Math.asin(n),u=this.apa,c=o+o,i=o+u[0]*Math.sin(c)+u[1]*Math.sin(c+c)+u[2]*Math.sin(c+c+c)}return t.x=U(this.long0+s),t.y=i,t},names:["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4};function Bs(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}var Ds={init:function(){Math.abs(this.lat1+this.lat2)<M||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=D(this.e3,this.sin_po,this.cos_po),this.qs1=Os(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=D(this.e3,this.sin_po,this.cos_po),this.qs2=Os(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Os(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>M?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 s=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var a=Os(this.e3,this.sin_phi),h=this.a*Math.sqrt(this.c-this.ns0*a)/this.ns0,e=this.ns0*U(s-this.long0),r=h*Math.sin(e)+this.x0,n=this.rh-h*Math.cos(e)+this.y0;return t.x=r,t.y=n,t},inverse:function(t){var s,i,a,h,e,r;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(s=Math.sqrt(t.x*t.x+t.y*t.y),a=1):(s=-Math.sqrt(t.x*t.x+t.y*t.y),a=-1),h=0,0!==s&&(h=Math.atan2(a*t.x,a*t.y)),a=s*this.ns0/this.a,this.sphere?r=Math.asin((this.c-a*a)/(2*this.ns0)):(i=(this.c-a*a)/this.ns0,r=this.phi1z(this.e3,i)),e=U(h/this.ns0+this.long0),t.x=e,t.y=r,t},names:["Albers_Conic_Equal_Area","Albers","aea"],phi1z:function(t,s){var i,a,h,e,r=Bs(.5*s);if(t<M)return r;for(var n=t*t,o=1;o<=25;o++)if(r+=e=.5*(h=1-(a=t*(i=Math.sin(r)))*a)*h/Math.cos(r)*(s/(1-n)-i/h+.5/t*Math.log((1-a)/(1+a))),Math.abs(e)<=1e-7)return r;return null}};var Fs={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1},forward:function(t){var s,i,a,h,e,r,n,o=t.x,l=t.y;return a=U(o-this.long0),s=Math.sin(l),i=Math.cos(l),h=Math.cos(a),1,(e=this.sin_p14*s+this.cos_p14*i*h)>0||Math.abs(e)<=M?(r=this.x0+1*this.a*i*Math.sin(a)/e,n=this.y0+1*this.a*(this.cos_p14*s-this.sin_p14*i*h)/e):(r=this.x0+this.infinity_dist*i*Math.sin(a),n=this.y0+this.infinity_dist*(this.cos_p14*s-this.sin_p14*i*h)),t.x=r,t.y=n,t},inverse:function(t){var s,i,a,h,e,r;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,(s=Math.sqrt(t.x*t.x+t.y*t.y))?(h=Math.atan2(s,this.rc),i=Math.sin(h),r=Bs((a=Math.cos(h))*this.sin_p14+t.y*i*this.cos_p14/s),e=Math.atan2(t.x*i,s*this.cos_p14*a-t.y*this.sin_p14*i),e=U(this.long0+e)):(r=this.phic0,e=0),t.x=e,t.y=r,t},names:["gnom"]};var Us={init:function(){this.sphere||(this.k0=D(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var s,i,a=t.x,h=t.y,e=U(a-this.long0);if(this.sphere)s=this.x0+this.a*e*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(h)/Math.cos(this.lat_ts);else{var r=Os(this.e,Math.sin(h));s=this.x0+this.a*this.k0*e,i=this.y0+this.a*r*.5/this.k0}return t.x=s,t.y=i,t},inverse:function(t){var s,i;return t.x-=this.x0,t.y-=this.y0,this.sphere?(s=U(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,s){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(s)-i)<1e-6)return s<0?-1*l:l;for(var a,h,e,r,n=Math.asin(.5*s),o=0;o<30;o++)if(h=Math.sin(n),e=Math.cos(n),r=t*h,n+=a=Math.pow(1-r*r,2)/(2*e)*(s/(1-t*t)-h/(1-r*r)+.5/t*Math.log((1-r)/(1+r))),Math.abs(a)<=1e-10)return n;return NaN}(this.e,2*t.y*this.k0/this.a),s=U(this.long0+t.x/(this.a*this.k0))),t.x=s,t.y=i,t},names:["cea"]};var Qs={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 s=t.x,i=t.y,a=U(s-this.long0),h=Ss(i-this.lat0);return t.x=this.x0+this.a*a*this.rc,t.y=this.y0+this.a*h,t},inverse:function(t){var s=t.x,i=t.y;return t.x=U(this.long0+(s-this.x0)/(this.a*this.rc)),t.y=Ss(this.lat0+(i-this.y0)/this.a),t},names:["Equirectangular","Equidistant_Cylindrical","eqc"]};var Ws={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=As(this.es),this.e1=Cs(this.es),this.e2=Ns(this.es),this.e3=Ps(this.es),this.ml0=this.a*ws(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var s,i,a,h=t.x,e=t.y,r=U(h-this.long0);if(a=r*Math.sin(e),this.sphere)Math.abs(e)<=M?(s=this.a*r,i=-1*this.a*this.lat0):(s=this.a*Math.sin(a)/Math.tan(e),i=this.a*(Ss(e-this.lat0)+(1-Math.cos(a))/Math.tan(e)));else if(Math.abs(e)<=M)s=this.a*r,i=-1*this.ml0;else{var n=Es(this.a,this.e,Math.sin(e))/Math.tan(e);s=n*Math.sin(a),i=this.a*ws(this.e0,this.e1,this.e2,this.e3,e)-this.ml0+n*(1-Math.cos(a))}return t.x=s+this.x0,t.y=i+this.y0,t},inverse:function(t){var s,i,a,h,e,r,n,o,l;if(a=t.x-this.x0,h=t.y-this.y0,this.sphere)if(Math.abs(h+this.a*this.lat0)<=M)s=U(a/this.a+this.long0),i=0;else{var u;for(r=this.lat0+h/this.a,n=a*a/this.a/this.a+r*r,o=r,e=20;e;--e)if(o+=l=-1*(r*(o*(u=Math.tan(o))+1)-o-.5*(o*o+n)*u)/((o-r)/u-1),Math.abs(l)<=M){i=o;break}s=U(this.long0+Math.asin(a*Math.tan(o)/this.a)/Math.sin(i))}else if(Math.abs(h+this.ml0)<=M)i=0,s=U(this.long0+a/this.a);else{var c,f,p,d,y;for(r=(this.ml0+h)/this.a,n=a*a/this.a/this.a+r*r,o=r,e=20;e;--e)if(y=this.e*Math.sin(o),c=Math.sqrt(1-y*y)*Math.tan(o),f=this.a*ws(this.e0,this.e1,this.e2,this.e3,o),p=this.e0-2*this.e1*Math.cos(2*o)+4*this.e2*Math.cos(4*o)-6*this.e3*Math.cos(6*o),o-=l=(r*(c*(d=f/this.a)+1)-d-.5*c*(d*d+n))/(this.es*Math.sin(2*o)*(d*d+n-2*r*d)/(4*c)+(r-d)*(c*p-2/Math.sin(2*o))-p),Math.abs(l)<=M){i=o;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),s=U(this.long0+Math.asin(a*c/this.a)/Math.sin(i))}return t.x=s,t.y=i,t},names:["Polyconic","poly"]};var Zs={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 s,i=t.x,a=t.y-this.lat0,h=i-this.long0,e=a/o*1e-5,r=h,n=1,l=0;for(s=1;s<=10;s++)n*=e,l+=this.A[s]*n;var u,c=l,f=r,M=1,p=0,d=0,y=0;for(s=1;s<=6;s++)u=p*c+M*f,M=M*c-p*f,p=u,d=d+this.B_re[s]*M-this.B_im[s]*p,y=y+this.B_im[s]*M+this.B_re[s]*p;return t.x=y*this.a+this.x0,t.y=d*this.a+this.y0,t},inverse:function(t){var s,i,a=t.x,h=t.y,e=a-this.x0,r=(h-this.y0)/this.a,n=e/this.a,l=1,u=0,c=0,f=0;for(s=1;s<=6;s++)i=u*r+l*n,l=l*r-u*n,u=i,c=c+this.C_re[s]*l-this.C_im[s]*u,f=f+this.C_im[s]*l+this.C_re[s]*u;for(var M=0;M<this.iterations;M++){var p,d=c,y=f,m=r,_=n;for(s=2;s<=6;s++)p=y*c+d*f,d=d*c-y*f,y=p,m+=(s-1)*(this.B_re[s]*d-this.B_im[s]*y),_+=(s-1)*(this.B_im[s]*d+this.B_re[s]*y);d=1,y=0;var g=this.B_re[1],x=this.B_im[1];for(s=2;s<=6;s++)p=y*c+d*f,d=d*c-y*f,y=p,g+=s*(this.B_re[s]*d-this.B_im[s]*y),x+=s*(this.B_im[s]*d+this.B_re[s]*y);var v=g*g+x*x;c=(m*g+_*x)/v,f=(_*g-m*x)/v}var b=c,w=f,A=1,C=0;for(s=1;s<=9;s++)A*=b,C+=this.D[s]*A;var N=this.lat0+C*o*1e5,P=this.long0+w;return t.x=P,t.y=N,t},names:["New_Zealand_Map_Grid","nzmg"]};var Hs={init:function(){},forward:function(t){var s=t.x,i=t.y,a=U(s-this.long0),h=this.x0+this.a*a,e=this.y0+this.a*Math.log(Math.tan(Math.PI/4+i/2.5))*1.25;return t.x=h,t.y=e,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var s=U(this.long0+t.x/this.a),i=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=s,t.y=i,t},names:["Miller_Cylindrical","mill"]};var Vs={init:function(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=is(this.es)},forward:function(t){var s,i,a=t.x,h=t.y;if(a=U(a-this.long0),this.sphere){if(this.m)for(var e=this.n*Math.sin(h),r=20;r;--r){var n=(this.m*h+Math.sin(h)-e)/(this.m+Math.cos(h));if(h-=n,Math.abs(n)<M)break}else h=1!==this.n?Math.asin(this.n*Math.sin(h)):h;s=this.a*this.C_x*a*(this.m+Math.cos(h)),i=this.a*this.C_y*h}else{var o=Math.sin(h),l=Math.cos(h);i=this.a*as(h,o,l,this.en),s=this.a*a*l/Math.sqrt(1-this.es*o*o)}return t.x=s,t.y=i,t},inverse:function(t){var s,i,a;return t.x-=this.x0,i=t.x/this.a,t.y-=this.y0,s=t.y/this.a,this.sphere?(s/=this.C_y,i/=this.C_x*(this.m+Math.cos(s)),this.m?s=Bs((this.m*s+Math.sin(s))/this.n):1!==this.n&&(s=Bs(Math.sin(s)/this.n)),i=U(i+this.long0),s=Ss(s)):(s=es(t.y/this.a,this.es,this.en),(a=Math.abs(s))<l?(a=Math.sin(s),i=U(this.long0+t.x*Math.sqrt(1-this.es*a*a)/(this.a*Math.cos(s)))):a-M<l&&(i=this.long0)),t.x=i,t.y=s,t},names:["Sinusoidal","sinu"]};var Xs={init:function(){},forward:function(t){for(var s=t.x,i=t.y,a=U(s-this.long0),h=i,e=Math.PI*Math.sin(i);;){var r=-(h+Math.sin(h)-e)/(1+Math.cos(h));if(h+=r,Math.abs(r)<M)break}h/=2,Math.PI/2-Math.abs(i)<M&&(a=0);var n=.900316316158*this.a*a*Math.cos(h)+this.x0,o=1.4142135623731*this.a*Math.sin(h)+this.y0;return t.x=n,t.y=o,t},inverse:function(t){var s,i;t.x-=this.x0,t.y-=this.y0,i=t.y/(1.4142135623731*this.a),Math.abs(i)>.999999999999&&(i=.999999999999),s=Math.asin(i);var a=U(this.long0+t.x/(.900316316158*this.a*Math.cos(s)));a<-Math.PI&&(a=-Math.PI),a>Math.PI&&(a=Math.PI),i=(2*s+Math.sin(2*s))/Math.PI,Math.abs(i)>1&&(i=1);var h=Math.asin(i);return t.x=a,t.y=h,t},names:["Mollweide","moll"]};var Js={init:function(){Math.abs(this.lat1+this.lat2)<M||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=As(this.es),this.e1=Cs(this.es),this.e2=Ns(this.es),this.e3=Ps(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=D(this.e,this.sinphi,this.cosphi),this.ml1=ws(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<M?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=D(this.e,this.sinphi,this.cosphi),this.ml2=ws(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=ws(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))},forward:function(t){var s,i=t.x,a=t.y;if(this.sphere)s=this.a*(this.g-a);else{var h=ws(this.e0,this.e1,this.e2,this.e3,a);s=this.a*(this.g-h)}var e=this.ns*U(i-this.long0),r=this.x0+s*Math.sin(e),n=this.y0+this.rh-s*Math.cos(e);return t.x=r,t.y=n,t},inverse:function(t){var s,i,a,h;t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns>=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),s=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),s=-1);var e=0;return 0!==i&&(e=Math.atan2(s*t.x,s*t.y)),this.sphere?(h=U(this.long0+e/this.ns),a=Ss(this.g-i/this.a),t.x=h,t.y=a,t):(a=Is(this.g-i/this.a,this.e0,this.e1,this.e2,this.e3),h=U(this.long0+e/this.ns),t.x=h,t.y=a,t)},names:["Equidistant_Conic","eqdc"]};var Ks={init:function(){this.R=this.a},forward:function(t){var s,i,a=t.x,h=t.y,e=U(a-this.long0);Math.abs(h)<=M&&(s=this.x0+this.R*e,i=this.y0);var r=Bs(2*Math.abs(h/Math.PI));(Math.abs(e)<=M||Math.abs(Math.abs(h)-l)<=M)&&(s=this.x0,i=h>=0?this.y0+Math.PI*this.R*Math.tan(.5*r):this.y0+Math.PI*this.R*-Math.tan(.5*r));var n=.5*Math.abs(Math.PI/e-e/Math.PI),o=n*n,u=Math.sin(r),c=Math.cos(r),f=c/(u+c-1),p=f*f,d=f*(2/u-1),y=d*d,m=Math.PI*this.R*(n*(f-y)+Math.sqrt(o*(f-y)*(f-y)-(y+o)*(p-y)))/(y+o);e<0&&(m=-m),s=this.x0+m;var _=o+f;return m=Math.PI*this.R*(d*_-n*Math.sqrt((y+o)*(o+1)-_*_))/(y+o),i=h>=0?this.y0+m:this.y0-m,t.x=s,t.y=i,t},inverse:function(t){var s,i,a,h,e,r,n,o,l,u,c,f;return t.x-=this.x0,t.y-=this.y0,c=Math.PI*this.R,e=(a=t.x/c)*a+(h=t.y/c)*h,c=3*(h*h/(o=-2*(r=-Math.abs(h)*(1+e))+1+2*h*h+e*e)+(2*(n=r-2*h*h+a*a)*n*n/o/o/o-9*r*n/o/o)/27)/(l=(r-n*n/3/o)/o)/(u=2*Math.sqrt(-l/3)),Math.abs(c)>1&&(c=c>=0?1:-1),f=Math.acos(c)/3,i=t.y>=0?(-u*Math.cos(f+Math.PI/3)-n/3/o)*Math.PI:-(-u*Math.cos(f+Math.PI/3)-n/3/o)*Math.PI,s=Math.abs(a)<M?this.long0:U(this.long0+Math.PI*(e-1+Math.sqrt(1+2*(a*a-h*h)+e*e))/2/a),t.x=s,t.y=i,t},names:["Van_der_Grinten_I","VanDerGrinten","vandg"]};var $s={init:function(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)},forward:function(t){var s,i,a,h,e,r,n,o,u,c,f,p,d,y,m,_,g,x,v,b,w,A,C=t.x,N=t.y,P=Math.sin(t.y),E=Math.cos(t.y),S=U(C-this.long0);return this.sphere?Math.abs(this.sin_p12-1)<=M?(t.x=this.x0+this.a*(l-N)*Math.sin(S),t.y=this.y0-this.a*(l-N)*Math.cos(S),t):Math.abs(this.sin_p12+1)<=M?(t.x=this.x0+this.a*(l+N)*Math.sin(S),t.y=this.y0+this.a*(l+N)*Math.cos(S),t):(x=this.sin_p12*P+this.cos_p12*E*Math.cos(S),g=(_=Math.acos(x))?_/Math.sin(_):1,t.x=this.x0+this.a*g*E*Math.sin(S),t.y=this.y0+this.a*g*(this.cos_p12*P-this.sin_p12*E*Math.cos(S)),t):(s=As(this.es),i=Cs(this.es),a=Ns(this.es),h=Ps(this.es),Math.abs(this.sin_p12-1)<=M?(e=this.a*ws(s,i,a,h,l),r=this.a*ws(s,i,a,h,N),t.x=this.x0+(e-r)*Math.sin(S),t.y=this.y0-(e-r)*Math.cos(S),t):Math.abs(this.sin_p12+1)<=M?(e=this.a*ws(s,i,a,h,l),r=this.a*ws(s,i,a,h,N),t.x=this.x0+(e+r)*Math.sin(S),t.y=this.y0+(e+r)*Math.cos(S),t):(n=P/E,o=Es(this.a,this.e,this.sin_p12),u=Es(this.a,this.e,P),c=Math.atan((1-this.es)*n+this.es*o*this.sin_p12/(u*E)),v=0===(f=Math.atan2(Math.sin(S),this.cos_p12*Math.tan(c)-this.sin_p12*Math.cos(S)))?Math.asin(this.cos_p12*Math.sin(c)-this.sin_p12*Math.cos(c)):Math.abs(Math.abs(f)-Math.PI)<=M?-Math.asin(this.cos_p12*Math.sin(c)-this.sin_p12*Math.cos(c)):Math.asin(Math.sin(S)*Math.cos(c)/Math.sin(f)),p=this.e*this.sin_p12/Math.sqrt(1-this.es),_=o*v*(1-(b=v*v)*(m=(d=this.e*this.cos_p12*Math.cos(f)/Math.sqrt(1-this.es))*d)*(1-m)/6+(w=b*v)/8*(y=p*d)*(1-2*m)+(A=w*v)/120*(m*(4-7*m)-3*p*p*(1-7*m))-A*v/48*y),t.x=this.x0+_*Math.sin(f),t.y=this.y0+_*Math.cos(f),t))},inverse:function(t){var s,i,a,h,e,r,n,o,u,c,f,p,d,y,m,_,g,x,v,b,w,A,C;if(t.x-=this.x0,t.y-=this.y0,this.sphere){if((s=Math.sqrt(t.x*t.x+t.y*t.y))>2*l*this.a)return;return i=s/this.a,a=Math.sin(i),h=Math.cos(i),e=this.long0,Math.abs(s)<=M?r=this.lat0:(r=Bs(h*this.sin_p12+t.y*a*this.cos_p12/s),n=Math.abs(this.lat0)-l,e=Math.abs(n)<=M?this.lat0>=0?U(this.long0+Math.atan2(t.x,-t.y)):U(this.long0-Math.atan2(-t.x,t.y)):U(this.long0+Math.atan2(t.x*a,s*this.cos_p12*h-t.y*this.sin_p12*a))),t.x=e,t.y=r,t}return o=As(this.es),u=Cs(this.es),c=Ns(this.es),f=Ps(this.es),Math.abs(this.sin_p12-1)<=M?(r=Is(((p=this.a*ws(o,u,c,f,l))-(s=Math.sqrt(t.x*t.x+t.y*t.y)))/this.a,o,u,c,f),e=U(this.long0+Math.atan2(t.x,-1*t.y)),t.x=e,t.y=r,t):Math.abs(this.sin_p12+1)<=M?(p=this.a*ws(o,u,c,f,l),r=Is(((s=Math.sqrt(t.x*t.x+t.y*t.y))-p)/this.a,o,u,c,f),e=U(this.long0+Math.atan2(t.x,t.y)),t.x=e,t.y=r,t):(s=Math.sqrt(t.x*t.x+t.y*t.y),m=Math.atan2(t.x,t.y),d=Es(this.a,this.e,this.sin_p12),_=Math.cos(m),x=-(g=this.e*this.cos_p12*_)*g/(1-this.es),v=3*this.es*(1-x)*this.sin_p12*this.cos_p12*_/(1-this.es),A=1-x*(w=(b=s/d)-x*(1+x)*Math.pow(b,3)/6-v*(1+3*x)*Math.pow(b,4)/24)*w/2-b*w*w*w/6,y=Math.asin(this.sin_p12*Math.cos(w)+this.cos_p12*Math.sin(w)*_),e=U(this.long0+Math.asin(Math.sin(m)*Math.sin(w)/Math.cos(y))),C=Math.sin(y),r=Math.atan2((C-this.es*A*this.sin_p12)*Math.tan(y),C*(1-this.es)),t.x=e,t.y=r,t)},names:["Azimuthal_Equidistant","aeqd"]};var Ys={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)},forward:function(t){var s,i,a,h,e,r,n,o=t.x,l=t.y;return a=U(o-this.long0),s=Math.sin(l),i=Math.cos(l),h=Math.cos(a),1,((e=this.sin_p14*s+this.cos_p14*i*h)>0||Math.abs(e)<=M)&&(r=1*this.a*i*Math.sin(a),n=this.y0+1*this.a*(this.cos_p14*s-this.sin_p14*i*h)),t.x=r,t.y=n,t},inverse:function(t){var s,i,a,h,e,r,n;return t.x-=this.x0,t.y-=this.y0,i=Bs((s=Math.sqrt(t.x*t.x+t.y*t.y))/this.a),a=Math.sin(i),h=Math.cos(i),r=this.long0,Math.abs(s)<=M?(n=this.lat0,t.x=r,t.y=n,t):(n=Bs(h*this.sin_p14+t.y*a*this.cos_p14/s),e=Math.abs(this.lat0)-l,Math.abs(e)<=M?(r=this.lat0>=0?U(this.long0+Math.atan2(t.x,-t.y)):U(this.long0-Math.atan2(-t.x,t.y)),t.x=r,t.y=n,t):(r=U(this.long0+Math.atan2(t.x*a,s*this.cos_p14*h-t.y*this.sin_p14*a)),t.x=r,t.y=n,t))},names:["ortho"]},ti=1,si=2,ii=3,ai=4,hi=5,ei=6,ri={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function ni(t,s,i,a){var h;return t<M?(a.value=ri.AREA_0,h=0):(h=Math.atan2(s,i),Math.abs(h)<=y?a.value=ri.AREA_0:h>y&&h<=l+y?(a.value=ri.AREA_1,h-=l):h>l+y||h<=-(l+y)?(a.value=ri.AREA_2,h=h>=0?h-_:h+_):(a.value=ri.AREA_3,h+=l)),h}function oi(t,s){var i=t+s;return i<-_?i+=m:i>+_&&(i-=m),i}var li={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>=l-y/2?this.face=hi:this.lat0<=-(l-y/2)?this.face=ei:Math.abs(this.long0)<=y?this.face=ti:Math.abs(this.long0)<=l+y?this.face=this.long0>0?si:ai:this.face=ii,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 s,i,a,h,e,r,n={x:0,y:0},o={value:0};if(t.x-=this.long0,s=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y,i=t.x,this.face===hi)h=l-s,i>=y&&i<=l+y?(o.value=ri.AREA_0,a=i-l):i>l+y||i<=-(l+y)?(o.value=ri.AREA_1,a=i>0?i-_:i+_):i>-(l+y)&&i<=-y?(o.value=ri.AREA_2,a=i+l):(o.value=ri.AREA_3,a=i);else if(this.face===ei)h=l+s,i>=y&&i<=l+y?(o.value=ri.AREA_0,a=-i+l):i<y&&i>=-y?(o.value=ri.AREA_1,a=-i):i<-y&&i>=-(l+y)?(o.value=ri.AREA_2,a=-i-l):(o.value=ri.AREA_3,a=i>0?-i+_:-i-_);else{var u,c,f,M,p,d;this.face===si?i=oi(i,+l):this.face===ii?i=oi(i,+_):this.face===ai&&(i=oi(i,-l)),M=Math.sin(s),p=Math.cos(s),d=Math.sin(i),u=p*Math.cos(i),c=p*d,f=M,this.face===ti?a=ni(h=Math.acos(u),f,c,o):this.face===si?a=ni(h=Math.acos(c),f,-u,o):this.face===ii?a=ni(h=Math.acos(-u),f,-c,o):this.face===ai?a=ni(h=Math.acos(-c),f,u,o):(h=a=0,o.value=ri.AREA_0)}return r=Math.atan(12/_*(a+Math.acos(Math.sin(a)*Math.cos(y))-l)),e=Math.sqrt((1-Math.cos(h))/(Math.cos(r)*Math.cos(r))/(1-Math.cos(Math.atan(1/Math.cos(a))))),o.value===ri.AREA_1?r+=l:o.value===ri.AREA_2?r+=_:o.value===ri.AREA_3&&(r+=1.5*_),n.x=e*Math.cos(r),n.y=e*Math.sin(r),n.x=n.x*this.a+this.x0,n.y=n.y*this.a+this.y0,t.x=n.x,t.y=n.y,t},inverse:function(t){var s,i,a,h,e,r,n,o,u,c,f,M,p={lam:0,phi:0},d={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)),s=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?d.value=ri.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(d.value=ri.AREA_1,s-=l):t.x<0&&-t.x>=Math.abs(t.y)?(d.value=ri.AREA_2,s=s<0?s+_:s-_):(d.value=ri.AREA_3,s+=l),u=_/12*Math.tan(s),e=Math.sin(u)/(Math.cos(u)-1/Math.sqrt(2)),r=Math.atan(e),(n=1-(a=Math.cos(s))*a*(h=Math.tan(i))*h*(1-Math.cos(Math.atan(1/Math.cos(r)))))<-1?n=-1:n>1&&(n=1),this.face===hi)o=Math.acos(n),p.phi=l-o,d.value===ri.AREA_0?p.lam=r+l:d.value===ri.AREA_1?p.lam=r<0?r+_:r-_:d.value===ri.AREA_2?p.lam=r-l:p.lam=r;else if(this.face===ei)o=Math.acos(n),p.phi=o-l,d.value===ri.AREA_0?p.lam=-r+l:d.value===ri.AREA_1?p.lam=-r:d.value===ri.AREA_2?p.lam=-r-l:p.lam=r<0?-r-_:-r+_;else{var y,m,g;u=(y=n)*y,m=(u+=(g=u>=1?0:Math.sqrt(1-u)*Math.sin(r))*g)>=1?0:Math.sqrt(1-u),d.value===ri.AREA_1?(u=m,m=-g,g=u):d.value===ri.AREA_2?(m=-m,g=-g):d.value===ri.AREA_3&&(u=m,m=g,g=-u),this.face===si?(u=y,y=-m,m=u):this.face===ii?(y=-y,m=-m):this.face===ai&&(u=y,y=m,m=-u),p.phi=Math.acos(-g)-l,p.lam=Math.atan2(m,y),this.face===si?p.lam=oi(p.lam,-l):this.face===ii?p.lam=oi(p.lam,-_):this.face===ai&&(p.lam=oi(p.lam,+l))}return 0!==this.es&&(c=p.phi<0?1:0,f=Math.tan(p.phi),M=this.b/Math.sqrt(f*f+this.one_minus_f_squared),p.phi=Math.atan(Math.sqrt(this.a*this.a-M*M)/(this.one_minus_f*M)),c&&(p.phi=-p.phi)),p.lam+=this.long0,t.x=p.lam,t.y=p.phi,t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]},ui=[[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]],ci=[[-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]],fi=.8487,Mi=1.3523,pi=d/5,di=1/pi,yi=18,mi=function(t,s){return t[0]+s*(t[1]+s*(t[2]+s*t[3]))};var _i={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 s=U(t.x-this.long0),i=Math.abs(t.y),a=Math.floor(i*pi);a<0?a=0:a>=yi&&(a=17);var h={x:mi(ui[a],i=d*(i-di*a))*s,y:mi(ci[a],i)};return t.y<0&&(h.y=-h.y),h.x=h.x*this.a*fi+this.x0,h.y=h.y*this.a*Mi+this.y0,h},inverse:function(t){var s={x:(t.x-this.x0)/(this.a*fi),y:Math.abs(t.y-this.y0)/(this.a*Mi)};if(s.y>=1)s.x/=ui[18][0],s.y=t.y<0?-l:l;else{var i=Math.floor(s.y*yi);for(i<0?i=0:i>=yi&&(i=17);;)if(ci[i][0]>s.y)--i;else{if(!(ci[i+1][0]<=s.y))break;++i}var a=ci[i],h=5*(s.y-a[0])/(ci[i+1][0]-a[0]);h=function(t,s,i,a){for(var h=s;a;--a){var e=t(h);if(h-=e,Math.abs(e)<i)break}return h}((function(t){return(mi(a,t)-s.y)/function(t,s){return t[1]+s*(2*t[2]+3*s*t[3])}(a,t)}),h,M,100),s.x/=mi(ui[i],h),s.y=(5*i+h)*p,t.y<0&&(s.y=-s.y)}return s.x=U(s.x+this.long0),s},names:["Robinson","robin"]};var gi={init:function(){this.name="geocent"},forward:function(t){return ut(t,this.es,this.a)},inverse:function(t){return ct(t,this.es,this.a,this.b)},names:["Geocentric","geocentric","geocent","Geocent"]},xi=0,vi=1,bi=2,wi=3,Ai={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};var Ci={init:function(){if(Object.keys(Ai).forEach(function(t){if(void 0===this[t])this[t]=Ai[t].def;else{if(Ai[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);Ai[t].num&&(this[t]=parseFloat(this[t]))}Ai[t].degrees&&(this[t]=this[t]*p)}.bind(this)),Math.abs(Math.abs(this.lat0)-l)<M?this.mode=this.lat0<0?vi:xi:Math.abs(this.lat0)<M?this.mode=bi:(this.mode=wi,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var t=this.tilt,s=this.azi;this.cg=Math.cos(s),this.sg=Math.sin(s),this.cw=Math.cos(t),this.sw=Math.sin(t)},forward:function(t){t.x-=this.long0;var s,i,a,h,e=Math.sin(t.y),r=Math.cos(t.y),n=Math.cos(t.x);switch(this.mode){case wi:i=this.sinph0*e+this.cosph0*r*n;break;case bi:i=r*n;break;case vi:i=-e;break;case xi:i=e}switch(s=(i=this.pn1/(this.p-i))*r*Math.sin(t.x),this.mode){case wi:i*=this.cosph0*e-this.sinph0*r*n;break;case bi:i*=e;break;case xi:i*=-r*n;break;case vi:i*=r*n}return h=1/((a=i*this.cg+s*this.sg)*this.sw*this.h1+this.cw),s=(s*this.cg-i*this.sg)*this.cw*h,i=a*h,t.x=s*this.a,t.y=i*this.a,t},inverse:function(t){t.x/=this.a,t.y/=this.a;var s,i,a,h={x:t.x,y:t.y};a=1/(this.pn1-t.y*this.sw),s=this.pn1*t.x*a,i=this.pn1*t.y*this.cw*a,t.x=s*this.cg+i*this.sg,t.y=i*this.cg-s*this.sg;var e=os(t.x,t.y);if(Math.abs(e)<M)h.x=0,h.y=t.y;else{var r,n;switch(n=1-e*e*this.pfact,n=(this.p-Math.sqrt(n))/(this.pn1/e+e/this.pn1),r=Math.sqrt(1-n*n),this.mode){case wi:h.y=Math.asin(r*this.sinph0+t.y*n*this.cosph0/e),t.y=(r-this.sinph0*Math.sin(h.y))*e,t.x*=n*this.cosph0;break;case bi:h.y=Math.asin(t.y*n/e),t.y=r*e,t.x*=n;break;case xi:h.y=Math.asin(r),t.y=-t.y;break;case vi:h.y=-Math.asin(r)}h.x=Math.atan2(t.x,t.y)}return t.x=h.x+this.long0,t.y=h.y,t},names:["Tilted_Perspective","tpers"]};var Ni={init:function(){if(this.flip_axis="x"===this.sweep?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>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,s=1/t;this.radius_p=Math.sqrt(t),this.radius_p2=t,this.radius_p_inv2=s,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 s,i,a,h,e=t.x,r=t.y;if(e-=this.long0,"ellipse"===this.shape){r=Math.atan(this.radius_p2*Math.tan(r));var n=this.radius_p/os(this.radius_p*Math.cos(r),Math.sin(r));if(i=n*Math.cos(e)*Math.cos(r),a=n*Math.sin(e)*Math.cos(r),h=n*Math.sin(r),(this.radius_g-i)*i-a*a-h*h*this.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;s=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(a/os(h,s)),t.y=this.radius_g_1*Math.atan(h/s)):(t.x=this.radius_g_1*Math.atan(a/s),t.y=this.radius_g_1*Math.atan(h/os(a,s)))}else"sphere"===this.shape&&(s=Math.cos(r),i=Math.cos(e)*s,a=Math.sin(e)*s,h=Math.sin(r),s=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(a/os(h,s)),t.y=this.radius_g_1*Math.atan(h/s)):(t.x=this.radius_g_1*Math.atan(a/s),t.y=this.radius_g_1*Math.atan(h/os(a,s))));return t.x=t.x*this.a,t.y=t.y*this.a,t},inverse:function(t){var s,i,a,h,e=-1,r=0,n=0;if(t.x=t.x/this.a,t.y=t.y/this.a,"ellipse"===this.shape){this.flip_axis?(n=Math.tan(t.y/this.radius_g_1),r=Math.tan(t.x/this.radius_g_1)*os(1,n)):(r=Math.tan(t.x/this.radius_g_1),n=Math.tan(t.y/this.radius_g_1)*os(1,r));var o=n/this.radius_p;if(s=r*r+o*o+e*e,(a=(i=2*this.radius_g*e)*i-4*s*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;h=(-i-Math.sqrt(a))/(2*s),e=this.radius_g+h*e,r*=h,n*=h,t.x=Math.atan2(r,e),t.y=Math.atan(n*Math.cos(t.x)/e),t.y=Math.atan(this.radius_p_inv2*Math.tan(t.y))}else if("sphere"===this.shape){if(this.flip_axis?(n=Math.tan(t.y/this.radius_g_1),r=Math.tan(t.x/this.radius_g_1)*Math.sqrt(1+n*n)):(r=Math.tan(t.x/this.radius_g_1),n=Math.tan(t.y/this.radius_g_1)*Math.sqrt(1+r*r)),s=r*r+n*n+e*e,(a=(i=2*this.radius_g*e)*i-4*s*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;h=(-i-Math.sqrt(a))/(2*s),e=this.radius_g+h*e,r*=h,n*=h,t.x=Math.atan2(r,e),t.y=Math.atan(n*Math.cos(t.x)/e)}return t.x=t.x+this.long0,t},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]};At.defaultDatum="WGS84",At.Proj=lt,At.WGS84=new At.Proj("WGS84"),At.Point=Ut,At.toPoint=_t,At.defs=j,At.nadgrid=function(t,s){var i=new DataView(s),a=function(t){var s=t.getInt32(8,!1);if(11===s)return!1;s=t.getInt32(8,!0),11!==s&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian");return!0}(i),h=function(t,s){return{nFields:t.getInt32(8,s),nSubgridFields:t.getInt32(24,s),nSubgrids:t.getInt32(40,s),shiftType:et(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,s),fromSemiMinorAxis:t.getFloat64(136,s),toSemiMajorAxis:t.getFloat64(152,s),toSemiMinorAxis:t.getFloat64(168,s)}}(i,a),e=function(t,s,i){for(var a=176,h=[],e=0;e<s.nSubgrids;e++){var r=nt(t,a,i),n=ot(t,a,r,i),o=Math.round(1+(r.upperLongitude-r.lowerLongitude)/r.longitudeInterval),l=Math.round(1+(r.upperLatitude-r.lowerLatitude)/r.latitudeInterval);h.push({ll:[ht(r.lowerLongitude),ht(r.lowerLatitude)],del:[ht(r.longitudeInterval),ht(r.latitudeInterval)],lim:[o,l],count:r.gridNodeCount,cvs:rt(n)}),a+=176+16*r.gridNodeCount}return h}(i,h,a),r={header:h,subgrids:e};return it[t]=r,r},At.transform=xt,At.mgrs=qt,At.version="__VERSION__",function(t){t.Proj.projections.add(rs),t.Proj.projections.add(fs),t.Proj.projections.add(Ms),t.Proj.projections.add(ys),t.Proj.projections.add(ms),t.Proj.projections.add(_s),t.Proj.projections.add(xs),t.Proj.projections.add(vs),t.Proj.projections.add(bs),t.Proj.projections.add(ks),t.Proj.projections.add(zs),t.Proj.projections.add(Ds),t.Proj.projections.add(Fs),t.Proj.projections.add(Us),t.Proj.projections.add(Qs),t.Proj.projections.add(Ws),t.Proj.projections.add(Zs),t.Proj.projections.add(Hs),t.Proj.projections.add(Vs),t.Proj.projections.add(Xs),t.Proj.projections.add(Js),t.Proj.projections.add(Ks),t.Proj.projections.add($s),t.Proj.projections.add(Ys),t.Proj.projections.add(li),t.Proj.projections.add(_i),t.Proj.projections.add(gi),t.Proj.projections.add(Ci),t.Proj.projections.add(Ni)}(At);var Pi,Ei="deflate-raw",Si=self.DecompressionStream;try{new Si(Ei),Pi=async t=>{let s=new Si(Ei),i=s.writable.getWriter(),a=s.readable.getReader();i.write(t),i.close();let h,e,r=[],n=0,o=0;for(;!(e=await a.read()).done;)h=e.value,r.push(h),n+=h.length;return r.length-1?(h=new Uint8Array(n),r.map((t=>{h.set(t,o),o+=t.length})),h):r[0]}}catch{}var Ii=new TextDecoder,ki=t=>{throw new Error("but-unzip~"+t)},Oi=t=>Ii.decode(t);function*qi(t,s=Pi){let i=(t=>{let s=t.length-20,i=Math.max(s-65516,2);for(;-1!==(s=t.lastIndexOf(80,s-1))&&(75!==t[s+1]||5!==t[s+2]||6!==t[s+3])&&s>i;);return s})(t);-1===i&&ki(2);let a=(s,a)=>t.subarray(i+=s,i+=a),h=new DataView(t.buffer,t.byteOffset),e=t=>h.getUint16(t+i,!0),r=t=>h.getUint32(t+i,!0),n=e(10);for(n!==e(8)&&ki(3),i=r(16);n--;){let t,h=e(10),n=e(28),o=e(30),l=e(32),u=r(20),c=r(42),f=Oi(a(46,n)),M=Oi(a(o,l)),p=i;i=c,t=a(30+e(26)+e(28),u),yield{filename:f,comment:M,read:()=>8&h?s(t):h?ki(1):t},i=p}}const Ri=/.+\.(shp|dbf|json|prj|cpg)$/i;const Li=globalThis.URL;var ji=(t,s)=>{if(!s)return t;const i=new Li(t);return i.pathname=`${i.pathname}.${s}`,i.href};async function Gi(t,s){const i=ji(t,s),a="prj"===s||"cpg"===s;try{const t=await fetch(i);if(t.status>399)throw new Error(t.statusText);if(a)return t.text();const s=await t.arrayBuffer();return new DataView(s)}catch(t){if(a||"dbf"===s)return!1;throw t}}function Ti(t){let s=0,i=1;const a=t.length;let h,e;const r=[t[0][0],t[0][1],t[0][0],t[0][1]];for(;i<a;)h=e||t[0],e=t[i],s+=(e[0]-h[0])*(e[1]+h[1]),i++,e[0]<r[0]&&(r[0]=e[0]),e[1]<r[1]&&(r[1]=e[1]),e[0]>r[2]&&(r[2]=e[0]),e[1]>r[3]&&(r[3]=e[1]);return{ring:t,clockWise:s>0,bbox:r,children:[]}}function zi(t,s){return!(t.bbox[0]>s.bbox[0])&&(!(t.bbox[1]>s.bbox[1])&&(!(t.bbox[2]<s.bbox[2])&&!(t.bbox[3]<s.bbox[3])))}function Bi(t,s=!1){const i=[],a=[];for(const h of t){const t=Ti(h);t.clockWise!==s?i.push(t):a.push(t)}const h=[];for(const t of a){let s;for(const a of i)zi(a,t)&&(s?zi(s,a)&&(s=a):s=a);s?s.children.push(t.ring):h.push(t)}if(s)return{outers:i,orphens:h};if(h.length&&!s){const s=Bi(t,!0);if(0===s.orphens.length){const t=[];for(const i of s.outers)t.push([i.ring.toReversed()].concat(i.children.map((t=>t.toReversed()))));return t}}const e=[];for(const t of i)e.push([t.ring].concat(t.children));return e}Fi.prototype.parsePoint=function(t){return{type:"Point",coordinates:this.parseCoord(t,0)}},Fi.prototype.parseZPoint=function(t){const s=this.parsePoint(t);return s.coordinates.push(t.getFloat64(16,!0)),s},Fi.prototype.parsePointArray=function(t,s,i){const a=[];let h=0;for(;h<i;)a.push(this.parseCoord(t,s)),s+=16,h++;return a},Fi.prototype.parseZPointArray=function(t,s,i,a){let h=0;for(;h<i;)a[h].push(t.getFloat64(s,!0)),h++,s+=8;return a},Fi.prototype.parseArrayGroup=function(t,s,i,a,h){const e=[];let r,n,o=0,l=0;for(;o<a;)o++,i+=4,r=l,l=o===a?h:t.getInt32(i,!0),n=l-r,n&&(e.push(this.parsePointArray(t,s,n)),s+=n<<4);return e},Fi.prototype.parseZArrayGroup=function(t,s,i,a){let h=0;for(;h<i;)a[h]=this.parseZPointArray(t,s,a[h].length,a[h]),s+=a[h].length<<3,h++;return a},Fi.prototype.parseMultiPoint=function(t){const s={},i=t.getInt32(32,!0);if(!i)return null;const a=this.parseCoord(t,0),h=this.parseCoord(t,16);s.bbox=[a[0],a[1],h[0],h[1]];return 1===i?(s.type="Point",s.coordinates=this.parseCoord(t,36)):(s.type="MultiPoint",s.coordinates=this.parsePointArray(t,36,i)),s},Fi.prototype.parseZMultiPoint=function(t){const s=this.parseMultiPoint(t);if(!s)return null;let i;if("Point"===s.type)return s.coordinates.push(t.getFloat64(72,!0)),s;i=s.coordinates.length;const a=52+(i<<4);return s.coordinates=this.parseZPointArray(t,a,i,s.coordinates),s},Fi.prototype.parsePolyline=function(t){const s={},i=t.getInt32(32,!0);if(!i)return null;const a=this.parseCoord(t,0),h=this.parseCoord(t,16);s.bbox=[a[0],a[1],h[0],h[1]];const e=t.getInt32(36,!0);let r,n;return 1===i?(s.type="LineString",r=44,s.coordinates=this.parsePointArray(t,r,e)):(s.type="MultiLineString",r=40+(i<<2),n=40,s.coordinates=this.parseArrayGroup(t,r,40,i,e)),s},Fi.prototype.parseZPolyline=function(t){const s=this.parsePolyline(t);if(!s)return null;const i=s.coordinates.length;let a;if("LineString"===s.type)return a=60+(i<<4),s.coordinates=this.parseZPointArray(t,a,i,s.coordinates),s;return a=56+(s.coordinates.reduce((function(t,s){return t+s.length}),0)<<4)+(i<<2),s.coordinates=this.parseZArrayGroup(t,a,i,s.coordinates),s},Fi.prototype.polyFuncs=function(t){return t?"LineString"===t.type?(t.type="Polygon",t.coordinates=[t.coordinates],t):(t.coordinates=Bi(t.coordinates),1===t.coordinates.length?(t.type="Polygon",t.coordinates=t.coordinates[0],t):(t.type="MultiPolygon",t)):t},Fi.prototype.parsePolygon=function(t){return this.polyFuncs(this.parsePolyline(t))},Fi.prototype.parseZPolygon=function(t){return this.polyFuncs(this.parseZPolyline(t))};const Di={1:"parsePoint",3:"parsePolyline",5:"parsePolygon",8:"parseMultiPoint",11:"parseZPoint",13:"parseZPolyline",15:"parseZPolygon",18:"parseZMultiPoint"};function Fi(t,s){if(!(this instanceof Fi))return new Fi(t,s);this.buffer=t,this.headers=this.parseHeader(),this.shpFuncs(s),this.rows=this.getRows()}function Ui(t,s){return new Fi(t,s).rows}Fi.prototype.shpFuncs=function(t){let s=this.headers.shpCode;if(s>20&&(s-=20),!(s in Di))throw new Error(`I don't know shp type "${s}"`);var i;this.parseFunc=this[Di[s]],this.parseCoord=(i=t)?function(t,s){const a=[t.getFloat64(s,!0),t.getFloat64(s+8,!0)];return i.inverse(a)}:function(t,s){return[t.getFloat64(s,!0),t.getFloat64(s+8,!0)]}},Fi.prototype.getShpCode=function(){return this.parseHeader().shpCode},Fi.prototype.parseHeader=function(){const t=this.buffer;return{length:t.getInt32(24)<<1,version:t.getInt32(28,!0),shpCode:t.getInt32(32,!0),bbox:[t.getFloat64(36,!0),t.getFloat64(44,!0),t.getFloat64(52,!0),t.getFloat64(60,!0)]}},Fi.prototype.getRows=function(){let t=100;const s=this.buffer.byteLength-8,i=[];let a;for(;t<=s&&(a=this.getRow(t),a);)t+=8,t+=a.len,a.type?i.push(this.parseFunc(a.data)):i.push(null);return i},Fi.prototype.getRow=function(t){const s=this.buffer.getInt32(t),i=this.buffer.getInt32(t+4)<<1;return 0===i?{id:s,len:i,type:0}:t+i+8>this.buffer.byteLength?void 0:{id:s,len:i,data:new DataView(this.buffer.buffer,this.buffer.byteOffset+t+12,i-4),type:this.buffer.getInt32(t+8,!0)}};var Qi=/^(?:ANSI\s)?(\d+)$/m;function Wi(t,s){if(!t)return a;try{new TextDecoder(t.trim())}catch(h){var i=Qi.exec(t);return i&&!s?Wi("windows-"+i[1],!0):(t=void 0,a)}return a;function a(s){var i=new TextDecoder(t||void 0);return(i.decode(s,{stream:!0})+i.decode()).replace(/\0/g,"").trim()}}function Zi(t,s,i,a,h){var e=h(new Uint8Array(t.buffer.slice(t.byteOffset+s,t.byteOffset+s+i)));switch(a){case"N":case"F":case"O":return parseFloat(e,10);case"D":return new Date(e.slice(0,4),parseInt(e.slice(4,6),10)-1,e.slice(6,8));case"L":return"y"===e.toLowerCase()||"t"===e.toLowerCase();default:return e}}function Hi(t,s,i,a){for(var h,e,r={},n=0,o=i.length;n<o;)h=Zi(t,s,(e=i[n]).len,e.dataType,a),s+=e.len,void 0!==h&&(r[e.name]=h),n++;return r}function Vi(t,s){for(var i=Wi(s),a=function(t){var s={};return s.lastUpdated=new Date(t.getUint8(1)+1900,t.getUint8(2),t.getUint8(3)),s.records=t.getUint32(4,!0),s.headerLen=t.getUint16(8,!0),s.recLen=t.getUint16(10,!0),s}(t),h=function(t,s,i){for(var a=[],h=32;h<s&&(a.push({name:i(new Uint8Array(t.buffer.slice(t.byteOffset+h,t.byteOffset+h+11))),dataType:String.fromCharCode(t.getUint8(h+11)),len:t.getUint8(h+16),decimal:t.getUint8(h+17)}),13!==t.getUint8(h+32));)h+=32;return a}(t,a.headerLen-1,i),e=2+(h.length+1<<5),r=a.recLen,n=a.records,o=[];n;)o.push(Hi(t,e,h,i)),e+=r,n--;return o}const Xi=globalThis.URL,Ji=new TextDecoder,Ki=t=>{if(t)return"string"==typeof t?t:Yi(t)||ArrayBuffer.isView(t)||ta(t)?Ji.decode(t):void 0},$i=t=>{if(!t)throw new Error("forgot to pass buffer");if(ta(t))return t;if(Yi(t))return new DataView(t);if(Yi(t.buffer))return new DataView(t.buffer,t.byteOffset,t.byteLength);throw new Error("invalid buffer like object")};function Yi(t){return t instanceof globalThis.ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(t)}function ta(t){return t instanceof globalThis.DataView||"[object DataView]"===Object.prototype.toString.call(t)}const sa=function([t,s]){const i={type:"FeatureCollection",features:[]};let a=0;const h=t.length;for(s||(s=[]);a<h;)i.features.push({type:"Feature",geometry:t[a],properties:s[a]||{}}),a++;return i},ia=async function(t,s){let i;t=(t=>{if(!t)throw new Error("forgot to pass buffer");if(Yi(t))return new Uint8Array(t);if(Yi(t.buffer))return 1===t.BYTES_PER_ELEMENT?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("invalid buffer like object")})(t);const a=await(async t=>{const s={},i=[];for(const a of qi(t))Ri.test(a.filename)&&i.push(Promise.resolve(a.read()).then((t=>s[a.filename]=t)));await Promise.all(i);const a={},h=new TextDecoder;for(const[t,i]of Object.entries(s))"shp"===t.slice(-3).toLowerCase()||"dbf"===t.slice(-3).toLowerCase()?a[t]=new DataView(i.buffer,i.byteOffset,i.byteLength):a[t]=h.decode(i);return a})(t),h=[];for(i in s=s||[],a)-1===i.indexOf("__MACOSX")&&(".shp"===i.slice(-4).toLowerCase()?(h.push(i.slice(0,-4)),a[i.slice(0,-3)+i.slice(-3).toLowerCase()]=a[i]):".prj"===i.slice(-4).toLowerCase()?a[i.slice(0,-3)+i.slice(-3).toLowerCase()]=At(a[i]):".json"===i.slice(-5).toLowerCase()||s.indexOf(i.split(".").pop())>-1?h.push(i.slice(0,-3)+i.slice(-3).toLowerCase()):".dbf"!==i.slice(-4).toLowerCase()&&".cpg"!==i.slice(-4).toLowerCase()||(a[i.slice(0,-3)+i.slice(-3).toLowerCase()]=a[i]));if(!h.length)throw new Error("no layers founds");const e=h.map((function(t){let i,h;const e=t.lastIndexOf(".");return e>-1&&t.slice(e).indexOf("json")>-1?(i=JSON.parse(a[t]),i.fileName=t.slice(0,e)):s.indexOf(t.slice(e+1))>-1?(i=a[t],i.fileName=t):(a[t+".dbf"]&&(h=Vi(a[t+".dbf"],a[t+".cpg"])),i=sa([Ui(a[t+".shp"],a[t+".prj"]),h]),i.fileName=t),i}));return 1===e.length?e[0]:e};const aa=async t=>{const s=await Promise.all([Gi(t,"shp"),Gi(t,"prj")]);let i=!1;try{s[1]&&(i=At(s[1]))}catch(t){i=!1}return Ui(s[0],i)},ha=async t=>{const[s,i]=await Promise.all([Gi(t,"dbf"),Gi(t,"cpg")]);if(s)return Vi(s,i)},ea=(t,s)=>new Xi(t,globalThis?.document?.location).pathname.slice(-4).toLowerCase()===s,ra=async function(t,s){if("string"!=typeof t){if(Yi(t)||ArrayBuffer.isView(t)||ta(t))return ia(t);if(t.shp)return(({shp:t,dbf:s,cpg:i,prj:a})=>{const h=[na(t,a)];return s&&h.push(oa(s,i)),sa(h)})(t);throw new TypeError("must be a string, some sort of Buffer, or an object with at least a .shp property")}if(ea(t,".zip"))return async function(t,s){const i=await Gi(t);return ia(i,s)}(t,s);ea(t,".shp")&&(t=t.slice(0,-4));const i=await Promise.all([aa(t),ha(t)]);return sa(i)},na=function(t,s){if(t=$i(t),"string"==typeof(s=Ki(s)))try{s=At(s)}catch(t){s=!1}return Ui(t,s)},oa=function(t,s){return Vi(t=$i(t),s=Ki(s))};return ra.combine=sa,ra.parseDbf=oa,ra.parseZip=ia,ra.parseShp=na,ra}));