class Wt{constructor(e,t){this.x=e,this.y=t}}class vt{constructor(e,t,a,d){this.x=e,this.y=t,this.width=a,this.height=d}get center(){return new Wt(this.x+this.width/2,this.y+this.height/2)}static fromCenter(e,t,a){return new vt(e.x-t/2,e.y-a/2,t,a)}toString(){return`Rect(${this.x}, ${this.y},${this.width}, ${this.height})`}vertex(){var e=this.x,t=this.x+this.width,a=this.y,d=this.y+this.height;return[e,a,t,a,e,d,e,d,t,a,t,d]}coverRadius(e,t){var a,d;e>this.x+this.width/2?a=this.x:a=this.x+this.width,t>this.y+this.height/2?d=this.y:d=this.y+this.height;var s=e-a,c=t-d;return Math.sqrt(s*s+c*c)}centerFitTo(e){const t=Math.min(e.width/this.width,e.height/this.height),a=t*this.width,d=t*this.height,s=e.width/2-a/2,c=e.height/2-d/2;return new vt(e.x+s,e.y+c,a,d)}}function zt(_,e,t){var a,d;e>_.x+_.width/2?a=_.x:a=_.x+_.width,t>_.y+_.height/2?d=_.y:d=_.y+_.height;var s=e-a,c=t-d;return Math.sqrt(s*s+c*c)}function pt(_,e,t,a,d,s){_[e]=t,_[e+1]=a,_[e+2]=t+d,_[e+3]=a,_[e+4]=t,_[e+5]=a+s,_[e+6]=t,_[e+7]=a+s,_[e+8]=t+d,_[e+9]=a,_[e+10]=t+d,_[e+11]=a+s}function Gt(_,e,t,a){const d=new Float32Array(12),s=0;return d[s]=_,d[s+1]=e,d[s+2]=_+t,d[s+3]=e,d[s+4]=_,d[s+5]=e+a,d[s+6]=_,d[s+7]=e+a,d[s+8]=_+t,d[s+9]=e,d[s+10]=_+t,d[s+11]=e+a,d}class Ut{constructor(e,t,a,d){this.duration=e,this.onUpdate=t,this.onEnd=a,this.interpolator=d,this.startTime=new Date().getTime(),this._progress=0,this.running=!0,this.ended=!1,this.canceled=!1}get progress(){return this._progress}update(){if(this.removable())return;const e=new Date().getTime()-this.startTime;e=this.duration&&(this.running?(this._progress=1,this.onUpdate(this),this.running=!1):this.end())}removable(){return this.ended||this.canceled}cancel(){this.canceled||(this.canceled=!0,this.end())}end(){this.ended||(this.onEnd(this),this.ended=!0)}value(){return this.interpolator!=null?this.interpolator.getInterpolation(this._progress):this._progress}}class Xt{constructor(e,t){this.touches=[],this.distance=0,this.callbacks=t,this.el=e}removeTouch(e){let t=this.touches.findIndex(a=>a.identifier==e);t>=0&&this.touches.splice(t,1)}getTouch(e){let t=this.touches.findIndex(a=>a.identifier==e);return t>=0?this.touches[t]:null}getX(e){return e.pageX}getY(e){return e.pageY}start(e){for(var t=0;t{s=!0,c=b.clientX,o=b.clientY,i=0}),document.addEventListener("mouseup",b=>{var v;s=!1,i==0&&b.target==e&&((v=t.tap)==null||v.call(t,b.offsetX,b.offsetY))}),document.addEventListener("mousemove",b=>{var v;s&&(b.preventDefault(),a=b.clientX-c,d=b.clientY-o,c=b.clientX,o=b.clientY,i+=Math.abs(a)+Math.abs(d),(v=t==null?void 0:t.drag)==null||v.call(t,a,d))}),e.addEventListener("wheel",b=>{var A;b.preventDefault();let v=b.deltaY*-.01+1;(A=t.zoom)==null||A.call(t,v,b.offsetX,b.offsetY)}),e.addEventListener("click",b=>{b.preventDefault()});const x=new Xt(e,t);e.addEventListener("touchstart",b=>{b.preventDefault(),x.start(b.changedTouches)}),e.addEventListener("touchmove",b=>{x.move(b.changedTouches)}),e.addEventListener("touchend",b=>{x.end(b.changedTouches)}),e.addEventListener("touchcancel",b=>{x.end(b.changedTouches)})}}var ut;(_=>{let e=Float32Array;function t(l,n,f=null){f=f||new e(16);var u=n[0*4+0],m=n[0*4+1],E=n[0*4+2],R=n[0*4+3],C=n[1*4+0],L=n[1*4+1],D=n[1*4+2],P=n[1*4+3],B=n[2*4+0],M=n[2*4+1],K=n[2*4+2],w=n[2*4+3],z=n[3*4+0],h=n[3*4+1],U=n[3*4+2],J=n[3*4+3],W=l[0*4+0],tt=l[0*4+1],X=l[0*4+2],q=l[0*4+3],S=l[1*4+0],F=l[1*4+1],$=l[1*4+2],V=l[1*4+3],j=l[2*4+0],at=l[2*4+1],ot=l[2*4+2],et=l[2*4+3],rt=l[3*4+0],st=l[3*4+1],nt=l[3*4+2],ct=l[3*4+3];return f[0]=u*W+m*S+E*j+R*rt,f[1]=u*tt+m*F+E*at+R*st,f[2]=u*X+m*$+E*ot+R*nt,f[3]=u*q+m*V+E*et+R*ct,f[4]=C*W+L*S+D*j+P*rt,f[5]=C*tt+L*F+D*at+P*st,f[6]=C*X+L*$+D*ot+P*nt,f[7]=C*q+L*V+D*et+P*ct,f[8]=B*W+M*S+K*j+w*rt,f[9]=B*tt+M*F+K*at+w*st,f[10]=B*X+M*$+K*ot+w*nt,f[11]=B*q+M*V+K*et+w*ct,f[12]=z*W+h*S+U*j+J*rt,f[13]=z*tt+h*F+U*at+J*st,f[14]=z*X+h*$+U*ot+J*nt,f[15]=z*q+h*V+U*et+J*ct,f}_.multiply=t;function a(l=null){return l=l||new e(16),l[0]=1,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=1,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=1,l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,l}_.identity=a;function d(l,n,f,u=null){return u=u||new e(16),u[0]=1,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=1,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=1,u[11]=0,u[12]=l,u[13]=n,u[14]=f,u[15]=1,u}_.translation=d;function s(l,n,f,u){return u=u||new e(16),u[0]=l,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=n,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=f,u[11]=0,u[12]=0,u[13]=0,u[14]=0,u[15]=1,u}_.scaling=s;function c(l,n,f,u,m){return m=m||new e(16),m[0]=n*l[0*4+0],m[1]=n*l[0*4+1],m[2]=n*l[0*4+2],m[3]=n*l[0*4+3],m[4]=f*l[1*4+0],m[5]=f*l[1*4+1],m[6]=f*l[1*4+2],m[7]=f*l[1*4+3],m[8]=u*l[2*4+0],m[9]=u*l[2*4+1],m[10]=u*l[2*4+2],m[11]=u*l[2*4+3],l!==m&&(m[12]=l[12],m[13]=l[13],m[14]=l[14],m[15]=l[15]),m}_.scale=c;function o(l,n=null){n=n||new e(16);var f=l[0*4+0],u=l[0*4+1],m=l[0*4+2],E=l[0*4+3],R=l[1*4+0],C=l[1*4+1],L=l[1*4+2],D=l[1*4+3],P=l[2*4+0],B=l[2*4+1],M=l[2*4+2],K=l[2*4+3],w=l[3*4+0],z=l[3*4+1],h=l[3*4+2],U=l[3*4+3],J=M*U,W=h*K,tt=L*U,X=h*D,q=L*K,S=M*D,F=m*U,$=h*E,V=m*K,j=M*E,at=m*D,ot=L*E,et=P*z,rt=w*B,st=R*z,nt=w*C,ct=R*B,ft=P*C,r=f*z,O=w*u,I=f*B,y=P*u,g=f*C,T=R*u,N=J*C+X*B+q*z-(W*C+tt*B+S*z),G=W*u+F*B+j*z-(J*u+$*B+V*z),k=tt*u+$*C+at*z-(X*u+F*C+ot*z),Y=S*u+V*C+ot*B-(q*u+j*C+at*B),Z=1/(f*N+R*G+P*k+w*Y);return n[0]=Z*N,n[1]=Z*G,n[2]=Z*k,n[3]=Z*Y,n[4]=Z*(W*R+tt*P+S*w-(J*R+X*P+q*w)),n[5]=Z*(J*f+$*P+V*w-(W*f+F*P+j*w)),n[6]=Z*(X*f+F*R+ot*w-(tt*f+$*R+at*w)),n[7]=Z*(q*f+j*R+at*P-(S*f+V*R+ot*P)),n[8]=Z*(et*D+nt*K+ct*U-(rt*D+st*K+ft*U)),n[9]=Z*(rt*E+r*K+y*U-(et*E+O*K+I*U)),n[10]=Z*(st*E+O*D+g*U-(nt*E+r*D+T*U)),n[11]=Z*(ft*E+I*D+T*K-(ct*E+y*D+g*K)),n[12]=Z*(st*M+ft*h+rt*L-(ct*h+et*L+nt*M)),n[13]=Z*(I*h+et*m+O*M-(r*M+y*h+rt*m)),n[14]=Z*(r*L+T*h+nt*m-(g*h+st*m+O*L)),n[15]=Z*(g*M+ct*m+y*L-(I*L+T*M+ft*m)),n}_.inverse=o;function i(l,n,f=null){f=f||new e(3);var u=n[0],m=n[1],E=n[2],R=u*l[0*4+3]+m*l[1*4+3]+E*l[2*4+3]+l[3*4+3];return f[0]=(u*l[0*4+0]+m*l[1*4+0]+E*l[2*4+0]+l[3*4+0])/R,f[1]=(u*l[0*4+1]+m*l[1*4+1]+E*l[2*4+1]+l[3*4+1])/R,f[2]=(u*l[0*4+2]+m*l[1*4+2]+E*l[2*4+2]+l[3*4+2])/R,f}_.transformPoint=i;function x(l,n=null){return n=n||new e(16),n[0]=l[0],n[1]=l[1],n[2]=l[2],n[3]=l[3],n[4]=l[4],n[5]=l[5],n[6]=l[6],n[7]=l[7],n[8]=l[8],n[9]=l[9],n[10]=l[10],n[11]=l[11],n[12]=l[12],n[13]=l[13],n[14]=l[14],n[15]=l[15],n}_.copy=x;function b(l,n,f=null){return f=a(f),f[0]=2/l,f[5]=-2/n,f[12]=-1,f[13]=1,f}_.projection=b;function v(l,n,f=null){return f=a(f),f[0]=2/l,f[5]=2/n,f[12]=-1,f[13]=-1,f}_.projectionNoflipY=v;function A(l,n,f,u){let m=a();return m[0]=l,m[5]=n,m[12]=-l*f+f,m[13]=-n*u+u,m}_.scaleAt=A;function p(l,n,f,u){for(var m=0;m<16;m++)f[m]=l[m]+(n[m]-l[m])*u}_.lerp=p})(ut||(ut={}));class kt{preDraw(){}draw(){}tap(e,t,a,d){}scale(e){}dispose(){}}class jt{constructor(e,t,a,d){this.left=e,this.top=t,this.right=a,this.bottom=d}equals(e){return this.left==e.left&&this.top==e.top&&this.right==e.right&&this.bottom==e.bottom}}class Zt{constructor(e,t,a=window){this.gl=e,this.ratio=t,this.animationFrameProvider=a,this.layers=[],this.testLayers=[],this.animators=[],this.userMat=ut.identity(),this.bestFitMat=ut.identity(),this.projectionMat=ut.identity(),this.resultMat=ut.identity(),this.width=0,this.height=0,this.contentWidth=0,this.contentHeight=0,this.padding=new jt(0,0,0,0),this.pendingDraw=!1,this.isBestMatSet=!1,this.updateViewport();let d=this;window&&new Yt(e.canvas,{drag:d.drag.bind(d),zoom:d.scaleAt.bind(d),tap:d.tap.bind(d)}),ut.identity()}updateViewport(){console.log("viewport update.");const t=this.gl.canvas;this.invalidate(),(t.width!=this.width||t.height!=this.height)&&(this.width=t.width,this.height=t.height,ut.projection(this.width,this.height,this.projectionMat),this.updateBestFit(),this.updateResultMat())}updateBestFit(){if(this.contentWidth==0||this.width==0)return;const e=new vt(this.padding.left,this.padding.top,this.width-this.padding.right-this.padding.left,this.height-this.padding.top-this.padding.bottom),t=Math.min(e.width/this.contentWidth,e.height/this.contentHeight),a=e.center.x-this.contentWidth*t/2,d=e.center.y-this.contentHeight*t/2;ut.identity(this.bestFitMat),this.bestFitMat[0]=t,this.bestFitMat[5]=t,this.bestFitMat[12]=a,this.bestFitMat[13]=d,this.isBestMatSet||(ut.copy(this.bestFitMat,this.userMat),this.invalidate(),this.isBestMatSet=!0)}updateResultMat(){if(this.contentWidth==0||this.width==0)return;const e=new vt(this.padding.left,this.padding.top,this.width-this.padding.right-this.padding.left,this.height-this.padding.top-this.padding.bottom);let t=this.width>this.height?.6:.7,a=this.width*t/this.contentWidth,d=this.height*t/this.contentHeight,s=Math.min(a,d);const c=e.center.x-this.contentWidth*s/2,o=e.center.y-this.contentHeight*s/(this.width>this.height?1.5:1.2);ut.identity(this.resultMat),this.resultMat[0]=s,this.resultMat[5]=s,this.resultMat[12]=c,this.resultMat[13]=o}setContentPadding(e){this.padding.equals(e)||(this.padding=e,this.updateBestFit(),this.updateResultMat())}setContentSize(e,t){(e!=this.contentWidth||t!=this.contentWidth)&&(this.contentWidth=e,this.contentHeight=t,this.updateBestFit(),this.updateResultMat())}addLayer(e){this.layers.push(e),this.invalidate()}invalidate(){this.pendingDraw||(this.pendingDraw=!0,this.animationFrameProvider.requestAnimationFrame(()=>{this.draw()}))}draw(){this.animators.forEach(a=>a.update()),this.layers.forEach(a=>a.preDraw());const e=this.gl;e.viewport(0,0,this.width,this.height);let t=239/255;e.clearColor(t,t,t,1),e.clear(e.COLOR_BUFFER_BIT),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.enable(e.BLEND),e.disable(e.DEPTH_TEST),this.layers.forEach(a=>a.draw()),this.pendingDraw=!1,this.animators=this.animators.filter(a=>!a.removable()),this.animators.length>0&&this.invalidate()}get drawMatrix(){return ut.multiply(this.projectionMat,this.userMat)}drag(e,t){let a=ut.translation(e*this.ratio,t*this.ratio,0);this.userMat=ut.multiply(a,this.userMat),this.invalidate()}scaleAt(e,t,a){t*=this.ratio,a*=this.ratio;let d=ut.scaleAt(e,e,t,a);this.userMat=ut.multiply(d,this.userMat),this.layers.forEach(s=>s.scale(this.userMat[0])),this.invalidate()}tap(e,t){let a=e*this.ratio,d=t*this.ratio,[s,c]=ut.transformPoint(ut.inverse(this.userMat),new Float32Array([a,d,0]));this.layers.forEach(o=>o.tap(s,c,a,d))}addAnimator(e){this.animators.push(e),this.invalidate()}addTestLayer(e){this.testLayers.push(e),this.testLayers.length<=1&&this.layers.push(e),this.invalidate()}toggleTestLayer(){if(this.testLayers.length==0)return;let e=this.testLayers.findIndex(d=>this.layers.indexOf(d)>=0),t=(e+1)%this.testLayers.length,a=this.testLayers[t];e>=0&&(this.layers=this.layers.filter(d=>d!=this.testLayers[e])),console.log(`toggleTestLayer, layer=${a}`),this.layers.push(a),this.invalidate()}setScale(e){ut.scaling(e,e,1,this.userMat),this.invalidate()}updateUserMat(e){ut.copy(e,this.userMat),this.invalidate()}matrixAnimationTo(e,t,a,d){const s=ut.copy(this.userMat),c=new Float32Array(16),o=new Ut(t,()=>{ut.lerp(s,e,c,o.value()),this.updateUserMat(c)},()=>{d==null||d()},a);this.addAnimator(o)}resetToBestFit(){this.matrixAnimationTo(this.bestFitMat,600)}dispose(){for(;this.layers.length>0;){let e=this.layers.pop();e==null||e.dispose()}}}function mt(_,e,t){var a=_.createShader(e);_.shaderSource(a,t),_.compileShader(a);var d=_.getShaderParameter(a,_.COMPILE_STATUS);if(d)return a;console.log("error",_.getShaderInfoLog(a)),_.deleteShader(a)}function bt(_,e,t){var a=_.createProgram();_.attachShader(a,e),_.attachShader(a,t),_.linkProgram(a);var d=_.getProgramParameter(a,_.LINK_STATUS);if(d)return a;console.log("error",_.getProgramInfoLog(a)),_.deleteProgram(a)}function Ht(_){return new Promise((e,t)=>{let a=new Image;a.src=_,a.onload=()=>e(a),a.onerror=t})}function Vt(_,e,t){return _t?t:_}function Kt(_){const[e,t,a,d]=_.map(b=>b/255),s=Math.max(e,t,a),c=Math.min(e,t,a);let o,i,x=(s+c)/2;if(s===c)o=i=0;else{const b=s-c;switch(i=x>.5?b/(2-s-c):b/(s+c),s){case e:o=(t-a)/b+(t(_[_.FitCenter=0]="FitCenter",_[_.Repeat=1]="Repeat",_))(Qt||{});class ve extends kt{constructor(e,t,a,d,s=0,c=t.width,o=t.height){super(),this.scene=e,this.image=t,this.width=a,this.height=d,this.texWidth=c,this.texHeight=o,this.vertexShaderCode=` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat4 u_matrix; varying vec2 v_texCoord; void main() { gl_Position = u_matrix * vec4(a_position, 0, 1); v_texCoord = a_texCoord; } `,this.fragmentShaderCode=` precision mediump float; uniform sampler2D u_image; varying vec2 v_texCoord; void main() { vec4 color = texture2D(u_image, v_texCoord); gl_FragColor = color; } `,this.vertexArray=new Float32Array(12),this.texCoordArray=new Float32Array(12);const i=e.gl;if(this.program=bt(i,mt(i,i.VERTEX_SHADER,this.vertexShaderCode),mt(i,i.FRAGMENT_SHADER,this.fragmentShaderCode)),this.aPositionLoc=i.getAttribLocation(this.program,"a_position"),this.aTexcoordLoc=i.getAttribLocation(this.program,"a_texCoord"),this.uMatrixLoc=i.getUniformLocation(this.program,"u_matrix"),pt(this.vertexArray,0,0,0,a,d),s==0){const x=new vt(0,0,a,d),b=new vt(0,0,c,o),v=x.centerFitTo(b);pt(this.texCoordArray,0,v.x/c,v.y/o,v.width/c,v.height/o)}else pt(this.texCoordArray,0,0,0,a/c,d/o);this.vertexBuffer=i.createBuffer(),i.bindBuffer(i.ARRAY_BUFFER,this.vertexBuffer),i.bufferData(i.ARRAY_BUFFER,this.vertexArray,i.STATIC_DRAW),this.texcoordBuffer=i.createBuffer(),i.bindBuffer(i.ARRAY_BUFFER,this.texcoordBuffer),i.bufferData(i.ARRAY_BUFFER,this.texCoordArray,i.STATIC_DRAW),this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t)}draw(){const e=this.scene.gl;e.useProgram(this.program),e.enableVertexAttribArray(this.aPositionLoc),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.vertexAttribPointer(this.aPositionLoc,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(this.aTexcoordLoc),e.bindBuffer(e.ARRAY_BUFFER,this.texcoordBuffer),e.vertexAttribPointer(this.aTexcoordLoc,2,e.FLOAT,!1,0,0),e.uniformMatrix4fv(this.uMatrixLoc,!1,this.scene.projectionMat),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this.texture),e.drawArrays(e.TRIANGLES,0,6)}}class At{constructor(e){this.color=e,this.parts=new Uint8Array(4);let t=new Uint32Array(this.parts.buffer);t[0]=e}toFloatArray(){let e=this.parts,t=new Float32Array(4);return t[0]=e[0]/255,t[1]=e[1]/255,t[2]=e[2]/255,t[3]=e[3]/255,t}fillFloatArray(e,t,a=1){let d=this.parts;const s=d[0]/255,c=d[1]/255,o=d[2]/255,i=d[3]/255;for(var x=0;xe.colored)}get firstUncoloredArea(){return this.areas.find(e=>!e.colored)}get progressPercent(){let e=this.areas.filter(d=>d.colored).length,t=this.areas.length;return e*100/t}}class re{constructor(e){this.areaGroups=e,this.areaHash=new Map,this.groupHash=new Map,e.forEach(t=>{Object.setPrototypeOf(t,ee.prototype),t.areas.forEach(a=>{Object.setPrototypeOf(a,te.prototype),this.areaHash.set(a.id,a),this.groupHash.set(a.id,t)})})}get areaCount(){return this.areaGroups.reduce((e,t)=>e+t.areas.length,0)}get maxAreaCountOfGroup(){return this.areaGroups.reduce((e,t)=>Math.max(e,t.areas.length),0)}groupAreaHash(e){return e.areas.reduce((t,a)=>t.set(a.id,a),new Map)}get coloredPercent(){let e=[...this.areaHash.values()].reduce((t,a)=>a.colored===!0?t+1:t,0);return Math.round(e*100/this.areaHash.size)}}function It(_,e,t=_.NEAREST){let a=_.createTexture();return _.bindTexture(_.TEXTURE_2D,a),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,t),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,t),_.texImage2D(_.TEXTURE_2D,0,_.RGBA,_.RGBA,_.UNSIGNED_BYTE,e),a}function ie(_,e){let t=_.createFramebuffer();_.bindFramebuffer(_.FRAMEBUFFER,t),_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_2D,e,0);let a=_.checkFramebufferStatus(_.FRAMEBUFFER)==_.FRAMEBUFFER_COMPLETE;return console.log(`canRead=${a}`),_.bindFramebuffer(_.FRAMEBUFFER,null),t}function Lt(_,e,t,a,d){let s=Gt(e,t,a,d),c=_.createBuffer();return _.bindBuffer(_.ARRAY_BUFFER,c),_.bufferData(_.ARRAY_BUFFER,s,_.STATIC_DRAW),_.bindBuffer(_.ARRAY_BUFFER,null),c}class be extends kt{constructor(e,t,a,d,s,c=4294967295,o=null){super(),this.scene=e,this.x=t,this.y=a,this.width=d,this.height=s,this.color=c,this.fragmentShader=o,this.vertexShaderCode=` attribute vec2 a_position; uniform mat4 u_matrix; void main() { gl_Position = u_matrix * vec4(a_position, 0, 1); } `,this.fragmentShaderCode=` precision mediump float; uniform vec4 u_color; void main() { gl_FragColor = u_color; } `,this.vertexArray=new Float32Array(12);const i=e.gl;this.program=bt(i,mt(i,i.VERTEX_SHADER,this.vertexShaderCode),mt(i,i.FRAGMENT_SHADER,o||this.fragmentShaderCode)),this.aPositionLoc=i.getAttribLocation(this.program,"a_position"),this.uMatrixLoc=i.getUniformLocation(this.program,"u_matrix"),this.uColorLoc=i.getUniformLocation(this.program,"u_color"),pt(this.vertexArray,0,t,a,d,s),this.vertexBuffer=i.createBuffer(),i.bindBuffer(i.ARRAY_BUFFER,this.vertexBuffer),i.bufferData(i.ARRAY_BUFFER,this.vertexArray,i.STATIC_DRAW),this.colorArray=new At(c).toFloatArray()}draw(){const e=this.scene.gl;e.useProgram(this.program),e.enableVertexAttribArray(this.aPositionLoc),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.vertexAttribPointer(this.aPositionLoc,2,e.FLOAT,!1,0,0),e.uniformMatrix4fv(this.uMatrixLoc,!1,this.scene.drawMatrix),e.uniform4fv(this.uColorLoc,this.colorArray),e.drawArrays(e.TRIANGLES,0,6)}toString(){return"BoxLayer()"}}function ae(_,e,t,a,d){const o=bt(_,mt(_,_.VERTEX_SHADER,` attribute vec2 a_position; attribute vec2 a_texCoord; attribute vec4 a_color; attribute vec4 a_destColor; uniform mat4 u_matrix; varying vec2 v_texCoord; varying vec4 v_color; varying vec4 v_destColor; void main() { gl_Position = u_matrix * vec4(a_position, 0, 1); v_texCoord = a_texCoord; v_color = a_color; v_destColor = a_destColor; } `),mt(_,_.FRAGMENT_SHADER,` precision mediump float; uniform sampler2D u_image; //uniform vec4 u_color; varying vec2 v_texCoord; varying vec4 v_color; varying vec4 v_destColor; void main() { vec4 color = texture2D(u_image, v_texCoord); float dist = distance(color, v_color); if(dist < 0.001) { gl_FragColor = v_destColor; }else{ gl_FragColor = vec4(0,0,0,0); } } `)),i=_.createTexture();_.bindTexture(_.TEXTURE_2D,i),_.texImage2D(_.TEXTURE_2D,0,_.RGBA,a,d,0,_.RGBA,_.UNSIGNED_BYTE,null),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,_.LINEAR),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.LINEAR),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE);const x=_.createFramebuffer();_.bindFramebuffer(_.FRAMEBUFFER,x),_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_2D,i,0);let b=_.getAttribLocation(o,"a_position"),v=_.getAttribLocation(o,"a_texCoord"),A=_.getAttribLocation(o,"a_color"),p=_.getAttribLocation(o,"a_destColor"),l=_.getUniformLocation(o,"u_matrix");const n=t.areaCount,f=new Float32Array(12*n),u=new Float32Array(12*n),m=new Float32Array(24*n),E=new Float32Array(24*n);for(var R=0,C=0,L=0;L!o.isAllColored);c&&(this.currentGroup=c)}get currentGroup(){return this._currentGroup}set currentGroup(e){this._currentGroup=e,this.listeners.forEach(t=>t.onGroupChange(e))}get currentGroupIndex(){return this.currentGroup?this.data.areaGroups.findIndex(e=>e==this.currentGroup):-1}get doneBeforeCount(){let e=0;for(let t=0;ta==this.currentGroup),t=!1;for(let a=0;aa))){L=1/Math.exp(C);var B=f.get(D);B==null?f.set(D,L):f.set(D,L+B)}let M=0,K;return f.forEach((w,z)=>{console.log(`id=${z}, count=${w}`);var h=d.get(z);h!=null&&!h.colored&&w>M&&(K=h,M=w)}),console.log("Area hit:",K),K}dispose(){this.gl.deleteFramebuffer(this.fb),this.gl.deleteTexture(this.colored),this.gl.deleteTexture(this.mapTexure),this.listeners=[]}}class we extends Zt{constructor(e,t,a=window){super(e,t,a)}focusToArea(e){if(this.fillerData==null)return;const t=e.center.radius*4,a=Vt(Math.min(this.width/t,this.height/t),1,this.fillerData.config.maxScale),d=this.width/2,s=this.height/2,c=ut.identity();c[0]=a,c[5]=a,c[12]=-a*e.center.x+d,c[13]=-a*e.center.y+s,this.matrixAnimationTo(c,600)}resetToResult(){this.matrixAnimationTo(this.resultMat,800)}hint(){if(console.log("hint"),this.fillerData==null||this.fillerData.currentGroup==null)return;let t=this.fillerData.currentGroup.firstUncoloredArea;t&&(console.log("find area:",t),this.focusToArea(t))}}class se extends kt{constructor(e,t,a,d,s,c,o=null){super(),this.scene=e,this.texture=t,this.texWidth=a,this.texHeight=d,this.width=s,this.height=c,this.fragmentShader=o,this.vertexShaderCode=` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat4 u_matrix; varying vec2 v_texCoord; void main() { gl_Position = u_matrix * vec4(a_position, 0, 1); v_texCoord = a_texCoord; } `,this.fragmentShaderCode=` precision mediump float; uniform sampler2D u_image; varying vec2 v_texCoord; void main() { vec4 color = texture2D(u_image, v_texCoord); gl_FragColor = color; } `,this.vertexArray=new Float32Array(12),this.texCoordArray=new Float32Array(12);const i=e.gl;this.program=bt(i,mt(i,i.VERTEX_SHADER,this.vertexShaderCode),mt(i,i.FRAGMENT_SHADER,o||this.fragmentShaderCode)),this.aPositionLoc=i.getAttribLocation(this.program,"a_position"),this.aTexcoordLoc=i.getAttribLocation(this.program,"a_texCoord"),this.uMatrixLoc=i.getUniformLocation(this.program,"u_matrix"),this.uScaleLoc=i.getUniformLocation(this.program,"u_scale"),this.uTexSizeLoc=i.getUniformLocation(this.program,"u_texSize"),pt(this.vertexArray,0,0,0,s,c),pt(this.texCoordArray,0,0,0,1,1),this.vertexBuffer=i.createBuffer(),i.bindBuffer(i.ARRAY_BUFFER,this.vertexBuffer),i.bufferData(i.ARRAY_BUFFER,this.vertexArray,i.STATIC_DRAW),this.texcoordBuffer=i.createBuffer(),i.bindBuffer(i.ARRAY_BUFFER,this.texcoordBuffer),i.bufferData(i.ARRAY_BUFFER,this.texCoordArray,i.STATIC_DRAW)}dispose(){let e=this.scene.gl;e.deleteProgram(this.program),e.deleteTexture(this.texture),e.deleteBuffer(this.texcoordBuffer),e.deleteBuffer(this.vertexBuffer)}get currentScale(){return this.scene.userMat[0]*(this.width/this.texWidth)}draw(){const e=this.scene.gl;e.useProgram(this.program),e.enableVertexAttribArray(this.aPositionLoc),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.vertexAttribPointer(this.aPositionLoc,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(this.aTexcoordLoc),e.bindBuffer(e.ARRAY_BUFFER,this.texcoordBuffer),e.vertexAttribPointer(this.aTexcoordLoc,2,e.FLOAT,!1,0,0),e.uniformMatrix4fv(this.uMatrixLoc,!1,this.scene.drawMatrix),e.uniform1f(this.uScaleLoc,this.currentScale),e.uniform2f(this.uTexSizeLoc,1/this.texWidth,1/this.texHeight),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this.texture),e.drawArrays(e.TRIANGLES,0,6)}scale(e){}toString(){return"TextureLayer()"}}const oe=` precision highp float; uniform sampler2D u_image; uniform float u_scale; uniform vec2 u_texSize; varying vec2 v_texCoord; const float w1 = 0.147761; const float w2 = 0.118318; const float w3 = 0.0947416; vec4 GaussianBlur(in sampler2D image, in vec2 texCoord, in vec2 pixelSize) { vec4 C00 = texture2D(image, texCoord + vec2(-pixelSize.x, -pixelSize.y)) * w3 ; vec4 C01 = texture2D(image, texCoord + vec2(0.0, -pixelSize.y)) * w2; vec4 C02 = texture2D(image, texCoord + vec2(pixelSize.x, -pixelSize.y)) * w3 ; vec4 C10 = texture2D(image, texCoord + vec2(-pixelSize.x, 0.0)) * w2; vec4 C11 = texture2D(image, texCoord + vec2(0.0, 0.0)) * w1; vec4 C12 = texture2D(image, texCoord + vec2(pixelSize.x, 0.0)) * w2; vec4 C20 = texture2D(image, texCoord + vec2(-pixelSize.x, pixelSize.y)) * w3; vec4 C21 = texture2D(image, texCoord + vec2(0.0, pixelSize.y)) * w2; vec4 C22 = texture2D(image, texCoord + vec2(pixelSize.x, pixelSize.y)) * w3; return C00 + C01 + C02 + C10 + C11 + C12 + C20 + C21 + C22 ; } void main() { vec4 color = GaussianBlur(u_image, v_texCoord, u_texSize); //vec4 color = texture2D(u_image, v_texCoord); //if(u_scale > 100. ) { if(color.a >= 0.4) { gl_FragColor = vec4(0.15, 0.15, 0.15, 1); }else{ gl_FragColor = vec4(0, 0, 0, 0); } //}else{ // gl_FragColor = vec4(.15, 0.15, 0.15, color.a); //} } `;class Ae extends se{constructor(e,t,a,d){const s=e.gl;let c=s.createTexture();s.bindTexture(s.TEXTURE_2D,c),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texImage2D(s.TEXTURE_2D,0,s.ALPHA,s.ALPHA,s.UNSIGNED_BYTE,t),super(e,c,t.width,t.height,a,d,oe)}}var Ct=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function he(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}function Tt(_){throw new Error('Could not dynamically require "'+_+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ot={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(_,e){(function(t){_.exports=t()})(function(){return function t(a,d,s){function c(x,b){if(!d[x]){if(!a[x]){var v=typeof Tt=="function"&&Tt;if(!b&&v)return v(x,!0);if(o)return o(x,!0);var A=new Error("Cannot find module '"+x+"'");throw A.code="MODULE_NOT_FOUND",A}var p=d[x]={exports:{}};a[x][0].call(p.exports,function(l){var n=a[x][1][l];return c(n||l)},p,p.exports,t,a,d,s)}return d[x].exports}for(var o=typeof Tt=="function"&&Tt,i=0;i>2,p=(3&x)<<4|b>>4,l=1>6:64,n=2>4,b=(15&A)<<4|(p=o.indexOf(i.charAt(n++)))>>2,v=(3&p)<<6|(l=o.indexOf(i.charAt(n++))),m[f++]=x,p!==64&&(m[f++]=b),l!==64&&(m[f++]=v);return m}},{"./support":30,"./utils":32}],2:[function(t,a,d){var s=t("./external"),c=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),i=t("./stream/DataLengthProbe");function x(b,v,A,p,l){this.compressedSize=b,this.uncompressedSize=v,this.crc32=A,this.compression=p,this.compressedContent=l}x.prototype={getContentWorker:function(){var b=new c(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new i("data_length")),v=this;return b.on("end",function(){if(this.streamInfo.data_length!==v.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),b},getCompressedWorker:function(){return new c(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},x.createWorkerFrom=function(b,v,A){return b.pipe(new o).pipe(new i("uncompressedSize")).pipe(v.compressWorker(A)).pipe(new i("compressedSize")).withStreamInfo("compression",v)},a.exports=x},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,a,d){var s=t("./stream/GenericWorker");d.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},d.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,a,d){var s=t("./utils"),c=function(){for(var o,i=[],x=0;x<256;x++){o=x;for(var b=0;b<8;b++)o=1&o?3988292384^o>>>1:o>>>1;i[x]=o}return i}();a.exports=function(o,i){return o!==void 0&&o.length?s.getTypeOf(o)!=="string"?function(x,b,v,A){var p=c,l=A+v;x^=-1;for(var n=A;n>>8^p[255&(x^b[n])];return-1^x}(0|i,o,o.length,0):function(x,b,v,A){var p=c,l=A+v;x^=-1;for(var n=A;n>>8^p[255&(x^b.charCodeAt(n))];return-1^x}(0|i,o,o.length,0):0}},{"./utils":32}],5:[function(t,a,d){d.base64=!1,d.binary=!1,d.dir=!1,d.createFolders=!0,d.date=null,d.compression=null,d.compressionOptions=null,d.comment=null,d.unixPermissions=null,d.dosPermissions=null},{}],6:[function(t,a,d){var s=null;s=typeof Promise<"u"?Promise:t("lie"),a.exports={Promise:s}},{lie:37}],7:[function(t,a,d){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",c=t("pako"),o=t("./utils"),i=t("./stream/GenericWorker"),x=s?"uint8array":"array";function b(v,A){i.call(this,"FlateWorker/"+v),this._pako=null,this._pakoAction=v,this._pakoOptions=A,this.meta={}}d.magic="\b\0",o.inherits(b,i),b.prototype.processChunk=function(v){this.meta=v.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(x,v.data),!1)},b.prototype.flush=function(){i.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},b.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this._pako=null},b.prototype._createPako=function(){this._pako=new c[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var v=this;this._pako.onData=function(A){v.push({data:A,meta:v.meta})}},d.compressWorker=function(v){return new b("Deflate",v)},d.uncompressWorker=function(){return new b("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,a,d){function s(p,l){var n,f="";for(n=0;n>>=8;return f}function c(p,l,n,f,u,m){var E,R,C=p.file,L=p.compression,D=m!==x.utf8encode,P=o.transformTo("string",m(C.name)),B=o.transformTo("string",x.utf8encode(C.name)),M=C.comment,K=o.transformTo("string",m(M)),w=o.transformTo("string",x.utf8encode(M)),z=B.length!==C.name.length,h=w.length!==M.length,U="",J="",W="",tt=C.dir,X=C.date,q={crc32:0,compressedSize:0,uncompressedSize:0};l&&!n||(q.crc32=p.crc32,q.compressedSize=p.compressedSize,q.uncompressedSize=p.uncompressedSize);var S=0;l&&(S|=8),D||!z&&!h||(S|=2048);var F=0,$=0;tt&&(F|=16),u==="UNIX"?($=798,F|=function(j,at){var ot=j;return j||(ot=at?16893:33204),(65535&ot)<<16}(C.unixPermissions,tt)):($=20,F|=function(j){return 63&(j||0)}(C.dosPermissions)),E=X.getUTCHours(),E<<=6,E|=X.getUTCMinutes(),E<<=5,E|=X.getUTCSeconds()/2,R=X.getUTCFullYear()-1980,R<<=4,R|=X.getUTCMonth()+1,R<<=5,R|=X.getUTCDate(),z&&(J=s(1,1)+s(b(P),4)+B,U+="up"+s(J.length,2)+J),h&&(W=s(1,1)+s(b(K),4)+w,U+="uc"+s(W.length,2)+W);var V="";return V+=` \0`,V+=s(S,2),V+=L.magic,V+=s(E,2),V+=s(R,2),V+=s(q.crc32,4),V+=s(q.compressedSize,4),V+=s(q.uncompressedSize,4),V+=s(P.length,2),V+=s(U.length,2),{fileRecord:v.LOCAL_FILE_HEADER+V+P+U,dirRecord:v.CENTRAL_FILE_HEADER+s($,2)+V+s(K.length,2)+"\0\0\0\0"+s(F,4)+s(f,4)+P+U+K}}var o=t("../utils"),i=t("../stream/GenericWorker"),x=t("../utf8"),b=t("../crc32"),v=t("../signature");function A(p,l,n,f){i.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=l,this.zipPlatform=n,this.encodeFileName=f,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(A,i),A.prototype.push=function(p){var l=p.meta.percent||0,n=this.entriesCount,f=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,i.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:n?(l+100*(n-f-1))/n:100}}))},A.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var l=this.streamFiles&&!p.file.dir;if(l){var n=c(p,l,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},A.prototype.closedSource=function(p){this.accumulate=!1;var l=this.streamFiles&&!p.file.dir,n=c(p,l,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),l)this.push({data:function(f){return v.DATA_DESCRIPTOR+s(f.crc32,4)+s(f.compressedSize,4)+s(f.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},A.prototype.flush=function(){for(var p=this.bytesWritten,l=0;l=this.index;i--)x=(x<<8)+this.byteAt(i);return this.index+=o,x},readString:function(o){return s.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},a.exports=c},{"../utils":32}],19:[function(t,a,d){var s=t("./Uint8ArrayReader");function c(o){s.call(this,o)}t("../utils").inherits(c,s),c.prototype.readData=function(o){this.checkOffset(o);var i=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,i},a.exports=c},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,a,d){var s=t("./DataReader");function c(o){s.call(this,o)}t("../utils").inherits(c,s),c.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},c.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},c.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},c.prototype.readData=function(o){this.checkOffset(o);var i=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,i},a.exports=c},{"../utils":32,"./DataReader":18}],21:[function(t,a,d){var s=t("./ArrayReader");function c(o){s.call(this,o)}t("../utils").inherits(c,s),c.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var i=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,i},a.exports=c},{"../utils":32,"./ArrayReader":17}],22:[function(t,a,d){var s=t("../utils"),c=t("../support"),o=t("./ArrayReader"),i=t("./StringReader"),x=t("./NodeBufferReader"),b=t("./Uint8ArrayReader");a.exports=function(v){var A=s.getTypeOf(v);return s.checkSupport(A),A!=="string"||c.uint8array?A==="nodebuffer"?new x(v):c.uint8array?new b(s.transformTo("uint8array",v)):new o(s.transformTo("array",v)):new i(v)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,a,d){d.LOCAL_FILE_HEADER="PK",d.CENTRAL_FILE_HEADER="PK",d.CENTRAL_DIRECTORY_END="PK",d.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",d.ZIP64_CENTRAL_DIRECTORY_END="PK",d.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,a,d){var s=t("./GenericWorker"),c=t("../utils");function o(i){s.call(this,"ConvertWorker to "+i),this.destType=i}c.inherits(o,s),o.prototype.processChunk=function(i){this.push({data:c.transformTo(this.destType,i.data),meta:i.meta})},a.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,a,d){var s=t("./GenericWorker"),c=t("../crc32");function o(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,s),o.prototype.processChunk=function(i){this.streamInfo.crc32=c(i.data,this.streamInfo.crc32||0),this.push(i)},a.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,a,d){var s=t("../utils"),c=t("./GenericWorker");function o(i){c.call(this,"DataLengthProbe for "+i),this.propName=i,this.withStreamInfo(i,0)}s.inherits(o,c),o.prototype.processChunk=function(i){if(i){var x=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=x+i.data.length}c.prototype.processChunk.call(this,i)},a.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,a,d){var s=t("../utils"),c=t("./GenericWorker");function o(i){c.call(this,"DataWorker");var x=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,i.then(function(b){x.dataIsReady=!0,x.data=b,x.max=b&&b.length||0,x.type=s.getTypeOf(b),x.isPaused||x._tickAndRepeat()},function(b){x.error(b)})}s.inherits(o,c),o.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var i=null,x=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":i=this.data.substring(this.index,x);break;case"uint8array":i=this.data.subarray(this.index,x);break;case"array":case"nodebuffer":i=this.data.slice(this.index,x)}return this.index=x,this.push({data:i,meta:{percent:this.max?this.index/this.max*100:0}})},a.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,a,d){function s(c){this.name=c||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(c){this.emit("data",c)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(c){this.emit("error",c)}return!0},error:function(c){return!this.isFinished&&(this.isPaused?this.generatedError=c:(this.isFinished=!0,this.emit("error",c),this.previous&&this.previous.error(c),this.cleanUp()),!0)},on:function(c,o){return this._listeners[c].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(c,o){if(this._listeners[c])for(var i=0;i "+c:c}},a.exports=s},{}],29:[function(t,a,d){var s=t("../utils"),c=t("./ConvertWorker"),o=t("./GenericWorker"),i=t("../base64"),x=t("../support"),b=t("../external"),v=null;if(x.nodestream)try{v=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function A(l,n){return new b.Promise(function(f,u){var m=[],E=l._internalType,R=l._outputType,C=l._mimeType;l.on("data",function(L,D){m.push(L),n&&n(D)}).on("error",function(L){m=[],u(L)}).on("end",function(){try{var L=function(D,P,B){switch(D){case"blob":return s.newBlob(s.transformTo("arraybuffer",P),B);case"base64":return i.encode(P);default:return s.transformTo(D,P)}}(R,function(D,P){var B,M=0,K=null,w=0;for(B=0;B"u")d.blob=!1;else{var s=new ArrayBuffer(0);try{d.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var c=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);c.append(s),d.blob=c.getBlob("application/zip").size===0}catch{d.blob=!1}}}try{d.nodestream=!!t("readable-stream").Readable}catch{d.nodestream=!1}},{"readable-stream":16}],31:[function(t,a,d){for(var s=t("./utils"),c=t("./support"),o=t("./nodejsUtils"),i=t("./stream/GenericWorker"),x=new Array(256),b=0;b<256;b++)x[b]=252<=b?6:248<=b?5:240<=b?4:224<=b?3:192<=b?2:1;x[254]=x[254]=1;function v(){i.call(this,"utf-8 decode"),this.leftOver=null}function A(){i.call(this,"utf-8 encode")}d.utf8encode=function(p){return c.nodebuffer?o.newBufferFrom(p,"utf-8"):function(l){var n,f,u,m,E,R=l.length,C=0;for(m=0;m>>6:(f<65536?n[E++]=224|f>>>12:(n[E++]=240|f>>>18,n[E++]=128|f>>>12&63),n[E++]=128|f>>>6&63),n[E++]=128|63&f);return n}(p)},d.utf8decode=function(p){return c.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):function(l){var n,f,u,m,E=l.length,R=new Array(2*E);for(n=f=0;n>10&1023,R[f++]=56320|1023&u)}return R.length!==f&&(R.subarray?R=R.subarray(0,f):R.length=f),s.applyFromCharCode(R)}(p=s.transformTo(c.uint8array?"uint8array":"array",p))},s.inherits(v,i),v.prototype.processChunk=function(p){var l=s.transformTo(c.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(c.uint8array){var n=l;(l=new Uint8Array(n.length+this.leftOver.length)).set(this.leftOver,0),l.set(n,this.leftOver.length)}else l=this.leftOver.concat(l);this.leftOver=null}var f=function(m,E){var R;for((E=E||m.length)>m.length&&(E=m.length),R=E-1;0<=R&&(192&m[R])==128;)R--;return R<0||R===0?E:R+x[m[R]]>E?R:E}(l),u=l;f!==l.length&&(c.uint8array?(u=l.subarray(0,f),this.leftOver=l.subarray(f,l.length)):(u=l.slice(0,f),this.leftOver=l.slice(f,l.length))),this.push({data:d.utf8decode(u),meta:p.meta})},v.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:d.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},d.Utf8DecodeWorker=v,s.inherits(A,i),A.prototype.processChunk=function(p){this.push({data:d.utf8encode(p.data),meta:p.meta})},d.Utf8EncodeWorker=A},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,a,d){var s=t("./support"),c=t("./base64"),o=t("./nodejsUtils"),i=t("./external");function x(n){return n}function b(n,f){for(var u=0;u>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===c.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===c.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===c.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===c.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var l,n,f,u=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4>>6:(p<65536?A[f++]=224|p>>>12:(A[f++]=240|p>>>18,A[f++]=128|p>>>12&63),A[f++]=128|p>>>6&63),A[f++]=128|63&p);return A},d.buf2binstring=function(v){return b(v,v.length)},d.binstring2buf=function(v){for(var A=new s.Buf8(v.length),p=0,l=A.length;p>10&1023,m[l++]=56320|1023&n)}return b(m,l)},d.utf8border=function(v,A){var p;for((A=A||v.length)>v.length&&(A=v.length),p=A-1;0<=p&&(192&v[p])==128;)p--;return p<0||p===0?A:p+i[v[p]]>A?p:A}},{"./common":41}],43:[function(t,a,d){a.exports=function(s,c,o,i){for(var x=65535&s|0,b=s>>>16&65535|0,v=0;o!==0;){for(o-=v=2e3>>1:c>>>1;o[i]=c}return o}();a.exports=function(c,o,i,x){var b=s,v=x+i;c^=-1;for(var A=x;A>>8^b[255&(c^o[A])];return-1^c}},{}],46:[function(t,a,d){var s,c=t("../utils/common"),o=t("./trees"),i=t("./adler32"),x=t("./crc32"),b=t("./messages"),v=0,A=4,p=0,l=-2,n=-1,f=4,u=2,m=8,E=9,R=286,C=30,L=19,D=2*R+1,P=15,B=3,M=258,K=M+B+1,w=42,z=113,h=1,U=2,J=3,W=4;function tt(r,O){return r.msg=b[O],O}function X(r){return(r<<1)-(4r.avail_out&&(I=r.avail_out),I!==0&&(c.arraySet(r.output,O.pending_buf,O.pending_out,I,r.next_out),r.next_out+=I,O.pending_out+=I,r.total_out+=I,r.avail_out-=I,O.pending-=I,O.pending===0&&(O.pending_out=0))}function F(r,O){o._tr_flush_block(r,0<=r.block_start?r.block_start:-1,r.strstart-r.block_start,O),r.block_start=r.strstart,S(r.strm)}function $(r,O){r.pending_buf[r.pending++]=O}function V(r,O){r.pending_buf[r.pending++]=O>>>8&255,r.pending_buf[r.pending++]=255&O}function j(r,O){var I,y,g=r.max_chain_length,T=r.strstart,N=r.prev_length,G=r.nice_match,k=r.strstart>r.w_size-K?r.strstart-(r.w_size-K):0,Y=r.window,Z=r.w_mask,H=r.prev,Q=r.strstart+M,ht=Y[T+N-1],it=Y[T+N];r.prev_length>=r.good_match&&(g>>=2),G>r.lookahead&&(G=r.lookahead);do if(Y[(I=O)+N]===it&&Y[I+N-1]===ht&&Y[I]===Y[T]&&Y[++I]===Y[T+1]){T+=2,I++;do;while(Y[++T]===Y[++I]&&Y[++T]===Y[++I]&&Y[++T]===Y[++I]&&Y[++T]===Y[++I]&&Y[++T]===Y[++I]&&Y[++T]===Y[++I]&&Y[++T]===Y[++I]&&Y[++T]===Y[++I]&&Tk&&--g!=0);return N<=r.lookahead?N:r.lookahead}function at(r){var O,I,y,g,T,N,G,k,Y,Z,H=r.w_size;do{if(g=r.window_size-r.lookahead-r.strstart,r.strstart>=H+(H-K)){for(c.arraySet(r.window,r.window,H,H,0),r.match_start-=H,r.strstart-=H,r.block_start-=H,O=I=r.hash_size;y=r.head[--O],r.head[O]=H<=y?y-H:0,--I;);for(O=I=H;y=r.prev[--O],r.prev[O]=H<=y?y-H:0,--I;);g+=H}if(r.strm.avail_in===0)break;if(N=r.strm,G=r.window,k=r.strstart+r.lookahead,Y=g,Z=void 0,Z=N.avail_in,Y=B)for(T=r.strstart-r.insert,r.ins_h=r.window[T],r.ins_h=(r.ins_h<=B&&(r.ins_h=(r.ins_h<=B)if(y=o._tr_tally(r,r.strstart-r.match_start,r.match_length-B),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=B){for(r.match_length--;r.strstart++,r.ins_h=(r.ins_h<=B&&(r.ins_h=(r.ins_h<=B&&r.match_length<=r.prev_length){for(g=r.strstart+r.lookahead-B,y=o._tr_tally(r,r.strstart-1-r.prev_match,r.prev_length-B),r.lookahead-=r.prev_length-1,r.prev_length-=2;++r.strstart<=g&&(r.ins_h=(r.ins_h<r.pending_buf_size-5&&(I=r.pending_buf_size-5);;){if(r.lookahead<=1){if(at(r),r.lookahead===0&&O===v)return h;if(r.lookahead===0)break}r.strstart+=r.lookahead,r.lookahead=0;var y=r.block_start+I;if((r.strstart===0||r.strstart>=y)&&(r.lookahead=r.strstart-y,r.strstart=y,F(r,!1),r.strm.avail_out===0)||r.strstart-r.block_start>=r.w_size-K&&(F(r,!1),r.strm.avail_out===0))return h}return r.insert=0,O===A?(F(r,!0),r.strm.avail_out===0?J:W):(r.strstart>r.block_start&&(F(r,!1),r.strm.avail_out),h)}),new rt(4,4,8,4,ot),new rt(4,5,16,8,ot),new rt(4,6,32,32,ot),new rt(4,4,16,16,et),new rt(8,16,32,32,et),new rt(8,16,128,128,et),new rt(8,32,128,256,et),new rt(32,128,258,1024,et),new rt(32,258,258,4096,et)],d.deflateInit=function(r,O){return ft(r,O,m,15,8,0)},d.deflateInit2=ft,d.deflateReset=ct,d.deflateResetKeep=nt,d.deflateSetHeader=function(r,O){return r&&r.state?r.state.wrap!==2?l:(r.state.gzhead=O,p):l},d.deflate=function(r,O){var I,y,g,T;if(!r||!r.state||5>8&255),$(y,y.gzhead.time>>16&255),$(y,y.gzhead.time>>24&255),$(y,y.level===9?2:2<=y.strategy||y.level<2?4:0),$(y,255&y.gzhead.os),y.gzhead.extra&&y.gzhead.extra.length&&($(y,255&y.gzhead.extra.length),$(y,y.gzhead.extra.length>>8&255)),y.gzhead.hcrc&&(r.adler=x(r.adler,y.pending_buf,y.pending,0)),y.gzindex=0,y.status=69):($(y,0),$(y,0),$(y,0),$(y,0),$(y,0),$(y,y.level===9?2:2<=y.strategy||y.level<2?4:0),$(y,3),y.status=z);else{var N=m+(y.w_bits-8<<4)<<8;N|=(2<=y.strategy||y.level<2?0:y.level<6?1:y.level===6?2:3)<<6,y.strstart!==0&&(N|=32),N+=31-N%31,y.status=z,V(y,N),y.strstart!==0&&(V(y,r.adler>>>16),V(y,65535&r.adler)),r.adler=1}if(y.status===69)if(y.gzhead.extra){for(g=y.pending;y.gzindex<(65535&y.gzhead.extra.length)&&(y.pending!==y.pending_buf_size||(y.gzhead.hcrc&&y.pending>g&&(r.adler=x(r.adler,y.pending_buf,y.pending-g,g)),S(r),g=y.pending,y.pending!==y.pending_buf_size));)$(y,255&y.gzhead.extra[y.gzindex]),y.gzindex++;y.gzhead.hcrc&&y.pending>g&&(r.adler=x(r.adler,y.pending_buf,y.pending-g,g)),y.gzindex===y.gzhead.extra.length&&(y.gzindex=0,y.status=73)}else y.status=73;if(y.status===73)if(y.gzhead.name){g=y.pending;do{if(y.pending===y.pending_buf_size&&(y.gzhead.hcrc&&y.pending>g&&(r.adler=x(r.adler,y.pending_buf,y.pending-g,g)),S(r),g=y.pending,y.pending===y.pending_buf_size)){T=1;break}T=y.gzindexg&&(r.adler=x(r.adler,y.pending_buf,y.pending-g,g)),T===0&&(y.gzindex=0,y.status=91)}else y.status=91;if(y.status===91)if(y.gzhead.comment){g=y.pending;do{if(y.pending===y.pending_buf_size&&(y.gzhead.hcrc&&y.pending>g&&(r.adler=x(r.adler,y.pending_buf,y.pending-g,g)),S(r),g=y.pending,y.pending===y.pending_buf_size)){T=1;break}T=y.gzindexg&&(r.adler=x(r.adler,y.pending_buf,y.pending-g,g)),T===0&&(y.status=103)}else y.status=103;if(y.status===103&&(y.gzhead.hcrc?(y.pending+2>y.pending_buf_size&&S(r),y.pending+2<=y.pending_buf_size&&($(y,255&r.adler),$(y,r.adler>>8&255),r.adler=0,y.status=z)):y.status=z),y.pending!==0){if(S(r),r.avail_out===0)return y.last_flush=-1,p}else if(r.avail_in===0&&X(O)<=X(I)&&O!==A)return tt(r,-5);if(y.status===666&&r.avail_in!==0)return tt(r,-5);if(r.avail_in!==0||y.lookahead!==0||O!==v&&y.status!==666){var G=y.strategy===2?function(k,Y){for(var Z;;){if(k.lookahead===0&&(at(k),k.lookahead===0)){if(Y===v)return h;break}if(k.match_length=0,Z=o._tr_tally(k,0,k.window[k.strstart]),k.lookahead--,k.strstart++,Z&&(F(k,!1),k.strm.avail_out===0))return h}return k.insert=0,Y===A?(F(k,!0),k.strm.avail_out===0?J:W):k.last_lit&&(F(k,!1),k.strm.avail_out===0)?h:U}(y,O):y.strategy===3?function(k,Y){for(var Z,H,Q,ht,it=k.window;;){if(k.lookahead<=M){if(at(k),k.lookahead<=M&&Y===v)return h;if(k.lookahead===0)break}if(k.match_length=0,k.lookahead>=B&&0k.lookahead&&(k.match_length=k.lookahead)}if(k.match_length>=B?(Z=o._tr_tally(k,1,k.match_length-B),k.lookahead-=k.match_length,k.strstart+=k.match_length,k.match_length=0):(Z=o._tr_tally(k,0,k.window[k.strstart]),k.lookahead--,k.strstart++),Z&&(F(k,!1),k.strm.avail_out===0))return h}return k.insert=0,Y===A?(F(k,!0),k.strm.avail_out===0?J:W):k.last_lit&&(F(k,!1),k.strm.avail_out===0)?h:U}(y,O):s[y.level].func(y,O);if(G!==J&&G!==W||(y.status=666),G===h||G===J)return r.avail_out===0&&(y.last_flush=-1),p;if(G===U&&(O===1?o._tr_align(y):O!==5&&(o._tr_stored_block(y,0,0,!1),O===3&&(q(y.head),y.lookahead===0&&(y.strstart=0,y.block_start=0,y.insert=0))),S(r),r.avail_out===0))return y.last_flush=-1,p}return O!==A?p:y.wrap<=0?1:(y.wrap===2?($(y,255&r.adler),$(y,r.adler>>8&255),$(y,r.adler>>16&255),$(y,r.adler>>24&255),$(y,255&r.total_in),$(y,r.total_in>>8&255),$(y,r.total_in>>16&255),$(y,r.total_in>>24&255)):(V(y,r.adler>>>16),V(y,65535&r.adler)),S(r),0=I.w_size&&(T===0&&(q(I.head),I.strstart=0,I.block_start=0,I.insert=0),Y=new c.Buf8(I.w_size),c.arraySet(Y,O,Z-I.w_size,I.w_size,0),O=Y,Z=I.w_size),N=r.avail_in,G=r.next_in,k=r.input,r.avail_in=Z,r.next_in=0,r.input=O,at(I);I.lookahead>=B;){for(y=I.strstart,g=I.lookahead-(B-1);I.ins_h=(I.ins_h<>>=B=P>>>24,E-=B,(B=P>>>16&255)===0)U[b++]=65535&P;else{if(!(16&B)){if(!(64&B)){P=R[(65535&P)+(m&(1<>>=B,E-=B),E<15&&(m+=h[i++]<>>=B=P>>>24,E-=B,!(16&(B=P>>>16&255))){if(!(64&B)){P=C[(65535&P)+(m&(1<>>=B,E-=B,(B=b-v)>3,m&=(1<<(E-=M<<3))-1,s.next_in=i,s.next_out=b,s.avail_in=i>>24&255)+(w>>>8&65280)+((65280&w)<<8)+((255&w)<<24)}function m(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function E(w){var z;return w&&w.state?(z=w.state,w.total_in=w.total_out=z.total=0,w.msg="",z.wrap&&(w.adler=1&z.wrap),z.mode=l,z.last=0,z.havedict=0,z.dmax=32768,z.head=null,z.hold=0,z.bits=0,z.lencode=z.lendyn=new s.Buf32(n),z.distcode=z.distdyn=new s.Buf32(f),z.sane=1,z.back=-1,A):p}function R(w){var z;return w&&w.state?((z=w.state).wsize=0,z.whave=0,z.wnext=0,E(w)):p}function C(w,z){var h,U;return w&&w.state?(U=w.state,z<0?(h=0,z=-z):(h=1+(z>>4),z<48&&(z&=15)),z&&(z<8||15=W.wsize?(s.arraySet(W.window,z,h-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(U<(J=W.wsize-W.wnext)&&(J=U),s.arraySet(W.window,z,h-U,J,W.wnext),(U-=J)?(s.arraySet(W.window,z,h-U,U,0),W.wnext=U,W.whave=W.wsize):(W.wnext+=J,W.wnext===W.wsize&&(W.wnext=0),W.whave>>8&255,h.check=o(h.check,T,2,0),F=S=0,h.mode=2;break}if(h.flags=0,h.head&&(h.head.done=!1),!(1&h.wrap)||(((255&S)<<8)+(S>>8))%31){w.msg="incorrect header check",h.mode=30;break}if((15&S)!=8){w.msg="unknown compression method",h.mode=30;break}if(F-=4,r=8+(15&(S>>>=4)),h.wbits===0)h.wbits=r;else if(r>h.wbits){w.msg="invalid window size",h.mode=30;break}h.dmax=1<>8&1),512&h.flags&&(T[0]=255&S,T[1]=S>>>8&255,h.check=o(h.check,T,2,0)),F=S=0,h.mode=3;case 3:for(;F<32;){if(X===0)break t;X--,S+=U[W++]<>>8&255,T[2]=S>>>16&255,T[3]=S>>>24&255,h.check=o(h.check,T,4,0)),F=S=0,h.mode=4;case 4:for(;F<16;){if(X===0)break t;X--,S+=U[W++]<>8),512&h.flags&&(T[0]=255&S,T[1]=S>>>8&255,h.check=o(h.check,T,2,0)),F=S=0,h.mode=5;case 5:if(1024&h.flags){for(;F<16;){if(X===0)break t;X--,S+=U[W++]<>>8&255,h.check=o(h.check,T,2,0)),F=S=0}else h.head&&(h.head.extra=null);h.mode=6;case 6:if(1024&h.flags&&(X<(j=h.length)&&(j=X),j&&(h.head&&(r=h.head.extra_len-h.length,h.head.extra||(h.head.extra=new Array(h.head.extra_len)),s.arraySet(h.head.extra,U,W,j,r)),512&h.flags&&(h.check=o(h.check,U,j,W)),X-=j,W+=j,h.length-=j),h.length))break t;h.length=0,h.mode=7;case 7:if(2048&h.flags){if(X===0)break t;for(j=0;r=U[W+j++],h.head&&r&&h.length<65536&&(h.head.name+=String.fromCharCode(r)),r&&j>9&1,h.head.done=!0),w.adler=h.check=0,h.mode=12;break;case 10:for(;F<32;){if(X===0)break t;X--,S+=U[W++]<>>=7&F,F-=7&F,h.mode=27;break}for(;F<3;){if(X===0)break t;X--,S+=U[W++]<>>=1)){case 0:h.mode=14;break;case 1:if(M(h),h.mode=20,z!==6)break;S>>>=2,F-=2;break t;case 2:h.mode=17;break;case 3:w.msg="invalid block type",h.mode=30}S>>>=2,F-=2;break;case 14:for(S>>>=7&F,F-=7&F;F<32;){if(X===0)break t;X--,S+=U[W++]<>>16^65535)){w.msg="invalid stored block lengths",h.mode=30;break}if(h.length=65535&S,F=S=0,h.mode=15,z===6)break t;case 15:h.mode=16;case 16:if(j=h.length){if(X>>=5,F-=5,h.ndist=1+(31&S),S>>>=5,F-=5,h.ncode=4+(15&S),S>>>=4,F-=4,286>>=3,F-=3}for(;h.have<19;)h.lens[N[h.have++]]=0;if(h.lencode=h.lendyn,h.lenbits=7,I={bits:h.lenbits},O=x(0,h.lens,0,19,h.lencode,0,h.work,I),h.lenbits=I.bits,O){w.msg="invalid code lengths set",h.mode=30;break}h.have=0,h.mode=19;case 19:for(;h.have>>16&255,st=65535&g,!((et=g>>>24)<=F);){if(X===0)break t;X--,S+=U[W++]<>>=et,F-=et,h.lens[h.have++]=st;else{if(st===16){for(y=et+2;F>>=et,F-=et,h.have===0){w.msg="invalid bit length repeat",h.mode=30;break}r=h.lens[h.have-1],j=3+(3&S),S>>>=2,F-=2}else if(st===17){for(y=et+3;F>>=et)),S>>>=3,F-=3}else{for(y=et+7;F>>=et)),S>>>=7,F-=7}if(h.have+j>h.nlen+h.ndist){w.msg="invalid bit length repeat",h.mode=30;break}for(;j--;)h.lens[h.have++]=r}}if(h.mode===30)break;if(h.lens[256]===0){w.msg="invalid code -- missing end-of-block",h.mode=30;break}if(h.lenbits=9,I={bits:h.lenbits},O=x(b,h.lens,0,h.nlen,h.lencode,0,h.work,I),h.lenbits=I.bits,O){w.msg="invalid literal/lengths set",h.mode=30;break}if(h.distbits=6,h.distcode=h.distdyn,I={bits:h.distbits},O=x(v,h.lens,h.nlen,h.ndist,h.distcode,0,h.work,I),h.distbits=I.bits,O){w.msg="invalid distances set",h.mode=30;break}if(h.mode=20,z===6)break t;case 20:h.mode=21;case 21:if(6<=X&&258<=q){w.next_out=tt,w.avail_out=q,w.next_in=W,w.avail_in=X,h.hold=S,h.bits=F,i(w,V),tt=w.next_out,J=w.output,q=w.avail_out,W=w.next_in,U=w.input,X=w.avail_in,S=h.hold,F=h.bits,h.mode===12&&(h.back=-1);break}for(h.back=0;rt=(g=h.lencode[S&(1<>>16&255,st=65535&g,!((et=g>>>24)<=F);){if(X===0)break t;X--,S+=U[W++]<>nt)])>>>16&255,st=65535&g,!(nt+(et=g>>>24)<=F);){if(X===0)break t;X--,S+=U[W++]<>>=nt,F-=nt,h.back+=nt}if(S>>>=et,F-=et,h.back+=et,h.length=st,rt===0){h.mode=26;break}if(32&rt){h.back=-1,h.mode=12;break}if(64&rt){w.msg="invalid literal/length code",h.mode=30;break}h.extra=15&rt,h.mode=22;case 22:if(h.extra){for(y=h.extra;F>>=h.extra,F-=h.extra,h.back+=h.extra}h.was=h.length,h.mode=23;case 23:for(;rt=(g=h.distcode[S&(1<>>16&255,st=65535&g,!((et=g>>>24)<=F);){if(X===0)break t;X--,S+=U[W++]<>nt)])>>>16&255,st=65535&g,!(nt+(et=g>>>24)<=F);){if(X===0)break t;X--,S+=U[W++]<>>=nt,F-=nt,h.back+=nt}if(S>>>=et,F-=et,h.back+=et,64&rt){w.msg="invalid distance code",h.mode=30;break}h.offset=st,h.extra=15&rt,h.mode=24;case 24:if(h.extra){for(y=h.extra;F>>=h.extra,F-=h.extra,h.back+=h.extra}if(h.offset>h.dmax){w.msg="invalid distance too far back",h.mode=30;break}h.mode=25;case 25:if(q===0)break t;if(j=V-q,h.offset>j){if((j=h.offset-j)>h.whave&&h.sane){w.msg="invalid distance too far back",h.mode=30;break}at=j>h.wnext?(j-=h.wnext,h.wsize-j):h.wnext-j,j>h.length&&(j=h.length),ot=h.window}else ot=J,at=tt-h.offset,j=h.length;for(qD?(B=at[ot+f[z]],F[$+f[z]]):(B=96,0),m=1<>tt)+(E-=m)]=P<<24|B<<16|M|0,E!==0;);for(m=1<>=1;if(m!==0?(S&=m-1,S+=m):S=0,z++,--V[w]==0){if(w===U)break;w=v[A+f[z]]}if(J>>7)]}function $(g,T){g.pending_buf[g.pending++]=255&T,g.pending_buf[g.pending++]=T>>>8&255}function V(g,T,N){g.bi_valid>u-N?(g.bi_buf|=T<>u-g.bi_valid,g.bi_valid+=N-u):(g.bi_buf|=T<>>=1,N<<=1,0<--T;);return N>>>1}function ot(g,T,N){var G,k,Y=new Array(f+1),Z=0;for(G=1;G<=f;G++)Y[G]=Z=Z+N[G-1]<<1;for(k=0;k<=T;k++){var H=g[2*k+1];H!==0&&(g[2*k]=at(Y[H]++,H))}}function et(g){var T;for(T=0;T>1;1<=N;N--)nt(g,Y,N);for(k=Q;N=g.heap[1],g.heap[1]=g.heap[g.heap_len--],nt(g,Y,1),G=g.heap[1],g.heap[--g.heap_max]=N,g.heap[--g.heap_max]=G,Y[2*k]=Y[2*N]+Y[2*G],g.depth[k]=(g.depth[N]>=g.depth[G]?g.depth[N]:g.depth[G])+1,Y[2*N+1]=Y[2*G+1]=k,g.heap[1]=k++,nt(g,Y,1),2<=g.heap_len;);g.heap[--g.heap_max]=g.heap[1],function(it,dt){var yt,_t,xt,lt,Et,Ft,gt=dt.dyn_tree,Bt=dt.max_code,Pt=dt.stat_desc.static_tree,Mt=dt.stat_desc.has_stree,Nt=dt.stat_desc.extra_bits,Dt=dt.stat_desc.extra_base,wt=dt.stat_desc.max_length,Rt=0;for(lt=0;lt<=f;lt++)it.bl_count[lt]=0;for(gt[2*it.heap[it.heap_max]+1]=0,yt=it.heap_max+1;yt>=7;k>>=1)if(1&ht&&H.dyn_ltree[2*Q]!==0)return c;if(H.dyn_ltree[18]!==0||H.dyn_ltree[20]!==0||H.dyn_ltree[26]!==0)return o;for(Q=32;Q>>3,(Y=g.static_len+3+7>>>3)<=k&&(k=Y)):k=Y=N+5,N+4<=k&&T!==-1?y(g,T,N,G):g.strategy===4||Y===k?(V(g,2+(G?1:0),3),ct(g,K,w)):(V(g,4+(G?1:0),3),function(H,Q,ht,it){var dt;for(V(H,Q-257,5),V(H,ht-1,5),V(H,it-4,4),dt=0;dt>>8&255,g.pending_buf[g.d_buf+2*g.last_lit+1]=255&T,g.pending_buf[g.l_buf+g.last_lit]=255&N,g.last_lit++,T===0?g.dyn_ltree[2*N]++:(g.matches++,T--,g.dyn_ltree[2*(h[N]+v+1)]++,g.dyn_dtree[2*F(T)]++),g.last_lit===g.lit_bufsize-1},d._tr_align=function(g){V(g,2,3),j(g,E,K),function(T){T.bi_valid===16?($(T,T.bi_buf),T.bi_buf=0,T.bi_valid=0):8<=T.bi_valid&&(T.pending_buf[T.pending++]=255&T.bi_buf,T.bi_buf>>=8,T.bi_valid-=8)}(g)}},{"../utils/common":41}],53:[function(t,a,d){a.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,a,d){(function(s){(function(c,o){if(!c.setImmediate){var i,x,b,v,A=1,p={},l=!1,n=c.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(c);f=f&&f.setTimeout?f:c,i={}.toString.call(c.process)==="[object process]"?function(R){process.nextTick(function(){m(R)})}:function(){if(c.postMessage&&!c.importScripts){var R=!0,C=c.onmessage;return c.onmessage=function(){R=!1},c.postMessage("","*"),c.onmessage=C,R}}()?(v="setImmediate$"+Math.random()+"$",c.addEventListener?c.addEventListener("message",E,!1):c.attachEvent("onmessage",E),function(R){c.postMessage(v+R,"*")}):c.MessageChannel?((b=new MessageChannel).port1.onmessage=function(R){m(R.data)},function(R){b.port2.postMessage(R)}):n&&"onreadystatechange"in n.createElement("script")?(x=n.documentElement,function(R){var C=n.createElement("script");C.onreadystatechange=function(){m(R),C.onreadystatechange=null,x.removeChild(C),C=null},x.appendChild(C)}):function(R){setTimeout(m,0,R)},f.setImmediate=function(R){typeof R!="function"&&(R=new Function(""+R));for(var C=new Array(arguments.length-1),L=0;L"u"?s===void 0?this:s:self)}).call(this,typeof Ct<"u"?Ct:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Ot);var ue=Ot.exports;const le=he(ue);async function Ee(_,e=void 0){let t=await fetch(_);t.headers.get("Content-Length");let a=await t.arrayBuffer();return ce(a,fe(_))}async function ce(_,e=void 0){var v,A,p,l;let t=new Uint8Array(_);if(console.log("firstByte:",t[0]),t[0]!=80){let n=de(e);console.log("key=",e),console.log("keyBuf=",n);let f=0;for(var a=0;a{let d=new Image;d.src=`data:${_};base64, ${e}`,d.onload=()=>{t(d)},d.onerror=a})}function fe(_){let t=/[0-9a-z]{24}/i.exec(_);if(t!=null)return t[0]}function de(_){for(var e=new ArrayBuffer(_.length*2),t=new Uint16Array(e),a=0,d=_.length;a= 1.0 ) { gl_FragColor = vec4(1, 1, 0, 1); }else{ float dist2 = distance(v_position, v_center); if(dist2 < v_maxRadius * v_progress) { gl_FragColor = vec4(1, 1, 0, 1); }else{ gl_FragColor = vec4(0, 0, 0, 0); } } }else{ gl_FragColor = vec4(0, 0, 0, 0); } */ //gl_FragColor = vec4(1, 1, 0, 1); //gl_FragColor = map; vec4 colored = vec4(1, 1, 0, 1); if(dist < 0.001) { if( v_progress < 1.0 ) { float dist2 = distance(v_position, v_center); float r = v_maxRadius * v_progress + 0.001; if(dist2 < r) { float f = dist2 / r; if(f < v_progress) { gl_FragColor = colored; }else if(v_progress < 1.0){ float a = (f - 1.0) / (v_progress - 1.0); gl_FragColor = vec4(colored.xyz, a); }else{ gl_FragColor = colored; } }else { gl_FragColor = vec4(0,0,0,0); } }else{ gl_FragColor = colored; } }else{ gl_FragColor = vec4(0, 0, 0, 0); } } `,this.animatingAreas=[];const a=e.gl;this.program=bt(a,mt(a,a.VERTEX_SHADER,this.vertexShaderCode),mt(a,a.FRAGMENT_SHADER,this.fragmentShaderCode)),this.aPositionLoc=a.getAttribLocation(this.program,"a_position"),this.aTexcoordLoc=a.getAttribLocation(this.program,"a_texCoord"),this.aAreaIdLoc=a.getAttribLocation(this.program,"a_areaId"),this.aCenterLoc=a.getAttribLocation(this.program,"a_center"),this.aProgressLoc=a.getAttribLocation(this.program,"a_progress"),this.aMaxRadiusLoc=a.getAttribLocation(this.program,"a_maxRadius"),this.uMatrixLoc=a.getUniformLocation(this.program,"u_matrix"),this.maxCount=t.data.maxAreaCountOfGroup,this.positionBuffer=a.createBuffer(),this.texCoordBuffer=a.createBuffer(),this.areaIdBuffer=a.createBuffer(),this.centerBuffer=a.createBuffer(),this.progressBuffer=a.createBuffer(),this.maxRadiusBuffer=a.createBuffer(),this.matrix=ut.projectionNoflipY(t.width,t.height),this.texture=a.createTexture(),a.bindTexture(a.TEXTURE_2D,this.texture),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,this.fillerData.width,this.fillerData.height,0,a.RGBA,a.UNSIGNED_BYTE,null),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),this.fb=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,this.fb),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,this.texture,0),a.bindFramebuffer(a.FRAMEBUFFER,null),this.positionArray=new Float32Array(this.maxCount*12),this.texCoordArray=new Float32Array(this.maxCount*12),this.areaIdArray=new Float32Array(this.maxCount*24),this.centerArray=new Float32Array(this.maxCount*12),this.progressArray=new Float32Array(this.maxCount*6),this.maxRadiusArray=new Float32Array(this.maxCount*6)}dispose(){let e=this.scene.gl;e.deleteBuffer(this.positionBuffer),e.deleteBuffer(this.texCoordBuffer),e.deleteBuffer(this.areaIdBuffer),e.deleteBuffer(this.centerBuffer),e.deleteBuffer(this.progressBuffer),e.deleteBuffer(this.maxRadiusBuffer),e.deleteProgram(this.program)}get width(){return this.fillerData.width}get height(){return this.fillerData.height}addArea(e,t,a,d=800){let s=new pe(e,t,a,0),c=new Ut(d,()=>{s.progress=c.value()},()=>{});this.scene.addAnimator(c),this.animatingAreas.push(s)}fillPoint(e,t,a,d,s){for(var c=0;cA.progress<1)}draw(e){const t=this.scene.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.fb),t.useProgram(this.program),t.viewport(0,0,this.fillerData.width,this.fillerData.height),t.enableVertexAttribArray(this.aPositionLoc),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.vertexAttribPointer(this.aPositionLoc,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(this.aTexcoordLoc),t.bindBuffer(t.ARRAY_BUFFER,this.texCoordBuffer),t.vertexAttribPointer(this.aTexcoordLoc,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(this.aAreaIdLoc),t.bindBuffer(t.ARRAY_BUFFER,this.areaIdBuffer),t.vertexAttribPointer(this.aAreaIdLoc,4,t.FLOAT,!1,0,0),t.enableVertexAttribArray(this.aCenterLoc),t.bindBuffer(t.ARRAY_BUFFER,this.centerBuffer),t.vertexAttribPointer(this.aCenterLoc,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(this.aProgressLoc),t.bindBuffer(t.ARRAY_BUFFER,this.progressBuffer),t.vertexAttribPointer(this.aProgressLoc,1,t.FLOAT,!1,0,0),t.enableVertexAttribArray(this.aMaxRadiusLoc),t.bindBuffer(t.ARRAY_BUFFER,this.maxRadiusBuffer),t.vertexAttribPointer(this.aMaxRadiusLoc,1,t.FLOAT,!1,0,0),t.uniformMatrix4fv(this.uMatrixLoc,!1,this.matrix),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.fillerData.mapTexure),t.drawArrays(t.TRIANGLES,0,e),t.bindFramebuffer(t.FRAMEBUFFER,null)}initTask(){let e=this.fillerData.taskList;const t=this.fillerData.width,a=this.fillerData.height;for(let c of e){let o=this.fillerData.data.areaHash.get(c);if(o){pt(this.positionArray,0,o.rect.x,o.rect.y,o.rect.width,o.rect.height),pt(this.texCoordArray,0,o.rect.x/t,o.rect.y/a,o.rect.width/t,o.rect.height/a),this.fillPoint(this.centerArray,0,o.center.x,o.center.y,6);var d=new At(o.id);d.fillFloatArray(this.areaIdArray,0,6);var s=zt(o.rect,o.center.x,o.center.y);console.log("rect=",o.rect,s,o.center.x,o.center.y),this.fillNumber(this.progressArray,0,1,6),this.fillNumber(this.maxRadiusArray,0,s,6);const i=this.scene.gl;i.bindBuffer(i.ARRAY_BUFFER,this.positionBuffer),i.bufferData(i.ARRAY_BUFFER,this.positionArray,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,this.texCoordBuffer),i.bufferData(i.ARRAY_BUFFER,this.texCoordArray,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,this.areaIdBuffer),i.bufferData(i.ARRAY_BUFFER,this.areaIdArray,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,this.centerBuffer),i.bufferData(i.ARRAY_BUFFER,this.centerArray,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,this.progressBuffer),i.bufferData(i.ARRAY_BUFFER,this.progressArray,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,this.maxRadiusBuffer),i.bufferData(i.ARRAY_BUFFER,this.maxRadiusArray,i.STATIC_DRAW),this.draw(6)}}}}class Re extends kt{constructor(e,t){super(),this.scene=e,this.fillerData=t,this.vertexShaderCode=` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat4 u_matrix; varying vec2 v_texCoord; void main() { gl_Position = u_matrix * vec4(a_position, 0, 1); v_texCoord = a_texCoord; } `,this.fragmentShaderCode=` precision mediump float; uniform sampler2D u_colored; uniform sampler2D u_mask; uniform vec2 u_pixelSize; varying vec2 v_texCoord; const float w1 = 0.147761; const float w2 = 0.118318; const float w3 = 0.0947416; vec4 GaussianBlur(in sampler2D image, in vec2 texCoord, in vec2 pixelSize) { vec4 C00 = texture2D(image, texCoord + vec2(-pixelSize.x, -pixelSize.y)) * w3 ; vec4 C01 = texture2D(image, texCoord + vec2(0.0, -pixelSize.y)) * w2; vec4 C02 = texture2D(image, texCoord + vec2(pixelSize.x, -pixelSize.y)) * w3 ; vec4 C10 = texture2D(image, texCoord + vec2(-pixelSize.x, 0.0)) * w2; vec4 C11 = texture2D(image, texCoord + vec2(0.0, 0.0)) * w1; vec4 C12 = texture2D(image, texCoord + vec2(pixelSize.x, 0.0)) * w2; vec4 C20 = texture2D(image, texCoord + vec2(-pixelSize.x, pixelSize.y)) * w3; vec4 C21 = texture2D(image, texCoord + vec2(0.0, pixelSize.y)) * w2; vec4 C22 = texture2D(image, texCoord + vec2(pixelSize.x, pixelSize.y)) * w3; return C00 + C01 + C02 + C10 + C11 + C12 + C20 + C21 + C22 ; } vec4 GaussianBlurR(in sampler2D image, in vec2 texCoord, in vec2 pixelSize) { vec4 C00 = texture2D(image, texCoord + vec2(-pixelSize.x, -pixelSize.y)) * w3 ; vec4 C01 = texture2D(image, texCoord + vec2(0.0, -pixelSize.y)) * w2; vec4 C02 = texture2D(image, texCoord + vec2(pixelSize.x, -pixelSize.y)) * w3 ; vec4 C10 = texture2D(image, texCoord + vec2(-pixelSize.x, 0.0)) * w2; vec4 C11 = texture2D(image, texCoord + vec2(0.0, 0.0)) * w1; vec4 C12 = texture2D(image, texCoord + vec2(pixelSize.x, 0.0)) * w2; vec4 C20 = texture2D(image, texCoord + vec2(-pixelSize.x, pixelSize.y)) * w3; vec4 C21 = texture2D(image, texCoord + vec2(0.0, pixelSize.y)) * w2; vec4 C22 = texture2D(image, texCoord + vec2(pixelSize.x, pixelSize.y)) * w3; vec4 g = C00 + C01 + C02 + C10 + C11 + C12 + C20 + C21 + C22 ; return g; } void main() { vec4 mask = GaussianBlurR(u_mask, v_texCoord, u_pixelSize); vec4 colored = GaussianBlur(u_colored, v_texCoord, u_pixelSize); //vec4 colored = texture2D(u_colored, v_texCoord); //gl_FragColor = vec4(colored.rgb, mask.a); if(mask.r >= 0.4) { gl_FragColor = vec4(colored.rgb, 1); //gl_FragColor = colored; }else{ gl_FragColor = vec4(0, 0, 0, 0); } } `,this.animatableMask=new me(e,t);const a=e.gl;this.program=bt(a,mt(a,a.VERTEX_SHADER,this.vertexShaderCode),mt(a,a.FRAGMENT_SHADER,this.fragmentShaderCode)),this.aPositionLoc=a.getAttribLocation(this.program,"a_position"),this.aTexcoordLoc=a.getAttribLocation(this.program,"a_texCoord"),this.uMatrixLoc=a.getUniformLocation(this.program,"u_matrix"),this.uMaskLoc=a.getUniformLocation(this.program,"u_mask"),this.uColoredLoc=a.getUniformLocation(this.program,"u_colored"),this.uPixelSizeLoc=a.getUniformLocation(this.program,"u_pixelSize"),this.positionBuffer=Lt(a,0,0,t.width,t.height),this.texCoordBuffer=Lt(a,0,0,1,1)}dispose(){let e=this.scene.gl;this.animatableMask.dispose(),e.deleteProgram(this.program),e.deleteBuffer(this.positionBuffer),e.deleteBuffer(this.texCoordBuffer)}initTask(){this.animatableMask.initTask(),this.scene.invalidate()}draw(){console.log("WorkLayer draw()");const e=this.scene.gl;e.useProgram(this.program),e.enableVertexAttribArray(this.aPositionLoc),e.bindBuffer(e.ARRAY_BUFFER,this.positionBuffer),e.vertexAttribPointer(this.aPositionLoc,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(this.aTexcoordLoc),e.bindBuffer(e.ARRAY_BUFFER,this.texCoordBuffer),e.vertexAttribPointer(this.aTexcoordLoc,2,e.FLOAT,!1,0,0),e.uniformMatrix4fv(this.uMatrixLoc,!1,this.scene.drawMatrix),e.uniform2f(this.uPixelSizeLoc,1/this.fillerData.width,1/this.fillerData.height),e.uniform1i(this.uMaskLoc,0),e.uniform1i(this.uColoredLoc,1),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this.animatableMask.texture),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,this.fillerData.colored),e.drawArrays(e.TRIANGLES,0,6)}preDraw(){this.animatableMask.flush()}tap(e,t,a,d){var i,x,b;let s=this.fillerData;if(s.currentGroup==null){(i=s.callback)==null||i.onFillFailed();return}const c=s.data.groupAreaHash(s.currentGroup);let o=this.fillerData.getArea(e,t,50,c);o!=null&&(this.animatableMask.addArea(o,e,t),s.setColored(o,s.currentGroup.color,e,t),(x=s.callback)==null||x.onFillSuccess(),s.currentGroup.isAllColored&&(s.switchToNextGroup()||(b=s.callback)==null||b.onFinish()))}async replay(){const e=this.scene.gl;e.bindFramebuffer(e.FRAMEBUFFER,this.animatableMask.fb),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.bindFramebuffer(e.FRAMEBUFFER,null);for(let t of this.fillerData.taskList){let a=this.fillerData.data.areaHash.get(t);a&&(this.animatableMask.addArea(a,a.center.x,a.center.y,200),this.scene.invalidate(),await _e(200))}}}const _e=_=>new Promise(e=>setTimeout(e,_));export{ve as B,At as C,we as F,kt as L,jt as P,Re as W,mt as a,It as b,bt as c,xe as d,ye as e,pt as f,ge as g,Qt as h,be as i,Ae as j,Ht as k,Ee as l,ut as m,ne as n,Gt as r};