/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as e}from"tslib";import{uniform as r,UniformGroup as t}from"../../../GraphShaderModule.js";import{step as n,Vec2 as o,Bool as i,texture2D as m,floor as s,fract as a,IVec2 as u,int as p,Vec3 as d,ifElse as c,lessThanEqual as f,texelFetch as l,Int as w,dot as g,Sampler2D as x}from"../../../graph/glsl.js";import{sampleBicubicBSpline as y}from"../bitmapUtils.js";import{oneMinus as b}from"../utils.js";import{sampleBilinear as S}from"./sampleBilinear.js";class v extends t{}function j(e,r){const t=m(r.transformTexture,e);return new o(t.r,t.g)}function z(e,r){const{transformTexture:t,targetImageSize:n,transformSpacing:i}=r,m=s(e.multiply(n)),l=new o(4,1),w=s(m.divide(i)).multiply(l),g=a(m.add(new o(.5,.5)).divide(i)),x=new u(p(w.x),p(w.y)),y=new d(g,1);return c(f(g.x,g.y),I(t,x,y),h(t,x,y))}function I(e,r,t){const n=l(e,r,new w(0)),i=new u(r.x.add(1),r.y),m=l(e,i,new w(0));return new o(g(n.rgb,t),g(m.rgb,t))}function h(e,r,t){const n=new u(r.x.add(2),r.y),i=l(e,n,new w(0)),m=new u(r.x.add(3),r.y),s=l(e,m,new w(0));return new o(g(i.rgb,t),g(s.rgb,t))}function T(e){const r=n(new o(-1e-5,-1e-5),e).multiply(n(e,new o(1.00001,1.00001))),t=b(r.x.multiply(r.y));return new i(t)}function G(e,r,t=!1){return r?t?j(e,r):z(e,r):e}function B(e,r,t){const{bicubic:n=!1,bilinear:o=!1,nearestOnEdge:i=!1}=t??{};return n||o?n?y(r.texture,e,r.srcImageSize):S(r.texture,e,r.srcImageSize,i):m(r.texture,e)}e([r(x)],v.prototype,"transformTexture",void 0),e([r(o)],v.prototype,"targetImageSize",void 0),e([r(o)],v.prototype,"transformSpacing",void 0),e([r(o)],v.prototype,"transformGridSize",void 0);export{v as ProjectionConfig,B as getPixel,G as getPixelLocation,T as isOutside};
