From 43bb37520a1d77ea4962a6b540fad384664ef872 Mon Sep 17 00:00:00 2001 From: Stefanie Jane Date: Fri, 13 Sep 2024 21:18:37 -0700 Subject: [PATCH] :rocket: Release version 0.9.6 --- dist/hyper-light-card.js | 155 ++++++++++++++------------------------- package.json | 4 +- 2 files changed, 58 insertions(+), 101 deletions(-) diff --git a/dist/hyper-light-card.js b/dist/hyper-light-card.js index bd5f418..2a5bbf7 100644 --- a/dist/hyper-light-card.js +++ b/dist/hyper-light-card.js @@ -1,104 +1,63 @@ -function t(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}function e(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function n(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError; +function t(t,e,n,r){var s,o=arguments.length,i=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(i=(o<3?s(i):o>3?s(e,n,i):s(e,n))||i);return o>3&&i&&Object.defineProperty(e,n,i),i}function e(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function n(t,e,n,r){return new(n||(n=Promise))((function(s,o){function i(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((r=r.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError; /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const r=globalThis,o=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),a=new WeakMap;let s=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(o&&void 0===t){const n=void 0!==e&&1===e.length;n&&(t=a.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&a.set(e,t))}return t}toString(){return this.cssText}};const c=t=>new s("string"==typeof t?t:t+"",void 0,i),l=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,n,r)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[r+1]),t[0]);return new s(n,t,i)},f=o?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return c(e)})(t):t +const r=globalThis,s=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),i=new WeakMap;let a=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(s&&void 0===t){const n=void 0!==e&&1===e.length;n&&(t=i.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(e,t))}return t}toString(){return this.cssText}};const c=t=>new a("string"==typeof t?t:t+"",void 0,o),l=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,n,r)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[r+1]),t[0]);return new a(n,t,o)},h=s?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return c(e)})(t):t /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */,{is:h,defineProperty:u,getOwnPropertyDescriptor:d,getOwnPropertyNames:p,getOwnPropertySymbols:g,getPrototypeOf:b}=Object,v=globalThis,y=v.trustedTypes,m=y?y.emptyScript:"",_=v.reactiveElementPolyfillSupport,w=(t,e)=>t,x={toAttribute(t,e){switch(e){case Boolean:t=t?m:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},k=(t,e)=>!h(t,e),$={attribute:!0,type:String,converter:x,reflect:!1,hasChanged:k};Symbol.metadata??=Symbol("metadata"),v.litPropertyMetadata??=new WeakMap;class A extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=$){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),r=this.getPropertyDescriptor(t,n,e);void 0!==r&&u(this.prototype,t,r)}}static getPropertyDescriptor(t,e,n){const{get:r,set:o}=d(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return r?.call(this)},set(e){const i=r?.call(this);o.call(this,e),this.requestUpdate(t,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??$}static _$Ei(){if(this.hasOwnProperty(w("elementProperties")))return;const t=b(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(w("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(w("properties"))){const t=this.properties,e=[...p(t),...g(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(f(t))}else void 0!==t&&e.push(f(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(o)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const n of e){const e=document.createElement("style"),o=r.litNonce;void 0!==o&&e.setAttribute("nonce",o),e.textContent=n.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$EC(t,e){const n=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,n);if(void 0!==r&&!0===n.reflect){const o=(void 0!==n.converter?.toAttribute?n.converter:x).toAttribute(e,n.type);this._$Em=t,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,e){const n=this.constructor,r=n._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=n.getPropertyOptions(r),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:x;this._$Em=r,this[r]=o.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,n){if(void 0!==t){if(n??=this.constructor.getPropertyOptions(t),!(n.hasChanged??k)(this[t],e))return;this.P(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,n){this._$AL.has(t)||this._$AL.set(t,e),!0===n.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,n]of t)!0!==n.wrapped||this._$AL.has(e)||void 0===this[e]||this.P(e,this[e],n)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}}A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[w("elementProperties")]=new Map,A[w("finalized")]=new Map,_?.({ReactiveElement:A}),(v.reactiveElementVersions??=[]).push("2.0.4"); + */,{is:d,defineProperty:f,getOwnPropertyDescriptor:u,getOwnPropertyNames:p,getOwnPropertySymbols:g,getPrototypeOf:b}=Object,m=globalThis,v=m.trustedTypes,y=v?v.emptyScript:"",w=m.reactiveElementPolyfillSupport,_=(t,e)=>t,x={toAttribute(t,e){switch(e){case Boolean:t=t?y:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},k=(t,e)=>!d(t,e),$={attribute:!0,type:String,converter:x,reflect:!1,hasChanged:k};Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;class A extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=$){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),r=this.getPropertyDescriptor(t,n,e);void 0!==r&&f(this.prototype,t,r)}}static getPropertyDescriptor(t,e,n){const{get:r,set:s}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return r?.call(this)},set(e){const o=r?.call(this);s.call(this,e),this.requestUpdate(t,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??$}static _$Ei(){if(this.hasOwnProperty(_("elementProperties")))return;const t=b(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(_("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_("properties"))){const t=this.properties,e=[...p(t),...g(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(h(t))}else void 0!==t&&e.push(h(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(s)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const n of e){const e=document.createElement("style"),s=r.litNonce;void 0!==s&&e.setAttribute("nonce",s),e.textContent=n.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$EC(t,e){const n=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,n);if(void 0!==r&&!0===n.reflect){const s=(void 0!==n.converter?.toAttribute?n.converter:x).toAttribute(e,n.type);this._$Em=t,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$Em=null}}_$AK(t,e){const n=this.constructor,r=n._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=n.getPropertyOptions(r),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:x;this._$Em=r,this[r]=s.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,n){if(void 0!==t){if(n??=this.constructor.getPropertyOptions(t),!(n.hasChanged??k)(this[t],e))return;this.P(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,n){this._$AL.has(t)||this._$AL.set(t,e),!0===n.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,n]of t)!0!==n.wrapped||this._$AL.has(e)||void 0===this[e]||this.P(e,this[e],n)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}}A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[_("elementProperties")]=new Map,A[_("finalized")]=new Map,w?.({ReactiveElement:A}),(m.reactiveElementVersions??=[]).push("2.0.4"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const C=globalThis,E=C.trustedTypes,M=E?E.createPolicy("lit-html",{createHTML:t=>t}):void 0,O="$lit$",S=`lit$${Math.random().toFixed(9).slice(2)}$`,P="?"+S,L=`<${P}>`,N=document,H=()=>N.createComment(""),U=t=>null===t||"object"!=typeof t&&"function"!=typeof t,R=Array.isArray,j="[ \t\n\f\r]",T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,z=/-->/g,D=/>/g,I=RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),q=/'/g,B=/"/g,F=/^(?:script|style|textarea|title)$/i,G=(t=>(e,...n)=>({_$litType$:t,strings:e,values:n}))(1),Y=Symbol.for("lit-noChange"),V=Symbol.for("lit-nothing"),W=new WeakMap,X=N.createTreeWalker(N,129);function Z(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==M?M.createHTML(e):e}const K=(t,e)=>{const n=t.length-1,r=[];let o,i=2===e?"":"",a=T;for(let e=0;e"===c[0]?(a=o??T,l=-1):void 0===c[1]?l=-2:(l=a.lastIndex-c[2].length,s=c[1],a=void 0===c[3]?I:'"'===c[3]?B:q):a===B||a===q?a=I:a===z||a===D?a=T:(a=I,o=void 0);const h=a===I&&t[e+1].startsWith("/>")?" ":"";i+=a===T?n+L:l>=0?(r.push(s),n.slice(0,l)+O+n.slice(l)+S+h):n+S+(-2===l?e:h)}return[Z(t,i+(t[n]||"")+(2===e?"":"")),r]};class J{constructor({strings:t,_$litType$:e},n){let r;this.parts=[];let o=0,i=0;const a=t.length-1,s=this.parts,[c,l]=K(t,e);if(this.el=J.createElement(c,n),X.currentNode=this.el.content,2===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=X.nextNode())&&s.length0){r.textContent=E?E.emptyScript:"";for(let n=0;nR(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==V&&U(this._$AH)?this._$AA.nextSibling.data=t:this.T(N.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,r="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=J.createElement(Z(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new tt(r,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=W.get(t.strings);return void 0===e&&W.set(t.strings,e=new J(t)),e}k(t){R(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,r=0;for(const o of t)r===e.length?e.push(n=new et(this.S(H()),this.S(H()),this,this.options)):n=e[r],n._$AI(o),r++;r2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=V}_$AI(t,e=this,n,r){const o=this.strings;let i=!1;if(void 0===o)t=Q(this,t,e,0),i=!U(t)||t!==this._$AH&&t!==Y,i&&(this._$AH=t);else{const r=t;let a,s;for(t=o[0],a=0;at}):void 0,S="$lit$",O=`lit$${Math.random().toFixed(9).slice(2)}$`,P="?"+O,L=`<${P}>`,N=document,U=()=>N.createComment(""),j=t=>null===t||"object"!=typeof t&&"function"!=typeof t,R=Array.isArray,H="[ \t\n\f\r]",z=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,B=/-->/g,T=/>/g,q=RegExp(`>|${H}(?:([^\\s"'>=/]+)(${H}*=${H}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),I=/'/g,D=/"/g,Y=/^(?:script|style|textarea|title)$/i,G=(t=>(e,...n)=>({_$litType$:t,strings:e,values:n}))(1),W=Symbol.for("lit-noChange"),X=Symbol.for("lit-nothing"),Z=new WeakMap,V=N.createTreeWalker(N,129);function K(t,e){if(!R(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==M?M.createHTML(e):e}class F{constructor({strings:t,_$litType$:e},n){let r;this.parts=[];let s=0,o=0;const i=t.length-1,a=this.parts,[c,l]=((t,e)=>{const n=t.length-1,r=[];let s,o=2===e?"":3===e?"":"",i=z;for(let e=0;e"===c[0]?(i=s??z,l=-1):void 0===c[1]?l=-2:(l=i.lastIndex-c[2].length,a=c[1],i=void 0===c[3]?q:'"'===c[3]?D:I):i===D||i===I?i=q:i===B||i===T?i=z:(i=q,s=void 0);const d=i===q&&t[e+1].startsWith("/>")?" ":"";o+=i===z?n+L:l>=0?(r.push(a),n.slice(0,l)+S+n.slice(l)+O+d):n+O+(-2===l?e:d)}return[K(t,o+(t[n]||"")+(2===e?"":3===e?"":"")),r]})(t,e);if(this.el=F.createElement(c,n),V.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=V.nextNode())&&a.length0){r.textContent=C?C.emptyScript:"";for(let n=0;nR(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==X&&j(this._$AH)?this._$AA.nextSibling.data=t:this.T(N.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,r="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=F.createElement(K(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new Q(r,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=Z.get(t.strings);return void 0===e&&Z.set(t.strings,e=new F(t)),e}k(t){R(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,r=0;for(const s of t)r===e.length?e.push(n=new tt(this.O(U()),this.O(U()),this,this.options)):n=e[r],n._$AI(s),r++;r2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=X}_$AI(t,e=this,n,r){const s=this.strings;let o=!1;if(void 0===s)t=J(this,t,e,0),o=!j(t)||t!==this._$AH&&t!==W,o&&(this._$AH=t);else{const r=t;let i,a;for(t=s[0],i=0;i{const r=n?.renderBefore??e;let o=r._$litPart$;if(void 0===o){const t=n?.renderBefore??null;r._$litPart$=o=new et(e.insertBefore(H(),t),t,void 0,n??{})}return o._$AI(t),o})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Y}}ct._$litElement$=!0,ct.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ct});const lt=globalThis.litElementPolyfillSupport;lt?.({LitElement:ct}),(globalThis.litElementVersions??=[]).push("4.0.6"); +class at extends A{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this.o=((t,e,n)=>{const r=n?.renderBefore??e;let s=r._$litPart$;if(void 0===s){const t=n?.renderBefore??null;r._$litPart$=s=new tt(e.insertBefore(U(),t),t,void 0,n??{})}return s._$AI(t),s})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.o?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.o?.setConnected(!1)}render(){return W}}at._$litElement$=!0,at.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:at});const ct=globalThis.litElementPolyfillSupport;ct?.({LitElement:at}),(globalThis.litElementVersions??=[]).push("4.1.0"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const ft={attribute:!0,type:String,converter:x,reflect:!1,hasChanged:k},ht=(t=ft,e,n)=>{const{kind:r,metadata:o}=n;let i=globalThis.litPropertyMetadata.get(o);if(void 0===i&&globalThis.litPropertyMetadata.set(o,i=new Map),i.set(n.name,t),"accessor"===r){const{name:r}=n;return{set(n){const o=e.get.call(this);e.set.call(this,n),this.requestUpdate(r,o,t)},init(e){return void 0!==e&&this.P(r,void 0,t),e}}}if("setter"===r){const{name:r}=n;return function(n){const o=this[r];e.call(this,n),this.requestUpdate(r,o,t)}}throw Error("Unsupported decorator location: "+r)};function ut(t){return(e,n)=>"object"==typeof n?ht(t,e,n):((t,e,n)=>{const r=e.hasOwnProperty(n);return e.constructor.createProperty(n,r?{...t,wrapped:!0}:t),r?Object.getOwnPropertyDescriptor(e,n):void 0})(t,e,n) +const lt={attribute:!0,type:String,converter:x,reflect:!1,hasChanged:k},ht=(t=lt,e,n)=>{const{kind:r,metadata:s}=n;let o=globalThis.litPropertyMetadata.get(s);if(void 0===o&&globalThis.litPropertyMetadata.set(s,o=new Map),o.set(n.name,t),"accessor"===r){const{name:r}=n;return{set(n){const s=e.get.call(this);e.set.call(this,n),this.requestUpdate(r,s,t)},init(e){return void 0!==e&&this.P(r,void 0,t),e}}}if("setter"===r){const{name:r}=n;return function(n){const s=this[r];e.call(this,n),this.requestUpdate(r,s,t)}}throw Error("Unsupported decorator location: "+r)};function dt(t){return(e,n)=>"object"==typeof n?ht(t,e,n):((t,e,n)=>{const r=e.hasOwnProperty(n);return e.constructor.createProperty(n,r?{...t,wrapped:!0}:t),r?Object.getOwnPropertyDescriptor(e,n):void 0})(t,e,n) /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */}function dt(t){return ut({...t,state:!0,attribute:!1})} + */} /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const pt=1;let gt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}; + */ +const ft=1;class ut{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this.t=t,this._$AM=e,this.i=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}} /** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const bt="important",vt=" !"+bt,yt=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends gt{constructor(t){if(super(t),t.type!==pt||"style"!==t.name||t.strings?.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,n)=>{const r=t[n];return null==r?e:e+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`}),"")}update(t,[e]){const{style:n}=t.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)null==e[t]&&(this.ft.delete(t),t.includes("-")?n.removeProperty(t):n[t]=null);for(const t in e){const r=e[t];if(null!=r){this.ft.add(t);const e="string"==typeof r&&r.endsWith(vt);t.includes("-")||e?n.setProperty(t,e?r.slice(0,-11):r,e?bt:""):n[t]=r}}return Y}});var mt=function(t){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.width=this.canvas.width=t.width,this.height=this.canvas.height=t.height,this.context.drawImage(t,0,0,this.width,this.height)};mt.prototype.getPixelCount=function(){return this.width*this.height},mt.prototype.getImageData=function(){return this.context.getImageData(0,0,this.width,this.height)};var _t=function(){};if(_t.prototype.getColor=function(t,e){return this.getPalette(t,5,e)[0]},_t.prototype.getPalette=function(t,e,n){(void 0===e||e<2||e>256)&&(e=10),(void 0===n||n<1)&&(n=10);for(var r,o,i,a,s=new mt(t),c=s.getImageData().data,l=s.getPixelCount(),f=[],h=0;h=125&&(o>250&&i>250&&a>250||f.push([o,i,a]));var u=xt.quantize(f,e);return u?u.palette():null},_t.prototype.getColorFromUrl=function(t,e,n){var r=document.createElement("img"),o=this;r.addEventListener("load",(function(){var i=o.getPalette(r,5,n);e(i[0],t)})),r.src=t},_t.prototype.getImageData=function(t,e){var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){if(200==this.status){var t=new Uint8Array(this.response);r=t.length;for(var n=new Array(r),r=0;re?1:0},sum:function(t,e){var n={};return t.reduce(e?function(t,r,o){return n.index=o,t+e.call(n,r)}:function(t,e){return t+e},0)},max:function(t,e){return Math.max.apply(null,e?wt.map(t,e):t)}};var xt=function(){var t=5,e=8-t;function n(e,n,r){return(e<<2*t)+(n<f/2){for(o=e.copy(),i=e.copy(),s=(n=a-e[c])<=(r=e[l]-a)?Math.min(e[l]-1,~~(a+r/2)):Math.max(e[c],~~(a-1-n/2));!h[s];)s++;for(d=u[s];!d&&h[s-1];)d=u[--s];return o[l]=s,i[c]=o[l]+1,[o,i]}}(i==r?"r":i==o?"g":"b")}}return o.prototype={volume:function(t){return this._volume&&!t||(this._volume=(this.r2-this.r1+1)*(this.g2-this.g1+1)*(this.b2-this.b1+1)),this._volume},count:function(t){var e=this.histo;if(!this._count_set||t){var r,o,i,a=0;for(r=this.r1;r<=this.r2;r++)for(o=this.g1;o<=this.g2;o++)for(i=this.b1;i<=this.b2;i++)a+=e[n(r,o,i)]||0;this._count=a,this._count_set=!0}return this._count},copy:function(){return new o(this.r1,this.r2,this.g1,this.g2,this.b1,this.b2,this.histo)},avg:function(e){var r=this.histo;if(!this._avg||e){var o,i,a,s,c=0,l=1<<8-t,f=0,h=0,u=0;for(i=this.r1;i<=this.r2;i++)for(a=this.g1;a<=this.g2;a++)for(s=this.b1;s<=this.b2;s++)c+=o=r[n(i,a,s)]||0,f+=o*(i+.5)*l,h+=o*(a+.5)*l,u+=o*(s+.5)*l;this._avg=c?[~~(f/c),~~(h/c),~~(u/c)]:[~~(l*(this.r1+this.r2+1)/2),~~(l*(this.g1+this.g2+1)/2),~~(l*(this.b1+this.b2+1)/2)]}return this._avg},contains:function(t){var n=t[0]>>e,r=t[1]>>e,o=t[2]>>e;return n>=this.r1&&n<=this.r2&&r>=this.g1&&r<=this.g2&&o>=this.b1&&o<=this.b2}},i.prototype={push:function(t){this.vboxes.push({vbox:t,color:t.avg()})},palette:function(){return this.vboxes.map((function(t){return t.color}))},size:function(){return this.vboxes.size()},map:function(t){for(var e=this.vboxes,n=0;n251&&r[1]>251&&r[2]>251&&(t[n].color=[255,255,255])}},{quantize:function(s,c){if(!s.length||c<2||c>256)return!1;var l=function(r){var o,i=new Array(1<<3*t);return r.forEach((function(t){o=n(t[0]>>e,t[1]>>e,t[2]>>e),i[o]=(i[o]||0)+1})),i}(s);l.forEach((function(){}));var f=function(t,n){var r,i,a,s=1e6,c=0,l=1e6,f=0,h=1e6,u=0;return t.forEach((function(t){(r=t[0]>>e)c&&(c=r),(i=t[1]>>e)f&&(f=i),(a=t[2]>>e)u&&(u=a)})),new o(s,c,l,f,h,u,n)}(s,l),h=new r((function(t,e){return wt.naturalOrder(t.count(),e.count())}));function u(t,e){for(var n,r=1,o=0;o<1e3;)if((n=t.pop()).count()){var i=a(l,n),s=i[0],c=i[1];if(!s)return;if(t.push(s),c&&(t.push(c),r++),r>=e)return;if(o++>1e3)return}else t.push(n),o++}h.push(f),u(h,.75*c);for(var d=new r((function(t,e){return wt.naturalOrder(t.count()*t.volume(),e.count()*e.volume())}));h.size();)d.push(h.pop());u(d,c-d.size());for(var p=new i;d.size();)p.push(d.pop());return p}}}();"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function kt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $t={exports:{}}; + */const pt="important",gt=" !"+pt,bt=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends ut{constructor(t){if(super(t),t.type!==ft||"style"!==t.name||t.strings?.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,n)=>{const r=t[n];return null==r?e:e+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`}),"")}update(t,[e]){const{style:n}=t.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)null==e[t]&&(this.ft.delete(t),t.includes("-")?n.removeProperty(t):n[t]=null);for(const t in e){const r=e[t];if(null!=r){this.ft.add(t);const e="string"==typeof r&&r.endsWith(gt);t.includes("-")||e?n.setProperty(t,e?r.slice(0,-11):r,e?pt:""):n[t]=r}}return W}}),{min:mt,max:vt}=Math;var yt=(t,e=0,n=1)=>mt(vt(e,t),n),wt=t=>{t._clipped=!1,t._unclipped=t.slice(0);for(let e=0;e<=3;e++)e<3?((t[e]<0||t[e]>255)&&(t._clipped=!0),t[e]=yt(t[e],0,255)):3===e&&(t[e]=yt(t[e],0,1));return t};const _t={};for(let t of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])_t[`[object ${t}]`]=t.toLowerCase();function xt(t){return _t[Object.prototype.toString.call(t)]||"object"}var kt=(t,e=null)=>t.length>=3?Array.prototype.slice.call(t):"object"==xt(t[0])&&e?e.split("").filter((e=>void 0!==t[0][e])).map((e=>t[0][e])):t[0].slice(0),$t=t=>{if(t.length<2)return null;const e=t.length-1;return"string"==xt(t[e])?t[e].toLowerCase():null};const{PI:At,min:Et,max:Ct}=Math,Mt=t=>Math.round(100*t)/100,St=t=>Math.round(100*t)/100,Ot=2*At,Pt=At/3,Lt=At/180,Nt=180/At;var Ut={format:{},autodetect:[]};class jt{constructor(...t){const e=this;if("object"===xt(t[0])&&t[0].constructor&&t[0].constructor===this.constructor)return t[0];let n=$t(t),r=!1;if(!n){r=!0,Ut.sorted||(Ut.autodetect=Ut.autodetect.sort(((t,e)=>e.p-t.p)),Ut.sorted=!0);for(let e of Ut.autodetect)if(n=e.test(...t),n)break}if(!Ut.format[n])throw new Error("unknown format: "+t);{const s=Ut.format[n].apply(null,r?t:t.slice(0,-1));e._rgb=wt(s)}3===e._rgb.length&&e._rgb.push(1)}toString(){return"function"==xt(this.hex)?this.hex():`[${this._rgb.join(",")}]`}}const Rt=(...t)=>new jt(...t);Rt.version="3.1.1";const Ht={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},zt=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Bt=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Tt=t=>{if(t.match(zt)){4!==t.length&&7!==t.length||(t=t.substr(1)),3===t.length&&(t=(t=t.split(""))[0]+t[0]+t[1]+t[1]+t[2]+t[2]);const e=parseInt(t,16);return[e>>16,e>>8&255,255&e,1]}if(t.match(Bt)){5!==t.length&&9!==t.length||(t=t.substr(1)),4===t.length&&(t=(t=t.split(""))[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);const e=parseInt(t,16);return[e>>24&255,e>>16&255,e>>8&255,Math.round((255&e)/255*100)/100]}throw new Error(`unknown hex color: ${t}`)},{round:qt}=Math,It=(...t)=>{let[e,n,r,s]=kt(t,"rgba"),o=$t(t)||"auto";void 0===s&&(s=1),"auto"===o&&(o=s<1?"rgba":"rgb"),e=qt(e),n=qt(n),r=qt(r);let i="000000"+(e<<16|n<<8|r).toString(16);i=i.substr(i.length-6);let a="0"+qt(255*s).toString(16);switch(a=a.substr(a.length-2),o.toLowerCase()){case"rgba":return`#${i}${a}`;case"argb":return`#${a}${i}`;default:return`#${i}`}};jt.prototype.name=function(){const t=It(this._rgb,"rgb");for(let e of Object.keys(Ht))if(Ht[e]===t)return e.toLowerCase();return t},Ut.format.named=t=>{if(t=t.toLowerCase(),Ht[t])return Tt(Ht[t]);throw new Error("unknown color name: "+t)},Ut.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&"string"===xt(t)&&Ht[t.toLowerCase()])return"named"}}),jt.prototype.alpha=function(t,e=!1){return void 0!==t&&"number"===xt(t)?e?(this._rgb[3]=t,this):new jt([this._rgb[0],this._rgb[1],this._rgb[2],t],"rgb"):this._rgb[3]},jt.prototype.clipped=function(){return this._rgb._clipped||!1};const Dt={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},Yt=new Map([["a",[1.0985,.35585]],["b",[1.0985,.35585]],["c",[.98074,1.18232]],["d50",[.96422,.82521]],["d55",[.95682,.92149]],["d65",[.95047,1.08883]],["e",[1,1,1]],["f2",[.99186,.67393]],["f7",[.95041,1.08747]],["f11",[1.00962,.6435]],["icc",[.96422,.82521]]]);function Gt(t){const e=Yt.get(String(t).toLowerCase());if(!e)throw new Error("unknown Lab illuminant "+t);Dt.labWhitePoint=t,Dt.Xn=e[0],Dt.Zn=e[1]}function Wt(){return Dt.labWhitePoint}const Xt=(...t)=>{t=kt(t,"lab");const[e,n,r]=t,[s,o,i]=Zt(e,n,r),[a,c,l]=Kt(s,o,i);return[a,c,l,t.length>3?t[3]:1]},Zt=(t,e,n)=>{const{kE:r,kK:s,kKE:o,Xn:i,Yn:a,Zn:c}=Dt,l=(t+16)/116,h=.002*e+l,d=l-.005*n,f=h*h*h,u=d*d*d;return[(f>r?f:(116*h-16)/s)*i,(t>o?Math.pow((t+16)/116,3):t/s)*a,(u>r?u:(116*d-16)/s)*c]},Vt=t=>{const e=Math.sign(t);return((t=Math.abs(t))<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)*e},Kt=(t,e,n)=>{const{MtxAdaptMa:r,MtxAdaptMaI:s,MtxXYZ2RGB:o,RefWhiteRGB:i,Xn:a,Yn:c,Zn:l}=Dt,h=a*r.m00+c*r.m10+l*r.m20,d=a*r.m01+c*r.m11+l*r.m21,f=a*r.m02+c*r.m12+l*r.m22,u=i.X*r.m00+i.Y*r.m10+i.Z*r.m20,p=i.X*r.m01+i.Y*r.m11+i.Z*r.m21,g=i.X*r.m02+i.Y*r.m12+i.Z*r.m22,b=(t*r.m00+e*r.m10+n*r.m20)*(u/h),m=(t*r.m01+e*r.m11+n*r.m21)*(p/d),v=(t*r.m02+e*r.m12+n*r.m22)*(g/f),y=b*s.m00+m*s.m10+v*s.m20,w=b*s.m01+m*s.m11+v*s.m21,_=b*s.m02+m*s.m12+v*s.m22;return[255*Vt(y*o.m00+w*o.m10+_*o.m20),255*Vt(y*o.m01+w*o.m11+_*o.m21),255*Vt(y*o.m02+w*o.m12+_*o.m22)]},Ft=(...t)=>{const[e,n,r,...s]=kt(t,"rgb"),[o,i,a]=Qt(e,n,r),[c,l,h]=function(t,e,n){const{Xn:r,Yn:s,Zn:o,kE:i,kK:a}=Dt,c=t/r,l=e/s,h=n/o,d=c>i?Math.pow(c,1/3):(a*c+16)/116,f=l>i?Math.pow(l,1/3):(a*l+16)/116,u=h>i?Math.pow(h,1/3):(a*h+16)/116;return[116*f-16,500*(d-f),200*(f-u)]}(o,i,a);return[c,l,h,...s.length>0&&s[0]<1?[s[0]]:[]]};function Jt(t){const e=Math.sign(t);return((t=Math.abs(t))<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))*e}const Qt=(t,e,n)=>{t=Jt(t/255),e=Jt(e/255),n=Jt(n/255);const{MtxRGB2XYZ:r,MtxAdaptMa:s,MtxAdaptMaI:o,Xn:i,Yn:a,Zn:c,As:l,Bs:h,Cs:d}=Dt;let f=t*r.m00+e*r.m10+n*r.m20,u=t*r.m01+e*r.m11+n*r.m21,p=t*r.m02+e*r.m12+n*r.m22;const g=i*s.m00+a*s.m10+c*s.m20,b=i*s.m01+a*s.m11+c*s.m21,m=i*s.m02+a*s.m12+c*s.m22;let v=f*s.m00+u*s.m10+p*s.m20,y=f*s.m01+u*s.m11+p*s.m21,w=f*s.m02+u*s.m12+p*s.m22;return v*=g/l,y*=b/h,w*=m/d,f=v*o.m00+y*o.m10+w*o.m20,u=v*o.m01+y*o.m11+w*o.m21,p=v*o.m02+y*o.m12+w*o.m22,[f,u,p]};jt.prototype.lab=function(){return Ft(this._rgb)};Object.assign(Rt,{lab:(...t)=>new jt(...t,"lab"),getLabWhitePoint:Wt,setLabWhitePoint:Gt}),Ut.format.lab=Xt,Ut.autodetect.push({p:2,test:(...t)=>{if("array"===xt(t=kt(t,"lab"))&&3===t.length)return"lab"}}),jt.prototype.darken=function(t=1){const e=this.lab();return e[0]-=Dt.Kn*t,new jt(e,"lab").alpha(this.alpha(),!0)},jt.prototype.brighten=function(t=1){return this.darken(-t)},jt.prototype.darker=jt.prototype.darken,jt.prototype.brighter=jt.prototype.brighten,jt.prototype.get=function(t){const[e,n]=t.split("."),r=this[e]();if(n){const t=e.indexOf(n)-("ok"===e.substr(0,2)?2:0);if(t>-1)return r[t];throw new Error(`unknown channel ${n} in mode ${e}`)}return r};const{pow:te}=Math;jt.prototype.luminance=function(t,e="rgb"){if(void 0!==t&&"number"===xt(t)){if(0===t)return new jt([0,0,0,this._rgb[3]],"rgb");if(1===t)return new jt([255,255,255,this._rgb[3]],"rgb");let n=this.luminance(),r=20;const s=(n,o)=>{const i=n.interpolate(o,.5,e),a=i.luminance();return Math.abs(t-a)<1e-7||!r--?i:a>t?s(n,i):s(i,o)},o=(n>t?s(new jt([0,0,0]),this):s(this,new jt([255,255,255]))).rgb();return new jt([...o,this._rgb[3]])}return ee(...this._rgb.slice(0,3))};const ee=(t,e,n)=>.2126*(t=ne(t))+.7152*(e=ne(e))+.0722*(n=ne(n)),ne=t=>(t/=255)<=.03928?t/12.92:te((t+.055)/1.055,2.4);var re={},se=(t,e,n=.5,...r)=>{let s=r[0]||"lrgb";if(re[s]||r.length||(s=Object.keys(re)[0]),!re[s])throw new Error(`interpolation mode ${s} is not defined`);return"object"!==xt(t)&&(t=new jt(t)),"object"!==xt(e)&&(e=new jt(e)),re[s](t,e,n).alpha(t.alpha()+n*(e.alpha()-t.alpha()))};jt.prototype.mix=jt.prototype.interpolate=function(t,e=.5,...n){return se(this,t,e,...n)},jt.prototype.premultiply=function(t=!1){const e=this._rgb,n=e[3];return t?(this._rgb=[e[0]*n,e[1]*n,e[2]*n,n],this):new jt([e[0]*n,e[1]*n,e[2]*n,n],"rgb")};const{sin:oe,cos:ie}=Math,ae=(...t)=>{let[e,n,r]=kt(t,"lch");return isNaN(r)&&(r=0),r*=Lt,[e,ie(r)*n,oe(r)*n]},ce=(...t)=>{t=kt(t,"lch");const[e,n,r]=t,[s,o,i]=ae(e,n,r),[a,c,l]=Xt(s,o,i);return[a,c,l,t.length>3?t[3]:1]},{sqrt:le,atan2:he,round:de}=Math,fe=(...t)=>{const[e,n,r]=kt(t,"lab"),s=le(n*n+r*r);let o=(he(r,n)*Nt+360)%360;return 0===de(1e4*s)&&(o=Number.NaN),[e,s,o]},ue=(...t)=>{const[e,n,r,...s]=kt(t,"rgb"),[o,i,a]=Ft(e,n,r),[c,l,h]=fe(o,i,a);return[c,l,h,...s.length>0&&s[0]<1?[s[0]]:[]]};jt.prototype.lch=function(){return ue(this._rgb)},jt.prototype.hcl=function(){return ue(this._rgb).reverse()};Object.assign(Rt,{lch:(...t)=>new jt(...t,"lch"),hcl:(...t)=>new jt(...t,"hcl")}),Ut.format.lch=ce,Ut.format.hcl=(...t)=>{const e=kt(t,"hcl").reverse();return ce(...e)},["lch","hcl"].forEach((t=>Ut.autodetect.push({p:2,test:(...e)=>{if("array"===xt(e=kt(e,t))&&3===e.length)return t}}))),jt.prototype.saturate=function(t=1){const e=this.lch();return e[1]+=Dt.Kn*t,e[1]<0&&(e[1]=0),new jt(e,"lch").alpha(this.alpha(),!0)},jt.prototype.desaturate=function(t=1){return this.saturate(-t)},jt.prototype.set=function(t,e,n=!1){const[r,s]=t.split("."),o=this[r]();if(s){const t=r.indexOf(s)-("ok"===r.substr(0,2)?2:0);if(t>-1){if("string"==xt(e))switch(e.charAt(0)){case"+":case"-":o[t]+=+e;break;case"*":o[t]*=+e.substr(1);break;case"/":o[t]/=+e.substr(1);break;default:o[t]=+e}else{if("number"!==xt(e))throw new Error("unsupported value for Color.set");o[t]=e}const s=new jt(o,r);return n?(this._rgb=s._rgb,this):s}throw new Error(`unknown channel ${s} in mode ${r}`)}return o},jt.prototype.tint=function(t=.5,...e){return se(this,"white",t,...e)},jt.prototype.shade=function(t=.5,...e){return se(this,"black",t,...e)};re.rgb=(t,e,n)=>{const r=t._rgb,s=e._rgb;return new jt(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"rgb")};const{sqrt:pe,pow:ge}=Math;re.lrgb=(t,e,n)=>{const[r,s,o]=t._rgb,[i,a,c]=e._rgb;return new jt(pe(ge(r,2)*(1-n)+ge(i,2)*n),pe(ge(s,2)*(1-n)+ge(a,2)*n),pe(ge(o,2)*(1-n)+ge(c,2)*n),"rgb")};re.lab=(t,e,n)=>{const r=t.lab(),s=e.lab();return new jt(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"lab")};var be=(t,e,n,r)=>{let s,o,i,a,c,l,h,d,f,u,p,g;return"hsl"===r?(s=t.hsl(),o=e.hsl()):"hsv"===r?(s=t.hsv(),o=e.hsv()):"hcg"===r?(s=t.hcg(),o=e.hcg()):"hsi"===r?(s=t.hsi(),o=e.hsi()):"lch"===r||"hcl"===r?(r="hcl",s=t.hcl(),o=e.hcl()):"oklch"===r&&(s=t.oklch().reverse(),o=e.oklch().reverse()),"h"!==r.substr(0,1)&&"oklch"!==r||([i,c,h]=s,[a,l,d]=o),isNaN(i)||isNaN(a)?isNaN(i)?isNaN(a)?u=Number.NaN:(u=a,1!=h&&0!=h||"hsv"==r||(f=l)):(u=i,1!=d&&0!=d||"hsv"==r||(f=c)):(g=a>i&&a-i>180?a-(i+360):a180?a+360-i:a-i,u=i+n*g),void 0===f&&(f=c+n*(l-c)),p=h+n*(d-h),new jt("oklch"===r?[p,f,u]:[u,f,p],r)};const me=(t,e,n)=>be(t,e,n,"lch");re.lch=me,re.hcl=me;jt.prototype.num=function(){return((...t)=>{const[e,n,r]=kt(t,"rgb");return(e<<16)+(n<<8)+r})(this._rgb)};Object.assign(Rt,{num:(...t)=>new jt(...t,"num")}),Ut.format.num=t=>{if("number"==xt(t)&&t>=0&&t<=16777215){return[t>>16,t>>8&255,255&t,1]}throw new Error("unknown num color: "+t)},Ut.autodetect.push({p:5,test:(...t)=>{if(1===t.length&&"number"===xt(t[0])&&t[0]>=0&&t[0]<=16777215)return"num"}});re.num=(t,e,n)=>{const r=t.num(),s=e.num();return new jt(r+n*(s-r),"num")};const{floor:ve}=Math;jt.prototype.hcg=function(){return((...t)=>{const[e,n,r]=kt(t,"rgb"),s=Et(e,n,r),o=Ct(e,n,r),i=o-s,a=100*i/255,c=s/(255-i)*100;let l;return 0===i?l=Number.NaN:(e===o&&(l=(n-r)/i),n===o&&(l=2+(r-e)/i),r===o&&(l=4+(e-n)/i),l*=60,l<0&&(l+=360)),[l,a,c]})(this._rgb)};Rt.hcg=(...t)=>new jt(...t,"hcg"),Ut.format.hcg=(...t)=>{t=kt(t,"hcg");let e,n,r,[s,o,i]=t;i*=255;const a=255*o;if(0===o)e=n=r=i;else{360===s&&(s=0),s>360&&(s-=360),s<0&&(s+=360),s/=60;const t=ve(s),c=s-t,l=i*(1-o),h=l+a*(1-c),d=l+a*c,f=l+a;switch(t){case 0:[e,n,r]=[f,d,l];break;case 1:[e,n,r]=[h,f,l];break;case 2:[e,n,r]=[l,f,d];break;case 3:[e,n,r]=[l,h,f];break;case 4:[e,n,r]=[d,l,f];break;case 5:[e,n,r]=[f,l,h]}}return[e,n,r,t.length>3?t[3]:1]},Ut.autodetect.push({p:1,test:(...t)=>{if("array"===xt(t=kt(t,"hcg"))&&3===t.length)return"hcg"}});re.hcg=(t,e,n)=>be(t,e,n,"hcg");const{cos:ye}=Math,{min:we,sqrt:_e,acos:xe}=Math;jt.prototype.hsi=function(){return((...t)=>{let e,[n,r,s]=kt(t,"rgb");n/=255,r/=255,s/=255;const o=we(n,r,s),i=(n+r+s)/3,a=i>0?1-o/i:0;return 0===a?e=NaN:(e=(n-r+(n-s))/2,e/=_e((n-r)*(n-r)+(n-s)*(r-s)),e=xe(e),s>r&&(e=Ot-e),e/=Ot),[360*e,a,i]})(this._rgb)};Rt.hsi=(...t)=>new jt(...t,"hsi"),Ut.format.hsi=(...t)=>{t=kt(t,"hsi");let e,n,r,[s,o,i]=t;return isNaN(s)&&(s=0),isNaN(o)&&(o=0),s>360&&(s-=360),s<0&&(s+=360),s/=360,s<1/3?(r=(1-o)/3,e=(1+o*ye(Ot*s)/ye(Pt-Ot*s))/3,n=1-(r+e)):s<2/3?(s-=1/3,e=(1-o)/3,n=(1+o*ye(Ot*s)/ye(Pt-Ot*s))/3,r=1-(e+n)):(s-=2/3,n=(1-o)/3,r=(1+o*ye(Ot*s)/ye(Pt-Ot*s))/3,e=1-(n+r)),e=yt(i*e*3),n=yt(i*n*3),r=yt(i*r*3),[255*e,255*n,255*r,t.length>3?t[3]:1]},Ut.autodetect.push({p:2,test:(...t)=>{if("array"===xt(t=kt(t,"hsi"))&&3===t.length)return"hsi"}});re.hsi=(t,e,n)=>be(t,e,n,"hsi");const ke=(...t)=>{t=kt(t,"hsl");const[e,n,r]=t;let s,o,i;if(0===n)s=o=i=255*r;else{const t=[0,0,0],a=[0,0,0],c=r<.5?r*(1+n):r+n-r*n,l=2*r-c,h=e/360;t[0]=h+1/3,t[1]=h,t[2]=h-1/3;for(let e=0;e<3;e++)t[e]<0&&(t[e]+=1),t[e]>1&&(t[e]-=1),6*t[e]<1?a[e]=l+6*(c-l)*t[e]:2*t[e]<1?a[e]=c:3*t[e]<2?a[e]=l+(c-l)*(2/3-t[e])*6:a[e]=l;[s,o,i]=[255*a[0],255*a[1],255*a[2]]}return t.length>3?[s,o,i,t[3]]:[s,o,i,1]},$e=(...t)=>{t=kt(t,"rgba");let[e,n,r]=t;e/=255,n/=255,r/=255;const s=Et(e,n,r),o=Ct(e,n,r),i=(o+s)/2;let a,c;return o===s?(a=0,c=Number.NaN):a=i<.5?(o-s)/(o+s):(o-s)/(2-o-s),e==o?c=(n-r)/(o-s):n==o?c=2+(r-e)/(o-s):r==o&&(c=4+(e-n)/(o-s)),c*=60,c<0&&(c+=360),t.length>3&&void 0!==t[3]?[c,a,i,t[3]]:[c,a,i]};jt.prototype.hsl=function(){return $e(this._rgb)};Rt.hsl=(...t)=>new jt(...t,"hsl"),Ut.format.hsl=ke,Ut.autodetect.push({p:2,test:(...t)=>{if("array"===xt(t=kt(t,"hsl"))&&3===t.length)return"hsl"}});re.hsl=(t,e,n)=>be(t,e,n,"hsl");const{floor:Ae}=Math,{min:Ee,max:Ce}=Math;jt.prototype.hsv=function(){return((...t)=>{t=kt(t,"rgb");let[e,n,r]=t;const s=Ee(e,n,r),o=Ce(e,n,r),i=o-s;let a,c,l;return l=o/255,0===o?(a=Number.NaN,c=0):(c=i/o,e===o&&(a=(n-r)/i),n===o&&(a=2+(r-e)/i),r===o&&(a=4+(e-n)/i),a*=60,a<0&&(a+=360)),[a,c,l]})(this._rgb)};Rt.hsv=(...t)=>new jt(...t,"hsv"),Ut.format.hsv=(...t)=>{t=kt(t,"hsv");let e,n,r,[s,o,i]=t;if(i*=255,0===o)e=n=r=i;else{360===s&&(s=0),s>360&&(s-=360),s<0&&(s+=360),s/=60;const t=Ae(s),a=s-t,c=i*(1-o),l=i*(1-o*a),h=i*(1-o*(1-a));switch(t){case 0:[e,n,r]=[i,h,c];break;case 1:[e,n,r]=[l,i,c];break;case 2:[e,n,r]=[c,i,h];break;case 3:[e,n,r]=[c,l,i];break;case 4:[e,n,r]=[h,c,i];break;case 5:[e,n,r]=[i,c,l]}}return[e,n,r,t.length>3?t[3]:1]},Ut.autodetect.push({p:2,test:(...t)=>{if("array"===xt(t=kt(t,"hsv"))&&3===t.length)return"hsv"}});function Me(t,e){let n=t.length;Array.isArray(t[0])||(t=[t]),Array.isArray(e[0])||(e=e.map((t=>[t])));let r=e[0].length,s=e[0].map(((t,n)=>e.map((t=>t[n])))),o=t.map((t=>s.map((e=>Array.isArray(t)?t.reduce(((t,n,r)=>t+n*(e[r]||0)),0):e.reduce(((e,n)=>e+n*t),0)))));return 1===n&&(o=o[0]),1===r?o.map((t=>t[0])):o}re.hsv=(t,e,n)=>be(t,e,n,"hsv");const Se=(...t)=>{t=kt(t,"lab");const[e,n,r,...s]=t,[o,i,a]=(c=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],l=Me([[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],[e,n,r]),Me(c,l.map((t=>t**3))));var c,l;const[h,d,f]=Kt(o,i,a);return[h,d,f,...s.length>0&&s[0]<1?[s[0]]:[]]};const Oe=(...t)=>{const[e,n,r,...s]=kt(t,"rgb"),o=function(t){const e=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],n=Me([[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],t);return Me(e,n.map((t=>Math.cbrt(t))))}(Qt(e,n,r));return[...o,...s.length>0&&s[0]<1?[s[0]]:[]]};jt.prototype.oklab=function(){return Oe(this._rgb)};Object.assign(Rt,{oklab:(...t)=>new jt(...t,"oklab")}),Ut.format.oklab=Se,Ut.autodetect.push({p:2,test:(...t)=>{if("array"===xt(t=kt(t,"oklab"))&&3===t.length)return"oklab"}});re.oklab=(t,e,n)=>{const r=t.oklab(),s=e.oklab();return new jt(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"oklab")};re.oklch=(t,e,n)=>be(t,e,n,"oklch");const{pow:Pe,sqrt:Le,PI:Ne,cos:Ue,sin:je,atan2:Re}=Math;const He=(t,e)=>{const n=t.length,r=[0,0,0,0];for(let s=0;s.9999999&&(r[3]=1),new jt(wt(r))},{pow:ze}=Math;function Be(t){let e="rgb",n=Rt("#ccc"),r=0,s=[0,1],o=[],i=[0,0],a=!1,c=[],l=!1,h=0,d=1,f=!1,u={},p=!0,g=1;const b=function(t){if((t=t||["#fff","#000"])&&"string"===xt(t)&&Rt.brewer&&Rt.brewer[t.toLowerCase()]&&(t=Rt.brewer[t.toLowerCase()]),"array"===xt(t)){1===t.length&&(t=[t[0],t[0]]),t=t.slice(0);for(let e=0;et,v=t=>t;const y=function(t,r){let s,l;if(null==r&&(r=!1),isNaN(t)||null===t)return n;if(r)l=t;else if(a&&a.length>2){const e=function(t){if(null!=a){const e=a.length-1;let n=0;for(;n=a[n];)n++;return n-1}return 0}(t);l=e/(a.length-2)}else l=d!==h?(t-h)/(d-h):1;l=v(l),r||(l=m(l)),1!==g&&(l=ze(l,g)),l=i[0]+l*(1-i[0]-i[1]),l=yt(l,0,1);const f=Math.floor(1e4*l);if(p&&u[f])s=u[f];else{if("array"===xt(c))for(let t=0;t=n&&t===o.length-1){s=c[t];break}if(l>n&&lu={};b(t);const _=function(t){const e=Rt(y(t));return l&&e[l]?e[l]():e};return _.classes=function(t){if(null!=t){if("array"===xt(t))a=t,s=[t[0],t[t.length-1]];else{const e=Rt.analyze(s);a=0===t?[e.min,e.max]:Rt.limits(e,"e",t)}return _}return a},_.domain=function(t){if(!arguments.length)return s;h=t[0],d=t[t.length-1],o=[];const e=c.length;if(t.length===e&&h!==d)for(let e of Array.from(t))o.push((e-h)/(d-h));else{for(let t=0;t2){const e=t.map(((e,n)=>n/(t.length-1))),n=t.map((t=>(t-h)/(d-h)));n.every(((t,n)=>e[n]===t))||(v=t=>{if(t<=0||t>=1)return t;let r=0;for(;t>=n[r+1];)r++;const s=(t-n[r])/(n[r+1]-n[r]);return e[r]+s*(e[r+1]-e[r])})}}return s=[h,d],_},_.mode=function(t){return arguments.length?(e=t,w(),_):e},_.range=function(t,e){return b(t),_},_.out=function(t){return l=t,_},_.spread=function(t){return arguments.length?(r=t,_):r},_.correctLightness=function(t){return null==t&&(t=!0),f=t,w(),m=f?function(t){const e=y(0,!0).lab()[0],n=y(1,!0).lab()[0],r=e>n;let s=y(t,!0).lab()[0];const o=e+(n-e)*t;let i=s-o,a=0,c=1,l=20;for(;Math.abs(i)>.01&&l-- >0;)r&&(i*=-1),i<0?(a=t,t+=.5*(c-t)):(c=t,t+=.5*(a-t)),s=y(t,!0).lab()[0],i=s-o;return t}:t=>t,_},_.padding=function(t){return null!=t?("number"===xt(t)&&(t=[t,t]),i=t,_):i},_.colors=function(e,n){arguments.length<2&&(n="hex");let r=[];if(0===arguments.length)r=c.slice(0);else if(1===e)r=[_(.5)];else if(e>1){const t=s[0],n=s[1]-t;r=function(t,e){let n=[],r=ts;r?e++:e--)n.push(e);return n}(0,e).map((r=>_(t+r/(e-1)*n)))}else{t=[];let e=[];if(a&&a.length>2)for(let t=1,n=a.length,r=1<=n;r?tn;r?t++:t--)e.push(.5*(a[t-1]+a[t]));else e=s;r=e.map((t=>_(t)))}return Rt[n]&&(r=r.map((t=>t[n]()))),r},_.cache=function(t){return null!=t?(p=t,_):p},_.gamma=function(t){return null!=t?(g=t,_):g},_.nodata=function(t){return null!=t?(n=Rt(t),_):n},_}const{round:Te}=Math;jt.prototype.rgb=function(t=!0){return!1===t?this._rgb.slice(0,3):this._rgb.slice(0,3).map(Te)},jt.prototype.rgba=function(t=!0){return this._rgb.slice(0,4).map(((e,n)=>n<3?!1===t?e:Te(e):e))};Object.assign(Rt,{rgb:(...t)=>new jt(...t,"rgb")}),Ut.format.rgb=(...t)=>{const e=kt(t,"rgba");return void 0===e[3]&&(e[3]=1),e},Ut.autodetect.push({p:3,test:(...t)=>{if("array"===xt(t=kt(t,"rgba"))&&(3===t.length||4===t.length&&"number"==xt(t[3])&&t[3]>=0&&t[3]<=1))return"rgb"}});const qe=(t,e,n)=>{if(!qe[n])throw new Error("unknown blend mode "+n);return qe[n](t,e)},Ie=t=>(e,n)=>{const r=Rt(n).rgb(),s=Rt(e).rgb();return Rt.rgb(t(r,s))},De=t=>(e,n)=>{const r=[];return r[0]=t(e[0],n[0]),r[1]=t(e[1],n[1]),r[2]=t(e[2],n[2]),r};qe.normal=Ie(De((t=>t))),qe.multiply=Ie(De(((t,e)=>t*e/255))),qe.screen=Ie(De(((t,e)=>255*(1-(1-t/255)*(1-e/255))))),qe.overlay=Ie(De(((t,e)=>e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255))))),qe.darken=Ie(De(((t,e)=>t>e?e:t))),qe.lighten=Ie(De(((t,e)=>t>e?t:e))),qe.dodge=Ie(De(((t,e)=>255===t||(t=e/255*255/(1-t/255))>255?255:t))),qe.burn=Ie(De(((t,e)=>255*(1-(1-e/255)/(t/255)))));const{pow:Ye,sin:Ge,cos:We}=Math;const{floor:Xe,random:Ze}=Math;const{log:Ve,pow:Ke,floor:Fe,abs:Je}=Math;function Qe(t,e=null){const n={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===xt(t)&&(t=Object.values(t)),t.forEach((t=>{e&&"object"===xt(t)&&(t=t[e]),null==t||isNaN(t)||(n.values.push(t),n.sum+=t,tn.max&&(n.max=t),n.count+=1)})),n.domain=[n.min,n.max],n.limits=(t,e)=>tn(n,t,e),n}function tn(t,e="equal",n=7){"array"==xt(t)&&(t=Qe(t));const{min:r,max:s}=t,o=t.values.sort(((t,e)=>t-e));if(1===n)return[r,s];const i=[];if("c"===e.substr(0,1)&&(i.push(r),i.push(s)),"e"===e.substr(0,1)){i.push(r);for(let t=1;t 0");const t=Math.LOG10E*Ve(r),e=Math.LOG10E*Ve(s);i.push(r);for(let r=1;r200&&(l=!1)}const f={};for(let t=0;tt-e)),i.push(u[0]);for(let t=1;tn?n:t},e=t,n=function(t){t._clipped=!1,t._unclipped=t.slice(0);for(var n=0;n<=3;n++)n<3?((t[n]<0||t[n]>255)&&(t._clipped=!0),t[n]=e(t[n],0,255)):3===n&&(t[n]=e(t[n],0,1));return t},r={},o=0,i=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];o=3?Array.prototype.slice.call(t):"object"==c(t[0])&&e?e.split("").filter((function(e){return void 0!==t[0][e]})).map((function(e){return t[0][e]})):t[0]},f=s,h=function(t){if(t.length<2)return null;var e=t.length-1;return"string"==f(t[e])?t[e].toLowerCase():null},u=Math.PI,d={clip_rgb:n,limit:t,type:s,unpack:l,last:h,PI:u,TWOPI:2*u,PITHIRD:u/3,DEG2RAD:u/180,RAD2DEG:180/u},p={format:{},autodetect:[]},g=d.last,b=d.clip_rgb,v=d.type,y=p,m=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=this;if("object"===v(t[0])&&t[0].constructor&&t[0].constructor===this.constructor)return t[0];var r=g(t),o=!1;if(!r){o=!0,y.sorted||(y.autodetect=y.autodetect.sort((function(t,e){return e.p-t.p})),y.sorted=!0);for(var i=0,a=y.autodetect;i4?t[4]:1;return 1===i?[0,0,0,a]:[n>=1?0:255*(1-n)*(1-i),r>=1?0:255*(1-r)*(1-i),o>=1?0:255*(1-o)*(1-i),a]},O=M,S=x,P=_,L=p,N=d.unpack,H=d.type,U=C;P.prototype.cmyk=function(){return U(this._rgb)},S.cmyk=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(P,[null].concat(t,["cmyk"])))},L.format.cmyk=O,L.autodetect.push({p:2,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=N(t,"cmyk"),"array"===H(t)&&4===t.length)return"cmyk"}});var R=d.unpack,j=d.last,T=function(t){return Math.round(100*t)/100},z=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=R(t,"hsla"),r=j(t)||"lsa";return n[0]=T(n[0]||0),n[1]=T(100*n[1])+"%",n[2]=T(100*n[2])+"%","hsla"===r||n.length>3&&n[3]<1?(n[3]=n.length>3?n[3]:1,r="hsla"):n.length=3,r+"("+n.join(",")+")"},D=z,I=d.unpack,q=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=(t=I(t,"rgba"))[0],r=t[1],o=t[2];n/=255,r/=255,o/=255;var i,a,s=Math.min(n,r,o),c=Math.max(n,r,o),l=(c+s)/2;return c===s?(i=0,a=Number.NaN):i=l<.5?(c-s)/(c+s):(c-s)/(2-c-s),n==c?a=(r-o)/(c-s):r==c?a=2+(o-n)/(c-s):o==c&&(a=4+(n-r)/(c-s)),(a*=60)<0&&(a+=360),t.length>3&&void 0!==t[3]?[a,i,l,t[3]]:[a,i,l]},B=q,F=d.unpack,G=d.last,Y=D,V=B,W=Math.round,X=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=F(t,"rgba"),r=G(t)||"rgb";return"hsl"==r.substr(0,3)?Y(V(n),r):(n[0]=W(n[0]),n[1]=W(n[1]),n[2]=W(n[2]),("rgba"===r||n.length>3&&n[3]<1)&&(n[3]=n.length>3?n[3]:1,r="rgba"),r+"("+n.slice(0,"rgb"===r?3:4).join(",")+")")},Z=X,K=d.unpack,J=Math.round,Q=function(){for(var t,e=[],n=arguments.length;n--;)e[n]=arguments[n];var r,o,i,a=(e=K(e,"hsl"))[0],s=e[1],c=e[2];if(0===s)r=o=i=255*c;else{var l=[0,0,0],f=[0,0,0],h=c<.5?c*(1+s):c+s-c*s,u=2*c-h,d=a/360;l[0]=d+1/3,l[1]=d,l[2]=d-1/3;for(var p=0;p<3;p++)l[p]<0&&(l[p]+=1),l[p]>1&&(l[p]-=1),6*l[p]<1?f[p]=u+6*(h-u)*l[p]:2*l[p]<1?f[p]=h:3*l[p]<2?f[p]=u+(h-u)*(2/3-l[p])*6:f[p]=u;r=(t=[J(255*f[0]),J(255*f[1]),J(255*f[2])])[0],o=t[1],i=t[2]}return e.length>3?[r,o,i,e[3]]:[r,o,i,1]},tt=Q,et=tt,nt=p,rt=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,ot=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,it=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,at=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,st=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,ct=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,lt=Math.round,ft=function(t){var e;if(t=t.toLowerCase().trim(),nt.format.named)try{return nt.format.named(t)}catch(t){}if(e=t.match(rt)){for(var n=e.slice(1,4),r=0;r<3;r++)n[r]=+n[r];return n[3]=1,n}if(e=t.match(ot)){for(var o=e.slice(1,5),i=0;i<4;i++)o[i]=+o[i];return o}if(e=t.match(it)){for(var a=e.slice(1,4),s=0;s<3;s++)a[s]=lt(2.55*a[s]);return a[3]=1,a}if(e=t.match(at)){for(var c=e.slice(1,5),l=0;l<3;l++)c[l]=lt(2.55*c[l]);return c[3]=+c[3],c}if(e=t.match(st)){var f=e.slice(1,4);f[1]*=.01,f[2]*=.01;var h=et(f);return h[3]=1,h}if(e=t.match(ct)){var u=e.slice(1,4);u[1]*=.01,u[2]*=.01;var d=et(u);return d[3]=+e[4],d}};ft.test=function(t){return rt.test(t)||ot.test(t)||it.test(t)||at.test(t)||st.test(t)||ct.test(t)};var ht=ft,ut=x,dt=_,pt=p,gt=d.type,bt=Z,vt=ht;dt.prototype.css=function(t){return bt(this._rgb,t)},ut.css=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(dt,[null].concat(t,["css"])))},pt.format.css=vt,pt.autodetect.push({p:5,test:function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];if(!e.length&&"string"===gt(t)&&vt.test(t))return"css"}});var yt=_,mt=x,_t=p,wt=d.unpack;_t.format.gl=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=wt(t,"rgba");return n[0]*=255,n[1]*=255,n[2]*=255,n},mt.gl=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(yt,[null].concat(t,["gl"])))},yt.prototype.gl=function(){var t=this._rgb;return[t[0]/255,t[1]/255,t[2]/255,t[3]]};var xt=d.unpack,kt=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n,r=xt(t,"rgb"),o=r[0],i=r[1],a=r[2],s=Math.min(o,i,a),c=Math.max(o,i,a),l=c-s,f=100*l/255,h=s/(255-l)*100;return 0===l?n=Number.NaN:(o===c&&(n=(i-a)/l),i===c&&(n=2+(a-o)/l),a===c&&(n=4+(o-i)/l),(n*=60)<0&&(n+=360)),[n,f,h]},$t=kt,At=d.unpack,Ct=Math.floor,Et=function(){for(var t,e,n,r,o,i,a=[],s=arguments.length;s--;)a[s]=arguments[s];var c,l,f,h=(a=At(a,"hcg"))[0],u=a[1],d=a[2];d*=255;var p=255*u;if(0===u)c=l=f=d;else{360===h&&(h=0),h>360&&(h-=360),h<0&&(h+=360);var g=Ct(h/=60),b=h-g,v=d*(1-u),y=v+p*(1-b),m=v+p*b,_=v+p;switch(g){case 0:c=(t=[_,m,v])[0],l=t[1],f=t[2];break;case 1:c=(e=[y,_,v])[0],l=e[1],f=e[2];break;case 2:c=(n=[v,_,m])[0],l=n[1],f=n[2];break;case 3:c=(r=[v,y,_])[0],l=r[1],f=r[2];break;case 4:c=(o=[m,v,_])[0],l=o[1],f=o[2];break;case 5:c=(i=[_,v,y])[0],l=i[1],f=i[2]}}return[c,l,f,a.length>3?a[3]:1]},Mt=Et,Ot=d.unpack,St=d.type,Pt=x,Lt=_,Nt=p,Ht=$t;Lt.prototype.hcg=function(){return Ht(this._rgb)},Pt.hcg=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Lt,[null].concat(t,["hcg"])))},Nt.format.hcg=Mt,Nt.autodetect.push({p:1,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=Ot(t,"hcg"),"array"===St(t)&&3===t.length)return"hcg"}});var Ut=d.unpack,Rt=d.last,jt=Math.round,Tt=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=Ut(t,"rgba"),r=n[0],o=n[1],i=n[2],a=n[3],s=Rt(t)||"auto";void 0===a&&(a=1),"auto"===s&&(s=a<1?"rgba":"rgb");var c="000000"+((r=jt(r))<<16|(o=jt(o))<<8|(i=jt(i))).toString(16);c=c.substr(c.length-6);var l="0"+jt(255*a).toString(16);switch(l=l.substr(l.length-2),s.toLowerCase()){case"rgba":return"#"+c+l;case"argb":return"#"+l+c;default:return"#"+c}},zt=Tt,Dt=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,It=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,qt=function(t){if(t.match(Dt)){4!==t.length&&7!==t.length||(t=t.substr(1)),3===t.length&&(t=(t=t.split(""))[0]+t[0]+t[1]+t[1]+t[2]+t[2]);var e=parseInt(t,16);return[e>>16,e>>8&255,255&e,1]}if(t.match(It)){5!==t.length&&9!==t.length||(t=t.substr(1)),4===t.length&&(t=(t=t.split(""))[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);var n=parseInt(t,16);return[n>>24&255,n>>16&255,n>>8&255,Math.round((255&n)/255*100)/100]}throw new Error("unknown hex color: "+t)},Bt=qt,Ft=x,Gt=_,Yt=d.type,Vt=p,Wt=zt;Gt.prototype.hex=function(t){return Wt(this._rgb,t)},Ft.hex=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Gt,[null].concat(t,["hex"])))},Vt.format.hex=Bt,Vt.autodetect.push({p:4,test:function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];if(!e.length&&"string"===Yt(t)&&[3,4,5,6,7,8,9].indexOf(t.length)>=0)return"hex"}});var Xt=d.unpack,Zt=d.TWOPI,Kt=Math.min,Jt=Math.sqrt,Qt=Math.acos,te=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n,r=Xt(t,"rgb"),o=r[0],i=r[1],a=r[2],s=Kt(o/=255,i/=255,a/=255),c=(o+i+a)/3,l=c>0?1-s/c:0;return 0===l?n=NaN:(n=(o-i+(o-a))/2,n/=Jt((o-i)*(o-i)+(o-a)*(i-a)),n=Qt(n),a>i&&(n=Zt-n),n/=Zt),[360*n,l,c]},ee=te,ne=d.unpack,re=d.limit,oe=d.TWOPI,ie=d.PITHIRD,ae=Math.cos,se=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n,r,o,i=(t=ne(t,"hsi"))[0],a=t[1],s=t[2];return isNaN(i)&&(i=0),isNaN(a)&&(a=0),i>360&&(i-=360),i<0&&(i+=360),(i/=360)<1/3?r=1-((o=(1-a)/3)+(n=(1+a*ae(oe*i)/ae(ie-oe*i))/3)):i<2/3?o=1-((n=(1-a)/3)+(r=(1+a*ae(oe*(i-=1/3))/ae(ie-oe*i))/3)):n=1-((r=(1-a)/3)+(o=(1+a*ae(oe*(i-=2/3))/ae(ie-oe*i))/3)),[255*(n=re(s*n*3)),255*(r=re(s*r*3)),255*(o=re(s*o*3)),t.length>3?t[3]:1]},ce=se,le=d.unpack,fe=d.type,he=x,ue=_,de=p,pe=ee;ue.prototype.hsi=function(){return pe(this._rgb)},he.hsi=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(ue,[null].concat(t,["hsi"])))},de.format.hsi=ce,de.autodetect.push({p:2,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=le(t,"hsi"),"array"===fe(t)&&3===t.length)return"hsi"}});var ge=d.unpack,be=d.type,ve=x,ye=_,me=p,_e=B;ye.prototype.hsl=function(){return _e(this._rgb)},ve.hsl=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(ye,[null].concat(t,["hsl"])))},me.format.hsl=tt,me.autodetect.push({p:2,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=ge(t,"hsl"),"array"===be(t)&&3===t.length)return"hsl"}});var we=d.unpack,xe=Math.min,ke=Math.max,$e=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n,r,o,i=(t=we(t,"rgb"))[0],a=t[1],s=t[2],c=xe(i,a,s),l=ke(i,a,s),f=l-c;return o=l/255,0===l?(n=Number.NaN,r=0):(r=f/l,i===l&&(n=(a-s)/f),a===l&&(n=2+(s-i)/f),s===l&&(n=4+(i-a)/f),(n*=60)<0&&(n+=360)),[n,r,o]},Ae=$e,Ce=d.unpack,Ee=Math.floor,Me=function(){for(var t,e,n,r,o,i,a=[],s=arguments.length;s--;)a[s]=arguments[s];var c,l,f,h=(a=Ce(a,"hsv"))[0],u=a[1],d=a[2];if(d*=255,0===u)c=l=f=d;else{360===h&&(h=0),h>360&&(h-=360),h<0&&(h+=360);var p=Ee(h/=60),g=h-p,b=d*(1-u),v=d*(1-u*g),y=d*(1-u*(1-g));switch(p){case 0:c=(t=[d,y,b])[0],l=t[1],f=t[2];break;case 1:c=(e=[v,d,b])[0],l=e[1],f=e[2];break;case 2:c=(n=[b,d,y])[0],l=n[1],f=n[2];break;case 3:c=(r=[b,v,d])[0],l=r[1],f=r[2];break;case 4:c=(o=[y,b,d])[0],l=o[1],f=o[2];break;case 5:c=(i=[d,b,v])[0],l=i[1],f=i[2]}}return[c,l,f,a.length>3?a[3]:1]},Oe=Me,Se=d.unpack,Pe=d.type,Le=x,Ne=_,He=p,Ue=Ae;Ne.prototype.hsv=function(){return Ue(this._rgb)},Le.hsv=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Ne,[null].concat(t,["hsv"])))},He.format.hsv=Oe,He.autodetect.push({p:2,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=Se(t,"hsv"),"array"===Pe(t)&&3===t.length)return"hsv"}});var Re={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},je=Re,Te=d.unpack,ze=Math.pow,De=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=Te(t,"rgb"),r=n[0],o=n[1],i=n[2],a=Be(r,o,i),s=a[0],c=a[1],l=116*c-16;return[l<0?0:l,500*(s-c),200*(c-a[2])]},Ie=function(t){return(t/=255)<=.04045?t/12.92:ze((t+.055)/1.055,2.4)},qe=function(t){return t>je.t3?ze(t,1/3):t/je.t2+je.t0},Be=function(t,e,n){return t=Ie(t),e=Ie(e),n=Ie(n),[qe((.4124564*t+.3575761*e+.1804375*n)/je.Xn),qe((.2126729*t+.7151522*e+.072175*n)/je.Yn),qe((.0193339*t+.119192*e+.9503041*n)/je.Zn)]},Fe=De,Ge=Re,Ye=d.unpack,Ve=Math.pow,We=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n,r,o,i=(t=Ye(t,"lab"))[0],a=t[1],s=t[2];return r=(i+16)/116,n=isNaN(a)?r:r+a/500,o=isNaN(s)?r:r-s/200,r=Ge.Yn*Ze(r),n=Ge.Xn*Ze(n),o=Ge.Zn*Ze(o),[Xe(3.2404542*n-1.5371385*r-.4985314*o),Xe(-.969266*n+1.8760108*r+.041556*o),Xe(.0556434*n-.2040259*r+1.0572252*o),t.length>3?t[3]:1]},Xe=function(t){return 255*(t<=.00304?12.92*t:1.055*Ve(t,1/2.4)-.055)},Ze=function(t){return t>Ge.t1?t*t*t:Ge.t2*(t-Ge.t0)},Ke=We,Je=d.unpack,Qe=d.type,tn=x,en=_,nn=p,rn=Fe;en.prototype.lab=function(){return rn(this._rgb)},tn.lab=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(en,[null].concat(t,["lab"])))},nn.format.lab=Ke,nn.autodetect.push({p:2,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=Je(t,"lab"),"array"===Qe(t)&&3===t.length)return"lab"}});var on=d.unpack,an=d.RAD2DEG,sn=Math.sqrt,cn=Math.atan2,ln=Math.round,fn=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=on(t,"lab"),r=n[0],o=n[1],i=n[2],a=sn(o*o+i*i),s=(cn(i,o)*an+360)%360;return 0===ln(1e4*a)&&(s=Number.NaN),[r,a,s]},hn=fn,un=d.unpack,dn=Fe,pn=hn,gn=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=un(t,"rgb"),r=n[0],o=n[1],i=n[2],a=dn(r,o,i),s=a[0],c=a[1],l=a[2];return pn(s,c,l)},bn=gn,vn=d.unpack,yn=d.DEG2RAD,mn=Math.sin,_n=Math.cos,wn=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=vn(t,"lch"),r=n[0],o=n[1],i=n[2];return isNaN(i)&&(i=0),[r,_n(i*=yn)*o,mn(i)*o]},xn=wn,kn=d.unpack,$n=xn,An=Ke,Cn=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=(t=kn(t,"lch"))[0],r=t[1],o=t[2],i=$n(n,r,o),a=i[0],s=i[1],c=i[2],l=An(a,s,c);return[l[0],l[1],l[2],t.length>3?t[3]:1]},En=Cn,Mn=d.unpack,On=En,Sn=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=Mn(t,"hcl").reverse();return On.apply(void 0,n)},Pn=Sn,Ln=d.unpack,Nn=d.type,Hn=x,Un=_,Rn=p,jn=bn;Un.prototype.lch=function(){return jn(this._rgb)},Un.prototype.hcl=function(){return jn(this._rgb).reverse()},Hn.lch=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Un,[null].concat(t,["lch"])))},Hn.hcl=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Un,[null].concat(t,["hcl"])))},Rn.format.lch=En,Rn.format.hcl=Pn,["lch","hcl"].forEach((function(t){return Rn.autodetect.push({p:2,test:function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];if(e=Ln(e,t),"array"===Nn(e)&&3===e.length)return t}})}));var Tn={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},zn=_,Dn=p,In=d.type,qn=Tn,Bn=Bt,Fn=zt;zn.prototype.name=function(){for(var t=Fn(this._rgb,"rgb"),e=0,n=Object.keys(qn);e0;)e[n]=arguments[n+1];if(!e.length&&"string"===In(t)&&qn[t.toLowerCase()])return"named"}});var Gn=d.unpack,Yn=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=Gn(t,"rgb");return(n[0]<<16)+(n[1]<<8)+n[2]},Vn=Yn,Wn=d.type,Xn=function(t){if("number"==Wn(t)&&t>=0&&t<=16777215)return[t>>16,t>>8&255,255&t,1];throw new Error("unknown num color: "+t)},Zn=Xn,Kn=x,Jn=_,Qn=p,tr=d.type,er=Vn;Jn.prototype.num=function(){return er(this._rgb)},Kn.num=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Jn,[null].concat(t,["num"])))},Qn.format.num=Zn,Qn.autodetect.push({p:5,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(1===t.length&&"number"===tr(t[0])&&t[0]>=0&&t[0]<=16777215)return"num"}});var nr=x,rr=_,or=p,ir=d.unpack,ar=d.type,sr=Math.round;rr.prototype.rgb=function(t){return void 0===t&&(t=!0),!1===t?this._rgb.slice(0,3):this._rgb.slice(0,3).map(sr)},rr.prototype.rgba=function(t){return void 0===t&&(t=!0),this._rgb.slice(0,4).map((function(e,n){return n<3?!1===t?e:sr(e):e}))},nr.rgb=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(rr,[null].concat(t,["rgb"])))},or.format.rgb=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=ir(t,"rgba");return void 0===n[3]&&(n[3]=1),n},or.autodetect.push({p:3,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=ir(t,"rgba"),"array"===ar(t)&&(3===t.length||4===t.length&&"number"==ar(t[3])&&t[3]>=0&&t[3]<=1))return"rgb"}});var cr=Math.log,lr=function(t){var e,n,r,o=t/100;return o<66?(e=255,n=o<6?0:-155.25485562709179-.44596950469579133*(n=o-2)+104.49216199393888*cr(n),r=o<20?0:.8274096064007395*(r=o-10)-254.76935184120902+115.67994401066147*cr(r)):(e=351.97690566805693+.114206453784165*(e=o-55)-40.25366309332127*cr(e),n=325.4494125711974+.07943456536662342*(n=o-50)-28.0852963507957*cr(n),r=255),[e,n,r,1]},fr=lr,hr=fr,ur=d.unpack,dr=Math.round,pr=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];for(var n,r=ur(t,"rgb"),o=r[0],i=r[2],a=1e3,s=4e4,c=.4;s-a>c;){var l=hr(n=.5*(s+a));l[2]/l[0]>=i/o?s=n:a=n}return dr(n)},gr=x,br=_,vr=p,yr=pr;br.prototype.temp=br.prototype.kelvin=br.prototype.temperature=function(){return yr(this._rgb)},gr.temp=gr.kelvin=gr.temperature=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(br,[null].concat(t,["temp"])))},vr.format.temp=vr.format.kelvin=vr.format.temperature=fr;var mr=d.unpack,_r=Math.cbrt,wr=Math.pow,xr=Math.sign,kr=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=mr(t,"rgb"),r=n[0],o=n[1],i=n[2],a=[Ar(r/255),Ar(o/255),Ar(i/255)],s=a[0],c=a[1],l=a[2],f=_r(.4122214708*s+.5363325363*c+.0514459929*l),h=_r(.2119034982*s+.6806995451*c+.1073969566*l),u=_r(.0883024619*s+.2817188376*c+.6299787005*l);return[.2104542553*f+.793617785*h-.0040720468*u,1.9779984951*f-2.428592205*h+.4505937099*u,.0259040371*f+.7827717662*h-.808675766*u]},$r=kr;function Ar(t){var e=Math.abs(t);return e<.04045?t/12.92:(xr(t)||1)*wr((e+.055)/1.055,2.4)}var Cr=d.unpack,Er=Math.pow,Mr=Math.sign,Or=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=(t=Cr(t,"lab"))[0],r=t[1],o=t[2],i=Er(n+.3963377774*r+.2158037573*o,3),a=Er(n-.1055613458*r-.0638541728*o,3),s=Er(n-.0894841775*r-1.291485548*o,3);return[255*Pr(4.0767416621*i-3.3077115913*a+.2309699292*s),255*Pr(-1.2684380046*i+2.6097574011*a-.3413193965*s),255*Pr(-.0041960863*i-.7034186147*a+1.707614701*s),t.length>3?t[3]:1]},Sr=Or;function Pr(t){var e=Math.abs(t);return e>.0031308?(Mr(t)||1)*(1.055*Er(e,1/2.4)-.055):12.92*t}var Lr=d.unpack,Nr=d.type,Hr=x,Ur=_,Rr=p,jr=$r;Ur.prototype.oklab=function(){return jr(this._rgb)},Hr.oklab=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Ur,[null].concat(t,["oklab"])))},Rr.format.oklab=Sr,Rr.autodetect.push({p:3,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=Lr(t,"oklab"),"array"===Nr(t)&&3===t.length)return"oklab"}});var Tr=d.unpack,zr=$r,Dr=hn,Ir=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=Tr(t,"rgb"),r=n[0],o=n[1],i=n[2],a=zr(r,o,i),s=a[0],c=a[1],l=a[2];return Dr(s,c,l)},qr=Ir,Br=d.unpack,Fr=xn,Gr=Sr,Yr=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=(t=Br(t,"lch"))[0],r=t[1],o=t[2],i=Fr(n,r,o),a=i[0],s=i[1],c=i[2],l=Gr(a,s,c);return[l[0],l[1],l[2],t.length>3?t[3]:1]},Vr=Yr,Wr=d.unpack,Xr=d.type,Zr=x,Kr=_,Jr=p,Qr=qr;Kr.prototype.oklch=function(){return Qr(this._rgb)},Zr.oklch=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Kr,[null].concat(t,["oklch"])))},Jr.format.oklch=Vr,Jr.autodetect.push({p:3,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=Wr(t,"oklch"),"array"===Xr(t)&&3===t.length)return"oklch"}});var to=_,eo=d.type;to.prototype.alpha=function(t,e){return void 0===e&&(e=!1),void 0!==t&&"number"===eo(t)?e?(this._rgb[3]=t,this):new to([this._rgb[0],this._rgb[1],this._rgb[2],t],"rgb"):this._rgb[3]},_.prototype.clipped=function(){return this._rgb._clipped||!1};var no=_,ro=Re;no.prototype.darken=function(t){void 0===t&&(t=1);var e=this,n=e.lab();return n[0]-=ro.Kn*t,new no(n,"lab").alpha(e.alpha(),!0)},no.prototype.brighten=function(t){return void 0===t&&(t=1),this.darken(-t)},no.prototype.darker=no.prototype.darken,no.prototype.brighter=no.prototype.brighten,_.prototype.get=function(t){var e=t.split("."),n=e[0],r=e[1],o=this[n]();if(r){var i=n.indexOf(r)-("ok"===n.substr(0,2)?2:0);if(i>-1)return o[i];throw new Error("unknown channel "+r+" in mode "+n)}return o};var oo=_,io=d.type,ao=Math.pow,so=1e-7,co=20;oo.prototype.luminance=function(t){if(void 0!==t&&"number"===io(t)){if(0===t)return new oo([0,0,0,this._rgb[3]],"rgb");if(1===t)return new oo([255,255,255,this._rgb[3]],"rgb");var e=this.luminance(),n="rgb",r=co,o=function(e,i){var a=e.interpolate(i,.5,n),s=a.luminance();return Math.abs(t-s)t?o(e,a):o(a,i)},i=(e>t?o(new oo([0,0,0]),this):o(this,new oo([255,255,255]))).rgb();return new oo(i.concat([this._rgb[3]]))}return lo.apply(void 0,this._rgb.slice(0,3))};var lo=function(t,e,n){return.2126*(t=fo(t))+.7152*(e=fo(e))+.0722*(n=fo(n))},fo=function(t){return(t/=255)<=.03928?t/12.92:ao((t+.055)/1.055,2.4)},ho={},uo=_,po=d.type,go=ho,bo=function(t,e,n){void 0===n&&(n=.5);for(var r=[],o=arguments.length-3;o-- >0;)r[o]=arguments[o+3];var i=r[0]||"lrgb";if(go[i]||r.length||(i=Object.keys(go)[0]),!go[i])throw new Error("interpolation mode "+i+" is not defined");return"object"!==po(t)&&(t=new uo(t)),"object"!==po(e)&&(e=new uo(e)),go[i](t,e,n).alpha(t.alpha()+n*(e.alpha()-t.alpha()))},vo=_,yo=bo;vo.prototype.mix=vo.prototype.interpolate=function(t,e){void 0===e&&(e=.5);for(var n=[],r=arguments.length-2;r-- >0;)n[r]=arguments[r+2];return yo.apply(void 0,[this,t,e].concat(n))};var mo=_;mo.prototype.premultiply=function(t){void 0===t&&(t=!1);var e=this._rgb,n=e[3];return t?(this._rgb=[e[0]*n,e[1]*n,e[2]*n,n],this):new mo([e[0]*n,e[1]*n,e[2]*n,n],"rgb")};var _o=_,wo=Re;_o.prototype.saturate=function(t){void 0===t&&(t=1);var e=this,n=e.lch();return n[1]+=wo.Kn*t,n[1]<0&&(n[1]=0),new _o(n,"lch").alpha(e.alpha(),!0)},_o.prototype.desaturate=function(t){return void 0===t&&(t=1),this.saturate(-t)};var xo=_,ko=d.type;xo.prototype.set=function(t,e,n){void 0===n&&(n=!1);var r=t.split("."),o=r[0],i=r[1],a=this[o]();if(i){var s=o.indexOf(i)-("ok"===o.substr(0,2)?2:0);if(s>-1){if("string"==ko(e))switch(e.charAt(0)){case"+":case"-":a[s]+=+e;break;case"*":a[s]*=+e.substr(1);break;case"/":a[s]/=+e.substr(1);break;default:a[s]=+e}else{if("number"!==ko(e))throw new Error("unsupported value for Color.set");a[s]=e}var c=new xo(a,o);return n?(this._rgb=c._rgb,this):c}throw new Error("unknown channel "+i+" in mode "+o)}return a};var $o=_,Ao=function(t,e,n){var r=t._rgb,o=e._rgb;return new $o(r[0]+n*(o[0]-r[0]),r[1]+n*(o[1]-r[1]),r[2]+n*(o[2]-r[2]),"rgb")};ho.rgb=Ao;var Co=_,Eo=Math.sqrt,Mo=Math.pow,Oo=function(t,e,n){var r=t._rgb,o=r[0],i=r[1],a=r[2],s=e._rgb,c=s[0],l=s[1],f=s[2];return new Co(Eo(Mo(o,2)*(1-n)+Mo(c,2)*n),Eo(Mo(i,2)*(1-n)+Mo(l,2)*n),Eo(Mo(a,2)*(1-n)+Mo(f,2)*n),"rgb")};ho.lrgb=Oo;var So=_,Po=function(t,e,n){var r=t.lab(),o=e.lab();return new So(r[0]+n*(o[0]-r[0]),r[1]+n*(o[1]-r[1]),r[2]+n*(o[2]-r[2]),"lab")};ho.lab=Po;var Lo=_,No=function(t,e,n,r){var o,i,a,s,c,l,f,h,u,d,p,g,b;return"hsl"===r?(a=t.hsl(),s=e.hsl()):"hsv"===r?(a=t.hsv(),s=e.hsv()):"hcg"===r?(a=t.hcg(),s=e.hcg()):"hsi"===r?(a=t.hsi(),s=e.hsi()):"lch"===r||"hcl"===r?(r="hcl",a=t.hcl(),s=e.hcl()):"oklch"===r&&(a=t.oklch().reverse(),s=e.oklch().reverse()),"h"!==r.substr(0,1)&&"oklch"!==r||(c=(o=a)[0],f=o[1],u=o[2],l=(i=s)[0],h=i[1],d=i[2]),isNaN(c)||isNaN(l)?isNaN(c)?isNaN(l)?g=Number.NaN:(g=l,1!=u&&0!=u||"hsv"==r||(p=h)):(g=c,1!=d&&0!=d||"hsv"==r||(p=f)):g=c+n*(l>c&&l-c>180?l-(c+360):l180?l+360-c:l-c),void 0===p&&(p=f+n*(h-f)),b=u+n*(d-u),new Lo("oklch"===r?[b,p,g]:[g,p,b],r)},Ho=No,Uo=function(t,e,n){return Ho(t,e,n,"lch")};ho.lch=Uo,ho.hcl=Uo;var Ro=_,jo=function(t,e,n){var r=t.num(),o=e.num();return new Ro(r+n*(o-r),"num")};ho.num=jo;var To=No,zo=function(t,e,n){return To(t,e,n,"hcg")};ho.hcg=zo;var Do=No,Io=function(t,e,n){return Do(t,e,n,"hsi")};ho.hsi=Io;var qo=No,Bo=function(t,e,n){return qo(t,e,n,"hsl")};ho.hsl=Bo;var Fo=No,Go=function(t,e,n){return Fo(t,e,n,"hsv")};ho.hsv=Go;var Yo=_,Vo=function(t,e,n){var r=t.oklab(),o=e.oklab();return new Yo(r[0]+n*(o[0]-r[0]),r[1]+n*(o[1]-r[1]),r[2]+n*(o[2]-r[2]),"oklab")};ho.oklab=Vo;var Wo=No,Xo=function(t,e,n){return Wo(t,e,n,"oklch")};ho.oklch=Xo;var Zo=_,Ko=d.clip_rgb,Jo=Math.pow,Qo=Math.sqrt,ti=Math.PI,ei=Math.cos,ni=Math.sin,ri=Math.atan2,oi=function(t,e,n){void 0===e&&(e="lrgb"),void 0===n&&(n=null);var r=t.length;n||(n=Array.from(new Array(r)).map((function(){return 1})));var o=r/n.reduce((function(t,e){return t+e}));if(n.forEach((function(t,e){n[e]*=o})),t=t.map((function(t){return new Zo(t)})),"lrgb"===e)return ii(t,n);for(var i=t.shift(),a=i.get(e),s=[],c=0,l=0,f=0;f=360;)p-=360;a[d]=p}else a[d]=a[d]/s[d];return u/=r,new Zo(a,e).alpha(u>.99999?1:u,!0)},ii=function(t,e){for(var n=t.length,r=[0,0,0,0],o=0;o.9999999&&(r[3]=1),new Zo(Ko(r))},ai=x,si=d.type,ci=Math.pow,li=function(t){var e="rgb",n=ai("#ccc"),r=0,o=[0,1],i=[],a=[0,0],s=!1,c=[],l=!1,f=0,h=1,u=!1,d={},p=!0,g=1,b=function(t){if((t=t||["#fff","#000"])&&"string"===si(t)&&ai.brewer&&ai.brewer[t.toLowerCase()]&&(t=ai.brewer[t.toLowerCase()]),"array"===si(t)){1===t.length&&(t=[t[0],t[0]]),t=t.slice(0);for(var e=0;e=s[n];)n++;return n-1}return 0},y=function(t){return t},m=function(t){return t},_=function(t,r){var o,l;if(null==r&&(r=!1),isNaN(t)||null===t)return n;l=r?t:s&&s.length>2?v(t)/(s.length-2):h!==f?(t-f)/(h-f):1,l=m(l),r||(l=y(l)),1!==g&&(l=ci(l,g)),l=a[0]+l*(1-a[0]-a[1]),l=Math.min(1,Math.max(0,l));var u=Math.floor(1e4*l);if(p&&d[u])o=d[u];else{if("array"===si(c))for(var b=0;b=_&&b===i.length-1){o=c[b];break}if(l>_&&l2){var l=t.map((function(e,n){return n/(t.length-1)})),u=t.map((function(t){return(t-f)/(h-f)}));u.every((function(t,e){return l[e]===t}))||(m=function(t){if(t<=0||t>=1)return t;for(var e=0;t>=u[e+1];)e++;var n=(t-u[e])/(u[e+1]-u[e]);return l[e]+n*(l[e+1]-l[e])})}}return o=[f,h],x},x.mode=function(t){return arguments.length?(e=t,w(),x):e},x.range=function(t,e){return b(t),x},x.out=function(t){return l=t,x},x.spread=function(t){return arguments.length?(r=t,x):r},x.correctLightness=function(t){return null==t&&(t=!0),u=t,w(),y=u?function(t){for(var e=_(0,!0).lab()[0],n=_(1,!0).lab()[0],r=e>n,o=_(t,!0).lab()[0],i=e+(n-e)*t,a=o-i,s=0,c=1,l=20;Math.abs(a)>.01&&l-- >0;)r&&(a*=-1),a<0?(s=t,t+=.5*(c-t)):(c=t,t+=.5*(s-t)),o=_(t,!0).lab()[0],a=o-i;return t}:function(t){return t},x},x.padding=function(t){return null!=t?("number"===si(t)&&(t=[t,t]),a=t,x):a},x.colors=function(e,n){arguments.length<2&&(n="hex");var r=[];if(0===arguments.length)r=c.slice(0);else if(1===e)r=[x(.5)];else if(e>1){var i=o[0],a=o[1]-i;r=fi(0,e).map((function(t){return x(i+t/(e-1)*a)}))}else{t=[];var l=[];if(s&&s.length>2)for(var f=1,h=s.length,u=1<=h;u?fh;u?f++:f--)l.push(.5*(s[f-1]+s[f]));else l=o;r=l.map((function(t){return x(t)}))}return ai[n]&&(r=r.map((function(t){return t[n]()}))),r},x.cache=function(t){return null!=t?(p=t,x):p},x.gamma=function(t){return null!=t?(g=t,x):g},x.nodata=function(t){return null!=t?(n=ai(t),x):n},x};function fi(t,e,n){for(var r=[],o=ti;o?a++:a--)r.push(a);return r}var hi=_,ui=li,di=function(t){for(var e=[1,1],n=1;n=5))throw new RangeError("No point in running bezier with only one color.");var l,f,h;l=t.map((function(t){return t.lab()})),h=t.length-1,f=di(h),o=function(t){var e=1-t,n=[0,1,2].map((function(n){return l.reduce((function(r,o,i){return r+f[i]*Math.pow(e,h-i)*Math.pow(t,i)*o[n]}),0)}));return new hi(n,"lab")}}return o},gi=function(t){var e=pi(t);return e.scale=function(){return ui(e)},e},bi=x,vi=function(t,e,n){if(!vi[n])throw new Error("unknown blend mode "+n);return vi[n](t,e)},yi=function(t){return function(e,n){var r=bi(n).rgb(),o=bi(e).rgb();return bi.rgb(t(r,o))}},mi=function(t){return function(e,n){var r=[];return r[0]=t(e[0],n[0]),r[1]=t(e[1],n[1]),r[2]=t(e[2],n[2]),r}},_i=function(t){return t},wi=function(t,e){return t*e/255},xi=function(t,e){return t>e?e:t},ki=function(t,e){return t>e?t:e},$i=function(t,e){return 255*(1-(1-t/255)*(1-e/255))},Ai=function(t,e){return e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255))},Ci=function(t,e){return 255*(1-(1-e/255)/(t/255))},Ei=function(t,e){return 255===t||(t=e/255*255/(1-t/255))>255?255:t};vi.normal=yi(mi(_i)),vi.multiply=yi(mi(wi)),vi.screen=yi(mi($i)),vi.overlay=yi(mi(Ai)),vi.darken=yi(mi(xi)),vi.lighten=yi(mi(ki)),vi.dodge=yi(mi(Ei)),vi.burn=yi(mi(Ci));for(var Mi=vi,Oi=d.type,Si=d.clip_rgb,Pi=d.TWOPI,Li=Math.pow,Ni=Math.sin,Hi=Math.cos,Ui=x,Ri=function(t,e,n,r,o){void 0===t&&(t=300),void 0===e&&(e=-1.5),void 0===n&&(n=1),void 0===r&&(r=1),void 0===o&&(o=[0,1]);var i,a=0;"array"===Oi(o)?i=o[1]-o[0]:(i=0,o=[o,o]);var s=function(s){var c=Pi*((t+120)/360+e*s),l=Li(o[0]+i*s,r),f=(0!==a?n[0]+s*a:n)*l*(1-l)/2,h=Hi(c),u=Ni(c);return Ui(Si([255*(l+f*(-.14861*h+1.78277*u)),255*(l+f*(-.29227*h-.90649*u)),255*(l+f*(1.97294*h)),1]))};return s.start=function(e){return null==e?t:(t=e,s)},s.rotations=function(t){return null==t?e:(e=t,s)},s.gamma=function(t){return null==t?r:(r=t,s)},s.hue=function(t){return null==t?n:("array"===Oi(n=t)?0==(a=n[1]-n[0])&&(n=n[1]):a=0,s)},s.lightness=function(t){return null==t?o:("array"===Oi(t)?(o=t,i=t[1]-t[0]):(o=[t,t],i=0),s)},s.scale=function(){return Ui.scale(s)},s.hue(n),s},ji=_,Ti="0123456789abcdef",zi=Math.floor,Di=Math.random,Ii=function(){for(var t="#",e=0;e<6;e++)t+=Ti.charAt(zi(16*Di()));return new ji(t,"hex")},qi=s,Bi=Math.log,Fi=Math.pow,Gi=Math.floor,Yi=Math.abs,Vi=function(t,e){void 0===e&&(e=null);var n={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===qi(t)&&(t=Object.values(t)),t.forEach((function(t){e&&"object"===qi(t)&&(t=t[e]),null==t||isNaN(t)||(n.values.push(t),n.sum+=t,tn.max&&(n.max=t),n.count+=1)})),n.domain=[n.min,n.max],n.limits=function(t,e){return Wi(n,t,e)},n},Wi=function(t,e,n){void 0===e&&(e="equal"),void 0===n&&(n=7),"array"==qi(t)&&(t=Vi(t));var r=t.min,o=t.max,i=t.values.sort((function(t,e){return t-e}));if(1===n)return[r,o];var a=[];if("c"===e.substr(0,1)&&(a.push(r),a.push(o)),"e"===e.substr(0,1)){a.push(r);for(var s=1;s 0");var c=Math.LOG10E*Bi(r),l=Math.LOG10E*Bi(o);a.push(r);for(var f=1;f200&&(m=!1)}for(var U={},R=0;Rr?(n+.05)/(r+.05):(r+.05)/(n+.05)},Ji=_,Qi=Math.sqrt,ta=Math.pow,ea=Math.min,na=Math.max,ra=Math.atan2,oa=Math.abs,ia=Math.cos,aa=Math.sin,sa=Math.exp,ca=Math.PI,la=function(t,e,n,r,o){void 0===n&&(n=1),void 0===r&&(r=1),void 0===o&&(o=1);var i=function(t){return 360*t/(2*ca)},a=function(t){return 2*ca*t/360};t=new Ji(t),e=new Ji(e);var s=Array.from(t.lab()),c=s[0],l=s[1],f=s[2],h=Array.from(e.lab()),u=h[0],d=h[1],p=h[2],g=(c+u)/2,b=(Qi(ta(l,2)+ta(f,2))+Qi(ta(d,2)+ta(p,2)))/2,v=.5*(1-Qi(ta(b,7)/(ta(b,7)+ta(25,7)))),y=l*(1+v),m=d*(1+v),_=Qi(ta(y,2)+ta(f,2)),w=Qi(ta(m,2)+ta(p,2)),x=(_+w)/2,k=i(ra(f,y)),$=i(ra(p,m)),A=k>=0?k:k+360,C=$>=0?$:$+360,E=oa(A-C)>180?(A+C+360)/2:(A+C)/2,M=1-.17*ia(a(E-30))+.24*ia(a(2*E))+.32*ia(a(3*E+6))-.2*ia(a(4*E-63)),O=C-A;O=oa(O)<=180?O:C<=A?O+360:O-360,O=2*Qi(_*w)*aa(a(O)/2);var S=u-c,P=w-_,L=1+.015*ta(g-50,2)/Qi(20+ta(g-50,2)),N=1+.045*x,H=1+.015*x*M,U=30*sa(-ta((E-275)/25,2)),R=-2*Qi(ta(x,7)/(ta(x,7)+ta(25,7)))*aa(2*a(U)),j=Qi(ta(S/(n*L),2)+ta(P/(r*N),2)+ta(O/(o*H),2)+R*(P/(r*N))*(O/(o*H)));return na(0,ea(100,j))},fa=_,ha=function(t,e,n){void 0===n&&(n="lab"),t=new fa(t),e=new fa(e);var r=t.get(n),o=e.get(n),i=0;for(var a in r){var s=(r[a]||0)-(o[a]||0);i+=s*s}return Math.sqrt(i)},ua=_,da=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];try{return new(Function.prototype.bind.apply(ua,[null].concat(t))),!0}catch(t){return!1}},pa=x,ga=li,ba={cool:function(){return ga([pa.hsl(180,1,.9),pa.hsl(250,.7,.4)])},hot:function(){return ga(["#000","#f00","#ff0","#fff"]).mode("rgb")}},va={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},ya=0,ma=Object.keys(va);ya50?At.lab(0,n.lab()[1],n.lab()[2]):At.lab(100,n.lab()[1],n.lab()[2]);return r=function(t,e){let n=e,r=At.contrast(t,n),o=0;for(;r<4.5&&o<200;)n=t.lab()[0]>50?n.set("lab.l",Math.max(0,n.lab()[0]-1)):n.set("lab.l",Math.min(100,n.lab()[0]+1)),r=At.contrast(t,n),o++;return r<4.5&&(n=n.set("lab.l",100-n.lab()[0]),r=At.contrast(t,n)),n}(e,r),r.rgb()}class Et extends ct{constructor(){super(),this._isOn=!1,this._currentEffect="No effect",this._isDropdownOpen=!1,this._isAttributesExpanded=!1,this._backgroundColor="",this._textColor="",this._accentColor="",this._showEffectInfo=!0,this._showEffectParameters=!0,this._brightness=100,this._colorThief=new _t,this._transitionInProgress=!1,this._updateCount=0,this._lastEffectImage=null,this._debouncedUpdate=this._debounce((()=>{this._extractColors(),this.requestUpdate(),console.debug(`HyperLightCard: Debounced update called (${++this._updateCount})`)}),250),this._debouncedExtractColors=this._debounce((()=>{this._extractColors()}),250),this._memoizedEffectList=function(t){const e=new Map;return function(){for(var n=arguments.length,r=new Array(n),o=0;ot.map((t=>G` + * You can read more about the APCA Readability Criterion at + * https://readtech.org/ARC/ + */ +const en=.022;function nn(t,e,n){return.2126729*Math.pow(t/255,2.4)+.7151522*Math.pow(e/255,2.4)+.072175*Math.pow(n/255,2.4)}const{sqrt:rn,pow:sn,min:on,max:an,atan2:cn,abs:ln,cos:hn,sin:dn,exp:fn,PI:un}=Math;var pn={cool:()=>Be([Rt.hsl(180,1,.9),Rt.hsl(250,.7,.4)]),hot:()=>Be(["#000","#f00","#ff0","#fff"]).mode("rgb")};const gn={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},bn=Object.keys(gn),mn=new Map(bn.map((t=>[t.toLowerCase(),t]))),vn="function"==typeof Proxy?new Proxy(gn,{get(t,e){const n=e.toLowerCase();if(mn.has(n))return t[mn.get(n)]},getOwnPropertyNames:()=>Object.getOwnPropertyNames(bn)}):gn,{max:yn}=Math;jt.prototype.cmyk=function(){return((...t)=>{let[e,n,r]=kt(t,"rgb");e/=255,n/=255,r/=255;const s=1-yn(e,yn(n,r)),o=s<1?1/(1-s):0;return[(1-e-s)*o,(1-n-s)*o,(1-r-s)*o,s]})(this._rgb)};Object.assign(Rt,{cmyk:(...t)=>new jt(...t,"cmyk")}),Ut.format.cmyk=(...t)=>{t=kt(t,"cmyk");const[e,n,r,s]=t,o=t.length>4?t[4]:1;return 1===s?[0,0,0,o]:[e>=1?0:255*(1-e)*(1-s),n>=1?0:255*(1-n)*(1-s),r>=1?0:255*(1-r)*(1-s),o]},Ut.autodetect.push({p:2,test:(...t)=>{if("array"===xt(t=kt(t,"cmyk"))&&4===t.length)return"cmyk"}});const wn=(...t)=>{const[e,n,r,...s]=kt(t,"rgb"),[o,i,a]=Oe(e,n,r),[c,l,h]=fe(o,i,a);return[c,l,h,...s.length>0&&s[0]<1?[s[0]]:[]]},{round:_n}=Math,xn=(...t)=>{const e=kt(t,"rgba");let n=$t(t)||"rgb";if("hsl"===n.substr(0,3))return((...t)=>{const e=kt(t,"hsla");let n=$t(t)||"lsa";return e[0]=Mt(e[0]||0)+"deg",e[1]=Mt(100*e[1])+"%",e[2]=Mt(100*e[2])+"%","hsla"===n||e.length>3&&e[3]<1?(e[3]="/ "+(e.length>3?e[3]:1),n="hsla"):e.length=3,`${n.substr(0,3)}(${e.join(" ")})`})($e(e),n);if("lab"===n.substr(0,3)){const t=Wt();Gt("d50");const r=((...t)=>{const e=kt(t,"lab");let n=$t(t)||"lab";return e[0]=Mt(e[0])+"%",e[1]=Mt(e[1]),e[2]=Mt(e[2]),"laba"===n||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`lab(${e.join(" ")})`})(Ft(e),n);return Gt(t),r}if("lch"===n.substr(0,3)){const t=Wt();Gt("d50");const r=((...t)=>{const e=kt(t,"lch");let n=$t(t)||"lab";return e[0]=Mt(e[0])+"%",e[1]=Mt(e[1]),e[2]=isNaN(e[2])?"none":Mt(e[2])+"deg","lcha"===n||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`lch(${e.join(" ")})`})(ue(e),n);return Gt(t),r}return"oklab"===n.substr(0,5)?((...t)=>{const e=kt(t,"lab");return e[0]=Mt(100*e[0])+"%",e[1]=St(e[1]),e[2]=St(e[2]),e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`oklab(${e.join(" ")})`})(Oe(e)):"oklch"===n.substr(0,5)?((...t)=>{const e=kt(t,"lch");return e[0]=Mt(100*e[0])+"%",e[1]=St(e[1]),e[2]=isNaN(e[2])?"none":Mt(e[2])+"deg",e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`oklch(${e.join(" ")})`})(wn(e)):(e[0]=_n(e[0]),e[1]=_n(e[1]),e[2]=_n(e[2]),("rgba"===n||e.length>3&&e[3]<1)&&(e[3]="/ "+(e.length>3?e[3]:1),n="rgba"),`${n.substr(0,3)}(${e.slice(0,"rgb"===n?3:4).join(" ")})`)},kn=(...t)=>{t=kt(t,"lch");const[e,n,r,...s]=t,[o,i,a]=ae(e,n,r),[c,l,h]=Se(o,i,a);return[c,l,h,...s.length>0&&s[0]<1?[s[0]]:[]]},$n=/((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source,An=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source,En=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source,Cn=/\s*/.source,Mn=/\s+/.source,Sn=/\s*,\s*/.source,On=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source,Pn=/\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source,Ln=new RegExp("^rgba?\\("+Cn+[$n,$n,$n].join(Mn)+Pn+"\\)$"),Nn=new RegExp("^rgb\\("+Cn+[$n,$n,$n].join(Sn)+Cn+"\\)$"),Un=new RegExp("^rgba\\("+Cn+[$n,$n,$n,An].join(Sn)+Cn+"\\)$"),jn=new RegExp("^hsla?\\("+Cn+[On,En,En].join(Mn)+Pn+"\\)$"),Rn=new RegExp("^hsl?\\("+Cn+[On,En,En].join(Sn)+Cn+"\\)$"),Hn=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,zn=new RegExp("^lab\\("+Cn+[An,An,An].join(Mn)+Pn+"\\)$"),Bn=new RegExp("^lch\\("+Cn+[An,An,On].join(Mn)+Pn+"\\)$"),Tn=new RegExp("^oklab\\("+Cn+[An,An,An].join(Mn)+Pn+"\\)$"),qn=new RegExp("^oklch\\("+Cn+[An,An,On].join(Mn)+Pn+"\\)$"),{round:In}=Math,Dn=t=>t.map(((t,e)=>e<=2?yt(In(t),0,255):t)),Yn=(t,e=0,n=100,r=!1)=>("string"==typeof t&&t.endsWith("%")&&(t=parseFloat(t.substring(0,t.length-1))/100,t=r?e+.5*(t+1)*(n-e):e+t*(n-e)),+t),Gn=(t,e)=>"none"===t?e:t,Wn=t=>{if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];let e;if(Ut.format.named)try{return Ut.format.named(t)}catch(t){}if((e=t.match(Ln))||(e=t.match(Nn))){let t=e.slice(1,4);for(let e=0;e<3;e++)t[e]=+Yn(Gn(t[e],0),0,255);t=Dn(t);const n=void 0!==e[4]?+Yn(e[4],0,1):1;return t[3]=n,t}if(e=t.match(Un)){const t=e.slice(1,5);for(let e=0;e<4;e++)t[e]=+Yn(t[e],0,255);return t}if((e=t.match(jn))||(e=t.match(Rn))){const t=e.slice(1,4);t[0]=+Gn(t[0].replace("deg",""),0),t[1]=.01*+Yn(Gn(t[1],0),0,100),t[2]=.01*+Yn(Gn(t[2],0),0,100);const n=Dn(ke(t)),r=void 0!==e[4]?+Yn(e[4],0,1):1;return n[3]=r,n}if(e=t.match(Hn)){const t=e.slice(1,4);t[1]*=.01,t[2]*=.01;const n=ke(t);for(let t=0;t<3;t++)n[t]=In(n[t]);return n[3]=+e[4],n}if(e=t.match(zn)){const t=e.slice(1,4);t[0]=Yn(Gn(t[0],0),0,100),t[1]=Yn(Gn(t[1],0),-125,125,!0),t[2]=Yn(Gn(t[2],0),-125,125,!0);const n=Wt();Gt("d50");const r=Dn(Xt(t));Gt(n);const s=void 0!==e[4]?+Yn(e[4],0,1):1;return r[3]=s,r}if(e=t.match(Bn)){const t=e.slice(1,4);t[0]=Yn(t[0],0,100),t[1]=Yn(Gn(t[1],0),0,150,!1),t[2]=+Gn(t[2].replace("deg",""),0);const n=Wt();Gt("d50");const r=Dn(ce(t));Gt(n);const s=void 0!==e[4]?+Yn(e[4],0,1):1;return r[3]=s,r}if(e=t.match(Tn)){const t=e.slice(1,4);t[0]=Yn(Gn(t[0],0),0,1),t[1]=Yn(Gn(t[1],0),-.4,.4,!0),t[2]=Yn(Gn(t[2],0),-.4,.4,!0);const n=Dn(Se(t)),r=void 0!==e[4]?+Yn(e[4],0,1):1;return n[3]=r,n}if(e=t.match(qn)){const t=e.slice(1,4);t[0]=Yn(Gn(t[0],0),0,1),t[1]=Yn(Gn(t[1],0),0,.4,!1),t[2]=+Gn(t[2].replace("deg",""),0);const n=Dn(kn(t)),r=void 0!==e[4]?+Yn(e[4],0,1):1;return n[3]=r,n}};Wn.test=t=>Ln.test(t)||jn.test(t)||zn.test(t)||Bn.test(t)||Tn.test(t)||qn.test(t)||Nn.test(t)||Un.test(t)||Rn.test(t)||Hn.test(t)||"transparent"===t,jt.prototype.css=function(t){return xn(this._rgb,t)};Rt.css=(...t)=>new jt(...t,"css"),Ut.format.css=Wn,Ut.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&"string"===xt(t)&&Wn.test(t))return"css"}}),Ut.format.gl=(...t)=>{const e=kt(t,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e};Rt.gl=(...t)=>new jt(...t,"gl"),jt.prototype.gl=function(){const t=this._rgb;return[t[0]/255,t[1]/255,t[2]/255,t[3]]},jt.prototype.hex=function(t){return It(this._rgb,t)};Rt.hex=(...t)=>new jt(...t,"hex"),Ut.format.hex=Tt,Ut.autodetect.push({p:4,test:(t,...e)=>{if(!e.length&&"string"===xt(t)&&[3,4,5,6,7,8,9].indexOf(t.length)>=0)return"hex"}});const{log:Xn}=Math,Zn=t=>{const e=t/100;let n,r,s;return e<66?(n=255,r=e<6?0:-155.25485562709179-.44596950469579133*(r=e-2)+104.49216199393888*Xn(r),s=e<20?0:.8274096064007395*(s=e-10)-254.76935184120902+115.67994401066147*Xn(s)):(n=351.97690566805693+.114206453784165*(n=e-55)-40.25366309332127*Xn(n),r=325.4494125711974+.07943456536662342*(r=e-50)-28.0852963507957*Xn(r),s=255),[n,r,s,1]},{round:Vn}=Math;jt.prototype.temp=jt.prototype.kelvin=jt.prototype.temperature=function(){return((...t)=>{const e=kt(t,"rgb"),n=e[0],r=e[2];let s,o=1e3,i=4e4;for(;i-o>.4;){s=.5*(i+o);const t=Zn(s);t[2]/t[0]>=r/n?i=s:o=s}return Vn(s)})(this._rgb)};const Kn=(...t)=>new jt(...t,"temp");Object.assign(Rt,{temp:Kn,kelvin:Kn,temperature:Kn}),Ut.format.temp=Ut.format.kelvin=Ut.format.temperature=Zn,jt.prototype.oklch=function(){return wn(this._rgb)};function Fn(t){const e=Rt(t),n=Rt.lab(e.lab()[0],e.get("lab.a"),e.get("lab.b"));let r=e.lab()[0]>50?Rt.lab(0,n.lab()[1],n.lab()[2]):Rt.lab(100,n.lab()[1],n.lab()[2]);return r=function(t,e){let n=e,r=Rt.contrast(t,n),s=0;for(;r<4.5&&s<200;)n=t.lab()[0]>50?n.set("lab.l",Math.max(0,n.lab()[0]-1)):n.set("lab.l",Math.min(100,n.lab()[0]+1)),r=Rt.contrast(t,n),s++;return r<4.5&&(n=n.set("lab.l",100-n.lab()[0]),r=Rt.contrast(t,n)),n}(e,r),r.rgb()}Object.assign(Rt,{oklch:(...t)=>new jt(...t,"oklch")}),Ut.format.oklch=kn,Ut.autodetect.push({p:2,test:(...t)=>{if("array"===xt(t=kt(t,"oklch"))&&3===t.length)return"oklch"}}),Object.assign(Rt,{analyze:Qe,average:(t,e="lrgb",n=null)=>{const r=t.length;n||(n=Array.from(new Array(r)).map((()=>1)));const s=r/n.reduce((function(t,e){return t+e}));if(n.forEach(((t,e)=>{n[e]*=s})),t=t.map((t=>new jt(t))),"lrgb"===e)return He(t,n);const o=t.shift(),i=o.get(e),a=[];let c=0,l=0;for(let t=0;t{const s=t.get(e);h+=t.alpha()*n[r+1];for(let t=0;t=360;)e-=360;i[t]=e}else i[t]=i[t]/a[t];return h/=r,new jt(i,e).alpha(h>.99999?1:h,!0)},bezier:t=>{const e=function(t){let e,n,r,s;if(t=t.map((t=>new jt(t))),2===t.length)[n,r]=t.map((t=>t.lab())),e=function(t){const e=[0,1,2].map((e=>n[e]+t*(r[e]-n[e])));return new jt(e,"lab")};else if(3===t.length)[n,r,s]=t.map((t=>t.lab())),e=function(t){const e=[0,1,2].map((e=>(1-t)*(1-t)*n[e]+2*(1-t)*t*r[e]+t*t*s[e]));return new jt(e,"lab")};else if(4===t.length){let o;[n,r,s,o]=t.map((t=>t.lab())),e=function(t){const e=[0,1,2].map((e=>(1-t)*(1-t)*(1-t)*n[e]+3*(1-t)*(1-t)*t*r[e]+3*(1-t)*t*t*s[e]+t*t*t*o[e]));return new jt(e,"lab")}}else{if(!(t.length>=5))throw new RangeError("No point in running bezier with only one color.");{let n,r,s;n=t.map((t=>t.lab())),s=t.length-1,r=function(t){let e=[1,1];for(let n=1;nn.reduce(((n,i,a)=>n+r[a]*e**(s-a)*t**a*i[o]),0)));return new jt(o,"lab")}}}return e}(t);return e.scale=()=>Be(e),e},blend:qe,brewer:vn,Color:jt,colors:Ht,contrast:(t,e)=>{t=new jt(t),e=new jt(e);const n=t.luminance(),r=e.luminance();return n>r?(n+.05)/(r+.05):(r+.05)/(n+.05)},contrastAPCA:(t,e)=>{t=new jt(t),e=new jt(e),t.alpha()<1&&(t=se(e,t,t.alpha(),"rgb"));const n=nn(...t.rgb()),r=nn(...e.rgb()),s=n>=en?n:n+Math.pow(en-n,1.414),o=r>=en?r:r+Math.pow(en-r,1.414),i=Math.pow(o,.56)-Math.pow(s,.57),a=Math.pow(o,.65)-Math.pow(s,.62),c=Math.abs(o-s)<5e-4?0:s0?c-.027:c+.027)},cubehelix:function(t=300,e=-1.5,n=1,r=1,s=[0,1]){let o,i=0;"array"===xt(s)?o=s[1]-s[0]:(o=0,s=[s,s]);const a=function(a){const c=Ot*((t+120)/360+e*a),l=Ye(s[0]+o*a,r),h=(0!==i?n[0]+a*i:n)*l*(1-l)/2,d=We(c),f=Ge(c);return Rt(wt([255*(l+h*(-.14861*d+1.78277*f)),255*(l+h*(-.29227*d-.90649*f)),255*(l+h*(1.97294*d)),1]))};return a.start=function(e){return null==e?t:(t=e,a)},a.rotations=function(t){return null==t?e:(e=t,a)},a.gamma=function(t){return null==t?r:(r=t,a)},a.hue=function(t){return null==t?n:("array"===xt(n=t)?(i=n[1]-n[0],0===i&&(n=n[1])):i=0,a)},a.lightness=function(t){return null==t?s:("array"===xt(t)?(s=t,o=t[1]-t[0]):(s=[t,t],o=0),a)},a.scale=()=>Rt.scale(a),a.hue(n),a},deltaE:function(t,e,n=1,r=1,s=1){var o=function(t){return 360*t/(2*un)},i=function(t){return 2*un*t/360};t=new jt(t),e=new jt(e);const[a,c,l]=Array.from(t.lab()),[h,d,f]=Array.from(e.lab()),u=(a+h)/2,p=(rn(sn(c,2)+sn(l,2))+rn(sn(d,2)+sn(f,2)))/2,g=.5*(1-rn(sn(p,7)/(sn(p,7)+sn(25,7)))),b=c*(1+g),m=d*(1+g),v=rn(sn(b,2)+sn(l,2)),y=rn(sn(m,2)+sn(f,2)),w=(v+y)/2,_=o(cn(l,b)),x=o(cn(f,m)),k=_>=0?_:_+360,$=x>=0?x:x+360,A=ln(k-$)>180?(k+$+360)/2:(k+$)/2,E=1-.17*hn(i(A-30))+.24*hn(i(2*A))+.32*hn(i(3*A+6))-.2*hn(i(4*A-63));let C=$-k;C=ln(C)<=180?C:$<=k?C+360:C-360,C=2*rn(v*y)*dn(i(C)/2);const M=h-a,S=y-v,O=1+.015*sn(u-50,2)/rn(20+sn(u-50,2)),P=1+.045*w,L=1+.015*w*E,N=30*fn(-sn((A-275)/25,2)),U=-(2*rn(sn(w,7)/(sn(w,7)+sn(25,7))))*dn(2*i(N)),j=rn(sn(M/(n*O),2)+sn(S/(r*P),2)+sn(C/(s*L),2)+U*(S/(r*P))*(C/(s*L)));return an(0,on(100,j))},distance:function(t,e,n="lab"){t=new jt(t),e=new jt(e);const r=t.get(n),s=e.get(n);let o=0;for(let t in r){const e=(r[t]||0)-(s[t]||0);o+=e*e}return Math.sqrt(o)},input:Ut,interpolate:se,limits:tn,mix:se,random:()=>{let t="#";for(let e=0;e<6;e++)t+="0123456789abcdef".charAt(Xe(16*Ze()));return new jt(t,"hex")},scale:Be,scales:pn,valid:(...t)=>{try{return new jt(...t),!0}catch(t){return!1}}});const Jn=function(){console.debug(...arguments)};class Qn{constructor(t){this._backgroundColor="",this._textColor="",this._accentColor="",this._isOn=!1,this._currentEffect="No effect",this._isDropdownOpen=!1,this._isAttributesExpanded=!1,this._showEffectInfo=!0,this._showEffectParameters=!0,this._showBrightnessControl=!0,this._brightness=100,this._lastEffectImage=null,(this._host=t).addController(this)}hostConnected(){this._host.requestUpdate()}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t,this._host.requestUpdate()}get textColor(){return this._textColor}set textColor(t){this._textColor=t,this._host.requestUpdate()}get accentColor(){return this._accentColor}set accentColor(t){this._accentColor=t,this._host.requestUpdate()}get isOn(){return this._isOn}set isOn(t){this._isOn=t,this._host.requestUpdate()}get currentEffect(){return this._currentEffect}set currentEffect(t){this._currentEffect=t,this._host.requestUpdate()}get isDropdownOpen(){return this._isDropdownOpen}set isDropdownOpen(t){this._isDropdownOpen=t,this._host.requestUpdate()}get isAttributesExpanded(){return this._isAttributesExpanded}set isAttributesExpanded(t){this._isAttributesExpanded=t,this._host.requestUpdate()}get showEffectInfo(){return this._showEffectInfo}set showEffectInfo(t){this._showEffectInfo=t,this._host.requestUpdate()}get showEffectParameters(){return this._showEffectParameters}set showEffectParameters(t){this._showEffectParameters=t,this._host.requestUpdate()}get showBrightnessControl(){return this._showBrightnessControl}set showBrightnessControl(t){this._showBrightnessControl=t,this._host.requestUpdate()}get brightness(){return this._brightness}set brightness(t){this._brightness=t,this._host.requestUpdate()}get allowedEffects(){return this._allowedEffects}set allowedEffects(t){this._allowedEffects=t,this._host.requestUpdate()}get lastEffectImage(){return this._lastEffectImage}set lastEffectImage(t){this._lastEffectImage=t,this._host.requestUpdate()}}var tr=function(t){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.width=this.canvas.width=t.width,this.height=this.canvas.height=t.height,this.context.drawImage(t,0,0,this.width,this.height)};tr.prototype.getPixelCount=function(){return this.width*this.height},tr.prototype.getImageData=function(){return this.context.getImageData(0,0,this.width,this.height)};var er=function(){};if(er.prototype.getColor=function(t,e){return this.getPalette(t,5,e)[0]},er.prototype.getPalette=function(t,e,n){(void 0===e||e<2||e>256)&&(e=10),(void 0===n||n<1)&&(n=10);for(var r,s,o,i,a=new tr(t),c=a.getImageData().data,l=a.getPixelCount(),h=[],d=0;d=125&&(s>250&&o>250&&i>250||h.push([s,o,i]));var f=rr.quantize(h,e);return f?f.palette():null},er.prototype.getColorFromUrl=function(t,e,n){var r=document.createElement("img"),s=this;r.addEventListener("load",(function(){var o=s.getPalette(r,5,n);e(o[0],t)})),r.src=t},er.prototype.getImageData=function(t,e){var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){if(200==this.status){var t=new Uint8Array(this.response);r=t.length;for(var n=new Array(r),r=0;re?1:0},sum:function(t,e){var n={};return t.reduce(e?function(t,r,s){return n.index=s,t+e.call(n,r)}:function(t,e){return t+e},0)},max:function(t,e){return Math.max.apply(null,e?nr.map(t,e):t)}};var rr=function(){var t=5,e=8-t;function n(e,n,r){return(e<<2*t)+(n<h/2){for(s=e.copy(),o=e.copy(),a=(n=i-e[c])<=(r=e[l]-i)?Math.min(e[l]-1,~~(i+r/2)):Math.max(e[c],~~(i-1-n/2));!d[a];)a++;for(u=f[a];!u&&d[a-1];)u=f[--a];return s[l]=a,o[c]=s[l]+1,[s,o]}}(o==r?"r":o==s?"g":"b")}}return s.prototype={volume:function(t){return this._volume&&!t||(this._volume=(this.r2-this.r1+1)*(this.g2-this.g1+1)*(this.b2-this.b1+1)),this._volume},count:function(t){var e=this.histo;if(!this._count_set||t){var r,s,o,i=0;for(r=this.r1;r<=this.r2;r++)for(s=this.g1;s<=this.g2;s++)for(o=this.b1;o<=this.b2;o++)i+=e[n(r,s,o)]||0;this._count=i,this._count_set=!0}return this._count},copy:function(){return new s(this.r1,this.r2,this.g1,this.g2,this.b1,this.b2,this.histo)},avg:function(e){var r=this.histo;if(!this._avg||e){var s,o,i,a,c=0,l=1<<8-t,h=0,d=0,f=0;for(o=this.r1;o<=this.r2;o++)for(i=this.g1;i<=this.g2;i++)for(a=this.b1;a<=this.b2;a++)c+=s=r[n(o,i,a)]||0,h+=s*(o+.5)*l,d+=s*(i+.5)*l,f+=s*(a+.5)*l;this._avg=c?[~~(h/c),~~(d/c),~~(f/c)]:[~~(l*(this.r1+this.r2+1)/2),~~(l*(this.g1+this.g2+1)/2),~~(l*(this.b1+this.b2+1)/2)]}return this._avg},contains:function(t){var n=t[0]>>e,r=t[1]>>e,s=t[2]>>e;return n>=this.r1&&n<=this.r2&&r>=this.g1&&r<=this.g2&&s>=this.b1&&s<=this.b2}},o.prototype={push:function(t){this.vboxes.push({vbox:t,color:t.avg()})},palette:function(){return this.vboxes.map((function(t){return t.color}))},size:function(){return this.vboxes.size()},map:function(t){for(var e=this.vboxes,n=0;n251&&r[1]>251&&r[2]>251&&(t[n].color=[255,255,255])}},{quantize:function(a,c){if(!a.length||c<2||c>256)return!1;var l=function(r){var s,o=new Array(1<<3*t);return r.forEach((function(t){s=n(t[0]>>e,t[1]>>e,t[2]>>e),o[s]=(o[s]||0)+1})),o}(a);l.forEach((function(){}));var h=function(t,n){var r,o,i,a=1e6,c=0,l=1e6,h=0,d=1e6,f=0;return t.forEach((function(t){(r=t[0]>>e)c&&(c=r),(o=t[1]>>e)h&&(h=o),(i=t[2]>>e)f&&(f=i)})),new s(a,c,l,h,d,f,n)}(a,l),d=new r((function(t,e){return nr.naturalOrder(t.count(),e.count())}));function f(t,e){for(var n,r=1,s=0;s<1e3;)if((n=t.pop()).count()){var o=i(l,n),a=o[0],c=o[1];if(!a)return;if(t.push(a),c&&(t.push(c),r++),r>=e)return;if(s++>1e3)return}else t.push(n),s++}d.push(h),f(d,.75*c);for(var u=new r((function(t,e){return nr.naturalOrder(t.count()*t.volume(),e.count()*e.volume())}));d.size();)u.push(d.pop());f(u,c-u.size());for(var p=new o;u.size();)p.push(u.pop());return p}}}();class sr{constructor(){this._colorThief=new er,Jn("ColorManager: Constructor called")}extractColors(t){return n(this,void 0,void 0,(function*(){if(Jn("ColorManager: extractColors called"),!t)return Jn("ColorManager: No effect image provided"),{backgroundColor:"",textColor:"",accentColor:""};const e=new Image;return e.crossOrigin="Anonymous",e.src=t,e.alt="Effect image",new Promise((t=>{e.onload=()=>{const n=this._colorThief.getPalette(e,3);if(Jn("ColorManager: Color palette extracted",n),n&&n.length>=2){const e=`rgb(${n[0].join(",")})`,r=`rgb(${Fn(n[0]).join(",")})`,s=`rgb(${n[1].join(",")})`;Jn("ColorManager: New colors:",e,r,s),t({backgroundColor:e,textColor:r,accentColor:s})}else console.warn("ColorManager: Insufficient colors in palette",n),t({backgroundColor:"",textColor:"",accentColor:""})}}))}))}}class or{constructor(t,e){this._pendingBrightnessUpdate=null,this._config=t,this._state=e,this._colorManager=new sr,Jn("StateManager: Initialized with config",t)}get hass(){return this._hass}set hass(t){this._hass=t,this.updateState()}updateState(){return n(this,void 0,void 0,(function*(){if(Jn("StateManager: Updating state"),this._hass&&this._config){const e=this._hass.states[this._config.entity];if(e){Jn("StateManager: State object:",e);const n=e.attributes.effect||"No effect",r="on"===e.state,s=(t=e.attributes.brightness,Math.round((t-3)/252*100));if(Jn("StateManager: Potential new state:",{effect:n,isOn:r,brightness:s}),e.attributes.effect_image!==this._state.lastEffectImage){this._state.lastEffectImage=e.attributes.effect_image;const t=yield this._colorManager.extractColors(e.attributes.effect_image);this._state.backgroundColor=t.backgroundColor,this._state.textColor=t.textColor,this._state.accentColor=t.accentColor,Jn("StateManager: New effect image detected and colors extracted")}this._state.currentEffect===n&&this._state.isOn===r&&this._state.brightness===s||(this._state.currentEffect=n,this._state.isOn=r,this._state.brightness=s,Jn("StateManager: State updated",{effect:this._state.currentEffect,isOn:this._state.isOn,brightness:this._state.brightness}))}}var t}))}toggleDropdown(){this._state.isDropdownOpen=!this._state.isDropdownOpen,Jn("StateManager: Dropdown toggled, new state:",this._state.isDropdownOpen)}toggleAttributes(){this._state.isAttributesExpanded=!this._state.isAttributesExpanded,Jn("StateManager: Attributes expanded:",this._state.isAttributesExpanded)}toggleLight(){return n(this,void 0,void 0,(function*(){this._state.isOn=!this._state.isOn,Jn("StateManager: Light toggled, new state:",this._state.isOn),this._hass&&this._config&&(Jn("StateManager: Calling service",this._state.isOn),yield this._hass.callService("light",this._state.isOn?"turn_on":"turn_off",{entity_id:this._config.entity}))}))}setBrightness(t){if(this._state.brightness=t,Jn("StateManager: Brightness updated:",this._state.brightness),this._pendingBrightnessUpdate&&(this._pendingBrightnessUpdate=null),this._hass&&this._config){const n=(e=t,Math.round(e/100*252)+3);this._pendingBrightnessUpdate=this._hass.callService("light","turn_on",{entity_id:this._config.entity,brightness:n}),Jn("StateManager: Brightness updated",{brightness:t,haBrightness:n})}var e}setCurrentEffect(t){return n(this,void 0,void 0,(function*(){this._state.currentEffect=t,Jn("StateManager: Current effect set to:",this._state.currentEffect),this._hass&&this._config&&(yield this._hass.callService("light","turn_on",{entity_id:this._config.entity,effect:t}))}))}}class ir extends at{constructor(){super(),this._memoizedEffectList=function(t){const e=new Map;return function(){for(var n=arguments.length,r=new Array(n),s=0;st.map((t=>G` - `)))),this._clickOutsideHandler=this._handleClickOutside.bind(this),console.debug("HyperLightCard: Constructor called")}static get styles(){return l` + `)))),this.state=new Qn(this),this.stateManager=new or(this.config,this.state),this._clickOutsideHandler=this._handleClickOutside.bind(this),Jn("HyperLightCard: Constructor called")}static get styles(){return l` ${c("/* Root variables */\n:root {\n --primary-color: #03a9f4;\n --secondary-color: #f0f0f0;\n --background-color: white;\n --text-color: black;\n --box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12),\n 0 3px 1px -2px rgba(0, 0, 0, 0.2);\n}\n\n/* Global styles */\n* {\n transition: all 0.5s ease;\n}\n\n/* Card Container */\nha-card {\n overflow: visible !important;\n}\n\n/* Main card styling */\n.card {\n background-color: var(\n --background-color,\n var(--ha-card-background, var(--card-background-color, white))\n );\n border-radius: 8px;\n box-shadow: var(\n --ha-card-box-shadow,\n 0 2px 2px 0 rgba(0, 0, 0, 0.14),\n 0 1px 5px 0 rgba(0, 0, 0, 0.12),\n 0 3px 1px -2px rgba(0, 0, 0, 0.2)\n );\n color: var(--text-color, var(--primary-text-color, black));\n padding: 16px;\n position: relative;\n overflow: visible;\n z-index: 1;\n font-size: 14px;\n transition:\n background-color 0.5s ease,\n color 0.5s ease;\n}\n\n/* Card border */\n.card::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border-radius: 8px;\n pointer-events: none;\n box-shadow: inset 0 0 0 1px rgba(var(--rgb-primary-text-color, 0, 0, 0), 0.1);\n z-index: 1;\n}\n\n/* Card Background */\n.card-background {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-size: cover;\n background-position: center;\n opacity: 0.7;\n transition:\n opacity 0.5s ease,\n background-image 0.5s ease;\n z-index: 0;\n pointer-events: none;\n border-radius: 8px; /* Add border-radius to match the card */\n}\n\n/* Header section */\n.header {\n display: flex;\n align-items: center;\n margin-bottom: 16px;\n position: relative;\n z-index: 2;\n}\n\n/* Light icon styling */\n.light-icon {\n width: 40px;\n height: 40px;\n margin-right: 16px;\n border-radius: 50%;\n background-color: var(--accent-color, var(--primary-color, #03a9f4));\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n overflow: hidden;\n box-shadow: 0 0 0\n rgba(var(--accent-color, var(--primary-color-rgb, 3, 169, 244)), 0);\n transition: box-shadow 0.3s ease;\n}\n\n.light-icon img {\n width: 30px;\n height: 30px;\n filter: brightness(0.8);\n transition: filter 0.3s ease;\n}\n\n/* Light icon when the light is on */\n.light-on .light-icon {\n box-shadow: 0 0 15px var(--accent-color, var(--primary-color, #03a9f4));\n animation: pulse 1.5s infinite;\n}\n\n.light-on .light-icon img {\n filter: brightness(1.2) drop-shadow(0 0 5px rgba(255, 255, 255, 0.7));\n}\n\n/* Pulsing animation for light icon */\n@keyframes pulse {\n 0% {\n box-shadow: 0 0 0 0 rgba(var(--rgb-accent-color), 0.7);\n }\n 70% {\n box-shadow: 0 0 0 10px rgba(var(--rgb-accent-color), 0);\n }\n 100% {\n box-shadow: 0 0 0 0 rgba(var(--rgb-accent-color), 0);\n }\n}\n\n/* Light name styling */\n.light-name {\n flex-grow: 1;\n font-weight: bold;\n font-size: 1.5em;\n color: var(--text-color, var(--primary-text-color, black));\n margin: 0 6px;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n/* Dropdown section */\n.effect-select-wrapper {\n position: relative;\n margin-bottom: 16px;\n z-index: 5;\n}\n\n.dropdown {\n position: relative;\n}\n\n.dropdown-header {\n padding: 8px 12px;\n border: 2px solid var(--accent-color, var(--primary-color, #03a9f4));\n border-radius: 4px;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: center;\n background-color: var(\n --background-color,\n var(--card-background-color, white)\n );\n color: var(--text-color, var(--primary-text-color, black));\n font-size: 1.1em;\n transition:\n background-color 0.3s ease,\n color 0.3s ease;\n}\n\n.dropdown-header:hover {\n background-color: var(\n --accent-color,\n var(--secondary-background-color, #f0f0f0)\n );\n color: var(--background-color, var(--primary-text-color, black));\n}\n\n.dropdown-header::after {\n content: 'β–Ό';\n font-size: 0.8em;\n transition: transform 0.3s ease;\n}\n\n.dropdown.open .dropdown-header::after {\n transform: rotate(180deg);\n}\n\n.dropdown-content {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n background-color: var(\n --background-color,\n var(--card-background-color, white)\n );\n border: 1px solid var(--accent-color, var(--primary-color, #03a9f4));\n border-radius: 0 0 4px 4px;\n max-height: 200px;\n overflow-y: auto;\n z-index: 6; /* Increased z-index */\n opacity: 0;\n visibility: hidden;\n transform-origin: top;\n transform: scaleY(0);\n transition:\n opacity 0.3s,\n visibility 0.3s,\n transform 0.3s;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n}\n\n.dropdown.open .dropdown-content {\n opacity: 1;\n visibility: visible;\n transform: scaleY(1);\n}\n\n.dropdown-item {\n padding: 8px 12px;\n cursor: pointer;\n color: var(--text-color, var(--primary-text-color, black));\n font-size: 1.1em;\n transition:\n background-color 0.3s ease,\n color 0.3s ease;\n}\n\n.dropdown-item:hover {\n background-color: var(--accent-color, var(--primary-color, #03a9f4));\n color: var(--background-color, white);\n}\n\n.dropdown-item.selected {\n background-color: var(--accent-color, #03a9f4);\n color: var(--text-color, white);\n}\n\n/* Effect info section */\n.effect-info {\n background-color: rgba(var(--background-color-rgb, 128, 128, 128), 0.1);\n -webkit-backdrop-filter: blur(10px);\n backdrop-filter: blur(10px);\n border-radius: 8px;\n padding: 12px;\n margin-top: 12px;\n position: relative;\n z-index: 4; /* Adjusted z-index */\n opacity: 0;\n transform: translateY(-10px);\n max-height: 0;\n overflow: hidden;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n border: 1px solid rgba(var(--accent-color-rgb, 3, 169, 244), 0.3);\n display: flex;\n justify-content: space-between;\n transition:\n opacity 0.3s ease,\n transform 0.3s ease,\n max-height 0.3s ease;\n}\n\n.effect-info.visible {\n opacity: 1;\n transform: translateY(0);\n max-height: 200px;\n}\n\n.effect-info-text {\n flex: 1;\n}\n\n.effect-description {\n font-style: italic;\n color: var(--text-color, var(--primary-text-color, black));\n font-weight: 500;\n margin-bottom: 8px;\n line-height: 1.4;\n}\n\n.effect-publisher {\n font-size: 0.9em;\n color: var(--text-color, var(--secondary-text-color, #666));\n font-weight: 500;\n line-height: 1.4;\n}\n\n.effect-features {\n display: flex;\n flex-direction: column;\n justify-content: center;\n margin-left: 12px;\n}\n\n.effect-features ha-icon {\n --mdc-icon-size: 20px;\n color: var(--text-color, var(--secondary-text-color, #666));\n margin-bottom: 4px;\n}\n\n.effect-features ha-icon:last-child {\n margin-bottom: 0;\n}\n\n/* Controls row (brightness slider and attributes toggle) */\n.controls-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-top: 16px;\n padding: 0 8px;\n}\n\n/* Brightness Slider */\n.brightness-slider {\n display: flex;\n align-items: center;\n flex-grow: 1;\n margin-right: 16px;\n}\n\n.brightness-slider ha-icon {\n margin-right: 8px;\n color: var(--text-color);\n}\n\n.brightness-slider input[type='range'] {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none; /* Add the standard 'appearance' property */\n width: 100%;\n height: 8px;\n border-radius: 4px;\n background: var(--primary-text-color);\n outline: none;\n opacity: 0.8;\n transition: all 0.3s ease;\n margin: 0;\n padding: 0;\n}\n\n.brightness-slider input[type='range']::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 18px;\n height: 18px;\n border-radius: 50%;\n background: var(--slider-color, var(--accent-color));\n cursor: pointer;\n -webkit-transition: all 0.3s ease;\n transition: all 0.3s ease;\n box-shadow: 0 0 0 3px rgba(var(--rgb-primary-text-color), 0.8);\n margin-top: -5px;\n}\n\n.brightness-slider input[type='range']::-moz-range-thumb {\n width: 18px;\n height: 18px;\n border: none;\n border-radius: 50%;\n background: var(--slider-color, var(--accent-color));\n cursor: pointer;\n -moz-transition: all 0.3s ease;\n transition: all 0.3s ease;\n box-shadow: 0 0 0 3px rgba(var(--rgb-primary-text-color), 0.8);\n}\n\n.brightness-slider input[type='range']::-webkit-slider-runnable-track {\n height: 8px;\n border-radius: 4px;\n background: linear-gradient(\n to right,\n var(--slider-color, var(--accent-color)) 0%,\n var(--slider-color, var(--accent-color)) var(--slider-percentage, 50%),\n var(--primary-text-color) var(--slider-percentage, 50%),\n var(--primary-text-color) 100%\n );\n}\n\n.brightness-slider input[type='range']::-moz-range-track {\n height: 8px;\n border-radius: 4px;\n background: linear-gradient(\n to right,\n var(--slider-color, var(--accent-color)) 0%,\n var(--slider-color, var(--accent-color)) var(--slider-percentage, 50%),\n var(--primary-text-color) var(--slider-percentage, 50%),\n var(--primary-text-color) 100%\n );\n}\n\n.brightness-slider input[type='range']:hover::-webkit-slider-thumb,\n.brightness-slider input[type='range']:active::-webkit-slider-thumb {\n box-shadow: 0 0 0 4px rgba(var(--rgb-primary-text-color), 0.9);\n transform: scale(1.2);\n}\n\n.brightness-slider input[type='range']:hover::-moz-range-thumb,\n.brightness-slider input[type='range']:active::-moz-range-thumb {\n box-shadow: 0 0 0 4px rgba(var(--rgb-primary-text-color), 0.9);\n transform: scale(1.2);\n}\n\n/* Attributes section */\n.attributes {\n margin-top: 8px;\n position: relative;\n z-index: 2;\n}\n\n.attributes-toggle {\n cursor: pointer;\n padding: 8px;\n border-radius: 50%;\n background-color: rgba(var(--rgb-primary-text-color), 0.1);\n transition: background-color 0.3s ease;\n}\n\n.attributes-toggle:hover {\n background-color: rgba(var(--rgb-primary-text-color), 0.2);\n}\n\n.attributes-toggle ha-icon {\n display: block;\n transition: transform 0.3s ease;\n}\n\n.attributes.expanded .attributes-toggle ha-icon {\n transform: rotate(180deg);\n}\n\n.attributes-content {\n max-height: 0;\n overflow: hidden;\n border-radius: 8px;\n padding: 0;\n margin-top: 8px;\n background-color: rgba(var(--background-color-rgb, 128, 128, 128), 0.1);\n -webkit-backdrop-filter: blur(10px);\n backdrop-filter: blur(10px);\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition:\n max-height 0.3s ease,\n padding 0.3s ease,\n opacity 0.3s ease;\n opacity: 0;\n}\n\n.attributes.expanded .attributes-content {\n max-height: 300px;\n padding: 8px 12px;\n overflow-y: auto;\n border: 1px solid rgba(var(--accent-color-rgb, 3, 169, 244), 0.3);\n opacity: 1;\n}\n\n/* Attribute list styling */\n.attribute-list {\n list-style-type: none;\n padding: 0;\n margin: 0;\n}\n\n.attribute-item {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n padding: 6px 0;\n border-bottom: 1px solid rgba(var(--rgb-primary-text-color, 0, 0, 0), 0.12);\n font-size: 0.9em;\n}\n\n.attribute-item:last-child {\n border-bottom: none;\n}\n\n.attribute-key {\n font-weight: bold;\n margin-right: 8px;\n color: var(--text-color, var(--primary-text-color, black));\n flex: 0 0 40%;\n}\n\n.attribute-value {\n flex: 0 0 58%;\n text-align: right;\n color: var(--text-color, var(--secondary-text-color, #666));\n overflow-wrap: break-word;\n word-break: break-word;\n font-size: 0.9em;\n}\n\n/* Scrollbar styles */\n.dropdown-content::-webkit-scrollbar,\n.attributes.expanded .attributes-content::-webkit-scrollbar {\n width: 8px;\n}\n\n.dropdown-content::-webkit-scrollbar-track,\n.attributes.expanded .attributes-content::-webkit-scrollbar-track {\n background: rgba(var(--background-color-rgb, 128, 128, 128), 0.1);\n}\n\n.dropdown-content::-webkit-scrollbar-thumb,\n.attributes.expanded .attributes-content::-webkit-scrollbar-thumb {\n background-color: var(--accent-color, var(--primary-color, #03a9f4));\n border-radius: 4px;\n border: 2px solid rgba(var(--background-color-rgb, 128, 128, 128), 0.1);\n}\n\n/* Toggle switch styles */\nha-switch {\n --switch-checked-color: var(--accent-color, var(--primary-color));\n --switch-checked-button-color: var(\n --switch-checked-color,\n var(--primary-background-color)\n );\n --switch-checked-track-color: var(--switch-checked-color, #000000);\n}\n\n/* Utility classes */\n.bg-white {\n background-color: var(--background-color);\n}\n\n.text-black {\n color: var(--text-color);\n}\n\n.rounded {\n border-radius: 8px;\n}\n\n/* Responsive design */\n@media (max-width: 600px) {\n .card {\n padding: 12px;\n font-size: 14px;\n }\n\n .light-icon {\n width: 32px;\n height: 32px;\n }\n\n .light-icon img {\n width: 24px;\n height: 24px;\n }\n\n .light-name {\n font-size: 1.5em;\n }\n\n .dropdown-header,\n .dropdown-item {\n padding: 6px 10px;\n }\n\n .controls-row {\n flex-direction: column;\n align-items: stretch;\n }\n\n .brightness-slider {\n margin-right: 0;\n margin-bottom: 12px;\n }\n\n .attributes-toggle {\n align-self: flex-end;\n }\n}\n\n/* Ensure content is above background */\n.header,\n.controls-row,\n.attributes {\n position: relative;\n z-index: 3;\n}\n")} - `}setConfig(t){var e,n;if(console.debug("HyperLightCard: setConfig called",t),!t.entity)throw new Error("You need to define an entity");this.config=Object.assign({name:t.name,icon:t.icon||"https://brands.home-assistant.io/_/signalrgb/icon.png",background_opacity:t.background_opacity||.7,show_effect_info:!1!==t.show_effect_info,show_effect_parameters:!1!==t.show_effect_parameters},t),this._showEffectInfo=null===(e=this.config.show_effect_info)||void 0===e||e,this._showEffectParameters=null===(n=this.config.show_effect_parameters)||void 0===n||n,console.debug("HyperLightCard: Config set",this.config)}getCardSize(){return 3}firstUpdated(){console.debug("HyperLightCard: firstUpdated called"),this._debouncedExtractColors()}_extractColors(){var t;if(console.debug("HyperLightCard: _extractColors called"),!(null===(t=this.config)||void 0===t?void 0:t.entity)||!this.hass)return void console.debug("HyperLightCard: No entity configured or hass not available");const e=this.hass.states[this.config.entity];if(!e||!e.attributes.effect_image)return void console.debug("HyperLightCard: No effect image found");console.debug("HyperLightCard: Extracting colors from effect image");const n=new Image;n.crossOrigin="Anonymous",n.src=e.attributes.effect_image,n.alt=`${e.entity_id} effect image`,n.onload=()=>{const t=this._colorThief.getPalette(n,3);console.debug("HyperLightCard: Color palette extracted",t),t&&t.length>=2?this._applyColorTransition(t):console.warn("HyperLightCard: Insufficient colors in palette",t)}}_applyColorTransition(t){return n(this,void 0,void 0,(function*(){if(console.debug("HyperLightCard: _applyColorTransition called",t),this._transitionInProgress)return void console.debug("HyperLightCard: Color transition already in progress");this._transitionInProgress=!0;const e=`rgb(${t[0].join(",")})`,n=`rgb(${Ct(t[0]).join(",")})`,r=`rgb(${t[1].join(",")})`;console.debug("HyperLightCard: New colors:",e,n,r),yield new Promise((t=>{requestAnimationFrame((()=>{this.style.setProperty("--background-color",e),this.style.setProperty("--text-color",n),this.style.setProperty("--accent-color",r),this.style.setProperty("--switch-checked-color",r),this.style.setProperty("--switch-checked-button-color",r),this.style.setProperty("--switch-checked-track-color",r),this._backgroundColor=e,this._textColor=n,this._accentColor=r,t(null)}))})),this._transitionInProgress=!1,this.requestUpdate()}))}updated(t){var e,n,r;if(super.updated(t),console.debug("HyperLightCard: updated called",t),console.debug("HyperLightCard: current hass state:",null===(e=this.hass)||void 0===e?void 0:e.states[null!==(r=null===(n=this.config)||void 0===n?void 0:n.entity)&&void 0!==r?r:""]),this.hass&&this.config){const t=this.hass.states[this.config.entity];if(t){const e=t.attributes.effect||"No effect",n="on"===t.state,r=Math.round((Number(t.attributes.brightness)-3)/252*100);console.debug("HyperLightCard: Potential new state:",{effect:e,isOn:n,brightness:r}),t.attributes.effect_image!==this._lastEffectImage&&(this._lastEffectImage=t.attributes.effect_image,this._debouncedExtractColors()),this._currentEffect===e&&this._isOn===n&&this._brightness===r||(console.debug("HyperLightCard: State changed, updating"),this._currentEffect=e,this._isOn=n,this._brightness=r,this._debouncedExtractColors())}}this._isDropdownOpen&&this._scrollToCurrentEffect()}render(){if(console.debug("HyperLightCard: render called with state:",{isOn:this._isOn,currentEffect:this._currentEffect,brightness:this._brightness,isDropdownOpen:this._isDropdownOpen}),!this.hass||!this.config)return console.debug("HyperLightCard: hass or config not available"),G``;const t=this.hass.states[this.config.entity];if(!t)return console.debug("HyperLightCard: Entity not found",this.config.entity),G` + `}setConfig(t){var e;if(Jn("HyperLightCard: setConfig called",t),!t.entity)throw new Error("You need to define an entity");this.config=Object.assign({name:t.name,icon:t.icon||"https://brands.home-assistant.io/_/signalrgb/icon.png",background_opacity:t.background_opacity||.7,show_effect_info:!1!==t.show_effect_info,show_effect_parameters:!1!==t.show_effect_parameters,show_brightness_control:null===(e=t.show_brightness_control)||void 0===e||e,allowed_effects:t.allowed_effects},t),this.stateManager=new or(this.config,this.state),Jn("HyperLightCard: Config set",this.config)}getCardSize(){return 3}firstUpdated(){Jn("HyperLightCard: firstUpdated called"),this.hass&&this.config&&(this.stateManager.hass=this.hass),this.stateManager.updateState()}updated(t){var e,n,r;super.updated(t),Jn("HyperLightCard: updated called",t),Jn("HyperLightCard: current hass state:",null===(e=this.hass)||void 0===e?void 0:e.states[null!==(r=null===(n=this.config)||void 0===n?void 0:n.entity)&&void 0!==r?r:""]),this.hass&&this.config&&(this.stateManager.hass=this.hass),this.state.isDropdownOpen&&this._scrollToCurrentEffect()}render(){if(!this.hass||!this.config||!this.hass.states)return Jn("HyperLightCard: hass or config not available"),G``;const t=this.hass.states[this.config.entity];if(!t)return Jn("HyperLightCard: Entity not found",this.config.entity),G`
Entity not found: ${this.config.entity}
- `;console.debug("HyperLightCard: Rendering with state",{isOn:this._isOn,currentEffect:this._currentEffect,brightness:this._brightness});const e={"--slider-color":this._accentColor};return G` + `;Jn("HyperLightCard: Rendering with state",{isOn:this.state.isOn,currentEffect:this.state.currentEffect,brightness:this.state.brightness});const e={"--slider-color":this.state.accentColor};return G`
${this._renderBackground(t)} ${this._renderHeader(t)} ${this._renderEffectDropdown(t)} - ${this._showEffectInfo?this._renderEffectInfo(t):""} + ${this.state.showEffectInfo?this._renderEffectInfo(t):""}
- ${this._renderBrightnessSlider(e)} - ${this._showEffectParameters?this._renderAttributesToggle():""} + ${this.state.showBrightnessControl?this._renderBrightnessSlider(e):""} + ${this.state.showEffectParameters?this._renderAttributesToggle():""}
- ${this._showEffectParameters?this._renderAttributes(t):""} + ${this.state.showEffectParameters?this._renderAttributes(t):""}
- `}_renderBackground(t){const e=t.attributes.effect_image?`url(${t.attributes.effect_image})`:"none";return console.debug("HyperLightCard: Rendering background",e),G` + `}_renderBackground(t){const e=t.attributes.effect_image?`url(${t.attributes.effect_image})`:"none";return Jn("HyperLightCard: Rendering background",e),G` - `}_renderHeader(t){const e=this.config.name||t.attributes.friendly_name||t.entity_id;return console.debug("HyperLightCard: Rendering header",e),G` + `}_renderHeader(t){const e=this.config.name||t.attributes.friendly_name||t.entity_id;return Jn("HyperLightCard: Rendering header",e),G`
-
+
${this.config.icon&&this.config.icon.startsWith("mdi:")?G`
- `}_renderEffectDropdown(t){const e=Array.isArray(t.attributes.effect_list)?t.attributes.effect_list:[];return console.debug("HyperLightCard: Rendering effect dropdown",e),G` + `}_renderEffectDropdown(t){let e=Array.isArray(t.attributes.effect_list)?t.attributes.effect_list:[];return this.state.allowedEffects&&(e=e.filter((t=>this.state.allowedEffects.includes(t)))),Jn("HyperLightCard: Rendering effect dropdown",e),G`
- - `}_renderEffectInfo(t){if(!this._showEffectInfo)return G``;const e=t.attributes.effect_description||"No effect description available",n=t.attributes.effect_publisher||"Unknown publisher",r=t.attributes.effect_uses_audio||!1,o=t.attributes.effect_uses_input||!1,i=t.attributes.effect_uses_video||!1;return console.debug("HyperLightCard: Rendering effect info",{description:e,publisher:n,usesAudio:r,usesInput:o,usesVideo:i}),G` -
+ `}_renderEffectInfo(t){if(!this.state.showEffectInfo)return G``;const e=t.attributes.effect_description||"No effect description available",n=t.attributes.effect_publisher||"Unknown publisher",r=t.attributes.effect_uses_audio||!1,s=t.attributes.effect_uses_input||!1,o=t.attributes.effect_uses_video||!1;return Jn("HyperLightCard: Rendering effect info",{description:e,publisher:n,usesAudio:r,usesInput:s,usesVideo:o}),G` +
${e}
Published by: ${n}
@@ -182,67 +141,65 @@ const ft={attribute:!0,type:String,converter:x,reflect:!1,hasChanged:k},ht=(t=ft title="Uses Audio" aria-label="Uses Audio" >`:""} - ${o?G``:""} - ${i?G``:""}
- `}_renderBrightnessSlider(t){const e=Object.assign(Object.assign({},t),{"--slider-percentage":`${this._brightness}%`,"--slider-color":this._accentColor});return console.debug("HyperLightCard: Rendering brightness slider",e),G` + `}_renderBrightnessSlider(t){const e=Object.assign(Object.assign({},t),{"--slider-percentage":`${this.state.brightness}%`,"--slider-color":this.state.accentColor});return Jn("HyperLightCard: Rendering brightness slider",e),G`
- `}_renderAttributesToggle(){return console.debug("HyperLightCard: Rendering attributes toggle"),G` + `}_renderAttributesToggle(){return Jn("HyperLightCard: Rendering attributes toggle"),G`
- `}_renderAttributes(t){if(!this._showEffectParameters)return G``;const e=t.attributes.effect_parameters;return e&&0!==Object.keys(e).length?(console.debug("HyperLightCard: Rendering attributes",e),G` + `}_renderAttributes(t){if(!this.state.showEffectParameters)return G``;const e=t.attributes.effect_parameters;return e&&0!==Object.keys(e).length?(Jn("HyperLightCard: Rendering attributes",e),G`
${this._renderAttributesList(e)}
- `):(console.debug("HyperLightCard: No effect parameters to render"),G``)}_renderAttributesList(t){return t&&0!==Object.keys(t).length?(console.debug("HyperLightCard: Rendering attributes list",t),G` + `):(Jn("HyperLightCard: No effect parameters to render"),G``)}_renderAttributesList(t){return t&&0!==Object.keys(t).length?(Jn("HyperLightCard: Rendering attributes list",t),G`
    - ${Object.entries(t).map((t=>{let[e,n]=t;return G` + ${Object.entries(t).map((t=>{let e,n,[r,s]=t;return"string"==typeof s?(e=function(t){return t.split("_").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join(" ")}(r),n=s):(e=s.label,n=function(t,e){switch(e){case"color":return G`${t}`;case"number":case"combobox":default:return t.toString();case"boolean":return t?"Yes":"No"}}(s.value,s.type)),G`
  • - ${function(t){return t.split("_").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join(" ")}(e)}: - ${function(t){return"boolean"==typeof t?t?"Yes":"No":"number"==typeof t?t.toFixed(2):t}(n)} + ${e}: + ${n}
  • `}))}
- `):(console.debug("HyperLightCard: No effect parameters to list"),G`

No effect parameters available.

`)}_toggleLight(){console.debug("HyperLightCard: _toggleLight called"),this._isOn=!this._isOn,this.hass.callService("light",this._isOn?"turn_on":"turn_off",{entity_id:this.config.entity});const t=this.shadowRoot.querySelector(".effect-info");t&&(this._isOn?setTimeout((()=>{t.classList.add("visible"),console.debug("HyperLightCard: Effect info made visible")}),50):(t.classList.remove("visible"),console.debug("HyperLightCard: Effect info hidden"))),console.debug("HyperLightCard: Light toggled, new state:",this._isOn)}_getCurrentEffectIndex(){var t,e,n;const r=null===(t=this.hass)||void 0===t?void 0:t.states[null!==(n=null===(e=this.config)||void 0===e?void 0:e.entity)&&void 0!==n?n:""];return(Array.isArray(null==r?void 0:r.attributes.effect_list)?null==r?void 0:r.attributes.effect_list:[]).indexOf(this._currentEffect)}_scrollToCurrentEffect(){var t,e;console.debug("HyperLightCard: _scrollToCurrentEffect called");const n=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".dropdown-content"),r=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(`.dropdown-item[data-effect="${this._currentEffect}"]`);if(n&&r){const t=r.offsetTop-n.offsetTop;n.scrollTop=t,console.debug("HyperLightCard: Scrolled to current effect",{effect:this._currentEffect,scrollTop:t})}else console.debug("HyperLightCard: Could not find dropdown content or current effect item")}_highlightCurrentEffect(){const t=this.shadowRoot.querySelector(".dropdown-content");((null==t?void 0:t.querySelectorAll(".dropdown-item"))||[]).forEach((t=>{var e;t.classList.remove("selected"),(null===(e=t.textContent)||void 0===e?void 0:e.trim())===this._currentEffect&&t.classList.add("selected")})),console.debug("HyperLightCard: Highlighted current effect")}_toggleDropdown(t){console.debug("HyperLightCard: _toggleDropdown called"),t.stopPropagation(),this._isDropdownOpen=!this._isDropdownOpen,console.debug("HyperLightCard: Dropdown toggled, new state:",this._isDropdownOpen),this._isDropdownOpen&&requestAnimationFrame((()=>{this._scrollToCurrentEffect()})),this.requestUpdate()}_selectEffect(t){return n(this,void 0,void 0,(function*(){console.debug("HyperLightCard: _selectEffect called",t),this._currentEffect=t,this._isDropdownOpen=!1,this._isOn?(yield this.hass.callService("light","turn_on",{entity_id:this.config.entity,effect:t}),console.debug("HyperLightCard: Effect applied via service call")):console.debug("HyperLightCard: Light is off, effect not applied")}))}_toggleAttributes(){console.debug("HyperLightCard: _toggleAttributes called"),this._isAttributesExpanded=!this._isAttributesExpanded,console.debug("HyperLightCard: Attributes expanded:",this._isAttributesExpanded),this.requestUpdate()}_handleClickOutside(t){console.debug("HyperLightCard: _handleClickOutside called");const e=t.composedPath();this._isDropdownOpen&&!e.includes(this.shadowRoot.querySelector(".dropdown"))&&(this._isDropdownOpen=!1,console.debug("HyperLightCard: Dropdown closed due to outside click"),this.requestUpdate())}_handleBrightnessChange(t){return n(this,void 0,void 0,(function*(){console.debug("HyperLightCard: _handleBrightnessChange called");const e=t.target,n=Number(e.value);if(this._brightness=n,this.hass&&this.config){const t=Math.round(n/100*252)+3;yield this.hass.callService("light","turn_on",{entity_id:this.config.entity,brightness:t}),console.debug("HyperLightCard: Brightness updated",{brightness:n,haBrightness:t})}}))}_debounce(t,e){let n;return function(){for(var r=arguments.length,o=new Array(r),i=0;it(...o)),e)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._clickOutsideHandler),console.debug("HyperLightCard: connectedCallback called, click listener added")}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._clickOutsideHandler),console.debug("HyperLightCard: disconnectedCallback called, click listener removed")}}t([ut({type:Object}),e("design:type",Object)],Et.prototype,"hass",void 0),t([ut({type:Object}),e("design:type",Object)],Et.prototype,"config",void 0),t([dt(),e("design:type",Object)],Et.prototype,"_isOn",void 0),t([dt(),e("design:type",Object)],Et.prototype,"_currentEffect",void 0),t([dt(),e("design:type",Object)],Et.prototype,"_isDropdownOpen",void 0),t([dt(),e("design:type",Object)],Et.prototype,"_isAttributesExpanded",void 0),t([dt(),e("design:type",Object)],Et.prototype,"_backgroundColor",void 0),t([dt(),e("design:type",Object)],Et.prototype,"_textColor",void 0),t([dt(),e("design:type",Object)],Et.prototype,"_accentColor",void 0),t([dt(),e("design:type",Object)],Et.prototype,"_showEffectInfo",void 0),t([dt(),e("design:type",Object)],Et.prototype,"_showEffectParameters",void 0),t([dt(),e("design:type",Number)],Et.prototype,"_brightness",void 0),customElements.define("hyper-light-card",Et);console.log("%c πŸš€βœ¨πŸŒŸ hyper-light-card v0.9.4 launched! πŸŒ πŸ›ΈπŸŒˆ ","background: linear-gradient(90deg, #000033 0%, #0033cc 50%, #6600cc 100%); color: #00ffff; font-weight: bold; padding: 5px 10px; border-radius: 5px; text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #00ffff, 0 0 35px #00ffff, 0 0 40px #00ffff, 0 0 50px #00ffff, 0 0 75px #00ffff;"); + `):(Jn("HyperLightCard: No effect parameters to list"),G`

No effect parameters available.

`)}_toggleLight(){return n(this,void 0,void 0,(function*(){Jn("HyperLightCard: _toggleLight called"),yield this.stateManager.toggleLight();const t=this.shadowRoot.querySelector(".effect-info");t&&(this.state.isOn?setTimeout((()=>{t.classList.add("visible"),Jn("HyperLightCard: Effect info made visible")}),50):(t.classList.remove("visible"),Jn("HyperLightCard: Effect info hidden"))),Jn("HyperLightCard: Light toggled, new state:",this.state.isOn)}))}_getCurrentEffectIndex(){var t,e,n;const r=null===(t=this.hass)||void 0===t?void 0:t.states[null!==(n=null===(e=this.config)||void 0===e?void 0:e.entity)&&void 0!==n?n:""];return(Array.isArray(null==r?void 0:r.attributes.effect_list)?null==r?void 0:r.attributes.effect_list:[]).indexOf(this.state.currentEffect)}_scrollToCurrentEffect(){var t,e;Jn("HyperLightCard: _scrollToCurrentEffect called");const n=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".dropdown-content"),r=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(`.dropdown-item[data-effect="${this.state.currentEffect}"]`);if(n&&r){const t=r.offsetTop-n.offsetTop;n.scrollTop=t,Jn("HyperLightCard: Scrolled to current effect",{effect:this.state.currentEffect,scrollTop:t})}else Jn("HyperLightCard: Could not find dropdown content or current effect item")}_highlightCurrentEffect(){const t=this.shadowRoot.querySelector(".dropdown-content");((null==t?void 0:t.querySelectorAll(".dropdown-item"))||[]).forEach((t=>{var e;t.classList.remove("selected"),(null===(e=t.textContent)||void 0===e?void 0:e.trim())===this.state.currentEffect&&t.classList.add("selected")})),Jn("HyperLightCard: Highlighted current effect")}_toggleDropdown(t){Jn("HyperLightCard: _toggleDropdown called"),t.stopPropagation(),this.stateManager.toggleDropdown(),Jn("HyperLightCard: Dropdown toggled, new state:",this.state.isDropdownOpen),this.state.isDropdownOpen&&requestAnimationFrame((()=>{this._scrollToCurrentEffect()})),this.requestUpdate()}_selectEffect(t){return n(this,void 0,void 0,(function*(){Jn("HyperLightCard: _selectEffect called",t),yield this.stateManager.setCurrentEffect(t),this.stateManager.toggleDropdown()}))}_toggleAttributes(){Jn("HyperLightCard: _toggleAttributes called"),this.stateManager.toggleAttributes(),Jn("HyperLightCard: Attributes expanded:",this.state.isAttributesExpanded),this.requestUpdate()}_handleClickOutside(t){Jn("HyperLightCard: _handleClickOutside called");const e=t.composedPath();this.state.isDropdownOpen&&!e.includes(this.shadowRoot.querySelector(".dropdown"))&&(this.stateManager.toggleDropdown(),Jn("HyperLightCard: Dropdown closed due to outside click"),this.requestUpdate())}_handleBrightnessChange(t){return n(this,void 0,void 0,(function*(){Jn("HyperLightCard: _handleBrightnessChange called");const e=t.target,n=Number(e.value);yield this.stateManager.setBrightness(n)}))}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._clickOutsideHandler),Jn("HyperLightCard: connectedCallback called, click listener added")}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._clickOutsideHandler),Jn("HyperLightCard: disconnectedCallback called, click listener removed")}static getConfigElement(){return document.createElement("hyper-light-card-editor")}static getStubConfig(t,e){const n=e.filter((t=>t.match(/^light\.signalrgb_/)));return{entity:n.length>0?n[0]:"",name:"",show_effect_info:!0,show_effect_parameters:!0,show_brightness_control:!0,background_opacity:.7,allowed_effects:[]}}}t([dt({type:Object}),e("design:type",Object)],ir.prototype,"hass",void 0),t([dt({type:Object}),e("design:type",Object)],ir.prototype,"config",void 0),t([function(t){return dt({...t,state:!0,attribute:!1})}(),e("design:type",Qn)],ir.prototype,"state",void 0),customElements.define("hyper-light-card",ir),window.customCards=window.customCards||[],window.customCards.push({type:"hyper-light-card",name:"Hyper Light Card",description:"A custom card for controlling SignalRGB.",preview:!0,documentationURL:"https://github.com/hyperb1iss/hyper-light-card"});console.log("%c πŸš€βœ¨πŸŒŸ hyper-light-card v0.9.6 launched! πŸŒ πŸ›ΈπŸŒˆ ","background: linear-gradient(90deg, #000033 0%, #0033cc 50%, #6600cc 100%); color: #00ffff; font-weight: bold; padding: 5px 10px; border-radius: 5px; text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #00ffff, 0 0 35px #00ffff, 0 0 40px #00ffff, 0 0 50px #00ffff, 0 0 75px #00ffff;");export{ir as HyperLightCard}; //# sourceMappingURL=hyper-light-card.js.map diff --git a/package.json b/package.json index 0a32228..833207b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hyper-light-card", - "version": "0.9.4", + "version": "0.9.6", "description": "A custom Lovelace card for Home Assistant to control SignalRGB", "main": "target/hyper-light-card.js", "module": "target/hyper-light-card.js", @@ -101,4 +101,4 @@ "dependencies": { "custom-card-helpers": "^1.9.0" } -} +} \ No newline at end of file