textmode.js 0.1.6-beta.4 → 0.1.6-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,26 @@
1
+ var FA=Object.defineProperty;var GA=(d,P,x)=>P in d?FA(d,P,{enumerable:!0,configurable:!0,writable:!0,value:x}):d[P]=x;var g=(d,P,x)=>GA(d,typeof P!="symbol"?P+"":P,x);var A,t;A=this,t=function(d){class P extends Error{constructor(i,s,B={}){super(P.t(i,B));g(this,"A");g(this,"context");this.name="TextmodeError",this.A=s,this.context=B}static t(i,s){let B=i;if(s&&Object.keys(s).length>0){B+=`
2
+
3
+ 📋 Context:`;for(const[r,E]of Object.entries(s))B+=`
4
+ - ${r}: ${P.i(E)}`}return B+=`
5
+
6
+ `,B+="↓".repeat(24)+`
7
+ `,B}static i(i){if(i===null)return"null";if(i===void 0)return"undefined";if(typeof i=="string")return`"${i}"`;if(typeof i=="number"||typeof i=="boolean")return i+"";if(Array.isArray(i))return i.length===0?"[]":i.length<=5?`[${i.map(s=>P.i(s)).join(", ")}]`:`[${i.slice(0,3).map(s=>P.i(s)).join(", ")}, ... +${i.length-3} more]`;if(typeof i=="object"){const s=Object.keys(i);return s.length===0?"{}":s.length<=3?`{ ${s.map(B=>`${B}: ${P.i(i[B])}`).join(", ")} }`:`{ ${s.slice(0,2).map(B=>`${B}: ${P.i(i[B])}`).join(", ")}, ... +${s.length-2} more }`}return i+""}}var x=(o=>(o[o.SILENT=0]="SILENT",o[o.WARNING=1]="WARNING",o[o.ERROR=2]="ERROR",o[o.THROW=3]="THROW",o))(x||{});const y=class y{constructor(){g(this,"h",{l:3})}static D(){return y.o||(y.o=new y),y.o}C(e,i,s){const B="[textmode.js]";switch(this.h.l){case 0:return!1;case 1:return console.group(`%c${B} Oops! (╯°□°)╯︵ Something went wrong in your code.`,"color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;"),console.warn(P.t(e,i)),console.groupEnd(),!1;case 2:return console.group(`%c${B} Oops! (╯°□°)╯︵ Something went wrong in your code.`,"color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;"),console.error(P.t(e,i)),console.groupEnd(),!1;default:const r=new P(e,s,i);throw console.group(`%c${B} Oops! (╯°□°)╯︵ Something went wrong in your code.`,"color: #d32f2f; font-weight: bold; background: #ffcdd2; padding: 2px 6px; border-radius: 3px;"),r}}validate(e,i,s){return!!e||(this.C(i,s),!1)}u(e){this.h.l=e}};g(y,"o",null);let S=y;const C=S.D(),N=new WeakMap;function Y(o,e){N.set(o,e)}function V(o){return N.get(o)}class K{constructor(e,i,s=i,B={}){g(this,"P");g(this,"I");g(this,"m");g(this,"p");g(this,"v");g(this,"options");g(this,"_",null);g(this,"M",null);this.P=e,this.p=i,this.v=s,this.options={filter:"nearest",wrap:"clamp",format:"rgba",type:"unsigned_byte",...B},this.m=this.createTexture(),this.I=e.createFramebuffer(),this.G()}F(e){const{P:i}=this,s=i.getParameter(i.FRAMEBUFFER_BINDING);i.bindFramebuffer(i.FRAMEBUFFER,this.I);try{return e()}finally{i.bindFramebuffer(i.FRAMEBUFFER,s)}}createTexture(){const{P:e}=this,i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i);const s=this.options.filter==="linear"?e.LINEAR:e.NEAREST,B=this.options.wrap==="repeat"?e.REPEAT:e.CLAMP_TO_EDGE;return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,s),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,s),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,B),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,B),this.Y(),i}Y(){const{P:e}=this,i=this.options.type==="float"?e.FLOAT:e.UNSIGNED_BYTE;e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.p,this.v,0,e.RGBA,i,null)}G(){const{P:e}=this;e.bindFramebuffer(e.FRAMEBUFFER,this.I),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.m,0),e.bindFramebuffer(e.FRAMEBUFFER,null)}update(e){const{P:i}=this;i.bindTexture(i.TEXTURE_2D,this.m),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,1),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e),i.bindTexture(i.TEXTURE_2D,null)}S(e,i,s){const{P:B}=this;B.bindTexture(B.TEXTURE_2D,this.m),B.texImage2D(B.TEXTURE_2D,0,B.RGBA,i,s,0,B.RGBA,B.UNSIGNED_BYTE,e),B.bindTexture(B.TEXTURE_2D,null)}resize(e,i){const{P:s}=this;this.p=e,this.v=i,this.M=null,s.bindTexture(s.TEXTURE_2D,this.m),this.Y(),s.bindTexture(s.TEXTURE_2D,null)}U(){const{P:e}=this;this._={framebuffer:e.getParameter(e.FRAMEBUFFER_BINDING),viewport:e.getParameter(e.VIEWPORT)},e.bindFramebuffer(e.FRAMEBUFFER,this.I),e.viewport(0,0,this.p,this.v),Y(e,[0,0,this.p,this.v])}end(){if(!this._)return;const{P:e}=this;e.bindFramebuffer(e.FRAMEBUFFER,this._.framebuffer),e.viewport(...this._.viewport),Y(e,this._.viewport),this._=null}O(){const{P:e}=this;this.M||(this.M=new Uint8Array(this.p*this.v*4)),this.F(()=>{e.readPixels(0,0,this.p,this.v,e.RGBA,e.UNSIGNED_BYTE,this.M)})}get(e,i,s,B){const{P:r}=this;if(e===void 0&&i===void 0){const E=new Uint8Array(this.p*this.v*4);return this.F(()=>(r.readPixels(0,0,this.p,this.v,r.RGBA,r.UNSIGNED_BYTE,E),E))}if(s===void 0&&B===void 0){(e<0||i<0||e>=this.p||i>=this.v)&&(console.warn("The x and y values passed to Framebuffer.get are outside of its range and will be clamped."),e=Math.max(0,Math.min(e,this.p-1)),i=Math.max(0,Math.min(i,this.v-1)));const E=new Uint8Array(4);return this.F(()=>(r.readPixels(e,i,1,1,r.RGBA,r.UNSIGNED_BYTE,E),[E[0],E[1],E[2],E[3]]))}{e=Math.max(0,Math.min(e,this.p-1)),i=Math.max(0,Math.min(i,this.v-1)),s=Math.max(1,Math.min(s,this.p-e)),B=Math.max(1,Math.min(B,this.v-i));const E=new Uint8Array(s*B*4);return this.F(()=>(r.readPixels(e,i,s,B,r.RGBA,r.UNSIGNED_BYTE,E),E))}}dispose(){const{P:e}=this;this.I&&(e.deleteFramebuffer(this.I),this.I=null),this.m&&(e.deleteTexture(this.m),this.m=null),this.M=null}get framebuffer(){return this.I}get texture(){return this.m}get width(){return this.p}get height(){return this.v}get V(){return this.M}}class v{constructor(e,i,s){g(this,"P");g(this,"k");g(this,"$",new Map);g(this,"R",new Map);g(this,"H",0);g(this,"J");this.P=e,this.k=this.createProgram(i,s),this.J=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.L()}L(){const e=this.P.getProgramParameter(this.k,this.P.ACTIVE_UNIFORMS);for(let i=0;i<e;i++){const s=this.P.getActiveUniform(this.k,i);if(s){const B=this.P.getUniformLocation(this.k,s.name);B&&(this.$.set(s.name,B),this.R.set(s.name,s.type))}}}createProgram(e,i){const s=this.createShader(this.P.VERTEX_SHADER,e),B=this.createShader(this.P.FRAGMENT_SHADER,i),r=this.P.createProgram();if(this.P.attachShader(r,s),this.P.attachShader(r,B),this.P.linkProgram(r),!this.P.getProgramParameter(r,this.P.LINK_STATUS)){const E=this.P.getProgramInfoLog(r);throw Error("Shader program link error: "+E)}return this.P.deleteShader(s),this.P.deleteShader(B),r}createShader(e,i){const s=this.P.createShader(e);if(this.P.shaderSource(s,i),this.P.compileShader(s),!this.P.getShaderParameter(s,this.P.COMPILE_STATUS)){const B=this.P.getShaderInfoLog(s);throw this.P.deleteShader(s),Error("Shader compilation error: "+B)}return s}K(){this.P.useProgram(this.k),this.W()}j(e,i){const s=this.$.get(e);if(s)if(typeof i=="number")this.Z(e)?this.P.uniform1i(s,Math.floor(i)):this.P.uniform1f(s,i);else if(typeof i=="boolean")this.P.uniform1i(s,i?1:0);else if(Array.isArray(i))switch(i.length){case 2:this.P.uniform2f(s,i[0],i[1]);break;case 3:this.P.uniform3f(s,i[0],i[1],i[2]);break;case 4:this.P.uniform4f(s,i[0],i[1],i[2],i[3]);break;default:console.warn(`Unsupported array length ${i.length} for uniform '${e}'`)}else if(i instanceof WebGLTexture){const B=this.N();this.P.uniform1i(s,B),this.P.activeTexture(this.P.TEXTURE0+B),this.P.bindTexture(this.P.TEXTURE_2D,i)}else if(i instanceof K){const B=this.N();this.P.uniform1i(s,B),this.P.activeTexture(this.P.TEXTURE0+B),this.P.bindTexture(this.P.TEXTURE_2D,i.texture)}else console.warn(`Unsupported uniform type for '${e}':`,typeof i)}N(){return this.H>=this.J&&console.warn(`Exceeded maximum texture units (${this.J}). Texture may not render correctly.`),this.H++}Z(e){const i=this.R.get(e);return!!i&&(i===this.P.INT||i===this.P.INT_VEC2||i===this.P.INT_VEC3||i===this.P.INT_VEC4||i===this.P.SAMPLER_2D||i===this.P.SAMPLER_CUBE)}get X(){return this.k}dispose(){this.k&&(this.P.deleteProgram(this.k),this.k=null),this.$.clear(),this.R.clear(),this.H=0}W(){this.H=0}}class W{constructor(e){g(this,"P");g(this,"q",null);g(this,"AA",16);g(this,"tA",new Map);this.P=e}eA(){if(this.q)return;const e=this.P;this.q=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.q)}sA(){const e=this.P,i=e.getParameter(e.CURRENT_PROGRAM);let s=this.tA.get(i);return s||(s={iA:e.getAttribLocation(i,"a_position"),BA:e.getAttribLocation(i,"a_texCoord")},this.tA.set(i,s)),e.enableVertexAttribArray(s.iA),e.vertexAttribPointer(s.iA,2,e.FLOAT,!1,this.AA,0),e.enableVertexAttribArray(s.BA),e.vertexAttribPointer(s.BA,2,e.FLOAT,!1,this.AA,8),{rA:s.iA,QA:s.BA}}EA(e,i){const s=this.P;s.disableVertexAttribArray(e),s.disableVertexAttribArray(i)}gA(e,i){const s=this.P,B=V(s)||[0,0,s.canvas.width,s.canvas.height];return{oA:e/B[2]*2-1,nA:1-i/B[3]*2}}hA(e,i,s,B){const r=this.P;this.eA(),r.bindBuffer(r.ARRAY_BUFFER,this.q);const E=new Float32Array([e,B,0,0,s,B,1,0,e,i,0,1,e,i,0,1,s,B,1,0,s,i,1,1]);r.bufferData(r.ARRAY_BUFFER,E,r.DYNAMIC_DRAW)}dispose(){this.q&&(this.P.deleteBuffer(this.q),this.q=null),this.tA.clear()}}class BA extends W{constructor(e){super(e)}aA(e,i,s,B){const r=this.gA(e,i),E=this.gA(e+s,i+B);this.hA(r.oA,r.nA,E.oA,E.nA);const Q=this.sA();this.P.drawArrays(this.P.TRIANGLES,0,6),this.EA(Q.rA,Q.QA)}lA(e,i,s,B,r){this.aA(e,i,s,r),this.aA(e+s-r,i,r,B),this.aA(e,i+B-r,s,r),this.aA(e,i,r,B)}}class rA extends W{constructor(e){super(e)}draw(e,i,s,B,r){const E=s-e,Q=B-i,n=Math.hypot(E,Q);if(n===0){const a=r/2,l=this.gA(e-a,i-a),c=this.gA(e+a,i+a);this.hA(l.oA,l.nA,c.oA,c.nA)}else{const a=E/n,l=-Q/n,c=r/2,I=e+l*c,w=i+a*c,u=e-l*c,f=i-a*c,p=s+l*c,m=B+a*c,_=s-l*c,M=B-a*c,k=this.gA(I,w),O=this.gA(u,f),R=this.gA(p,m),sA=this.gA(_,M),U=this.P;this.eA(),U.bindBuffer(U.ARRAY_BUFFER,this.q);const RA=new Float32Array([k.oA,k.nA,0,0,O.oA,O.nA,0,1,R.oA,R.nA,1,0,O.oA,O.nA,0,1,sA.oA,sA.nA,1,1,R.oA,R.nA,1,0]);U.bufferData(U.ARRAY_BUFFER,RA,U.DYNAMIC_DRAW)}const h=this.sA();this.P.drawArrays(this.P.TRIANGLES,0,6),this.EA(h.rA,h.QA)}}var b="attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_uv;uniform float u_rotation;uniform vec2 u_center;uniform float u_aspectRatio;mat2 rotate2D(float angle){float s=sin(angle);float c=cos(angle);return mat2(c,-s,s,c);}void main(){v_uv=a_texCoord;vec2 pos=a_position;pos-=u_center;pos.x*=u_aspectRatio;pos=rotate2D(-u_rotation)*pos;pos.x/=u_aspectRatio;pos+=u_center;gl_Position=vec4(pos,0.0,1.0);}";class EA{constructor(e){g(this,"P");g(this,"DA");g(this,"CA");g(this,"cA",null);g(this,"uA");g(this,"PA");g(this,"IA",[1,1,1,1]);g(this,"wA",!0);g(this,"fA",[0,0,0,1]);g(this,"dA",1);g(this,"mA",!0);g(this,"pA",0);g(this,"vA",[]);this.P=e,this.DA=new v(this.P,b,"precision lowp float;uniform sampler2D u_texture;varying vec2 v_uv;void main(){gl_FragColor=texture2D(u_texture,v_uv);}"),this.CA=new v(this.P,b,"precision lowp float;uniform vec4 u_color;void main(){gl_FragColor=u_color;}"),this.uA=new BA(this.P),this.PA=new rA(this.P),this.P.enable(this.P.BLEND),this.P.blendEquation(this.P.FUNC_ADD),this.P.blendFunc(this.P.ONE,this.P.ONE_MINUS_SRC_ALPHA),Y(this.P,[0,0,this.P.canvas.width,this.P.canvas.height])}bA(e){this.cA!==e&&(this.cA=e,e.K())}fill(e,i,s,B){if(this.wA=!0,i===void 0&&s===void 0&&B===void 0){const r=e/255;this.IA=[r,r,r,1]}else if(s!==void 0&&B===void 0)this.IA=[e/255,i/255,s/255,1];else{if(s===void 0||B===void 0)throw Error("Invalid fill parameters. Use fill(gray), fill(r,g,b), or fill(r,g,b,a)");this.IA=[e/255,i/255,s/255,B/255]}}stroke(e,i,s,B){if(this.mA=!0,i===void 0&&s===void 0&&B===void 0){const r=e/255;this.fA=[r,r,r,1]}else if(s!==void 0&&B===void 0)this.fA=[e/255,i/255,s/255,1];else{if(s===void 0||B===void 0)throw Error("Invalid stroke parameters. Use stroke(gray), stroke(r,g,b), or stroke(r,g,b,a)");this.fA=[e/255,i/255,s/255,B/255]}}xA(e){if(e<0)throw Error("Stroke weight must be non-negative");this.dA=e}_A(){this.mA=!1}yA(){this.wA=!1}rotate(e){this.pA=e}push(){this.vA.push({MA:[...this.IA],wA:this.wA,GA:[...this.fA],xA:this.dA,mA:this.mA,rotation:this.pA})}pop(){const e=this.vA.pop();e?(this.IA=e.MA,this.wA=e.wA,this.fA=e.GA,this.dA=e.xA,this.mA=e.mA,this.pA=e.rotation):console.warn("pop() called without matching push()")}reset(){this.cA=null,this.vA=[],this.pA=0}createShader(e,i){return new v(this.P,e,i)}FA(e){return new v(this.P,b,e)}j(e,i){this.cA.j(e,i)}rect(e,i,s,B){if(this.cA!==null){const{YA:l,TA:c,SA:I,aspectRatio:w}=this.UA(e,i,s,B);return this.j("u_rotation",I),this.j("u_center",[l,c]),this.j("u_aspectRatio",w),this.uA.aA(e,i,s,B),void(this.cA=null)}const r=this.CA;let E=0,Q=0,n=0,h=1;const a=this.UA(e,i,s,B);E=a.YA,Q=a.TA,n=a.SA,h=a.aspectRatio,this.wA&&(this.bA(r),this.j("u_color",this.IA),this.j("u_rotation",n),this.j("u_center",[E,Q]),this.j("u_aspectRatio",h),this.uA.aA(e,i,s,B)),this.mA&&this.dA>0&&(this.bA(r),this.j("u_color",this.fA),this.j("u_rotation",n),this.j("u_center",[E,Q]),this.j("u_aspectRatio",h),this.uA.lA(e,i,s,B,this.dA)),this.cA=null}line(e,i,s,B){if(this.cA!==null){const u=(e+s)/2,f=(i+B)/2,p=Math.abs(s-e)||1,m=Math.abs(B-i)||1,{YA:_,TA:M,SA:k,aspectRatio:O}=this.UA(u-p/2,f-m/2,p,m);this.j("u_rotation",k),this.j("u_center",[_,M]),this.j("u_aspectRatio",O);const R=this.dA>0?this.dA:1;return this.PA.draw(e,i,s,B,R),void(this.cA=null)}if(!this.mA||this.dA<=0)return;const r=this.CA,E=(e+s)/2,Q=(i+B)/2,n=Math.abs(s-e)||1,h=Math.abs(B-i)||1,a=this.pA!==0;let l=0,c=0,I=0,w=1;if(a){const u=this.UA(E-n/2,Q-h/2,n,h);l=u.YA,c=u.TA,I=u.SA,w=u.aspectRatio}this.bA(r),this.j("u_color",this.fA),a&&(this.j("u_rotation",I),this.j("u_center",[l,c]),this.j("u_aspectRatio",w)),this.PA.draw(e,i,s,B,this.dA)}UA(e,i,s,B){const r=V(this.P)||[0,0,this.P.canvas.width,this.P.canvas.height],E=r[2],Q=r[3],n=E/Q;return{YA:(e+s/2)/E*2-1,TA:1-(i+B/2)/Q*2,SA:this.pA*Math.PI/180,aspectRatio:n}}createFramebuffer(e,i,s={}){return new K(this.P,e,i,s)}background(e,i=e,s=e,B=255){this.clear(e/255,i/255,s/255,B/255)}clear(e=0,i=0,s=0,B=0){this.P.clearColor(e,i,s,B),this.P.clear(this.P.COLOR_BUFFER_BIT)}OA(){this.P.viewport(0,0,this.P.canvas.width,this.P.canvas.height),Y(this.P,[0,0,this.P.canvas.width,this.P.canvas.height])}get context(){return this.P}dispose(){this.DA.dispose(),this.CA.dispose(),this.uA.dispose(),this.PA.dispose(),this.DA=null,this.CA=null,this.cA=null,this.uA=null,this.PA=null,this.vA=[]}image(e,i,s,B,r){const E=this.P,Q=B??e.width,n=r??e.height;this.bA(this.DA),this.j("u_texture",e.texture);const h=this.UA(i,s,Q,n);this.j("u_rotation",h.SA),this.j("u_center",[h.YA,h.TA]),this.j("u_aspectRatio",h.aspectRatio),this.uA.aA(i,s,Q,n),E.bindTexture(E.TEXTURE_2D,null),this.cA=null}}var F,D={parse:function(o){var e=function(i,s,B,r){var E=D.T,Q={cmap:E.cmap,head:E.head,hhea:E.hhea,maxp:E.maxp,hmtx:E.hmtx,loca:E.loca,glyf:E.glyf},n={_data:i,_index:s,_offset:B};for(var h in Q){var a=D.findTable(i,h,B);if(a){var l=a[0],c=r[l];c==null&&(c=Q[h].VA(i,l,a[1],n)),n[h]=r[l]=c}}return n}(new Uint8Array(o),0,0,{});return[e]},findTable:function(o,e,i){for(var s=D.B,B=s.kA(o,i+4),r=i+12,E=0;E<B;E++){var Q=s.$A(o,r,4);s.RA(o,r+4);var n=s.RA(o,r+8),h=s.RA(o,r+12);if(Q==e)return[n,h];r+=16}return null},T:{}};D.B={HA:function(o,e){return D.B.zA.uint16[0]=o[e]<<8|o[e+1],D.B.zA.int16[0]},kA:function(o,e){return o[e]<<8|o[e+1]},JA:function(o,e,i){for(var s=[],B=0;B<i;B++)s.push(D.B.kA(o,e+2*B));return s},RA:function(o,e){var i=D.B.zA.uint8;return i[3]=o[e],i[2]=o[e+1],i[1]=o[e+2],i[0]=o[e+3],D.B.zA.uint32[0]},$A:function(o,e,i){for(var s="",B=0;B<i;B++)s+=String.fromCharCode(o[e+B]);return s},zA:(F=new ArrayBuffer(8),{uint8:new Uint8Array(F),int16:new Int16Array(F),uint16:new Uint16Array(F),uint32:new Uint32Array(F)})},D.T.cmap={VA:function(o,e,i){var s={LA:[],KA:{},off:e};o=new Uint8Array(o.buffer,e,i),e=0;var B=D.B,r=B.kA,E=D.T.cmap;r(o,e);var Q=r(o,e+=2);e+=2;for(var n=[],h=0;h<Q;h++){var a=r(o,e),l=r(o,e+=2);e+=2;var c=B.RA(o,e);e+=4;var I="p"+a+"e"+l,w=n.indexOf(c);if(w==-1){w=s.LA.length;var u={};n.push(c);var f=u.format=r(o,c);f==4?u=E.WA(o,c,u):f==12&&(u=E.jA(o,c,u)),s.LA.push(u)}s.KA[I]!=null&&console.log("multiple tables for one platform+encoding: "+I),s.KA[I]=w}return s},WA:function(o,e,i){var s=D.B,B=s.kA,r=s.JA,E=e,Q=B(o,e+=2);B(o,e+=2);var n=B(o,e+=2);e+=2;var h=n>>>1;i.ZA=B(o,e),e+=2,i.NA=B(o,e),e+=2,i.XA=B(o,e),e+=2,i.qA=r(o,e,h),e+=2*h,e+=2,i.At=r(o,e,h),e+=2*h,i.tt=[];for(var a=0;a<h;a++)i.tt.push(s.HA(o,e)),e+=2;return i.et=r(o,e,h),e+=2*h,i.st=r(o,e,E+Q-e>>1),i},jA:function(o,e,i){var s=D.B.RA;s(o,e+=4),s(o,e+=4);var B=3*s(o,e+=4);e+=4;for(var r=i.groups=new Uint32Array(B),E=0;E<B;E+=3)r[E]=s(o,e+(E<<2)),r[E+1]=s(o,e+(E<<2)+4),r[E+2]=s(o,e+(E<<2)+8);return i}},D.T.head={VA:function(o,e,i){var s=D.B,B={};return e+=18,B.unitsPerEm=s.kA(o,e),e+=2,e+=16,B.xMin=s.HA(o,e),e+=2,B.yMin=s.HA(o,e),e+=2,B.xMax=s.HA(o,e),e+=2,B.yMax=s.HA(o,e),e+=2,e+=6,B.indexToLocFormat=s.HA(o,e),B}},D.T.hhea={VA:function(o,e,i){var s=D.B,B={};e+=4;for(var r=["ascender","descender","lineGap","advanceWidthMax","minLeftSideBearing","minRightSideBearing","xMaxExtent","caretSlopeRise","caretSlopeRun","caretOffset","res0","res1","res2","res3","metricDataFormat","numberOfHMetrics"],E=0;E<r.length;E++){var Q=r[E],n=Q=="advanceWidthMax"||Q=="numberOfHMetrics"?s.kA:s.HA;B[Q]=n(o,e+2*E)}return B}},D.T.hmtx={VA:function(o,e,i,s){for(var B=D.B,r=[],E=[],Q=s.maxp.numGlyphs,n=s.hhea.numberOfHMetrics,h=0,a=0,l=0;l<n;)h=B.kA(o,e+(l<<2)),a=B.HA(o,e+(l<<2)+2),r.push(h),E.push(a),l++;for(;l<Q;)r.push(h),E.push(a),l++;return{it:r,Bt:E}}},D.T.maxp={VA:function(o,e,i){var s=D.B,B=s.kA,r={};return s.RA(o,e),e+=4,r.numGlyphs=B(o,e),e+=2,r}},D.T.loca={VA:function(o,e,i,s){var B=D.B,r=[],E=s.head.indexToLocFormat,Q=s.maxp.numGlyphs+1;if(E==0)for(var n=0;n<Q;n++)r.push(B.kA(o,e+(n<<1))<<1);if(E==1)for(n=0;n<Q;n++)r.push(B.RA(o,e+(n<<2)));return r}},D.T.glyf={VA:function(o,e,i,s){for(var B=[],r=s.maxp.numGlyphs,E=0;E<r;E++)B.push(null);return B},rt:function(o,e){var i=D.B,s=o._data,B=o.loca;if(B[e]==B[e+1])return null;var r=D.findTable(s,"glyf",o._offset)[0]+B[e],E={};if(E.Qt=i.HA(s,r),r+=2,E.xMin=i.HA(s,r),r+=2,E.yMin=i.HA(s,r),r+=2,E.xMax=i.HA(s,r),r+=2,E.yMax=i.HA(s,r),r+=2,E.xMin>=E.xMax||E.yMin>=E.yMax)return null;if(E.Qt>0){E.Et=[];for(var Q=0;Q<E.Qt;Q++)E.Et.push(i.kA(s,r)),r+=2;var n=i.kA(s,r);if(r+=2,s.length-r<n)return null;r+=n;var h=E.Et[E.Qt-1]+1;for(E.flags=[],Q=0;Q<h;Q++){var a=s[r];if(r++,E.flags.push(a),8&a){var l=s[r];r++;for(var c=0;c<l;c++)E.flags.push(a),Q++}}for(E.gt=[],Q=0;Q<h;Q++){var I=!!(2&E.flags[Q]),w=!!(16&E.flags[Q]);I?(E.gt.push(w?s[r]:-s[r]),r++):w?E.gt.push(0):(E.gt.push(i.HA(s,r)),r+=2)}for(E.ot=[],Q=0;Q<h;Q++)I=!!(4&E.flags[Q]),w=!!(32&E.flags[Q]),I?(E.ot.push(w?s[r]:-s[r]),r++):w?E.ot.push(0):(E.ot.push(i.HA(s,r)),r+=2);var u=0,f=0;for(Q=0;Q<h;Q++)u+=E.gt[Q],f+=E.ot[Q],E.gt[Q]=u,E.ot[Q]=f}else E.nt=[];return E}},typeof module<"u"&&module.exports?module.exports=D:typeof window<"u"&&(window.Typr=D);class QA{ht(e){var s;const i=[];return(s=e==null?void 0:e.cmap)!=null&&s.LA?(e.cmap.LA.forEach(B=>{if(B.format===4){const r=this.lt(B);i.push(...r)}else if(B.format===12){const r=this.Dt(B);i.push(...r)}}),[...new Set(i)]):[]}lt(e){const i=[];if(!(e.At&&e.qA&&e.et&&e.tt))return i;for(let s=0;s<e.At.length;s++){const B=e.At[s],r=e.qA[s];if(B!==65535||r!==65535){for(let E=B;E<=r;E++)if(this.Ct(e,E,s)>0){const Q=String.fromCodePoint(E);i.push(Q)}}}return i}Dt(e){const i=[];if(!e.groups)return i;for(let s=0;s<e.groups.length;s+=3){const B=e.groups[s],r=e.groups[s+1],E=e.groups[s+2];for(let Q=B;Q<=r;Q++)if(E+(Q-B)>0){const n=String.fromCodePoint(Q);i.push(n)}}return i}Ct(e,i,s){if(e.et[s]===0)return i+e.tt[s]&65535;{const B=e.et[s]/2+(i-e.At[s])-(e.At.length-s);if(B>=0&&e.st&&B<e.st.length){const r=e.st[B];if(r!==0)return r+e.tt[s]&65535}}return 0}ct(e){return e.filter(i=>this.ut(i))}ut(e){const i=e.codePointAt(0)||0;return!(i>=0&&i<=31&&i!==9&&i!==10&&i!==13||i>=127&&i<=159)}}class gA{constructor(e){g(this,"Pt");g(this,"It");g(this,"wt");this.wt=e,this.Pt=document.createElement("canvas"),this.It=this.Pt.getContext("2d",{ft:!0,alpha:!1})}dt(e,i,s,B){const r=e.length,E=Math.ceil(Math.sqrt(r)),Q=Math.ceil(r/E),n=i.width*E,h=i.height*Q;this.vt(n,h,s,B),this.bt(e,i,E,s),this.xt();const a=this.wt.createFramebuffer(n,h,{filter:"nearest"});return a.update(this.Pt),{framebuffer:a,columns:E,rows:Q}}vt(e,i,s,B){this.Pt.width=e,this.Pt.height=i,this.Pt.style.width=e+"px",this.Pt.style.height=e+"px",this.It.imageSmoothingEnabled=!1,this.Pt.style.imageRendering="pixelated",this.It.fillStyle="black",this.It.fillRect(0,0,e,i),this.It.font=`${s}px ${B}`,this.It.textBaseline="top",this.It.textAlign="left",this.It.fillStyle="white"}bt(e,i,s,B){for(let r=0;r<e.length;r++){const E=r%s,Q=Math.floor(r/s),n=E*i.width+.5*i.width,h=Q*i.height+.5*i.height,a=Math.round(n-.5*i.width),l=Math.round(h-.5*B);this.It.fillText(e[r]._t,a,l)}}xt(e=128){const i=this.It.getImageData(0,0,this.Pt.width,this.Pt.height),s=i.data;for(let B=0;B<s.length;B+=4){const r=.299*s[B]+.587*s[B+1]+.114*s[B+2]>e+32?255:0;s[B]=r,s[B+1]=r,s[B+2]=r}this.It.putImageData(i,0,0)}}class oA{constructor(){g(this,"yt");g(this,"Mt");this.yt=document.createElement("canvas"),this.Mt=this.yt.getContext("2d")}Gt(e,i,s){this.Mt.font=`${i}px ${s}`;let B=0,r=0;for(const E of e){const Q=this.Mt.measureText(E),n=Q.width,h=Q.actualBoundingBoxAscent+Q.actualBoundingBoxDescent;n>0&&(B=Math.max(B,n),r=Math.max(r,h))}return{width:Math.ceil(B),height:Math.ceil(r)}}}class nA{Ft(e,i){return e.map((s,B)=>{const r=s.codePointAt(0)||0,E=this.Yt(B);let Q=0;if(i.hmtx&&i.hmtx.it){const n=this.Tt(i,r);n>0&&i.hmtx.it[n]!==void 0&&(Q=i.hmtx.it[n])}return{_t:s,unicode:r,color:E,St:Q}})}Tt(e,i){const s=e.cmap;if(!s||!s.LA)return 0;for(const B of s.LA)if(B.format===4){for(let r=0;r<B.At.length;r++)if(i>=B.At[r]&&i<=B.qA[r]){if(B.et[r]===0)return i+B.tt[r]&65535;{const E=B.et[r]/2+(i-B.At[r])-(B.At.length-r);if(E>=0&&E<B.st.length){const Q=B.st[E];if(Q!==0)return Q+B.tt[r]&65535}}}}return 0}Yt(e){return[e%256,Math.floor(e/256)%256,Math.floor(e/65536)%256]}Ut(e,i){if(!C.validate(typeof e=="string","Character must be a string.",{method:"getCharacterColor",Ot:e}))return[0,0,0];const s=i.find(B=>B._t===e);return s?s.color:[0,0,0]}Vt(e,i){return C.validate(typeof e=="string"&&e.length>0,"Characters must be a string with at least one character.",{method:"getCharacterColors",Ot:e})?e.split("").map(s=>this.Ut(s,i)||[0,0,0]):[[0,0,0]]}}class X{constructor(e,i=16){g(this,"kt");g(this,"$t",[]);g(this,"Rt");g(this,"Ht",16);g(this,"zt",0);g(this,"Jt",0);g(this,"Lt",{width:0,height:0});g(this,"Kt");g(this,"Wt","UrsaFont");g(this,"jt");g(this,"Zt");g(this,"Nt");g(this,"Xt");this.Ht=i,this.jt=new QA,this.Zt=new gA(e),this.Nt=new oA,this.Xt=new nA}async initialize(e){let i;if(e){const s=await fetch(e);if(!s.ok)throw new P(`Failed to load font file: ${s.status} ${s.statusText}`);i=await s.arrayBuffer()}else i=await(await fetch(`data:font/truetype;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMs+QEyQAAAEoAAAAYGNtYXAg7yVJAAAFjAAACSBnbHlmuHLTdAAAErQAAGi0aGVhZFvXdUwAAACsAAAANmhoZWELAQUCAAAA5AAAACRobXR4BACDgAAAAYgAAAQEbG9jYQAy54AAAA6sAAAECG1heHABIgCCAAABCAAAACBuYW1lVs/OSgAAe2gAAAOicG9zdABpADQAAH8MAAAAIAABAAAAAQAAzOWHqV8PPPUAAAQAAAAAAHxiGCcAAAAAfGIYJwAAAAAEAAQAAAAACAACAAEAAAAAAAEAAAQAAAAAAAQAAAAAAAcAAAEAAAAAAAAAAAAAAAAAAAEBAAEAAAEBAIAAIAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAgQAAZAABQAEAgACAAAAAAACAAIAAAACAAAzAMwAAAAABAAAAAAAAACAAACLAABw4wAAAAAAAAAAWUFMLgBAACAmawQAAAAAAAQAAAAAAAFRAAAAAAMABAAAAAAgAAAEAAAABAAAAAQAAAAEAAGABAABAAQAAIAEAACABAAAgAQAAIAEAAGABAABAAQAAQAEAACABAABAAQAAIAEAACABAABAAQAAIAEAACABAAAgAQAAIAEAACABAAAgAQAAIAEAACABAAAgAQAAIAEAACABAABAAQAAIAEAAEABAAAgAQAAIAEAACABAAAgAQAAIAEAACABAAAgAQAAIAEAACABAAAgAQAAIAEAACABAAAgAQAAIAEAACABAAAgAQAAIAEAACABAAAgAQAAIAEAACABAAAgAQAAIAEAACABAAAgAQAAIAEAACABAAAgAQAAIAEAACABAABAAQAAIAEAAEABAAAgAQAAIAEAAEABAAAgAQAAIAEAACABAAAgAQAAIAEAAEABAAAgAQAAIAEAAGABAAAgAQAAIAEAAGABAAAgAQAAIAEAACABAAAgAQAAIAEAAEABAAAgAQAAIAEAACABAAAgAQAAIAEAACABAAAgAQAAIAEAACABAABgAQAAQAEAAC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AAAAA==\r
8
+ `)).arrayBuffer();await this.qt(i),this.kt=D.parse(i)[0],await this.Ae()}te(e){if(e===void 0)return this.Ht;this.Ht=e,this.Lt=this.Nt.Gt(this.$t.map(s=>s._t),this.Ht,this.Wt);const i=this.Zt.dt(this.$t,this.Lt,this.Ht,this.Wt);this.Rt=i.framebuffer,this.zt=i.columns,this.Jt=i.rows}async ee(e){try{const i=await fetch(e);if(!i.ok)throw new P(`Failed to load font file: ${i.status} ${i.statusText}`);const s=await i.arrayBuffer();await this.qt(s);const B=D.parse(s);if(!B||B.length===0)throw Error("Failed to parse font file");this.kt=B[0],await this.Ae()}catch(i){throw new P("Failed to load font: "+(i instanceof Error?i.message:"Unknown error"),i)}}async qt(e){const i=Date.now();this.Wt=this.Wt==="UrsaFont"?"UrsaFont":"CustomFont_"+i,this.Kt=new FontFace(this.Wt,e),await this.Kt.load(),document.fonts.add(this.Kt)}async Ae(){const e=this.jt.ht(this.kt),i=this.jt.ct(e);this.$t=this.Xt.Ft(i,this.kt),this.Lt=this.Nt.Gt(i,this.Ht,this.Wt);const s=this.Zt.dt(this.$t,this.Lt,this.Ht,this.Wt);this.Rt=s.framebuffer,this.zt=s.columns,this.Jt=s.rows}Ut(e){return this.Xt.Ut(e,this.$t)}Vt(e){return this.Xt.Vt(e,this.$t)}se(e){if(typeof e!="string"||e.length===0)return!1;const i=new Set(this.$t.map(s=>s._t));for(const s of e)if(!i.has(s))return!1;return!0}get ie(){return this.Rt}get Be(){return this.$t}get re(){return this.zt}get Qe(){return this.Jt}get Ee(){return this.Lt}dispose(){this.Rt.dispose(),document.fonts.delete(this.Kt),this.Rt=null,this.Kt=null,this.kt=null,this.$t=[],this.Lt={width:0,height:0},this.zt=0,this.Jt=0}get fontSize(){return this.Ht}get font(){return this.kt}}class Z{constructor(e,i,s){g(this,"ge");g(this,"oe");g(this,"p");g(this,"v");g(this,"ne");g(this,"he");g(this,"ae",!1);g(this,"le");g(this,"De");g(this,"Ce");this.le=e,this.De=i,this.Ce=s,this.reset()}reset(){if(!this.ae){const e=this.le.width,i=this.le.height;[this.ge,this.oe]=[Math.floor(e/this.De),Math.floor(i/this.Ce)]}this.ce()}ce(){const e=this.le.width,i=this.le.height;this.p=this.ge*this.De,this.v=this.oe*this.Ce,this.ne=Math.floor((e-this.p)/2),this.he=Math.floor((i-this.v)/2)}ue(e,i){[this.De,this.Ce]=[e,i],this.reset()}Pe(e,i){this.ae=!0,[this.ge,this.oe]=[e,i],this.ce()}Ie(){this.ae=!1,this.reset()}resize(){this.ae?this.ce():this.reset()}we(e){if(e===void 0)return this.ae;this.ae=e}get fe(){return this.De}get de(){return this.Ce}dispose(){this.le=null,this.ge=0,this.oe=0,this.p=0,this.v=0,this.ne=0,this.he=0,this.De=0,this.Ce=0}get cols(){return this.ge}get rows(){return this.oe}get width(){return this.p}get height(){return this.v}get offsetX(){return this.ne}get offsetY(){return this.he}}class q{constructor(e,i=!1,s={}){g(this,"le");g(this,"me");g(this,"pe");g(this,"ve");g(this,"be");this.me=e,this.pe=i,this.le=this.xe(s.width,s.height),i&&this._e()}xe(e,i){var B;const s=document.createElement("canvas");if(s.className="textmodeCanvas",s.style.imageRendering="pixelated",this.pe)s.width=e||800,s.height=i||600,document.body.appendChild(s);else{const r=this.me.getBoundingClientRect();let E=Math.round(r.width),Q=Math.round(r.height);if(this.me instanceof HTMLVideoElement){const a=this.me;(E===0||Q===0)&&a.videoWidth>0&&a.videoHeight>0&&(E=a.videoWidth,Q=a.videoHeight)}s.width=E,s.height=Q,s.style.position="absolute",s.style.pointerEvents="none";const n=window.getComputedStyle(this.me);let h=parseInt(n.zIndex||"0",10);isNaN(h)&&(h=0),s.style.zIndex=""+(h+1),this.ye(s),(B=this.me.parentNode)==null||B.insertBefore(s,this.me.nextSibling)}return s}ye(e){const i=this.me.getBoundingClientRect();let s=this.me.offsetParent;if(s&&s!==document.body){const B=s.getBoundingClientRect();e.style.top=i.top-B.top+"px",e.style.left=i.left-B.left+"px"}else e.style.top=i.top+window.scrollY+"px",e.style.left=i.left+window.scrollX+"px"}resize(e,i){if(this.pe)this.le.width=e??this.le.width,this.le.height=i??this.le.height;else{const s=this.me.getBoundingClientRect();let B=Math.round(s.width),r=Math.round(s.height);if(this.me instanceof HTMLVideoElement){const E=this.me;(B===0||r===0)&&E.videoWidth>0&&E.videoHeight>0&&(B=E.videoWidth,r=E.videoHeight)}this.le.width=B,this.le.height=r,this.ye(this.le)}}Me(){const e={alpha:!1,premultipliedAlpha:!1,Ge:!0,antialias:!1,Fe:!1,Ye:!1,powerPreference:"high-performance"},i=this.le.getContext("webgl2",e)||this.le.getContext("webgl",e);if(!i)throw new P("WebGL context could not be created. Ensure your browser supports WebGL.");return i}Te(){return this.le?{width:this.le.width,height:this.le.height}:{width:0,height:0}}Se(){if(!this.le||!this.pe)return!1;const e=this.le.getBoundingClientRect(),i=Math.round(e.width),s=Math.round(e.height);return i!==this.le.width||s!==this.le.height}_e(){typeof ResizeObserver<"u"&&(this.ve=new ResizeObserver(e=>{for(const i of e){const s=i.contentRect,B=Math.round(s.width),r=Math.round(s.height);!this.be||B===this.le.width&&r===this.le.height||this.be()}}),this.ve.observe(this.le))}dispose(){if(this.ve&&(this.ve.disconnect(),this.ve=void 0),this.le){const e=this.le.getContext("webgl")||this.le.getContext("webgl2");if(e){const i=e.getExtension("WEBGL_lose_context");i&&i.Ue()}this.le.parentNode&&this.le.parentNode.removeChild(this.le),this.le=null}this.me=null}get canvas(){return this.le}get width(){return this.le.width}get height(){return this.le.height}}class T{constructor(e,i,s,B={}){g(this,"Oe");g(this,"Ve");g(this,"grid");g(this,"ke");g(this,"$e");g(this,"Re");g(this,"He");g(this,"ze");g(this,"h");this.Oe=e,this.Ve=i,this.grid=s,this.h=B,this.ke=this.Oe.createFramebuffer(this.grid.cols,this.grid.rows),this.$e=this.Oe.createFramebuffer(this.grid.cols,this.grid.rows),this.Re=this.Oe.createFramebuffer(this.grid.cols,this.grid.rows),this.He=this.Oe.createFramebuffer(this.grid.cols,this.grid.rows),this.ze=this.Oe.createFramebuffer(this.grid.cols,this.grid.rows)}resize(){this.ke.resize(this.grid.cols,this.grid.rows),this.$e.resize(this.grid.cols,this.grid.rows),this.Re.resize(this.grid.cols,this.grid.rows),this.He.resize(this.grid.cols,this.grid.rows),this.ze.resize(this.grid.cols,this.grid.rows)}enabled(e){this.h.enabled=e}enable(){this.enabled(!0)}disable(){this.enabled(!1)}dispose(){this.ke.dispose(),this.$e.dispose(),this.Re.dispose(),this.He.dispose(),this.ze.dispose(),this.ke=null,this.$e=null,this.Re=null,this.He=null,this.ze=null}get Je(){return this.ke}get Le(){return this.$e}get Ke(){return this.Re}get We(){return this.He}get je(){return this.ze}get options(){return this.h}}class hA{constructor(e,i){g(this,"I");g(this,"wt");g(this,"Ze");this.wt=e,this.Ze=i;const s=Math.max(this.Ze.length,1);this.I=this.wt.createFramebuffer(s,1),this.Ne()}Ne(){if(!this.I)return;const e=Math.max(this.Ze.length,1);this.I.width!==e&&this.I.resize(e,1);const i=new Uint8Array(1*e*4);for(let s=0;s<e;s++){const B=s<this.Ze.length?this.Ze[s]:[0,0,0],r=4*s;i[r]=B[0],i[r+1]=B[1],i[r+2]=B[2],i[r+3]=255}this.I.S(i,e,1)}Xe(e){this.Ze=e,this.Ne()}get qe(){return this.Ze}get framebuffer(){return this.I}get texture(){return this.I.texture}}class j extends T{constructor(i,s,B,r={}){super(i,s,B,r);g(this,"palette");this.palette=new hA(this.Oe,this.Ve.Vt(" .:-=+*%@#"))}Be(i){C.validate(this.Ve.se(i),"One or more characters do not exist in the current font.",{method:"characters",Ot:i})&&(this.h.Be=i,this.palette.Xe(this.Ve.Vt(i)))}As(i,s,B,r=255){let E,Q,n,h;if(typeof i=="string"){const a=this.ts(i);if(!a)return void C.validate(!1,"Invalid hex color format. Use '#FF0000', '#F00', 'FF0000', or 'F00'.",{method:"characterColor",Ot:i});[E,Q,n,h]=a}else if(E=i,Q=s!==void 0?s:i,n=B!==void 0?B:i,h=r,!C.validate([E,Q,n,h].every(a=>a>=0&&a<=255),"Character color values must be between 0 and 255",{method:"characterColor",es:{r:E,g:Q,b:n,a:h}}))return;this.h.As=[E/255,Q/255,n/255,h/255]}ss(i){C.validate(["sampled","fixed"].includes(i),"Invalid character color mode. Must be 'sampled' or 'fixed'.",{method:"characterColorMode",Ot:i})&&(this.h.ss=i)}Bs(i,s,B,r=255){let E,Q,n,h;if(typeof i=="string"){const a=this.ts(i);if(!a)return void C.validate(!1,"Invalid hex color format. Use '#FF0000', '#F00', 'FF0000', or 'F00'.",{method:"cellColor",Ot:i});[E,Q,n,h]=a}else if(E=i,Q=s!==void 0?s:i,n=B!==void 0?B:i,h=r,!C.validate([E,Q,n,h].every(a=>a>=0&&a<=255),"Cell color values must be between 0 and 255",{method:"cellColor",es:{r:E,g:Q,b:n,a:h}}))return;this.h.Bs=[E/255,Q/255,n/255,h/255]}rs(i){C.validate(["sampled","fixed"].includes(i),"Invalid cell color mode. Must be 'sampled' or 'fixed'.",{method:"cellColorMode",Ot:i})&&(this.h.rs=i)}Qs(i){C.validate(typeof i=="boolean"||typeof i=="number"&&Number.isInteger(i),"Invert must be a boolean value or an integer (0 for false, any other number for true).",{method:"invert",Ot:i})&&(this.h.Qs=!!i)}rotation(i){if(!C.validate(typeof i=="number","Rotation angle must be a number.",{method:"rotation",Ot:i}))return;(i%=360)<0&&(i+=360);const s=255*i/360,B=Math.floor(s)/255,r=Math.round(s-B);this.h.rotation=[B,r,0,1]}Es(i){C.validate(typeof i=="boolean"||typeof i=="number"&&Number.isInteger(i),"Flip horizontally must be a boolean value or an integer (0 for false, any other number for true).",{method:"flipHorizontally",Ot:i})&&(this.h.Es=!!i)}gs(i){C.validate(typeof i=="boolean"||typeof i=="number"&&Number.isInteger(i),"Flip vertically must be a boolean value or an integer (0 for false, any other number for true).",{method:"flipVertically",Ot:i})&&(this.h.gs=!!i)}ts(i){return i=i.replace(/^#/,""),/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(i)?(i.length===3&&(i=i.split("").map(s=>s+s).join("")),[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),255]):null}}const aA={enabled:!0,Be:" .:-=+*%@#",As:[1,1,1,1],ss:"sampled",Bs:[0,0,0,1],rs:"fixed",Qs:!1,rotation:[0,0,0,255],Es:!1,gs:!1,ns:[0,255]};class H extends j{constructor(i,s,B){super(i,s,B,{...aA});g(this,"hs");g(this,"ls");g(this,"Ds");g(this,"Cs");g(this,"cs");g(this,"us");this.hs=new v(i.context,b,"precision lowp float;uniform sampler2D u_sketchTexture;uniform vec2 u_gridCellDimensions;uniform vec2 u_brightnessRange;varying vec2 v_uv;void main(){vec2 cellCenter=(floor(v_uv*u_gridCellDimensions)+vec2(0.5))/u_gridCellDimensions;vec4 color=texture2D(u_sketchTexture,cellCenter);float brightness=dot(color.rgb,vec3(0.299,0.587,0.114));float brightnessValue=brightness*255.0;if(brightnessValue>=u_brightnessRange.x&&brightnessValue<=u_brightnessRange.y){gl_FragColor=color;}else{gl_FragColor=vec4(0.0);}}"),this.ls=new v(i.context,b,"precision lowp float;uniform sampler2D u_sampleTexture;uniform vec4 u_fillColor;uniform bool u_useFixedColor;varying vec2 v_uv;void main(){vec4 sampleColor=texture2D(u_sampleTexture,v_uv);if(sampleColor.a>0.0){if(u_useFixedColor){gl_FragColor=u_fillColor;}else{gl_FragColor=sampleColor;}}else{gl_FragColor=vec4(0.0);}}"),this.Cs=new v(i.context,b,"precision lowp float;uniform sampler2D u_sampleTexture;uniform bool u_invert;uniform bool u_flipHorizontally;uniform bool u_flipVertically;varying vec2 v_uv;void main(){vec4 sampleColor=texture2D(u_sampleTexture,v_uv);if(sampleColor.a>0.0){float invertValue=u_invert ? 1.0 : 0.0;float flipHValue=u_flipHorizontally ? 1.0 : 0.0;float flipVValue=u_flipVertically ? 1.0 : 0.0;gl_FragColor=vec4(invertValue,flipHValue,flipVValue,1.0);}else{gl_FragColor=vec4(0.0);}}"),this.cs=new v(i.context,b,"precision lowp float;uniform sampler2D u_sampleTexture;uniform vec4 u_rotationColor;varying vec2 v_uv;void main(){vec4 sampleColor=texture2D(u_sampleTexture,v_uv);if(sampleColor.a>0.0){gl_FragColor=u_rotationColor;}else{gl_FragColor=vec4(0.0);}}"),this.Ds=new v(i.context,b,"precision lowp float;uniform sampler2D u_colorSampleFramebuffer;uniform sampler2D u_charPaletteTexture;uniform vec2 u_charPaletteSize;uniform vec2 u_brightnessRange;varying vec2 v_uv;void main(){vec4 color=texture2D(u_colorSampleFramebuffer,v_uv);if(color.a==0.0){gl_FragColor=vec4(0.0);return;}float brightness=dot(color.rgb,vec3(0.299,0.587,0.114))*255.0;vec2 range=u_brightnessRange;if(brightness<range.x||brightness>range.y){gl_FragColor=vec4(0.0);return;}float t=(brightness-range.x)/(range.y-range.x);float idx=clamp(floor(t*u_charPaletteSize.x),0.0,u_charPaletteSize.x-1.0);vec3 charColor=texture2D(u_charPaletteTexture,vec2((idx+0.5)/u_charPaletteSize.x,0.0)).rgb;gl_FragColor=vec4(charColor,1.0);}"),this.us=this.Oe.createFramebuffer(this.grid.cols,this.grid.rows)}Ps(i){this.us.U(),this.Oe.clear(),this.Oe.bA(this.hs),this.Oe.j("u_sketchTexture",i),this.Oe.j("u_gridCellDimensions",[this.grid.cols,this.grid.rows]),this.Oe.j("u_brightnessRange",this.h.ns),this.Oe.rect(0,0,this.grid.cols,this.grid.rows),this.us.end(),this.$e.U(),this.Oe.clear(),this.Oe.bA(this.ls),this.Oe.j("u_sampleTexture",this.us.texture),this.Oe.j("u_fillColor",this.h.As),this.Oe.j("u_useFixedColor",this.h.ss==="fixed"),this.Oe.rect(0,0,this.grid.cols,this.grid.rows),this.$e.end(),this.Re.U(),this.Oe.clear(),this.Oe.bA(this.ls),this.Oe.j("u_sampleTexture",this.us.texture),this.Oe.j("u_fillColor",this.h.Bs),this.Oe.j("u_useFixedColor",this.h.rs==="fixed"),this.Oe.rect(0,0,this.grid.cols,this.grid.rows),this.Re.end(),this.ze.U(),this.Oe.clear(),this.Oe.bA(this.Cs),this.Oe.j("u_sampleTexture",this.us.texture),this.Oe.j("u_invert",this.h.Qs),this.Oe.j("u_flipHorizontally",this.h.Es),this.Oe.j("u_flipVertically",this.h.gs),this.Oe.rect(0,0,this.grid.cols,this.grid.rows),this.ze.end(),this.He.U(),this.Oe.clear(),this.Oe.bA(this.cs),this.Oe.j("u_sampleTexture",this.us.texture),this.Oe.j("u_rotationColor",this.h.rotation),this.Oe.rect(0,0,this.grid.cols,this.grid.rows),this.He.end(),this.ke.U(),this.Oe.clear(0,0,0,0),this.Oe.bA(this.Ds),this.Oe.j("u_colorSampleFramebuffer",this.us.texture),this.Oe.j("u_charPaletteTexture",this.palette.texture),this.Oe.j("u_charPaletteSize",[this.palette.qe.length,1]),this.Oe.j("u_brightnessRange",this.h.ns),this.Oe.rect(0,0,this.grid.cols,this.grid.rows),this.ke.end()}resize(){super.resize(),this.us.resize(this.grid.cols,this.grid.rows)}ns(i){C.validate(Array.isArray(i)&&i.length===2&&i.every(s=>typeof s=="number"&&s>=0&&s<=255),"Brightness range must be an array of two numbers between 0 and 255.",{method:"brightnessRange",Ot:i})&&(this.h.ns=i)}}const lA=Object.freeze(Object.defineProperty({__proto__:null,Is:H,ws:T,fs:j},Symbol.toStringTag,{value:"Module"}));class AA{constructor(e,i,s){g(this,"Oe");g(this,"font");g(this,"grid");g(this,"ds");g(this,"ps");g(this,"vs");g(this,"ke");g(this,"$e");g(this,"Re");g(this,"He");g(this,"ze");this.Oe=e,this.font=i,this.grid=s,this.vs=this.Oe.createShader(b,"precision mediump float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D u_primaryColorTexture;uniform sampler2D u_secondaryColorTexture;uniform sampler2D u_transformTexture;uniform sampler2D u_asciiCharacterTexture;uniform sampler2D u_rotationTexture;uniform sampler2D u_captureTexture;uniform vec2 u_captureDimensions;uniform int u_backgroundMode;uniform vec2 u_gridCellDimensions;uniform vec2 u_gridPixelDimensions;mat2 rotate2D(float angle){float s=sin(angle);float c=cos(angle);return mat2(c,-s,s,c);}void main(){vec2 adjustedCoord=gl_FragCoord.xy/u_gridPixelDimensions;vec2 gridCoord=adjustedCoord*u_gridCellDimensions;vec2 cellCoord=floor(gridCoord);vec2 charIndexTexCoord=(cellCoord+0.5)/u_gridCellDimensions;vec4 primaryColor=texture2D(u_primaryColorTexture,charIndexTexCoord);vec4 secondaryColor=texture2D(u_secondaryColorTexture,charIndexTexCoord);vec4 transformColor=texture2D(u_transformTexture,charIndexTexCoord);bool isInverted=transformColor.r>0.5;bool flipHorizontal=transformColor.g>0.5;bool flipVertical=transformColor.b>0.5;vec4 encodedIndexVec=texture2D(u_asciiCharacterTexture,charIndexTexCoord);if(encodedIndexVec.a<0.01){gl_FragColor=(u_backgroundMode==0)? vec4(0.0):texture2D(u_captureTexture,gl_FragCoord.xy/u_captureDimensions);return;}int charIndex=int(encodedIndexVec.r*255.0+0.5)+int(encodedIndexVec.g*255.0+0.5)*256;int charCol=int(mod(float(charIndex),u_charsetDimensions.x));int charRow=charIndex/int(u_charsetDimensions.x);float flippedRow=(u_charsetDimensions.y-1.0)-float(charRow);vec2 charCoord=vec2(float(charCol),flippedRow)/u_charsetDimensions;vec4 rotationColor=texture2D(u_rotationTexture,charIndexTexCoord);float scaledAngle=rotationColor.r*255.0+rotationColor.g;float rotationAngle=(scaledAngle*360.0/255.0)*0.017453292;vec2 fractionalPart=fract(gridCoord)-0.5;if(flipHorizontal)fractionalPart.x=-fractionalPart.x;if(flipVertical)fractionalPart.y=-fractionalPart.y;fractionalPart=rotate2D(rotationAngle)*fractionalPart+0.5;vec2 cellSize=1.0/u_charsetDimensions;vec2 texCoord=charCoord+fractionalPart*cellSize;vec2 cellMax=charCoord+cellSize;if(any(lessThan(texCoord,charCoord))||any(greaterThan(texCoord,cellMax))){gl_FragColor=isInverted ? primaryColor : secondaryColor;return;}vec4 charTexel=texture2D(u_characterTexture,texCoord);if(isInverted)charTexel.rgb=1.0-charTexel.rgb;gl_FragColor=mix(secondaryColor,primaryColor,charTexel);}"),this.ds=[{name:"brightness",bs:new H(e,i,s)},{name:"custom",bs:new T(e,i,s)}],this.ke=this.Oe.createFramebuffer(s.cols,s.rows),this.$e=this.Oe.createFramebuffer(s.cols,s.rows),this.Re=this.Oe.createFramebuffer(s.cols,s.rows),this.He=this.Oe.createFramebuffer(s.cols,s.rows),this.ze=this.Oe.createFramebuffer(s.cols,s.rows),this.ps=this.Oe.createFramebuffer(this.grid.width,this.grid.height)}xs(e){for(const s of this.ds){const B=s.bs;B.options.enabled&&B instanceof j&&B.Ps(e)}const i=(s,B)=>{s.U(),this.Oe.clear();for(const r of this.ds){const E=r.bs;E.options.enabled&&this.Oe.image(B(E),0,0)}s.end()};i(this.ke,s=>s.Je),i(this.$e,s=>s.Le),i(this.Re,s=>s.Ke),i(this.He,s=>s.We),i(this.ze,s=>s.je),this.ps.U(),this.Oe.clear(),this.Oe.bA(this.vs),this.Oe.j("u_characterTexture",this.font.ie),this.Oe.j("u_charsetDimensions",[this.font.re,this.font.Qe]),this.Oe.j("u_asciiCharacterTexture",this.ke.texture),this.Oe.j("u_primaryColorTexture",this.$e.texture),this.Oe.j("u_secondaryColorTexture",this.Re.texture),this.Oe.j("u_transformTexture",this.ze.texture),this.Oe.j("u_rotationTexture",this.He.texture),this.Oe.j("u_captureTexture",e.texture),this.Oe.j("u_backgroundMode",!1),this.Oe.j("u_captureDimensions",[e.width,e.height]),this.Oe.j("u_gridCellDimensions",[this.grid.cols,this.grid.rows]),this.Oe.j("u_gridPixelDimensions",[this.grid.width,this.grid.height]),this.Oe.rect(0,0,this.ps.width,this.ps.height),this.ps.end()}get(e){if(!C.validate(typeof e=="string"&&e.length>0,"Converter name must be a non-empty string.",{method:"converter",Ot:e}))return;const i=this.ds.find(B=>B.name===e),s=i==null?void 0:i.bs;return C.validate(s instanceof T,`Converter "${e}" is not a valid TextmodeConverter.`,{method:"converter",Ot:e,_s:s})?s:void 0}add(e,i){if(!C.validate(typeof e=="string"&&e.length>0,"Converter name must be a non-empty string.",{method:"add",Ot:e})||!C.validate(i==="brightness"||i==="custom",'Converter type must be either "brightness" or "custom". Provided: '+i,{method:"add",Ot:i}))return;let s;return s=i==="brightness"?new H(this.Oe,this.font,this.grid):new T(this.Oe,this.font,this.grid),this.ds.push({name:e,bs:s}),s}remove(e){if(!C.validate(typeof e=="string"||e instanceof T,"Parameter must be either a string (converter name) or a TextmodeConverter instance.",{method:"remove",Ot:e}))return;let i=-1;if(typeof e=="string"){if(!C.validate(e.length>0,"Converter name must be a non-empty string.",{method:"remove",Ot:e}))return;i=this.ds.findIndex(s=>s.name===e)}else i=this.ds.findIndex(s=>s.bs===e);C.validate(i!==-1,typeof e=="string"?`Converter with name "${e}" not found in pipeline.`:"Converter instance not found in pipeline.",{method:"remove",Ot:e,ys:this.ds.length})&&this.ds.splice(i,1)}get texture(){return this.ps}resize(){this.ps.resize(this.grid.width,this.grid.height),this.ke.resize(this.grid.cols,this.grid.rows),this.$e.resize(this.grid.cols,this.grid.rows),this.Re.resize(this.grid.cols,this.grid.rows),this.He.resize(this.grid.cols,this.grid.rows),this.ze.resize(this.grid.cols,this.grid.rows);for(const e of this.ds)e.bs.resize()}Ms(){return this.ds.some(e=>e.bs.options.enabled)}disable(){for(const e of this.ds)e.bs.disable()}enable(){for(const e of this.ds)e.bs.enable()}dispose(){for(const e of this.ds)e.bs.dispose();this.ke.dispose(),this.$e.dispose(),this.Re.dispose(),this.He.dispose(),this.ze.dispose(),this.ps.dispose(),this.vs.dispose(),this.ds=[],this.ke=null,this.$e=null,this.Re=null,this.He=null,this.ze=null,this.ps=null,this.vs=null}get Je(){return this.ke}get Le(){return this.$e}get Ke(){return this.Re}get We(){return this.He}get je(){return this.ze}}const cA=o=>class extends o{fill(e,i,s,B){this.wt.fill(e,i,s,B)}stroke(e,i,s,B){this.wt.stroke(e,i,s,B)}xA(e){this.wt.xA(e)}_A(){this.wt._A()}yA(){this.wt.yA()}rotate(e){this.wt.rotate(e)}push(){this.wt.push()}pop(){this.wt.pop()}rect(e,i,s=1,B=1){this.wt.rect(e,i,s,B)}line(e,i,s,B){this.wt.line(e,i,s,B)}background(e,i=e,s=e,B=255){this.wt.background(e,i,s,B)}createShader(e,i){return this.wt.createShader(e,i)}FA(e){return this.wt.FA(e)}bA(e){this.wt.bA(e)}j(e,i){this.wt.j(e,i)}};class z{Gs(e){const i=e.get("brightness"),s=i==null?void 0:i.Je,B=i==null?void 0:i.Le,r=i==null?void 0:i.Ke,E=i==null?void 0:i.je,Q=i==null?void 0:i.We;return s==null||s.O(),B==null||B.O(),r==null||r.O(),E==null||E.O(),Q==null||Q.O(),{Fs:(s==null?void 0:s.V)||new Uint8Array(0),Ys:(B==null?void 0:B.V)||new Uint8Array(0),Ts:(r==null?void 0:r.V)||new Uint8Array(0),Ss:(E==null?void 0:E.V)||new Uint8Array(0),Us:(Q==null?void 0:Q.V)||new Uint8Array(0)}}Os(e,i){return e[i]+(e[i+1]<<8)}Vs(e,i){return{r:e[i],g:e[i+1],b:e[i+2],a:e[i+3]}}}class ${ks(e,i){return new Blob([e],{type:i})}$s(e,i,s){try{const B=this.ks(e,s),r=URL.createObjectURL(B),E=document.createElement("a");E.href=r,E.download=i,E.style.display="none",E.rel="noopener",document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(r)}catch(B){throw console.error("Failed to download file:",B),Error("File download failed: "+(B instanceof Error?B.message:"Unknown error"))}}Rs(){return new Date().toISOString().slice(0,19).replace(/:/g,"-")}Hs(){const e=new Date;return{zs:e.toISOString().split("T")[0],time:e.toTimeString().split(" ")[0].replace(/:/g,"-")}}Js(e){return e.replace(/[<>:"/\\|?*]/g,"_").replace(/\s+/g,"_").replace(/_{2,}/g,"_").replace(/^_+|_+$/g,"").substring(0,255)}Ls(){return"'textmode-export'-"+this.Rs()}}class DA extends z{Ks(e,i,s){const B=e[s]===255,r=e[s+1]===255,E=e[s+2]===255,Q=i[s],n=i[s+1];return{Ws:B,js:r,Zs:E,rotation:Math.round(360*(Q+n/255)/255*100)/100}}Ns(e,i,s){return{x:e,y:i,Xs:e*s.fe,qs:i*s.de}}Ai(e,i){const s=[];let B=0;for(let r=0;r<i.rows;r++)for(let E=0;E<i.cols;E++){const Q=4*B,n=this.Os(e.Fs,Q);let h=this.Vs(e.Ys,Q),a=this.Vs(e.Ts,Q);const l=this.Ks(e.Ss,e.Us,Q);if(l.Ws){const I=h;h=a,a=I}const c=this.Ns(E,r,i);s.push({charIndex:n,ti:h,ei:a,transform:l,position:c}),B++}return s}}class uA{si(e,i){const s=e.cmap;if(!s||!s.LA)return 0;for(const B of s.LA)if(B.format===4){for(let r=0;r<B.At.length;r++)if(i>=B.At[r]&&i<=B.qA[r]){if(B.et[r]===0)return i+B.tt[r]&65535;{const E=B.et[r]/2+(i-B.At[r])-(B.At.length-r);if(E>=0&&E<B.st.length){const Q=B.st[E];if(Q!==0)return Q+B.tt[r]&65535}}}}return 0}ii(){return{Bi:()=>({x1:0,y1:0,x2:0,y2:0}),ri:()=>""}}Qi(e,i,s,B,r){if(!i||!i.gt||i.gt.length===0)return this.ii();const E=r/e.head.unitsPerEm;return{Bi:()=>({x1:s+i.xMin*E,y1:B+-i.yMax*E,x2:s+i.xMax*E,y2:B+-i.yMin*E}),ri:()=>this.Ei(i,s,B,E)}}Ei(e,i,s,B){if(!e||!e.gt)return"";const{gt:r,ot:E,Et:Q,flags:n}=e;if(!(r&&E&&Q&&n))return"";let h="",a=0;for(let l=0;l<Q.length;l++){const c=Q[l];if(!(c<a)){if(c>=a){const I=i+r[a]*B,w=s-E[a]*B;h+=`M${I.toFixed(2)},${w.toFixed(2)}`;let u=a+1;for(;u<=c;)if(1&n[u]){const f=i+r[u]*B,p=s-E[u]*B;h+=`L${f.toFixed(2)},${p.toFixed(2)}`,u++}else{const f=i+r[u]*B,p=s-E[u]*B;let m=u+1>c?a:u+1;if(1&n[m]){const _=i+r[m]*B,M=s-E[m]*B;h+=`Q${f.toFixed(2)},${p.toFixed(2)} ${_.toFixed(2)},${M.toFixed(2)}`,u=m+1}else{const _=(f+(i+r[m]*B))/2,M=(p+(s-E[m]*B))/2;h+=`Q${f.toFixed(2)},${p.toFixed(2)} ${_.toFixed(2)},${M.toFixed(2)}`,u=m}}h+="Z"}a=c+1}}return h}gi(e,i,s,B,r){try{const E=e.codePointAt(0)||0,Q=this.si(i,E);if(Q===0)return this.ii();let n=null;try{i.glyf&&i.glyf[Q]!==null?n=i.glyf[Q]:D&&D.T&&D.T.glyf&&D.T.glyf.rt&&(n=D.T.glyf.rt(i,Q),i.glyf&&n&&(i.glyf[Q]=n))}catch(h){console.warn(`Failed to parse glyph ${Q}:`,h)}return n?this.Qi(i,n,s,B,r):this.ii()}catch(E){return console.warn(`Failed to generate path for character "${e}":`,E),this.ii()}}oi(e,i,s,B,r,E,Q,n){try{const h=Q/i.head.unitsPerEm,a=s+(r-n*h)/2,l=B+(E+.7*Q)/2;return this.gi(e,i,a,l,Q).ri()||null}catch(h){return console.warn(`Failed to generate positioned character path for "${e}":`,h),null}}}class CA{constructor(){g(this,"ni");this.ni=new uA}hi(e){return`<?xml version="1.0" encoding="UTF-8" standalone="no"?>
9
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
10
+ <svg width="${e.width}" height="${e.height}" viewBox="0 0 ${e.width} ${e.height}"
11
+ xmlns="http://www.w3.org/2000/svg" version="1.1">
12
+ <title>textmode art generated via textmode.js</title>
13
+ <desc>textmode art visualization generated by textmode.js library</desc>`}ai(){return`
14
+ </g>
15
+ </svg>`}li(e,i){if(!i.Di)return"";const s=i.backgroundColor,B=`rgba(${s[0]},${s[1]},${s[2]},${s[3]/255})`;return`
16
+ <rect width="${e.width}" height="${e.height}" fill="${B}" />`}Ci(e){return`rgba(${e.r},${e.g},${e.b},${e.a/255})`}ci(e,i){const{transform:s,position:B}=e,r=B.Xs+i.fe/2,E=B.qs+i.de/2,Q=[];if(s.js||s.Zs){const n=s.js?-1:1,h=s.Zs?-1:1;Q.push(`translate(${r} ${E})`),Q.push(`scale(${n} ${h})`),Q.push(`translate(${-r} ${-E})`)}return s.rotation&&Q.push(`rotate(${s.rotation} ${r} ${E})`),Q.length?` transform="${Q.join(" ")}"`:""}ui(e,i,s){if(!s.Di||e.ei.a===0)return"";const{position:B}=e,r=this.Ci(e.ei);return s.Pi==="stroke"?`
17
+ <rect x="${B.Xs}" y="${B.qs}" width="${i.fe}" height="${i.de}" stroke="${r}" fill="none" stroke-width="${s.strokeWidth}" />`:`
18
+ <rect x="${B.Xs}" y="${B.qs}" width="${i.fe}" height="${i.de}" fill="${r}" />`}gi(e,i,s,B){const r=s.Be[e.charIndex];if(!r)return"";const E=this.ni.oi(r._t,s.font,e.position.Xs,e.position.qs,i.fe,i.de,s.fontSize,r.St);if(!E)return"";const Q=this.Ci(e.ti);return B.Pi==="stroke"?`
19
+ <path id="${`path-${e.charIndex}-${e.position.Xs}-${e.position.qs}`.replace(/\./g,"-")}" d="${E}" stroke="${Q}" stroke-width="${B.strokeWidth}" fill="none" />`:`
20
+ <path d="${E}" fill="${Q}" />`}Ii(e,i,s,B){let r="";r+=this.ui(e,i,B);const E=this.ci(e,i),Q=this.gi(e,i,s,B);return Q&&(E?(r+=`
21
+ <g${E}>`,r+=Q,r+=`
22
+ </g>`):r+=Q),r}wi(e,i,s,B){let r=this.hi(i);r+=this.li(i,B),r+=`
23
+ <g id="ascii-cells">`;for(const E of e)r+=this.Ii(E,i,s,B);return r+=this.ai(),r}fi(e){return e.replace(/<path[^>]*d=""[^>]*\/>/g,"").replace(/\n\s*\n/g,`
24
+ `).replace(/[ \t]+$/gm,"")}}class PA extends ${di(e){return this.ks(e,"image/svg+xml;charset=utf-8")}mi(e,i){try{this.$s(e,this.Js(i)+".svg","image/svg+xml;charset=utf-8")}catch(s){throw console.error("Failed to download SVG file:",s),Error("SVG download failed: "+(s instanceof Error?s.message:"Unknown error"))}}pi(e,i){this.mi(e,i||this.Ls())}}class tA{constructor(){g(this,"bi");g(this,"xi");g(this,"_i");this.bi=new DA,this.xi=new CA,this._i=new PA}yi(e){return{Di:e.Di??!0,Pi:e.Pi??"fill",strokeWidth:e.strokeWidth??1,backgroundColor:e.backgroundColor??[0,0,0,0]}}Mi(e,i={}){const s=this.yi(i),B=this.bi.Gs(e.Gi),r=this.bi.Ai(B,e.grid),E=this.xi.wi(r,e.grid,e.font,s);return this.xi.fi(E)}pi(e,i={}){try{const s=this.Mi(e,i),B=i.filename||this._i.Ls();this._i.pi(s,B)}catch(s){throw console.error("Failed to save SVG:",s),Error("SVG save failed: "+(s instanceof Error?s.message:"Unknown error"))}}}class dA extends z{Fi(e,i,s,B=" "){var Q;const r=[];let E=0;for(let n=0;n<i.rows;n++){const h=[];for(let a=0;a<i.cols;a++){const l=4*E,c=this.Os(e.Fs,l),I=((Q=s.Be[c])==null?void 0:Q._t)||B;h.push(I),E++}r.push(h)}return r}}class IA{Yi(e,i){const s=[];for(const r of e){let E=r.join("");i.Ti||(E=E.replace(/\s+$/,"")),s.push(E)}const B=i.Si==="crlf"?`\r
25
+ `:`
26
+ `;return s.join(B)}}class wA extends ${Ui(e,i){try{const s=this.Oi(i);this.$s(e,s,"text/plain;charset=utf-8")}catch(s){throw console.error("Failed to save TXT file:",s),Error("TXT file save failed: "+(s instanceof Error?s.message:"Unknown error"))}}Oi(e){let i=this.Js(e);return i===".txt"||i.length<=4?this.Ls():i}}class eA{constructor(){g(this,"bi");g(this,"xi");g(this,"_i");this.bi=new dA,this.xi=new IA,this._i=new wA}yi(e){return{Ti:e.Ti??!1,Si:e.Si??"lf",Vi:e.Vi??" "}}ki(e,i={}){const s=this.yi(i),B=this.bi.Gs(e.Gi),r=this.bi.Fi(B,e.grid,e.font,s.Vi);return this.xi.Yi(r,s)}Ui(e,i={}){try{const s=this.ki(e,i),B=i.filename||this._i.Ls();this._i.Ui(s,B)}catch(s){throw console.error("Failed to save TXT:",s),Error("TXT save failed: "+(s instanceof Error?s.message:"Unknown error"))}}}class fA extends z{$i(e,i=1,s="transparent"){const B=e.canvas;if(i===1&&s==="transparent")return B;const r=document.createElement("canvas"),E=r.getContext("2d"),Q=Math.round(B.width*i),n=Math.round(B.height*i);return r.width=Q,r.height=n,s!=="transparent"&&(E.fillStyle=s,E.fillRect(0,0,Q,n)),E.imageSmoothingEnabled=!1,E.drawImage(B,0,0,B.width,B.height,0,0,Q,n),r}}class mA{Ri(e,i){const s=this.Hi(i.format);return i.format==="png"?e.toDataURL(s):e.toDataURL(s,i.zi)}async Ji(e,i){return new Promise((s,B)=>{const r=this.Hi(i.format),E=Q=>{Q?s(Q):B(Error(`Failed to generate ${i.format.toUpperCase()} blob`))};i.format==="png"?e.toBlob(E,r):e.toBlob(E,r,i.zi)})}Hi(e){switch(e){case"png":return"image/png";case"jpg":return"image/jpeg";case"webp":return"image/webp";default:throw Error("Unsupported image format: "+e)}}}const iA={Li:"image/png",Ki:"image/jpeg",Wi:"image/webp"},L={Li:".png",Ki:".jpg",Wi:".webp"};class pA extends ${ji(e,i,s){try{const B=L[s];typeof e=="string"?this.Zi(e,this.Js(i)+B):this.Ni(e,this.Js(i)+B)}catch(B){throw console.error(`Failed to save ${s.toUpperCase()} image:`,B),Error("Image save failed: "+(B instanceof Error?B.message:"Unknown error"))}}Zi(e,i){const s=document.createElement("a");s.href=e,s.download=i,s.style.display="none",s.rel="noopener",document.body.appendChild(s),s.click(),document.body.removeChild(s)}Ni(e,i){const s=URL.createObjectURL(e);try{const B=document.createElement("a");B.href=s,B.download=i,B.style.display="none",B.rel="noopener",document.body.appendChild(B),B.click(),document.body.removeChild(B)}finally{URL.revokeObjectURL(s)}}Xi(e){return e in iA&&e in L}Hi(e){return iA[e]}qi(e){return L[e]}}class vA{constructor(){g(this,"bi");g(this,"xi");g(this,"_i");this.bi=new fA,this.xi=new mA,this._i=new pA}yi(e){return{format:e.format??"png",zi:e.zi??1,scale:e.scale??1,backgroundColor:e.backgroundColor??"transparent"}}AB(e){if(console.log("Validating image export options:",e),!this._i.Xi(e.format))throw Error(`Saving '${e.format}' files is not supported`);if(e.zi<0||e.zi>1)throw Error("Image quality must be between 0.0 and 1.0");if(e.scale<=0)throw Error("Scale factor must be greater than 0");e.scale>10&&console.warn("Large scale factors may result in very large files and slow performance"),e.format==="jpg"&&e.backgroundColor==="transparent"&&(e.backgroundColor="black")}tB(e,i={}){const s=this.yi(i);if(this.AB(s),s.scale===1&&s.backgroundColor==="transparent")return this.xi.Ri(e.canvas,s);const B=this.bi.$i(e,s.scale,s.backgroundColor);return this.xi.Ri(B,s)}async Ji(e,i={}){const s=this.yi(i);if(this.AB(s),s.scale===1&&s.backgroundColor==="transparent")return await this.xi.Ji(e.canvas,s);const B=this.bi.$i(e,s.scale,s.backgroundColor);return await this.xi.Ji(B,s)}async ji(e,i={}){try{const s=await this.Ji(e,i),B=i.format??"png",r=i.filename||this._i.Ls();this._i.ji(s,r,B)}catch(s){throw console.error("Failed to save image:",s),Error("Image save failed: "+(s instanceof Error?s.message:"Unknown error"))}}}const bA=o=>class extends o{toString(e={}){return new eA().ki(this,e)}eB(e={}){new eA().Ui(this,e)}ri(e={}){return new tA().Mi(this,e)}pi(e={}){new tA().pi(this,e)}async sB(e,i="png",s={}){await new vA().ji(this.iB,{...s,filename:e,format:i})}},xA=o=>class extends o{async ee(e){return this.kt.ee(e).then(()=>{const i=this.kt.Ee;this.BB.ue(i.width,i.height),this.rB.resize()})}fontSize(e){if(!C.validate(typeof e=="number"&&e>0,"Font size must be a positive number greater than 0.",{method:"fontSize",Ot:e})||this.kt.fontSize===e)return;this.kt.te(e);const i=this.kt.Ee;this.BB.ue(i.width,i.height),this.rB.resize(),this.wt.OA()}};class yA{constructor(){g(this,"wt");g(this,"kt");g(this,"rB");g(this,"iB");g(this,"BB")}}class J extends function(i,...s){return s.reduce((B,r)=>r(B),i)}(yA,cA,bA,xA){constructor(i=null,s={}){super();g(this,"me");g(this,"QB");g(this,"ve");g(this,"EB");g(this,"gB");g(this,"oB",null);g(this,"nB",0);g(this,"hB");g(this,"aB",!0);g(this,"lB",0);g(this,"DB",0);g(this,"CB",0);g(this,"cB",[]);g(this,"uB",10);g(this,"PB",!1);g(this,"IB",!1);g(this,"wB",()=>{});g(this,"fB",()=>{});g(this,"dB",null);g(this,"mB",!1);this.me=i,this.IB=i===null,this.EB=s.pB??"auto",this.gB=s.vB??60,this.hB=1e3/this.gB}static async create(i=null,s={}){const B=new this(i,s),r=B.IB?s:void 0;let E,Q;B.iB=new q(B.me,B.IB,r),B.wt=new EA(B.iB.Me()),B.IB?(E=s.width||800,Q=s.height||600):(E=B.iB.width||800,Q=B.iB.height||600),B.QB=B.wt.createFramebuffer(E,Q),B.kt=new X(B.wt,s.fontSize??16),await B.kt.initialize(s.bB);const n=B.kt.Ee;return B.BB=new Z(B.iB.canvas,n.width,n.height),B.rB=new AA(B.wt,B.kt,B.BB),B.xB(),B._B(),B}xB(){this.dB=()=>{this.IB?this.fB():this.resize()},window.addEventListener("resize",this.dB),window.ResizeObserver&&this.me&&!this.IB&&(this.ve=new ResizeObserver(()=>{this.resize()}),this.ve.observe(this.me))}xs(){if(this.yB(),this.CB++,this.PB)console.warn("Cannot render: Required resources have been disposed");else if(this.IB?(this.QB.U(),this.wB(),this.QB.end()):this.QB.update(this.me),this.rB.Ms()?(this.rB.xs(this.QB),this.wt.background(0),this.wt.image(this.rB.texture,this.BB.offsetX,this.BB.offsetY,this.rB.texture.width,this.rB.texture.height)):(this.wt.clear(),this.wt.image(this.QB,this.BB.offsetX,this.BB.offsetY,this.QB.width,this.QB.height)),this.mB){let i=0;this.wt.image(this.rB.Je,i,0,this.rB.Je.width,this.rB.Je.height),i+=this.rB.Je.width,this.wt.image(this.rB.Le,i,0,this.rB.Le.width,this.rB.Le.height),i+=this.rB.Le.width,this.wt.image(this.rB.Ke,i,0,this.rB.Ke.width,this.rB.Ke.height),i+=this.rB.Ke.width,this.wt.image(this.rB.je,i,0,this.rB.je.width,this.rB.je.height),i+=this.rB.je.width,this.wt.image(this.rB.We,i,0,this.rB.We.width,this.rB.We.height)}}resize(){this.iB.resize(),this.QB.resize(this.iB.width,this.iB.height),this.BB.resize(),this.rB.resize(),this.wt.OA(),this.EB!=="manual"&&this.xs()}_B(){if(this.EB!=="auto"||!this.aB)return;this.nB=performance.now();const i=s=>{if(!this.aB)return void(this.oB=null);const B=s-this.nB;B>=this.hB&&(this.xs(),this.nB=s-B%this.hB),this.aB&&(this.oB=requestAnimationFrame(i))};this.oB=requestAnimationFrame(i)}yB(){const i=performance.now();if(this.DB>0){const s=i-this.DB;this.cB.push(s),this.cB.length>this.uB&&this.cB.shift();const B=this.cB.reduce((r,E)=>r+E,0)/this.cB.length;this.lB=1e3/B}this.DB=i}MB(){this.oB&&(cancelAnimationFrame(this.oB),this.oB=null)}pB(i){this.EB!==i&&(this.MB(),this.EB=i,i==="auto"&&this.aB&&this._B())}vB(i){if(i===void 0)return this.lB;this.gB=i,this.hB=1e3/i,this.EB==="auto"&&this.aB&&(this.MB(),this._B())}GB(){this.aB&&(this.aB=!1,this.oB&&(cancelAnimationFrame(this.oB),this.oB=null))}loop(){this.aB||(this.aB=!0,this.EB==="auto"&&this._B())}FB(i=1){if(C.validate(typeof i=="number"&&i>0&&Number.isInteger(i),"Redraw count must be a positive integer.",{method:"redraw",Ot:i}))for(let s=0;s<i;s++)this.xs()}YB(){return this.EB==="auto"&&this.aB}draw(i){this.wB=i}TB(i){this.fB=i}SB(i,s){this.iB.resize(i,s),this.QB.resize(this.iB.width,this.iB.height),this.BB.resize(),this.rB.resize(),this.wt.OA(),this.EB!=="manual"&&this.xs()}bs(i){return this.rB.get(i)}destroy(){this.MB(),this.dB&&(window.removeEventListener("resize",this.dB),this.dB=null),this.ve&&(this.ve.disconnect(),this.ve=null),this.rB.dispose(),this.kt.dispose(),this.BB.dispose(),this.QB.dispose(),this.wt.dispose(),this.iB.dispose(),this.me=null,this.iB=null,this.wt=null,this.QB=null,this.kt=null,this.BB=null,this.rB=null,this.ve=null,this.wB=()=>{},this.fB=()=>{},this.oB=null,this.nB=0,this.DB=0,this.CB=0,this.lB=0,this.cB=[],this.aB=!1,this.PB=!0}debug(i){this.mB=i}get grid(){return this.BB}get font(){return this.kt}get mode(){return this.EB}get Gi(){return this.rB}get frameCount(){return this.CB}set frameCount(i){this.CB=i}get width(){return this.iB.width}get height(){return this.iB.height}get UB(){return this.PB}}class G{static async create(e,i={}){if(e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement)return J.create(e,i);{const s=e||{};return J.create(null,s)}}static OB(e){C.u(e)}static get version(){return"0.1.6-beta.5"}constructor(){throw Error("Textmode is a static class and cannot be instantiated.")}}const _A=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),MA=G.create,TA=G.OB,OA=G.version;d.VB=q,d.kB=AA,d.$B=x,d.RB=X,d.HB=Z,d.zB=J,d.ds=lA,d.create=MA,d.default=G,d.JB=_A,d.OB=TA,d.LB=G,d.version=OA,Object.defineProperties(d,{KB:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):t((A=typeof globalThis<"u"?globalThis:A||self).LB={});
@@ -0,0 +1,25 @@
1
+ var Pt=Object.defineProperty;var It=(x,v,F)=>v in x?Pt(x,v,{enumerable:!0,configurable:!0,writable:!0,value:F}):x[v]=F;var l=(x,v,F)=>It(x,typeof v!="symbol"?v+"":v,F);var t,e;t=this,e=function(x){class v extends Error{constructor(s,r,o={}){super(v.i(s,o));l(this,"t");l(this,"context");this.name="TextmodeError",this.t=r,this.context=o}static i(s,r){let o=s;if(r&&Object.keys(r).length>0){o+=`
2
+
3
+ 📋 Context:`;for(const[n,h]of Object.entries(r))o+=`
4
+ - ${n}: ${v.o(h)}`}return o+=`
5
+
6
+ `,o+="↓".repeat(24)+`
7
+ `,o}static o(s){if(s===null)return"null";if(s===void 0)return"undefined";if(typeof s=="string")return`"${s}"`;if(typeof s=="number"||typeof s=="boolean")return s+"";if(Array.isArray(s))return s.length===0?"[]":s.length<=5?`[${s.map(r=>v.o(r)).join(", ")}]`:`[${s.slice(0,3).map(r=>v.o(r)).join(", ")}, ... +${s.length-3} more]`;if(typeof s=="object"){const r=Object.keys(s);return r.length===0?"{}":r.length<=3?`{ ${r.map(o=>`${o}: ${v.o(s[o])}`).join(", ")} }`:`{ ${r.slice(0,2).map(o=>`${o}: ${v.o(s[o])}`).join(", ")}, ... +${r.length-2} more }`}return s+""}}var F=(c=>(c[c.SILENT=0]="SILENT",c[c.WARNING=1]="WARNING",c[c.ERROR=2]="ERROR",c[c.THROW=3]="THROW",c))(F||{});const M=class M{constructor(){l(this,"l",{u:3})}static m(){return M.h||(M.h=new M),M.h}p(i,s,r){const o="[textmode.js]";switch(this.l.u){case 0:return!1;case 1:return console.group(`%c${o} Oops! (╯°□°)╯︵ Something went wrong in your code.`,"color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;"),console.warn(v.i(i,s)),console.groupEnd(),!1;case 2:return console.group(`%c${o} Oops! (╯°□°)╯︵ Something went wrong in your code.`,"color: #f44336; font-weight: bold; background: #ffebee; padding: 2px 6px; border-radius: 3px;"),console.error(v.i(i,s)),console.groupEnd(),!1;default:const n=new v(i,r,s);throw console.group(`%c${o} Oops! (╯°□°)╯︵ Something went wrong in your code.`,"color: #d32f2f; font-weight: bold; background: #ffcdd2; padding: 2px 6px; border-radius: 3px;"),n}}validate(i,s,r){return!!i||(this.p(s,r),!1)}v(i){this.l.u=i}};l(M,"h",null);let k=M;const w=k.m(),j=new WeakMap;function N(c,i){j.set(c,i)}function W(c){return j.get(c)}class q{constructor(i,s,r=s,o={}){l(this,"_");l(this,"C");l(this,"F");l(this,"$");l(this,"M");l(this,"options");l(this,"S",null);l(this,"D",null);this._=i,this.$=s,this.M=r,this.options={filter:"nearest",wrap:"clamp",format:"rgba",type:"unsigned_byte",...o},this.F=this.createTexture(),this.C=i.createFramebuffer(),this.V()}R(i){const{_:s}=this,r=s.getParameter(s.FRAMEBUFFER_BINDING);s.bindFramebuffer(s.FRAMEBUFFER,this.C);try{return i()}finally{s.bindFramebuffer(s.FRAMEBUFFER,r)}}createTexture(){const{_:i}=this,s=i.createTexture();i.bindTexture(i.TEXTURE_2D,s);const r=this.options.filter==="linear"?i.LINEAR:i.NEAREST,o=this.options.wrap==="repeat"?i.REPEAT:i.CLAMP_TO_EDGE;return i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,r),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,r),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,o),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,o),this.k(),s}k(){const{_:i}=this,s=this.options.type==="float"?i.FLOAT:i.UNSIGNED_BYTE;i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this.$,this.M,0,i.RGBA,s,null)}V(){const{_:i}=this;i.bindFramebuffer(i.FRAMEBUFFER,this.C),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,this.F,0),i.bindFramebuffer(i.FRAMEBUFFER,null)}update(i){const{_:s}=this;s.bindTexture(s.TEXTURE_2D,this.F),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,1),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,i),s.bindTexture(s.TEXTURE_2D,null)}I(i,s,r){const{_:o}=this;o.bindTexture(o.TEXTURE_2D,this.F),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,s,r,0,o.RGBA,o.UNSIGNED_BYTE,i),o.bindTexture(o.TEXTURE_2D,null)}resize(i,s){const{_:r}=this;this.$=i,this.M=s,this.D=null,r.bindTexture(r.TEXTURE_2D,this.F),this.k(),r.bindTexture(r.TEXTURE_2D,null)}U(){const{_:i}=this;this.S={framebuffer:i.getParameter(i.FRAMEBUFFER_BINDING),viewport:i.getParameter(i.VIEWPORT)},i.bindFramebuffer(i.FRAMEBUFFER,this.C),i.viewport(0,0,this.$,this.M),N(i,[0,0,this.$,this.M])}end(){if(!this.S)return;const{_:i}=this;i.bindFramebuffer(i.FRAMEBUFFER,this.S.framebuffer),i.viewport(...this.S.viewport),N(i,this.S.viewport),this.S=null}G(){const{_:i}=this;this.D||(this.D=new Uint8Array(this.$*this.M*4)),this.R(()=>{i.readPixels(0,0,this.$,this.M,i.RGBA,i.UNSIGNED_BYTE,this.D)})}get(i,s,r,o){const{_:n}=this;if(i===void 0&&s===void 0){const h=new Uint8Array(this.$*this.M*4);return this.R(()=>(n.readPixels(0,0,this.$,this.M,n.RGBA,n.UNSIGNED_BYTE,h),h))}if(r===void 0&&o===void 0){(i<0||s<0||i>=this.$||s>=this.M)&&(console.warn("The x and y values passed to Framebuffer.get are outside of its range and will be clamped."),i=Math.max(0,Math.min(i,this.$-1)),s=Math.max(0,Math.min(s,this.M-1)));const h=new Uint8Array(4);return this.R(()=>(n.readPixels(i,s,1,1,n.RGBA,n.UNSIGNED_BYTE,h),[h[0],h[1],h[2],h[3]]))}{i=Math.max(0,Math.min(i,this.$-1)),s=Math.max(0,Math.min(s,this.M-1)),r=Math.max(1,Math.min(r,this.$-i)),o=Math.max(1,Math.min(o,this.M-s));const h=new Uint8Array(r*o*4);return this.R(()=>(n.readPixels(i,s,r,o,n.RGBA,n.UNSIGNED_BYTE,h),h))}}dispose(){const{_:i}=this;this.C&&(i.deleteFramebuffer(this.C),this.C=null),this.F&&(i.deleteTexture(this.F),this.F=null),this.D=null}get framebuffer(){return this.C}get texture(){return this.F}get width(){return this.$}get height(){return this.M}get P(){return this.D}}class E{constructor(i,s,r){l(this,"_");l(this,"A");l(this,"L",new Map);l(this,"O",new Map);l(this,"H",0);l(this,"j");this._=i,this.A=this.createProgram(s,r),this.j=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),this.W()}W(){const i=this._.getProgramParameter(this.A,this._.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const r=this._.getActiveUniform(this.A,s);if(r){const o=this._.getUniformLocation(this.A,r.name);o&&(this.L.set(r.name,o),this.O.set(r.name,r.type))}}}createProgram(i,s){const r=this.createShader(this._.VERTEX_SHADER,i),o=this.createShader(this._.FRAGMENT_SHADER,s),n=this._.createProgram();if(this._.attachShader(n,r),this._.attachShader(n,o),this._.linkProgram(n),!this._.getProgramParameter(n,this._.LINK_STATUS)){const h=this._.getProgramInfoLog(n);throw Error("Shader program link error: "+h)}return this._.deleteShader(r),this._.deleteShader(o),n}createShader(i,s){const r=this._.createShader(i);if(this._.shaderSource(r,s),this._.compileShader(r),!this._.getShaderParameter(r,this._.COMPILE_STATUS)){const o=this._.getShaderInfoLog(r);throw this._.deleteShader(r),Error("Shader compilation error: "+o)}return r}N(){this._.useProgram(this.A),this.X()}Y(i,s){const r=this.L.get(i);if(r)if(typeof s=="number")this.q(i)?this._.uniform1i(r,Math.floor(s)):this._.uniform1f(r,s);else if(typeof s=="boolean")this._.uniform1i(r,s?1:0);else if(Array.isArray(s))switch(s.length){case 2:this._.uniform2f(r,s[0],s[1]);break;case 3:this._.uniform3f(r,s[0],s[1],s[2]);break;case 4:this._.uniform4f(r,s[0],s[1],s[2],s[3]);break;default:console.warn(`Unsupported array length ${s.length} for uniform '${i}'`)}else if(s instanceof WebGLTexture){const o=this.Z();this._.uniform1i(r,o),this._.activeTexture(this._.TEXTURE0+o),this._.bindTexture(this._.TEXTURE_2D,s)}else if(s instanceof q){const o=this.Z();this._.uniform1i(r,o),this._.activeTexture(this._.TEXTURE0+o),this._.bindTexture(this._.TEXTURE_2D,s.texture)}else console.warn(`Unsupported uniform type for '${i}':`,typeof s)}Z(){return this.H>=this.j&&console.warn(`Exceeded maximum texture units (${this.j}). Texture may not render correctly.`),this.H++}q(i){const s=this.O.get(i);return!!s&&(s===this._.INT||s===this._.INT_VEC2||s===this._.INT_VEC3||s===this._.INT_VEC4||s===this._.SAMPLER_2D||s===this._.SAMPLER_CUBE)}get J(){return this.A}dispose(){this.A&&(this._.deleteProgram(this.A),this.A=null),this.L.clear(),this.O.clear(),this.H=0}X(){this.H=0}}class K{constructor(i){l(this,"_");l(this,"K",null);l(this,"tt",16);l(this,"et",new Map);this._=i}it(){if(this.K)return;const i=this._;this.K=i.createBuffer(),i.bindBuffer(i.ARRAY_BUFFER,this.K)}st(){const i=this._,s=i.getParameter(i.CURRENT_PROGRAM);let r=this.et.get(s);return r||(r={rt:i.getAttribLocation(s,"a_position"),ot:i.getAttribLocation(s,"a_texCoord")},this.et.set(s,r)),i.enableVertexAttribArray(r.rt),i.vertexAttribPointer(r.rt,2,i.FLOAT,!1,this.tt,0),i.enableVertexAttribArray(r.ot),i.vertexAttribPointer(r.ot,2,i.FLOAT,!1,this.tt,8),{nt:r.rt,ht:r.ot}}lt(i,s){const r=this._;r.disableVertexAttribArray(i),r.disableVertexAttribArray(s)}ct(i,s){const r=this._,o=W(r)||[0,0,r.canvas.width,r.canvas.height];return{ut:i/o[2]*2-1,ft:1-s/o[3]*2}}dt(i,s,r,o){const n=this._;this.it(),n.bindBuffer(n.ARRAY_BUFFER,this.K);const h=new Float32Array([i,o,0,0,r,o,1,0,i,s,0,1,i,s,0,1,r,o,1,0,r,s,1,1]);n.bufferData(n.ARRAY_BUFFER,h,n.DYNAMIC_DRAW)}dispose(){this.K&&(this._.deleteBuffer(this.K),this.K=null),this.et.clear()}}class ot extends K{constructor(i){super(i)}gt(i,s,r,o){const n=this.ct(i,s),h=this.ct(i+r,s+o);this.dt(n.ut,n.ft,h.ut,h.ft);const a=this.st();this._.drawArrays(this._.TRIANGLES,0,6),this.lt(a.nt,a.ht)}vt(i,s,r,o,n){this.gt(i,s,r,n),this.gt(i+r-n,s,n,o),this.gt(i,s+o-n,r,n),this.gt(i,s,n,o)}}class nt extends K{constructor(i){super(i)}draw(i,s,r,o,n){const h=r-i,a=o-s,u=Math.hypot(h,a);if(u===0){const f=n/2,g=this.ct(i-f,s-f),m=this.ct(i+f,s+f);this.dt(g.ut,g.ft,m.ut,m.ft)}else{const f=h/u,g=-a/u,m=n/2,b=i+g*m,y=s+f*m,_=i-g*m,T=s-f*m,A=r+g*m,C=o+f*m,$=r-g*m,D=o-f*m,L=this.ct(b,y),U=this.ct(_,T),B=this.ct(A,C),rt=this.ct($,D),Y=this._;this.it(),Y.bindBuffer(Y.ARRAY_BUFFER,this.K);const Bt=new Float32Array([L.ut,L.ft,0,0,U.ut,U.ft,0,1,B.ut,B.ft,1,0,U.ut,U.ft,0,1,rt.ut,rt.ft,1,1,B.ut,B.ft,1,0]);Y.bufferData(Y.ARRAY_BUFFER,Bt,Y.DYNAMIC_DRAW)}const d=this.st();this._.drawArrays(this._.TRIANGLES,0,6),this.lt(d.nt,d.ht)}}var R="attribute vec2 a_position;attribute vec2 a_texCoord;varying vec2 v_uv;uniform float u_rotation;uniform vec2 u_center;uniform float u_aspectRatio;mat2 rotate2D(float angle){float s=sin(angle);float c=cos(angle);return mat2(c,-s,s,c);}void main(){v_uv=a_texCoord;vec2 pos=a_position;pos-=u_center;pos.x*=u_aspectRatio;pos=rotate2D(-u_rotation)*pos;pos.x/=u_aspectRatio;pos+=u_center;gl_Position=vec4(pos,0.0,1.0);}";class ht{constructor(i){l(this,"_");l(this,"_t");l(this,"xt");l(this,"bt",null);l(this,"wt");l(this,"Ct");l(this,"yt",[1,1,1,1]);l(this,"Ft",!0);l(this,"Tt",[0,0,0,1]);l(this,"$t",1);l(this,"Mt",!0);l(this,"St",0);l(this,"Dt",[]);this._=i,this._t=new E(this._,R,"precision lowp float;uniform sampler2D u_texture;varying vec2 v_uv;void main(){gl_FragColor=texture2D(u_texture,v_uv);}"),this.xt=new E(this._,R,"precision lowp float;uniform vec4 u_color;void main(){gl_FragColor=u_color;}"),this.wt=new ot(this._),this.Ct=new nt(this._),this._.enable(this._.BLEND),this._.blendEquation(this._.FUNC_ADD),this._.blendFunc(this._.ONE,this._.ONE_MINUS_SRC_ALPHA),N(this._,[0,0,this._.canvas.width,this._.canvas.height])}Vt(i){this.bt!==i&&(this.bt=i,i.N())}fill(i,s,r,o){if(this.Ft=!0,s===void 0&&r===void 0&&o===void 0){const n=i/255;this.yt=[n,n,n,1]}else if(r!==void 0&&o===void 0)this.yt=[i/255,s/255,r/255,1];else{if(r===void 0||o===void 0)throw Error("Invalid fill parameters. Use fill(gray), fill(r,g,b), or fill(r,g,b,a)");this.yt=[i/255,s/255,r/255,o/255]}}stroke(i,s,r,o){if(this.Mt=!0,s===void 0&&r===void 0&&o===void 0){const n=i/255;this.Tt=[n,n,n,1]}else if(r!==void 0&&o===void 0)this.Tt=[i/255,s/255,r/255,1];else{if(r===void 0||o===void 0)throw Error("Invalid stroke parameters. Use stroke(gray), stroke(r,g,b), or stroke(r,g,b,a)");this.Tt=[i/255,s/255,r/255,o/255]}}Rt(i){if(i<0)throw Error("Stroke weight must be non-negative");this.$t=i}kt(){this.Mt=!1}It(){this.Ft=!1}rotate(i){this.St=i}push(){this.Dt.push({Et:[...this.yt],Ft:this.Ft,Ut:[...this.Tt],Rt:this.$t,Mt:this.Mt,rotation:this.St})}pop(){const i=this.Dt.pop();i?(this.yt=i.Et,this.Ft=i.Ft,this.Tt=i.Ut,this.$t=i.Rt,this.Mt=i.Mt,this.St=i.rotation):console.warn("pop() called without matching push()")}reset(){this.bt=null,this.Dt=[],this.St=0}createShader(i,s){return new E(this._,i,s)}zt(i){return new E(this._,R,i)}Y(i,s){this.bt.Y(i,s)}rect(i,s,r,o){if(this.bt!==null){const{Gt:g,Pt:m,At:b,aspectRatio:y}=this.Lt(i,s,r,o);return this.Y("u_rotation",b),this.Y("u_center",[g,m]),this.Y("u_aspectRatio",y),this.wt.gt(i,s,r,o),void(this.bt=null)}const n=this.xt;let h=0,a=0,u=0,d=1;const f=this.Lt(i,s,r,o);h=f.Gt,a=f.Pt,u=f.At,d=f.aspectRatio,this.Ft&&(this.Vt(n),this.Y("u_color",this.yt),this.Y("u_rotation",u),this.Y("u_center",[h,a]),this.Y("u_aspectRatio",d),this.wt.gt(i,s,r,o)),this.Mt&&this.$t>0&&(this.Vt(n),this.Y("u_color",this.Tt),this.Y("u_rotation",u),this.Y("u_center",[h,a]),this.Y("u_aspectRatio",d),this.wt.vt(i,s,r,o,this.$t)),this.bt=null}line(i,s,r,o){if(this.bt!==null){const _=(i+r)/2,T=(s+o)/2,A=Math.abs(r-i)||1,C=Math.abs(o-s)||1,{Gt:$,Pt:D,At:L,aspectRatio:U}=this.Lt(_-A/2,T-C/2,A,C);this.Y("u_rotation",L),this.Y("u_center",[$,D]),this.Y("u_aspectRatio",U);const B=this.$t>0?this.$t:1;return this.Ct.draw(i,s,r,o,B),void(this.bt=null)}if(!this.Mt||this.$t<=0)return;const n=this.xt,h=(i+r)/2,a=(s+o)/2,u=Math.abs(r-i)||1,d=Math.abs(o-s)||1,f=this.St!==0;let g=0,m=0,b=0,y=1;if(f){const _=this.Lt(h-u/2,a-d/2,u,d);g=_.Gt,m=_.Pt,b=_.At,y=_.aspectRatio}this.Vt(n),this.Y("u_color",this.Tt),f&&(this.Y("u_rotation",b),this.Y("u_center",[g,m]),this.Y("u_aspectRatio",y)),this.Ct.draw(i,s,r,o,this.$t)}Lt(i,s,r,o){const n=W(this._)||[0,0,this._.canvas.width,this._.canvas.height],h=n[2],a=n[3],u=h/a;return{Gt:(i+r/2)/h*2-1,Pt:1-(s+o/2)/a*2,At:this.St*Math.PI/180,aspectRatio:u}}createFramebuffer(i,s,r={}){return new q(this._,i,s,r)}background(i,s=i,r=i,o=255){this.clear(i/255,s/255,r/255,o/255)}clear(i=0,s=0,r=0,o=0){this._.clearColor(i,s,r,o),this._.clear(this._.COLOR_BUFFER_BIT)}Ot(){this._.viewport(0,0,this._.canvas.width,this._.canvas.height),N(this._,[0,0,this._.canvas.width,this._.canvas.height])}get context(){return this._}dispose(){this._t.dispose(),this.xt.dispose(),this.wt.dispose(),this.Ct.dispose(),this._t=null,this.xt=null,this.bt=null,this.wt=null,this.Ct=null,this.Dt=[]}image(i,s,r,o,n){const h=this._,a=o??i.width,u=n??i.height;this.Vt(this._t),this.Y("u_texture",i.texture);const d=this.Lt(s,r,a,u);this.Y("u_rotation",d.At),this.Y("u_center",[d.Gt,d.Pt]),this.Y("u_aspectRatio",d.aspectRatio),this.wt.gt(s,r,a,u),h.bindTexture(h.TEXTURE_2D,null),this.bt=null}}var P,p={parse:function(c){var i=function(s,r,o,n){var h=p.T,a={cmap:h.cmap,head:h.head,hhea:h.hhea,maxp:h.maxp,hmtx:h.hmtx,loca:h.loca,glyf:h.glyf},u={_data:s,_index:r,_offset:o};for(var d in a){var f=p.findTable(s,d,o);if(f){var g=f[0],m=n[g];m==null&&(m=a[d].Bt(s,g,f[1],u)),u[d]=n[g]=m}}return u}(new Uint8Array(c),0,0,{});return[i]},findTable:function(c,i,s){for(var r=p.B,o=r.Ht(c,s+4),n=s+12,h=0;h<o;h++){var a=r.jt(c,n,4);r.Wt(c,n+4);var u=r.Wt(c,n+8),d=r.Wt(c,n+12);if(a==i)return[u,d];n+=16}return null},T:{}};p.B={Nt:function(c,i){return p.B.Xt.uint16[0]=c[i]<<8|c[i+1],p.B.Xt.int16[0]},Ht:function(c,i){return c[i]<<8|c[i+1]},Yt:function(c,i,s){for(var r=[],o=0;o<s;o++)r.push(p.B.Ht(c,i+2*o));return r},Wt:function(c,i){var s=p.B.Xt.uint8;return s[3]=c[i],s[2]=c[i+1],s[1]=c[i+2],s[0]=c[i+3],p.B.Xt.uint32[0]},jt:function(c,i,s){for(var r="",o=0;o<s;o++)r+=String.fromCharCode(c[i+o]);return r},Xt:(P=new ArrayBuffer(8),{uint8:new Uint8Array(P),int16:new Int16Array(P),uint16:new Uint16Array(P),uint32:new Uint32Array(P)})},p.T.cmap={Bt:function(c,i,s){var r={qt:[],Qt:{},off:i};c=new Uint8Array(c.buffer,i,s),i=0;var o=p.B,n=o.Ht,h=p.T.cmap;n(c,i);var a=n(c,i+=2);i+=2;for(var u=[],d=0;d<a;d++){var f=n(c,i),g=n(c,i+=2);i+=2;var m=o.Wt(c,i);i+=4;var b="p"+f+"e"+g,y=u.indexOf(m);if(y==-1){y=r.qt.length;var _={};u.push(m);var T=_.format=n(c,m);T==4?_=h.Zt(c,m,_):T==12&&(_=h.Jt(c,m,_)),r.qt.push(_)}r.Qt[b]!=null&&console.log("multiple tables for one platform+encoding: "+b),r.Qt[b]=y}return r},Zt:function(c,i,s){var r=p.B,o=r.Ht,n=r.Yt,h=i,a=o(c,i+=2);o(c,i+=2);var u=o(c,i+=2);i+=2;var d=u>>>1;s.Kt=o(c,i),i+=2,s.te=o(c,i),i+=2,s.ee=o(c,i),i+=2,s.ie=n(c,i,d),i+=2*d,i+=2,s.se=n(c,i,d),i+=2*d,s.re=[];for(var f=0;f<d;f++)s.re.push(r.Nt(c,i)),i+=2;return s.oe=n(c,i,d),i+=2*d,s.ne=n(c,i,h+a-i>>1),s},Jt:function(c,i,s){var r=p.B.Wt;r(c,i+=4),r(c,i+=4);var o=3*r(c,i+=4);i+=4;for(var n=s.groups=new Uint32Array(o),h=0;h<o;h+=3)n[h]=r(c,i+(h<<2)),n[h+1]=r(c,i+(h<<2)+4),n[h+2]=r(c,i+(h<<2)+8);return s}},p.T.head={Bt:function(c,i,s){var r=p.B,o={};return i+=18,o.unitsPerEm=r.Ht(c,i),i+=2,i+=16,o.xMin=r.Nt(c,i),i+=2,o.yMin=r.Nt(c,i),i+=2,o.xMax=r.Nt(c,i),i+=2,o.yMax=r.Nt(c,i),i+=2,i+=6,o.indexToLocFormat=r.Nt(c,i),o}},p.T.hhea={Bt:function(c,i,s){var r=p.B,o={};i+=4;for(var n=["ascender","descender","lineGap","advanceWidthMax","minLeftSideBearing","minRightSideBearing","xMaxExtent","caretSlopeRise","caretSlopeRun","caretOffset","res0","res1","res2","res3","metricDataFormat","numberOfHMetrics"],h=0;h<n.length;h++){var a=n[h],u=a=="advanceWidthMax"||a=="numberOfHMetrics"?r.Ht:r.Nt;o[a]=u(c,i+2*h)}return o}},p.T.hmtx={Bt:function(c,i,s,r){for(var o=p.B,n=[],h=[],a=r.maxp.numGlyphs,u=r.hhea.numberOfHMetrics,d=0,f=0,g=0;g<u;)d=o.Ht(c,i+(g<<2)),f=o.Nt(c,i+(g<<2)+2),n.push(d),h.push(f),g++;for(;g<a;)n.push(d),h.push(f),g++;return{he:n,ae:h}}},p.T.maxp={Bt:function(c,i,s){var r=p.B,o=r.Ht,n={};return r.Wt(c,i),i+=4,n.numGlyphs=o(c,i),i+=2,n}},p.T.loca={Bt:function(c,i,s,r){var o=p.B,n=[],h=r.head.indexToLocFormat,a=r.maxp.numGlyphs+1;if(h==0)for(var u=0;u<a;u++)n.push(o.Ht(c,i+(u<<1))<<1);if(h==1)for(u=0;u<a;u++)n.push(o.Wt(c,i+(u<<2)));return n}},p.T.glyf={Bt:function(c,i,s,r){for(var o=[],n=r.maxp.numGlyphs,h=0;h<n;h++)o.push(null);return o},le:function(c,i){var s=p.B,r=c._data,o=c.loca;if(o[i]==o[i+1])return null;var n=p.findTable(r,"glyf",c._offset)[0]+o[i],h={};if(h.ce=s.Nt(r,n),n+=2,h.xMin=s.Nt(r,n),n+=2,h.yMin=s.Nt(r,n),n+=2,h.xMax=s.Nt(r,n),n+=2,h.yMax=s.Nt(r,n),n+=2,h.xMin>=h.xMax||h.yMin>=h.yMax)return null;if(h.ce>0){h.ue=[];for(var a=0;a<h.ce;a++)h.ue.push(s.Ht(r,n)),n+=2;var u=s.Ht(r,n);if(n+=2,r.length-n<u)return null;n+=u;var d=h.ue[h.ce-1]+1;for(h.flags=[],a=0;a<d;a++){var f=r[n];if(n++,h.flags.push(f),8&f){var g=r[n];n++;for(var m=0;m<g;m++)h.flags.push(f),a++}}for(h.fe=[],a=0;a<d;a++){var b=!!(2&h.flags[a]),y=!!(16&h.flags[a]);b?(h.fe.push(y?r[n]:-r[n]),n++):y?h.fe.push(0):(h.fe.push(s.Nt(r,n)),n+=2)}for(h.de=[],a=0;a<d;a++)b=!!(4&h.flags[a]),y=!!(32&h.flags[a]),b?(h.de.push(y?r[n]:-r[n]),n++):y?h.de.push(0):(h.de.push(s.Nt(r,n)),n+=2);var _=0,T=0;for(a=0;a<d;a++)_+=h.fe[a],T+=h.de[a],h.fe[a]=_,h.de[a]=T}else h.me=[];return h}},typeof module<"u"&&module.exports?module.exports=p:typeof window<"u"&&(window.Typr=p);class at{ge(i){var r;const s=[];return(r=i==null?void 0:i.cmap)!=null&&r.qt?(i.cmap.qt.forEach(o=>{if(o.format===4){const n=this.pe(o);s.push(...n)}else if(o.format===12){const n=this.ve(o);s.push(...n)}}),[...new Set(s)]):[]}pe(i){const s=[];if(!(i.se&&i.ie&&i.oe&&i.re))return s;for(let r=0;r<i.se.length;r++){const o=i.se[r],n=i.ie[r];if(o!==65535||n!==65535){for(let h=o;h<=n;h++)if(this._e(i,h,r)>0){const a=String.fromCodePoint(h);s.push(a)}}}return s}ve(i){const s=[];if(!i.groups)return s;for(let r=0;r<i.groups.length;r+=3){const o=i.groups[r],n=i.groups[r+1],h=i.groups[r+2];for(let a=o;a<=n;a++)if(h+(a-o)>0){const u=String.fromCodePoint(a);s.push(u)}}return s}_e(i,s,r){if(i.oe[r]===0)return s+i.re[r]&65535;{const o=i.oe[r]/2+(s-i.se[r])-(i.se.length-r);if(o>=0&&i.ne&&o<i.ne.length){const n=i.ne[o];if(n!==0)return n+i.re[r]&65535}}return 0}xe(i){return i.filter(s=>this.be(s))}be(i){const s=i.codePointAt(0)||0;return!(s>=0&&s<=31&&s!==9&&s!==10&&s!==13||s>=127&&s<=159)}}class lt{constructor(i){l(this,"we");l(this,"Ce");l(this,"ye");this.ye=i,this.we=document.createElement("canvas"),this.Ce=this.we.getContext("2d",{Fe:!0,alpha:!1})}Te(i,s,r,o){const n=i.length,h=Math.ceil(Math.sqrt(n)),a=Math.ceil(n/h),u=s.width*h,d=s.height*a;this.$e(u,d,r,o),this.Me(i,s,h,r),this.Se();const f=this.ye.createFramebuffer(u,d,{filter:"nearest"});return f.update(this.we),{framebuffer:f,columns:h,rows:a}}$e(i,s,r,o){this.we.width=i,this.we.height=s,this.we.style.width=i+"px",this.we.style.height=i+"px",this.Ce.imageSmoothingEnabled=!1,this.we.style.imageRendering="pixelated",this.Ce.fillStyle="black",this.Ce.fillRect(0,0,i,s),this.Ce.font=`${r}px ${o}`,this.Ce.textBaseline="top",this.Ce.textAlign="left",this.Ce.fillStyle="white"}Me(i,s,r,o){for(let n=0;n<i.length;n++){const h=n%r,a=Math.floor(n/r),u=h*s.width+.5*s.width,d=a*s.height+.5*s.height,f=Math.round(u-.5*s.width),g=Math.round(d-.5*o);this.Ce.fillText(i[n].De,f,g)}}Se(i=128){const s=this.Ce.getImageData(0,0,this.we.width,this.we.height),r=s.data;for(let o=0;o<r.length;o+=4){const n=.299*r[o]+.587*r[o+1]+.114*r[o+2]>i+32?255:0;r[o]=n,r[o+1]=n,r[o+2]=n}this.Ce.putImageData(s,0,0)}}class ct{constructor(){l(this,"Ve");l(this,"Re");this.Ve=document.createElement("canvas"),this.Re=this.Ve.getContext("2d")}ke(i,s,r){this.Re.font=`${s}px ${r}`;let o=0,n=0;for(const h of i){const a=this.Re.measureText(h),u=a.width,d=a.actualBoundingBoxAscent+a.actualBoundingBoxDescent;u>0&&(o=Math.max(o,u),n=Math.max(n,d))}return{width:Math.ceil(o),height:Math.ceil(n)}}}class ut{Ie(i,s){return i.map((r,o)=>{const n=r.codePointAt(0)||0,h=this.Ee(o);let a=0;if(s.hmtx&&s.hmtx.he){const u=this.Ue(s,n);u>0&&s.hmtx.he[u]!==void 0&&(a=s.hmtx.he[u])}return{De:r,unicode:n,color:h,ze:a}})}Ue(i,s){const r=i.cmap;if(!r||!r.qt)return 0;for(const o of r.qt)if(o.format===4){for(let n=0;n<o.se.length;n++)if(s>=o.se[n]&&s<=o.ie[n]){if(o.oe[n]===0)return s+o.re[n]&65535;{const h=o.oe[n]/2+(s-o.se[n])-(o.se.length-n);if(h>=0&&h<o.ne.length){const a=o.ne[h];if(a!==0)return a+o.re[n]&65535}}}}return 0}Ee(i){return[i%256,Math.floor(i/256)%256,Math.floor(i/65536)%256]}Ge(i,s){if(!w.validate(typeof i=="string","Character must be a string.",{method:"getCharacterColor",Pe:i}))return[0,0,0];const r=s.find(o=>o.De===i);return r?r.color:[0,0,0]}Ae(i,s){return w.validate(typeof i=="string"&&i.length>0,"Characters must be a string with at least one character.",{method:"getCharacterColors",Pe:i})?i.split("").map(r=>this.Ge(r,s)||[0,0,0]):[[0,0,0]]}}class Z{constructor(i,s=16){l(this,"Le");l(this,"Oe",[]);l(this,"Be");l(this,"He",16);l(this,"je",0);l(this,"We",0);l(this,"Ne",{width:0,height:0});l(this,"Xe");l(this,"Ye","UrsaFont");l(this,"qe");l(this,"Qe");l(this,"Ze");l(this,"Je");this.He=s,this.qe=new at,this.Qe=new lt(i),this.Ze=new ct,this.Je=new ut}async initialize(i){let s;if(!i)throw new v("Embedded font not available. This appears to be a minified build - please provide `fontSource`.");{const r=await fetch(i);if(!r.ok)throw new v(`Failed to load font file: ${r.status} ${r.statusText}`);s=await r.arrayBuffer()}await this.Ke(s),this.Le=p.parse(s)[0],await this.ti()}ei(i){if(i===void 0)return this.He;this.He=i,this.Ne=this.Ze.ke(this.Oe.map(r=>r.De),this.He,this.Ye);const s=this.Qe.Te(this.Oe,this.Ne,this.He,this.Ye);this.Be=s.framebuffer,this.je=s.columns,this.We=s.rows}async ii(i){try{const s=await fetch(i);if(!s.ok)throw new v(`Failed to load font file: ${s.status} ${s.statusText}`);const r=await s.arrayBuffer();await this.Ke(r);const o=p.parse(r);if(!o||o.length===0)throw Error("Failed to parse font file");this.Le=o[0],await this.ti()}catch(s){throw new v("Failed to load font: "+(s instanceof Error?s.message:"Unknown error"),s)}}async Ke(i){const s=Date.now();this.Ye=this.Ye==="UrsaFont"?"UrsaFont":"CustomFont_"+s,this.Xe=new FontFace(this.Ye,i),await this.Xe.load(),document.fonts.add(this.Xe)}async ti(){const i=this.qe.ge(this.Le),s=this.qe.xe(i);this.Oe=this.Je.Ie(s,this.Le),this.Ne=this.Ze.ke(s,this.He,this.Ye);const r=this.Qe.Te(this.Oe,this.Ne,this.He,this.Ye);this.Be=r.framebuffer,this.je=r.columns,this.We=r.rows}Ge(i){return this.Je.Ge(i,this.Oe)}Ae(i){return this.Je.Ae(i,this.Oe)}si(i){if(typeof i!="string"||i.length===0)return!1;const s=new Set(this.Oe.map(r=>r.De));for(const r of i)if(!s.has(r))return!1;return!0}get ri(){return this.Be}get oi(){return this.Oe}get ni(){return this.je}get hi(){return this.We}get ai(){return this.Ne}dispose(){this.Be.dispose(),document.fonts.delete(this.Xe),this.Be=null,this.Xe=null,this.Le=null,this.Oe=[],this.Ne={width:0,height:0},this.je=0,this.We=0}get fontSize(){return this.He}get font(){return this.Le}}class Q{constructor(i,s,r){l(this,"li");l(this,"ci");l(this,"$");l(this,"M");l(this,"ui");l(this,"fi");l(this,"di",!1);l(this,"mi");l(this,"gi");l(this,"pi");this.mi=i,this.gi=s,this.pi=r,this.reset()}reset(){if(!this.di){const i=this.mi.width,s=this.mi.height;[this.li,this.ci]=[Math.floor(i/this.gi),Math.floor(s/this.pi)]}this._i()}_i(){const i=this.mi.width,s=this.mi.height;this.$=this.li*this.gi,this.M=this.ci*this.pi,this.ui=Math.floor((i-this.$)/2),this.fi=Math.floor((s-this.M)/2)}xi(i,s){[this.gi,this.pi]=[i,s],this.reset()}bi(i,s){this.di=!0,[this.li,this.ci]=[i,s],this._i()}wi(){this.di=!1,this.reset()}resize(){this.di?this._i():this.reset()}Ci(i){if(i===void 0)return this.di;this.di=i}get yi(){return this.gi}get Fi(){return this.pi}dispose(){this.mi=null,this.li=0,this.ci=0,this.$=0,this.M=0,this.ui=0,this.fi=0,this.gi=0,this.pi=0}get cols(){return this.li}get rows(){return this.ci}get width(){return this.$}get height(){return this.M}get offsetX(){return this.ui}get offsetY(){return this.fi}}class J{constructor(i,s=!1,r={}){l(this,"mi");l(this,"Ti");l(this,"$i");l(this,"Mi");l(this,"Si");this.Ti=i,this.$i=s,this.mi=this.Di(r.width,r.height),s&&this.Vi()}Di(i,s){var o;const r=document.createElement("canvas");if(r.className="textmodeCanvas",r.style.imageRendering="pixelated",this.$i)r.width=i||800,r.height=s||600,document.body.appendChild(r);else{const n=this.Ti.getBoundingClientRect();let h=Math.round(n.width),a=Math.round(n.height);if(this.Ti instanceof HTMLVideoElement){const f=this.Ti;(h===0||a===0)&&f.videoWidth>0&&f.videoHeight>0&&(h=f.videoWidth,a=f.videoHeight)}r.width=h,r.height=a,r.style.position="absolute",r.style.pointerEvents="none";const u=window.getComputedStyle(this.Ti);let d=parseInt(u.zIndex||"0",10);isNaN(d)&&(d=0),r.style.zIndex=""+(d+1),this.Ri(r),(o=this.Ti.parentNode)==null||o.insertBefore(r,this.Ti.nextSibling)}return r}Ri(i){const s=this.Ti.getBoundingClientRect();let r=this.Ti.offsetParent;if(r&&r!==document.body){const o=r.getBoundingClientRect();i.style.top=s.top-o.top+"px",i.style.left=s.left-o.left+"px"}else i.style.top=s.top+window.scrollY+"px",i.style.left=s.left+window.scrollX+"px"}resize(i,s){if(this.$i)this.mi.width=i??this.mi.width,this.mi.height=s??this.mi.height;else{const r=this.Ti.getBoundingClientRect();let o=Math.round(r.width),n=Math.round(r.height);if(this.Ti instanceof HTMLVideoElement){const h=this.Ti;(o===0||n===0)&&h.videoWidth>0&&h.videoHeight>0&&(o=h.videoWidth,n=h.videoHeight)}this.mi.width=o,this.mi.height=n,this.Ri(this.mi)}}ki(){const i={alpha:!1,premultipliedAlpha:!1,Ii:!0,antialias:!1,Ei:!1,Ui:!1,powerPreference:"high-performance"},s=this.mi.getContext("webgl2",i)||this.mi.getContext("webgl",i);if(!s)throw new v("WebGL context could not be created. Ensure your browser supports WebGL.");return s}zi(){return this.mi?{width:this.mi.width,height:this.mi.height}:{width:0,height:0}}Gi(){if(!this.mi||!this.$i)return!1;const i=this.mi.getBoundingClientRect(),s=Math.round(i.width),r=Math.round(i.height);return s!==this.mi.width||r!==this.mi.height}Vi(){typeof ResizeObserver<"u"&&(this.Mi=new ResizeObserver(i=>{for(const s of i){const r=s.contentRect,o=Math.round(r.width),n=Math.round(r.height);!this.Si||o===this.mi.width&&n===this.mi.height||this.Si()}}),this.Mi.observe(this.mi))}dispose(){if(this.Mi&&(this.Mi.disconnect(),this.Mi=void 0),this.mi){const i=this.mi.getContext("webgl")||this.mi.getContext("webgl2");if(i){const s=i.getExtension("WEBGL_lose_context");s&&s.Pi()}this.mi.parentNode&&this.mi.parentNode.removeChild(this.mi),this.mi=null}this.Ti=null}get canvas(){return this.mi}get width(){return this.mi.width}get height(){return this.mi.height}}class S{constructor(i,s,r,o={}){l(this,"Ai");l(this,"Li");l(this,"grid");l(this,"Oi");l(this,"Bi");l(this,"Hi");l(this,"ji");l(this,"Wi");l(this,"l");this.Ai=i,this.Li=s,this.grid=r,this.l=o,this.Oi=this.Ai.createFramebuffer(this.grid.cols,this.grid.rows),this.Bi=this.Ai.createFramebuffer(this.grid.cols,this.grid.rows),this.Hi=this.Ai.createFramebuffer(this.grid.cols,this.grid.rows),this.ji=this.Ai.createFramebuffer(this.grid.cols,this.grid.rows),this.Wi=this.Ai.createFramebuffer(this.grid.cols,this.grid.rows)}resize(){this.Oi.resize(this.grid.cols,this.grid.rows),this.Bi.resize(this.grid.cols,this.grid.rows),this.Hi.resize(this.grid.cols,this.grid.rows),this.ji.resize(this.grid.cols,this.grid.rows),this.Wi.resize(this.grid.cols,this.grid.rows)}enabled(i){this.l.enabled=i}enable(){this.enabled(!0)}disable(){this.enabled(!1)}dispose(){this.Oi.dispose(),this.Bi.dispose(),this.Hi.dispose(),this.ji.dispose(),this.Wi.dispose(),this.Oi=null,this.Bi=null,this.Hi=null,this.ji=null,this.Wi=null}get Ni(){return this.Oi}get Xi(){return this.Bi}get Yi(){return this.Hi}get qi(){return this.ji}get Qi(){return this.Wi}get options(){return this.l}}class dt{constructor(i,s){l(this,"C");l(this,"ye");l(this,"Zi");this.ye=i,this.Zi=s;const r=Math.max(this.Zi.length,1);this.C=this.ye.createFramebuffer(r,1),this.Ji()}Ji(){if(!this.C)return;const i=Math.max(this.Zi.length,1);this.C.width!==i&&this.C.resize(i,1);const s=new Uint8Array(1*i*4);for(let r=0;r<i;r++){const o=r<this.Zi.length?this.Zi[r]:[0,0,0],n=4*r;s[n]=o[0],s[n+1]=o[1],s[n+2]=o[2],s[n+3]=255}this.C.I(s,i,1)}Ki(i){this.Zi=i,this.Ji()}get ts(){return this.Zi}get framebuffer(){return this.C}get texture(){return this.C.texture}}class O extends S{constructor(s,r,o,n={}){super(s,r,o,n);l(this,"palette");this.palette=new dt(this.Ai,this.Li.Ae(" .:-=+*%@#"))}oi(s){w.validate(this.Li.si(s),"One or more characters do not exist in the current font.",{method:"characters",Pe:s})&&(this.l.oi=s,this.palette.Ki(this.Li.Ae(s)))}es(s,r,o,n=255){let h,a,u,d;if(typeof s=="string"){const f=this.ss(s);if(!f)return void w.validate(!1,"Invalid hex color format. Use '#FF0000', '#F00', 'FF0000', or 'F00'.",{method:"characterColor",Pe:s});[h,a,u,d]=f}else if(h=s,a=r!==void 0?r:s,u=o!==void 0?o:s,d=n,!w.validate([h,a,u,d].every(f=>f>=0&&f<=255),"Character color values must be between 0 and 255",{method:"characterColor",rs:{r:h,g:a,b:u,a:d}}))return;this.l.es=[h/255,a/255,u/255,d/255]}ns(s){w.validate(["sampled","fixed"].includes(s),"Invalid character color mode. Must be 'sampled' or 'fixed'.",{method:"characterColorMode",Pe:s})&&(this.l.ns=s)}hs(s,r,o,n=255){let h,a,u,d;if(typeof s=="string"){const f=this.ss(s);if(!f)return void w.validate(!1,"Invalid hex color format. Use '#FF0000', '#F00', 'FF0000', or 'F00'.",{method:"cellColor",Pe:s});[h,a,u,d]=f}else if(h=s,a=r!==void 0?r:s,u=o!==void 0?o:s,d=n,!w.validate([h,a,u,d].every(f=>f>=0&&f<=255),"Cell color values must be between 0 and 255",{method:"cellColor",rs:{r:h,g:a,b:u,a:d}}))return;this.l.hs=[h/255,a/255,u/255,d/255]}ls(s){w.validate(["sampled","fixed"].includes(s),"Invalid cell color mode. Must be 'sampled' or 'fixed'.",{method:"cellColorMode",Pe:s})&&(this.l.ls=s)}cs(s){w.validate(typeof s=="boolean"||typeof s=="number"&&Number.isInteger(s),"Invert must be a boolean value or an integer (0 for false, any other number for true).",{method:"invert",Pe:s})&&(this.l.cs=!!s)}rotation(s){if(!w.validate(typeof s=="number","Rotation angle must be a number.",{method:"rotation",Pe:s}))return;(s%=360)<0&&(s+=360);const r=255*s/360,o=Math.floor(r)/255,n=Math.round(r-o);this.l.rotation=[o,n,0,1]}us(s){w.validate(typeof s=="boolean"||typeof s=="number"&&Number.isInteger(s),"Flip horizontally must be a boolean value or an integer (0 for false, any other number for true).",{method:"flipHorizontally",Pe:s})&&(this.l.us=!!s)}fs(s){w.validate(typeof s=="boolean"||typeof s=="number"&&Number.isInteger(s),"Flip vertically must be a boolean value or an integer (0 for false, any other number for true).",{method:"flipVertically",Pe:s})&&(this.l.fs=!!s)}ss(s){return s=s.replace(/^#/,""),/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(s)?(s.length===3&&(s=s.split("").map(r=>r+r).join("")),[parseInt(s.slice(0,2),16),parseInt(s.slice(2,4),16),parseInt(s.slice(4,6),16),255]):null}}const ft={enabled:!0,oi:" .:-=+*%@#",es:[1,1,1,1],ns:"sampled",hs:[0,0,0,1],ls:"fixed",cs:!1,rotation:[0,0,0,255],us:!1,fs:!1,ds:[0,255]};class z extends O{constructor(s,r,o){super(s,r,o,{...ft});l(this,"gs");l(this,"ps");l(this,"vs");l(this,"_s");l(this,"xs");l(this,"bs");this.gs=new E(s.context,R,"precision lowp float;uniform sampler2D u_sketchTexture;uniform vec2 u_gridCellDimensions;uniform vec2 u_brightnessRange;varying vec2 v_uv;void main(){vec2 cellCenter=(floor(v_uv*u_gridCellDimensions)+vec2(0.5))/u_gridCellDimensions;vec4 color=texture2D(u_sketchTexture,cellCenter);float brightness=dot(color.rgb,vec3(0.299,0.587,0.114));float brightnessValue=brightness*255.0;if(brightnessValue>=u_brightnessRange.x&&brightnessValue<=u_brightnessRange.y){gl_FragColor=color;}else{gl_FragColor=vec4(0.0);}}"),this.ps=new E(s.context,R,"precision lowp float;uniform sampler2D u_sampleTexture;uniform vec4 u_fillColor;uniform bool u_useFixedColor;varying vec2 v_uv;void main(){vec4 sampleColor=texture2D(u_sampleTexture,v_uv);if(sampleColor.a>0.0){if(u_useFixedColor){gl_FragColor=u_fillColor;}else{gl_FragColor=sampleColor;}}else{gl_FragColor=vec4(0.0);}}"),this._s=new E(s.context,R,"precision lowp float;uniform sampler2D u_sampleTexture;uniform bool u_invert;uniform bool u_flipHorizontally;uniform bool u_flipVertically;varying vec2 v_uv;void main(){vec4 sampleColor=texture2D(u_sampleTexture,v_uv);if(sampleColor.a>0.0){float invertValue=u_invert ? 1.0 : 0.0;float flipHValue=u_flipHorizontally ? 1.0 : 0.0;float flipVValue=u_flipVertically ? 1.0 : 0.0;gl_FragColor=vec4(invertValue,flipHValue,flipVValue,1.0);}else{gl_FragColor=vec4(0.0);}}"),this.xs=new E(s.context,R,"precision lowp float;uniform sampler2D u_sampleTexture;uniform vec4 u_rotationColor;varying vec2 v_uv;void main(){vec4 sampleColor=texture2D(u_sampleTexture,v_uv);if(sampleColor.a>0.0){gl_FragColor=u_rotationColor;}else{gl_FragColor=vec4(0.0);}}"),this.vs=new E(s.context,R,"precision lowp float;uniform sampler2D u_colorSampleFramebuffer;uniform sampler2D u_charPaletteTexture;uniform vec2 u_charPaletteSize;uniform vec2 u_brightnessRange;varying vec2 v_uv;void main(){vec4 color=texture2D(u_colorSampleFramebuffer,v_uv);if(color.a==0.0){gl_FragColor=vec4(0.0);return;}float brightness=dot(color.rgb,vec3(0.299,0.587,0.114))*255.0;vec2 range=u_brightnessRange;if(brightness<range.x||brightness>range.y){gl_FragColor=vec4(0.0);return;}float t=(brightness-range.x)/(range.y-range.x);float idx=clamp(floor(t*u_charPaletteSize.x),0.0,u_charPaletteSize.x-1.0);vec3 charColor=texture2D(u_charPaletteTexture,vec2((idx+0.5)/u_charPaletteSize.x,0.0)).rgb;gl_FragColor=vec4(charColor,1.0);}"),this.bs=this.Ai.createFramebuffer(this.grid.cols,this.grid.rows)}ws(s){this.bs.U(),this.Ai.clear(),this.Ai.Vt(this.gs),this.Ai.Y("u_sketchTexture",s),this.Ai.Y("u_gridCellDimensions",[this.grid.cols,this.grid.rows]),this.Ai.Y("u_brightnessRange",this.l.ds),this.Ai.rect(0,0,this.grid.cols,this.grid.rows),this.bs.end(),this.Bi.U(),this.Ai.clear(),this.Ai.Vt(this.ps),this.Ai.Y("u_sampleTexture",this.bs.texture),this.Ai.Y("u_fillColor",this.l.es),this.Ai.Y("u_useFixedColor",this.l.ns==="fixed"),this.Ai.rect(0,0,this.grid.cols,this.grid.rows),this.Bi.end(),this.Hi.U(),this.Ai.clear(),this.Ai.Vt(this.ps),this.Ai.Y("u_sampleTexture",this.bs.texture),this.Ai.Y("u_fillColor",this.l.hs),this.Ai.Y("u_useFixedColor",this.l.ls==="fixed"),this.Ai.rect(0,0,this.grid.cols,this.grid.rows),this.Hi.end(),this.Wi.U(),this.Ai.clear(),this.Ai.Vt(this._s),this.Ai.Y("u_sampleTexture",this.bs.texture),this.Ai.Y("u_invert",this.l.cs),this.Ai.Y("u_flipHorizontally",this.l.us),this.Ai.Y("u_flipVertically",this.l.fs),this.Ai.rect(0,0,this.grid.cols,this.grid.rows),this.Wi.end(),this.ji.U(),this.Ai.clear(),this.Ai.Vt(this.xs),this.Ai.Y("u_sampleTexture",this.bs.texture),this.Ai.Y("u_rotationColor",this.l.rotation),this.Ai.rect(0,0,this.grid.cols,this.grid.rows),this.ji.end(),this.Oi.U(),this.Ai.clear(0,0,0,0),this.Ai.Vt(this.vs),this.Ai.Y("u_colorSampleFramebuffer",this.bs.texture),this.Ai.Y("u_charPaletteTexture",this.palette.texture),this.Ai.Y("u_charPaletteSize",[this.palette.ts.length,1]),this.Ai.Y("u_brightnessRange",this.l.ds),this.Ai.rect(0,0,this.grid.cols,this.grid.rows),this.Oi.end()}resize(){super.resize(),this.bs.resize(this.grid.cols,this.grid.rows)}ds(s){w.validate(Array.isArray(s)&&s.length===2&&s.every(r=>typeof r=="number"&&r>=0&&r<=255),"Brightness range must be an array of two numbers between 0 and 255.",{method:"brightnessRange",Pe:s})&&(this.l.ds=s)}}const gt=Object.freeze(Object.defineProperty({__proto__:null,Cs:z,ys:S,Fs:O},Symbol.toStringTag,{value:"Module"}));class tt{constructor(i,s,r){l(this,"Ai");l(this,"font");l(this,"grid");l(this,"Ts");l(this,"$s");l(this,"Ms");l(this,"Oi");l(this,"Bi");l(this,"Hi");l(this,"ji");l(this,"Wi");this.Ai=i,this.font=s,this.grid=r,this.Ms=this.Ai.createShader(R,"precision mediump float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D u_primaryColorTexture;uniform sampler2D u_secondaryColorTexture;uniform sampler2D u_transformTexture;uniform sampler2D u_asciiCharacterTexture;uniform sampler2D u_rotationTexture;uniform sampler2D u_captureTexture;uniform vec2 u_captureDimensions;uniform int u_backgroundMode;uniform vec2 u_gridCellDimensions;uniform vec2 u_gridPixelDimensions;mat2 rotate2D(float angle){float s=sin(angle);float c=cos(angle);return mat2(c,-s,s,c);}void main(){vec2 adjustedCoord=gl_FragCoord.xy/u_gridPixelDimensions;vec2 gridCoord=adjustedCoord*u_gridCellDimensions;vec2 cellCoord=floor(gridCoord);vec2 charIndexTexCoord=(cellCoord+0.5)/u_gridCellDimensions;vec4 primaryColor=texture2D(u_primaryColorTexture,charIndexTexCoord);vec4 secondaryColor=texture2D(u_secondaryColorTexture,charIndexTexCoord);vec4 transformColor=texture2D(u_transformTexture,charIndexTexCoord);bool isInverted=transformColor.r>0.5;bool flipHorizontal=transformColor.g>0.5;bool flipVertical=transformColor.b>0.5;vec4 encodedIndexVec=texture2D(u_asciiCharacterTexture,charIndexTexCoord);if(encodedIndexVec.a<0.01){gl_FragColor=(u_backgroundMode==0)? vec4(0.0):texture2D(u_captureTexture,gl_FragCoord.xy/u_captureDimensions);return;}int charIndex=int(encodedIndexVec.r*255.0+0.5)+int(encodedIndexVec.g*255.0+0.5)*256;int charCol=int(mod(float(charIndex),u_charsetDimensions.x));int charRow=charIndex/int(u_charsetDimensions.x);float flippedRow=(u_charsetDimensions.y-1.0)-float(charRow);vec2 charCoord=vec2(float(charCol),flippedRow)/u_charsetDimensions;vec4 rotationColor=texture2D(u_rotationTexture,charIndexTexCoord);float scaledAngle=rotationColor.r*255.0+rotationColor.g;float rotationAngle=(scaledAngle*360.0/255.0)*0.017453292;vec2 fractionalPart=fract(gridCoord)-0.5;if(flipHorizontal)fractionalPart.x=-fractionalPart.x;if(flipVertical)fractionalPart.y=-fractionalPart.y;fractionalPart=rotate2D(rotationAngle)*fractionalPart+0.5;vec2 cellSize=1.0/u_charsetDimensions;vec2 texCoord=charCoord+fractionalPart*cellSize;vec2 cellMax=charCoord+cellSize;if(any(lessThan(texCoord,charCoord))||any(greaterThan(texCoord,cellMax))){gl_FragColor=isInverted ? primaryColor : secondaryColor;return;}vec4 charTexel=texture2D(u_characterTexture,texCoord);if(isInverted)charTexel.rgb=1.0-charTexel.rgb;gl_FragColor=mix(secondaryColor,primaryColor,charTexel);}"),this.Ts=[{name:"brightness",Ss:new z(i,s,r)},{name:"custom",Ss:new S(i,s,r)}],this.Oi=this.Ai.createFramebuffer(r.cols,r.rows),this.Bi=this.Ai.createFramebuffer(r.cols,r.rows),this.Hi=this.Ai.createFramebuffer(r.cols,r.rows),this.ji=this.Ai.createFramebuffer(r.cols,r.rows),this.Wi=this.Ai.createFramebuffer(r.cols,r.rows),this.$s=this.Ai.createFramebuffer(this.grid.width,this.grid.height)}Ds(i){for(const r of this.Ts){const o=r.Ss;o.options.enabled&&o instanceof O&&o.ws(i)}const s=(r,o)=>{r.U(),this.Ai.clear();for(const n of this.Ts){const h=n.Ss;h.options.enabled&&this.Ai.image(o(h),0,0)}r.end()};s(this.Oi,r=>r.Ni),s(this.Bi,r=>r.Xi),s(this.Hi,r=>r.Yi),s(this.ji,r=>r.qi),s(this.Wi,r=>r.Qi),this.$s.U(),this.Ai.clear(),this.Ai.Vt(this.Ms),this.Ai.Y("u_characterTexture",this.font.ri),this.Ai.Y("u_charsetDimensions",[this.font.ni,this.font.hi]),this.Ai.Y("u_asciiCharacterTexture",this.Oi.texture),this.Ai.Y("u_primaryColorTexture",this.Bi.texture),this.Ai.Y("u_secondaryColorTexture",this.Hi.texture),this.Ai.Y("u_transformTexture",this.Wi.texture),this.Ai.Y("u_rotationTexture",this.ji.texture),this.Ai.Y("u_captureTexture",i.texture),this.Ai.Y("u_backgroundMode",!1),this.Ai.Y("u_captureDimensions",[i.width,i.height]),this.Ai.Y("u_gridCellDimensions",[this.grid.cols,this.grid.rows]),this.Ai.Y("u_gridPixelDimensions",[this.grid.width,this.grid.height]),this.Ai.rect(0,0,this.$s.width,this.$s.height),this.$s.end()}get(i){if(!w.validate(typeof i=="string"&&i.length>0,"Converter name must be a non-empty string.",{method:"converter",Pe:i}))return;const s=this.Ts.find(o=>o.name===i),r=s==null?void 0:s.Ss;return w.validate(r instanceof S,`Converter "${i}" is not a valid TextmodeConverter.`,{method:"converter",Pe:i,Vs:r})?r:void 0}add(i,s){if(!w.validate(typeof i=="string"&&i.length>0,"Converter name must be a non-empty string.",{method:"add",Pe:i})||!w.validate(s==="brightness"||s==="custom",'Converter type must be either "brightness" or "custom". Provided: '+s,{method:"add",Pe:s}))return;let r;return r=s==="brightness"?new z(this.Ai,this.font,this.grid):new S(this.Ai,this.font,this.grid),this.Ts.push({name:i,Ss:r}),r}remove(i){if(!w.validate(typeof i=="string"||i instanceof S,"Parameter must be either a string (converter name) or a TextmodeConverter instance.",{method:"remove",Pe:i}))return;let s=-1;if(typeof i=="string"){if(!w.validate(i.length>0,"Converter name must be a non-empty string.",{method:"remove",Pe:i}))return;s=this.Ts.findIndex(r=>r.name===i)}else s=this.Ts.findIndex(r=>r.Ss===i);w.validate(s!==-1,typeof i=="string"?`Converter with name "${i}" not found in pipeline.`:"Converter instance not found in pipeline.",{method:"remove",Pe:i,Rs:this.Ts.length})&&this.Ts.splice(s,1)}get texture(){return this.$s}resize(){this.$s.resize(this.grid.width,this.grid.height),this.Oi.resize(this.grid.cols,this.grid.rows),this.Bi.resize(this.grid.cols,this.grid.rows),this.Hi.resize(this.grid.cols,this.grid.rows),this.ji.resize(this.grid.cols,this.grid.rows),this.Wi.resize(this.grid.cols,this.grid.rows);for(const i of this.Ts)i.Ss.resize()}ks(){return this.Ts.some(i=>i.Ss.options.enabled)}disable(){for(const i of this.Ts)i.Ss.disable()}enable(){for(const i of this.Ts)i.Ss.enable()}dispose(){for(const i of this.Ts)i.Ss.dispose();this.Oi.dispose(),this.Bi.dispose(),this.Hi.dispose(),this.ji.dispose(),this.Wi.dispose(),this.$s.dispose(),this.Ms.dispose(),this.Ts=[],this.Oi=null,this.Bi=null,this.Hi=null,this.ji=null,this.Wi=null,this.$s=null,this.Ms=null}get Ni(){return this.Oi}get Xi(){return this.Bi}get Yi(){return this.Hi}get qi(){return this.ji}get Qi(){return this.Wi}}const mt=c=>class extends c{fill(i,s,r,o){this.ye.fill(i,s,r,o)}stroke(i,s,r,o){this.ye.stroke(i,s,r,o)}Rt(i){this.ye.Rt(i)}kt(){this.ye.kt()}It(){this.ye.It()}rotate(i){this.ye.rotate(i)}push(){this.ye.push()}pop(){this.ye.pop()}rect(i,s,r=1,o=1){this.ye.rect(i,s,r,o)}line(i,s,r,o){this.ye.line(i,s,r,o)}background(i,s=i,r=i,o=255){this.ye.background(i,s,r,o)}createShader(i,s){return this.ye.createShader(i,s)}zt(i){return this.ye.zt(i)}Vt(i){this.ye.Vt(i)}Y(i,s){this.ye.Y(i,s)}};class V{Is(i){const s=i.get("brightness"),r=s==null?void 0:s.Ni,o=s==null?void 0:s.Xi,n=s==null?void 0:s.Yi,h=s==null?void 0:s.Qi,a=s==null?void 0:s.qi;return r==null||r.G(),o==null||o.G(),n==null||n.G(),h==null||h.G(),a==null||a.G(),{Es:(r==null?void 0:r.P)||new Uint8Array(0),Us:(o==null?void 0:o.P)||new Uint8Array(0),zs:(n==null?void 0:n.P)||new Uint8Array(0),Gs:(h==null?void 0:h.P)||new Uint8Array(0),Ps:(a==null?void 0:a.P)||new Uint8Array(0)}}As(i,s){return i[s]+(i[s+1]<<8)}Ls(i,s){return{r:i[s],g:i[s+1],b:i[s+2],a:i[s+3]}}}class H{Os(i,s){return new Blob([i],{type:s})}Bs(i,s,r){try{const o=this.Os(i,r),n=URL.createObjectURL(o),h=document.createElement("a");h.href=n,h.download=s,h.style.display="none",h.rel="noopener",document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(n)}catch(o){throw console.error("Failed to download file:",o),Error("File download failed: "+(o instanceof Error?o.message:"Unknown error"))}}Hs(){return new Date().toISOString().slice(0,19).replace(/:/g,"-")}js(){const i=new Date;return{Ws:i.toISOString().split("T")[0],time:i.toTimeString().split(" ")[0].replace(/:/g,"-")}}Ns(i){return i.replace(/[<>:"/\\|?*]/g,"_").replace(/\s+/g,"_").replace(/_{2,}/g,"_").replace(/^_+|_+$/g,"").substring(0,255)}Xs(){return"'textmode-export'-"+this.Hs()}}class pt extends V{Ys(i,s,r){const o=i[r]===255,n=i[r+1]===255,h=i[r+2]===255,a=s[r],u=s[r+1];return{qs:o,Qs:n,Zs:h,rotation:Math.round(360*(a+u/255)/255*100)/100}}Js(i,s,r){return{x:i,y:s,Ks:i*r.yi,tr:s*r.Fi}}er(i,s){const r=[];let o=0;for(let n=0;n<s.rows;n++)for(let h=0;h<s.cols;h++){const a=4*o,u=this.As(i.Es,a);let d=this.Ls(i.Us,a),f=this.Ls(i.zs,a);const g=this.Ys(i.Gs,i.Ps,a);if(g.qs){const b=d;d=f,f=b}const m=this.Js(h,n,s);r.push({charIndex:u,ir:d,sr:f,transform:g,position:m}),o++}return r}}class _t{rr(i,s){const r=i.cmap;if(!r||!r.qt)return 0;for(const o of r.qt)if(o.format===4){for(let n=0;n<o.se.length;n++)if(s>=o.se[n]&&s<=o.ie[n]){if(o.oe[n]===0)return s+o.re[n]&65535;{const h=o.oe[n]/2+(s-o.se[n])-(o.se.length-n);if(h>=0&&h<o.ne.length){const a=o.ne[h];if(a!==0)return a+o.re[n]&65535}}}}return 0}nr(){return{hr:()=>({x1:0,y1:0,x2:0,y2:0}),ar:()=>""}}lr(i,s,r,o,n){if(!s||!s.fe||s.fe.length===0)return this.nr();const h=n/i.head.unitsPerEm;return{hr:()=>({x1:r+s.xMin*h,y1:o+-s.yMax*h,x2:r+s.xMax*h,y2:o+-s.yMin*h}),ar:()=>this.cr(s,r,o,h)}}cr(i,s,r,o){if(!i||!i.fe)return"";const{fe:n,de:h,ue:a,flags:u}=i;if(!(n&&h&&a&&u))return"";let d="",f=0;for(let g=0;g<a.length;g++){const m=a[g];if(!(m<f)){if(m>=f){const b=s+n[f]*o,y=r-h[f]*o;d+=`M${b.toFixed(2)},${y.toFixed(2)}`;let _=f+1;for(;_<=m;)if(1&u[_]){const T=s+n[_]*o,A=r-h[_]*o;d+=`L${T.toFixed(2)},${A.toFixed(2)}`,_++}else{const T=s+n[_]*o,A=r-h[_]*o;let C=_+1>m?f:_+1;if(1&u[C]){const $=s+n[C]*o,D=r-h[C]*o;d+=`Q${T.toFixed(2)},${A.toFixed(2)} ${$.toFixed(2)},${D.toFixed(2)}`,_=C+1}else{const $=(T+(s+n[C]*o))/2,D=(A+(r-h[C]*o))/2;d+=`Q${T.toFixed(2)},${A.toFixed(2)} ${$.toFixed(2)},${D.toFixed(2)}`,_=C}}d+="Z"}f=m+1}}return d}ur(i,s,r,o,n){try{const h=i.codePointAt(0)||0,a=this.rr(s,h);if(a===0)return this.nr();let u=null;try{s.glyf&&s.glyf[a]!==null?u=s.glyf[a]:p&&p.T&&p.T.glyf&&p.T.glyf.le&&(u=p.T.glyf.le(s,a),s.glyf&&u&&(s.glyf[a]=u))}catch(d){console.warn(`Failed to parse glyph ${a}:`,d)}return u?this.lr(s,u,r,o,n):this.nr()}catch(h){return console.warn(`Failed to generate path for character "${i}":`,h),this.nr()}}dr(i,s,r,o,n,h,a,u){try{const d=a/s.head.unitsPerEm,f=r+(n-u*d)/2,g=o+(h+.7*a)/2;return this.ur(i,s,f,g,a).ar()||null}catch(d){return console.warn(`Failed to generate positioned character path for "${i}":`,d),null}}}class wt{constructor(){l(this,"mr");this.mr=new _t}gr(i){return`<?xml version="1.0" encoding="UTF-8" standalone="no"?>
8
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
9
+ <svg width="${i.width}" height="${i.height}" viewBox="0 0 ${i.width} ${i.height}"
10
+ xmlns="http://www.w3.org/2000/svg" version="1.1">
11
+ <title>textmode art generated via textmode.js</title>
12
+ <desc>textmode art visualization generated by textmode.js library</desc>`}pr(){return`
13
+ </g>
14
+ </svg>`}vr(i,s){if(!s._r)return"";const r=s.backgroundColor,o=`rgba(${r[0]},${r[1]},${r[2]},${r[3]/255})`;return`
15
+ <rect width="${i.width}" height="${i.height}" fill="${o}" />`}br(i){return`rgba(${i.r},${i.g},${i.b},${i.a/255})`}wr(i,s){const{transform:r,position:o}=i,n=o.Ks+s.yi/2,h=o.tr+s.Fi/2,a=[];if(r.Qs||r.Zs){const u=r.Qs?-1:1,d=r.Zs?-1:1;a.push(`translate(${n} ${h})`),a.push(`scale(${u} ${d})`),a.push(`translate(${-n} ${-h})`)}return r.rotation&&a.push(`rotate(${r.rotation} ${n} ${h})`),a.length?` transform="${a.join(" ")}"`:""}Cr(i,s,r){if(!r._r||i.sr.a===0)return"";const{position:o}=i,n=this.br(i.sr);return r.yr==="stroke"?`
16
+ <rect x="${o.Ks}" y="${o.tr}" width="${s.yi}" height="${s.Fi}" stroke="${n}" fill="none" stroke-width="${r.strokeWidth}" />`:`
17
+ <rect x="${o.Ks}" y="${o.tr}" width="${s.yi}" height="${s.Fi}" fill="${n}" />`}ur(i,s,r,o){const n=r.oi[i.charIndex];if(!n)return"";const h=this.mr.dr(n.De,r.font,i.position.Ks,i.position.tr,s.yi,s.Fi,r.fontSize,n.ze);if(!h)return"";const a=this.br(i.ir);return o.yr==="stroke"?`
18
+ <path id="${`path-${i.charIndex}-${i.position.Ks}-${i.position.tr}`.replace(/\./g,"-")}" d="${h}" stroke="${a}" stroke-width="${o.strokeWidth}" fill="none" />`:`
19
+ <path d="${h}" fill="${a}" />`}Fr(i,s,r,o){let n="";n+=this.Cr(i,s,o);const h=this.wr(i,s),a=this.ur(i,s,r,o);return a&&(h?(n+=`
20
+ <g${h}>`,n+=a,n+=`
21
+ </g>`):n+=a),n}Tr(i,s,r,o){let n=this.gr(s);n+=this.vr(s,o),n+=`
22
+ <g id="ascii-cells">`;for(const h of i)n+=this.Fr(h,s,r,o);return n+=this.pr(),n}$r(i){return i.replace(/<path[^>]*d=""[^>]*\/>/g,"").replace(/\n\s*\n/g,`
23
+ `).replace(/[ \t]+$/gm,"")}}class vt extends H{Mr(i){return this.Os(i,"image/svg+xml;charset=utf-8")}Sr(i,s){try{this.Bs(i,this.Ns(s)+".svg","image/svg+xml;charset=utf-8")}catch(r){throw console.error("Failed to download SVG file:",r),Error("SVG download failed: "+(r instanceof Error?r.message:"Unknown error"))}}Dr(i,s){this.Sr(i,s||this.Xs())}}class et{constructor(){l(this,"Vr");l(this,"Rr");l(this,"kr");this.Vr=new pt,this.Rr=new wt,this.kr=new vt}Ir(i){return{_r:i._r??!0,yr:i.yr??"fill",strokeWidth:i.strokeWidth??1,backgroundColor:i.backgroundColor??[0,0,0,0]}}Er(i,s={}){const r=this.Ir(s),o=this.Vr.Is(i.Ur),n=this.Vr.er(o,i.grid),h=this.Rr.Tr(n,i.grid,i.font,r);return this.Rr.$r(h)}Dr(i,s={}){try{const r=this.Er(i,s),o=s.filename||this.kr.Xs();this.kr.Dr(r,o)}catch(r){throw console.error("Failed to save SVG:",r),Error("SVG save failed: "+(r instanceof Error?r.message:"Unknown error"))}}}class xt extends V{zr(i,s,r,o=" "){var a;const n=[];let h=0;for(let u=0;u<s.rows;u++){const d=[];for(let f=0;f<s.cols;f++){const g=4*h,m=this.As(i.Es,g),b=((a=r.oi[m])==null?void 0:a.De)||o;d.push(b),h++}n.push(d)}return n}}class bt{Gr(i,s){const r=[];for(const n of i){let h=n.join("");s.Pr||(h=h.replace(/\s+$/,"")),r.push(h)}const o=s.Ar==="crlf"?`\r
24
+ `:`
25
+ `;return r.join(o)}}class yt extends H{Lr(i,s){try{const r=this.Or(s);this.Bs(i,r,"text/plain;charset=utf-8")}catch(r){throw console.error("Failed to save TXT file:",r),Error("TXT file save failed: "+(r instanceof Error?r.message:"Unknown error"))}}Or(i){let s=this.Ns(i);return s===".txt"||s.length<=4?this.Xs():s}}class it{constructor(){l(this,"Vr");l(this,"Rr");l(this,"kr");this.Vr=new xt,this.Rr=new bt,this.kr=new yt}Ir(i){return{Pr:i.Pr??!1,Ar:i.Ar??"lf",Br:i.Br??" "}}Hr(i,s={}){const r=this.Ir(s),o=this.Vr.Is(i.Ur),n=this.Vr.zr(o,i.grid,i.font,r.Br);return this.Rr.Gr(n,r)}Lr(i,s={}){try{const r=this.Hr(i,s),o=s.filename||this.kr.Xs();this.kr.Lr(r,o)}catch(r){throw console.error("Failed to save TXT:",r),Error("TXT save failed: "+(r instanceof Error?r.message:"Unknown error"))}}}class Tt extends V{jr(i,s=1,r="transparent"){const o=i.canvas;if(s===1&&r==="transparent")return o;const n=document.createElement("canvas"),h=n.getContext("2d"),a=Math.round(o.width*s),u=Math.round(o.height*s);return n.width=a,n.height=u,r!=="transparent"&&(h.fillStyle=r,h.fillRect(0,0,a,u)),h.imageSmoothingEnabled=!1,h.drawImage(o,0,0,o.width,o.height,0,0,a,u),n}}class Ct{Wr(i,s){const r=this.Nr(s.format);return s.format==="png"?i.toDataURL(r):i.toDataURL(r,s.Xr)}async Yr(i,s){return new Promise((r,o)=>{const n=this.Nr(s.format),h=a=>{a?r(a):o(Error(`Failed to generate ${s.format.toUpperCase()} blob`))};s.format==="png"?i.toBlob(h,n):i.toBlob(h,n,s.Xr)})}Nr(i){switch(i){case"png":return"image/png";case"jpg":return"image/jpeg";case"webp":return"image/webp";default:throw Error("Unsupported image format: "+i)}}}const st={qr:"image/png",Qr:"image/jpeg",Zr:"image/webp"},X={qr:".png",Qr:".jpg",Zr:".webp"};class At extends H{Jr(i,s,r){try{const o=X[r];typeof i=="string"?this.Kr(i,this.Ns(s)+o):this.eo(i,this.Ns(s)+o)}catch(o){throw console.error(`Failed to save ${r.toUpperCase()} image:`,o),Error("Image save failed: "+(o instanceof Error?o.message:"Unknown error"))}}Kr(i,s){const r=document.createElement("a");r.href=i,r.download=s,r.style.display="none",r.rel="noopener",document.body.appendChild(r),r.click(),document.body.removeChild(r)}eo(i,s){const r=URL.createObjectURL(i);try{const o=document.createElement("a");o.href=r,o.download=s,o.style.display="none",o.rel="noopener",document.body.appendChild(o),o.click(),document.body.removeChild(o)}finally{URL.revokeObjectURL(r)}}io(i){return i in st&&i in X}Nr(i){return st[i]}so(i){return X[i]}}class Et{constructor(){l(this,"Vr");l(this,"Rr");l(this,"kr");this.Vr=new Tt,this.Rr=new Ct,this.kr=new At}Ir(i){return{format:i.format??"png",Xr:i.Xr??1,scale:i.scale??1,backgroundColor:i.backgroundColor??"transparent"}}ro(i){if(console.log("Validating image export options:",i),!this.kr.io(i.format))throw Error(`Saving '${i.format}' files is not supported`);if(i.Xr<0||i.Xr>1)throw Error("Image quality must be between 0.0 and 1.0");if(i.scale<=0)throw Error("Scale factor must be greater than 0");i.scale>10&&console.warn("Large scale factors may result in very large files and slow performance"),i.format==="jpg"&&i.backgroundColor==="transparent"&&(i.backgroundColor="black")}oo(i,s={}){const r=this.Ir(s);if(this.ro(r),r.scale===1&&r.backgroundColor==="transparent")return this.Rr.Wr(i.canvas,r);const o=this.Vr.jr(i,r.scale,r.backgroundColor);return this.Rr.Wr(o,r)}async Yr(i,s={}){const r=this.Ir(s);if(this.ro(r),r.scale===1&&r.backgroundColor==="transparent")return await this.Rr.Yr(i.canvas,r);const o=this.Vr.jr(i,r.scale,r.backgroundColor);return await this.Rr.Yr(o,r)}async Jr(i,s={}){try{const r=await this.Yr(i,s),o=s.format??"png",n=s.filename||this.kr.Xs();this.kr.Jr(r,n,o)}catch(r){throw console.error("Failed to save image:",r),Error("Image save failed: "+(r instanceof Error?r.message:"Unknown error"))}}}const Rt=c=>class extends c{toString(i={}){return new it().Hr(this,i)}no(i={}){new it().Lr(this,i)}ar(i={}){return new et().Er(this,i)}Dr(i={}){new et().Dr(this,i)}async ho(i,s="png",r={}){await new Et().Jr(this.ao,{...r,filename:i,format:s})}},Ft=c=>class extends c{async ii(i){return this.Le.ii(i).then(()=>{const s=this.Le.ai;this.lo.xi(s.width,s.height),this.co.resize()})}fontSize(i){if(!w.validate(typeof i=="number"&&i>0,"Font size must be a positive number greater than 0.",{method:"fontSize",Pe:i})||this.Le.fontSize===i)return;this.Le.ei(i);const s=this.Le.ai;this.lo.xi(s.width,s.height),this.co.resize(),this.ye.Ot()}};class Mt{constructor(){l(this,"ye");l(this,"Le");l(this,"co");l(this,"ao");l(this,"lo")}}class G extends function(s,...r){return r.reduce((o,n)=>n(o),s)}(Mt,mt,Rt,Ft){constructor(s=null,r={}){super();l(this,"Ti");l(this,"uo");l(this,"Mi");l(this,"fo");l(this,"do");l(this,"mo",null);l(this,"po",0);l(this,"vo");l(this,"_o",!0);l(this,"xo",0);l(this,"bo",0);l(this,"wo",0);l(this,"Co",[]);l(this,"yo",10);l(this,"Fo",!1);l(this,"To",!1);l(this,"$o",()=>{});l(this,"Mo",()=>{});l(this,"So",null);l(this,"Do",!1);this.Ti=s,this.To=s===null,this.fo=r.Vo??"auto",this.do=r.Ro??60,this.vo=1e3/this.do}static async create(s=null,r={}){const o=new this(s,r),n=o.To?r:void 0;let h,a;o.ao=new J(o.Ti,o.To,n),o.ye=new ht(o.ao.ki()),o.To?(h=r.width||800,a=r.height||600):(h=o.ao.width||800,a=o.ao.height||600),o.uo=o.ye.createFramebuffer(h,a),o.Le=new Z(o.ye,r.fontSize??16),await o.Le.initialize(r.ko);const u=o.Le.ai;return o.lo=new Q(o.ao.canvas,u.width,u.height),o.co=new tt(o.ye,o.Le,o.lo),o.Io(),o.Eo(),o}Io(){this.So=()=>{this.To?this.Mo():this.resize()},window.addEventListener("resize",this.So),window.ResizeObserver&&this.Ti&&!this.To&&(this.Mi=new ResizeObserver(()=>{this.resize()}),this.Mi.observe(this.Ti))}Ds(){if(this.Uo(),this.wo++,this.Fo)console.warn("Cannot render: Required resources have been disposed");else if(this.To?(this.uo.U(),this.$o(),this.uo.end()):this.uo.update(this.Ti),this.co.ks()?(this.co.Ds(this.uo),this.ye.background(0),this.ye.image(this.co.texture,this.lo.offsetX,this.lo.offsetY,this.co.texture.width,this.co.texture.height)):(this.ye.clear(),this.ye.image(this.uo,this.lo.offsetX,this.lo.offsetY,this.uo.width,this.uo.height)),this.Do){let s=0;this.ye.image(this.co.Ni,s,0,this.co.Ni.width,this.co.Ni.height),s+=this.co.Ni.width,this.ye.image(this.co.Xi,s,0,this.co.Xi.width,this.co.Xi.height),s+=this.co.Xi.width,this.ye.image(this.co.Yi,s,0,this.co.Yi.width,this.co.Yi.height),s+=this.co.Yi.width,this.ye.image(this.co.Qi,s,0,this.co.Qi.width,this.co.Qi.height),s+=this.co.Qi.width,this.ye.image(this.co.qi,s,0,this.co.qi.width,this.co.qi.height)}}resize(){this.ao.resize(),this.uo.resize(this.ao.width,this.ao.height),this.lo.resize(),this.co.resize(),this.ye.Ot(),this.fo!=="manual"&&this.Ds()}Eo(){if(this.fo!=="auto"||!this._o)return;this.po=performance.now();const s=r=>{if(!this._o)return void(this.mo=null);const o=r-this.po;o>=this.vo&&(this.Ds(),this.po=r-o%this.vo),this._o&&(this.mo=requestAnimationFrame(s))};this.mo=requestAnimationFrame(s)}Uo(){const s=performance.now();if(this.bo>0){const r=s-this.bo;this.Co.push(r),this.Co.length>this.yo&&this.Co.shift();const o=this.Co.reduce((n,h)=>n+h,0)/this.Co.length;this.xo=1e3/o}this.bo=s}zo(){this.mo&&(cancelAnimationFrame(this.mo),this.mo=null)}Vo(s){this.fo!==s&&(this.zo(),this.fo=s,s==="auto"&&this._o&&this.Eo())}Ro(s){if(s===void 0)return this.xo;this.do=s,this.vo=1e3/s,this.fo==="auto"&&this._o&&(this.zo(),this.Eo())}Go(){this._o&&(this._o=!1,this.mo&&(cancelAnimationFrame(this.mo),this.mo=null))}loop(){this._o||(this._o=!0,this.fo==="auto"&&this.Eo())}Po(s=1){if(w.validate(typeof s=="number"&&s>0&&Number.isInteger(s),"Redraw count must be a positive integer.",{method:"redraw",Pe:s}))for(let r=0;r<s;r++)this.Ds()}Ao(){return this.fo==="auto"&&this._o}draw(s){this.$o=s}Lo(s){this.Mo=s}Oo(s,r){this.ao.resize(s,r),this.uo.resize(this.ao.width,this.ao.height),this.lo.resize(),this.co.resize(),this.ye.Ot(),this.fo!=="manual"&&this.Ds()}Ss(s){return this.co.get(s)}destroy(){this.zo(),this.So&&(window.removeEventListener("resize",this.So),this.So=null),this.Mi&&(this.Mi.disconnect(),this.Mi=null),this.co.dispose(),this.Le.dispose(),this.lo.dispose(),this.uo.dispose(),this.ye.dispose(),this.ao.dispose(),this.Ti=null,this.ao=null,this.ye=null,this.uo=null,this.Le=null,this.lo=null,this.co=null,this.Mi=null,this.$o=()=>{},this.Mo=()=>{},this.mo=null,this.po=0,this.bo=0,this.wo=0,this.xo=0,this.Co=[],this._o=!1,this.Fo=!0}debug(s){this.Do=s}get grid(){return this.lo}get font(){return this.Le}get mode(){return this.fo}get Ur(){return this.co}get frameCount(){return this.wo}set frameCount(s){this.wo=s}get width(){return this.ao.width}get height(){return this.ao.height}get Bo(){return this.Fo}}class I{static async create(i,s={}){if(i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement)return G.create(i,s);{const r=i||{};return G.create(null,r)}}static Ho(i){w.v(i)}static get version(){return"0.1.6-beta.5"}constructor(){throw Error("Textmode is a static class and cannot be instantiated.")}}const $t=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Dt=I.create,St=I.Ho,Ut=I.version;x.jo=J,x.Wo=tt,x.No=F,x.Xo=Z,x.Yo=Q,x.qo=G,x.Ts=gt,x.create=Dt,x.default=I,x.Qo=$t,x.Ho=St,x.Zo=I,x.version=Ut,Object.defineProperties(x,{Jo:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},typeof exports=="object"&&typeof module<"u"?e(exports):typeof define=="function"&&define.amd?define(["exports"],e):e((t=typeof globalThis<"u"?globalThis:t||self).Zo={});
@@ -1,8 +1,3 @@
1
1
  export { Shader } from './webgl/Shader';
2
2
  export { GLRenderer } from './webgl/Renderer';
3
3
  export { Framebuffer } from './webgl/Framebuffer';
4
- export { Rectangle } from './webgl/geometries/Rectangle';
5
- export { Line } from './webgl/geometries/Line';
6
- export { Shape } from './webgl/shapes/Shape';
7
- export { RectangleShape } from './webgl/shapes/RectangleShape';
8
- export { LineShape } from './webgl/shapes/LineShape';
@@ -21,16 +21,11 @@ export declare class Framebuffer {
21
21
  private options;
22
22
  private previousState;
23
23
  private _pixels;
24
- private _isFromCanvasSource;
25
24
  constructor(gl: WebGLRenderingContext, width: number, height?: number, options?: FramebufferOptions);
26
- /** Cache for MAX_TEXTURE_IMAGE_UNITS per-context */
27
- private static maxTextureUnitsMap;
28
- private getMaxTextureUnits;
29
25
  /**
30
- * Unbind the provided texture from any texture unit where it is currently bound.
31
- * This prevents framebuffer-texture feedback loops when rendering to this framebuffer.
26
+ * Execute a function with this framebuffer bound, then restore previous binding
32
27
  */
33
- private unbindTextureAcrossUnits;
28
+ private withFramebufferBound;
34
29
  private createTexture;
35
30
  private updateTextureSize;
36
31
  private attachTexture;
@@ -86,6 +81,4 @@ export declare class Framebuffer {
86
81
  get width(): number;
87
82
  get height(): number;
88
83
  get pixels(): Uint8Array | null;
89
- /** True if the last content update came from a canvas/video or raw pixels (top-left origin). False if rendered via FBO (bottom-left). */
90
- get isFromCanvasSource(): boolean;
91
84
  }
@@ -8,7 +8,8 @@ export declare class GLRenderer {
8
8
  private imageShader;
9
9
  private solidColorShader;
10
10
  private currentShader;
11
- private attribCache;
11
+ private rectangleGeometry;
12
+ private lineGeometry;
12
13
  private currentFillColor;
13
14
  private fillMode;
14
15
  private currentStrokeColor;
@@ -121,15 +122,4 @@ export declare class GLRenderer {
121
122
  * Render a framebuffer at a specific position with optional scaling
122
123
  */
123
124
  image(source: Framebuffer, posX: number, posY: number, width?: number, height?: number): void;
124
- private unitBuffer;
125
- private bytesPerVertex;
126
- private scratchFramebuffer;
127
- private ensureUnitBuffer;
128
- private enableAttribs;
129
- private disableAttribs;
130
- private uploadQuadNDC;
131
- private toNDC;
132
- private drawRectImmediate;
133
- private drawRectStrokeImmediate;
134
- private drawLineImmediate;
135
125
  }
@@ -5,12 +5,13 @@ export declare class Shader {
5
5
  private gl;
6
6
  private program;
7
7
  private uniformLocations;
8
- private attributeLocations;
8
+ private uniformTypes;
9
9
  private textureUnitCounter;
10
+ private maxTextureUnits;
10
11
  constructor(gl: WebGLRenderingContext, vertexSource: string, fragmentSource: string);
12
+ private cacheLocations;
11
13
  private createProgram;
12
14
  private createShader;
13
- private cacheLocations;
14
15
  /**
15
16
  * Use this shader program
16
17
  */
@@ -19,19 +20,11 @@ export declare class Shader {
19
20
  * Set a single uniform value with automatic texture unit management
20
21
  */
21
22
  setUniform(name: string, value: any): void;
22
- /**
23
- * Get uniform info to determine the correct WebGL type
24
- */
25
- private getUniformInfo;
26
23
  private getNextTextureUnit;
27
24
  /**
28
- * Check if this shader has a specific uniform
29
- */
30
- hasUniform(name: string): boolean;
31
- /**
32
- * Check if this shader has a specific attribute
25
+ * Check if a uniform is an integer type
33
26
  */
34
- hasAttribute(name: string): boolean;
27
+ private isUniformInteger;
35
28
  /**
36
29
  * Get the WebGL program
37
30
  */
@@ -1,6 +1,4 @@
1
1
  type Viewport = [number, number, number, number];
2
2
  export declare function setViewport(gl: WebGLRenderingContext, vp: Viewport): void;
3
3
  export declare function getViewport(gl: WebGLRenderingContext): Viewport | undefined;
4
- export declare function setIsFramebufferTarget(gl: WebGLRenderingContext, isFbo: boolean): void;
5
- export declare function getIsFramebufferTarget(gl: WebGLRenderingContext): boolean | undefined;
6
4
  export {};