PageSourceSearch

https://postboxmap.co.uk/_next/static/chunks/3246.b1c030068b891746.js

js postboxmap.co.uk collected 2026-10-04 17:12:55 UTC 15,801 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3246],{3246:function(t,e,r){r.r(e),r.d(e,{Dms:function(){return s},LatLon:function(){return w},default:function(){return N}});let i=" ";class a{static get separator(){return i}static set separator(t){i=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);let e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let r=null;switch(e.length){case 3:r=e[0]/1+e[1]/60+e[2]/3600;break;case 2:r=e[0]/1+e[1]/60;break;case 1:r=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(r=-r),Number(r)}static toDms(t,e="d",r){if(isNaN(t)||"string"==typeof t&&""==t.trim()||"boolean"==typeof t||t==1/0||null==t)return null;if(void 0===r)switch(e){case"d":case"deg":r=4;break;case"dm":case"deg+min":r=2;break;case"dms":case"deg+min+sec":r=0;break;default:e="d",r=4}t=Math.abs(t);let i=null,s=null,o=null,n=null;switch(e){default:case"d":case"deg":(s=t.toFixed(r))<100&&(s="0"+s),s<10&&(s="0"+s),i=s+"\xb0";break;case"dm":case"deg+min":s=Math.floor(t),60==(o=(60*t%60).toFixed(r))&&(o=0..toFixed(r),s++),s=("000"+s).slice(-3),o<10&&(o="0"+o),i=s+"\xb0"+a.separator+o+"′";break;case"dms":case"deg+min+sec":s=Math.floor(t),o=Math.floor(3600*t/60)%60,60==(n=(3600*t%60).toFixed(r))&&(n=0..toFixed(r),o++),60==o&&(o=0,s++),s=("000"+s).slice(-3),o=("00"+o).slice(-2),n<10&&(n="0"+n),i=s+"\xb0"+a.separator+o+"′"+a.separator+n+"″"}return i}static toLat(t,e,r){let i=a.toDms(a.wrap90(t),e,r);return null===i?"–":i.slice(1)+a.separator+(t<0?"S":"N")}static toLon(t,e,r){let i=a.toDms(a.wrap180(t),e,r);return null===i?"–":i+a.separator+(t<0?"W":"E")}static toBrng(t,e,r){let i=a.toDms(a.wrap360(t),e,r);return null===i?"–":i.replace("360","0")}static fromLocale(t){let e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(r.thousands,"⁜").replace(r.decimal,".").replace("⁜",",")}static toLocale(t){let e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",r.decimal).replace("⁜",r.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw RangeError(`invalid precision ‘${e}’`);t=a.wrap360(t);let r=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*r/360)%r*16/r]}static wrap90(t){return -90<=t&&t<=90?t:1*Math.abs(((t-90)%360+360)%360-180)-90}static wrap180(t){return -180<=t&&t<=180?t:((360*t/360-180)%360+360)%360-180}static wrap360(t){return 0<=t&&t<360?t:(360*t/360%360+360)%360}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return this*180/Math.PI};var s=a;class o{constructor(t,e,r){if(isNaN(t)||isNaN(e)||isNaN(r))throw TypeError(`invalid vector [${t},${e},${r}]`);this.x=Number(t),this.y=Number(e),this.z=Number(r)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}plus(t){if(!(t instanceof o))throw TypeError("v is not Vector3d object");return new o(this.x+t.x,this.y+t.y,this.z+t.z)}minus(t){if(!(t instanceof o))throw TypeError("v is not Vector3d object");return new o(this.x-t.x,this.y-t.y,this.z-t.z)}times(t){if(isNaN(t))throw TypeError(`invalid scalar value ‘${t}’`);return new o(this.x*t,this.y*t,this.z*t)}dividedBy(t){if(isNaN(t))throw TypeError(`invalid scalar value ‘${t}’`);return new o(this.x/t,this.y/t,this.z/t)}dot(t){if(!(t instanceof o))throw TypeError("v is not Vector3d object");return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){if(!(t instanceof o))throw TypeError("v is not Vector3d object");return new o(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)}negate(){return new o(-this.x,-this.y,-this.z)}unit(){let t=this.length;return 1==t||0==t?this:new o(this.x/t,this.y/t,this.z/t)}angleTo(t,e){if(!(t instanceof o))throw TypeError("v is not Vector3d object");if(!(e instanceof o||void 0==e))throw TypeError("n is not Vector3d object");let r=void 0==e||this.cross(t).dot(e)>=0?1:-1;return Math.atan2(this.cross(t).length*r,this.dot(t))}
1rotateAround(t,e){if(!(t instanceof o))throw TypeError("axis is not Vector3d object");let r=e.toRadians(),i=this.unit(),a=t.unit(),s=Math.sin(r),n=Math.cos(r),l=1-n,h=a.x,d=a.y,u=a.z,c=[[l*h*h+n,l*h*d-s*u,l*h*u+s*d],[l*h*d+s*u,l*d*d+n,l*d*u-s*h],[l*h*u-s*d,l*d*u+s*h,l*u*u+n]],p=[c[0][0]*i.x+c[0][1]*i.y+c[0][2]*i.z,c[1][0]*i.x+c[1][1]*i.y+c[1][2]*i.z,c[2][0]*i.x+c[2][1]*i.y+c[2][2]*i.z];return new o(p[0],p[1],p[2])}toString(t=3){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return this*180/Math.PI};var n=o;let l={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},h={WGS84:{ellipsoid:l.WGS84}};Object.freeze(l.WGS84),Object.freeze(h.WGS84);class d{constructor(t,e,r=0){if(isNaN(t)||null==t)throw TypeError(`invalid lat ‘${t}’`);if(isNaN(e)||null==e)throw TypeError(`invalid lon ‘${e}’`);if(isNaN(r)||null==r)throw TypeError(`invalid height ‘${r}’`);this._lat=s.wrap90(Number(t)),this._lon=s.wrap180(Number(e)),this._height=Number(r)}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?s.wrap90(s.parse(t)):s.wrap90(Number(t)),isNaN(this._lat))throw TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?s.wrap90(s.parse(t)):s.wrap90(Number(t)),isNaN(this._lat))throw TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?s.wrap180(s.parse(t)):s.wrap180(Number(t)),isNaN(this._lon))throw TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?s.wrap180(s.parse(t)):s.wrap180(Number(t)),isNaN(this._lon))throw TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?s.wrap180(s.parse(t)):s.wrap180(Number(t)),isNaN(this._lon))throw TypeError(`invalid longitude ‘${t}’`)}get height(){return this._height}set height(t){if(this._height=Number(t),isNaN(this._height))throw TypeError(`invalid height ‘${t}’`)}get datum(){return this._datum}set datum(t){this._datum=t}static get ellipsoids(){return l}static get datums(){return h}static parse(...t){let e,r,i;if(0==t.length)throw TypeError("invalid (empty) point");if("object"==typeof t[0]&&(1==t.length||!isNaN(parseFloat(t[1])))){let a=t[0];if("Point"==a.type&&Array.isArray(a.coordinates)?([r,e,i]=a.coordinates,i=i||0):(void 0!=a.latitude&&(e=a.latitude),void 0!=a.lat&&(e=a.lat),void 0!=a.longitude&&(r=a.longitude),void 0!=a.lng&&(r=a.lng),void 0!=a.lon&&(r=a.lon),void 0!=a.height&&(i=a.height),e=s.wrap90(s.parse(e)),r=s.wrap180(s.parse(r))),void 0!=t[1]&&(i=t[1]),isNaN(e)||isNaN(r))throw TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if("string"==typeof t[0]&&2==t[0].split(",").length&&([e,r]=t[0].split(","),e=s.wrap90(s.parse(e)),r=s.wrap180(s.parse(r)),i=t[1]||0,isNaN(e)||isNaN(r)))throw TypeError(`invalid point ‘${t[0]}’`);if(void 0==e&&void 0==r&&([e,r]=t,e=s.wrap90(s.parse(e)),r=s.wrap180(s.parse(r)),i=t[2]||0,isNaN(e)||isNaN(r)))throw TypeError(`invalid point ‘${t.toString()}’`);return new this(e,r,i)}toCartesian(){let t=this.datum?this.datum.ellipsoid:this.referenceFrame?this.referenceFrame.ellipsoid:l.WGS84,e=this.lat.toRadians(),r=this.lon.toRadians(),i=this.height,{a,f:s}=t,o=Math.sin(e),n=Math.cos(e),h=2*s-s*s,d=a/Math.sqrt(1-h*o*o);return new u((d+i)*n*Math.cos(r),(d+i)*n*Math.sin(r),(d*(1-h)+i)*o)}equals(t){if(!(t instanceof d))throw TypeError(`invalid point ‘${t}’`);return!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON||Math.abs(this.height-t.height)>Number.EPSILON)&&this.datum==t.datum&&this.referenceFrame==t.referenceFrame&&this.epoch==t.epoch}toString(t="d",e,r=null){if(!["d","dm","dms","n"].includes(t))throw RangeError(`invalid format ‘${t}’`);let i=(this.height>=0?" +":" ")+this.height.toFixed(r)+"m";if("n"==t){void 0==e&&(e=4);let t=this.lat.toFixed(e),a=this.lon.toFixed(e);return`${t}, ${a}${null==r?"":i}`}let a=s.toLat(this.lat,t,e),o=s.toLon(this.lon,t,e);return`${a}, ${o}${null==r?"":i}`}}class u extends n{constructor(t,e,r){super(t,e,r)}toLatLon(t=l.WGS84){if(!t||!t.a)throw TypeError(`invalid ellipsoid ‘${t}’`);let{x:e,y:r,z:i}=this,{a,b:s,f:o}=t,n=2*o-o*o,h=n/(1-n),u=Math.sqrt(e*e+r*r),c=s*i/(a*u)*(1+h*s/Math.sqrt(u*u+i*i)),p=c/Math.sqrt(1+c*c),m=p/c,f=isNaN(m)?0:Math.atan2(i+h*s*p*p*p,u-n*a*m*m*m),g=Math.sin(f);return new d(f.toDegrees(),Math.atan2(r,e).toDegrees(),u*Math.cos(f)+i*g-a*a/(a/Math.sqrt(1-n*g*g)))}toString(t=0){let e=this.x.toFixed(t),r=this.y.toFixed(t),i=this.z.toFixed(t);return`[${e},${r},${i}]`}}let c={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563},Airy1830:{a:6377563.396,b:6356256.909,f:1/299.3249646},AiryModified:{a:6377340.189,b:6356034.448,f:1/299.3249646},Bessel1841:{a:6377397.155,b:6356078.962818,f:1/299.1528128},Clarke1866:{a:6378206.4,b:6356583.8,f:1/294.978698214},Clarke1880IGN:{a:6378249.2,b:6356515,f:1/293.466021294},GRS80:{a:6378137,b:6356752.31414,f:1/298.257222101},Intl1924:{a:6378388,b:6356911.946,f:1/297},WGS72:{a:6378135,b:6356750.5,f:1/298.26}},p={ED50:{ellipsoid:c.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:c.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:c.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:c.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:c.GRS80,transform:[.9956,-1.9103,-.5215,-.00062,.025915,.009426,.011599]},NTF:{ellipsoid:c.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:c.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:c.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:c.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:c.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:c.WGS84,transform:[0,0,0,0,0,0,0]}};
1Object.keys(c).forEach(t=>Object.freeze(c[t])),Object.keys(p).forEach(t=>{Object.freeze(p[t]),Object.freeze(p[t].transform)});class m extends d{constructor(t,e,r=0,i=p.WGS84){if(!i||void 0==i.ellipsoid)throw TypeError(`unrecognised datum ‘${i}’`);super(t,e,r),this._datum=i}get datum(){return this._datum}static get ellipsoids(){return c}static get datums(){return p}static parse(...t){let e=p.WGS84;if((4==t.length||3==t.length&&"object"==typeof t[2])&&(e=t.pop()),!e||void 0==e.ellipsoid)throw TypeError(`unrecognised datum ‘${e}’`);let r=super.parse(...t);return r._datum=e,r}convertDatum(t){if(!t||void 0==t.ellipsoid)throw TypeError(`unrecognised datum ‘${t}’`);return this.toCartesian().convertDatum(t).toLatLon()}toCartesian(){let t=super.toCartesian();return new f(t.x,t.y,t.z,this.datum)}}class f extends u{constructor(t,e,r,i){if(i&&void 0==i.ellipsoid)throw TypeError(`unrecognised datum ‘${i}’`);super(t,e,r),i&&(this._datum=i)}get datum(){return this._datum}set datum(t){if(!t||void 0==t.ellipsoid)throw TypeError(`unrecognised datum ‘${t}’`);this._datum=t}toLatLon(t){t&&(console.info("datum parameter to Cartesian_Datum.toLatLon is deprecated: set datum before calling toLatLon()"),this.datum=t);let e=this.datum||p.WGS84;if(!e||void 0==e.ellipsoid)throw TypeError(`unrecognised datum ‘${e}’`);let r=super.toLatLon(e.ellipsoid);return new m(r.lat,r.lon,r.height,this.datum)}convertDatum(t){if(!t||void 0==t.ellipsoid)throw TypeError(`unrecognised datum ‘${t}’`);if(!this.datum)throw TypeError("cartesian coordinate has no datum");let e=null,r=null;(void 0==this.datum||this.datum==p.WGS84)&&(e=this,r=t.transform),t==p.WGS84&&(e=this,r=this.datum.transform.map(t=>-t)),null==r&&(e=this.convertDatum(p.WGS84),r=t.transform);let i=e.applyTransform(r);return i.datum=t,i}applyTransform(t){let{x:e,y:r,z:i}=this,a=t[0],s=t[1],o=t[2],n=t[3]/1e6+1,l=(t[4]/3600).toRadians(),h=(t[5]/3600).toRadians(),d=(t[6]/3600).toRadians();return new f(a+e*n-r*d+i*h,s+e*d+r*n-i*l,o-e*h+r*l+i*n)}}let g={trueOrigin:{lat:49,lon:-2},falseOrigin:{easting:-4e5,northing:1e5},scaleFactor:.9996012717,ellipsoid:m.ellipsoids.Airy1830};class N{constructor(t,e){if(this.easting=Number(t),this.northing=Number(e),isNaN(t)||this.easting<0||this.easting>7e5)throw RangeError(`invalid easting ‘${t}’`);if(isNaN(e)||this.northing<0||this.northing>13e5)throw RangeError(`invalid northing ‘${e}’`)}toLatLon(t=m.datums.WGS84){let{easting:e,northing:r}=this,{a:i,b:a}=g.ellipsoid,s=g.trueOrigin.lat.toRadians(),o=g.trueOrigin.lon.toRadians(),n=-g.falseOrigin.easting,l=-g.falseOrigin.northing,h=g.scaleFactor,d=1-a*a/(i*i),u=(i-a)/(i+a),c=u*u,p=u*u*u,f=s,N=0;do{let t=(1+u+5/4*c+5/4*p)*((f=(r-l-N)/(i*h)+f)-s);N=a*h*(t-(3*u+3*u*u+21/8*p)*Math.sin(f-s)*Math.cos(f+s)+(15/8*c+15/8*p)*Math.sin(2*(f-s))*Math.cos(2*(f+s))-35/24*p*Math.sin(3*(f-s))*Math.cos(3*(f+s)))}while(Math.abs(r-l-N)>=1e-5);let y=Math.cos(f),b=Math.sin(f),M=i*h/Math.sqrt(1-d*b*b),v=i*h*(1-d)/Math.pow(1-d*b*b,1.5),E=M/v-1,S=Math.tan(f),$=S*S,x=$*$,T=1/y,G=M*M*M,_=G*M*M,W=e-n,F=W*W,z=F*W,L=F*F,O=z*F,D=new w((f=f-S/(2*v*M)*F+S/(24*v*G)*(5+3*$+E-9*$*E)*L-S/(720*v*_)*(61+90*$+45*x)*(L*F)).toDegrees(),(o+T/M*W-T/(6*G)*(M/v+2*$)*z+T/(120*_)*(5+28*$+24*x)*O-T/(_*M*M*5040)*(61+662*$+1320*x+x*$*720)*(O*F)).toDegrees(),0,m.datums.OSGB36);return t!=m.datums.OSGB36&&(D=new w((D=D.convertDatum(t)).lat,D.lon,D.height,D.datum)),D}static parse(t){let e=(t=String(t).trim()).match(/^(\d+),\s*(\d+)$/);if(e)return new N(e[1],e[2]);if(!(e=t.match(/^[HNST][ABCDEFGHJKLMNOPQRSTUVWXYZ]\s*[0-9]+\s*[0-9]+$/i)))throw Error(`invalid grid reference ‘${t}’`);let r=t.toUpperCase().charCodeAt(0)-65,i=t.toUpperCase().charCodeAt(1)-65;r>7&&r--,i>7&&i--;let a=(r-2)%5*5+i%5,s=19-5*Math.floor(r/5)-Math.floor(i/5),o=t.slice(2).trim().split(/\s+/);if(1==o.length&&(o=[o[0].slice(0,o[0].length/2),o[0].slice(o[0].length/2)]),o[0].length!=o[1].length)throw Error(`invalid grid reference ‘${t}’`);return o[0]=o[0].padEnd(5,"0"),o[1]=o[1].padEnd(5,"0"),new N(a+o[0],s+o[1])}toString(t=10){if(![0,2,4,6,8,10,12,14,16].includes(Number(t)))throw RangeError(`invalid precision ‘${t}’`);let{easting:e,northing:r}=this;if(0==t){let t={useGrouping:!1,minimumIntegerDigits:6,maximumFractionDigits:3}
1,i=e.toLocaleString("en",t),a=r.toLocaleString("en",t);return`${i},${a}`}let i=Math.floor(e/1e5),a=Math.floor(r/1e5),s=19-a-(19-a)%5+Math.floor((i+10)/5),o=(19-a)*5%25+i%5;s>7&&s++,o>7&&o++;let n=String.fromCharCode(s+65,o+65);return e=Math.floor(e%1e5/Math.pow(10,5-t/2)),r=Math.floor(r%1e5/Math.pow(10,5-t/2)),e=e.toString().padStart(t/2,"0"),r=r.toString().padStart(t/2,"0"),`${n} ${e} ${r}`}}class w extends m{toOsGrid(){let t=this.datum==m.datums.OSGB36?this:this.convertDatum(m.datums.OSGB36),e=t.lat.toRadians(),r=t.lon.toRadians(),{a:i,b:a}=g.ellipsoid,s=g.trueOrigin.lat.toRadians(),o=g.trueOrigin.lon.toRadians(),n=-g.falseOrigin.easting,l=-g.falseOrigin.northing,h=g.scaleFactor,d=1-a*a/(i*i),u=(i-a)/(i+a),c=u*u,p=u*u*u,f=Math.cos(e),w=Math.sin(e),y=i*h/Math.sqrt(1-d*w*w),b=i*h*(1-d)/Math.pow(1-d*w*w,1.5),M=y/b-1,v=f*f*f,E=v*f*f,S=Math.tan(e)*Math.tan(e),$=S*S,x=r-o,T=x*x,G=T*x,_=G*x,W=_*x,F=a*h*((1+u+5/4*c+5/4*p)*(e-s)-(3*u+3*u*u+21/8*p)*Math.sin(e-s)*Math.cos(e+s)+(15/8*c+15/8*p)*Math.sin(2*(e-s))*Math.cos(2*(e+s))-35/24*p*Math.sin(3*(e-s))*Math.cos(3*(e+s)))+l+y/2*w*f*T+y/24*w*v*(5-S+9*M)*_+y/720*w*E*(61-58*S+$)*(W*x),z=n+y*f*x+y/6*v*(y/b-S)*G+y/120*E*(5-18*S+$+14*M-58*S*M)*W;F=Number(F.toFixed(3)),z=Number(z.toFixed(3));try{return new N(z,F)}catch(e){throw Error(`${e.message} from (${t.lat.toFixed(6)},${t.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(t){let e=super.convertDatum(t);return new w(e.lat,e.lon,e.height,e.datum)}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.