diff --git a/www/mushroom.js b/www/mushroom.js index 4803f74..8a5d7a7 100644 --- a/www/mushroom.js +++ b/www/mushroom.js @@ -607,8 +607,8 @@ const ia=h`.mdc-floating-label{-moz-osx-font-smoothing:grayscale;-webkit-font-sm const la="important",ca=" !"+la,da=He(class extends Ye{constructor(t){var e;if(super(t),t.type!==Ve||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,i)=>{const o=t[i];return null==o?e:e+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${o};`}),"")}update(t,[e]){const{style:i}=t.element;if(void 0===this.ht){this.ht=new Set;for(const t in e)this.ht.add(t);return this.render(e)}this.ht.forEach((t=>{null==e[t]&&(this.ht.delete(t),t.includes("-")?i.removeProperty(t):i[t]="")}));for(const t in e){const o=e[t];if(null!=o){this.ht.add(t);const e="string"==typeof o&&o.endsWith(ca);t.includes("-")||e?i.setProperty(t,e?o.slice(0,-11):o,e?la:""):i[t]=o}}return X}});var ua={exports:{}},ha={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]},ma={exports:{}},pa=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},fa=Array.prototype.concat,ga=Array.prototype.slice,_a=ma.exports=function(t){for(var e=[],i=0,o=t.length;i=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},Ca.to.keyword=function(t){return wa[t.slice(0,3)]};var Aa=ua.exports;const Sa=ha,Ia={};for(const t of Object.keys(Sa))Ia[Sa[t]]=t;const Ta={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var za=Ta;for(const t of Object.keys(Ta)){if(!("channels"in Ta[t]))throw new Error("missing channels property: "+t);if(!("labels"in Ta[t]))throw new Error("missing channel labels property: "+t);if(Ta[t].labels.length!==Ta[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:e,labels:i}=Ta[t];delete Ta[t].channels,delete Ta[t].labels,Object.defineProperty(Ta[t],"channels",{value:e}),Object.defineProperty(Ta[t],"labels",{value:i})}function Oa(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}Ta.rgb.hsl=function(t){const e=t[0]/255,i=t[1]/255,o=t[2]/255,n=Math.min(e,i,o),r=Math.max(e,i,o),a=r-n;let s,l;r===n?s=0:e===r?s=(i-o)/a:i===r?s=2+(o-e)/a:o===r&&(s=4+(e-i)/a),s=Math.min(60*s,360),s<0&&(s+=360);const c=(n+r)/2;return l=r===n?0:c<=.5?a/(r+n):a/(2-r-n),[s,100*l,100*c]},Ta.rgb.hsv=function(t){let e,i,o,n,r;const a=t[0]/255,s=t[1]/255,l=t[2]/255,c=Math.max(a,s,l),d=c-Math.min(a,s,l),u=function(t){return(c-t)/6/d+.5};return 0===d?(n=0,r=0):(r=d/c,e=u(a),i=u(s),o=u(l),a===c?n=o-i:s===c?n=1/3+e-o:l===c&&(n=2/3+i-e),n<0?n+=1:n>1&&(n-=1)),[360*n,100*r,100*c]},Ta.rgb.hwb=function(t){const e=t[0],i=t[1];let o=t[2];const n=Ta.rgb.hsl(t)[0],r=1/255*Math.min(e,Math.min(i,o));return o=1-1/255*Math.max(e,Math.max(i,o)),[n,100*r,100*o]},Ta.rgb.cmyk=function(t){const e=t[0]/255,i=t[1]/255,o=t[2]/255,n=Math.min(1-e,1-i,1-o);return[100*((1-e-n)/(1-n)||0),100*((1-i-n)/(1-n)||0),100*((1-o-n)/(1-n)||0),100*n]},Ta.rgb.keyword=function(t){const e=Ia[t];if(e)return e;let i,o=1/0;for(const e of Object.keys(Sa)){const n=Oa(t,Sa[e]);n.04045?((e+.055)/1.055)**2.4:e/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,o=o>.04045?((o+.055)/1.055)**2.4:o/12.92;return[100*(.4124*e+.3576*i+.1805*o),100*(.2126*e+.7152*i+.0722*o),100*(.0193*e+.1192*i+.9505*o)]},Ta.rgb.lab=function(t){const e=Ta.rgb.xyz(t);let i=e[0],o=e[1],n=e[2];i/=95.047,o/=100,n/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;return[116*o-16,500*(i-o),200*(o-n)]},Ta.hsl.rgb=function(t){const e=t[0]/360,i=t[1]/100,o=t[2]/100;let n,r,a;if(0===i)return a=255*o,[a,a,a];n=o<.5?o*(1+i):o+i-o*i;const s=2*o-n,l=[0,0,0];for(let t=0;t<3;t++)r=e+1/3*-(t-1),r<0&&r++,r>1&&r--,a=6*r<1?s+6*(n-s)*r:2*r<1?n:3*r<2?s+(n-s)*(2/3-r)*6:s,l[t]=255*a;return l},Ta.hsl.hsv=function(t){const e=t[0];let i=t[1]/100,o=t[2]/100,n=i;const r=Math.max(o,.01);o*=2,i*=o<=1?o:2-o,n*=r<=1?r:2-r;return[e,100*(0===o?2*n/(r+n):2*i/(o+i)),100*((o+i)/2)]},Ta.hsv.rgb=function(t){const e=t[0]/60,i=t[1]/100;let o=t[2]/100;const n=Math.floor(e)%6,r=e-Math.floor(e),a=255*o*(1-i),s=255*o*(1-i*r),l=255*o*(1-i*(1-r));switch(o*=255,n){case 0:return[o,l,a];case 1:return[s,o,a];case 2:return[a,o,l];case 3:return[a,s,o];case 4:return[l,a,o];case 5:return[o,a,s]}},Ta.hsv.hsl=function(t){const e=t[0],i=t[1]/100,o=t[2]/100,n=Math.max(o,.01);let r,a;a=(2-i)*o;const s=(2-i)*n;return r=i*n,r/=s<=1?s:2-s,r=r||0,a/=2,[e,100*r,100*a]},Ta.hwb.rgb=function(t){const e=t[0]/360;let i=t[1]/100,o=t[2]/100;const n=i+o;let r;n>1&&(i/=n,o/=n);const a=Math.floor(6*e),s=1-o;r=6*e-a,0!=(1&a)&&(r=1-r);const l=i+r*(s-i);let c,d,u;switch(a){default:case 6:case 0:c=s,d=l,u=i;break;case 1:c=l,d=s,u=i;break;case 2:c=i,d=s,u=l;break;case 3:c=i,d=l,u=s;break;case 4:c=l,d=i,u=s;break;case 5:c=s,d=i,u=l}return[255*c,255*d,255*u]},Ta.cmyk.rgb=function(t){const e=t[0]/100,i=t[1]/100,o=t[2]/100,n=t[3]/100;return[255*(1-Math.min(1,e*(1-n)+n)),255*(1-Math.min(1,i*(1-n)+n)),255*(1-Math.min(1,o*(1-n)+n))]},Ta.xyz.rgb=function(t){const e=t[0]/100,i=t[1]/100,o=t[2]/100;let n,r,a;return n=3.2406*e+-1.5372*i+-.4986*o,r=-.9689*e+1.8758*i+.0415*o,a=.0557*e+-.204*i+1.057*o,n=n>.0031308?1.055*n**(1/2.4)-.055:12.92*n,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,n=Math.min(Math.max(0,n),1),r=Math.min(Math.max(0,r),1),a=Math.min(Math.max(0,a),1),[255*n,255*r,255*a]},Ta.xyz.lab=function(t){let e=t[0],i=t[1],o=t[2];e/=95.047,i/=100,o/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;return[116*i-16,500*(e-i),200*(i-o)]},Ta.lab.xyz=function(t){let e,i,o;i=(t[0]+16)/116,e=t[1]/500+i,o=i-t[2]/200;const n=i**3,r=e**3,a=o**3;return i=n>.008856?n:(i-16/116)/7.787,e=r>.008856?r:(e-16/116)/7.787,o=a>.008856?a:(o-16/116)/7.787,e*=95.047,i*=100,o*=108.883,[e,i,o]},Ta.lab.lch=function(t){const e=t[0],i=t[1],o=t[2];let n;n=360*Math.atan2(o,i)/2/Math.PI,n<0&&(n+=360);return[e,Math.sqrt(i*i+o*o),n]},Ta.lch.lab=function(t){const e=t[0],i=t[1],o=t[2]/360*2*Math.PI;return[e,i*Math.cos(o),i*Math.sin(o)]},Ta.rgb.ansi16=function(t,e=null){const[i,o,n]=t;let r=null===e?Ta.rgb.hsv(t)[2]:e;if(r=Math.round(r/50),0===r)return 30;let a=30+(Math.round(n/255)<<2|Math.round(o/255)<<1|Math.round(i/255));return 2===r&&(a+=60),a},Ta.hsv.ansi16=function(t){return Ta.rgb.ansi16(Ta.hsv.rgb(t),t[2])},Ta.rgb.ansi256=function(t){const e=t[0],i=t[1],o=t[2];if(e===i&&i===o)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;return 16+36*Math.round(e/255*5)+6*Math.round(i/255*5)+Math.round(o/255*5)},Ta.ansi16.rgb=function(t){let e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const i=.5*(1+~~(t>50));return[(1&e)*i*255,(e>>1&1)*i*255,(e>>2&1)*i*255]},Ta.ansi256.rgb=function(t){if(t>=232){const e=10*(t-232)+8;return[e,e,e]}let e;t-=16;return[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},Ta.rgb.hex=function(t){const e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},Ta.hex.rgb=function(t){const e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let i=e[0];3===e[0].length&&(i=i.split("").map((t=>t+t)).join(""));const o=parseInt(i,16);return[o>>16&255,o>>8&255,255&o]},Ta.rgb.hcg=function(t){const e=t[0]/255,i=t[1]/255,o=t[2]/255,n=Math.max(Math.max(e,i),o),r=Math.min(Math.min(e,i),o),a=n-r;let s,l;return s=a<1?r/(1-a):0,l=a<=0?0:n===e?(i-o)/a%6:n===i?2+(o-e)/a:4+(e-i)/a,l/=6,l%=1,[360*l,100*a,100*s]},Ta.hsl.hcg=function(t){const e=t[1]/100,i=t[2]/100,o=i<.5?2*e*i:2*e*(1-i);let n=0;return o<1&&(n=(i-.5*o)/(1-o)),[t[0],100*o,100*n]},Ta.hsv.hcg=function(t){const e=t[1]/100,i=t[2]/100,o=e*i;let n=0;return o<1&&(n=(i-o)/(1-o)),[t[0],100*o,100*n]},Ta.hcg.rgb=function(t){const e=t[0]/360,i=t[1]/100,o=t[2]/100;if(0===i)return[255*o,255*o,255*o];const n=[0,0,0],r=e%1*6,a=r%1,s=1-a;let l=0;switch(Math.floor(r)){case 0:n[0]=1,n[1]=a,n[2]=0;break;case 1:n[0]=s,n[1]=1,n[2]=0;break;case 2:n[0]=0,n[1]=1,n[2]=a;break;case 3:n[0]=0,n[1]=s,n[2]=1;break;case 4:n[0]=a,n[1]=0,n[2]=1;break;default:n[0]=1,n[1]=0,n[2]=s}return l=(1-i)*o,[255*(i*n[0]+l),255*(i*n[1]+l),255*(i*n[2]+l)]},Ta.hcg.hsv=function(t){const e=t[1]/100,i=e+t[2]/100*(1-e);let o=0;return i>0&&(o=e/i),[t[0],100*o,100*i]},Ta.hcg.hsl=function(t){const e=t[1]/100,i=t[2]/100*(1-e)+.5*e;let o=0;return i>0&&i<.5?o=e/(2*i):i>=.5&&i<1&&(o=e/(2*(1-i))),[t[0],100*o,100*i]},Ta.hcg.hwb=function(t){const e=t[1]/100,i=e+t[2]/100*(1-e);return[t[0],100*(i-e),100*(1-i)]},Ta.hwb.hcg=function(t){const e=t[1]/100,i=1-t[2]/100,o=i-e;let n=0;return o<1&&(n=(i-o)/(1-o)),[t[0],100*o,100*n]},Ta.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},Ta.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},Ta.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},Ta.gray.hsl=function(t){return[0,0,t[0]]},Ta.gray.hsv=Ta.gray.hsl,Ta.gray.hwb=function(t){return[0,100,t[0]]},Ta.gray.cmyk=function(t){return[0,0,0,t[0]]},Ta.gray.lab=function(t){return[t[0],0,0]},Ta.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),i=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(i.length)+i},Ta.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};const Ma=za;function ja(t){const e=function(){const t={},e=Object.keys(Ma);for(let i=e.length,o=0;o{Ra[t]={},Object.defineProperty(Ra[t],"channels",{value:Pa[t].channels}),Object.defineProperty(Ra[t],"labels",{value:Pa[t].labels});const e=Na(t);Object.keys(e).forEach((i=>{const o=e[i];Ra[t][i]=function(t){const e=function(...e){const i=e[0];if(null==i)return i;i.length>1&&(e=i);const o=t(e);if("object"==typeof o)for(let t=o.length,e=0;e1&&(e=i),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(o)}))}));const Fa=Aa,Va=Ra,Ba=["keyword","gray","hex"],Ua={};for(const t of Object.keys(Va))Ua[[...Va[t].labels].sort().join("")]=t;const Ha={};function Ya(t,e){if(!(this instanceof Ya))return new Ya(t,e);if(e&&e in Ba&&(e=null),e&&!(e in Va))throw new Error("Unknown model: "+e);let i,o;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof Ya)this.model=t.model,this.color=[...t.color],this.valpha=t.valpha;else if("string"==typeof t){const e=Fa.get(t);if(null===e)throw new Error("Unable to parse color from string: "+t);this.model=e.model,o=Va[this.model].channels,this.color=e.value.slice(0,o),this.valpha="number"==typeof e.value[o]?e.value[o]:1}else if(t.length>0){this.model=e||"rgb",o=Va[this.model].channels;const i=Array.prototype.slice.call(t,0,o);this.color=Ga(i,o),this.valpha="number"==typeof t[o]?t[o]:1}else if("number"==typeof t)this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;const e=Object.keys(t);"alpha"in t&&(e.splice(e.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);const o=e.sort().join("");if(!(o in Ua))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=Ua[o];const{labels:n}=Va[this.model],r=[];for(i=0;i(t%360+360)%360)),saturationl:Xa("hsl",1,Ka(100)),lightness:Xa("hsl",2,Ka(100)),saturationv:Xa("hsv",1,Ka(100)),value:Xa("hsv",2,Ka(100)),chroma:Xa("hcg",1,Ka(100)),gray:Xa("hcg",2,Ka(100)),white:Xa("hwb",1,Ka(100)),wblack:Xa("hwb",2,Ka(100)),cyan:Xa("cmyk",0,Ka(100)),magenta:Xa("cmyk",1,Ka(100)),yellow:Xa("cmyk",2,Ka(100)),black:Xa("cmyk",3,Ka(100)),x:Xa("xyz",0,Ka(95.047)),y:Xa("xyz",1,Ka(100)),z:Xa("xyz",2,Ka(108.833)),l:Xa("lab",0,Ka(100)),a:Xa("lab",1),b:Xa("lab",2),keyword(t){return void 0!==t?new Ya(t):Va[this.model].keyword(this.color)},hex(t){return void 0!==t?new Ya(t):Fa.to.hex(this.rgb().round().color)},hexa(t){if(void 0!==t)return new Ya(t);const e=this.rgb().round().color;let i=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===i.length&&(i="0"+i),Fa.to.hex(e)+i},rgbNumber(){const t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity(){const t=this.rgb().color,e=[];for(const[i,o]of t.entries()){const t=o/255;e[i]=t<=.04045?t/12.92:((t+.055)/1.055)**2.4}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast(t){const e=this.luminosity(),i=t.luminosity();return e>i?(e+.05)/(i+.05):(i+.05)/(e+.05)},level(t){const e=this.contrast(t);return e>=7?"AAA":e>=4.5?"AA":""},isDark(){const t=this.rgb().color;return(2126*t[0]+7152*t[1]+722*t[2])/1e4<128},isLight(){return!this.isDark()},negate(){const t=this.rgb();for(let e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten(t){const e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken(t){const e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate(t){const e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate(t){const e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten(t){const e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken(t){const e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale(){const t=this.rgb().color,e=.3*t[0]+.59*t[1]+.11*t[2];return Ya.rgb(e,e,e)},fade(t){return this.alpha(this.valpha-this.valpha*t)},opaquer(t){return this.alpha(this.valpha+this.valpha*t)},rotate(t){const e=this.hsl();let i=e.color[0];return i=(i+t)%360,i=i<0?360+i:i,e.color[0]=i,e},mix(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);const i=t.rgb(),o=this.rgb(),n=void 0===e?.5:e,r=2*n-1,a=i.alpha()-o.alpha(),s=((r*a==-1?r:(r+a)/(1+r*a))+1)/2,l=1-s;return Ya.rgb(s*i.red()+l*o.red(),s*i.green()+l*o.green(),s*i.blue()+l*o.blue(),i.alpha()*n+o.alpha()*(1-n))}};for(const t of Object.keys(Va)){if(Ba.includes(t))continue;const{channels:e}=Va[t];Ya.prototype[t]=function(...e){return this.model===t?new Ya(this):e.length>0?new Ya(e,t):new Ya([...(i=Va[this.model][t].raw(this.color),Array.isArray(i)?i:[i]),this.valpha],t);var i},Ya[t]=function(...i){let o=i[0];return"number"==typeof o&&(o=Ga(i,e)),new Ya(o,t)}}function Wa(t){return function(e){return function(t,e){return Number(t.toFixed(e))}(e,t)}}function Xa(t,e,i){t=Array.isArray(t)?t:[t];for(const o of t)(Ha[o]||(Ha[o]=[]))[e]=i;return t=t[0],function(o){let n;return void 0!==o?(i&&(o=i(o)),n=this[t](),n.color[e]=o,n):(n=this[t]().color[e],i&&(n=i(n)),n)}}function Ka(t){return function(e){return Math.max(0,Math.min(t,e))}}function Ga(t,e){for(let i=0;i{this._tryConnectKey(t)}))}async _tryConnectKey(t){var e,i;if(void 0===this._unsubRenderTemplates.get(t)&&this.hass&&this._config&&this.isTemplate(t))try{const i=Fe(this.hass.connection,(e=>{this._templateResults=Object.assign(Object.assign({},this._templateResults),{[t]:e})}),{template:null!==(e=this._config[t])&&void 0!==e?e:"",entity_ids:this._config.entity_id,variables:{config:this._config,user:this.hass.user.name,entity:this._config.entity},strict:!0});this._unsubRenderTemplates.set(t,i),await i}catch(e){const o={result:null!==(i=this._config[t])&&void 0!==i?i:"",listeners:{all:!1,domains:[],entities:[],time:!1}};this._templateResults=Object.assign(Object.assign({},this._templateResults),{[t]:o}),this._unsubRenderTemplates.delete(t)}}async _tryDisconnect(){Pd.forEach((t=>{this._tryDisconnectKey(t)}))}async _tryDisconnectKey(t){const e=this._unsubRenderTemplates.get(t);if(e)try{(await e)(),this._unsubRenderTemplates.delete(t)}catch(t){if("not_found"!==t.code&&"template_error"!==t.code)throw t}}setConfig(t){Pd.forEach((e=>{var i,o;(null===(i=this._config)||void 0===i?void 0:i[e])===t[e]&&(null===(o=this._config)||void 0===o?void 0:o.entity)==t.entity||this._tryDisconnectKey(e)})),this._config=Object.assign({tap_action:{action:"none"}},t)}get hasAction(){var t,e,i,o;return!(null===(t=this._config)||void 0===t?void 0:t.tap_action)||Ge(null===(e=this._config)||void 0===e?void 0:e.tap_action)||Ge(null===(i=this._config)||void 0===i?void 0:i.hold_action)||Ge(null===(o=this._config)||void 0===o?void 0:o.double_tap_action)}render(){var t,e;if(!this._config||!this.hass)return K;const i=this.getValue("icon"),o=this.getValue("color"),n=this.getValue("content"),r=this.getValue("label"),a=this.getValue("picture"),s=!!n,l=!!i||!!a,c={};o&&(c["--badge-color"]=function(t){return jd.has(t)?`var(--${t}-color)`:t}(o));const d=pl(i);return Y` + `]}};Md=n([pt(Cd)],Md);const jd=new Set(["primary","accent","disabled","red","pink","purple","deep-purple","indigo","blue","light-blue","cyan","teal","green","light-green","lime","yellow","amber","orange","deep-orange","brown","light-grey","grey","dark-grey","blue-grey","black","white"]);const Dd=`${Fs}-template-badge`,Ld=`${Dd}-editor`;!function(e){const i=window;i.customBadges=i.customBadges||[];const o=e.type.replace("-badge","").replace("mushroom-","");i.customBadges.push(Object.assign(Object.assign({},e),{preview:!0,documentationURL:`${t}/blob/main/docs/badges/${o}.md`}))}({type:Dd,name:"Mushroom Template",description:"Build your own badge using templates"});const Pd=["icon","color","label","content","picture"];let Nd=class extends ht{constructor(){super(...arguments),this._templateResults={},this._unsubRenderTemplates=new Map}static async getConfigElement(){return await Promise.resolve().then((function(){return Og})),document.createElement(Ld)}static async getStubConfig(t){return{type:`custom:${Dd}`,content:"Hello",icon:"mdi:mushroom",color:"red"}}connectedCallback(){super.connectedCallback(),this._tryConnect()}disconnectedCallback(){this._tryDisconnect()}updated(t){super.updated(t),this._config&&this.hass&&this._tryConnect()}async _tryConnect(){Pd.forEach((t=>{this._tryConnectKey(t)}))}async _tryConnectKey(t){var e,i;if(void 0===this._unsubRenderTemplates.get(t)&&this.hass&&this._config&&this.isTemplate(t))try{const i=Fe(this.hass.connection,(e=>{this._templateResults=Object.assign(Object.assign({},this._templateResults),{[t]:e})}),{template:null!==(e=this._config[t])&&void 0!==e?e:"",entity_ids:this._config.entity_id,variables:{config:this._config,user:this.hass.user.name,entity:this._config.entity},strict:!0});this._unsubRenderTemplates.set(t,i),await i}catch(e){const o={result:null!==(i=this._config[t])&&void 0!==i?i:"",listeners:{all:!1,domains:[],entities:[],time:!1}};this._templateResults=Object.assign(Object.assign({},this._templateResults),{[t]:o}),this._unsubRenderTemplates.delete(t)}}async _tryDisconnect(){Pd.forEach((t=>{this._tryDisconnectKey(t)}))}async _tryDisconnectKey(t){const e=this._unsubRenderTemplates.get(t);if(e)try{(await e)(),this._unsubRenderTemplates.delete(t)}catch(t){if("not_found"!==t.code&&"template_error"!==t.code)throw t}}setConfig(t){Pd.forEach((e=>{var i,o;(null===(i=this._config)||void 0===i?void 0:i[e])===t[e]&&(null===(o=this._config)||void 0===o?void 0:o.entity)==t.entity||this._tryDisconnectKey(e)})),this._config=Object.assign({tap_action:{action:"none"}},t)}get hasAction(){var t,e,i,o;return!(null===(t=this._config)||void 0===t?void 0:t.tap_action)||Ge(null===(e=this._config)||void 0===e?void 0:e.tap_action)||Ge(null===(i=this._config)||void 0===i?void 0:i.hold_action)||Ge(null===(o=this._config)||void 0===o?void 0:o.double_tap_action)}render(){if(!this._config||!this.hass)return K;const t=this.getValue("icon"),e=this.getValue("color"),i=this.getValue("content"),o=this.getValue("label"),n=this.getValue("picture"),r=!!i,a=!!t||!!n,s={};e&&(s["--badge-color"]=function(t){return jd.has(t)?`var(--${t}-color)`:t}(e));const l=pl(t);return Y`
- ${a?Y``:d||(i?Y` + ${n?Y``:l||(t?Y` `:K)} - ${n?Y` + ${i?Y` - ${r?Y`${r}`:K} - ${n} + ${o?Y`${o}`:K} + ${i} `:K}
@@ -3334,7 +3334,12 @@ const la="important",ca=" !"+la,da=He(class extends Ye{constructor(t){var e;if(s --ha-badge-border-radius, calc(var(--ha-badge-size, 36px) / 2) ); - background-color: var(--card-background-color, white); + background: var( + --ha-card-background, + var(--card-background-color, white) + ); + -webkit-backdrop-filter: var(--ha-card-backdrop-filter, none); + backdrop-filter: var(--ha-card-backdrop-filter, none); border-width: var(--ha-card-border-width, 1px); box-shadow: var(--ha-card-box-shadow, none); border-style: solid; @@ -3360,7 +3365,7 @@ const la="important",ca=" !"+la,da=He(class extends Ye{constructor(t){var e;if(s [role="button"]:focus { outline: none; } - .content { + .info { display: flex; flex-direction: column; align-items: flex-start; @@ -3368,7 +3373,7 @@ const la="important",ca=" !"+la,da=He(class extends Ye{constructor(t){var e;if(s padding-inline-end: 4px; padding-inline-start: initial; } - .name { + .label { font-size: 10px; font-style: normal; font-weight: 500; @@ -3376,7 +3381,7 @@ const la="important",ca=" !"+la,da=He(class extends Ye{constructor(t){var e;if(s letter-spacing: 0.1px; color: var(--secondary-text-color); } - .state { + .content { font-size: 12px; font-style: normal; font-weight: 500; @@ -3400,22 +3405,22 @@ const la="important",ca=" !"+la,da=He(class extends Ye{constructor(t){var e;if(s object-fit: cover; overflow: hidden; } - .badge.icon-only { + .badge.no-info { padding: 0; } - .badge:not(.icon-only) img { + .badge:not(.no-icon):not(.no-info) img { margin-left: -6px; margin-inline-start: -6px; margin-inline-end: initial; } - .badge.content-only .content { + .badge.no-icon .info { padding-right: 4px; padding-left: 4px; padding-inline-end: 4px; padding-inline-start: 4px; } ${nl} - `}};n([_t({attribute:!1})],Nd.prototype,"hass",void 0),n([vt()],Nd.prototype,"_config",void 0),n([vt()],Nd.prototype,"_templateResults",void 0),n([vt()],Nd.prototype,"_unsubRenderTemplates",void 0),Nd=n([pt(Dd)],Nd),console.info("%c🍄 Mushroom 🍄 - 4.0.5","color: #ef5350; font-weight: 700;");const Rd=Ce({tap_action:$e(ni),hold_action:$e(ni),double_tap_action:$e(ni)}),Fd=(t,e)=>(e&&t&&(t=t.map((t=>"perform-action"===t?"call-service":t))),[{name:"tap_action",selector:{"ui-action":{actions:t}}},{name:"hold_action",selector:{"ui-action":{actions:t}}},{name:"double_tap_action",selector:{"ui-action":{actions:t}}}]),Vd=Ce({layout:$e(Se([we("horizontal"),we("vertical"),we("default")])),fill_container:$e(ye()),primary_info:$e(xe(ns)),secondary_info:$e(xe(ns)),icon_type:$e(xe(rs))}),Bd=[{type:"grid",name:"",schema:[{name:"layout",selector:{mush_layout:{}}},{name:"fill_container",selector:{boolean:{}}}]},{type:"grid",name:"",schema:[{name:"primary_info",selector:{mush_info:{}}},{name:"secondary_info",selector:{mush_info:{}}},{name:"icon_type",selector:{mush_icon_type:{}}}]}],Ud=["color","icon_color","layout","fill_container","primary_info","secondary_info","icon_type","content_info","use_entity_picture","collapsible_controls","icon_animation"],Hd=Ce({entity:$e(Ee()),name:$e(Ee()),icon:$e(Ee())}),Yd=Ce({index:$e(ke()),view_index:$e(ke()),view_layout:ve(),type:Ee(),layout_options:ve(),visibility:ve()}),Wd=fe(Yd,fe(Hd,Vd,Rd),Ce({states:$e(be()),show_keypad:(Xd=$e(ye()),Kd=(t,e)=>{console.warn(`🍄 "${e.path}" option is deprecated and no longer available. Remove it from your YAML configuration or use the built-in Home Assistant alarm panel card if you want keypad.`)},new he({...Xd,refiner:(t,e)=>void 0===t||Xd.refiner(t,e),validator:(t,e)=>void 0===t||(Kd(t,e),Xd.validator(t,e))}))}));var Xd,Kd;const Gd=["more-info","navigate","url","perform-action","assist","none"],qd=["armed_home","armed_away","armed_night","armed_vacation","armed_custom_bypass"],Zd=Tt(((t,e)=>[{name:"entity",selector:{entity:{domain:Us}}},{name:"name",selector:{text:{}}},{name:"icon",selector:{icon:{}},context:{icon_entity:"entity"}},...Bd,{type:"multi_select",name:"states",options:qd.map((e=>[e,t(`ui.card.alarm_control_panel.${e.replace("armed","arm")}`)]))},...Fd(Gd,e)]));let Jd=class extends Ls{constructor(){super(...arguments),this._computeLabel=t=>{const e=Mo(this.hass);return Ud.includes(t.name)?e(`editor.card.generic.${t.name}`):"states"===t.name?this.hass.localize("ui.panel.lovelace.editor.card.alarm-panel.available_states"):this.hass.localize(`ui.panel.lovelace.editor.card.generic.${t.name}`)}}connectedCallback(){super.connectedCallback(),_l()}setConfig(t){me(t,Wd),this._config=t}render(){if(!this.hass||!this._config)return K;const t=!ai(this.hass.config.version,2024,8),e=Zd(this.hass.localize,t);return Y` + `}};n([_t({attribute:!1})],Nd.prototype,"hass",void 0),n([vt()],Nd.prototype,"_config",void 0),n([vt()],Nd.prototype,"_templateResults",void 0),n([vt()],Nd.prototype,"_unsubRenderTemplates",void 0),Nd=n([pt(Dd)],Nd),console.info("%c🍄 Mushroom 🍄 - 4.0.6","color: #ef5350; font-weight: 700;");const Rd=Ce({tap_action:$e(ni),hold_action:$e(ni),double_tap_action:$e(ni)}),Fd=(t,e)=>(e&&t&&(t=t.map((t=>"perform-action"===t?"call-service":t))),[{name:"tap_action",selector:{"ui-action":{actions:t}}},{name:"hold_action",selector:{"ui-action":{actions:t}}},{name:"double_tap_action",selector:{"ui-action":{actions:t}}}]),Vd=Ce({layout:$e(Se([we("horizontal"),we("vertical"),we("default")])),fill_container:$e(ye()),primary_info:$e(xe(ns)),secondary_info:$e(xe(ns)),icon_type:$e(xe(rs))}),Bd=[{type:"grid",name:"",schema:[{name:"layout",selector:{mush_layout:{}}},{name:"fill_container",selector:{boolean:{}}}]},{type:"grid",name:"",schema:[{name:"primary_info",selector:{mush_info:{}}},{name:"secondary_info",selector:{mush_info:{}}},{name:"icon_type",selector:{mush_icon_type:{}}}]}],Ud=["color","icon_color","layout","fill_container","primary_info","secondary_info","icon_type","content_info","use_entity_picture","collapsible_controls","icon_animation"],Hd=Ce({entity:$e(Ee()),name:$e(Ee()),icon:$e(Ee())}),Yd=Ce({index:$e(ke()),view_index:$e(ke()),view_layout:ve(),type:Ee(),layout_options:ve(),visibility:ve()}),Wd=fe(Yd,fe(Hd,Vd,Rd),Ce({states:$e(be()),show_keypad:(Xd=$e(ye()),Kd=(t,e)=>{console.warn(`🍄 "${e.path}" option is deprecated and no longer available. Remove it from your YAML configuration or use the built-in Home Assistant alarm panel card if you want keypad.`)},new he({...Xd,refiner:(t,e)=>void 0===t||Xd.refiner(t,e),validator:(t,e)=>void 0===t||(Kd(t,e),Xd.validator(t,e))}))}));var Xd,Kd;const Gd=["more-info","navigate","url","perform-action","assist","none"],qd=["armed_home","armed_away","armed_night","armed_vacation","armed_custom_bypass"],Zd=Tt(((t,e)=>[{name:"entity",selector:{entity:{domain:Us}}},{name:"name",selector:{text:{}}},{name:"icon",selector:{icon:{}},context:{icon_entity:"entity"}},...Bd,{type:"multi_select",name:"states",options:qd.map((e=>[e,t(`ui.card.alarm_control_panel.${e.replace("armed","arm")}`)]))},...Fd(Gd,e)]));let Jd=class extends Ls{constructor(){super(...arguments),this._computeLabel=t=>{const e=Mo(this.hass);return Ud.includes(t.name)?e(`editor.card.generic.${t.name}`):"states"===t.name?this.hass.localize("ui.panel.lovelace.editor.card.alarm-panel.available_states"):this.hass.localize(`ui.panel.lovelace.editor.card.generic.${t.name}`)}}connectedCallback(){super.connectedCallback(),_l()}setConfig(t){me(t,Wd),this._config=t}render(){if(!this.hass||!this._config)return K;const t=!ai(this.hass.config.version,2024,8),e=Zd(this.hass.localize,t);return Y`