Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@americana/maplibre-shield-generator

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@americana/maplibre-shield-generator - npm Package Compare versions

Comparing version 0.0.1-alpha.16 to 0.0.1-alpha.17

4

dist/index.js

@@ -1,3 +0,3 @@

var Ze=Object.create;var Se=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var it=Object.getPrototypeOf,lt=Object.prototype.hasOwnProperty;var nt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ot=(t,e,i,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of tt(e))!lt.call(t,n)&&n!==i&&Se(t,n,{get:()=>e[n],enumerable:!(l=et(e,n))||l.enumerable});return t};var rt=(t,e,i)=>(i=t!=null?Ze(it(t)):{},ot(e||!t||!t.__esModule?Se(i,"default",{value:t,enumerable:!0}):i,t));var we=nt((At,ce)=>{"use strict";ce.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var le=rt(we(),1),be=at,xe={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function at(t){var e,i=[],l=1,n;if(typeof t=="string")if(le.default[t])i=le.default[t].slice(),n="rgb";else if(t==="transparent")l=0,n="rgb",i=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var o=t.slice(1),r=o.length,u=r<=4;l=1,u?(i=[parseInt(o[0]+o[0],16),parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16)],r===4&&(l=parseInt(o[3]+o[3],16)/255)):(i=[parseInt(o[0]+o[1],16),parseInt(o[2]+o[3],16),parseInt(o[4]+o[5],16)],r===8&&(l=parseInt(o[6]+o[7],16)/255)),i[0]||(i[0]=0),i[1]||(i[1]=0),i[2]||(i[2]=0),n="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var h=e[1],g=h==="rgb",o=h.replace(/a$/,"");n=o;var r=o==="cmyk"?4:o==="gray"?1:3;i=e[2].trim().split(/\s*[,\/]\s*|\s+/).map(function(a,f){if(/%$/.test(a))return f===r?parseFloat(a)/100:o==="rgb"?parseFloat(a)*255/100:parseFloat(a);if(o[f]==="h"){if(/deg$/.test(a))return parseFloat(a);if(xe[a]!==void 0)return xe[a]}return parseFloat(a)}),h===o&&i.push(1),l=g||i[r]===void 0?1:i[r],i=i.slice(0,r)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(i=t.match(/([0-9]+)/g).map(function(y){return parseFloat(y)}),n=t.match(/([a-z])/ig).join("").toLowerCase());else isNaN(t)?Array.isArray(t)||t.length?(i=[t[0],t[1],t[2]],n="rgb",l=t.length===4?t[3]:1):t instanceof Object&&(t.r!=null||t.red!=null||t.R!=null?(n="rgb",i=[t.r||t.red||t.R||0,t.g||t.green||t.G||0,t.b||t.blue||t.B||0]):(n="hsl",i=[t.h||t.hue||t.H||0,t.s||t.saturation||t.S||0,t.l||t.lightness||t.L||t.b||t.brightness]),l=t.a||t.alpha||t.opacity||1,t.opacity!=null&&(l/=100)):(n="rgb",i=[t>>>16,(t&65280)>>>8,t&255]);return{space:n,values:i,alpha:l}}var D={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]};var Q={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e=t[0]/360,i=t[1]/100,l=t[2]/100,n,o,r,u,h;if(i===0)return h=l*255,[h,h,h];l<.5?o=l*(1+i):o=l+i-l*i,n=2*l-o,u=[0,0,0];for(var g=0;g<3;g++)r=e+1/3*-(g-1),r<0?r++:r>1&&r--,6*r<1?h=n+(o-n)*6*r:2*r<1?h=o:3*r<2?h=n+(o-n)*(2/3-r)*6:h=n,u[g]=h*255;return u}};D.hsl=function(t){var e=t[0]/255,i=t[1]/255,l=t[2]/255,n=Math.min(e,i,l),o=Math.max(e,i,l),r=o-n,u,h,g;return o===n?u=0:e===o?u=(i-l)/r:i===o?u=2+(l-e)/r:l===o&&(u=4+(e-i)/r),u=Math.min(u*60,360),u<0&&(u+=360),g=(n+o)/2,o===n?h=0:g<=.5?h=r/(o+n):h=r/(2-o-n),[u,h*100,g*100]};function N(t){Array.isArray(t)&&t.raw&&(t=String.raw(...arguments));var e,i,l,n=be(t);if(!n.space)return[];let o=n.space[0]==="h"?Q.min:D.min,r=n.space[0]==="h"?Q.max:D.max;return e=Array(3),e[0]=Math.min(Math.max(n.values[0],o[0]),r[0]),e[1]=Math.min(Math.max(n.values[1],o[1]),r[1]),e[2]=Math.min(Math.max(n.values[2],o[2]),r[2]),n.space[0]==="h"&&(e=Q.rgb(e)),e.push(Math.min(Math.max(n.alpha,0),1)),e}var dt='"sans-serif-condensed", "Arial Narrow", sans-serif',L=(t,e)=>`bold ${t}px ${e||dt}`,V=12;function ne(t,e,i){return 255-t/255*(255-i)-(1-t/255)*(255-e)}function ht(t,e,i,l){e[l]=t[i],e[l+1]=t[i+1],e[l+2]=t[i+2],e[l+3]=t[i+3]}function ut(t,e,i,l,n,o){e[l]=ne(t[i],n[0],o[0]),e[l+1]=ne(t[i+1],n[1],o[1]),e[l+2]=ne(t[i+2],n[2],o[2]),e[l+3]=t[i+3]}function oe(t,e,i,l,n,o){let r=t.createImageData(e.data.width,e.data.height),u=n||o?ut:ht,h=n?N(n):N("#000"),g=o?N(o):N("#fff");if(l)for(let y=0;y<e.data.height;y++)for(let s=0;s<e.data.width;s++){let f=((e.data.height-y-1)*e.data.width+s)*4,p=(y*e.data.width+s)*4;u(e.data.data,r.data,p,f,h,g)}else for(let y=0;y<e.data.data.length;y+=4)u(e.data.data,r.data,y,y,h,g);t.putImageData(r,0,i)}var U={Middle:"middle",Top:"top",Bottom:"bottom"};function ke(t,e){var i=t.width,l=t.height,n=e.width,o=e.height;return i*l/Math.sqrt(i*i*o*o+l*l*n*n)}function st(t,e){return{scale:ke(t,e),valign:U.Middle}}function ft(t,e){return{scale:ke(t,{height:e.width/2,width:e.height}),valign:U.Top}}function Ce(t,e){var i=t.height/e.height,l=t.width/e.width;return{scale:Math.min(l,i),valign:U.Middle}}function pt(t,e,i){let l=2;return i!==void 0&&i.radius!==void 0&&(l=i.radius),Ce({width:t.width-l*(2-Math.sqrt(2)),height:t.height-l*(2-Math.sqrt(2))},e)}function gt(t,e,i,l,n,o){var r=t.px(i.top)||0,u=t.px(i.bottom)||0,h=t.px(i.left)||0,g=t.px(i.right)||0,y=t.px(o),s=t.gfxFactory.createGraphics(l);s.font=L(V,t.options.shieldFont),s.textAlign="center",s.textBaseline="top";var a=s.measureText(e),f=a.width,p=a.actualBoundingBoxDescent,S=l.height-r-u,d=l.width-h-g,c=h+d/2;let w=We[n.constraintFunc],x=w({height:S,width:d},{height:p,width:f},n.options);var m=Math.min(y,V*x.scale);s.font=L(m,t.options.shieldFont),s.textAlign="center",s.textBaseline="top",a=s.measureText(e),p=a.actualBoundingBoxDescent;var b;switch(x.valign){case U.Top:b=r;break;case U.Bottom:b=r+S-p;break;case U.Middle:default:b=r+(S-p)/2;break}return{xBaseline:c,yBaseline:b,fontPx:m}}var yt={padding:{top:0,bottom:0,left:0,right:0}};function $(t,e,i,l){i==null&&(i=yt);var n=i.padding||{},o={constraintFunc:"rect"},r=14;return typeof i.textLayout<"u"&&(o=i.textLayout),typeof i.maxFontSize<"u"&&(r=Math.min(r,i.maxFontSize)),gt(t,e,n,l,o,r)}function Te(t,e,i,l){ve(t,e,l),e.fillText(i,l.xBaseline,l.yBaseline)}function re(t,e,i,l){ve(t,e,l),e.shadowColor=e.strokeStyle,e.shadowBlur=0,e.lineWidth=t.px(2),e.strokeText(i,l.xBaseline,l.yBaseline),e.shadowColor=null,e.shadowBlur=null}function ve(t,e,i){e.textAlign="center",e.textBaseline="top",e.font=L(i.fontPx,t.options.shieldFont)}function Me(t,e,i,l){var n=$(t,i,null,{width:e.canvas.width,height:H-void 0});e.fillStyle=t.options.bannerTextColor,e.font=L(n.fontPx,t.options.shieldFont),e.textBaseline="top",e.textAlign="center",e.fillText(i,n.xBaseline,n.yBaseline+l*H-void 0)}function Re(t,e,i,l){var n=$(t,i,null,{width:e.canvas.width,height:H-void 0});e.strokeStyle=e.shadowColor=t.options.bannerTextHaloColor,e.font=L(n.fontPx,t.options.shieldFont),e.textBaseline="top",e.textAlign="center",e.shadowBlur=0,e.lineWidth=t.px(2),e.strokeText(i,n.xBaseline,n.yBaseline+l*H-void 0),e.shadowColor=null,e.shadowBlur=null}function ae(t,e,i){var l=t.emptySprite();return l.font=L(i,t.options.shieldFont),Math.ceil(l.measureText(e).width)}var We={};function Y(t,e){We[t]=e}Y("ellipse",st);Y("rect",Ce);Y("roundedRect",pt);Y("southHalfEllipse",ft);function St(t,e,i){K(t,e,{fillColor:"white",strokeColor:"black",outlineWidth:1,radius:2,rectWidth:20});let l=i.fillColor,n=t.px(.5),o=t.shieldSize()/3-n;return e.beginPath(),e.arc(t.shieldSize()/2,t.shieldSize()/2,o,0,2*Math.PI,!1),e.fillStyle=l,e.strokeStyle=i.strokeColor,e.fill(),e.lineWidth=n,e.stroke(),e}function ct(t,e,i){K(t,e,{fillColor:"#006747",strokeColor:"white",outlineWidth:1,radius:2,rectWidth:20});let l=i.fillColor,n=t.px(.5),o=.15*t.shieldSize()+n,r=.7*t.shieldSize()-2*n,u=.4*t.shieldSize()+n,h=.45*t.shieldSize()-2*n;return e.beginPath(),e.rect(o,u,r,h),e.fillStyle=l,e.strokeStyle=i.strokeColor,e.fill(),e.lineWidth=n,e.stroke(),e}function Be(){z("branson",ct,20),z("paBelt",St,20)}var ze=20,Ie=34,_e=18;function I(t,e,i,l){if(de[l]!==void 0)return t.px(de[l]);let n=e.rectWidth==null?null:e.rectWidth,o=e.angle==null?0:e.angle,r=Math.tan(o);if(n==null){let u=ae(t,i,t.px(_e))+t.px(2),h=t.px(ze);switch(l){case"pentagon":let g=e.offset==null?0:e.offset;u+=(t.shieldSize()-t.px(g))*r/2;break;case"trapezoid":u+=t.shieldSize()*r/2;break;case"triangle":h+=t.px(2);break;case"diamond":case"hexagonHorizontal":h+=t.px(4);break}return Math.max(h,Math.min(t.px(Ie),u))}else return t.px(n)}function wt(t,e,i,l){let n=i.fillColor==null?"white":i.fillColor,o=i.strokeColor==null?"black":i.strokeColor,r=I(t,i,l),u=t.px(1),h=r/2-u,g=t.shieldSize()/2-u;return e.beginPath(),e.ellipse(e.canvas.width/2,t.shieldSize()/2,h,g,0,2*Math.PI,!1),e.fillStyle=n,e.fill(),e.lineWidth=u,e.strokeStyle=o,e.stroke(),r}function He(t,e){var i=ae(t,e,t.px(_e))+t.px(2),l=Math.max(t.px(ze),Math.min(t.px(Ie),i));return t.gfxFactory.createGraphics({width:l,height:t.shieldSize()})}function K(t,e,i,l){let n=i.fillColor==null?"white":i.fillColor,o=i.strokeColor==null?"black":i.strokeColor,r=i.radius==null?0:i.radius,u=i.outlineWidth==null?1:i.outlineWidth,h=I(t,i,l),g=t.px(u),y=g/2,s=t.px(r),a=y,f=y+s,p=h-y-s,S=h-y,d=y,c=y+s,w=t.shieldSize()-y-s,x=t.shieldSize()-y;return e.beginPath(),e.moveTo(p,d),e.arcTo(S,d,S,c,s),e.arcTo(S,x,p,x,s),e.arcTo(a,x,a,w,s),e.arcTo(a,d,f,d,s),e.closePath(),e.lineWidth=g,e.fillStyle=n,e.fill(),o!=null&&(e.strokeStyle=o,e.stroke()),h}function xt(t,e,i,l){let n=i.offset==null?0:i.offset,o=i.fillColor==null?"white":i.fillColor,r=i.strokeColor==null?"black":i.strokeColor,u=i.radius==null?0:i.radius,h=i.outlineWidth==null?1:i.outlineWidth,g=I(t,i,l),y=t.px(h),s=y/2,a=t.px(u),f=t.px(n),p=s,S=g-s,d=s,c=t.shieldSize()-s,w=p+a,x=(p+S)/2,m=d+a,b=c-f,C=(2*p+x)/3,k=(x+2*S)/3,T=(b+c)/2,M=(T+2*c)/3;return e.beginPath(),e.moveTo(x,c),e.bezierCurveTo(C,M,p,T,p,b),e.arcTo(p,d,w,d,a),e.arcTo(S,d,S,m,a),e.lineTo(S,b),e.bezierCurveTo(S,T,k,M,x,c),e.closePath(),e.lineWidth=y,e.fillStyle=o,e.fill(),r!=null&&(e.strokeStyle=r,e.stroke()),g}function bt(t,e,i,l){let n=i.pointUp==null?!1:i.pointUp,o=i.fillColor==null?"white":i.fillColor,r=i.strokeColor==null?"black":i.strokeColor,u=i.outlineWidth==null?1:i.outlineWidth,h=n?-1:1,g=I(t,i,l),y=t.px(u),s=y/2,a=s,f=g-s,p=n?t.shieldSize()-s:s,S=n?s:t.shieldSize()-s,d=a+t.px(1),c=a+t.px(2.5),w=(a+f)/2,x=f-t.px(2.5),m=f-t.px(1),b=p+h*t.px(2),C=p+h*t.px(4.5),k=p+h*t.px(7),T=S-h*t.px(6),M=S-h*t.px(1),v=(a+w)/2,R=(w+f)/2;e.beginPath(),e.moveTo(w,S),e.bezierCurveTo(v,M,a,T,a,k),e.bezierCurveTo(a,C,d,b,c,p),e.lineTo(x,p),e.bezierCurveTo(m,b,f,C,f,k),e.bezierCurveTo(f,T,R,M,w,S),e.closePath(),e.lineWidth=y,e.fillStyle=o,e.fill(),r!=null&&(e.strokeStyle=r,e.stroke())}function mt(t,e,i,l){let n=i.pointUp==null?!1:i.pointUp,o=i.fillColor==null?"white":i.fillColor,r=i.strokeColor==null?"black":i.strokeColor,u=i.radius==null?0:i.radius,h=i.outlineWidth==null?1:i.outlineWidth,g=n?-1:1,y=I(t,i,l,"triangle"),s=t.px(h),a=s/2,f=t.px(u),p=a,S=y-a,d=n?t.shieldSize()-a:a,c=n?a:t.shieldSize()-a,w=p+f,x=(p+S)/2,m=S-f,b=d+g*f,C=Math.atan((x-w)/Math.abs(c-f-b)),k=Math.sin(C),T=Math.cos(C),M=Math.tan(C/2),v=Math.tan(Math.PI/4-C/2),R=w-f*T,W=x-f*v,F=x+f*v,_=m+f*T,P=b+g*f*M,B=b+g*f*k,G=c-g*f*(1-k);return e.beginPath(),e.moveTo(x,c),e.arcTo(W,c,R,B,f),e.arcTo(p,P,p,b,f),e.arcTo(p,d,w,d,f),e.arcTo(S,d,S,b,f),e.arcTo(S,P,_,B,f),e.arcTo(F,c,x,c,f),e.closePath(),e.lineWidth=s,e.fillStyle=o,e.fill(),r!=null&&(e.strokeStyle=r,e.stroke()),y}function kt(t,e,i,l){let n=i.shortSideUp==null?!1:i.shortSideUp,o=i.angle==null?0:i.angle,r=i.fillColor==null?"white":i.fillColor,u=i.strokeColor==null?"black":i.strokeColor,h=i.radius==null?0:i.radius,g=i.outlineWidth==null?1:i.outlineWidth,y=n?-1:1,s=Math.sin(o),a=Math.cos(o),f=Math.tan(o),p=I(t,i,l,"trapezoid"),S=t.px(g),d=S/2,c=t.px(h),w=d,x=p-d,m=n?t.shieldSize()-d:d,b=n?d:t.shieldSize()-d,C=m+y*c*(1+s),k=b-y*c*(1-s),T=w+(C-m)*f,M=T+c*a,v=w+y*(k-m)*f,R=w+y*(b-m)*f,W=v+y*c*a,F=p-R,_=p-v,P=p-M;return e.beginPath(),e.moveTo(P,m),e.arcTo(x,m,_,k,c),e.arcTo(F,b,W,b,c),e.arcTo(R,b,T,C,c),e.arcTo(w,m,P,m,c),e.closePath(),e.lineWidth=S,e.fillStyle=r,e.fill(),u!=null&&(e.strokeStyle=u,e.stroke()),p}function Ct(t,e,i,l){let n=i.fillColor==null?"white":i.fillColor,o=i.strokeColor==null?"black":i.strokeColor,r=i.radius==null?0:i.radius,u=i.outlineWidth==null?1:i.outlineWidth,h=Z(t,"diamond"),g=I(t,i,l,"diamond"),y=t.px(u),s=y/2,a=t.px(r),f=s,p=g-s,S=s,d=h-s,c=(f+p)/2,w=(S+d)/2,x=Math.atan((c-a-f)/(d-a-w)),m=Math.sin(x),b=Math.cos(x),C=Math.tan(x/2),k=Math.tan(Math.PI/4-x/2),T=f+a*(1-b),M=c-a*b,v=c-a*k,R=c+a*k,W=c+a*b,F=p-a*(1-b),_=S+a*(1-m),P=w-a*m,B=w-a*C,G=w+a*C,A=w+a*m,O=d-a*(1-m);return e.beginPath(),e.moveTo(c,d),e.arcTo(v,d,T,A,a),e.arcTo(f,G,f,w,a),e.arcTo(f,B,M,_,a),e.arcTo(v,S,c,S,a),e.arcTo(R,S,F,P,a),e.arcTo(p,B,p,w,a),e.arcTo(p,G,W,O,a),e.arcTo(R,d,c,d,a),e.closePath(),e.lineWidth=y,e.fillStyle=n,e.fill(),o!=null&&(e.strokeStyle=o,e.stroke()),g}function Tt(t,e,i,l){let n=i.pointUp==null?!0:i.pointUp,o=i.offset==null?0:i.offset,r=i.angle==null?0:i.angle,u=i.fillColor==null?"white":i.fillColor,h=i.strokeColor==null?"black":i.strokeColor,g=i.radius1==null?0:i.radius1,y=i.radius2==null?0:i.radius2,s=i.outlineWidth==null?1:i.outlineWidth,a=n?-1:1,f=Math.sin(r),p=Math.cos(r),S=Math.tan(r),d=I(t,i,l,"pentagon"),c=t.px(s),w=c/2,x=t.px(g),m=t.px(y),b=t.px(o),C=w,k=d-w,T=n?t.shieldSize()-w:w,M=n?w:t.shieldSize()-w,v=M-a*b,R=C+a*(v-T)*S,W=(C+k)/2,F=k-a*(v-T)*S,_=Math.atan(b/(W-C)),P=(Math.PI/2-_+r)/2,B=Math.tan(P),G=(Math.PI/2-r)/2,A=Math.tan(G),O=C+x*B*f,j=R+m*A,E=F-m*A,X=k-x*B*f,J=v-a*x*B*p;return e.beginPath(),e.moveTo(W,M),e.arcTo(C,v,O,J,x),e.arcTo(R,T,j,T,m),e.lineTo(E,T),e.arcTo(F,T,X,J,m),e.arcTo(k,v,W,M,x),e.closePath(),e.lineWidth=c,e.fillStyle=u,e.fill(),h!=null&&(e.strokeStyle=h,e.stroke()),d}function vt(t,e,i,l){let n=i.offset==null?0:i.offset,o=i.fillColor==null?"white":i.fillColor,r=i.strokeColor==null?"black":i.strokeColor,u=i.radius==null?0:i.radius,h=i.outlineWidth==null?1:i.outlineWidth,g=I(t,i,l),y=t.px(h),s=y/2,a=t.px(u),f=t.px(n),p=s,S=g-s,d=s,c=t.shieldSize()-s,w=(p+S)/2,x=d+f,m=c-f,b=a*Math.tan(Math.PI/4-Math.asin(f/(w-p))/2),C=x+b,k=m-b;return e.beginPath(),e.moveTo(w,c),e.arcTo(p,m,p,k,a),e.arcTo(p,x,w,d,a),e.lineTo(w,d),e.arcTo(S,x,S,C,a),e.arcTo(S,m,w,c,a),e.lineTo(w,c),e.closePath(),e.lineWidth=y,e.fillStyle=o,e.fill(),r!=null&&(e.strokeStyle=r,e.stroke()),g}function Mt(t,e,i,l){let n=i.angle==null?0:i.angle,o=i.fillColor==null?"white":i.fillColor,r=i.strokeColor==null?"black":i.strokeColor,u=i.radius==null?0:i.radius,h=i.outlineWidth==null?1:i.outlineWidth,g=Math.sin(n),y=Math.cos(n),s=Math.tan(n),a=Math.tan(Math.PI/4-n/2),f=I(t,i,l,"hexagonHorizontal"),p=t.px(h),S=p/2,d=t.px(u),c=S,w=f-S,x=S,m=t.shieldSize()-S,b=(x+m)/2,C=x+d*a*y,k=b-d*g,T=b+d*g,M=m-d*a*y,v=c+(b-k)*s,R=c+(b-x)*s,W=w-(b-x)*s,F=w-(b-k)*s,_=R-d*a*g,P=R+d*a,B=W-d*a,G=W+d*a*g;return e.beginPath(),e.moveTo(P,x),e.arcTo(W,x,G,C,d),e.arcTo(w,b,F,T,d),e.arcTo(W,m,B,m,d),e.arcTo(R,m,_,M,d),e.arcTo(c,b,v,k,d),e.arcTo(R,x,P,x,d),e.closePath(),e.lineWidth=p,e.fillStyle=o,e.fill(),r!=null&&(e.strokeStyle=r,e.stroke()),f}function Rt(t,e,i,l){let n=i.offset==null?0:i.offset,o=i.angle==null?0:i.angle,r=i.fillColor==null?"white":i.fillColor,u=i.strokeColor==null?"black":i.strokeColor,h=i.radius==null?0:i.radius,g=i.outlineWidth==null?1:i.outlineWidth,y=Math.sin(o),s=Math.cos(o),a=Math.tan(o),f=I(t,i,l),p=t.px(g),S=p/2,d=t.px(h),c=t.px(n),w=S,x=f-S,m=S,b=t.shieldSize()-S,C=w+d*a*y,k=(w+x)/2,T=x-d*a*y,M=m+c,v=(m+b)/2,R=b-c,W=w+(v-M)*a,F=x-(v-M)*a,_=v-d*a*s,P=v+d*a*s,B=Math.atan(c/(k-W)),G=Math.sin(B),A=Math.cos(B),O=(Math.PI/2-o-B)/2,j=Math.cos(O),E=d*Math.cos(o+O)/j,X=d*Math.sin(o+O)/j,J=W+E-d*s,Ve=W+E-d*G,$e=F-E+d*G,je=F-E+d*s,Je=M+X-d*A,Qe=M+X-d*y,Ye=R-X+d*y,Ke=R-X+d*A;return e.beginPath(),e.moveTo(k,b),e.arcTo(W,R,J,Ye,d),e.arcTo(w,v,C,_,d),e.arcTo(W,M,Ve,Je,d),e.lineTo(k,m),e.arcTo(F,M,je,Qe,d),e.arcTo(x,v,T,P,d),e.arcTo(F,R,$e,Ke,d),e.lineTo(k,b),e.closePath(),e.lineWidth=p,e.fillStyle=r,e.fill(),u!=null&&(e.strokeStyle=u,e.stroke()),f}function Z(t,e){switch(e){case"diamond":return t.shieldSize()+t.px(4);default:return t.shieldSize()}}function Ge(t,e,i,l,n){return Ae[e](t,i,l,n)}var Ae={},de={};function z(t,e,i){Ae[t]=e,i!==void 0&&(de[t]=i)}z("diamond",Ct);z("ellipse",wt);z("escutcheon",xt);z("fishhead",bt);z("hexagonVertical",vt);z("hexagonHorizontal",Mt);z("octagonVertical",Rt);z("pentagon",Tt);z("roundedRectangle",K);z("trapezoid",kt);z("triangle",mt);Be();var H=9;function Oe(t,e,i,l){if(i==null||typeof i.banners>"u")return e;for(var n=0;n<i.banners.length;n++)l(t,e,i.banners[n],n);return e}function Wt(t,e,i){return{width:e.width,height:e.height+i*t.px(H)}}function he(t){return t!==null&&t.length!==0&&t.length<=6}function ue(t){return t==null||typeof t.banners>"u"?0:t.banners.length}function Le(t,e,i){var l=null,n,o=0,r;if(Array.isArray(e.spriteBlank))for(var u=0;u<e.spriteBlank.length&&(l=t.spriteRepo.getSprite(e.spriteBlank[u]),r=Wt(t,l.data,o),n=$(t,i.ref,e,r),!(n.fontPx>t.px(V)));u++);else l=t.spriteRepo.getSprite(e.spriteBlank);return l}function Ft(t){return t!=null&&typeof t.textColor<"u"?t.textColor:"black"}function Ee(t){return typeof t.shapeBlank<"u"?(e,i,l)=>Ge(e,t.shapeBlank.drawFunc,i,t.shapeBlank.params,l):He}function Bt(t,e,i,l){let o=ue(i)*t.px(H);e.save(),e.translate(0,o),Ee(i)(t,e,l.ref),e.restore()}function Pt(t,e){return typeof e.shapeBlank<"u"?Z(t,e.shapeBlank.drawFunc):t.shieldSize()}function zt(t,e,i,l){var n=ue(i),o=null,r=Le(t,i,l);let u=n*t.px(H);if(r==null?(e.translate(0,u),Ee(i)(t,e,l.ref),e.translate(0,-u),o={width:e.canvas.width,height:Pt(t,i)}):o={width:r.data.width,height:r.data.height},i.notext)return e;var h=$(t,l.ref,i,o);return h.yBaseline+=n*t.px(H),typeof t.options.SHIELD_TEXT_HALO_COLOR_OVERRIDE<"u"?(e.strokeStyle=options.SHIELD_TEXT_HALO_COLOR_OVERRIDE,re(t,e,l.ref,h)):i.textHaloColor&&(e.strokeStyle=i.textHaloColor,re(t,e,l.ref,h)),e.fillStyle=Ft(i),Te(t,e,l.ref,h),t.options.SHIELD_TEXT_BBOX_COLOR&&(e.strokeStyle=t.options.SHIELD_TEXT_BBOX_COLOR,e.lineWidth=t.px(1),e.strokeRect(t.px(i.padding.left-.5),n*t.px(H)+t.px(i.padding.top-.5),o.width-t.px(i.padding.left+i.padding.right-1),o.height-t.px(i.padding.top+i.padding.bottom-1))),e}function Xe(t,e){let i=se(t,e);i==null&&(console.warn("Didn't produce a shield for",JSON.stringify(e)),i=t.gfxFactory.createGraphics({width:1,height:1})),Ne(t,e.spriteID,i)}function Ne(t,e,i){let l=i.getImageData(0,0,i.canvas.width,i.canvas.height);t.spriteRepo.putSprite(e,{width:i.canvas.width,height:i.canvas.height,data:l.data},t.px(1))}function Ue(t,e){Ne(t,e,t.emptySprite())}function qe(t,e){return e.refsByName&&t.name&&e.refsByName[t.name]?e.refsByName[t.name]:t.ref}function It(t,e){var i=t[e.network];if(e==null)return null;if(i==null)return console.debug("Generic shield for",JSON.stringify(e)),he(e.ref)?t.default:null;var l=qe(e,i);return i.overrideByRef&&(i={...i,...i.overrideByRef[l]}),i.overrideByName&&(i={...i,...i.overrideByName[e.name||""]}),!he(l)&&"noref"in i&&(i=i.noref,i.notext=!0),!he(l)&&!i.notext&&!(i.refsByName&&e.name)?null:i}function _t(t){let e=parseInt(t,10);if(isNaN(e))return t;let i="M".repeat(e/1e3)+"D".repeat(e%1e3/500)+"C".repeat(e%500/100)+"L".repeat(e%100/50)+"X".repeat(e%50/10)+"V".repeat(e%10/5)+"I".repeat(e%5);return i=i.replace("DCCCC","CM").replace("CCCC","CD").replace("LXXXX","XC").replace("XXXX","XL").replace("VIIII","IX").replace("IIII","IV"),i+t.slice(e.toString().length)}function Ht(t,e,i){let l=Math.max(t.shieldSize(),I(t,e.shapeBlank.params,i,e.shapeBlank.drawFunc)),n=Z(t,e.shapeBlank.drawFunc);return{width:l,height:n}}function se(t,e){let i=It(t.shieldDef,e);if(i==null)return null;e.ref=qe(e,i);let l=ue(i),n=Le(t,i,e),o=t.shieldSize(),r=t.shieldSize();if(n==null){if(typeof i.shapeBlank<"u"){let g=Ht(t,i,e.ref);o=g.width,r=g.height}}else o=n.data.width,r=n.data.height;let u=l*t.px(H);r+=u;let h=t.gfxFactory.createGraphics({width:o,height:r});return e.ref&&i.numberingSystem==="roman"&&(e.ref=_t(e.ref)),Oe(t,h,i,Re),n==null?Bt(t,h,i,e):oe(h,n,u,i.verticalReflect,i.colorLighten,i.colorDarken),zt(t,h,i,e),Oe(t,h,i,Me),h}function De(){return(typeof window<"u"&&window.devicePixelRatio)>1?2:1}var ee=class{createGraphics(e){var i=document.createElement("canvas").getContext("2d"),i=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});return i.imageSmoothingQuality="high",i.textAlign="center",i.textBaseline="top",i.canvas.width=e.width,i.canvas.height=e.height,i}pixelRatio(){return De()}};var fe=class{shieldDef;options;debugOptions;gfxFactory;spriteRepo;_emptySpriteCache;emptySprite(){return this._emptySpriteCache||(this._emptySpriteCache=this.gfxFactory.createGraphics({width:1,height:1})),this._emptySpriteCache}px(e){return e*this.gfxFactory.pixelRatio()}shieldSize(){return this.px(this.options.shieldSize)}},pe=class{map;constructor(e){this.map=e}getSprite(e){return this.map.style.getImage(e)}putSprite(e,i,l){this.map.addImage(e,i,{pixelRatio:l})}},te=class{_shieldPredicate=()=>!0;_networkPredicate=()=>!0;_routeParser;_renderContext;constructor(e){this._routeParser=e,this._renderContext=new fe,this._renderContext.gfxFactory=new ee}setShields(e){this._renderContext.options=e.options,this._renderContext.shieldDef=e.networks}debugOptions(e){return this._renderContext.debugOptions=e,this}filterImageID(e){return this._shieldPredicate=e,this}filterNetwork(e){return this._networkPredicate=e,this}graphicsFactory(e){return this._renderContext.gfxFactory=e,this}renderOnMaplibreGL(e){return this.renderOnRepository(new pe(e)),e.on("styleimagemissing",this.getStyleImageMissingHandler()),this}renderOnRepository(e){return this._renderContext.spriteRepo||(this._renderContext.spriteRepo=e),this}getStyleImageMissingHandler(){return e=>{try{if(!this._shieldPredicate(e.id))return;let i=this._routeParser.parse(e.id);if(!this._networkPredicate(i.network)){Ue(this._renderContext,e.id);return}i.spriteID=e.id,this._renderContext.debugOptions=this.debugOptions,i&&Xe(this._renderContext,i)}catch(i){console.error(`Exception while loading image \u2018${e?.id}\u2019:
`,i)}}}getGraphicForRoute(e,i,l){return se(this._renderContext,{network:e,ref:i,name:l,spriteID:this._routeParser.format(e,i,l)})}emptySprite(){return this._renderContext.emptySprite()}createGraphics(e){return this._renderContext.gfxFactory.createGraphics(e)}pixelRatio(){return this._renderContext.px(1)}},ge=class extends te{constructor(e,i){super(i),this.setShields(e)}},ye=class extends te{constructor(e,i){super(i),this.setShieldURL(e)}async setShieldURL(e){await fetch(e).then(i=>i.json()).then(i=>super.setShields(i)).catch(i=>console.error(i))}},ie=class{sprites={};getSprite(e){return this.sprites[e]}hasSprite(e){return e in this.sprites}putSprite(e,i){this.sprites[e]=i}},Kt=new ie;export{ie as InMemorySpriteRepository,ge as ShieldRenderer,ye as URLShieldRenderer,De as getDOMPixelRatio,oe as transposeImageData};
var Ye=Object.create;var ge=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Ze=Object.getOwnPropertyNames;var et=Object.getPrototypeOf,tt=Object.prototype.hasOwnProperty;var it=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var lt=(t,e,i,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ze(e))!tt.call(t,n)&&n!==i&&ge(t,n,{get:()=>e[n],enumerable:!(l=Ke(e,n))||l.enumerable});return t};var nt=(t,e,i)=>(i=t!=null?Ye(et(t)):{},lt(e||!t||!t.__esModule?ge(i,"default",{value:t,enumerable:!0}):i,t));var Se=it((Ht,ye)=>{"use strict";ye.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var te=nt(Se(),1),we=ot,ce={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function ot(t){var e,i=[],l=1,n;if(typeof t=="string")if(te.default[t])i=te.default[t].slice(),n="rgb";else if(t==="transparent")l=0,n="rgb",i=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var o=t.slice(1),r=o.length,s=r<=4;l=1,s?(i=[parseInt(o[0]+o[0],16),parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16)],r===4&&(l=parseInt(o[3]+o[3],16)/255)):(i=[parseInt(o[0]+o[1],16),parseInt(o[2]+o[3],16),parseInt(o[4]+o[5],16)],r===8&&(l=parseInt(o[6]+o[7],16)/255)),i[0]||(i[0]=0),i[1]||(i[1]=0),i[2]||(i[2]=0),n="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var h=e[1],g=h==="rgb",o=h.replace(/a$/,"");n=o;var r=o==="cmyk"?4:o==="gray"?1:3;i=e[2].trim().split(/\s*[,\/]\s*|\s+/).map(function(a,f){if(/%$/.test(a))return f===r?parseFloat(a)/100:o==="rgb"?parseFloat(a)*255/100:parseFloat(a);if(o[f]==="h"){if(/deg$/.test(a))return parseFloat(a);if(ce[a]!==void 0)return ce[a]}return parseFloat(a)}),h===o&&i.push(1),l=g||i[r]===void 0?1:i[r],i=i.slice(0,r)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(i=t.match(/([0-9]+)/g).map(function(y){return parseFloat(y)}),n=t.match(/([a-z])/ig).join("").toLowerCase());else isNaN(t)?Array.isArray(t)||t.length?(i=[t[0],t[1],t[2]],n="rgb",l=t.length===4?t[3]:1):t instanceof Object&&(t.r!=null||t.red!=null||t.R!=null?(n="rgb",i=[t.r||t.red||t.R||0,t.g||t.green||t.G||0,t.b||t.blue||t.B||0]):(n="hsl",i=[t.h||t.hue||t.H||0,t.s||t.saturation||t.S||0,t.l||t.lightness||t.L||t.b||t.brightness]),l=t.a||t.alpha||t.opacity||1,t.opacity!=null&&(l/=100)):(n="rgb",i=[t>>>16,(t&65280)>>>8,t&255]);return{space:n,values:i,alpha:l}}var U={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]};var j={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e=t[0]/360,i=t[1]/100,l=t[2]/100,n,o,r,s,h;if(i===0)return h=l*255,[h,h,h];l<.5?o=l*(1+i):o=l+i-l*i,n=2*l-o,s=[0,0,0];for(var g=0;g<3;g++)r=e+1/3*-(g-1),r<0?r++:r>1&&r--,6*r<1?h=n+(o-n)*6*r:2*r<1?h=o:3*r<2?h=n+(o-n)*(2/3-r)*6:h=n,s[g]=h*255;return s}};U.hsl=function(t){var e=t[0]/255,i=t[1]/255,l=t[2]/255,n=Math.min(e,i,l),o=Math.max(e,i,l),r=o-n,s,h,g;return o===n?s=0:e===o?s=(i-l)/r:i===o?s=2+(l-e)/r:l===o&&(s=4+(e-i)/r),s=Math.min(s*60,360),s<0&&(s+=360),g=(n+o)/2,o===n?h=0:g<=.5?h=r/(o+n):h=r/(2-o-n),[s,h*100,g*100]};function X(t){Array.isArray(t)&&t.raw&&(t=String.raw(...arguments));var e,i,l,n=we(t);if(!n.space)return[];let o=n.space[0]==="h"?j.min:U.min,r=n.space[0]==="h"?j.max:U.max;return e=Array(3),e[0]=Math.min(Math.max(n.values[0],o[0]),r[0]),e[1]=Math.min(Math.max(n.values[1],o[1]),r[1]),e[2]=Math.min(Math.max(n.values[2],o[2]),r[2]),n.space[0]==="h"&&(e=j.rgb(e)),e.push(Math.min(Math.max(n.alpha,0),1)),e}var rt='"sans-serif-condensed", "Arial Narrow", sans-serif',O=(t,e)=>`bold ${t}px ${e||rt}`,q=12;function ie(t,e,i){return 255-t/255*(255-i)-(1-t/255)*(255-e)}function at(t,e,i,l){e[l]=t[i],e[l+1]=t[i+1],e[l+2]=t[i+2],e[l+3]=t[i+3]}function dt(t,e,i,l,n,o){e[l]=ie(t[i],n[0],o[0]),e[l+1]=ie(t[i+1],n[1],o[1]),e[l+2]=ie(t[i+2],n[2],o[2]),e[l+3]=t[i+3]}function le(t,e,i,l,n,o){let r=t.createImageData(e.data.width,e.data.height),s=n||o?dt:at,h=n?X(n):X("#000"),g=o?X(o):X("#fff");if(l)for(let y=0;y<e.data.height;y++)for(let u=0;u<e.data.width;u++){let f=((e.data.height-y-1)*e.data.width+u)*4,p=(y*e.data.width+u)*4;s(e.data.data,r.data,p,f,h,g)}else for(let y=0;y<e.data.data.length;y+=4)s(e.data.data,r.data,y,y,h,g);t.putImageData(r,0,i)}var N={Middle:"middle",Top:"top",Bottom:"bottom"};function xe(t,e){var i=t.width,l=t.height,n=e.width,o=e.height;return i*l/Math.sqrt(i*i*o*o+l*l*n*n)}function ht(t,e){return{scale:xe(t,e),valign:N.Middle}}function st(t,e){return{scale:xe(t,{height:e.width/2,width:e.height}),valign:N.Top}}function me(t,e){var i=t.height/e.height,l=t.width/e.width;return{scale:Math.min(l,i),valign:N.Middle}}function ut(t,e,i){let l=2;return i!==void 0&&i.radius!==void 0&&(l=i.radius),me({width:t.width-l*(2-Math.sqrt(2)),height:t.height-l*(2-Math.sqrt(2))},e)}function ft(t,e,i,l,n,o){var r=t.px(i.top)||0,s=t.px(i.bottom)||0,h=t.px(i.left)||0,g=t.px(i.right)||0,y=t.px(o),u=t.gfxFactory.createGraphics(l);u.font=O(q,t.options.shieldFont),u.textAlign="center",u.textBaseline="top";var a=u.measureText(e),f=a.width,p=a.actualBoundingBoxDescent,S=l.height-r-s,d=l.width-h-g,c=h+d/2;let w=Me[n.constraintFunc],b=w({height:S,width:d},{height:p,width:f},n.options);var m=Math.min(y,q*b.scale);u.font=O(m,t.options.shieldFont),u.textAlign="center",u.textBaseline="top",a=u.measureText(e),p=a.actualBoundingBoxDescent;var x;switch(b.valign){case N.Top:x=r;break;case N.Bottom:x=r+S-p;break;case N.Middle:default:x=r+(S-p)/2;break}return{xBaseline:c,yBaseline:x,fontPx:m}}var pt={padding:{top:0,bottom:0,left:0,right:0}};function D(t,e,i,l){i==null&&(i=pt);var n=i.padding||{},o={constraintFunc:"rect"},r=14;return typeof i.textLayout<"u"&&(o=i.textLayout),typeof i.maxFontSize<"u"&&(r=Math.min(r,i.maxFontSize)),ft(t,e,n,l,o,r)}function ke(t,e,i,l){Ce(t,e,l),e.fillText(i,l.xBaseline,l.yBaseline)}function ne(t,e,i,l){Ce(t,e,l),e.shadowColor=e.strokeStyle,e.shadowBlur=0,e.lineWidth=t.px(2),e.strokeText(i,l.xBaseline,l.yBaseline),e.shadowColor=null,e.shadowBlur=null}function Ce(t,e,i){e.textAlign="center",e.textBaseline="top",e.font=O(i.fontPx,t.options.shieldFont)}function Te(t,e,i,l){let n={padding:{top:t.options.bannerPadding,bottom:0,left:0,right:0}};var o=D(t,i,n,{width:e.canvas.width,height:t.options.bannerHeight-t.options.bannerPadding});e.fillStyle=t.options.bannerTextColor,e.font=O(o.fontPx,t.options.shieldFont),e.textBaseline="top",e.textAlign="center",e.fillText(i,o.xBaseline,o.yBaseline+l*t.options.bannerHeight-t.options.bannerPadding)}function ve(t,e,i,l){let n={padding:{top:t.options.bannerPadding,bottom:0,left:0,right:0}};var o=D(t,i,n,{width:e.canvas.width,height:t.options.bannerHeight-t.options.bannerPadding});e.strokeStyle=e.shadowColor=t.options.bannerTextHaloColor,e.font=O(o.fontPx,t.options.shieldFont),e.textBaseline="top",e.textAlign="center",e.shadowBlur=0,e.lineWidth=t.px(2),e.strokeText(i,o.xBaseline,o.yBaseline+l*t.options.bannerHeight-t.options.bannerPadding),e.shadowColor=null,e.shadowBlur=null}function oe(t,e,i){var l=t.emptySprite();return l.font=O(i,t.options.shieldFont),Math.ceil(l.measureText(e).width)}var Me={};function J(t,e){Me[t]=e}J("ellipse",ht);J("rect",me);J("roundedRect",ut);J("southHalfEllipse",st);function gt(t,e,i){Q(t,e,{fillColor:"white",strokeColor:"black",outlineWidth:1,radius:2,rectWidth:20});let l=i.fillColor,n=t.px(.5),o=t.shieldSize()/3-n;return e.beginPath(),e.arc(t.shieldSize()/2,t.shieldSize()/2,o,0,2*Math.PI,!1),e.fillStyle=l,e.strokeStyle=i.strokeColor,e.fill(),e.lineWidth=n,e.stroke(),e}function yt(t,e,i){Q(t,e,{fillColor:"#006747",strokeColor:"white",outlineWidth:1,radius:2,rectWidth:20});let l=i.fillColor,n=t.px(.5),o=.15*t.shieldSize()+n,r=.7*t.shieldSize()-2*n,s=.4*t.shieldSize()+n,h=.45*t.shieldSize()-2*n;return e.beginPath(),e.rect(o,s,r,h),e.fillStyle=l,e.strokeStyle=i.strokeColor,e.fill(),e.lineWidth=n,e.stroke(),e}function We(){I("branson",yt,20),I("paBelt",gt,20)}var Fe=20,Be=34,Ie=18;function z(t,e,i,l){if(re[l]!==void 0)return t.px(re[l]);let n=e.rectWidth==null?null:e.rectWidth,o=e.angle==null?0:e.angle,r=Math.tan(o);if(n==null){let s=oe(t,i,t.px(Ie))+t.px(2),h=t.px(Fe);switch(l){case"pentagon":let g=e.offset==null?0:e.offset;s+=(t.shieldSize()-t.px(g))*r/2;break;case"trapezoid":s+=t.shieldSize()*r/2;break;case"triangle":h+=t.px(2);break;case"diamond":case"hexagonHorizontal":h+=t.px(4);break}return Math.max(h,Math.min(t.px(Be),s))}else return t.px(n)}function St(t,e,i,l){let n=i.fillColor==null?"white":i.fillColor,o=i.strokeColor==null?"black":i.strokeColor,r=z(t,i,l),s=t.px(1),h=r/2-s,g=t.shieldSize()/2-s;return e.beginPath(),e.ellipse(e.canvas.width/2,t.shieldSize()/2,h,g,0,2*Math.PI,!1),e.fillStyle=n,e.fill(),e.lineWidth=s,e.strokeStyle=o,e.stroke(),r}function ze(t,e){var i=oe(t,e,t.px(Ie))+t.px(2),l=Math.max(t.px(Fe),Math.min(t.px(Be),i));return t.gfxFactory.createGraphics({width:l,height:t.shieldSize()})}function Q(t,e,i,l){let n=i.fillColor==null?"white":i.fillColor,o=i.strokeColor==null?"black":i.strokeColor,r=i.radius==null?0:i.radius,s=i.outlineWidth==null?1:i.outlineWidth,h=z(t,i,l),g=t.px(s),y=g/2,u=t.px(r),a=y,f=y+u,p=h-y-u,S=h-y,d=y,c=y+u,w=t.shieldSize()-y-u,b=t.shieldSize()-y;return e.beginPath(),e.moveTo(p,d),e.arcTo(S,d,S,c,u),e.arcTo(S,b,p,b,u),e.arcTo(a,b,a,w,u),e.arcTo(a,d,f,d,u),e.closePath(),e.lineWidth=g,e.fillStyle=n,e.fill(),o!=null&&(e.strokeStyle=o,e.stroke()),h}function ct(t,e,i,l){let n=i.offset==null?0:i.offset,o=i.fillColor==null?"white":i.fillColor,r=i.strokeColor==null?"black":i.strokeColor,s=i.radius==null?0:i.radius,h=i.outlineWidth==null?1:i.outlineWidth,g=z(t,i,l),y=t.px(h),u=y/2,a=t.px(s),f=t.px(n),p=u,S=g-u,d=u,c=t.shieldSize()-u,w=p+a,b=(p+S)/2,m=d+a,x=c-f,C=(2*p+b)/3,k=(b+2*S)/3,T=(x+c)/2,M=(T+2*c)/3;return e.beginPath(),e.moveTo(b,c),e.bezierCurveTo(C,M,p,T,p,x),e.arcTo(p,d,w,d,a),e.arcTo(S,d,S,m,a),e.lineTo(S,x),e.bezierCurveTo(S,T,k,M,b,c),e.closePath(),e.lineWidth=y,e.fillStyle=o,e.fill(),r!=null&&(e.strokeStyle=r,e.stroke()),g}function wt(t,e,i,l){let n=i.pointUp==null?!1:i.pointUp,o=i.fillColor==null?"white":i.fillColor,r=i.strokeColor==null?"black":i.strokeColor,s=i.outlineWidth==null?1:i.outlineWidth,h=n?-1:1,g=z(t,i,l),y=t.px(s),u=y/2,a=u,f=g-u,p=n?t.shieldSize()-u:u,S=n?u:t.shieldSize()-u,d=a+t.px(1),c=a+t.px(2.5),w=(a+f)/2,b=f-t.px(2.5),m=f-t.px(1),x=p+h*t.px(2),C=p+h*t.px(4.5),k=p+h*t.px(7),T=S-h*t.px(6),M=S-h*t.px(1),v=(a+w)/2,R=(w+f)/2;e.beginPath(),e.moveTo(w,S),e.bezierCurveTo(v,M,a,T,a,k),e.bezierCurveTo(a,C,d,x,c,p),e.lineTo(b,p),e.bezierCurveTo(m,x,f,C,f,k),e.bezierCurveTo(f,T,R,M,w,S),e.closePath(),e.lineWidth=y,e.fillStyle=o,e.fill(),r!=null&&(e.strokeStyle=r,e.stroke())}function bt(t,e,i,l){let n=i.pointUp==null?!1:i.pointUp,o=i.fillColor==null?"white":i.fillColor,r=i.strokeColor==null?"black":i.strokeColor,s=i.radius==null?0:i.radius,h=i.outlineWidth==null?1:i.outlineWidth,g=n?-1:1,y=z(t,i,l,"triangle"),u=t.px(h),a=u/2,f=t.px(s),p=a,S=y-a,d=n?t.shieldSize()-a:a,c=n?a:t.shieldSize()-a,w=p+f,b=(p+S)/2,m=S-f,x=d+g*f,C=Math.atan((b-w)/Math.abs(c-f-x)),k=Math.sin(C),T=Math.cos(C),M=Math.tan(C/2),v=Math.tan(Math.PI/4-C/2),R=w-f*T,W=b-f*v,P=b+f*v,_=m+f*T,B=x+g*f*M,F=x+g*f*k,H=c-g*f*(1-k);return e.beginPath(),e.moveTo(b,c),e.arcTo(W,c,R,F,f),e.arcTo(p,B,p,x,f),e.arcTo(p,d,w,d,f),e.arcTo(S,d,S,x,f),e.arcTo(S,B,_,F,f),e.arcTo(P,c,b,c,f),e.closePath(),e.lineWidth=u,e.fillStyle=o,e.fill(),r!=null&&(e.strokeStyle=r,e.stroke()),y}function xt(t,e,i,l){let n=i.shortSideUp==null?!1:i.shortSideUp,o=i.angle==null?0:i.angle,r=i.fillColor==null?"white":i.fillColor,s=i.strokeColor==null?"black":i.strokeColor,h=i.radius==null?0:i.radius,g=i.outlineWidth==null?1:i.outlineWidth,y=n?-1:1,u=Math.sin(o),a=Math.cos(o),f=Math.tan(o),p=z(t,i,l,"trapezoid"),S=t.px(g),d=S/2,c=t.px(h),w=d,b=p-d,m=n?t.shieldSize()-d:d,x=n?d:t.shieldSize()-d,C=m+y*c*(1+u),k=x-y*c*(1-u),T=w+(C-m)*f,M=T+c*a,v=w+y*(k-m)*f,R=w+y*(x-m)*f,W=v+y*c*a,P=p-R,_=p-v,B=p-M;return e.beginPath(),e.moveTo(B,m),e.arcTo(b,m,_,k,c),e.arcTo(P,x,W,x,c),e.arcTo(R,x,T,C,c),e.arcTo(w,m,B,m,c),e.closePath(),e.lineWidth=S,e.fillStyle=r,e.fill(),s!=null&&(e.strokeStyle=s,e.stroke()),p}function mt(t,e,i,l){let n=i.fillColor==null?"white":i.fillColor,o=i.strokeColor==null?"black":i.strokeColor,r=i.radius==null?0:i.radius,s=i.outlineWidth==null?1:i.outlineWidth,h=Y(t,"diamond"),g=z(t,i,l,"diamond"),y=t.px(s),u=y/2,a=t.px(r),f=u,p=g-u,S=u,d=h-u,c=(f+p)/2,w=(S+d)/2,b=Math.atan((c-a-f)/(d-a-w)),m=Math.sin(b),x=Math.cos(b),C=Math.tan(b/2),k=Math.tan(Math.PI/4-b/2),T=f+a*(1-x),M=c-a*x,v=c-a*k,R=c+a*k,W=c+a*x,P=p-a*(1-x),_=S+a*(1-m),B=w-a*m,F=w-a*C,H=w+a*C,G=w+a*m,A=d-a*(1-m);return e.beginPath(),e.moveTo(c,d),e.arcTo(v,d,T,G,a),e.arcTo(f,H,f,w,a),e.arcTo(f,F,M,_,a),e.arcTo(v,S,c,S,a),e.arcTo(R,S,P,B,a),e.arcTo(p,F,p,w,a),e.arcTo(p,H,W,A,a),e.arcTo(R,d,c,d,a),e.closePath(),e.lineWidth=y,e.fillStyle=n,e.fill(),o!=null&&(e.strokeStyle=o,e.stroke()),g}function kt(t,e,i,l){let n=i.pointUp==null?!0:i.pointUp,o=i.offset==null?0:i.offset,r=i.angle==null?0:i.angle,s=i.fillColor==null?"white":i.fillColor,h=i.strokeColor==null?"black":i.strokeColor,g=i.radius1==null?0:i.radius1,y=i.radius2==null?0:i.radius2,u=i.outlineWidth==null?1:i.outlineWidth,a=n?-1:1,f=Math.sin(r),p=Math.cos(r),S=Math.tan(r),d=z(t,i,l,"pentagon"),c=t.px(u),w=c/2,b=t.px(g),m=t.px(y),x=t.px(o),C=w,k=d-w,T=n?t.shieldSize()-w:w,M=n?w:t.shieldSize()-w,v=M-a*x,R=C+a*(v-T)*S,W=(C+k)/2,P=k-a*(v-T)*S,_=Math.atan(x/(W-C)),B=(Math.PI/2-_+r)/2,F=Math.tan(B),H=(Math.PI/2-r)/2,G=Math.tan(H),A=C+b*F*f,V=R+m*G,L=P-m*G,E=k-b*F*f,$=v-a*b*F*p;return e.beginPath(),e.moveTo(W,M),e.arcTo(C,v,A,$,b),e.arcTo(R,T,V,T,m),e.lineTo(L,T),e.arcTo(P,T,E,$,m),e.arcTo(k,v,W,M,b),e.closePath(),e.lineWidth=c,e.fillStyle=s,e.fill(),h!=null&&(e.strokeStyle=h,e.stroke()),d}function Ct(t,e,i,l){let n=i.offset==null?0:i.offset,o=i.fillColor==null?"white":i.fillColor,r=i.strokeColor==null?"black":i.strokeColor,s=i.radius==null?0:i.radius,h=i.outlineWidth==null?1:i.outlineWidth,g=z(t,i,l),y=t.px(h),u=y/2,a=t.px(s),f=t.px(n),p=u,S=g-u,d=u,c=t.shieldSize()-u,w=(p+S)/2,b=d+f,m=c-f,x=a*Math.tan(Math.PI/4-Math.asin(f/(w-p))/2),C=b+x,k=m-x;return e.beginPath(),e.moveTo(w,c),e.arcTo(p,m,p,k,a),e.arcTo(p,b,w,d,a),e.lineTo(w,d),e.arcTo(S,b,S,C,a),e.arcTo(S,m,w,c,a),e.lineTo(w,c),e.closePath(),e.lineWidth=y,e.fillStyle=o,e.fill(),r!=null&&(e.strokeStyle=r,e.stroke()),g}function Tt(t,e,i,l){let n=i.angle==null?0:i.angle,o=i.fillColor==null?"white":i.fillColor,r=i.strokeColor==null?"black":i.strokeColor,s=i.radius==null?0:i.radius,h=i.outlineWidth==null?1:i.outlineWidth,g=Math.sin(n),y=Math.cos(n),u=Math.tan(n),a=Math.tan(Math.PI/4-n/2),f=z(t,i,l,"hexagonHorizontal"),p=t.px(h),S=p/2,d=t.px(s),c=S,w=f-S,b=S,m=t.shieldSize()-S,x=(b+m)/2,C=b+d*a*y,k=x-d*g,T=x+d*g,M=m-d*a*y,v=c+(x-k)*u,R=c+(x-b)*u,W=w-(x-b)*u,P=w-(x-k)*u,_=R-d*a*g,B=R+d*a,F=W-d*a,H=W+d*a*g;return e.beginPath(),e.moveTo(B,b),e.arcTo(W,b,H,C,d),e.arcTo(w,x,P,T,d),e.arcTo(W,m,F,m,d),e.arcTo(R,m,_,M,d),e.arcTo(c,x,v,k,d),e.arcTo(R,b,B,b,d),e.closePath(),e.lineWidth=p,e.fillStyle=o,e.fill(),r!=null&&(e.strokeStyle=r,e.stroke()),f}function vt(t,e,i,l){let n=i.offset==null?0:i.offset,o=i.angle==null?0:i.angle,r=i.fillColor==null?"white":i.fillColor,s=i.strokeColor==null?"black":i.strokeColor,h=i.radius==null?0:i.radius,g=i.outlineWidth==null?1:i.outlineWidth,y=Math.sin(o),u=Math.cos(o),a=Math.tan(o),f=z(t,i,l),p=t.px(g),S=p/2,d=t.px(h),c=t.px(n),w=S,b=f-S,m=S,x=t.shieldSize()-S,C=w+d*a*y,k=(w+b)/2,T=b-d*a*y,M=m+c,v=(m+x)/2,R=x-c,W=w+(v-M)*a,P=b-(v-M)*a,_=v-d*a*u,B=v+d*a*u,F=Math.atan(c/(k-W)),H=Math.sin(F),G=Math.cos(F),A=(Math.PI/2-o-F)/2,V=Math.cos(A),L=d*Math.cos(o+A)/V,E=d*Math.sin(o+A)/V,$=W+L-d*u,qe=W+L-d*H,De=P-L+d*H,Ve=P-L+d*u,$e=M+E-d*G,je=M+E-d*y,Je=R-E+d*y,Qe=R-E+d*G;return e.beginPath(),e.moveTo(k,x),e.arcTo(W,R,$,Je,d),e.arcTo(w,v,C,_,d),e.arcTo(W,M,qe,$e,d),e.lineTo(k,m),e.arcTo(P,M,Ve,je,d),e.arcTo(b,v,T,B,d),e.arcTo(P,R,De,Qe,d),e.lineTo(k,x),e.closePath(),e.lineWidth=p,e.fillStyle=r,e.fill(),s!=null&&(e.strokeStyle=s,e.stroke()),f}function Y(t,e){switch(e){case"diamond":return t.shieldSize()+t.px(4);default:return t.shieldSize()}}function _e(t,e,i,l,n){return He[e](t,i,l,n)}var He={},re={};function I(t,e,i){He[t]=e,i!==void 0&&(re[t]=i)}I("diamond",mt);I("ellipse",St);I("escutcheon",ct);I("fishhead",wt);I("hexagonVertical",Ct);I("hexagonHorizontal",Tt);I("octagonVertical",vt);I("pentagon",kt);I("roundedRectangle",Q);I("trapezoid",xt);I("triangle",bt);We();function Ge(t,e,i,l){if(i==null||typeof i.banners>"u")return e;for(var n=0;n<i.banners.length;n++)l(t,e,i.banners[n],n);return e}function Mt(t,e,i){return{width:e.width,height:e.height+i*t.px(t.options.bannerHeight+t.options.bannerPadding)}}function ae(t){return t!==null&&t.length!==0&&t.length<=6}function de(t){return t==null||typeof t.banners>"u"?0:t.banners.length}function Ae(t,e,i){var l=null,n,o=0,r;if(Array.isArray(e.spriteBlank))for(var s=0;s<e.spriteBlank.length&&(l=t.spriteRepo.getSprite(e.spriteBlank[s]),r=Mt(t,l.data,o),n=D(t,i.ref,e,r),!(n.fontPx>t.px(q)));s++);else l=t.spriteRepo.getSprite(e.spriteBlank);return l}function Rt(t){return t!=null&&typeof t.textColor<"u"?t.textColor:"black"}function Oe(t){return typeof t.shapeBlank<"u"?(e,i,l)=>_e(e,t.shapeBlank.drawFunc,i,t.shapeBlank.params,l):ze}function Wt(t,e,i,l){let o=de(i)*t.px(t.options.bannerHeight);e.save(),e.translate(0,o),Oe(i)(t,e,l.ref),e.restore()}function Pt(t,e){return typeof e.shapeBlank<"u"?Y(t,e.shapeBlank.drawFunc):t.shieldSize()}function Ft(t,e,i,l){var n=de(i),o=null,r=Ae(t,i,l);let s=n*t.px(t.options.bannerHeight);if(r==null?(e.translate(0,s),Oe(i)(t,e,l.ref),e.translate(0,-s),o={width:e.canvas.width,height:Pt(t,i)}):o={width:r.data.width,height:r.data.height},i.notext)return e;var h=D(t,l.ref,i,o);return h.yBaseline+=n*t.px(t.options.bannerHeight),typeof t.options.SHIELD_TEXT_HALO_COLOR_OVERRIDE<"u"?(e.strokeStyle=options.SHIELD_TEXT_HALO_COLOR_OVERRIDE,ne(t,e,l.ref,h)):i.textHaloColor&&(e.strokeStyle=i.textHaloColor,ne(t,e,l.ref,h)),e.fillStyle=Rt(i),ke(t,e,l.ref,h),t.options.SHIELD_TEXT_BBOX_COLOR&&(e.strokeStyle=t.options.SHIELD_TEXT_BBOX_COLOR,e.lineWidth=t.px(1),e.strokeRect(t.px(i.padding.left-.5),n*t.px(t.options.bannerHeight)+t.px(i.padding.top-.5),o.width-t.px(i.padding.left+i.padding.right-1),o.height-t.px(i.padding.top+i.padding.bottom-1))),e}function Le(t,e){let i=he(t,e);i==null&&(console.warn("Didn't produce a shield for",JSON.stringify(e)),i=t.gfxFactory.createGraphics({width:1,height:1})),Ee(t,e.spriteID,i)}function Ee(t,e,i){let l=i.getImageData(0,0,i.canvas.width,i.canvas.height);t.spriteRepo.putSprite(e,{width:i.canvas.width,height:i.canvas.height,data:l.data},t.px(1))}function Xe(t,e){Ee(t,e,t.emptySprite())}function Ne(t,e){return e.refsByName&&t.name&&e.refsByName[t.name]?e.refsByName[t.name]:t.ref}function Bt(t,e){var i=t[e.network];if(e==null)return null;if(i==null)return console.debug("Generic shield for",JSON.stringify(e)),ae(e.ref)?t.default:null;var l=Ne(e,i);return i.overrideByRef&&(i={...i,...i.overrideByRef[l]}),i.overrideByName&&(i={...i,...i.overrideByName[e.name||""]}),!ae(l)&&"noref"in i&&(i=i.noref,i.notext=!0),!ae(l)&&!i.notext&&!(i.refsByName&&e.name)?null:i}function It(t){let e=parseInt(t,10);if(isNaN(e))return t;let i="M".repeat(e/1e3)+"D".repeat(e%1e3/500)+"C".repeat(e%500/100)+"L".repeat(e%100/50)+"X".repeat(e%50/10)+"V".repeat(e%10/5)+"I".repeat(e%5);return i=i.replace("DCCCC","CM").replace("CCCC","CD").replace("LXXXX","XC").replace("XXXX","XL").replace("VIIII","IX").replace("IIII","IV"),i+t.slice(e.toString().length)}function zt(t,e,i){let l=Math.max(t.shieldSize(),z(t,e.shapeBlank.params,i,e.shapeBlank.drawFunc)),n=Y(t,e.shapeBlank.drawFunc);return{width:l,height:n}}function he(t,e){let i=Bt(t.shieldDef,e);if(i==null)return null;e.ref=Ne(e,i);let l=de(i),n=Ae(t,i,e),o=t.shieldSize(),r=t.shieldSize();if(n==null){if(typeof i.shapeBlank<"u"){let g=zt(t,i,e.ref);o=g.width,r=g.height}}else o=n.data.width,r=n.data.height;let s=l*t.px(t.options.bannerHeight);r+=s;let h=t.gfxFactory.createGraphics({width:o,height:r});return e.ref&&i.numberingSystem==="roman"&&(e.ref=It(e.ref)),Ge(t,h,i,ve),n==null?Wt(t,h,i,e):le(h,n,s,i.verticalReflect,i.colorLighten,i.colorDarken),Ft(t,h,i,e),Ge(t,h,i,Te),h}function Ue(){return(typeof window<"u"&&window.devicePixelRatio)>1?2:1}var K=class{createGraphics(e){var i=document.createElement("canvas").getContext("2d"),i=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});return i.imageSmoothingQuality="high",i.textAlign="center",i.textBaseline="top",i.canvas.width=e.width,i.canvas.height=e.height,i}pixelRatio(){return Ue()}};var se=class{shieldDef;options;debugOptions;gfxFactory;spriteRepo;_emptySpriteCache;emptySprite(){return this._emptySpriteCache||(this._emptySpriteCache=this.gfxFactory.createGraphics({width:1,height:1})),this._emptySpriteCache}px(e){return e*this.gfxFactory.pixelRatio()}shieldSize(){return this.px(this.options.shieldSize)}},ue=class{map;constructor(e){this.map=e}getSprite(e){return this.map.style.getImage(e)}putSprite(e,i,l){this.map.addImage(e,i,{pixelRatio:l})}},Z=class{_shieldPredicate=()=>!0;_networkPredicate=()=>!0;_routeParser;_renderContext;constructor(e){this._routeParser=e,this._renderContext=new se,this._renderContext.gfxFactory=new K}setShields(e){this._renderContext.options=e.options,this._renderContext.shieldDef=e.networks}debugOptions(e){return this._renderContext.debugOptions=e,this}filterImageID(e){return this._shieldPredicate=e,this}filterNetwork(e){return this._networkPredicate=e,this}graphicsFactory(e){return this._renderContext.gfxFactory=e,this}renderOnMaplibreGL(e){return this.renderOnRepository(new ue(e)),e.on("styleimagemissing",this.getStyleImageMissingHandler()),this}renderOnRepository(e){return this._renderContext.spriteRepo||(this._renderContext.spriteRepo=e),this}getStyleImageMissingHandler(){return e=>{try{if(!this._shieldPredicate(e.id))return;let i=this._routeParser.parse(e.id);if(!this._networkPredicate(i.network)){Xe(this._renderContext,e.id);return}i.spriteID=e.id,this._renderContext.debugOptions=this.debugOptions,i&&Le(this._renderContext,i)}catch(i){console.error(`Exception while loading image \u2018${e?.id}\u2019:
`,i)}}}getGraphicForRoute(e,i,l){return he(this._renderContext,{network:e,ref:i,name:l,spriteID:this._routeParser.format(e,i,l)})}emptySprite(){return this._renderContext.emptySprite()}createGraphics(e){return this._renderContext.gfxFactory.createGraphics(e)}pixelRatio(){return this._renderContext.px(1)}},fe=class extends Z{constructor(e,i){super(i),this.setShields(e)}},pe=class extends Z{constructor(e,i){super(i),this.setShieldURL(e)}async setShieldURL(e){await fetch(e).then(i=>i.json()).then(i=>super.setShields(i)).catch(i=>console.error(i))}},ee=class{sprites={};getSprite(e){return this.sprites[e]}hasSprite(e){return e in this.sprites}putSprite(e,i){this.sprites[e]=i}},Yt=new ee;export{ee as InMemorySpriteRepository,fe as ShieldRenderer,pe as URLShieldRenderer,Ue as getDOMPixelRatio,le as transposeImageData};
//# sourceMappingURL=index.js.map
{
"name": "@americana/maplibre-shield-generator",
"description": "Generate highway shields for maplibre-gl-js maps",
"version": "0.0.1-alpha.16",
"version": "0.0.1-alpha.17",
"author": "OpenStreetMap Americana Contributors",

@@ -6,0 +6,0 @@ "type": "module",

@@ -84,2 +84,4 @@ # Americana Shield Renderer

"options": {
"bannerHeight": 9,
"bannerPadding": 1,
"bannerTextColor": "black",

@@ -100,2 +102,4 @@ "bannerTextHaloColor": "white",

- **`bannerHeight`**: height of each text banner
- **`bannerPadding`**: padding between each banner
- **`bannerTextColor`**: color to draw text banners above the shield

@@ -102,0 +106,0 @@ - **`bannerTextHaloColor`**: color to draw an outline around the text banner

@@ -7,5 +7,2 @@ "use strict";

//Height of modifier banners
export const bannerSizeH = 9;
function drawBannerPart(r, ctx, shieldDef, drawFunc) {

@@ -26,3 +23,5 @@ if (shieldDef == null || typeof shieldDef.banners == "undefined") {

width: dimension.width,
height: dimension.height + bannerCount * r.px(bannerSizeH),
height:
dimension.height +
bannerCount * r.px(r.options.bannerHeight + r.options.bannerPadding),
};

@@ -108,3 +107,3 @@ }

let bannerCount = getBannerCount(shieldDef);
let yOffset = bannerCount * r.px(bannerSizeH);
let yOffset = bannerCount * r.px(r.options.bannerHeight);

@@ -131,3 +130,3 @@ //Shift canvas to draw shield below banner

var shieldArtwork = getRasterShieldBlank(r, shieldDef, routeDef);
let yOffset = bannerCount * r.px(bannerSizeH);
let yOffset = bannerCount * r.px(r.options.bannerHeight);

@@ -164,3 +163,3 @@ if (shieldArtwork == null) {

textLayout.yBaseline += bannerCount * r.px(bannerSizeH);
textLayout.yBaseline += bannerCount * r.px(r.options.bannerHeight);

@@ -183,3 +182,4 @@ if (typeof r.options.SHIELD_TEXT_HALO_COLOR_OVERRIDE !== "undefined") {

r.px(shieldDef.padding.left - 0.5),
bannerCount * r.px(bannerSizeH) + r.px(shieldDef.padding.top - 0.5),
bannerCount * r.px(r.options.bannerHeight) +
r.px(shieldDef.padding.top - 0.5),
shieldBounds.width -

@@ -354,3 +354,3 @@ r.px(shieldDef.padding.left + shieldDef.padding.right - 1),

let bannerHeight = bannerCount * r.px(bannerSizeH);
let bannerHeight = bannerCount * r.px(r.options.bannerHeight);
height += bannerHeight;

@@ -357,0 +357,0 @@

@@ -51,2 +51,4 @@ import { StyleImage } from "maplibre-gl";

export interface ShieldOptions {
bannerHeight: number;
bannerPadding: number;
bannerTextColor: string;

@@ -53,0 +55,0 @@ bannerTextHaloColor: string;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc