New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/text-bitmap

Package Overview
Dependencies
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/text-bitmap - npm Package Compare versions

Comparing version

to
6.5.2

6

dist/browser/text-bitmap.min.js
/*!
* @pixi/text-bitmap - v6.5.1
* Compiled Sun, 24 Jul 2022 20:56:21 UTC
* @pixi/text-bitmap - v6.5.2
* Compiled Wed, 24 Aug 2022 13:51:19 UTC
*

@@ -8,3 +8,3 @@ * @pixi/text-bitmap is licensed under the MIT License.

*/
this.PIXI=this.PIXI||{};var _pixi_text_bitmap=function(e,t,r,n,i,a,o,s,h,l){"use strict";var u=function(e,t){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},u(e,t)};var f=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]},c=function(){function e(){}return e.test=function(e){return"string"==typeof e&&0===e.indexOf("info face=")},e.parse=function(e){var t=e.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(var n in t){var i=t[n].match(/^[a-z]+/gm)[0],a=t[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),o={};for(var s in a){var h=a[s].split("="),l=h[0],u=h[1].replace(/"/gm,""),c=parseFloat(u),d=isNaN(c)?u:c;o[l]=d}r[i].push(o)}var p=new f;return r.info.forEach((function(e){return p.info.push({face:e.face,size:parseInt(e.size,10)})})),r.common.forEach((function(e){return p.common.push({lineHeight:parseInt(e.lineHeight,10)})})),r.page.forEach((function(e){return p.page.push({id:parseInt(e.id,10),file:e.file})})),r.char.forEach((function(e){return p.char.push({id:parseInt(e.id,10),page:parseInt(e.page,10),x:parseInt(e.x,10),y:parseInt(e.y,10),width:parseInt(e.width,10),height:parseInt(e.height,10),xoffset:parseInt(e.xoffset,10),yoffset:parseInt(e.yoffset,10),xadvance:parseInt(e.xadvance,10)})})),r.kerning.forEach((function(e){return p.kerning.push({first:parseInt(e.first,10),second:parseInt(e.second,10),amount:parseInt(e.amount,10)})})),r.distanceField.forEach((function(e){return p.distanceField.push({distanceRange:parseInt(e.distanceRange,10),fieldType:e.fieldType})})),p},e}(),d=function(){function e(){}return e.test=function(e){return e instanceof XMLDocument&&e.getElementsByTagName("page").length&&null!==e.getElementsByTagName("info")[0].getAttribute("face")},e.parse=function(e){for(var t=new f,r=e.getElementsByTagName("info"),n=e.getElementsByTagName("common"),i=e.getElementsByTagName("page"),a=e.getElementsByTagName("char"),o=e.getElementsByTagName("kerning"),s=e.getElementsByTagName("distanceField"),h=0;h<r.length;h++)t.info.push({face:r[h].getAttribute("face"),size:parseInt(r[h].getAttribute("size"),10)});for(h=0;h<n.length;h++)t.common.push({lineHeight:parseInt(n[h].getAttribute("lineHeight"),10)});for(h=0;h<i.length;h++)t.page.push({id:parseInt(i[h].getAttribute("id"),10)||0,file:i[h].getAttribute("file")});for(h=0;h<a.length;h++){var l=a[h];t.char.push({id:parseInt(l.getAttribute("id"),10),page:parseInt(l.getAttribute("page"),10)||0,x:parseInt(l.getAttribute("x"),10),y:parseInt(l.getAttribute("y"),10),width:parseInt(l.getAttribute("width"),10),height:parseInt(l.getAttribute("height"),10),xoffset:parseInt(l.getAttribute("xoffset"),10),yoffset:parseInt(l.getAttribute("yoffset"),10),xadvance:parseInt(l.getAttribute("xadvance"),10)})}for(h=0;h<o.length;h++)t.kerning.push({first:parseInt(o[h].getAttribute("first"),10),second:parseInt(o[h].getAttribute("second"),10),amount:parseInt(o[h].getAttribute("amount"),10)});for(h=0;h<s.length;h++)t.distanceField.push({fieldType:s[h].getAttribute("fieldType"),distanceRange:parseInt(s[h].getAttribute("distanceRange"),10)});return t},e}(),p=function(){function e(){}return e.test=function(e){if("string"==typeof e&&e.indexOf("<font>")>-1){var t=(new globalThis.DOMParser).parseFromString(e,"text/xml");return d.test(t)}return!1},e.parse=function(e){var t=(new globalThis.DOMParser).parseFromString(e,"text/xml");return d.parse(t)},e}(),g=[c,d,p];function x(e){for(var t=0;t<g.length;t++)if(g[t].test(e))return g[t];return null}function v(e,t,r,n,a,s,h){var l=r.text,u=r.fontProperties;t.translate(n,a),t.scale(s,s);var f=h.strokeThickness/2,c=-h.strokeThickness/2;if(t.font=h.toFontString(),t.lineWidth=h.strokeThickness,t.textBaseline=h.textBaseline,t.lineJoin=h.lineJoin,t.miterLimit=h.miterLimit,t.fillStyle=function(e,t,r,n,i,a){var s,h=r.fill;if(!Array.isArray(h))return h;if(1===h.length)return h[0];var l=r.dropShadow?r.dropShadowDistance:0,u=r.padding||0,f=e.width/n-l-2*u,c=e.height/n-l-2*u,d=h.slice(),p=r.fillGradientStops.slice();if(!p.length)for(var g=d.length+1,x=1;x<g;++x)p.push(x/g);if(d.unshift(h[0]),p.unshift(0),d.push(h[h.length-1]),p.push(1),r.fillGradientType===o.TEXT_GRADIENT.LINEAR_VERTICAL){s=t.createLinearGradient(f/2,u,f/2,c+u);var v=0,m=(a.fontProperties.fontSize+r.strokeThickness)/c;for(x=0;x<i.length;x++)for(var y=a.lineHeight*x,_=0;_<d.length;_++){var b=y/c+("number"==typeof p[_]?p[_]:_/d.length)*m,T=Math.max(v,b);T=Math.min(T,1),s.addColorStop(T,d[_]),v=T}}else{s=t.createLinearGradient(u,c/2,f+u,c/2);var w=d.length+1,P=1;for(x=0;x<d.length;x++){var I=void 0;I="number"==typeof p[x]?p[x]:P/w,s.addColorStop(I,d[x]),P++}}return s}(e,t,h,s,[l],r),t.strokeStyle=h.stroke,h.dropShadow){var d=h.dropShadowColor,p=i.hex2rgb("number"==typeof d?d:i.string2hex(d)),g=h.dropShadowBlur*s,x=h.dropShadowDistance*s;t.shadowColor="rgba("+255*p[0]+","+255*p[1]+","+255*p[2]+","+h.dropShadowAlpha+")",t.shadowBlur=g,t.shadowOffsetX=Math.cos(h.dropShadowAngle)*x,t.shadowOffsetY=Math.sin(h.dropShadowAngle)*x}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;h.stroke&&h.strokeThickness&&t.strokeText(l,f,c+r.lineHeight-u.descent),h.fill&&t.fillText(l,f,c+r.lineHeight-u.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function m(e){return Array.from?Array.from(e):e.split("")}function y(e){return e.codePointAt?e.codePointAt(0):e.charCodeAt(0)}var _=function(){function e(e,r,n){var o,h,l=e.info[0],u=e.common[0],f=e.page[0],c=e.distanceField[0],d=i.getResolutionOfUrl(f.file),p={};this._ownsTextures=n,this.font=l.face,this.size=l.size,this.lineHeight=u.lineHeight/d,this.chars={},this.pageTextures=p;for(var g=0;g<e.page.length;g++){var x=e.page[g],v=x.id,m=x.file;p[v]=r instanceof Array?r[g]:r[m],(null==c?void 0:c.fieldType)&&"none"!==c.fieldType&&(p[v].baseTexture.alphaMode=s.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA)}for(g=0;g<e.char.length;g++){var y=e.char[g],_=(v=y.id,y.page),b=e.char[g],T=b.x,w=b.y,P=b.width,I=b.height,A=b.xoffset,M=b.yoffset,S=b.xadvance;T/=d,w/=d,P/=d,I/=d,A/=d,M/=d,S/=d;var C=new t.Rectangle(T+p[_].frame.x/d,w+p[_].frame.y/d,P,I);this.chars[v]={xOffset:A,yOffset:M,xAdvance:S,kerning:{},texture:new a.Texture(p[_].baseTexture,C),page:_}}for(g=0;g<e.kerning.length;g++){var E=e.kerning[g],O=E.first,F=E.second,D=E.amount;O/=d,F/=d,D/=d,this.chars[F]&&(this.chars[F].kerning[O]=D)}this.distanceFieldRange=null==c?void 0:c.distanceRange,this.distanceFieldType=null!==(h=null===(o=null==c?void 0:c.fieldType)||void 0===o?void 0:o.toLowerCase())&&void 0!==h?h:"none"}return e.prototype.destroy=function(){for(var e in this.chars)this.chars[e].texture.destroy(),this.chars[e].texture=null;for(var e in this.pageTextures)this._ownsTextures&&this.pageTextures[e].destroy(!0),this.pageTextures[e]=null;this.chars=null,this.pageTextures=null},e.install=function(t,r,n){var i;if(t instanceof f)i=t;else{var o=x(t);if(!o)throw new Error("Unrecognized data format for font.");i=o.parse(t)}r instanceof a.Texture&&(r=[r]);var s=new e(i,r,n);return e.available[s.font]=s,s},e.uninstall=function(t){var r=e.available[t];if(!r)throw new Error("No font found named '"+t+"'");r.destroy(),delete e.available[t]},e.from=function(t,n,i){if(!t)throw new Error("[BitmapFont] Property `name` is required.");var s=Object.assign({},e.defaultOptions,i),h=s.chars,l=s.padding,u=s.resolution,c=s.textureWidth,d=s.textureHeight,p=function(e){"string"==typeof e&&(e=[e]);for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];if(Array.isArray(i)){if(2!==i.length)throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got "+i.length+".");var a=i[0].charCodeAt(0),o=i[1].charCodeAt(0);if(o<a)throw new Error("[BitmapFont]: Invalid character range.");for(var s=a,h=o;s<=h;s++)t.push(String.fromCharCode(s))}else t.push.apply(t,m(i))}if(0===t.length)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}(h),g=n instanceof o.TextStyle?n:new o.TextStyle(n),x=c,_=new f;_.info[0]={face:g.fontFamily,size:g.fontSize},_.common[0]={lineHeight:g.fontSize};for(var b,T,w,P=0,I=0,A=0,M=[],S=[],C=0;C<p.length;C++){b||((b=r.settings.ADAPTER.createCanvas()).width=c,b.height=d,T=b.getContext("2d"),w=new a.BaseTexture(b,{resolution:u}),M.push(w),S.push(new a.Texture(w)),_.page.push({id:S.length-1,file:""}));var E=o.TextMetrics.measureText(p[C],g,!1,b),O=E.width,F=Math.ceil(E.height),D=Math.ceil(("italic"===g.fontStyle?2:1)*O);if(I>=d-F*u){if(0===I)throw new Error("[BitmapFont] textureHeight "+d+"px is too small for "+g.fontSize+"px fonts");--C,b=null,T=null,w=null,I=0,P=0,A=0}else if(A=Math.max(F+E.fontProperties.descent,A),D*u+P>=x)--C,I+=A*u,I=Math.ceil(I),P=0,A=0;else{v(b,T,E,P,I,u,g);var L=y(E.text);_.char.push({id:L,page:S.length-1,x:P/u,y:I/u,width:D,height:F,xoffset:0,yoffset:0,xadvance:Math.ceil(O-(g.dropShadow?g.dropShadowDistance:0)-(g.stroke?g.strokeThickness:0))}),P+=(D+2*l)*u,P=Math.ceil(P)}}C=0;for(var k=p.length;C<k;C++)for(var B=p[C],N=0;N<k;N++){var H=p[N],z=T.measureText(B).width,R=T.measureText(H).width,j=T.measureText(B+H).width-(z+R);j&&_.kerning.push({first:y(B),second:y(H),amount:j})}var X=new e(_,S,!0);return void 0!==e.available[t]&&e.uninstall(t),e.available[t]=X,X},e.ALPHA=[["a","z"],["A","Z"]," "],e.NUMERIC=[["0","9"]],e.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],e.ASCII=[[" ","~"]],e.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:e.ALPHANUMERIC},e.available={},e}(),b=[],T=[],w=[],P=function(e){function o(n,i){void 0===i&&(i={});var a=e.call(this)||this;a._tint=16777215;var s=Object.assign({},o.styleDefaults,i),h=s.align,l=s.tint,u=s.maxWidth,f=s.letterSpacing,c=s.fontName,d=s.fontSize;if(!_.available[c])throw new Error('Missing BitmapFont "'+c+'"');return a._activePagesMeshData=[],a._textWidth=0,a._textHeight=0,a._align=h,a._tint=l,a._fontName=c,a._fontSize=d||_.available[c].size,a.text=n,a._maxWidth=u,a._maxLineHeight=0,a._letterSpacing=f,a._anchor=new t.ObservablePoint((function(){a.dirty=!0}),a,0,0),a._roundPixels=r.settings.ROUND_PIXELS,a.dirty=!0,a._resolution=r.settings.RESOLUTION,a._autoResolution=!0,a._textureCache={},a}return function(e,t){function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(o,e),o.prototype.updateText=function(){for(var e,r=_.available[this._fontName],o=this._fontSize/r.size,h=new t.Point,l=[],u=[],f=[],c=m(this._text.replace(/(?:\r\n|\r)/g,"\n")||" "),d=this._maxWidth*r.size/this._fontSize,p="none"===r.distanceFieldType?b:T,g=null,x=0,v=0,P=0,I=-1,A=0,M=0,S=0,C=0,E=0;E<c.length;E++){var O=y(J=c[E]);if(/(?:\s)/.test(J)&&(I=E,A=x,C++),"\r"!==J&&"\n"!==J){var F=r.chars[O];if(F){g&&F.kerning[g]&&(h.x+=F.kerning[g]);var D=w.pop()||{texture:a.Texture.EMPTY,line:0,charCode:0,prevSpaces:0,position:new t.Point};D.texture=F.texture,D.line=P,D.charCode=O,D.position.x=h.x+F.xOffset+this._letterSpacing/2,D.position.y=h.y+F.yOffset,D.prevSpaces=C,l.push(D),x=D.position.x+Math.max(F.xAdvance,F.texture.orig.width),h.x+=F.xAdvance+this._letterSpacing,S=Math.max(S,F.yOffset+F.texture.height),g=O,-1!==I&&d>0&&h.x>d&&(++M,i.removeItems(l,1+I-M,1+E-I),E=I,I=-1,u.push(A),f.push(l.length>0?l[l.length-1].prevSpaces:0),v=Math.max(v,A),P++,h.x=0,h.y+=r.lineHeight,g=null,C=0)}}else u.push(x),f.push(-1),v=Math.max(v,x),++P,++M,h.x=0,h.y+=r.lineHeight,g=null,C=0}var L=c[c.length-1];"\r"!==L&&"\n"!==L&&(/(?:\s)/.test(L)&&(x=A),u.push(x),v=Math.max(v,x),f.push(-1));var k=[];for(E=0;E<=P;E++){var B=0;"right"===this._align?B=v-u[E]:"center"===this._align?B=(v-u[E])/2:"justify"===this._align&&(B=f[E]<0?0:(v-u[E])/f[E]),k.push(B)}var N=l.length,H={},z=[],R=this._activePagesMeshData;for(E=0;E<R.length;E++)p.push(R[E]);for(E=0;E<N;E++){var j=(Q=l[E].texture).baseTexture.uid;if(!H[j]){if(!(oe=p.pop())){var X=new n.MeshGeometry,W=void 0,U=void 0;"none"===r.distanceFieldType?(W=new n.MeshMaterial(a.Texture.EMPTY),U=s.BLEND_MODES.NORMAL):(W=new n.MeshMaterial(a.Texture.EMPTY,{program:a.Program.from("// Mesh material default fragment\r\nattribute vec2 aVertexPosition;\r\nattribute vec2 aTextureCoord;\r\n\r\nuniform mat3 projectionMatrix;\r\nuniform mat3 translationMatrix;\r\nuniform mat3 uTextureMatrix;\r\n\r\nvarying vec2 vTextureCoord;\r\n\r\nvoid main(void)\r\n{\r\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r\n\r\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r\n}\r\n","// Pixi texture info\r\nvarying vec2 vTextureCoord;\r\nuniform sampler2D uSampler;\r\n\r\n// Tint\r\nuniform vec4 uColor;\r\n\r\n// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r\nuniform float uFWidth;\r\n\r\nvoid main(void) {\r\n\r\n // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r\n vec4 texColor = texture2D(uSampler, vTextureCoord);\r\n\r\n // MSDF\r\n float median = texColor.r + texColor.g + texColor.b -\r\n min(texColor.r, min(texColor.g, texColor.b)) -\r\n max(texColor.r, max(texColor.g, texColor.b));\r\n // SDF\r\n median = min(median, texColor.a);\r\n\r\n float screenPxDistance = uFWidth * (median - 0.5);\r\n float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r\n\r\n // NPM Textures, NPM outputs\r\n gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r\n\r\n}\r\n"),uniforms:{uFWidth:0}}),U=s.BLEND_MODES.NORMAL_NPM);var G=new n.Mesh(X,W);G.blendMode=U,oe={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:G,vertices:null,uvs:null,indices:null}}oe.index=0,oe.indexCount=0,oe.vertexCount=0,oe.uvsCount=0,oe.total=0;var Y=this._textureCache;Y[j]=Y[j]||new a.Texture(Q.baseTexture),oe.mesh.texture=Y[j],oe.mesh.tint=this._tint,z.push(oe),H[j]=oe}H[j].total++}for(E=0;E<R.length;E++)-1===z.indexOf(R[E])&&this.removeChild(R[E].mesh);for(E=0;E<z.length;E++)z[E].mesh.parent!==this&&this.addChild(z[E].mesh);for(var E in this._activePagesMeshData=z,H){var V=(oe=H[E]).total;if(!((null===(e=oe.indices)||void 0===e?void 0:e.length)>6*V)||oe.vertices.length<2*n.Mesh.BATCHABLE_SIZE)oe.vertices=new Float32Array(8*V),oe.uvs=new Float32Array(8*V),oe.indices=new Uint16Array(6*V);else for(var Z=oe.total,q=oe.vertices,$=4*Z*2;$<q.length;$++)q[$]=0;oe.mesh.size=6*V}for(E=0;E<N;E++){var J,K=(J=l[E]).position.x+k[J.line]*("justify"===this._align?J.prevSpaces:1);this._roundPixels&&(K=Math.round(K));var Q,ee=K*o,te=J.position.y*o,re=H[(Q=J.texture).baseTexture.uid],ne=Q.frame,ie=Q._uvs,ae=re.index++;re.indices[6*ae+0]=0+4*ae,re.indices[6*ae+1]=1+4*ae,re.indices[6*ae+2]=2+4*ae,re.indices[6*ae+3]=0+4*ae,re.indices[6*ae+4]=2+4*ae,re.indices[6*ae+5]=3+4*ae,re.vertices[8*ae+0]=ee,re.vertices[8*ae+1]=te,re.vertices[8*ae+2]=ee+ne.width*o,re.vertices[8*ae+3]=te,re.vertices[8*ae+4]=ee+ne.width*o,re.vertices[8*ae+5]=te+ne.height*o,re.vertices[8*ae+6]=ee,re.vertices[8*ae+7]=te+ne.height*o,re.uvs[8*ae+0]=ie.x0,re.uvs[8*ae+1]=ie.y0,re.uvs[8*ae+2]=ie.x1,re.uvs[8*ae+3]=ie.y1,re.uvs[8*ae+4]=ie.x2,re.uvs[8*ae+5]=ie.y2,re.uvs[8*ae+6]=ie.x3,re.uvs[8*ae+7]=ie.y3}for(var E in this._textWidth=v*o,this._textHeight=(h.y+r.lineHeight)*o,H){var oe=H[E];if(0!==this.anchor.x||0!==this.anchor.y)for(var se=0,he=this._textWidth*this.anchor.x,le=this._textHeight*this.anchor.y,ue=0;ue<oe.total;ue++)oe.vertices[se++]-=he,oe.vertices[se++]-=le,oe.vertices[se++]-=he,oe.vertices[se++]-=le,oe.vertices[se++]-=he,oe.vertices[se++]-=le,oe.vertices[se++]-=he,oe.vertices[se++]-=le;this._maxLineHeight=S*o;var fe=oe.mesh.geometry.getBuffer("aVertexPosition"),ce=oe.mesh.geometry.getBuffer("aTextureCoord"),de=oe.mesh.geometry.getIndex();fe.data=oe.vertices,ce.data=oe.uvs,de.data=oe.indices,fe.update(),ce.update(),de.update()}for(E=0;E<l.length;E++)w.push(l[E])},o.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},o.prototype._render=function(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);var r=_.available[this._fontName],n=r.distanceFieldRange,i=r.distanceFieldType,a=r.size;if("none"!==i)for(var o=this.worldTransform,s=o.a,h=o.b,l=o.c,u=o.d,f=Math.sqrt(s*s+h*h),c=Math.sqrt(l*l+u*u),d=(Math.abs(f)+Math.abs(c))/2,p=this._fontSize/a,g=0,x=this._activePagesMeshData;g<x.length;g++){x[g].mesh.shader.uniforms.uFWidth=d*n*p*this._resolution}e.prototype._render.call(this,t)},o.prototype.getLocalBounds=function(){return this.validate(),e.prototype.getLocalBounds.call(this)},o.prototype.validate=function(){this.dirty&&(this.updateText(),this.dirty=!1)},Object.defineProperty(o.prototype,"tint",{get:function(){return this._tint},set:function(e){if(this._tint!==e){this._tint=e;for(var t=0;t<this._activePagesMeshData.length;t++)this._activePagesMeshData[t].mesh.tint=e}},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"align",{get:function(){return this._align},set:function(e){this._align!==e&&(this._align=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"fontName",{get:function(){return this._fontName},set:function(e){if(!_.available[e])throw new Error('Missing BitmapFont "'+e+'"');this._fontName!==e&&(this._fontName=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"fontSize",{get:function(){return this._fontSize},set:function(e){this._fontSize!==e&&(this._fontSize=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"anchor",{get:function(){return this._anchor},set:function(e){"number"==typeof e?this._anchor.set(e):this._anchor.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"text",{get:function(){return this._text},set:function(e){e=String(null==e?"":e),this._text!==e&&(this._text=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(e){this._maxWidth!==e&&(this._maxWidth=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"maxLineHeight",{get:function(){return this.validate(),this._maxLineHeight},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"textWidth",{get:function(){return this.validate(),this._textWidth},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(e){e!==this._roundPixels&&(this._roundPixels=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"textHeight",{get:function(){return this.validate(),this._textHeight},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"resolution",{get:function(){return this._resolution},set:function(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)},enumerable:!1,configurable:!0}),o.prototype.destroy=function(t){var r=this._textureCache;for(var n in r){r[n].destroy(),delete r[n]}this._textureCache=null,e.prototype.destroy.call(this,t)},o.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0},o}(h.Container),I=function(){function e(){}return e.add=function(){l.LoaderResource.setExtensionXhrType("fnt",l.LoaderResource.XHR_RESPONSE_TYPE.TEXT)},e.use=function(t,r){var n=x(t.data);if(n)for(var i=e.getBaseUrl(this,t),a=n.parse(t.data),o={},s=function(e){o[e.metadata.pageFile]=e.texture,Object.keys(o).length===a.page.length&&(t.bitmapFont=_.install(a,o,!0),r())},h=0;h<a.page.length;++h){var u=a.page[h].file,f=i+u,c=!1;for(var d in this.resources){var p=this.resources[d];if(p.url===f){p.metadata.pageFile=u,p.texture?s(p):p.onAfterMiddleware.add(s),c=!0;break}}if(!c){var g={crossOrigin:t.crossOrigin,loadType:l.LoaderResource.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:u},t.metadata.imageMetadata),parentResource:t};this.add(f,g,s)}}else r()},e.getBaseUrl=function(t,r){var n=r.isDataUrl?"":e.dirname(r.url);return r.isDataUrl&&("."===n&&(n=""),t.baseUrl&&n&&"/"===t.baseUrl.charAt(t.baseUrl.length-1)&&(n+="/")),(n=n.replace(t.baseUrl,""))&&"/"!==n.charAt(n.length-1)&&(n+="/"),n},e.dirname=function(e){var t=e.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return t===e?".":""===t?"/":t},e.extension=a.ExtensionType.Loader,e}();return e.BitmapFont=_,e.BitmapFontData=f,e.BitmapFontLoader=I,e.BitmapText=P,e.TextFormat=c,e.XMLFormat=d,e.XMLStringFormat=p,e.autoDetectFormat=x,Object.defineProperty(e,"__esModule",{value:!0}),e}({},PIXI,PIXI,PIXI,PIXI.utils,PIXI,PIXI,PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_text_bitmap);
this.PIXI=this.PIXI||{};var _pixi_text_bitmap=function(e,t,r,n,i,a,o,s,h,l){"use strict";var u=function(e,t){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},u(e,t)};var f=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]},c=function(){function e(){}return e.test=function(e){return"string"==typeof e&&0===e.indexOf("info face=")},e.parse=function(e){var t=e.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(var n in t){var i=t[n].match(/^[a-z]+/gm)[0],a=t[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),o={};for(var s in a){var h=a[s].split("="),l=h[0],u=h[1].replace(/"/gm,""),c=parseFloat(u),d=isNaN(c)?u:c;o[l]=d}r[i].push(o)}var p=new f;return r.info.forEach((function(e){return p.info.push({face:e.face,size:parseInt(e.size,10)})})),r.common.forEach((function(e){return p.common.push({lineHeight:parseInt(e.lineHeight,10)})})),r.page.forEach((function(e){return p.page.push({id:parseInt(e.id,10),file:e.file})})),r.char.forEach((function(e){return p.char.push({id:parseInt(e.id,10),page:parseInt(e.page,10),x:parseInt(e.x,10),y:parseInt(e.y,10),width:parseInt(e.width,10),height:parseInt(e.height,10),xoffset:parseInt(e.xoffset,10),yoffset:parseInt(e.yoffset,10),xadvance:parseInt(e.xadvance,10)})})),r.kerning.forEach((function(e){return p.kerning.push({first:parseInt(e.first,10),second:parseInt(e.second,10),amount:parseInt(e.amount,10)})})),r.distanceField.forEach((function(e){return p.distanceField.push({distanceRange:parseInt(e.distanceRange,10),fieldType:e.fieldType})})),p},e}(),d=function(){function e(){}return e.test=function(e){return e instanceof XMLDocument&&e.getElementsByTagName("page").length&&null!==e.getElementsByTagName("info")[0].getAttribute("face")},e.parse=function(e){for(var t=new f,r=e.getElementsByTagName("info"),n=e.getElementsByTagName("common"),i=e.getElementsByTagName("page"),a=e.getElementsByTagName("char"),o=e.getElementsByTagName("kerning"),s=e.getElementsByTagName("distanceField"),h=0;h<r.length;h++)t.info.push({face:r[h].getAttribute("face"),size:parseInt(r[h].getAttribute("size"),10)});for(h=0;h<n.length;h++)t.common.push({lineHeight:parseInt(n[h].getAttribute("lineHeight"),10)});for(h=0;h<i.length;h++)t.page.push({id:parseInt(i[h].getAttribute("id"),10)||0,file:i[h].getAttribute("file")});for(h=0;h<a.length;h++){var l=a[h];t.char.push({id:parseInt(l.getAttribute("id"),10),page:parseInt(l.getAttribute("page"),10)||0,x:parseInt(l.getAttribute("x"),10),y:parseInt(l.getAttribute("y"),10),width:parseInt(l.getAttribute("width"),10),height:parseInt(l.getAttribute("height"),10),xoffset:parseInt(l.getAttribute("xoffset"),10),yoffset:parseInt(l.getAttribute("yoffset"),10),xadvance:parseInt(l.getAttribute("xadvance"),10)})}for(h=0;h<o.length;h++)t.kerning.push({first:parseInt(o[h].getAttribute("first"),10),second:parseInt(o[h].getAttribute("second"),10),amount:parseInt(o[h].getAttribute("amount"),10)});for(h=0;h<s.length;h++)t.distanceField.push({fieldType:s[h].getAttribute("fieldType"),distanceRange:parseInt(s[h].getAttribute("distanceRange"),10)});return t},e}(),p=function(){function e(){}return e.test=function(e){if("string"==typeof e&&e.indexOf("<font>")>-1){var t=(new globalThis.DOMParser).parseFromString(e,"text/xml");return d.test(t)}return!1},e.parse=function(e){var t=(new globalThis.DOMParser).parseFromString(e,"text/xml");return d.parse(t)},e}(),g=[c,d,p];function x(e){for(var t=0;t<g.length;t++)if(g[t].test(e))return g[t];return null}function v(e,t,r,n,a,s,h){var l=r.text,u=r.fontProperties;t.translate(n,a),t.scale(s,s);var f=h.strokeThickness/2,c=-h.strokeThickness/2;if(t.font=h.toFontString(),t.lineWidth=h.strokeThickness,t.textBaseline=h.textBaseline,t.lineJoin=h.lineJoin,t.miterLimit=h.miterLimit,t.fillStyle=function(e,t,r,n,i,a){var s,h=r.fill;if(!Array.isArray(h))return h;if(1===h.length)return h[0];var l=r.dropShadow?r.dropShadowDistance:0,u=r.padding||0,f=e.width/n-l-2*u,c=e.height/n-l-2*u,d=h.slice(),p=r.fillGradientStops.slice();if(!p.length)for(var g=d.length+1,x=1;x<g;++x)p.push(x/g);if(d.unshift(h[0]),p.unshift(0),d.push(h[h.length-1]),p.push(1),r.fillGradientType===o.TEXT_GRADIENT.LINEAR_VERTICAL){s=t.createLinearGradient(f/2,u,f/2,c+u);var v=0,m=(a.fontProperties.fontSize+r.strokeThickness)/c;for(x=0;x<i.length;x++)for(var y=a.lineHeight*x,_=0;_<d.length;_++){var b=y/c+("number"==typeof p[_]?p[_]:_/d.length)*m,T=Math.max(v,b);T=Math.min(T,1),s.addColorStop(T,d[_]),v=T}}else{s=t.createLinearGradient(u,c/2,f+u,c/2);var w=d.length+1,P=1;for(x=0;x<d.length;x++){var I=void 0;I="number"==typeof p[x]?p[x]:P/w,s.addColorStop(I,d[x]),P++}}return s}(e,t,h,s,[l],r),t.strokeStyle=h.stroke,h.dropShadow){var d=h.dropShadowColor,p=i.hex2rgb("number"==typeof d?d:i.string2hex(d)),g=h.dropShadowBlur*s,x=h.dropShadowDistance*s;t.shadowColor="rgba("+255*p[0]+","+255*p[1]+","+255*p[2]+","+h.dropShadowAlpha+")",t.shadowBlur=g,t.shadowOffsetX=Math.cos(h.dropShadowAngle)*x,t.shadowOffsetY=Math.sin(h.dropShadowAngle)*x}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;h.stroke&&h.strokeThickness&&t.strokeText(l,f,c+r.lineHeight-u.descent),h.fill&&t.fillText(l,f,c+r.lineHeight-u.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function m(e){return Array.from?Array.from(e):e.split("")}function y(e){return e.codePointAt?e.codePointAt(0):e.charCodeAt(0)}var _=function(){function e(e,r,n){var o,h,l=e.info[0],u=e.common[0],f=e.page[0],c=e.distanceField[0],d=i.getResolutionOfUrl(f.file),p={};this._ownsTextures=n,this.font=l.face,this.size=l.size,this.lineHeight=u.lineHeight/d,this.chars={},this.pageTextures=p;for(var g=0;g<e.page.length;g++){var x=e.page[g],v=x.id,m=x.file;p[v]=r instanceof Array?r[g]:r[m],(null==c?void 0:c.fieldType)&&"none"!==c.fieldType&&(p[v].baseTexture.alphaMode=s.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA)}for(g=0;g<e.char.length;g++){var y=e.char[g],_=(v=y.id,y.page),b=e.char[g],T=b.x,w=b.y,P=b.width,I=b.height,A=b.xoffset,M=b.yoffset,S=b.xadvance;T/=d,w/=d,P/=d,I/=d,A/=d,M/=d,S/=d;var C=new t.Rectangle(T+p[_].frame.x/d,w+p[_].frame.y/d,P,I);this.chars[v]={xOffset:A,yOffset:M,xAdvance:S,kerning:{},texture:new a.Texture(p[_].baseTexture,C),page:_}}for(g=0;g<e.kerning.length;g++){var O=e.kerning[g],E=O.first,F=O.second,D=O.amount;E/=d,F/=d,D/=d,this.chars[F]&&(this.chars[F].kerning[E]=D)}this.distanceFieldRange=null==c?void 0:c.distanceRange,this.distanceFieldType=null!==(h=null===(o=null==c?void 0:c.fieldType)||void 0===o?void 0:o.toLowerCase())&&void 0!==h?h:"none"}return e.prototype.destroy=function(){for(var e in this.chars)this.chars[e].texture.destroy(),this.chars[e].texture=null;for(var e in this.pageTextures)this._ownsTextures&&this.pageTextures[e].destroy(!0),this.pageTextures[e]=null;this.chars=null,this.pageTextures=null},e.install=function(t,r,n){var i;if(t instanceof f)i=t;else{var o=x(t);if(!o)throw new Error("Unrecognized data format for font.");i=o.parse(t)}r instanceof a.Texture&&(r=[r]);var s=new e(i,r,n);return e.available[s.font]=s,s},e.uninstall=function(t){var r=e.available[t];if(!r)throw new Error("No font found named '"+t+"'");r.destroy(),delete e.available[t]},e.from=function(t,n,i){if(!t)throw new Error("[BitmapFont] Property `name` is required.");var s=Object.assign({},e.defaultOptions,i),h=s.chars,l=s.padding,u=s.resolution,c=s.textureWidth,d=s.textureHeight,p=function(e){"string"==typeof e&&(e=[e]);for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];if(Array.isArray(i)){if(2!==i.length)throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got "+i.length+".");var a=i[0].charCodeAt(0),o=i[1].charCodeAt(0);if(o<a)throw new Error("[BitmapFont]: Invalid character range.");for(var s=a,h=o;s<=h;s++)t.push(String.fromCharCode(s))}else t.push.apply(t,m(i))}if(0===t.length)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}(h),g=n instanceof o.TextStyle?n:new o.TextStyle(n),x=c,_=new f;_.info[0]={face:g.fontFamily,size:g.fontSize},_.common[0]={lineHeight:g.fontSize};for(var b,T,w,P=0,I=0,A=0,M=[],S=[],C=0;C<p.length;C++){b||((b=r.settings.ADAPTER.createCanvas()).width=c,b.height=d,T=b.getContext("2d"),w=new a.BaseTexture(b,{resolution:u}),M.push(w),S.push(new a.Texture(w)),_.page.push({id:S.length-1,file:""}));var O=o.TextMetrics.measureText(p[C],g,!1,b),E=O.width,F=Math.ceil(O.height),D=Math.ceil(("italic"===g.fontStyle?2:1)*E);if(I>=d-F*u){if(0===I)throw new Error("[BitmapFont] textureHeight "+d+"px is too small for "+g.fontSize+"px fonts");--C,b=null,T=null,w=null,I=0,P=0,A=0}else if(A=Math.max(F+O.fontProperties.descent,A),D*u+P>=x)--C,I+=A*u,I=Math.ceil(I),P=0,A=0;else{v(b,T,O,P,I,u,g);var L=y(O.text);_.char.push({id:L,page:S.length-1,x:P/u,y:I/u,width:D,height:F,xoffset:0,yoffset:0,xadvance:Math.ceil(E-(g.dropShadow?g.dropShadowDistance:0)-(g.stroke?g.strokeThickness:0))}),P+=(D+2*l)*u,P=Math.ceil(P)}}C=0;for(var k=p.length;C<k;C++)for(var B=p[C],N=0;N<k;N++){var H=p[N],z=T.measureText(B).width,R=T.measureText(H).width,j=T.measureText(B+H).width-(z+R);j&&_.kerning.push({first:y(B),second:y(H),amount:j})}var X=new e(_,S,!0);return void 0!==e.available[t]&&e.uninstall(t),e.available[t]=X,X},e.ALPHA=[["a","z"],["A","Z"]," "],e.NUMERIC=[["0","9"]],e.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],e.ASCII=[[" ","~"]],e.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:e.ALPHANUMERIC},e.available={},e}(),b=[],T=[],w=[],P=function(e){function o(n,i){void 0===i&&(i={});var a=e.call(this)||this;a._tint=16777215;var s=Object.assign({},o.styleDefaults,i),h=s.align,l=s.tint,u=s.maxWidth,f=s.letterSpacing,c=s.fontName,d=s.fontSize;if(!_.available[c])throw new Error('Missing BitmapFont "'+c+'"');return a._activePagesMeshData=[],a._textWidth=0,a._textHeight=0,a._align=h,a._tint=l,a._fontName=c,a._fontSize=d||_.available[c].size,a.text=n,a._maxWidth=u,a._maxLineHeight=0,a._letterSpacing=f,a._anchor=new t.ObservablePoint((function(){a.dirty=!0}),a,0,0),a._roundPixels=r.settings.ROUND_PIXELS,a.dirty=!0,a._resolution=r.settings.RESOLUTION,a._autoResolution=!0,a._textureCache={},a}return function(e,t){function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(o,e),o.prototype.updateText=function(){for(var e,r=_.available[this._fontName],o=this._fontSize/r.size,h=new t.Point,l=[],u=[],f=[],c=m(this._text.replace(/(?:\r\n|\r)/g,"\n")||" "),d=this._maxWidth*r.size/this._fontSize,p="none"===r.distanceFieldType?b:T,g=null,x=0,v=0,P=0,I=-1,A=0,M=0,S=0,C=0,O=0;O<c.length;O++){var E=y(J=c[O]);if(/(?:\s)/.test(J)&&(I=O,A=x,C++),"\r"!==J&&"\n"!==J){var F=r.chars[E];if(F){g&&F.kerning[g]&&(h.x+=F.kerning[g]);var D=w.pop()||{texture:a.Texture.EMPTY,line:0,charCode:0,prevSpaces:0,position:new t.Point};D.texture=F.texture,D.line=P,D.charCode=E,D.position.x=h.x+F.xOffset+this._letterSpacing/2,D.position.y=h.y+F.yOffset,D.prevSpaces=C,l.push(D),x=D.position.x+Math.max(F.xAdvance-F.xOffset,F.texture.orig.width),h.x+=F.xAdvance+this._letterSpacing,S=Math.max(S,F.yOffset+F.texture.height),g=E,-1!==I&&d>0&&h.x>d&&(++M,i.removeItems(l,1+I-M,1+O-I),O=I,I=-1,u.push(A),f.push(l.length>0?l[l.length-1].prevSpaces:0),v=Math.max(v,A),P++,h.x=0,h.y+=r.lineHeight,g=null,C=0)}}else u.push(x),f.push(-1),v=Math.max(v,x),++P,++M,h.x=0,h.y+=r.lineHeight,g=null,C=0}var L=c[c.length-1];"\r"!==L&&"\n"!==L&&(/(?:\s)/.test(L)&&(x=A),u.push(x),v=Math.max(v,x),f.push(-1));var k=[];for(O=0;O<=P;O++){var B=0;"right"===this._align?B=v-u[O]:"center"===this._align?B=(v-u[O])/2:"justify"===this._align&&(B=f[O]<0?0:(v-u[O])/f[O]),k.push(B)}var N=l.length,H={},z=[],R=this._activePagesMeshData;for(O=0;O<R.length;O++)p.push(R[O]);for(O=0;O<N;O++){var j=(Q=l[O].texture).baseTexture.uid;if(!H[j]){if(!(oe=p.pop())){var X=new n.MeshGeometry,W=void 0,U=void 0;"none"===r.distanceFieldType?(W=new n.MeshMaterial(a.Texture.EMPTY),U=s.BLEND_MODES.NORMAL):(W=new n.MeshMaterial(a.Texture.EMPTY,{program:a.Program.from("// Mesh material default fragment\r\nattribute vec2 aVertexPosition;\r\nattribute vec2 aTextureCoord;\r\n\r\nuniform mat3 projectionMatrix;\r\nuniform mat3 translationMatrix;\r\nuniform mat3 uTextureMatrix;\r\n\r\nvarying vec2 vTextureCoord;\r\n\r\nvoid main(void)\r\n{\r\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r\n\r\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r\n}\r\n","// Pixi texture info\r\nvarying vec2 vTextureCoord;\r\nuniform sampler2D uSampler;\r\n\r\n// Tint\r\nuniform vec4 uColor;\r\n\r\n// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r\nuniform float uFWidth;\r\n\r\nvoid main(void) {\r\n\r\n // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r\n vec4 texColor = texture2D(uSampler, vTextureCoord);\r\n\r\n // MSDF\r\n float median = texColor.r + texColor.g + texColor.b -\r\n min(texColor.r, min(texColor.g, texColor.b)) -\r\n max(texColor.r, max(texColor.g, texColor.b));\r\n // SDF\r\n median = min(median, texColor.a);\r\n\r\n float screenPxDistance = uFWidth * (median - 0.5);\r\n float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r\n\r\n // NPM Textures, NPM outputs\r\n gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r\n\r\n}\r\n"),uniforms:{uFWidth:0}}),U=s.BLEND_MODES.NORMAL_NPM);var G=new n.Mesh(X,W);G.blendMode=U,oe={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:G,vertices:null,uvs:null,indices:null}}oe.index=0,oe.indexCount=0,oe.vertexCount=0,oe.uvsCount=0,oe.total=0;var Y=this._textureCache;Y[j]=Y[j]||new a.Texture(Q.baseTexture),oe.mesh.texture=Y[j],oe.mesh.tint=this._tint,z.push(oe),H[j]=oe}H[j].total++}for(O=0;O<R.length;O++)-1===z.indexOf(R[O])&&this.removeChild(R[O].mesh);for(O=0;O<z.length;O++)z[O].mesh.parent!==this&&this.addChild(z[O].mesh);for(var O in this._activePagesMeshData=z,H){var V=(oe=H[O]).total;if(!((null===(e=oe.indices)||void 0===e?void 0:e.length)>6*V)||oe.vertices.length<2*n.Mesh.BATCHABLE_SIZE)oe.vertices=new Float32Array(8*V),oe.uvs=new Float32Array(8*V),oe.indices=new Uint16Array(6*V);else for(var Z=oe.total,q=oe.vertices,$=4*Z*2;$<q.length;$++)q[$]=0;oe.mesh.size=6*V}for(O=0;O<N;O++){var J,K=(J=l[O]).position.x+k[J.line]*("justify"===this._align?J.prevSpaces:1);this._roundPixels&&(K=Math.round(K));var Q,ee=K*o,te=J.position.y*o,re=H[(Q=J.texture).baseTexture.uid],ne=Q.frame,ie=Q._uvs,ae=re.index++;re.indices[6*ae+0]=0+4*ae,re.indices[6*ae+1]=1+4*ae,re.indices[6*ae+2]=2+4*ae,re.indices[6*ae+3]=0+4*ae,re.indices[6*ae+4]=2+4*ae,re.indices[6*ae+5]=3+4*ae,re.vertices[8*ae+0]=ee,re.vertices[8*ae+1]=te,re.vertices[8*ae+2]=ee+ne.width*o,re.vertices[8*ae+3]=te,re.vertices[8*ae+4]=ee+ne.width*o,re.vertices[8*ae+5]=te+ne.height*o,re.vertices[8*ae+6]=ee,re.vertices[8*ae+7]=te+ne.height*o,re.uvs[8*ae+0]=ie.x0,re.uvs[8*ae+1]=ie.y0,re.uvs[8*ae+2]=ie.x1,re.uvs[8*ae+3]=ie.y1,re.uvs[8*ae+4]=ie.x2,re.uvs[8*ae+5]=ie.y2,re.uvs[8*ae+6]=ie.x3,re.uvs[8*ae+7]=ie.y3}for(var O in this._textWidth=v*o,this._textHeight=(h.y+r.lineHeight)*o,H){var oe=H[O];if(0!==this.anchor.x||0!==this.anchor.y)for(var se=0,he=this._textWidth*this.anchor.x,le=this._textHeight*this.anchor.y,ue=0;ue<oe.total;ue++)oe.vertices[se++]-=he,oe.vertices[se++]-=le,oe.vertices[se++]-=he,oe.vertices[se++]-=le,oe.vertices[se++]-=he,oe.vertices[se++]-=le,oe.vertices[se++]-=he,oe.vertices[se++]-=le;this._maxLineHeight=S*o;var fe=oe.mesh.geometry.getBuffer("aVertexPosition"),ce=oe.mesh.geometry.getBuffer("aTextureCoord"),de=oe.mesh.geometry.getIndex();fe.data=oe.vertices,ce.data=oe.uvs,de.data=oe.indices,fe.update(),ce.update(),de.update()}for(O=0;O<l.length;O++)w.push(l[O])},o.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},o.prototype._render=function(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);var r=_.available[this._fontName],n=r.distanceFieldRange,i=r.distanceFieldType,a=r.size;if("none"!==i)for(var o=this.worldTransform,s=o.a,h=o.b,l=o.c,u=o.d,f=Math.sqrt(s*s+h*h),c=Math.sqrt(l*l+u*u),d=(Math.abs(f)+Math.abs(c))/2,p=this._fontSize/a,g=0,x=this._activePagesMeshData;g<x.length;g++){x[g].mesh.shader.uniforms.uFWidth=d*n*p*this._resolution}e.prototype._render.call(this,t)},o.prototype.getLocalBounds=function(){return this.validate(),e.prototype.getLocalBounds.call(this)},o.prototype.validate=function(){this.dirty&&(this.updateText(),this.dirty=!1)},Object.defineProperty(o.prototype,"tint",{get:function(){return this._tint},set:function(e){if(this._tint!==e){this._tint=e;for(var t=0;t<this._activePagesMeshData.length;t++)this._activePagesMeshData[t].mesh.tint=e}},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"align",{get:function(){return this._align},set:function(e){this._align!==e&&(this._align=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"fontName",{get:function(){return this._fontName},set:function(e){if(!_.available[e])throw new Error('Missing BitmapFont "'+e+'"');this._fontName!==e&&(this._fontName=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"fontSize",{get:function(){return this._fontSize},set:function(e){this._fontSize!==e&&(this._fontSize=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"anchor",{get:function(){return this._anchor},set:function(e){"number"==typeof e?this._anchor.set(e):this._anchor.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"text",{get:function(){return this._text},set:function(e){e=String(null==e?"":e),this._text!==e&&(this._text=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(e){this._maxWidth!==e&&(this._maxWidth=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"maxLineHeight",{get:function(){return this.validate(),this._maxLineHeight},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"textWidth",{get:function(){return this.validate(),this._textWidth},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(e){e!==this._roundPixels&&(this._roundPixels=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"textHeight",{get:function(){return this.validate(),this._textHeight},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"resolution",{get:function(){return this._resolution},set:function(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)},enumerable:!1,configurable:!0}),o.prototype.destroy=function(t){var r=this._textureCache;for(var n in r){r[n].destroy(),delete r[n]}this._textureCache=null,e.prototype.destroy.call(this,t)},o.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0},o}(h.Container),I=function(){function e(){}return e.add=function(){l.LoaderResource.setExtensionXhrType("fnt",l.LoaderResource.XHR_RESPONSE_TYPE.TEXT)},e.use=function(t,r){var n=x(t.data);if(n)for(var i=e.getBaseUrl(this,t),a=n.parse(t.data),o={},s=function(e){o[e.metadata.pageFile]=e.texture,Object.keys(o).length===a.page.length&&(t.bitmapFont=_.install(a,o,!0),r())},h=0;h<a.page.length;++h){var u=a.page[h].file,f=i+u,c=!1;for(var d in this.resources){var p=this.resources[d];if(p.url===f){p.metadata.pageFile=u,p.texture?s(p):p.onAfterMiddleware.add(s),c=!0;break}}if(!c){var g={crossOrigin:t.crossOrigin,loadType:l.LoaderResource.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:u},t.metadata.imageMetadata),parentResource:t};this.add(f,g,s)}}else r()},e.getBaseUrl=function(t,r){var n=r.isDataUrl?"":e.dirname(r.url);return r.isDataUrl&&("."===n&&(n=""),t.baseUrl&&n&&"/"===t.baseUrl.charAt(t.baseUrl.length-1)&&(n+="/")),(n=n.replace(t.baseUrl,""))&&"/"!==n.charAt(n.length-1)&&(n+="/"),n},e.dirname=function(e){var t=e.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return t===e?".":""===t?"/":t},e.extension=a.ExtensionType.Loader,e}();return e.BitmapFont=_,e.BitmapFontData=f,e.BitmapFontLoader=I,e.BitmapText=P,e.TextFormat=c,e.XMLFormat=d,e.XMLStringFormat=p,e.autoDetectFormat=x,Object.defineProperty(e,"__esModule",{value:!0}),e}({},PIXI,PIXI,PIXI,PIXI.utils,PIXI,PIXI,PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_text_bitmap);
//# sourceMappingURL=text-bitmap.min.js.map
/*!
* @pixi/text-bitmap - v6.5.1
* Compiled Sun, 24 Jul 2022 20:56:21 UTC
* @pixi/text-bitmap - v6.5.2
* Compiled Wed, 24 Aug 2022 13:51:19 UTC
*

@@ -8,3 +8,3 @@ * @pixi/text-bitmap is licensed under the MIT License.

*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pixi/math"),t=require("@pixi/settings"),r=require("@pixi/mesh"),i=require("@pixi/utils"),n=require("@pixi/core"),a=require("@pixi/text"),o=require("@pixi/constants"),s=require("@pixi/display"),h=require("@pixi/loaders"),l=function(e,t){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},l(e,t)};var u=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]},f=function(){function e(){}return e.test=function(e){return"string"==typeof e&&0===e.indexOf("info face=")},e.parse=function(e){var t=e.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(var i in t){var n=t[i].match(/^[a-z]+/gm)[0],a=t[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),o={};for(var s in a){var h=a[s].split("="),l=h[0],f=h[1].replace(/"/gm,""),c=parseFloat(f),d=isNaN(c)?f:c;o[l]=d}r[n].push(o)}var p=new u;return r.info.forEach((function(e){return p.info.push({face:e.face,size:parseInt(e.size,10)})})),r.common.forEach((function(e){return p.common.push({lineHeight:parseInt(e.lineHeight,10)})})),r.page.forEach((function(e){return p.page.push({id:parseInt(e.id,10),file:e.file})})),r.char.forEach((function(e){return p.char.push({id:parseInt(e.id,10),page:parseInt(e.page,10),x:parseInt(e.x,10),y:parseInt(e.y,10),width:parseInt(e.width,10),height:parseInt(e.height,10),xoffset:parseInt(e.xoffset,10),yoffset:parseInt(e.yoffset,10),xadvance:parseInt(e.xadvance,10)})})),r.kerning.forEach((function(e){return p.kerning.push({first:parseInt(e.first,10),second:parseInt(e.second,10),amount:parseInt(e.amount,10)})})),r.distanceField.forEach((function(e){return p.distanceField.push({distanceRange:parseInt(e.distanceRange,10),fieldType:e.fieldType})})),p},e}(),c=function(){function e(){}return e.test=function(e){return e instanceof XMLDocument&&e.getElementsByTagName("page").length&&null!==e.getElementsByTagName("info")[0].getAttribute("face")},e.parse=function(e){for(var t=new u,r=e.getElementsByTagName("info"),i=e.getElementsByTagName("common"),n=e.getElementsByTagName("page"),a=e.getElementsByTagName("char"),o=e.getElementsByTagName("kerning"),s=e.getElementsByTagName("distanceField"),h=0;h<r.length;h++)t.info.push({face:r[h].getAttribute("face"),size:parseInt(r[h].getAttribute("size"),10)});for(h=0;h<i.length;h++)t.common.push({lineHeight:parseInt(i[h].getAttribute("lineHeight"),10)});for(h=0;h<n.length;h++)t.page.push({id:parseInt(n[h].getAttribute("id"),10)||0,file:n[h].getAttribute("file")});for(h=0;h<a.length;h++){var l=a[h];t.char.push({id:parseInt(l.getAttribute("id"),10),page:parseInt(l.getAttribute("page"),10)||0,x:parseInt(l.getAttribute("x"),10),y:parseInt(l.getAttribute("y"),10),width:parseInt(l.getAttribute("width"),10),height:parseInt(l.getAttribute("height"),10),xoffset:parseInt(l.getAttribute("xoffset"),10),yoffset:parseInt(l.getAttribute("yoffset"),10),xadvance:parseInt(l.getAttribute("xadvance"),10)})}for(h=0;h<o.length;h++)t.kerning.push({first:parseInt(o[h].getAttribute("first"),10),second:parseInt(o[h].getAttribute("second"),10),amount:parseInt(o[h].getAttribute("amount"),10)});for(h=0;h<s.length;h++)t.distanceField.push({fieldType:s[h].getAttribute("fieldType"),distanceRange:parseInt(s[h].getAttribute("distanceRange"),10)});return t},e}(),d=function(){function e(){}return e.test=function(e){if("string"==typeof e&&e.indexOf("<font>")>-1){var t=(new globalThis.DOMParser).parseFromString(e,"text/xml");return c.test(t)}return!1},e.parse=function(e){var t=(new globalThis.DOMParser).parseFromString(e,"text/xml");return c.parse(t)},e}(),p=[f,c,d];function g(e){for(var t=0;t<p.length;t++)if(p[t].test(e))return p[t];return null}function x(e,t,r,n,o,s,h){var l=r.text,u=r.fontProperties;t.translate(n,o),t.scale(s,s);var f=h.strokeThickness/2,c=-h.strokeThickness/2;if(t.font=h.toFontString(),t.lineWidth=h.strokeThickness,t.textBaseline=h.textBaseline,t.lineJoin=h.lineJoin,t.miterLimit=h.miterLimit,t.fillStyle=function(e,t,r,i,n,o){var s,h=r.fill;if(!Array.isArray(h))return h;if(1===h.length)return h[0];var l=r.dropShadow?r.dropShadowDistance:0,u=r.padding||0,f=e.width/i-l-2*u,c=e.height/i-l-2*u,d=h.slice(),p=r.fillGradientStops.slice();if(!p.length)for(var g=d.length+1,x=1;x<g;++x)p.push(x/g);if(d.unshift(h[0]),p.unshift(0),d.push(h[h.length-1]),p.push(1),r.fillGradientType===a.TEXT_GRADIENT.LINEAR_VERTICAL){s=t.createLinearGradient(f/2,u,f/2,c+u);var v=0,m=(o.fontProperties.fontSize+r.strokeThickness)/c;for(x=0;x<n.length;x++)for(var y=o.lineHeight*x,_=0;_<d.length;_++){var b=y/c+("number"==typeof p[_]?p[_]:_/d.length)*m,T=Math.max(v,b);T=Math.min(T,1),s.addColorStop(T,d[_]),v=T}}else{s=t.createLinearGradient(u,c/2,f+u,c/2);var w=d.length+1,A=1;for(x=0;x<d.length;x++){var M=void 0;M="number"==typeof p[x]?p[x]:A/w,s.addColorStop(M,d[x]),A++}}return s}(e,t,h,s,[l],r),t.strokeStyle=h.stroke,h.dropShadow){var d=h.dropShadowColor,p=i.hex2rgb("number"==typeof d?d:i.string2hex(d)),g=h.dropShadowBlur*s,x=h.dropShadowDistance*s;t.shadowColor="rgba("+255*p[0]+","+255*p[1]+","+255*p[2]+","+h.dropShadowAlpha+")",t.shadowBlur=g,t.shadowOffsetX=Math.cos(h.dropShadowAngle)*x,t.shadowOffsetY=Math.sin(h.dropShadowAngle)*x}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;h.stroke&&h.strokeThickness&&t.strokeText(l,f,c+r.lineHeight-u.descent),h.fill&&t.fillText(l,f,c+r.lineHeight-u.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function v(e){return Array.from?Array.from(e):e.split("")}function m(e){return e.codePointAt?e.codePointAt(0):e.charCodeAt(0)}var y=function(){function r(t,r,a){var s,h,l=t.info[0],u=t.common[0],f=t.page[0],c=t.distanceField[0],d=i.getResolutionOfUrl(f.file),p={};this._ownsTextures=a,this.font=l.face,this.size=l.size,this.lineHeight=u.lineHeight/d,this.chars={},this.pageTextures=p;for(var g=0;g<t.page.length;g++){var x=t.page[g],v=x.id,m=x.file;p[v]=r instanceof Array?r[g]:r[m],(null==c?void 0:c.fieldType)&&"none"!==c.fieldType&&(p[v].baseTexture.alphaMode=o.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA)}for(g=0;g<t.char.length;g++){var y=t.char[g],_=(v=y.id,y.page),b=t.char[g],T=b.x,w=b.y,A=b.width,M=b.height,S=b.xoffset,P=b.yoffset,C=b.xadvance;T/=d,w/=d,A/=d,M/=d,S/=d,P/=d,C/=d;var E=new e.Rectangle(T+p[_].frame.x/d,w+p[_].frame.y/d,A,M);this.chars[v]={xOffset:S,yOffset:P,xAdvance:C,kerning:{},texture:new n.Texture(p[_].baseTexture,E),page:_}}for(g=0;g<t.kerning.length;g++){var O=t.kerning[g],I=O.first,F=O.second,D=O.amount;I/=d,F/=d,D/=d,this.chars[F]&&(this.chars[F].kerning[I]=D)}this.distanceFieldRange=null==c?void 0:c.distanceRange,this.distanceFieldType=null!==(h=null===(s=null==c?void 0:c.fieldType)||void 0===s?void 0:s.toLowerCase())&&void 0!==h?h:"none"}return r.prototype.destroy=function(){for(var e in this.chars)this.chars[e].texture.destroy(),this.chars[e].texture=null;for(var e in this.pageTextures)this._ownsTextures&&this.pageTextures[e].destroy(!0),this.pageTextures[e]=null;this.chars=null,this.pageTextures=null},r.install=function(e,t,i){var a;if(e instanceof u)a=e;else{var o=g(e);if(!o)throw new Error("Unrecognized data format for font.");a=o.parse(e)}t instanceof n.Texture&&(t=[t]);var s=new r(a,t,i);return r.available[s.font]=s,s},r.uninstall=function(e){var t=r.available[e];if(!t)throw new Error("No font found named '"+e+"'");t.destroy(),delete r.available[e]},r.from=function(e,i,o){if(!e)throw new Error("[BitmapFont] Property `name` is required.");var s=Object.assign({},r.defaultOptions,o),h=s.chars,l=s.padding,f=s.resolution,c=s.textureWidth,d=s.textureHeight,p=function(e){"string"==typeof e&&(e=[e]);for(var t=[],r=0,i=e.length;r<i;r++){var n=e[r];if(Array.isArray(n)){if(2!==n.length)throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got "+n.length+".");var a=n[0].charCodeAt(0),o=n[1].charCodeAt(0);if(o<a)throw new Error("[BitmapFont]: Invalid character range.");for(var s=a,h=o;s<=h;s++)t.push(String.fromCharCode(s))}else t.push.apply(t,v(n))}if(0===t.length)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}(h),g=i instanceof a.TextStyle?i:new a.TextStyle(i),y=c,_=new u;_.info[0]={face:g.fontFamily,size:g.fontSize},_.common[0]={lineHeight:g.fontSize};for(var b,T,w,A=0,M=0,S=0,P=[],C=0;C<p.length;C++){b||((b=t.settings.ADAPTER.createCanvas()).width=c,b.height=d,T=b.getContext("2d"),w=new n.BaseTexture(b,{resolution:f}),P.push(new n.Texture(w)),_.page.push({id:P.length-1,file:""}));var E=a.TextMetrics.measureText(p[C],g,!1,b),O=E.width,I=Math.ceil(E.height),F=Math.ceil(("italic"===g.fontStyle?2:1)*O);if(M>=d-I*f){if(0===M)throw new Error("[BitmapFont] textureHeight "+d+"px is too small for "+g.fontSize+"px fonts");--C,b=null,T=null,w=null,M=0,A=0,S=0}else if(S=Math.max(I+E.fontProperties.descent,S),F*f+A>=y)--C,M+=S*f,M=Math.ceil(M),A=0,S=0;else{x(b,T,E,A,M,f,g);var D=m(E.text);_.char.push({id:D,page:P.length-1,x:A/f,y:M/f,width:F,height:I,xoffset:0,yoffset:0,xadvance:Math.ceil(O-(g.dropShadow?g.dropShadowDistance:0)-(g.stroke?g.strokeThickness:0))}),A+=(F+2*l)*f,A=Math.ceil(A)}}C=0;for(var L=p.length;C<L;C++)for(var k=p[C],B=0;B<L;B++){var N=p[B],H=T.measureText(k).width,z=T.measureText(N).width,R=T.measureText(k+N).width-(H+z);R&&_.kerning.push({first:m(k),second:m(N),amount:R})}var j=new r(_,P,!0);return void 0!==r.available[e]&&r.uninstall(e),r.available[e]=j,j},r.ALPHA=[["a","z"],["A","Z"]," "],r.NUMERIC=[["0","9"]],r.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],r.ASCII=[[" ","~"]],r.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:r.ALPHANUMERIC},r.available={},r}(),_=[],b=[],T=[],w=function(a){function s(r,i){void 0===i&&(i={});var n=a.call(this)||this;n._tint=16777215;var o=Object.assign({},s.styleDefaults,i),h=o.align,l=o.tint,u=o.maxWidth,f=o.letterSpacing,c=o.fontName,d=o.fontSize;if(!y.available[c])throw new Error('Missing BitmapFont "'+c+'"');return n._activePagesMeshData=[],n._textWidth=0,n._textHeight=0,n._align=h,n._tint=l,n._fontName=c,n._fontSize=d||y.available[c].size,n.text=r,n._maxWidth=u,n._maxLineHeight=0,n._letterSpacing=f,n._anchor=new e.ObservablePoint((function(){n.dirty=!0}),n,0,0),n._roundPixels=t.settings.ROUND_PIXELS,n.dirty=!0,n._resolution=t.settings.RESOLUTION,n._autoResolution=!0,n._textureCache={},n}return function(e,t){function r(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(s,a),s.prototype.updateText=function(){for(var t,a=y.available[this._fontName],s=this._fontSize/a.size,h=new e.Point,l=[],u=[],f=[],c=v(this._text.replace(/(?:\r\n|\r)/g,"\n")||" "),d=this._maxWidth*a.size/this._fontSize,p="none"===a.distanceFieldType?_:b,g=null,x=0,w=0,A=0,M=-1,S=0,P=0,C=0,E=0,O=0;O<c.length;O++){var I=m(J=c[O]);if(/(?:\s)/.test(J)&&(M=O,S=x,E++),"\r"!==J&&"\n"!==J){var F=a.chars[I];if(F){g&&F.kerning[g]&&(h.x+=F.kerning[g]);var D=T.pop()||{texture:n.Texture.EMPTY,line:0,charCode:0,prevSpaces:0,position:new e.Point};D.texture=F.texture,D.line=A,D.charCode=I,D.position.x=h.x+F.xOffset+this._letterSpacing/2,D.position.y=h.y+F.yOffset,D.prevSpaces=E,l.push(D),x=D.position.x+Math.max(F.xAdvance,F.texture.orig.width),h.x+=F.xAdvance+this._letterSpacing,C=Math.max(C,F.yOffset+F.texture.height),g=I,-1!==M&&d>0&&h.x>d&&(++P,i.removeItems(l,1+M-P,1+O-M),O=M,M=-1,u.push(S),f.push(l.length>0?l[l.length-1].prevSpaces:0),w=Math.max(w,S),A++,h.x=0,h.y+=a.lineHeight,g=null,E=0)}}else u.push(x),f.push(-1),w=Math.max(w,x),++A,++P,h.x=0,h.y+=a.lineHeight,g=null,E=0}var L=c[c.length-1];"\r"!==L&&"\n"!==L&&(/(?:\s)/.test(L)&&(x=S),u.push(x),w=Math.max(w,x),f.push(-1));var k=[];for(O=0;O<=A;O++){var B=0;"right"===this._align?B=w-u[O]:"center"===this._align?B=(w-u[O])/2:"justify"===this._align&&(B=f[O]<0?0:(w-u[O])/f[O]),k.push(B)}var N=l.length,H={},z=[],R=this._activePagesMeshData;for(O=0;O<R.length;O++)p.push(R[O]);for(O=0;O<N;O++){var j=(Q=l[O].texture).baseTexture.uid;if(!H[j]){if(!(oe=p.pop())){var W=new r.MeshGeometry,U=void 0,q=void 0;"none"===a.distanceFieldType?(U=new r.MeshMaterial(n.Texture.EMPTY),q=o.BLEND_MODES.NORMAL):(U=new r.MeshMaterial(n.Texture.EMPTY,{program:n.Program.from("// Mesh material default fragment\r\nattribute vec2 aVertexPosition;\r\nattribute vec2 aTextureCoord;\r\n\r\nuniform mat3 projectionMatrix;\r\nuniform mat3 translationMatrix;\r\nuniform mat3 uTextureMatrix;\r\n\r\nvarying vec2 vTextureCoord;\r\n\r\nvoid main(void)\r\n{\r\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r\n\r\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r\n}\r\n","// Pixi texture info\r\nvarying vec2 vTextureCoord;\r\nuniform sampler2D uSampler;\r\n\r\n// Tint\r\nuniform vec4 uColor;\r\n\r\n// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r\nuniform float uFWidth;\r\n\r\nvoid main(void) {\r\n\r\n // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r\n vec4 texColor = texture2D(uSampler, vTextureCoord);\r\n\r\n // MSDF\r\n float median = texColor.r + texColor.g + texColor.b -\r\n min(texColor.r, min(texColor.g, texColor.b)) -\r\n max(texColor.r, max(texColor.g, texColor.b));\r\n // SDF\r\n median = min(median, texColor.a);\r\n\r\n float screenPxDistance = uFWidth * (median - 0.5);\r\n float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r\n\r\n // NPM Textures, NPM outputs\r\n gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r\n\r\n}\r\n"),uniforms:{uFWidth:0}}),q=o.BLEND_MODES.NORMAL_NPM);var X=new r.Mesh(W,U);X.blendMode=q,oe={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:X,vertices:null,uvs:null,indices:null}}oe.index=0,oe.indexCount=0,oe.vertexCount=0,oe.uvsCount=0,oe.total=0;var G=this._textureCache;G[j]=G[j]||new n.Texture(Q.baseTexture),oe.mesh.texture=G[j],oe.mesh.tint=this._tint,z.push(oe),H[j]=oe}H[j].total++}for(O=0;O<R.length;O++)-1===z.indexOf(R[O])&&this.removeChild(R[O].mesh);for(O=0;O<z.length;O++)z[O].mesh.parent!==this&&this.addChild(z[O].mesh);for(var O in this._activePagesMeshData=z,H){var Y=(oe=H[O]).total;if(!((null===(t=oe.indices)||void 0===t?void 0:t.length)>6*Y)||oe.vertices.length<2*r.Mesh.BATCHABLE_SIZE)oe.vertices=new Float32Array(8*Y),oe.uvs=new Float32Array(8*Y),oe.indices=new Uint16Array(6*Y);else for(var V=oe.total,Z=oe.vertices,$=4*V*2;$<Z.length;$++)Z[$]=0;oe.mesh.size=6*Y}for(O=0;O<N;O++){var J,K=(J=l[O]).position.x+k[J.line]*("justify"===this._align?J.prevSpaces:1);this._roundPixels&&(K=Math.round(K));var Q,ee=K*s,te=J.position.y*s,re=H[(Q=J.texture).baseTexture.uid],ie=Q.frame,ne=Q._uvs,ae=re.index++;re.indices[6*ae+0]=0+4*ae,re.indices[6*ae+1]=1+4*ae,re.indices[6*ae+2]=2+4*ae,re.indices[6*ae+3]=0+4*ae,re.indices[6*ae+4]=2+4*ae,re.indices[6*ae+5]=3+4*ae,re.vertices[8*ae+0]=ee,re.vertices[8*ae+1]=te,re.vertices[8*ae+2]=ee+ie.width*s,re.vertices[8*ae+3]=te,re.vertices[8*ae+4]=ee+ie.width*s,re.vertices[8*ae+5]=te+ie.height*s,re.vertices[8*ae+6]=ee,re.vertices[8*ae+7]=te+ie.height*s,re.uvs[8*ae+0]=ne.x0,re.uvs[8*ae+1]=ne.y0,re.uvs[8*ae+2]=ne.x1,re.uvs[8*ae+3]=ne.y1,re.uvs[8*ae+4]=ne.x2,re.uvs[8*ae+5]=ne.y2,re.uvs[8*ae+6]=ne.x3,re.uvs[8*ae+7]=ne.y3}for(var O in this._textWidth=w*s,this._textHeight=(h.y+a.lineHeight)*s,H){var oe=H[O];if(0!==this.anchor.x||0!==this.anchor.y)for(var se=0,he=this._textWidth*this.anchor.x,le=this._textHeight*this.anchor.y,ue=0;ue<oe.total;ue++)oe.vertices[se++]-=he,oe.vertices[se++]-=le,oe.vertices[se++]-=he,oe.vertices[se++]-=le,oe.vertices[se++]-=he,oe.vertices[se++]-=le,oe.vertices[se++]-=he,oe.vertices[se++]-=le;this._maxLineHeight=C*s;var fe=oe.mesh.geometry.getBuffer("aVertexPosition"),ce=oe.mesh.geometry.getBuffer("aTextureCoord"),de=oe.mesh.geometry.getIndex();fe.data=oe.vertices,ce.data=oe.uvs,de.data=oe.indices,fe.update(),ce.update(),de.update()}for(O=0;O<l.length;O++)T.push(l[O])},s.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},s.prototype._render=function(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0);var t=y.available[this._fontName],r=t.distanceFieldRange,i=t.distanceFieldType,n=t.size;if("none"!==i)for(var o=this.worldTransform,s=o.a,h=o.b,l=o.c,u=o.d,f=Math.sqrt(s*s+h*h),c=Math.sqrt(l*l+u*u),d=(Math.abs(f)+Math.abs(c))/2,p=this._fontSize/n,g=0,x=this._activePagesMeshData;g<x.length;g++){x[g].mesh.shader.uniforms.uFWidth=d*r*p*this._resolution}a.prototype._render.call(this,e)},s.prototype.getLocalBounds=function(){return this.validate(),a.prototype.getLocalBounds.call(this)},s.prototype.validate=function(){this.dirty&&(this.updateText(),this.dirty=!1)},Object.defineProperty(s.prototype,"tint",{get:function(){return this._tint},set:function(e){if(this._tint!==e){this._tint=e;for(var t=0;t<this._activePagesMeshData.length;t++)this._activePagesMeshData[t].mesh.tint=e}},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"align",{get:function(){return this._align},set:function(e){this._align!==e&&(this._align=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"fontName",{get:function(){return this._fontName},set:function(e){if(!y.available[e])throw new Error('Missing BitmapFont "'+e+'"');this._fontName!==e&&(this._fontName=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"fontSize",{get:function(){return this._fontSize},set:function(e){this._fontSize!==e&&(this._fontSize=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"anchor",{get:function(){return this._anchor},set:function(e){"number"==typeof e?this._anchor.set(e):this._anchor.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"text",{get:function(){return this._text},set:function(e){e=String(null==e?"":e),this._text!==e&&(this._text=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(e){this._maxWidth!==e&&(this._maxWidth=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"maxLineHeight",{get:function(){return this.validate(),this._maxLineHeight},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"textWidth",{get:function(){return this.validate(),this._textWidth},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(e){e!==this._roundPixels&&(this._roundPixels=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"textHeight",{get:function(){return this.validate(),this._textHeight},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"resolution",{get:function(){return this._resolution},set:function(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)},enumerable:!1,configurable:!0}),s.prototype.destroy=function(e){var t=this._textureCache;for(var r in t){t[r].destroy(),delete t[r]}this._textureCache=null,a.prototype.destroy.call(this,e)},s.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0},s}(s.Container),A=function(){function e(){}return e.add=function(){h.LoaderResource.setExtensionXhrType("fnt",h.LoaderResource.XHR_RESPONSE_TYPE.TEXT)},e.use=function(t,r){var i=g(t.data);if(i)for(var n=e.getBaseUrl(this,t),a=i.parse(t.data),o={},s=function(e){o[e.metadata.pageFile]=e.texture,Object.keys(o).length===a.page.length&&(t.bitmapFont=y.install(a,o,!0),r())},l=0;l<a.page.length;++l){var u=a.page[l].file,f=n+u,c=!1;for(var d in this.resources){var p=this.resources[d];if(p.url===f){p.metadata.pageFile=u,p.texture?s(p):p.onAfterMiddleware.add(s),c=!0;break}}if(!c){var x={crossOrigin:t.crossOrigin,loadType:h.LoaderResource.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:u},t.metadata.imageMetadata),parentResource:t};this.add(f,x,s)}}else r()},e.getBaseUrl=function(t,r){var i=r.isDataUrl?"":e.dirname(r.url);return r.isDataUrl&&("."===i&&(i=""),t.baseUrl&&i&&"/"===t.baseUrl.charAt(t.baseUrl.length-1)&&(i+="/")),(i=i.replace(t.baseUrl,""))&&"/"!==i.charAt(i.length-1)&&(i+="/"),i},e.dirname=function(e){var t=e.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return t===e?".":""===t?"/":t},e.extension=n.ExtensionType.Loader,e}();exports.BitmapFont=y,exports.BitmapFontData=u,exports.BitmapFontLoader=A,exports.BitmapText=w,exports.TextFormat=f,exports.XMLFormat=c,exports.XMLStringFormat=d,exports.autoDetectFormat=g;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pixi/math"),t=require("@pixi/settings"),r=require("@pixi/mesh"),i=require("@pixi/utils"),n=require("@pixi/core"),a=require("@pixi/text"),o=require("@pixi/constants"),s=require("@pixi/display"),h=require("@pixi/loaders"),l=function(e,t){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},l(e,t)};var u=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]},f=function(){function e(){}return e.test=function(e){return"string"==typeof e&&0===e.indexOf("info face=")},e.parse=function(e){var t=e.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(var i in t){var n=t[i].match(/^[a-z]+/gm)[0],a=t[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),o={};for(var s in a){var h=a[s].split("="),l=h[0],f=h[1].replace(/"/gm,""),c=parseFloat(f),d=isNaN(c)?f:c;o[l]=d}r[n].push(o)}var p=new u;return r.info.forEach((function(e){return p.info.push({face:e.face,size:parseInt(e.size,10)})})),r.common.forEach((function(e){return p.common.push({lineHeight:parseInt(e.lineHeight,10)})})),r.page.forEach((function(e){return p.page.push({id:parseInt(e.id,10),file:e.file})})),r.char.forEach((function(e){return p.char.push({id:parseInt(e.id,10),page:parseInt(e.page,10),x:parseInt(e.x,10),y:parseInt(e.y,10),width:parseInt(e.width,10),height:parseInt(e.height,10),xoffset:parseInt(e.xoffset,10),yoffset:parseInt(e.yoffset,10),xadvance:parseInt(e.xadvance,10)})})),r.kerning.forEach((function(e){return p.kerning.push({first:parseInt(e.first,10),second:parseInt(e.second,10),amount:parseInt(e.amount,10)})})),r.distanceField.forEach((function(e){return p.distanceField.push({distanceRange:parseInt(e.distanceRange,10),fieldType:e.fieldType})})),p},e}(),c=function(){function e(){}return e.test=function(e){return e instanceof XMLDocument&&e.getElementsByTagName("page").length&&null!==e.getElementsByTagName("info")[0].getAttribute("face")},e.parse=function(e){for(var t=new u,r=e.getElementsByTagName("info"),i=e.getElementsByTagName("common"),n=e.getElementsByTagName("page"),a=e.getElementsByTagName("char"),o=e.getElementsByTagName("kerning"),s=e.getElementsByTagName("distanceField"),h=0;h<r.length;h++)t.info.push({face:r[h].getAttribute("face"),size:parseInt(r[h].getAttribute("size"),10)});for(h=0;h<i.length;h++)t.common.push({lineHeight:parseInt(i[h].getAttribute("lineHeight"),10)});for(h=0;h<n.length;h++)t.page.push({id:parseInt(n[h].getAttribute("id"),10)||0,file:n[h].getAttribute("file")});for(h=0;h<a.length;h++){var l=a[h];t.char.push({id:parseInt(l.getAttribute("id"),10),page:parseInt(l.getAttribute("page"),10)||0,x:parseInt(l.getAttribute("x"),10),y:parseInt(l.getAttribute("y"),10),width:parseInt(l.getAttribute("width"),10),height:parseInt(l.getAttribute("height"),10),xoffset:parseInt(l.getAttribute("xoffset"),10),yoffset:parseInt(l.getAttribute("yoffset"),10),xadvance:parseInt(l.getAttribute("xadvance"),10)})}for(h=0;h<o.length;h++)t.kerning.push({first:parseInt(o[h].getAttribute("first"),10),second:parseInt(o[h].getAttribute("second"),10),amount:parseInt(o[h].getAttribute("amount"),10)});for(h=0;h<s.length;h++)t.distanceField.push({fieldType:s[h].getAttribute("fieldType"),distanceRange:parseInt(s[h].getAttribute("distanceRange"),10)});return t},e}(),d=function(){function e(){}return e.test=function(e){if("string"==typeof e&&e.indexOf("<font>")>-1){var t=(new globalThis.DOMParser).parseFromString(e,"text/xml");return c.test(t)}return!1},e.parse=function(e){var t=(new globalThis.DOMParser).parseFromString(e,"text/xml");return c.parse(t)},e}(),p=[f,c,d];function g(e){for(var t=0;t<p.length;t++)if(p[t].test(e))return p[t];return null}function x(e,t,r,n,o,s,h){var l=r.text,u=r.fontProperties;t.translate(n,o),t.scale(s,s);var f=h.strokeThickness/2,c=-h.strokeThickness/2;if(t.font=h.toFontString(),t.lineWidth=h.strokeThickness,t.textBaseline=h.textBaseline,t.lineJoin=h.lineJoin,t.miterLimit=h.miterLimit,t.fillStyle=function(e,t,r,i,n,o){var s,h=r.fill;if(!Array.isArray(h))return h;if(1===h.length)return h[0];var l=r.dropShadow?r.dropShadowDistance:0,u=r.padding||0,f=e.width/i-l-2*u,c=e.height/i-l-2*u,d=h.slice(),p=r.fillGradientStops.slice();if(!p.length)for(var g=d.length+1,x=1;x<g;++x)p.push(x/g);if(d.unshift(h[0]),p.unshift(0),d.push(h[h.length-1]),p.push(1),r.fillGradientType===a.TEXT_GRADIENT.LINEAR_VERTICAL){s=t.createLinearGradient(f/2,u,f/2,c+u);var v=0,m=(o.fontProperties.fontSize+r.strokeThickness)/c;for(x=0;x<n.length;x++)for(var y=o.lineHeight*x,_=0;_<d.length;_++){var b=y/c+("number"==typeof p[_]?p[_]:_/d.length)*m,T=Math.max(v,b);T=Math.min(T,1),s.addColorStop(T,d[_]),v=T}}else{s=t.createLinearGradient(u,c/2,f+u,c/2);var w=d.length+1,A=1;for(x=0;x<d.length;x++){var M=void 0;M="number"==typeof p[x]?p[x]:A/w,s.addColorStop(M,d[x]),A++}}return s}(e,t,h,s,[l],r),t.strokeStyle=h.stroke,h.dropShadow){var d=h.dropShadowColor,p=i.hex2rgb("number"==typeof d?d:i.string2hex(d)),g=h.dropShadowBlur*s,x=h.dropShadowDistance*s;t.shadowColor="rgba("+255*p[0]+","+255*p[1]+","+255*p[2]+","+h.dropShadowAlpha+")",t.shadowBlur=g,t.shadowOffsetX=Math.cos(h.dropShadowAngle)*x,t.shadowOffsetY=Math.sin(h.dropShadowAngle)*x}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;h.stroke&&h.strokeThickness&&t.strokeText(l,f,c+r.lineHeight-u.descent),h.fill&&t.fillText(l,f,c+r.lineHeight-u.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function v(e){return Array.from?Array.from(e):e.split("")}function m(e){return e.codePointAt?e.codePointAt(0):e.charCodeAt(0)}var y=function(){function r(t,r,a){var s,h,l=t.info[0],u=t.common[0],f=t.page[0],c=t.distanceField[0],d=i.getResolutionOfUrl(f.file),p={};this._ownsTextures=a,this.font=l.face,this.size=l.size,this.lineHeight=u.lineHeight/d,this.chars={},this.pageTextures=p;for(var g=0;g<t.page.length;g++){var x=t.page[g],v=x.id,m=x.file;p[v]=r instanceof Array?r[g]:r[m],(null==c?void 0:c.fieldType)&&"none"!==c.fieldType&&(p[v].baseTexture.alphaMode=o.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA)}for(g=0;g<t.char.length;g++){var y=t.char[g],_=(v=y.id,y.page),b=t.char[g],T=b.x,w=b.y,A=b.width,M=b.height,S=b.xoffset,P=b.yoffset,C=b.xadvance;T/=d,w/=d,A/=d,M/=d,S/=d,P/=d,C/=d;var E=new e.Rectangle(T+p[_].frame.x/d,w+p[_].frame.y/d,A,M);this.chars[v]={xOffset:S,yOffset:P,xAdvance:C,kerning:{},texture:new n.Texture(p[_].baseTexture,E),page:_}}for(g=0;g<t.kerning.length;g++){var O=t.kerning[g],I=O.first,F=O.second,D=O.amount;I/=d,F/=d,D/=d,this.chars[F]&&(this.chars[F].kerning[I]=D)}this.distanceFieldRange=null==c?void 0:c.distanceRange,this.distanceFieldType=null!==(h=null===(s=null==c?void 0:c.fieldType)||void 0===s?void 0:s.toLowerCase())&&void 0!==h?h:"none"}return r.prototype.destroy=function(){for(var e in this.chars)this.chars[e].texture.destroy(),this.chars[e].texture=null;for(var e in this.pageTextures)this._ownsTextures&&this.pageTextures[e].destroy(!0),this.pageTextures[e]=null;this.chars=null,this.pageTextures=null},r.install=function(e,t,i){var a;if(e instanceof u)a=e;else{var o=g(e);if(!o)throw new Error("Unrecognized data format for font.");a=o.parse(e)}t instanceof n.Texture&&(t=[t]);var s=new r(a,t,i);return r.available[s.font]=s,s},r.uninstall=function(e){var t=r.available[e];if(!t)throw new Error("No font found named '"+e+"'");t.destroy(),delete r.available[e]},r.from=function(e,i,o){if(!e)throw new Error("[BitmapFont] Property `name` is required.");var s=Object.assign({},r.defaultOptions,o),h=s.chars,l=s.padding,f=s.resolution,c=s.textureWidth,d=s.textureHeight,p=function(e){"string"==typeof e&&(e=[e]);for(var t=[],r=0,i=e.length;r<i;r++){var n=e[r];if(Array.isArray(n)){if(2!==n.length)throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got "+n.length+".");var a=n[0].charCodeAt(0),o=n[1].charCodeAt(0);if(o<a)throw new Error("[BitmapFont]: Invalid character range.");for(var s=a,h=o;s<=h;s++)t.push(String.fromCharCode(s))}else t.push.apply(t,v(n))}if(0===t.length)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}(h),g=i instanceof a.TextStyle?i:new a.TextStyle(i),y=c,_=new u;_.info[0]={face:g.fontFamily,size:g.fontSize},_.common[0]={lineHeight:g.fontSize};for(var b,T,w,A=0,M=0,S=0,P=[],C=0;C<p.length;C++){b||((b=t.settings.ADAPTER.createCanvas()).width=c,b.height=d,T=b.getContext("2d"),w=new n.BaseTexture(b,{resolution:f}),P.push(new n.Texture(w)),_.page.push({id:P.length-1,file:""}));var E=a.TextMetrics.measureText(p[C],g,!1,b),O=E.width,I=Math.ceil(E.height),F=Math.ceil(("italic"===g.fontStyle?2:1)*O);if(M>=d-I*f){if(0===M)throw new Error("[BitmapFont] textureHeight "+d+"px is too small for "+g.fontSize+"px fonts");--C,b=null,T=null,w=null,M=0,A=0,S=0}else if(S=Math.max(I+E.fontProperties.descent,S),F*f+A>=y)--C,M+=S*f,M=Math.ceil(M),A=0,S=0;else{x(b,T,E,A,M,f,g);var D=m(E.text);_.char.push({id:D,page:P.length-1,x:A/f,y:M/f,width:F,height:I,xoffset:0,yoffset:0,xadvance:Math.ceil(O-(g.dropShadow?g.dropShadowDistance:0)-(g.stroke?g.strokeThickness:0))}),A+=(F+2*l)*f,A=Math.ceil(A)}}C=0;for(var L=p.length;C<L;C++)for(var k=p[C],B=0;B<L;B++){var N=p[B],H=T.measureText(k).width,z=T.measureText(N).width,R=T.measureText(k+N).width-(H+z);R&&_.kerning.push({first:m(k),second:m(N),amount:R})}var j=new r(_,P,!0);return void 0!==r.available[e]&&r.uninstall(e),r.available[e]=j,j},r.ALPHA=[["a","z"],["A","Z"]," "],r.NUMERIC=[["0","9"]],r.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],r.ASCII=[[" ","~"]],r.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:r.ALPHANUMERIC},r.available={},r}(),_=[],b=[],T=[],w=function(a){function s(r,i){void 0===i&&(i={});var n=a.call(this)||this;n._tint=16777215;var o=Object.assign({},s.styleDefaults,i),h=o.align,l=o.tint,u=o.maxWidth,f=o.letterSpacing,c=o.fontName,d=o.fontSize;if(!y.available[c])throw new Error('Missing BitmapFont "'+c+'"');return n._activePagesMeshData=[],n._textWidth=0,n._textHeight=0,n._align=h,n._tint=l,n._fontName=c,n._fontSize=d||y.available[c].size,n.text=r,n._maxWidth=u,n._maxLineHeight=0,n._letterSpacing=f,n._anchor=new e.ObservablePoint((function(){n.dirty=!0}),n,0,0),n._roundPixels=t.settings.ROUND_PIXELS,n.dirty=!0,n._resolution=t.settings.RESOLUTION,n._autoResolution=!0,n._textureCache={},n}return function(e,t){function r(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(s,a),s.prototype.updateText=function(){for(var t,a=y.available[this._fontName],s=this._fontSize/a.size,h=new e.Point,l=[],u=[],f=[],c=v(this._text.replace(/(?:\r\n|\r)/g,"\n")||" "),d=this._maxWidth*a.size/this._fontSize,p="none"===a.distanceFieldType?_:b,g=null,x=0,w=0,A=0,M=-1,S=0,P=0,C=0,E=0,O=0;O<c.length;O++){var I=m(J=c[O]);if(/(?:\s)/.test(J)&&(M=O,S=x,E++),"\r"!==J&&"\n"!==J){var F=a.chars[I];if(F){g&&F.kerning[g]&&(h.x+=F.kerning[g]);var D=T.pop()||{texture:n.Texture.EMPTY,line:0,charCode:0,prevSpaces:0,position:new e.Point};D.texture=F.texture,D.line=A,D.charCode=I,D.position.x=h.x+F.xOffset+this._letterSpacing/2,D.position.y=h.y+F.yOffset,D.prevSpaces=E,l.push(D),x=D.position.x+Math.max(F.xAdvance-F.xOffset,F.texture.orig.width),h.x+=F.xAdvance+this._letterSpacing,C=Math.max(C,F.yOffset+F.texture.height),g=I,-1!==M&&d>0&&h.x>d&&(++P,i.removeItems(l,1+M-P,1+O-M),O=M,M=-1,u.push(S),f.push(l.length>0?l[l.length-1].prevSpaces:0),w=Math.max(w,S),A++,h.x=0,h.y+=a.lineHeight,g=null,E=0)}}else u.push(x),f.push(-1),w=Math.max(w,x),++A,++P,h.x=0,h.y+=a.lineHeight,g=null,E=0}var L=c[c.length-1];"\r"!==L&&"\n"!==L&&(/(?:\s)/.test(L)&&(x=S),u.push(x),w=Math.max(w,x),f.push(-1));var k=[];for(O=0;O<=A;O++){var B=0;"right"===this._align?B=w-u[O]:"center"===this._align?B=(w-u[O])/2:"justify"===this._align&&(B=f[O]<0?0:(w-u[O])/f[O]),k.push(B)}var N=l.length,H={},z=[],R=this._activePagesMeshData;for(O=0;O<R.length;O++)p.push(R[O]);for(O=0;O<N;O++){var j=(Q=l[O].texture).baseTexture.uid;if(!H[j]){if(!(oe=p.pop())){var W=new r.MeshGeometry,U=void 0,q=void 0;"none"===a.distanceFieldType?(U=new r.MeshMaterial(n.Texture.EMPTY),q=o.BLEND_MODES.NORMAL):(U=new r.MeshMaterial(n.Texture.EMPTY,{program:n.Program.from("// Mesh material default fragment\r\nattribute vec2 aVertexPosition;\r\nattribute vec2 aTextureCoord;\r\n\r\nuniform mat3 projectionMatrix;\r\nuniform mat3 translationMatrix;\r\nuniform mat3 uTextureMatrix;\r\n\r\nvarying vec2 vTextureCoord;\r\n\r\nvoid main(void)\r\n{\r\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r\n\r\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r\n}\r\n","// Pixi texture info\r\nvarying vec2 vTextureCoord;\r\nuniform sampler2D uSampler;\r\n\r\n// Tint\r\nuniform vec4 uColor;\r\n\r\n// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r\nuniform float uFWidth;\r\n\r\nvoid main(void) {\r\n\r\n // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r\n vec4 texColor = texture2D(uSampler, vTextureCoord);\r\n\r\n // MSDF\r\n float median = texColor.r + texColor.g + texColor.b -\r\n min(texColor.r, min(texColor.g, texColor.b)) -\r\n max(texColor.r, max(texColor.g, texColor.b));\r\n // SDF\r\n median = min(median, texColor.a);\r\n\r\n float screenPxDistance = uFWidth * (median - 0.5);\r\n float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r\n\r\n // NPM Textures, NPM outputs\r\n gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r\n\r\n}\r\n"),uniforms:{uFWidth:0}}),q=o.BLEND_MODES.NORMAL_NPM);var X=new r.Mesh(W,U);X.blendMode=q,oe={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:X,vertices:null,uvs:null,indices:null}}oe.index=0,oe.indexCount=0,oe.vertexCount=0,oe.uvsCount=0,oe.total=0;var G=this._textureCache;G[j]=G[j]||new n.Texture(Q.baseTexture),oe.mesh.texture=G[j],oe.mesh.tint=this._tint,z.push(oe),H[j]=oe}H[j].total++}for(O=0;O<R.length;O++)-1===z.indexOf(R[O])&&this.removeChild(R[O].mesh);for(O=0;O<z.length;O++)z[O].mesh.parent!==this&&this.addChild(z[O].mesh);for(var O in this._activePagesMeshData=z,H){var Y=(oe=H[O]).total;if(!((null===(t=oe.indices)||void 0===t?void 0:t.length)>6*Y)||oe.vertices.length<2*r.Mesh.BATCHABLE_SIZE)oe.vertices=new Float32Array(8*Y),oe.uvs=new Float32Array(8*Y),oe.indices=new Uint16Array(6*Y);else for(var V=oe.total,Z=oe.vertices,$=4*V*2;$<Z.length;$++)Z[$]=0;oe.mesh.size=6*Y}for(O=0;O<N;O++){var J,K=(J=l[O]).position.x+k[J.line]*("justify"===this._align?J.prevSpaces:1);this._roundPixels&&(K=Math.round(K));var Q,ee=K*s,te=J.position.y*s,re=H[(Q=J.texture).baseTexture.uid],ie=Q.frame,ne=Q._uvs,ae=re.index++;re.indices[6*ae+0]=0+4*ae,re.indices[6*ae+1]=1+4*ae,re.indices[6*ae+2]=2+4*ae,re.indices[6*ae+3]=0+4*ae,re.indices[6*ae+4]=2+4*ae,re.indices[6*ae+5]=3+4*ae,re.vertices[8*ae+0]=ee,re.vertices[8*ae+1]=te,re.vertices[8*ae+2]=ee+ie.width*s,re.vertices[8*ae+3]=te,re.vertices[8*ae+4]=ee+ie.width*s,re.vertices[8*ae+5]=te+ie.height*s,re.vertices[8*ae+6]=ee,re.vertices[8*ae+7]=te+ie.height*s,re.uvs[8*ae+0]=ne.x0,re.uvs[8*ae+1]=ne.y0,re.uvs[8*ae+2]=ne.x1,re.uvs[8*ae+3]=ne.y1,re.uvs[8*ae+4]=ne.x2,re.uvs[8*ae+5]=ne.y2,re.uvs[8*ae+6]=ne.x3,re.uvs[8*ae+7]=ne.y3}for(var O in this._textWidth=w*s,this._textHeight=(h.y+a.lineHeight)*s,H){var oe=H[O];if(0!==this.anchor.x||0!==this.anchor.y)for(var se=0,he=this._textWidth*this.anchor.x,le=this._textHeight*this.anchor.y,ue=0;ue<oe.total;ue++)oe.vertices[se++]-=he,oe.vertices[se++]-=le,oe.vertices[se++]-=he,oe.vertices[se++]-=le,oe.vertices[se++]-=he,oe.vertices[se++]-=le,oe.vertices[se++]-=he,oe.vertices[se++]-=le;this._maxLineHeight=C*s;var fe=oe.mesh.geometry.getBuffer("aVertexPosition"),ce=oe.mesh.geometry.getBuffer("aTextureCoord"),de=oe.mesh.geometry.getIndex();fe.data=oe.vertices,ce.data=oe.uvs,de.data=oe.indices,fe.update(),ce.update(),de.update()}for(O=0;O<l.length;O++)T.push(l[O])},s.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},s.prototype._render=function(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0);var t=y.available[this._fontName],r=t.distanceFieldRange,i=t.distanceFieldType,n=t.size;if("none"!==i)for(var o=this.worldTransform,s=o.a,h=o.b,l=o.c,u=o.d,f=Math.sqrt(s*s+h*h),c=Math.sqrt(l*l+u*u),d=(Math.abs(f)+Math.abs(c))/2,p=this._fontSize/n,g=0,x=this._activePagesMeshData;g<x.length;g++){x[g].mesh.shader.uniforms.uFWidth=d*r*p*this._resolution}a.prototype._render.call(this,e)},s.prototype.getLocalBounds=function(){return this.validate(),a.prototype.getLocalBounds.call(this)},s.prototype.validate=function(){this.dirty&&(this.updateText(),this.dirty=!1)},Object.defineProperty(s.prototype,"tint",{get:function(){return this._tint},set:function(e){if(this._tint!==e){this._tint=e;for(var t=0;t<this._activePagesMeshData.length;t++)this._activePagesMeshData[t].mesh.tint=e}},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"align",{get:function(){return this._align},set:function(e){this._align!==e&&(this._align=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"fontName",{get:function(){return this._fontName},set:function(e){if(!y.available[e])throw new Error('Missing BitmapFont "'+e+'"');this._fontName!==e&&(this._fontName=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"fontSize",{get:function(){return this._fontSize},set:function(e){this._fontSize!==e&&(this._fontSize=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"anchor",{get:function(){return this._anchor},set:function(e){"number"==typeof e?this._anchor.set(e):this._anchor.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"text",{get:function(){return this._text},set:function(e){e=String(null==e?"":e),this._text!==e&&(this._text=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(e){this._maxWidth!==e&&(this._maxWidth=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"maxLineHeight",{get:function(){return this.validate(),this._maxLineHeight},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"textWidth",{get:function(){return this.validate(),this._textWidth},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(e){e!==this._roundPixels&&(this._roundPixels=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"textHeight",{get:function(){return this.validate(),this._textHeight},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"resolution",{get:function(){return this._resolution},set:function(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)},enumerable:!1,configurable:!0}),s.prototype.destroy=function(e){var t=this._textureCache;for(var r in t){t[r].destroy(),delete t[r]}this._textureCache=null,a.prototype.destroy.call(this,e)},s.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0},s}(s.Container),A=function(){function e(){}return e.add=function(){h.LoaderResource.setExtensionXhrType("fnt",h.LoaderResource.XHR_RESPONSE_TYPE.TEXT)},e.use=function(t,r){var i=g(t.data);if(i)for(var n=e.getBaseUrl(this,t),a=i.parse(t.data),o={},s=function(e){o[e.metadata.pageFile]=e.texture,Object.keys(o).length===a.page.length&&(t.bitmapFont=y.install(a,o,!0),r())},l=0;l<a.page.length;++l){var u=a.page[l].file,f=n+u,c=!1;for(var d in this.resources){var p=this.resources[d];if(p.url===f){p.metadata.pageFile=u,p.texture?s(p):p.onAfterMiddleware.add(s),c=!0;break}}if(!c){var x={crossOrigin:t.crossOrigin,loadType:h.LoaderResource.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:u},t.metadata.imageMetadata),parentResource:t};this.add(f,x,s)}}else r()},e.getBaseUrl=function(t,r){var i=r.isDataUrl?"":e.dirname(r.url);return r.isDataUrl&&("."===i&&(i=""),t.baseUrl&&i&&"/"===t.baseUrl.charAt(t.baseUrl.length-1)&&(i+="/")),(i=i.replace(t.baseUrl,""))&&"/"!==i.charAt(i.length-1)&&(i+="/"),i},e.dirname=function(e){var t=e.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return t===e?".":""===t?"/":t},e.extension=n.ExtensionType.Loader,e}();exports.BitmapFont=y,exports.BitmapFontData=u,exports.BitmapFontLoader=A,exports.BitmapText=w,exports.TextFormat=f,exports.XMLFormat=c,exports.XMLStringFormat=d,exports.autoDetectFormat=g;
//# sourceMappingURL=text-bitmap.min.js.map
{
"name": "@pixi/text-bitmap",
"version": "6.5.1",
"version": "6.5.2",
"main": "dist/cjs/text-bitmap.js",

@@ -41,13 +41,13 @@ "module": "dist/esm/text-bitmap.mjs",

"peerDependencies": {
"@pixi/constants": "6.5.1",
"@pixi/core": "6.5.1",
"@pixi/display": "6.5.1",
"@pixi/loaders": "6.5.1",
"@pixi/math": "6.5.1",
"@pixi/mesh": "6.5.1",
"@pixi/settings": "6.5.1",
"@pixi/text": "6.5.1",
"@pixi/utils": "6.5.1"
"@pixi/constants": "6.5.2",
"@pixi/core": "6.5.2",
"@pixi/display": "6.5.2",
"@pixi/loaders": "6.5.2",
"@pixi/math": "6.5.2",
"@pixi/mesh": "6.5.2",
"@pixi/settings": "6.5.2",
"@pixi/text": "6.5.2",
"@pixi/utils": "6.5.2"
},
"gitHead": "a344b58dc859e3a60f75d2dc95b7d45180c766d8"
"gitHead": "48ab2f2d009bfb541079ef169df79e4174930f0a"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet