/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
function n(n){return((n+180)%360+360)%360-180}function t(n){return Math.max(-90,Math.min(90,n))}function o(o,a,i,M){const l=Math.min(Math.max(i,0),360),r=Math.min(Math.max(M,0),180),u=l/2,f=r/2,c=a-90,e=t(c-f),s=t(c+f),x=s>=90||e<=-90||l>=360,h=n(o);return{latMin:e,latMax:s,lonMin:n(h-u),lonMax:n(h+u),fullLongitude:x,hfov:l,vfov:r}}function a(n,t,o,a){if(Math.abs(t-n)>=360||Math.abs(a-o)>=360)return!0;function i(n,t){return n<=t?[[n,t]]:[[n,180],[-180,t]]}const M=i(n,t),l=i(o,a);for(const r of M)for(const n of l)if(!(r[1]<=n[0]||r[0]>=n[1]))return!0;return!1}function i(n,t,o,a){return!(t<=o||n>=a)}function M(t,o,a,i){const M=360/a,l=180/i,r=t*M-180,u=r+M,f=90-o*l,c=f-l;return{lonMinRaw:r,lonMaxRaw:u,lonMin:n(r),lonMax:n(u),latMin:c,latMax:f}}function l(n,[t,l],[r,u],f,c,e,s,x){const{latMin:h,latMax:m,lonMin:d,lonMax:g,fullLongitude:v}=o(c,e,s,x),$=r-t+1,b=u-l+1,p=[];for(let o=t;o<=r;o++){const{lonMin:t,lonMax:r}=M(o,l,$,b);if(v||a(d,g,t,r))for(let a=l;a<=u;a++){const{latMin:t,latMax:l}=M(o,a,$,b);if(!i(h,m,t,l))continue;const r=`${n}/${a}/${o}`,u=f.get(r);u&&p.push(u)}}return p}export{l as default};
