1"use strict";(self.webpackChunkew_startertheme=self.webpackChunkew_startertheme||[]).push([[7621],{7621:(e,t,s)=>{s.r(t),s.d(t,{BitmapFont:()=>b});var i=s(78077),n=s(13904),r=s(3546),a=s(54146),o=s(156);class h extends a.Z{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return(0,o.a1)(o.PD,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return(0,o.a1)(o.PD,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return(0,o.a1)(o.PD,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return(0,o.a1)(o.PD,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return(0,o.a1)(o.PD,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners();for(const e in this.chars)this.chars[e].texture?.destroy();this.chars=null,e&&(this.pages.forEach((e=>e.texture.destroy(!0))),this.pages=null)}}var l=s(42552),c=s(4162),d=s(4796),u=s(65228),p=s(33779),f=s(59193),g=s(20131),w=s(9160),m=s(25021),x=s(13),y=s(40778);const S=class e extends h{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentMaxCharHeight=0,this._currentPageIndex=-1,this._skipKerning=!1;const s={...e.defaultOptions,...t};this._textureSize=s.textureSize,this._mipmap=s.mipmap;const i=s.style.clone();s.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=r.x.WHITE,i._fill.fill=null),this.applyFillAsTint=s.overrideFill;const n=i.fontSize;i.fontSize=this.baseMeasurementFontSize;const a=(0,x.M)(i);s.overrideSize?(i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/n),i.dropShadow&&(i.dropShadow.blur*=this.baseRenderedFontSize/n,i.dropShadow.distance*=this.baseRenderedFontSize/n)):i.fontSize=this.baseRenderedFontSize=n,this._style=i,this._skipKerning=s.skipKerning??!1,this.resolution=s.resolution??1,this._padding=s.padding??4,s.textureStyle&&(this._textureStyle=s.textureStyle instanceof m.L?s.textureStyle:new m.L(s.textureStyle)),this.fontMetrics=u.c.measureFont(a),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(e){const t=u.c.graphemeSegmenter(e).filter((e=>!this._currentChars.includes(e))).filter(((e,t,s)=>s.indexOf(e)===t));if(!t.length)return;let s;this._currentChars=[...this._currentChars,...t],s=-1===this._currentPageIndex?this._nextPage():this.pages[this._currentPageIndex];let{canvas:i,context:a}=s.canvasAndContext,o=s.texture.source;const h=this._style;let l=this._currentX,c=this._currentY,d=this._currentMaxCharHeight;const p=this.baseRenderedFontSize/this.baseMeasurementFontSize,f=(h.dropShadow?.distance??0)+(h._stroke?.width??0),g=this._padding+f;let w=!1;const m=i.width/this.resolution,x=i.height/this.resolution;for(let e=0;e<t.length;e++){const s=t[e],f=u.c.measureText(s,h,i,!1);f.lineHeight=f.height;const y=f.width*p,S=Math.ceil(("italic"===h.fontStyle?2:1)*y)+2*g,_=f.height*p+2*g;if(w=!1,"\n"!==s&&"\r"!==s&&"\t"!==s&&" "!==s&&(w=!0,d=Math.ceil(Math.max(_,d))),l+S>m&&(c+=d,d=_,l=0,c+d>x)){o.update();const e=this._nextPage();i=e.canvasAndContext.canvas,a=e.canvasAndContext.context,o=e.texture.source,l=0,c=0,d=0}const F=a.measureText(s).width/p;if(this.chars[s]={id:s.codePointAt(0),xOffset:-g/p,yOffset:-g/p,xAdvance:F,kerning:{}},w){this._drawGlyph(a,f,l+g,c+g,p,h);const e=o.width*p,t=o.height*p,i=new n.A(l/e*o.width,c/t*o.height,S/e*o.width,_/t*o.height);this.chars[s].texture=new r.x({source:o,frame:i}),l+=Math.ceil(S)}}o.update(),this._currentX=l,this._currentY=c,this._currentMaxCharHeight=d,this._skipKerning||this._applyKerning(t,a,p)}get pageTextures(){return(0,o.a1)(o.PD,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}
1_applyKerning(e,t,s){const i=this._measureCache;for(let n=0;n<e.length;n++){const r=e[n];for(let e=0;e<this._currentChars.length;e++){const n=this._currentChars[e];let a=i[r];a||(a=i[r]=t.measureText(r).width);let o=i[n];o||(o=i[n]=t.measureText(n).width);let h=t.measureText(r+n).width,l=h-(a+o);l&&this.chars[r]&&(this.chars[r].kerning[n]=l/s),h=t.measureText(r+n).width,l=h-(a+o),l&&this.chars[n]&&(this.chars[n].kerning[r]=l/s)}}}_nextPage(){this._currentPageIndex++;const e=this.resolution,t=g.h.getOptimalCanvasAndContext(this._textureSize,this._textureSize,e);this._setupContext(t.context,this._style,e);const s=e*(this.baseRenderedFontSize/this.baseMeasurementFontSize),i=new r.x({source:new w.c({resource:t.canvas,resolution:s,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})});this._textureStyle&&(i.source.style=this._textureStyle);const n={canvasAndContext:t,texture:i};return this.pages[this._currentPageIndex]=n,n}_setupContext(e,t,s){t.fontSize=this.baseRenderedFontSize,e.scale(s,s),e.font=(0,x.M)(t),t.fontSize=this.baseMeasurementFontSize,e.textBaseline=t.textBaseline;const i=t._stroke,n=i?.width??0;if(i&&(e.lineWidth=n,e.lineJoin=i.join,e.miterLimit=i.miterLimit,e.strokeStyle=(0,y.m)(i,e)),t._fill&&(e.fillStyle=(0,y.m)(t._fill,e)),t.dropShadow){const i=t.dropShadow,n=f.I.shared.setValue(i.color).toArray(),r=i.blur*s,a=i.distance*s;e.shadowColor=`rgba(${255*n[0]},${255*n[1]},${255*n[2]},${i.alpha})`,e.shadowBlur=r,e.shadowOffsetX=Math.cos(i.angle)*a,e.shadowOffsetY=Math.sin(i.angle)*a}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0}_drawGlyph(e,t,s,i,n,r){const a=t.text,o=t.fontProperties,h=(r._stroke?.width??0)*n,l=s+h/2,c=i-h/2,d=o.descent*n,u=t.lineHeight*n;let p=!1;r.stroke&&h&&(p=!0,e.strokeText(a,l,c+u-d));const{shadowBlur:f,shadowOffsetX:g,shadowOffsetY:w}=e;r._fill&&(p&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.fillText(a,l,c+u-d)),p&&(e.shadowBlur=f,e.shadowOffsetX=g,e.shadowOffsetY=w)}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){const{canvasAndContext:t,texture:s}=this.pages[e];g.h.returnCanvasAndContext(t),s.destroy(!0)}this.pages=null}};S.defaultOptions={textureSize:512,style:new p.p,mipmap:!0};let _=S;var F=s(10277);let C=0;const z=new class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1,textureStyle:null},this.measureCache=(0,l.n)(1e3)}getFont(e,t){let s=`${t.fontFamily}-bitmap`,i=!0;if(c.C.has(s)){const t=c.C.get(s);return t.ensureCharacters?.(e),t}if(t._fill.fill&&!t._stroke?(s+=t._fill.fill.styleKey,i=!1):(t._stroke||t.dropShadow)&&(s=`${t.styleKey}-bitmap`,i=!1),s+=`-${t.fontStyle}`,s+=`-${t.fontVariant}`,s+=`-${t.fontWeight}`,!c.C.has(s)){const e=Object.create(t);e._lineHeight=0;const n=new _({style:e,overrideFill:i,overrideSize:!0,...this.defaultOptions});C++,C>50&&(0,d.Z)("BitmapText",`You have dynamically created ${C} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",(()=>{C--,c.C.remove(s)})),c.C.set(s,n)}const n=c.C.get(s);return n.ensureCharacters?.(e),n}getLayout(e,t,s=!0){const i=this.getFont(e,t),n=`${e}-${t.styleKey}-${s}`;if(this.measureCache.has(n))return this.measureCache.get(n);const r=function(e,t,s,i){const n={width:0,height:0,offsetY:0,scale:t.fontSize/s.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};n.offsetY=s.baseLineOffset;let r=n.lines[0],a=null,o=!0;const h={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},l=s.baseMeasurementFontSize/t.fontSize,c=t.letterSpacing*l,d=t.wordWrapWidth*l,u=t.lineHeight?t.lineHeight*l:s.lineHeight,p=t.wordWrap&&t.breakWords,f=(0,F.Sy)(t.whiteSpace),g=(0,F.Zb)(t.whiteSpace);if(f||g){const t=[];let s=f;for(let i=0;i<e.length;i++){let n=e[i];if("\r"===n||"\n"===n){if(!g){f&&(s=!0),t.push(n);continue}"\r"===n&&"\n"===e[i+1]&&i++,n=" "}if((0,F.DF)(n))if(f&&(0,F.d0)(n)){if(s)continue;s=!0,t.push(" ")}else s=!1,t.push(n);else s=!1,t.push(n)}e=t}const w=e=>{const t=r.width;for(let s=0;s<h.index;s++){const i=e.positions[s];r.chars.push(e.chars[s]),r.charPositions.push(i+t)}
1r.width+=e.width,(h.index>0||!f)&&(o=!1),h.width=0,h.index=0,h.chars.length=0},m=()=>{let e=r.chars.length-1;if(i){let t=r.chars[e];for(;(0,F.d0)(t);)r.width-=s.chars[t].xAdvance,r.spacesIndex.pop(),t=r.chars[--e]}n.width=Math.max(n.width,r.width),r={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},o=!0,n.lines.push(r),n.height+=u},x=e=>e-c>d;for(let i=0;i<e.length+1;i++){let n;const l=i===e.length;l||(n=e[i]);const d=s.chars[n];if(/(?:\s)/.test(n)||"\r"===n||"\n"===n||l){if(!o&&t.wordWrap&&x(r.width+h.width)?(m(),w(h),l||r.charPositions.push(0)):(h.start=r.width,w(h),l||r.charPositions.push(0)),"\r"===n||"\n"===n)m();else if(!l&&d){const e=d.xAdvance+(d.kerning?.[a]||0)+c;r.width+=e,r.spaceWidth=e,r.spacesIndex.push(r.charPositions.length),r.chars.push(n)}}else if(d){const e=d.kerning?.[a]||0,s=d.xAdvance+e+c;p&&x(h.width+s)&&(o||m(),w(h),m()),h.positions[h.index++]=h.width+e,h.chars.push(n),h.width+=s,(0,F.dB)(n)&&(!o&&t.wordWrap&&x(r.width+h.width)&&m(),w(h))}a=n}return m(),"center"===t.align?function(e){for(let t=0;t<e.lines.length;t++){const s=e.lines[t],i=e.width/2-s.width/2;for(let e=0;e<s.charPositions.length;e++)s.charPositions[e]+=i}}(n):"right"===t.align?function(e){for(let t=0;t<e.lines.length;t++){const s=e.lines[t],i=e.width-s.width;for(let e=0;e<s.charPositions.length;e++)s.charPositions[e]+=i}}(n):"justify"===t.align&&function(e){const t=e.width;for(let s=0;s<e.lines.length-2;s++){const i=e.lines[s];let n=0,r=i.spacesIndex[n++],a=0;const o=i.spacesIndex.length,h=(t-i.width)/o;for(let e=0;e<i.charPositions.length;e++)e===r&&(r=i.spacesIndex[n++],a+=h),i.charPositions[e]+=a}}(n),n}(u.c.graphemeSegmenter(e),t,i,s);return this.measureCache.set(n,r),r}measureText(e,t,s=!0){return this.getLayout(e,t,s)}install(...e){let t=e[0];"string"==typeof t&&(t={name:t,style:e[1],chars:e[2]?.chars,resolution:e[2]?.resolution,padding:e[2]?.padding,skipKerning:e[2]?.skipKerning},(0,o.a1)(o.PD,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));const s=t?.name;if(!s)throw new Error("[BitmapFontManager] Property `name` is required.");t={...this.defaultOptions,...t};const i=t.style,n=i instanceof p.p?i:new p.p(i),r=t.dynamicFill??this._canUseTintForStyle(n),a=new _({style:n,overrideFill:r,skipKerning:t.skipKerning,padding:t.padding,resolution:t.resolution,overrideSize:!1,textureStyle:t.textureStyle}),h=function(e){if(""===e)return[];"string"==typeof e&&(e=[e]);const t=[];for(let s=0,i=e.length;s<i;s++){const i=e[s];if(Array.isArray(i)){if(2!==i.length)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${i.length}.`);if(0===i[0].length||0===i[1].length)throw new Error("[BitmapFont]: Invalid character delimiter.");const e=i[0].charCodeAt(0),s=i[1].charCodeAt(0);if(s<e)throw new Error("[BitmapFont]: Invalid character range.");for(let i=e,n=s;i<=n;i++)t.push(String.fromCharCode(i))}else t.push(...Array.from(i))}if(0===t.length)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}(t.chars);return a.ensureCharacters(h.join("")),c.C.set(`${s}-bitmap`,a),a.once("destroy",(()=>c.C.remove(`${s}-bitmap`))),a}uninstall(e){const t=`${e}-bitmap`,s=c.C.get(t);s&&s.destroy()}_canUseTintForStyle(e){return!(e._stroke||e.dropShadow&&0!==e.dropShadow.color||e._fill.fill||16777215!==e._fill.color)}};class b extends h{constructor(e,t){super();const{textures:s,data:a}=e;Object.keys(a.pages).forEach((e=>{const t=a.pages[parseInt(e,10)],i=s[t.id];this.pages.push({texture:i})})),Object.keys(a.chars).forEach((e=>{const t=a.chars[e],{frame:o,source:h,rotate:l}=s[t.page],c=i.L.transformRectCoords(t,o,l,new n.A),d=new r.x({frame:c,orig:new n.A(0,0,t.width,t.height),source:h,rotate:l});this.chars[e]={id:e.codePointAt(0),xOffset:t.xOffset,yOffset:t.yOffset,xAdvance:t.xAdvance,kerning:t.kerning??{},texture:d}})),this.baseRenderedFontSize=a.fontSize,this.baseMeasurementFontSize=a.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:a.fontSize},this.baseLineOffset=a.baseLineOffset,this.lineHeight=a.lineHeight,this.fontFamily=a.fontFamily,this.distanceField=a.distanceField??{type:"none",range:0},this.url=t}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){const{texture:t}=this.pages[e];t.destroy(!0)}this.pages=null}static install(e){z.install(e)}static uninstall(e){z.uninstall(e)}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.