/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.25/esri/copyright.txt for details. */ const t=16,n=8,o=4,r=2,e=1,c=new Float64Array(2),f=new Float64Array(2),u=-90,l=90,h=-180,s=180,i="0123456789bcdefghjkmnpqrstuvwxyz";function a(t){return t<=57?t-48:t<=104?t-88:t<=107?t-89:t<=110?t-90:t-91}function g(t){return i[t]}function M(t){return(t[0]+t[1])/2}function A(t,n,o){return t[0]=n,t[1]=o,t}function d(t,n){const o=M(t),r=n,e=!n;t[0]=e*t[0]+r*o,t[1]=e*o+r*t[1]}function w(t,n){const o=n>M(t);return d(t,o),o}function y(i,g){const w=A(c,u,l),y=A(f,h,s);for(let c=0;c>h,A=(g&t.geohashY)>>s;for(let t=i-1;t>=0;t--){const n=(e+c)/2,o=M&1<=0;t--){const n=(o+r)/2,e=A&1<n?1:0;e|=r<<29-(t+5*s),l=(1-r)*l+r*n,h=(1-r)*n+r*h}for(let t=0;t<5;t++){const o=(f+u)/2,r=n>o?1:0;c|=r<<29-(t+5*s),f=(1-r)*f+r*o,u=(1-r)*o+r*u}}t.geohashX=e,t.geohashY=c}function b(t,n,o,r,e){e%2&&(e+=1);let c=0,f=0,u=-90,l=90,h=-180,s=180;for(let i=0;in?1:0;c|=o<<29-(t+5*i),h=(1-o)*h+o*n,s=(1-o)*n+o*s}for(let t=0;t<5;t++){const n=(u+l)/2,r=o>n?1:0;f|=r<<29-(t+5*i),u=(1-r)*u+r*n,l=(1-r)*n+r*l}}t[2*n]=c,t[2*n+1]=f}function p(t,n,o){let r="";const e=A(c,-90,90),u=A(f,-180,180);for(let c=0;c>1|(t&c)>>2:(r&c)>>1|(n&c)>>2}function m(c,f){return f?(r&c)>>1|(n&c)>>2:e&c|(o&c)>>1|(t&c)>>2}function q(c,f,u){const l=!((c.length-1)%2),h=c.substring(0,c.length-1),s=a(c.charCodeAt(c.length-1));let i=0,M=0,A=0,d=0;l?(i=8,M=4,A=e&s|(o&s)>>1|(t&s)>>2,d=(r&s)>>1|(n&s)>>2):(i=4,M=8,d=e&s|(o&s)>>1|(t&s)>>2,A=(r&s)>>1|(n&s)>>2);const w=A+f,y=d+u,C=Math.floor(w/i),X=Math.floor(y/M),Y=g(j(w-C*i,y-X*M,l));return c.length>1&&(C||X)?q(h,C,X)+Y:h+Y}export{C as convertGeohash32ToXY,a as decodeBase32Char,y as decodeGeohash,X as decodeGeohashXY,g as encodeBase32Char,p as encodeGeohash,q as getRelativeGeohash,x as latDistPerGeohash,F as lonDistPerGeohash,b as setGeohashBuf,Y as setGeohashXY,k as unpackXBits,m as unpackYBits};