UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

3 lines 30.1 kB
/*! For license information please see 22041.98d9291dfc5d8ec4.js.LICENSE.txt */ "use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["22041"],{22299:function(t,r,e){e.a(t,(async function(t,i){try{e.d(r,{z:()=>p});var n=e(31948),s=(e(71695),e(61495),e(40251),e(47021),e(9065)),a=e(4428),o=e(57243),l=e(50778),c=e(35359),m=e(20552),d=e(69634),h=t([n]);n=(h.then?(await h)():h)[0];let u,g=t=>t;class p extends o.oi{constructor(){super(...arguments),this.indeterminate=!1,this.progress=0,this.buffer=1,this.reverse=!1,this.closed=!1,this.stylePrimaryHalf="",this.stylePrimaryFull="",this.styleSecondaryQuarter="",this.styleSecondaryHalf="",this.styleSecondaryFull="",this.animationReady=!0,this.closedAnimationOff=!1,this.resizeObserver=null}connectedCallback(){super.connectedCallback(),this.rootEl&&this.attachResizeObserver()}render(){const t={"mdc-linear-progress--closed":this.closed,"mdc-linear-progress--closed-animation-off":this.closedAnimationOff,"mdc-linear-progress--indeterminate":this.indeterminate,"mdc-linear-progress--animation-ready":this.animationReady},r={"--mdc-linear-progress-primary-half":this.stylePrimaryHalf,"--mdc-linear-progress-primary-half-neg":""!==this.stylePrimaryHalf?`-${this.stylePrimaryHalf}`:"","--mdc-linear-progress-primary-full":this.stylePrimaryFull,"--mdc-linear-progress-primary-full-neg":""!==this.stylePrimaryFull?`-${this.stylePrimaryFull}`:"","--mdc-linear-progress-secondary-quarter":this.styleSecondaryQuarter,"--mdc-linear-progress-secondary-quarter-neg":""!==this.styleSecondaryQuarter?`-${this.styleSecondaryQuarter}`:"","--mdc-linear-progress-secondary-half":this.styleSecondaryHalf,"--mdc-linear-progress-secondary-half-neg":""!==this.styleSecondaryHalf?`-${this.styleSecondaryHalf}`:"","--mdc-linear-progress-secondary-full":this.styleSecondaryFull,"--mdc-linear-progress-secondary-full-neg":""!==this.styleSecondaryFull?`-${this.styleSecondaryFull}`:""},e={"flex-basis":this.indeterminate?"100%":100*this.buffer+"%"},i={transform:this.indeterminate?"scaleX(1)":`scaleX(${this.progress})`};return(0,o.dy)(u||(u=g` <div role="progressbar" class="mdc-linear-progress ${0}" style="${0}" dir="${0}" aria-label="${0}" aria-valuemin="0" aria-valuemax="1" aria-valuenow="${0}" @transitionend="${0}"> <div class="mdc-linear-progress__buffer"> <div class="mdc-linear-progress__buffer-bar" style="${0}"> </div> <div class="mdc-linear-progress__buffer-dots"></div> </div> <div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar" style="${0}"> <span class="mdc-linear-progress__bar-inner"></span> </div> <div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar"> <span class="mdc-linear-progress__bar-inner"></span> </div> </div>`),(0,c.$)(t),(0,d.V)(r),(0,m.o)(this.reverse?"rtl":void 0),(0,m.o)(this.ariaLabel),(0,m.o)(this.indeterminate?void 0:this.progress),this.syncClosedState,(0,d.V)(e),(0,d.V)(i))}update(t){!t.has("closed")||this.closed&&void 0!==t.get("closed")||this.syncClosedState(),super.update(t)}async firstUpdated(t){super.firstUpdated(t),this.attachResizeObserver()}syncClosedState(){this.closedAnimationOff=this.closed}updated(t){!t.has("indeterminate")&&t.has("reverse")&&this.indeterminate&&this.restartAnimation(),t.has("indeterminate")&&void 0!==t.get("indeterminate")&&this.indeterminate&&window.ResizeObserver&&this.calculateAndSetAnimationDimensions(this.rootEl.offsetWidth),super.updated(t)}disconnectedCallback(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),super.disconnectedCallback()}attachResizeObserver(){if(window.ResizeObserver)return this.resizeObserver=new window.ResizeObserver((t=>{if(this.indeterminate)for(const r of t)if(r.contentRect){const t=r.contentRect.width;this.calculateAndSetAnimationDimensions(t)}})),void this.resizeObserver.observe(this.rootEl);this.resizeObserver=null}calculateAndSetAnimationDimensions(t){const r=.8367142*t,e=2.00611057*t,i=.37651913*t,n=.84386165*t,s=1.60277782*t;this.stylePrimaryHalf=`${r}px`,this.stylePrimaryFull=`${e}px`,this.styleSecondaryQuarter=`${i}px`,this.styleSecondaryHalf=`${n}px`,this.styleSecondaryFull=`${s}px`,this.restartAnimation()}async restartAnimation(){this.animationReady=!1,await this.updateComplete,await new Promise(requestAnimationFrame),this.animationReady=!0,await this.updateComplete}open(){this.closed=!1}close(){this.closed=!0}}(0,s.__decorate)([(0,l.IO)(".mdc-linear-progress")],p.prototype,"rootEl",void 0),(0,s.__decorate)([(0,l.Cb)({type:Boolean,reflect:!0})],p.prototype,"indeterminate",void 0),(0,s.__decorate)([(0,l.Cb)({type:Number})],p.prototype,"progress",void 0),(0,s.__decorate)([(0,l.Cb)({type:Number})],p.prototype,"buffer",void 0),(0,s.__decorate)([(0,l.Cb)({type:Boolean,reflect:!0})],p.prototype,"reverse",void 0),(0,s.__decorate)([(0,l.Cb)({type:Boolean,reflect:!0})],p.prototype,"closed",void 0),(0,s.__decorate)([a.L,(0,l.Cb)({attribute:"aria-label"})],p.prototype,"ariaLabel",void 0),(0,s.__decorate)([(0,l.SB)()],p.prototype,"stylePrimaryHalf",void 0),(0,s.__decorate)([(0,l.SB)()],p.prototype,"stylePrimaryFull",void 0),(0,s.__decorate)([(0,l.SB)()],p.prototype,"styleSecondaryQuarter",void 0),(0,s.__decorate)([(0,l.SB)()],p.prototype,"styleSecondaryHalf",void 0),(0,s.__decorate)([(0,l.SB)()],p.prototype,"styleSecondaryFull",void 0),(0,s.__decorate)([(0,l.SB)()],p.prototype,"animationReady",void 0),(0,s.__decorate)([(0,l.SB)()],p.prototype,"closedAnimationOff",void 0),i()}catch(u){i(u)}}))},51574:function(t,r,e){e.d(r,{W:()=>n});let i;const n=(0,e(57243).iv)(i||(i=(t=>t)`@keyframes mdc-linear-progress-primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5,0,0.701732,0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435,0.381352,0.55,0.956352);transform:translateX(83.67142%);transform:translateX(var(--mdc-linear-progress-primary-half,83.67142%))}100%{transform:translateX(200.611057%);transform:translateX(var(--mdc-linear-progress-primary-full,200.611057%))}}@keyframes mdc-linear-progress-primary-indeterminate-scale{0%{transform:scaleX(.08)}36.65%{animation-timing-function:cubic-bezier(0.334731,0.12482,0.785844,1);transform:scaleX(.08)}69.15%{animation-timing-function:cubic-bezier(0.06,0.11,0.6,1);transform:scaleX(.661479)}100%{transform:scaleX(.08)}}@keyframes mdc-linear-progress-secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(0.15,0,0.515058,0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033,0.284058,0.8,0.733712);transform:translateX(37.651913%);transform:translateX(var(--mdc-linear-progress-secondary-quarter,37.651913%))}48.35%{animation-timing-function:cubic-bezier(0.4,0.627035,0.6,0.902026);transform:translateX(84.386165%);transform:translateX(var(--mdc-linear-progress-secondary-half,84.386165%))}100%{transform:translateX(160.277782%);transform:translateX(var(--mdc-linear-progress-secondary-full,160.277782%))}}@keyframes mdc-linear-progress-secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(0.205028,0.057051,0.57661,0.453971);transform:scaleX(.08)}19.15%{animation-timing-function:cubic-bezier(0.152313,0.196432,0.648374,1.004315);transform:scaleX(.457104)}44.15%{animation-timing-function:cubic-bezier(0.257759,-0.003163,0.211762,1.38179);transform:scaleX(.72796)}100%{transform:scaleX(.08)}}@keyframes mdc-linear-progress-buffering{from{transform:rotate(180deg) translateX(-10px)}}@keyframes mdc-linear-progress-primary-indeterminate-translate-reverse{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5,0,0.701732,0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435,0.381352,0.55,0.956352);transform:translateX(-83.67142%);transform:translateX(var(--mdc-linear-progress-primary-half-neg,-83.67142%))}100%{transform:translateX(-200.611057%);transform:translateX(var(--mdc-linear-progress-primary-full-neg,-200.611057%))}}@keyframes mdc-linear-progress-secondary-indeterminate-translate-reverse{0%{animation-timing-function:cubic-bezier(0.15,0,0.515058,0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033,0.284058,0.8,0.733712);transform:translateX(-37.651913%);transform:translateX(var(--mdc-linear-progress-secondary-quarter-neg,-37.651913%))}48.35%{animation-timing-function:cubic-bezier(0.4,0.627035,0.6,0.902026);transform:translateX(-84.386165%);transform:translateX(var(--mdc-linear-progress-secondary-half-neg,-84.386165%))}100%{transform:translateX(-160.277782%);transform:translateX(var(--mdc-linear-progress-secondary-full-neg,-160.277782%))}}@keyframes mdc-linear-progress-buffering-reverse{from{transform:translateX(-10px)}}.mdc-linear-progress{position:relative;width:100%;transform:translateZ(0);outline:1px solid transparent;overflow:hidden;transition:opacity 250ms 0s cubic-bezier(.4, 0, .6, 1)}@media screen and (forced-colors:active){.mdc-linear-progress{outline-color:CanvasText}}.mdc-linear-progress__bar{position:absolute;width:100%;height:100%;animation:none;transform-origin:top left;transition:transform 250ms 0s cubic-bezier(.4, 0, .6, 1)}.mdc-linear-progress__bar-inner{display:inline-block;position:absolute;width:100%;animation:none;border-top-style:solid}.mdc-linear-progress__buffer{display:flex;position:absolute;width:100%;height:100%}.mdc-linear-progress__buffer-dots{background-repeat:repeat-x;flex:auto;transform:rotate(180deg);animation:mdc-linear-progress-buffering 250ms infinite linear}.mdc-linear-progress__buffer-bar{flex:0 1 100%;transition:flex-basis 250ms 0s cubic-bezier(.4, 0, .6, 1)}.mdc-linear-progress__primary-bar{transform:scaleX(0)}.mdc-linear-progress__secondary-bar{display:none}.mdc-linear-progress--indeterminate .mdc-linear-progress__bar{transition:none}.mdc-linear-progress--indeterminate .mdc-linear-progress__primary-bar{left:-145.166611%}.mdc-linear-progress--indeterminate .mdc-linear-progress__secondary-bar{left:-54.888891%;display:block}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar{animation:mdc-linear-progress-primary-indeterminate-translate 2s infinite linear}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar>.mdc-linear-progress__bar-inner{animation:mdc-linear-progress-primary-indeterminate-scale 2s infinite linear}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar{animation:mdc-linear-progress-secondary-indeterminate-translate 2s infinite linear}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar>.mdc-linear-progress__bar-inner{animation:mdc-linear-progress-secondary-indeterminate-scale 2s infinite linear}.mdc-linear-progress[dir=rtl]:not([dir=ltr]) .mdc-linear-progress__bar,[dir=rtl] .mdc-linear-progress:not([dir=ltr]) .mdc-linear-progress__bar{right:0;-webkit-transform-origin:center right;transform-origin:center right}.mdc-linear-progress[dir=rtl]:not([dir=ltr]).mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar,[dir=rtl] .mdc-linear-progress:not([dir=ltr]).mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar{animation-name:mdc-linear-progress-primary-indeterminate-translate-reverse}.mdc-linear-progress[dir=rtl]:not([dir=ltr]).mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar,[dir=rtl] .mdc-linear-progress:not([dir=ltr]).mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar{animation-name:mdc-linear-progress-secondary-indeterminate-translate-reverse}.mdc-linear-progress[dir=rtl]:not([dir=ltr]) .mdc-linear-progress__buffer-dots,[dir=rtl] .mdc-linear-progress:not([dir=ltr]) .mdc-linear-progress__buffer-dots{animation:mdc-linear-progress-buffering-reverse 250ms infinite linear;transform:rotate(0)}.mdc-linear-progress[dir=rtl]:not([dir=ltr]).mdc-linear-progress--indeterminate .mdc-linear-progress__primary-bar,[dir=rtl] .mdc-linear-progress:not([dir=ltr]).mdc-linear-progress--indeterminate .mdc-linear-progress__primary-bar{right:-145.166611%;left:auto}.mdc-linear-progress[dir=rtl]:not([dir=ltr]).mdc-linear-progress--indeterminate .mdc-linear-progress__secondary-bar,[dir=rtl] .mdc-linear-progress:not([dir=ltr]).mdc-linear-progress--indeterminate .mdc-linear-progress__secondary-bar{right:-54.888891%;left:auto}.mdc-linear-progress--closed{opacity:0}.mdc-linear-progress--closed-animation-off .mdc-linear-progress__buffer-dots{animation:none}.mdc-linear-progress--closed-animation-off.mdc-linear-progress--indeterminate .mdc-linear-progress__bar,.mdc-linear-progress--closed-animation-off.mdc-linear-progress--indeterminate .mdc-linear-progress__bar .mdc-linear-progress__bar-inner{animation:none}.mdc-linear-progress__bar-inner{border-color:#6200ee;border-color:var(--mdc-theme-primary,#6200ee)}.mdc-linear-progress__buffer-dots{background-image:url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' enable-background='new 0 0 5 2' xml:space='preserve' viewBox='0 0 5 2' preserveAspectRatio='none slice'%3E%3Ccircle cx='1' cy='1' r='1' fill='%23e6e6e6'/%3E%3C/svg%3E")}.mdc-linear-progress__buffer-bar{background-color:#e6e6e6}.mdc-linear-progress{height:4px}.mdc-linear-progress__bar-inner{border-top-width:4px}.mdc-linear-progress__buffer-dots{background-size:10px 4px}:host{display:block}.mdc-linear-progress__buffer-bar{background-color:#e6e6e6;background-color:var(--mdc-linear-progress-buffer-color,#e6e6e6)}.mdc-linear-progress__buffer-dots{background-image:url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' enable-background='new 0 0 5 2' xml:space='preserve' viewBox='0 0 5 2' preserveAspectRatio='none slice'%3E%3Ccircle cx='1' cy='1' r='1' fill='%23e6e6e6'/%3E%3C/svg%3E");background-image:var(--mdc-linear-progress-buffering-dots-image, url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' enable-background='new 0 0 5 2' xml:space='preserve' viewBox='0 0 5 2' preserveAspectRatio='none slice'%3E%3Ccircle cx='1' cy='1' r='1' fill='%23e6e6e6'/%3E%3C/svg%3E"))}`))},87515:function(t,r,e){e.a(t,(async function(t,r){try{var i=e(9065),n=e(50778),s=e(22299),a=e(51574),o=t([s]);s=(o.then?(await o)():o)[0];let l=class extends s.z{};l.styles=[a.W],l=(0,i.__decorate)([(0,n.Mo)("mwc-linear-progress")],l),r()}catch(l){r(l)}}))},44201:function(t,r,e){e(13492)("Uint32",(function(t){return function(r,e,i){return t(this,r,e,i)}}))},76822:function(t,r,e){e.d(r,{O:()=>o});e(52247),e(71695),e(40251),e(47021),e(72700),e(8038),e(71513),e(75656),e(50100),e(18084);class i{scaleDown(t){const r=this.getWidth(),e=this.getHeight();let i=1;if(t.maxDimension>0){const n=Math.max(r,e);n>t.maxDimension&&(i=t.maxDimension/n)}else i=1/t.quality;i<1&&this.resize(r*i,e*i,i)}}e(9359),e(31526);function n(t,...r){return r.forEach((r=>{if(r)for(const e in r)if(r.hasOwnProperty(e)){const i=r[e];Array.isArray(i)?t[e]=i.slice(0):"object"==typeof i?(t[e]||(t[e]={}),n(t[e],i)):t[e]=i}})),t}e(92745);class s{constructor(t,r={}){this._src=t,this._opts=n({},o.DefaultOpts,r)}maxColorCount(t){return this._opts.colorCount=t,this}maxDimension(t){return this._opts.maxDimension=t,this}addFilter(t){return this._opts.filters?this._opts.filters.push(t):this._opts.filters=[t],this}removeFilter(t){if(this._opts.filters){const r=this._opts.filters.indexOf(t);r>0&&this._opts.filters.splice(r)}return this}clearFilters(){return this._opts.filters=[],this}quality(t){return this._opts.quality=t,this}useImageClass(t){return this._opts.ImageClass=t,this}useGenerator(t,r){return this._opts.generators||(this._opts.generators=[]),this._opts.generators.push(r?{name:t,options:r}:t),this}useQuantizer(t,r){return this._opts.quantizer=r?{name:t,options:r}:t,this}build(){return new o(this._src,this._opts)}getPalette(){return this.build().getPalette()}}const a=class t{constructor(r,e){this._src=r,this.opts=n({},t.DefaultOpts,e)}static use(t){this._pipeline=t}static from(t){return new s(t)}get result(){return this._result}_process(r,e){r.scaleDown(this.opts);const i=function(t,r){const{colorCount:e,quantizer:i,generators:s,filters:a}=t,o={colorCount:e},l="string"==typeof i?{name:i,options:{}}:i;return l.options=n({},o,l.options),n({},{quantizer:l,generators:s,filters:a},r)}(this.opts,e);return t._pipeline.process(r.getImageData(),i)}async getPalette(){const t=new this.opts.ImageClass;try{const r=await t.load(this._src),e=await this._process(r,{generators:["default"]});this._result=e;const i=e.palettes.default;if(!i)throw new Error("Something went wrong and a palette was not found, please file a bug against our GitHub repo: https://github.com/vibrant-Colors/node-vibrant/");return t.remove(),i}catch(r){return t.remove(),Promise.reject(r)}}async getPalettes(){const t=new this.opts.ImageClass;try{const r=await t.load(this._src),e=await this._process(r,{generators:["*"]});this._result=e;const i=e.palettes;return t.remove(),i}catch(r){return t.remove(),Promise.reject(r)}}};a.DefaultOpts={colorCount:64,quality:5,filters:[]};let o=a;o.DefaultOpts.quantizer="mmcq",o.DefaultOpts.generators=["default"],o.DefaultOpts.filters=["default"],o.DefaultOpts.ImageClass=class extends i{_getCanvas(){if(!this._canvas)throw new Error("Canvas is not initialized");return this._canvas}_getContext(){if(!this._context)throw new Error("Context is not initialized");return this._context}_getWidth(){if(!this._width)throw new Error("Width is not initialized");return this._width}_getHeight(){if(!this._height)throw new Error("Height is not initialized");return this._height}_initCanvas(){const t=this.image;if(!t)throw new Error("Image is not initialized");const r=this._canvas=document.createElement("canvas"),e=r.getContext("2d");if(!e)throw new ReferenceError("Failed to create canvas context");this._context=e,r.className="@vibrant/canvas",r.style.display="none",this._width=r.width=t.width,this._height=r.height=t.height,e.drawImage(t,0,0),document.body.appendChild(r)}load(t){let r,e;if("string"==typeof t)r=document.createElement("img"),e=t,function(t){const r=new URL(t,location.href);return r.protocol===location.protocol&&r.host===location.host&&r.port===location.port}(e)||function(t,r){const e=new URL(t),i=new URL(r);return e.protocol===i.protocol&&e.hostname===i.hostname&&e.port===i.port}(window.location.href,e)||(r.crossOrigin="anonymous"),r.src=e;else{if(!(t instanceof HTMLImageElement))return Promise.reject(new Error("Cannot load buffer as an image in browser"));r=t,e=t.src}return this.image=r,new Promise(((t,i)=>{const n=()=>{this._initCanvas(),t(this)};r.complete?n():(r.onload=n,r.onerror=t=>i(new Error(`Fail to load image: ${e}`)))}))}clear(){this._getContext().clearRect(0,0,this._getWidth(),this._getHeight())}update(t){this._getContext().putImageData(t,0,0)}getWidth(){return this._getWidth()}getHeight(){return this._getHeight()}resize(t,r,e){if(!this.image)throw new Error("Image is not initialized");this._width=this._getCanvas().width=t,this._height=this._getCanvas().height=r,this._getContext().scale(e,e),this._getContext().drawImage(this.image,0,0)}getPixelCount(){return this._getWidth()*this._getHeight()}getImageData(){return this._getContext().getImageData(0,0,this._getWidth(),this._getHeight())}remove(){this._canvas&&this._canvas.parentNode&&this._canvas.parentNode.removeChild(this._canvas)}};e(56475),e(23669),e(19134),e(11740);function l(t,r,e){let i,n,s;function a(t,r,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+6*(r-t)*e:e<.5?r:e<2/3?t+(r-t)*(2/3-e)*6:t}if(0===r)i=n=s=e;else{const o=e<.5?e*(1+r):e+r-e*r,l=2*e-o;i=a(l,o,t+1/3),n=a(l,o,t),s=a(l,o,t-1/3)}return[255*i,255*n,255*s]}class c{static applyFilters(t,r){return r.length>0?t.filter((({r:t,g:e,b:i})=>{var n;for(let s=0;s<r.length;s++)if(!(null==(n=r[s])?void 0:n.call(r,t,e,i,255)))return!1;return!0})):t}static clone(t){return new c(t._rgb,t._population)}get r(){return this._rgb[0]}get g(){return this._rgb[1]}get b(){return this._rgb[2]}get rgb(){return this._rgb}get hsl(){if(!this._hsl){const[t,r,e]=this._rgb;this._hsl=function(t,r,e){t/=255,r/=255,e/=255;const i=Math.max(t,r,e),n=Math.min(t,r,e);let s=0,a=0;const o=(i+n)/2;if(i!==n){const l=i-n;switch(a=o>.5?l/(2-i-n):l/(i+n),i){case t:s=(r-e)/l+(r<e?6:0);break;case r:s=(e-t)/l+2;break;case e:s=(t-r)/l+4}s/=6}return[s,a,o]}(t,r,e)}return this._hsl}get hex(){if(!this._hex){const[t,r,e]=this._rgb;this._hex=function(t,r,e){return"#"+((1<<24)+(t<<16)+(r<<8)+e).toString(16).slice(1,7)}(t,r,e)}return this._hex}get population(){return this._population}toJSON(){return{rgb:this.rgb,population:this.population}}getYiq(){if(!this._yiq){const t=this._rgb;this._yiq=(299*t[0]+587*t[1]+114*t[2])/1e3}return this._yiq}get titleTextColor(){return this._titleTextColor||(this._titleTextColor=this.getYiq()<200?"#fff":"#000"),this._titleTextColor}get bodyTextColor(){return this._bodyTextColor||(this._bodyTextColor=this.getYiq()<150?"#fff":"#000"),this._bodyTextColor}constructor(t,r){this._rgb=t,this._population=r}}e(82328),e(55751),e(26200),e(25754),e(22246),e(44201),e(36810),e(14953),e(58402),e(31503),e(16440),e(2213),e(57385),e(71375),e(15524),e(20267),e(52805),e(48136);class m{constructor(t,r){this.pixels=t,this.opts=r;const{sigBits:e}=r,i=(t,r,i)=>(t<<2*e)+(r<<e)+i;this.getColorIndex=i;const n=8-e,s=new Uint32Array(1<<3*e);let a,o,l,c,m,d,h,u,g,p;a=l=m=0,o=c=d=Number.MAX_VALUE;const f=t.length/4;let b=0;for(;b<f;){const r=4*b;if(b++,h=t[r+0],u=t[r+1],g=t[r+2],p=t[r+3],0===p)continue;h>>=n,u>>=n,g>>=n;const e=i(h,u,g);void 0===s[e]&&(s[e]=0),s[e]+=1,h>a&&(a=h),h<o&&(o=h),u>l&&(l=u),u<c&&(c=u),g>m&&(m=g),g<d&&(d=g)}this._colorCount=s.reduce(((t,r)=>r>0?t+1:t),0),this.hist=s,this.rmax=a,this.rmin=o,this.gmax=l,this.gmin=c,this.bmax=m,this.bmin=d}get colorCount(){return this._colorCount}}class d{constructor(t,r,e,i,n,s,a){this.histogram=a,this._volume=-1,this._avg=null,this._count=-1,this.dimension={r1:t,r2:r,g1:e,g2:i,b1:n,b2:s}}static build(t){const r=new m(t,{sigBits:5}),{rmin:e,rmax:i,gmin:n,gmax:s,bmin:a,bmax:o}=r;return new d(e,i,n,s,a,o,r)}invalidate(){this._volume=this._count=-1,this._avg=null}volume(){if(this._volume<0){const{r1:t,r2:r,g1:e,g2:i,b1:n,b2:s}=this.dimension;this._volume=(r-t+1)*(i-e+1)*(s-n+1)}return this._volume}count(){if(this._count<0){const{hist:t,getColorIndex:r}=this.histogram,{r1:e,r2:i,g1:n,g2:s,b1:a,b2:o}=this.dimension;let l=0;for(let c=e;c<=i;c++)for(let e=n;e<=s;e++)for(let i=a;i<=o;i++){const n=r(c,e,i);t[n]&&(l+=t[n])}this._count=l}return this._count}clone(){const{histogram:t}=this,{r1:r,r2:e,g1:i,g2:n,b1:s,b2:a}=this.dimension;return new d(r,e,i,n,s,a,t)}avg(){if(!this._avg){const{hist:t,getColorIndex:r}=this.histogram,{r1:e,r2:i,g1:n,g2:s,b1:a,b2:o}=this.dimension;let l=0;const c=8;let m,d,h;m=d=h=0;for(let u=e;u<=i;u++)for(let e=n;e<=s;e++)for(let i=a;i<=o;i++){const n=t[r(u,e,i)];n&&(l+=n,m+=n*(u+.5)*c,d+=n*(e+.5)*c,h+=n*(i+.5)*c)}this._avg=l?[~~(m/l),~~(d/l),~~(h/l)]:[~~(c*(e+i+1)/2),~~(c*(n+s+1)/2),~~(c*(a+o+1)/2)]}return this._avg}contains(t){let[r,e,i]=t;const{r1:n,r2:s,g1:a,g2:o,b1:l,b2:c}=this.dimension;return r>>=3,e>>=3,i>>=3,r>=n&&r<=s&&e>=a&&e<=o&&i>=l&&i<=c}split(){const{hist:t,getColorIndex:r}=this.histogram,{r1:e,r2:i,g1:n,g2:s,b1:a,b2:o}=this.dimension,l=this.count();if(!l)return[];if(1===l)return[this.clone()];const c=i-e+1,m=s-n+1,d=o-a+1,h=Math.max(c,m,d);let u,g,p=null;u=g=0;let f=null;if(h===c){f="r",p=new Uint32Array(i+1);for(let l=e;l<=i;l++){u=0;for(let e=n;e<=s;e++)for(let i=a;i<=o;i++){const n=r(l,e,i);t[n]&&(u+=t[n])}g+=u,p[l]=g}}else if(h===m){f="g",p=new Uint32Array(s+1);for(let l=n;l<=s;l++){u=0;for(let n=e;n<=i;n++)for(let e=a;e<=o;e++){const i=r(n,l,e);t[i]&&(u+=t[i])}g+=u,p[l]=g}}else{f="b",p=new Uint32Array(o+1);for(let l=a;l<=o;l++){u=0;for(let a=e;a<=i;a++)for(let e=n;e<=s;e++){const i=r(a,e,l);t[i]&&(u+=t[i])}g+=u,p[l]=g}}let b=-1;const _=new Uint32Array(p.length);for(let v=0;v<p.length;v++){const t=p[v];t&&(b<0&&t>g/2&&(b=v),_[v]=g-t)}const y=this;return function(t){const r=t+"1",e=t+"2",i=y.dimension[r];let n=y.dimension[e];const s=y.clone(),a=y.clone(),o=b-i,l=n-b;for(o<=l?(n=Math.min(n-1,~~(b+l/2)),n=Math.max(0,n)):(n=Math.max(i,~~(b-1-o/2)),n=Math.min(y.dimension[e],n));!p[n];)n++;let c=_[n];for(;!c&&p[n-1];)c=_[--n];return s.dimension[e]=n,a.dimension[r]=n+1,[s,a]}(f)}}e(61893),e(70104);class h{_sort(){this._sorted||(this.contents.sort(this._comparator),this._sorted=!0)}constructor(t){this._comparator=t,this.contents=[],this._sorted=!1}push(t){this.contents.push(t),this._sorted=!1}peek(t){return this._sort(),t="number"==typeof t?t:this.contents.length-1,this.contents[t]}pop(){return this._sort(),this.contents.pop()}size(){return this.contents.length}map(t){return this._sort(),this.contents.map(t)}}function u(t,r){let e=t.size();for(;t.size()<r;){const r=t.pop();if(!(r&&r.count()>0))break;{const[i,n]=r.split();if(!i)break;if(t.push(i),n&&n.count()>0&&t.push(n),t.size()===e)break;e=t.size()}}}e(19423);const g={targetDarkLuma:.26,maxDarkLuma:.45,minLightLuma:.55,targetLightLuma:.74,minNormalLuma:.3,targetNormalLuma:.5,maxNormalLuma:.7,targetMutesSaturation:.3,maxMutesSaturation:.4,targetVibrantSaturation:1,minVibrantSaturation:.35,weightSaturation:3,weightLuma:6.5,weightPopulation:.5};function p(t,r,e,i,n,s,a,o,l,c){let m=null,d=0;return r.forEach((r=>{const[,h,u]=r.hsl;if(h>=o&&h<=l&&u>=n&&u<=s&&!function(t,r){return t.Vibrant===r||t.DarkVibrant===r||t.LightVibrant===r||t.Muted===r||t.DarkMuted===r||t.LightMuted===r}(t,r)){const t=function(t,r,e,i,n,s,a){function o(t,r){return 1-Math.abs(t-r)}return function(...t){let r=0,e=0;for(let i=0;i<t.length;i+=2){const n=t[i],s=t[i+1];n&&s&&(r+=n*s,e+=s)}return r/e}(o(t,r),a.weightSaturation,o(e,i),a.weightLuma,n/s,a.weightPopulation)}(h,a,u,i,r.population,e,c);(null===m||t>d)&&(m=r,d=t)}})),m}class f{constructor(t){this.pipeline=t,this._map={}}names(){return Object.keys(this._map)}has(t){return!!this._map[t]}get(t){return this._map[t]}register(t,r){return this._map[t]=r,this.pipeline}}const b=(new class{constructor(){this.filter=new f(this),this.quantizer=new f(this),this.generator=new f(this)}_buildProcessTasks({filters:t,quantizer:r,generators:e}){return 1===e.length&&"*"===e[0]&&(e=this.generator.names()),{filters:t.map((t=>i(this.filter,t))),quantizer:i(this.quantizer,r),generators:e.map((t=>i(this.generator,t)))};function i(t,r){let e,i;return"string"==typeof r?e=r:(e=r.name,i=r.options),{name:e,fn:t.get(e),options:i}}}async process(t,r){const{filters:e,quantizer:i,generators:n}=this._buildProcessTasks(r),s=await this._filterColors(e,t),a=await this._generateColors(i,s);return{colors:a,palettes:await this._generatePalettes(n,a)}}_filterColors(t,r){return Promise.resolve(function(t,r){var e;if(r.length>0){const i=t.data,n=i.length/4;let s,a,o,l,c;for(let t=0;t<n;t++){s=4*t,a=i[s+0],o=i[s+1],l=i[s+2],c=i[s+3];for(let t=0;t<r.length;t++)if(!(null==(e=r[t])?void 0:e.call(r,a,o,l,c))){i[s+3]=0;break}}}return t}(r,t.map((({fn:t})=>t))))}_generateColors(t,r){return Promise.resolve(t.fn(r.data,t.options))}async _generatePalettes(t,r){const e=await Promise.all(t.map((({fn:t,options:e})=>Promise.resolve(t(r,e)))));return Promise.resolve(e.reduce(((r,e,i)=>(r[t[i].name]=e,r)),{}))}}).filter.register("default",((t,r,e,i)=>i>=125&&!(t>250&&r>250&&e>250))).quantizer.register("mmcq",((t,r)=>{if(0===t.length||r.colorCount<2||r.colorCount>256)throw new Error("Wrong MMCQ parameters");const e=d.build(t);e.histogram.colorCount;const i=new h(((t,r)=>t.count()-r.count()));i.push(e),u(i,.75*r.colorCount);const n=new h(((t,r)=>t.count()*t.volume()-r.count()*r.volume()));return n.contents=i.contents,u(n,r.colorCount-n.size()),function(t){const r=[];for(;t.size();){const e=t.pop(),i=e.avg();r.push(new c(i,e.count()))}return r}(n)})).generator.register("default",((t,r)=>{r=Object.assign({},g,r);const e=function(t){let r=0;return t.forEach((t=>{r=Math.max(r,t.population)})),r}(t),i=function(t,r,e){const i={Vibrant:null,DarkVibrant:null,LightVibrant:null,Muted:null,DarkMuted:null,LightMuted:null};return i.Vibrant=p(i,t,r,e.targetNormalLuma,e.minNormalLuma,e.maxNormalLuma,e.targetVibrantSaturation,e.minVibrantSaturation,1,e),i.LightVibrant=p(i,t,r,e.targetLightLuma,e.minLightLuma,1,e.targetVibrantSaturation,e.minVibrantSaturation,1,e),i.DarkVibrant=p(i,t,r,e.targetDarkLuma,0,e.maxDarkLuma,e.targetVibrantSaturation,e.minVibrantSaturation,1,e),i.Muted=p(i,t,r,e.targetNormalLuma,e.minNormalLuma,e.maxNormalLuma,e.targetMutesSaturation,0,e.maxMutesSaturation,e),i.LightMuted=p(i,t,r,e.targetLightLuma,e.minLightLuma,1,e.targetMutesSaturation,0,e.maxMutesSaturation,e),i.DarkMuted=p(i,t,r,e.targetDarkLuma,0,e.maxDarkLuma,e.targetMutesSaturation,0,e.maxMutesSaturation,e),i}(t,e,r);return function(t,r,e){if(!t.Vibrant&&!t.DarkVibrant&&!t.LightVibrant){if(!t.DarkVibrant&&t.DarkMuted){let[r,i,n]=t.DarkMuted.hsl;n=e.targetDarkLuma,t.DarkVibrant=new c(l(r,i,n),0)}if(!t.LightVibrant&&t.LightMuted){let[r,i,n]=t.LightMuted.hsl;n=e.targetDarkLuma,t.DarkVibrant=new c(l(r,i,n),0)}}if(!t.Vibrant&&t.DarkVibrant){let[r,i,n]=t.DarkVibrant.hsl;n=e.targetNormalLuma,t.Vibrant=new c(l(r,i,n),0)}else if(!t.Vibrant&&t.LightVibrant){let[r,i,n]=t.LightVibrant.hsl;n=e.targetNormalLuma,t.Vibrant=new c(l(r,i,n),0)}if(!t.DarkVibrant&&t.Vibrant){let[r,i,n]=t.Vibrant.hsl;n=e.targetDarkLuma,t.DarkVibrant=new c(l(r,i,n),0)}if(!t.LightVibrant&&t.Vibrant){let[r,i,n]=t.Vibrant.hsl;n=e.targetLightLuma,t.LightVibrant=new c(l(r,i,n),0)}if(!t.Muted&&t.Vibrant){let[r,i,n]=t.Vibrant.hsl;n=e.targetMutesSaturation,t.Muted=new c(l(r,i,n),0)}if(!t.DarkMuted&&t.DarkVibrant){let[r,i,n]=t.DarkVibrant.hsl;n=e.targetMutesSaturation,t.DarkMuted=new c(l(r,i,n),0)}if(!t.LightMuted&&t.LightVibrant){let[r,i,n]=t.LightVibrant.hsl;n=e.targetMutesSaturation,t.LightMuted=new c(l(r,i,n),0)}}(i,0,r),i}));o.use(b)}}]); //# sourceMappingURL=22041.98d9291dfc5d8ec4.js.map