/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../chunks/_rollupPluginBabelHelpers","../2d/engine/webgl/DefaultVertexAttributeLayouts","./BufferObject","./enums","./FramebufferObject","./Texture","./VertexArrayObject"],(function(e,t,r,i,n,a,o,s){"use strict";function l(e){return p.apply(this,arguments)}function p(){return(p=t._asyncToGenerator((function*(e){const t=new Image;if(t.src="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A",t.width=5,t.height=5,yield t.decode(),!e.gl)return!0;const l=new a.FramebufferObject(e,{colorTarget:n.TargetType.TEXTURE,depthStencilTarget:n.DepthStencilTargetType.NONE},{target:n.TextureType.TEXTURE_2D,wrapMode:n.TextureWrapMode.CLAMP_TO_EDGE,pixelFormat:n.PixelFormat.RGBA,dataType:n.PixelType.UNSIGNED_BYTE,samplingMode:n.TextureSamplingMode.NEAREST,width:1,height:1}),p=i.BufferObject.createVertex(e,n.Usage.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),u=new s.VertexArrayObject(e,new Map([["a_pos",0]]),r.Pos2us,{geometry:p}),d="\n  precision highp float;\n\n  attribute vec2 a_pos;\n  varying vec2 v_uv;\n\n  void main() {\n    v_uv = a_pos;\n    gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n  }\n  ",g="\n  precision highp float;\n\n  varying vec2 v_uv;\n  uniform sampler2D u_texture;\n\n  void main() {\n    gl_FragColor = texture2D(u_texture, v_uv);\n  }\n  ",c=e.programCache.acquire(d,g,new Map([["a_pos",0]]));e.useProgram(c);const T=new o.Texture(e,{dataType:n.PixelType.UNSIGNED_BYTE,pixelFormat:n.PixelFormat.RGBA,preMultiplyAlpha:!1,wrapMode:n.TextureWrapMode.CLAMP_TO_EDGE,samplingMode:n.TextureSamplingMode.LINEAR},t);e.bindTexture(T,0),c.setUniform1i("u_texture",0);const f=e.getBoundFramebufferObject(),{x:m,y:x,width:_,height:h}=e.getViewport();e.bindFramebuffer(l),e.setViewport(0,0,1,1),e.setClearColor(0,0,0,0),e.setBlendingEnabled(!1),e.clearSafe(n.ClearBufferBit.COLOR_BUFFER_BIT),e.bindVAO(u),e.drawArrays(n.PrimitiveType.TRIANGLE_STRIP,0,4);const v=new Uint8Array(4);return l.readPixels(0,0,1,1,n.PixelFormat.RGBA,n.PixelType.UNSIGNED_BYTE,v),c.dispose(),u.dispose(!1),p.dispose(),l.dispose(),T.dispose(),e.setViewport(m,x,_,h),e.bindFramebuffer(f),t.src="",255===v[0]}))).apply(this,arguments)}e.testSVGPremultipliedAlpha=l,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
