pretty-color-picker 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,77 @@
1
+ (function(w,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(w=typeof globalThis<"u"?globalThis:w||self,T(w.PrettyColorPicker={}))})(this,(function(w){"use strict";var _r=w=>{throw TypeError(w)};var Fn=(w,T,F)=>T.has(w)||_r("Cannot "+F);var l=(w,T,F)=>(Fn(w,T,"read from private field"),F?F.call(w):T.get(w)),z=(w,T,F)=>T.has(w)?_r("Cannot add the same private member more than once"):T instanceof WeakSet?T.add(w):T.set(w,F),m=(w,T,F,at)=>(Fn(w,T,"write to private field"),at?at.call(w,F):T.set(w,F),F),d=(w,T,F)=>(Fn(w,T,"access private method"),F);var $,y,R,U,Ce,I,Pe,Ye,j,K,q,Q,Ze,Y,He,ee,Be,G,ue,Ee,te,Z,ne,ie,fe,be,re,B,s,Tr,Lr,Sr,Xn,On,et,Dn,jn,Yn,tt,ae,Zn,Cr,nt,Bn,Pr,Wn,Hr,Er,Nr,Ir,Ht,it,Rr,qr,Fr,Xr,Et,Gn,Vn,Or,Dr,jr,Yr,Zr,Br,Wr,oe,rt,Jn,Un,we,Ie,Nt,Kn,Qn,Gr,ei,Vr,It,Rt,ti,qt,se,Jr;const T='<svg viewBox="0 0 256 256" fill="currentColor" aria-hidden="true"><path d="M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z" opacity="0.2"/><path d="M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"/></svg>',F='<svg viewBox="0 0 256 256" fill="currentColor" aria-hidden="true"><path d="M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z" opacity="0.2"/><path d="M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"/></svg>',at='@import"https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500&display=swap";:host{--pcp-width: 260px;--pcp-radius-sm: 4px;--pcp-radius: 6px;--pcp-radius-lg: 9px;--pcp-panel-padding: 9px;--pcp-section-gap: 6px;--pcp-history-cols: 8;--pcp-history-swatch-size: calc( (var(--pcp-width) - 2 * var(--pcp-panel-padding) - 7 * var(--pcp-history-gap)) / var(--pcp-history-cols) );--pcp-control-height: var(--pcp-history-swatch-size);--pcp-tab-row-height: 32px;--pcp-field-label-size: 10px;--pcp-field-label-line: 12px;--pcp-field-label-gap: 3px;--pcp-field-value-size: 11px;--pcp-field-value-line: 15px;--pcp-field-input-height: 20px;--pcp-input-panel-height: calc( var(--pcp-field-label-line) + var(--pcp-field-label-gap) + var(--pcp-field-input-height) );--pcp-input-row-padding-y: 6px;--pcp-input-row-padding-x: 7px;--pcp-alpha-col-width: 4ch;--pcp-value-col-width: minmax(0, 1fr);--pcp-swatch-code-gap: 8px;--pcp-history-gap: 6px;--pcp-checker-size: 6px;--pcp-slider-handle-height: calc(var(--pcp-control-height) * 20 / 36);--pcp-field-input-radius: var(--pcp-radius-sm);--pcp-icon-button-size: 26px;--pcp-icon-button-radius: var(--pcp-radius-sm);--pcp-title-size: 12px;--pcp-title-line: 17px;--pcp-title-weight: 600;--pcp-title-tracking: -.24px;--pcp-ease-out: cubic-bezier(.175, .885, .32, 1.1);--pcp-font: "Geist", system-ui, -apple-system, "SF Pro Display", sans-serif;--pcp-mono: "Geist Mono", ui-monospace, monospace;display:inline-block;font-family:var(--pcp-font);-webkit-font-smoothing:antialiased;color:var(--pcp-text-primary)}:host([mode="popover"]),:host([movable]){position:fixed;z-index:1000;margin:0}:host([mode="popover"]:not([open])){display:none}:host([mode="popover"]) .pcp-header,:host([movable]) .pcp-header{cursor:grab;touch-action:none}:host([mode="popover"]) .pcp-header[data-dragging=true],:host([movable]) .pcp-header[data-dragging=true]{cursor:grabbing}:host,:host([theme="dark"]){color-scheme:dark;--pcp-bg: #212121;--pcp-border: rgba(255, 255, 255, .1);--pcp-border-hover: rgba(255, 255, 255, .15);--pcp-surface: rgba(255, 255, 255, .05);--pcp-surface-hover: rgba(255, 255, 255, .1);--pcp-surface-active: rgba(255, 255, 255, .11);--pcp-tab-pill: rgba(255, 255, 255, .11);--pcp-divider: rgba(255, 255, 255, .06);--pcp-text-root: #ffffff;--pcp-text-primary: rgba(255, 255, 255, .95);--pcp-text-label: rgba(255, 255, 255, .7);--pcp-text-secondary: rgba(255, 255, 255, .6);--pcp-text-tertiary: rgba(255, 255, 255, .4);--pcp-text-focus: #ffffff;--pcp-slider-handle: rgba(255, 255, 255, .95);--pcp-checker-base: #ffffff;--pcp-checker-tone: #cccccc;--pcp-focus-ring: #47a8ff;--pcp-cursor-ring: #ffffff;--pcp-cursor-outline: rgba(0, 0, 0, .35);--pcp-elevation: 0 8px 32px rgba(0, 0, 0, .5)}:host([theme="light"]){color-scheme:light;--pcp-bg: #fafafa;--pcp-border: rgba(0, 0, 0, .1);--pcp-border-hover: rgba(0, 0, 0, .15);--pcp-surface: rgba(0, 0, 0, .04);--pcp-surface-hover: rgba(0, 0, 0, .08);--pcp-surface-active: rgba(0, 0, 0, .1);--pcp-tab-pill: rgba(0, 0, 0, .1);--pcp-divider: rgba(0, 0, 0, .06);--pcp-text-root: #000000;--pcp-text-primary: rgba(0, 0, 0, .9);--pcp-text-label: rgba(0, 0, 0, .6);--pcp-text-secondary: rgba(0, 0, 0, .55);--pcp-text-tertiary: rgba(0, 0, 0, .35);--pcp-text-focus: #000000;--pcp-slider-handle: rgba(0, 0, 0, .9);--pcp-checker-base: #ffffff;--pcp-checker-tone: #cccccc;--pcp-focus-ring: #006bff;--pcp-cursor-ring: #ffffff;--pcp-cursor-outline: rgba(0, 0, 0, .4);--pcp-elevation: 0 4px 20px rgba(0, 0, 0, .08)}@media(prefers-color-scheme:dark){:host([theme="system"]){color-scheme:dark;--pcp-bg: #212121;--pcp-border: rgba(255, 255, 255, .1);--pcp-border-hover: rgba(255, 255, 255, .15);--pcp-surface: rgba(255, 255, 255, .05);--pcp-surface-hover: rgba(255, 255, 255, .1);--pcp-surface-active: rgba(255, 255, 255, .11);--pcp-tab-pill: rgba(255, 255, 255, .11);--pcp-divider: rgba(255, 255, 255, .06);--pcp-text-root: #ffffff;--pcp-text-primary: rgba(255, 255, 255, .95);--pcp-text-label: rgba(255, 255, 255, .7);--pcp-text-secondary: rgba(255, 255, 255, .6);--pcp-text-tertiary: rgba(255, 255, 255, .4);--pcp-text-focus: #ffffff;--pcp-slider-handle: rgba(255, 255, 255, .95);--pcp-checker-base: #ffffff;--pcp-checker-tone: #cccccc;--pcp-focus-ring: #47a8ff;--pcp-cursor-ring: #ffffff;--pcp-cursor-outline: rgba(0, 0, 0, .35);--pcp-elevation: 0 8px 32px rgba(0, 0, 0, .5)}}@media(prefers-color-scheme:light){:host([theme="system"]){color-scheme:light;--pcp-bg: #fafafa;--pcp-border: rgba(0, 0, 0, .1);--pcp-border-hover: rgba(0, 0, 0, .15);--pcp-surface: rgba(0, 0, 0, .04);--pcp-surface-hover: rgba(0, 0, 0, .08);--pcp-surface-active: rgba(0, 0, 0, .1);--pcp-tab-pill: rgba(0, 0, 0, .1);--pcp-divider: rgba(0, 0, 0, .06);--pcp-text-root: #000000;--pcp-text-primary: rgba(0, 0, 0, .9);--pcp-text-label: rgba(0, 0, 0, .6);--pcp-text-secondary: rgba(0, 0, 0, .55);--pcp-text-tertiary: rgba(0, 0, 0, .35);--pcp-text-focus: #000000;--pcp-slider-handle: rgba(0, 0, 0, .9);--pcp-checker-base: #ffffff;--pcp-checker-tone: #cccccc;--pcp-focus-ring: #006bff;--pcp-cursor-ring: #ffffff;--pcp-cursor-outline: rgba(0, 0, 0, .4);--pcp-elevation: 0 4px 20px rgba(0, 0, 0, .08)}}*,*:before,*:after{box-sizing:border-box}.pcp-clip{overflow:hidden;border-radius:var(--pcp-clip-radius, var(--pcp-radius-sm))}.pcp-swatch-fill{display:block;box-sizing:border-box;width:calc(100% + 2px);height:calc(100% + 2px);margin:-1px;border-radius:inherit;background-color:var(--pcp-checker-base);background-image:linear-gradient(to right,var(--swatch-solid, #000) 50%,transparent 50%),linear-gradient(to right,transparent 50%,var(--swatch-alpha, rgba(0, 0, 0, .5)) 50%),linear-gradient(45deg,var(--pcp-checker-tone) 25%,transparent 25%),linear-gradient(-45deg,var(--pcp-checker-tone) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,var(--pcp-checker-tone) 75%),linear-gradient(-45deg,transparent 75%,var(--pcp-checker-tone) 75%);background-size:100% 100%,100% 100%,var(--pcp-checker-size) var(--pcp-checker-size),var(--pcp-checker-size) var(--pcp-checker-size),var(--pcp-checker-size) var(--pcp-checker-size),var(--pcp-checker-size) var(--pcp-checker-size);background-position:0 0,0 0,0 0,0 calc(var(--pcp-checker-size) / 2),calc(var(--pcp-checker-size) / 2) calc(var(--pcp-checker-size) / -2),calc(var(--pcp-checker-size) / -2) 0}@supports (background: -webkit-named-image(i)){.pcp-clip,.pcp-swatch-fill{clip-path:inset(0 round var(--pcp-clip-radius, var(--pcp-radius-sm)))}}.pcp{display:flex;flex-direction:column;gap:var(--pcp-section-gap);width:var(--pcp-width);background:var(--pcp-bg);border:1px solid var(--pcp-border);border-radius:var(--pcp-radius-lg);box-shadow:var(--pcp-elevation);padding:var(--pcp-panel-padding);-webkit-user-select:none;user-select:none}.pcp-header{display:flex;align-items:center;justify-content:space-between;gap:6px;padding-bottom:4px;margin-bottom:0;min-height:var(--pcp-icon-button-size);border-bottom:1px solid var(--pcp-divider)}.pcp-title{flex:1;min-width:0;font-family:var(--pcp-font);font-size:var(--pcp-title-size);font-weight:var(--pcp-title-weight);line-height:var(--pcp-title-line);letter-spacing:var(--pcp-title-tracking);color:var(--pcp-text-root);margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.pcp-header-btn{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:var(--pcp-icon-button-size);height:var(--pcp-icon-button-size);padding:0;border:none;border-radius:var(--pcp-icon-button-radius);background:transparent;color:var(--pcp-text-focus);cursor:pointer;transition:background .15s var(--pcp-ease-out),color .15s var(--pcp-ease-out),transform .16s var(--pcp-ease-out)}.pcp-header-btn svg{width:13px;height:13px;flex-shrink:0}@media(hover:hover)and (pointer:fine){.pcp-header-btn:hover{background:var(--pcp-surface-hover);color:var(--pcp-text-primary)}}.pcp-header-btn:active{background:var(--pcp-surface-active);transform:scale(.97)}.pcp-header-btn:focus{outline:none}.pcp-header-btn:focus-visible{box-shadow:0 0 0 2px var(--pcp-bg),0 0 0 4px var(--pcp-focus-ring)}.pcp-plane-wrap{position:relative;width:100%;aspect-ratio:4 / 3;--pcp-clip-radius: var(--pcp-radius-sm);margin-bottom:0;cursor:crosshair;touch-action:none}.pcp-plane{display:block;width:100%;height:100%}.pcp-cursor{position:absolute;width:13px;height:13px;margin:-6.5px 0 0 -6.5px;border:2px solid var(--pcp-cursor-ring);border-radius:50%;box-shadow:0 0 0 1px var(--pcp-cursor-outline),inset 0 0 0 1px #0000001f;pointer-events:none}.pcp-cursor[data-dragging=true]{transition:none}.pcp-slider-wrapper{position:relative;height:var(--pcp-control-height);margin-bottom:0}.pcp-slider{position:absolute;top:0;right:0;bottom:0;left:0;cursor:pointer;-webkit-user-select:none;user-select:none;--pcp-clip-radius: var(--pcp-radius-sm);background:transparent;touch-action:none}.pcp-slider-fill{position:absolute;top:0;right:0;bottom:0;left:0;border-radius:inherit;pointer-events:none}.pcp-slider-fill-hue{background:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red)}.pcp-slider-fill-alpha{--pcp-alpha-gradient: linear-gradient(to right, rgba(0, 0, 0, 0), rgb(0, 0, 0));background-color:var(--pcp-checker-base);background-image:var(--pcp-alpha-gradient),linear-gradient(45deg,var(--pcp-checker-tone) 25%,transparent 25%),linear-gradient(-45deg,var(--pcp-checker-tone) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,var(--pcp-checker-tone) 75%),linear-gradient(-45deg,transparent 75%,var(--pcp-checker-tone) 75%);background-size:100% 100%,var(--pcp-checker-size) var(--pcp-checker-size),var(--pcp-checker-size) var(--pcp-checker-size),var(--pcp-checker-size) var(--pcp-checker-size),var(--pcp-checker-size) var(--pcp-checker-size);background-position:0 0,0 0,0 calc(var(--pcp-checker-size) / 2),calc(var(--pcp-checker-size) / 2) calc(var(--pcp-checker-size) / -2),calc(var(--pcp-checker-size) / -2) 0}.pcp-slider-handle{position:absolute;top:50%;left:0;z-index:1;width:3px;height:var(--pcp-slider-handle-height);border:none;outline:none;border-radius:999px;background-color:transparent;pointer-events:none;transform:translateY(-50%);opacity:.68;box-shadow:none;filter:none;transition:opacity .15s ease,background-color .12s ease,box-shadow .12s ease}.pcp-slider:hover .pcp-slider-handle,.pcp-slider[data-active=true] .pcp-slider-handle{opacity:.68}.pcp-slider-handle[data-dragging=true]{opacity:.95}.pcp-tabs{position:relative;display:flex;align-items:center;height:var(--pcp-tab-row-height);box-sizing:border-box;padding:2px;margin-bottom:0;background:transparent;border-radius:var(--pcp-radius)}.pcp-tabs-pill{position:absolute;top:2px;bottom:2px;left:0;width:0;background:var(--pcp-tab-pill);border-radius:5px;z-index:0;pointer-events:none;transition:left .2s var(--pcp-ease-out),width .2s var(--pcp-ease-out)}.pcp-tab{position:relative;z-index:1;flex:1;display:flex;align-items:center;justify-content:center;height:100%;padding:0 4px;font-family:inherit;font-size:11px;font-weight:500;line-height:1;text-align:center;background:transparent;border:none;color:var(--pcp-text-label);cursor:pointer;transition:color .15s var(--pcp-ease-out),transform .16s var(--pcp-ease-out)}.pcp-tab[data-active=true]{color:var(--pcp-text-primary)}.pcp-tab:active{transform:scale(.97)}.pcp-inputs{display:grid;width:100%;min-width:0;box-sizing:border-box;overflow:hidden;grid-template-columns:var(--pcp-input-panel-height) var(--pcp-swatch-code-gap) var(--pcp-value-col-width) var(--pcp-value-col-width) var(--pcp-value-col-width) var(--pcp-alpha-col-width);column-gap:3px;align-items:center;margin-bottom:0;padding:var(--pcp-input-row-padding-y) var(--pcp-input-row-padding-x);background:var(--pcp-surface);border-radius:var(--pcp-radius-sm)}.pcp-swatch{grid-column:1;flex-shrink:0;width:var(--pcp-input-panel-height);height:var(--pcp-input-panel-height);--pcp-clip-radius: var(--pcp-radius-sm);position:relative}.pcp-fields{grid-column:3 / 6;display:grid;min-width:0;grid-template-columns:repeat(3,minmax(0,1fr));column-gap:3px}.pcp-fields[data-format=hex] .pcp-field-hex{grid-column:1 / -1;justify-self:center;width:fit-content;align-items:center}.pcp-fields[data-format=hex] .pcp-field-label{text-align:center;white-space:nowrap}.pcp-fields[data-format=hex] .pcp-field-input{width:8ch;min-width:8ch;padding:0 4px}.pcp-fields[data-format=rgb] .pcp-field-r{grid-column:1}.pcp-fields[data-format=rgb] .pcp-field-g{grid-column:2}.pcp-fields[data-format=rgb] .pcp-field-b{grid-column:3}.pcp-fields[data-format=hsl] .pcp-field-h{grid-column:1}.pcp-fields[data-format=hsl] .pcp-field-s{grid-column:2}.pcp-fields[data-format=hsl] .pcp-field-l{grid-column:3}.pcp-fields[data-format=oklch] .pcp-field-l{grid-column:1}.pcp-fields[data-format=oklch] .pcp-field-c{grid-column:2}.pcp-fields[data-format=oklch] .pcp-field-h{grid-column:3}.pcp-alpha-field{grid-column:6;box-sizing:border-box;width:var(--pcp-alpha-col-width);min-width:var(--pcp-alpha-col-width);max-width:var(--pcp-alpha-col-width);align-items:center}.pcp-alpha-field .pcp-field-input{width:100%;min-width:0;padding:0;box-sizing:border-box}.pcp-field{min-width:0;display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:var(--pcp-field-label-gap)}.pcp-fields[data-format=oklch] .pcp-field-c .pcp-field-input{letter-spacing:-.02em;padding:0 1px}.pcp-field-label{display:block;font-size:var(--pcp-field-label-size);font-weight:500;line-height:var(--pcp-field-label-line);color:var(--pcp-text-label);margin:0;text-align:center}.pcp-fields:not([data-format=hex]) .pcp-field-label,.pcp-alpha-field .pcp-field-label{cursor:ew-resize;-webkit-user-select:none;user-select:none;touch-action:none;transition:color .15s var(--pcp-ease-out)}.pcp-field-label[data-scrubbing=true]{color:var(--pcp-text-primary)}.pcp-field-input{width:100%;min-width:0;min-height:var(--pcp-field-input-height);height:var(--pcp-field-input-height);padding:0 2px;font-family:var(--pcp-mono);font-size:var(--pcp-field-value-size);font-weight:500;line-height:var(--pcp-field-input-height);font-variant-numeric:tabular-nums;text-align:center;color:var(--pcp-text-secondary);background:transparent;border:none;border-radius:var(--pcp-field-input-radius);outline:none;box-shadow:none;transition:color .15s var(--pcp-ease-out),background .15s var(--pcp-ease-out)}@media(hover:hover)and (pointer:fine){.pcp-field-input:hover{background:var(--pcp-surface-hover)}}.pcp-field-input:focus{color:var(--pcp-text-focus);background:transparent;border-radius:var(--pcp-field-input-radius);box-shadow:none;outline:none}.pcp-field-input:active{background:var(--pcp-surface-active)}.pcp-history-section[hidden]{display:none}.pcp-history-label{font-size:10px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--pcp-text-label);margin:0 0 5px}.pcp-history{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:var(--pcp-history-gap);width:100%}.pcp-history-swatch{-moz-appearance:none;appearance:none;-webkit-appearance:none;display:block;width:100%;aspect-ratio:1;height:auto;flex-shrink:0;padding:0;border:none;background:none;--pcp-clip-radius: 4px;cursor:pointer;transition:opacity .15s var(--pcp-ease-out)}@media(hover:hover)and (pointer:fine){.pcp-history-swatch:hover{opacity:.85}}.pcp-history-swatch:active{opacity:.7}@media(prefers-reduced-motion:reduce){.pcp-header-btn,.pcp-tab,.pcp-tabs-pill,.pcp-cursor,.pcp-slider-handle,.pcp-history-swatch{transition:none}.pcp-tab:active,.pcp-header-btn:active{transform:none}}',ni=(e,n)=>{if(typeof e=="number"){if(n===3)return{mode:"rgb",r:(e>>8&15|e>>4&240)/255,g:(e>>4&15|e&240)/255,b:(e&15|e<<4&240)/255};if(n===4)return{mode:"rgb",r:(e>>12&15|e>>8&240)/255,g:(e>>8&15|e>>4&240)/255,b:(e>>4&15|e&240)/255,alpha:(e&15|e<<4&240)/255};if(n===6)return{mode:"rgb",r:(e>>16&255)/255,g:(e>>8&255)/255,b:(e&255)/255};if(n===8)return{mode:"rgb",r:(e>>24&255)/255,g:(e>>16&255)/255,b:(e>>8&255)/255,alpha:(e&255)/255}}},Ur={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Kr=e=>ni(Ur[e.toLowerCase()],6),Qr=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,ea=e=>{let n;return(n=e.match(Qr))?ni(parseInt(n[1],16),n[1].length):void 0},le="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",Re=`${le}%`,Ft=`(?:${le}%|${le})`,ta=`(?:${le}(deg|grad|rad|turn)|${le})`,ke="\\s*,\\s*",na=new RegExp(`^rgba?\\(\\s*${le}${ke}${le}${ke}${le}\\s*(?:,\\s*${Ft}\\s*)?\\)$`),ia=new RegExp(`^rgba?\\(\\s*${Re}${ke}${Re}${ke}${Re}\\s*(?:,\\s*${Ft}\\s*)?\\)$`),ra=e=>{let n={mode:"rgb"},t;if(t=e.match(na))t[1]!==void 0&&(n.r=t[1]/255),t[2]!==void 0&&(n.g=t[2]/255),t[3]!==void 0&&(n.b=t[3]/255);else if(t=e.match(ia))t[1]!==void 0&&(n.r=t[1]/100),t[2]!==void 0&&(n.g=t[2]/100),t[3]!==void 0&&(n.b=t[3]/100);else return;return t[4]!==void 0?n.alpha=Math.max(0,Math.min(1,t[4]/100)):t[5]!==void 0&&(n.alpha=Math.max(0,Math.min(1,+t[5]))),n},ot=(e,n)=>e===void 0?void 0:typeof e!="object"?oi(e):e.mode!==void 0?e:n?{...e,mode:n}:void 0,O=(e="rgb")=>n=>(n=ot(n,e))!==void 0?n.mode===e?n:W[n.mode][e]?W[n.mode][e](n):e==="rgb"?W[n.mode].rgb(n):W.rgb[e](W[n.mode].rgb(n)):void 0,W={},ii={},st=[],ri={},aa=e=>e,k=e=>(W[e.mode]={...W[e.mode],...e.toMode},Object.keys(e.fromMode||{}).forEach(n=>{W[n]||(W[n]={}),W[n][e.mode]=e.fromMode[n]}),e.ranges||(e.ranges={}),e.difference||(e.difference={}),e.channels.forEach(n=>{if(e.ranges[n]===void 0&&(e.ranges[n]=[0,1]),!e.interpolate[n])throw new Error(`Missing interpolator for: ${n}`);typeof e.interpolate[n]=="function"&&(e.interpolate[n]={use:e.interpolate[n]}),e.interpolate[n].fixup||(e.interpolate[n].fixup=aa)}),ii[e.mode]=e,(e.parse||[]).forEach(n=>{oa(n,e.mode)}),O(e.mode)),lt=e=>ii[e],oa=(e,n)=>{if(typeof e=="string"){if(!n)throw new Error("'mode' required when 'parser' is a string");ri[e]=n}else typeof e=="function"&&st.indexOf(e)<0&&st.push(e)},Xt=/[^\x00-\x7F]|[a-zA-Z_]/,sa=/[^\x00-\x7F]|[-\w]/,h={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"};let g=0;function ct(e){let n=e[g],t=e[g+1];return n==="-"||n==="+"?/\d/.test(t)||t==="."&&/\d/.test(e[g+2]):n==="."?/\d/.test(t):/\d/.test(n)}function Ot(e){if(g>=e.length)return!1;let n=e[g];if(Xt.test(n))return!0;if(n==="-"){if(e.length-g<2)return!1;let t=e[g+1];return!!(t==="-"||Xt.test(t))}return!1}const la={deg:1,rad:180/Math.PI,grad:9/10,turn:360};function qe(e){let n="";if((e[g]==="-"||e[g]==="+")&&(n+=e[g++]),n+=dt(e),e[g]==="."&&/\d/.test(e[g+1])&&(n+=e[g++]+dt(e)),(e[g]==="e"||e[g]==="E")&&((e[g+1]==="-"||e[g+1]==="+")&&/\d/.test(e[g+2])?n+=e[g++]+e[g++]+dt(e):/\d/.test(e[g+1])&&(n+=e[g++]+dt(e))),Ot(e)){let t=pt(e);return t==="deg"||t==="rad"||t==="turn"||t==="grad"?{type:h.Hue,value:n*la[t]}:void 0}return e[g]==="%"?(g++,{type:h.Percentage,value:+n}):{type:h.Number,value:+n}}function dt(e){let n="";for(;/\d/.test(e[g]);)n+=e[g++];return n}function pt(e){let n="";for(;g<e.length&&sa.test(e[g]);)n+=e[g++];return n}function ca(e){let n=pt(e);return e[g]==="("?(g++,{type:h.Function,value:n}):n==="none"?{type:h.None,value:void 0}:{type:h.Ident,value:n}}function da(e=""){let n=e.trim(),t=[],i;for(g=0;g<n.length;){if(i=n[g++],i===`
2
+ `||i===" "||i===" "){for(;g<n.length&&(n[g]===`
3
+ `||n[g]===" "||n[g]===" ");)g++;continue}if(i===",")return;if(i===")"){t.push({type:h.ParenClose});continue}if(i==="+"){if(g--,ct(n)){t.push(qe(n));continue}return}if(i==="-"){if(g--,ct(n)){t.push(qe(n));continue}if(Ot(n)){t.push({type:h.Ident,value:pt(n)});continue}return}if(i==="."){if(g--,ct(n)){t.push(qe(n));continue}return}if(i==="/"){for(;g<n.length&&(n[g]===`
4
+ `||n[g]===" "||n[g]===" ");)g++;let r;if(ct(n)&&(r=qe(n),r.type!==h.Hue)){t.push({type:h.Alpha,value:r});continue}if(Ot(n)&&pt(n)==="none"){t.push({type:h.Alpha,value:{type:h.None,value:void 0}});continue}return}if(/\d/.test(i)){g--,t.push(qe(n));continue}if(Xt.test(i)){g--,t.push(ca(n));continue}return}return t}function pa(e){e._i=0;let n=e[e._i++];if(!n||n.type!==h.Function||n.value!=="color"||(n=e[e._i++],n.type!==h.Ident))return;const t=ri[n.value];if(!t)return;const i={mode:t},r=ai(e,!1);if(!r)return;const a=lt(t).channels;for(let o=0,c,p;o<a.length;o++)c=r[o],p=a[o],c.type!==h.None&&(i[p]=c.type===h.Number?c.value:c.value/100,p==="alpha"&&(i[p]=Math.max(0,Math.min(1,i[p]))));return i}function ai(e,n){const t=[];let i;for(;e._i<e.length;){if(i=e[e._i++],i.type===h.None||i.type===h.Number||i.type===h.Alpha||i.type===h.Percentage||n&&i.type===h.Hue){t.push(i);continue}if(i.type===h.ParenClose){if(e._i<e.length)return;continue}return}if(!(t.length<3||t.length>4)){if(t.length===4){if(t[3].type!==h.Alpha)return;t[3]=t[3].value}return t.length===3&&t.push({type:h.None,value:void 0}),t.every(r=>r.type!==h.Alpha)?t:void 0}}function ha(e,n){e._i=0;let t=e[e._i++];if(!t||t.type!==h.Function)return;let i=ai(e,n);if(i)return i.unshift(t.value),i}const oi=e=>{if(typeof e!="string")return;const n=da(e),t=n?ha(n,!0):void 0;let i,r=0,a=st.length;for(;r<a;)if((i=st[r++](e,t))!==void 0)return i;return n?pa(n):void 0};function ua(e,n){if(!n||n[0]!=="rgb"&&n[0]!=="rgba")return;const t={mode:"rgb"},[,i,r,a,o]=n;if(!(i.type===h.Hue||r.type===h.Hue||a.type===h.Hue))return i.type!==h.None&&(t.r=i.type===h.Number?i.value/255:i.value/100),r.type!==h.None&&(t.g=r.type===h.Number?r.value/255:r.value/100),a.type!==h.None&&(t.b=a.type===h.Number?a.value/255:a.value/100),o.type!==h.None&&(t.alpha=Math.min(1,Math.max(0,o.type===h.Number?o.value:o.value/100))),t}const fa=e=>e==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,ba=(e,n,t)=>e+t*(n-e),ga=e=>{let n=[];for(let t=0;t<e.length-1;t++){let i=e[t],r=e[t+1];i===void 0&&r===void 0?n.push(void 0):i!==void 0&&r!==void 0?n.push([i,r]):n.push(i!==void 0?[i,i]:[r,r])}return n},u=(e=>n=>{let t=ga(n);return i=>{let r=i*t.length,a=i>=1?t.length-1:Math.max(Math.floor(r),0),o=t[a];return o===void 0?void 0:e(o[0],o[1],r-a)}})(ba),P=e=>{let n=!1,t=e.map(i=>i!==void 0?(n=!0,i):1);return n?t:e},ze={mode:"rgb",channels:["r","g","b","alpha"],parse:[ua,ea,ra,Kr,fa,"srgb"],serialize:"srgb",interpolate:{r:u,g:u,b:u,alpha:{use:u,fixup:P}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},Dt=(e=0)=>Math.pow(Math.abs(e),563/256)*Math.sign(e),si=e=>{let n=Dt(e.r),t=Dt(e.g),i=Dt(e.b),r={mode:"xyz65",x:.5766690429101305*n+.1855582379065463*t+.1882286462349947*i,y:.297344975250536*n+.6273635662554661*t+.0752914584939979*i,z:.0270313613864123*n+.0706888525358272*t+.9913375368376386*i};return e.alpha!==void 0&&(r.alpha=e.alpha),r},jt=e=>Math.pow(Math.abs(e),256/563)*Math.sign(e),li=({x:e,y:n,z:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r={mode:"a98",r:jt(e*2.0415879038107465-n*.5650069742788597-.3447313507783297*t),g:jt(e*-.9692436362808798+n*1.8759675015077206+.0415550574071756*t),b:jt(e*.0134442806320312-n*.1183623922310184+1.0151749943912058*t)};return i!==void 0&&(r.alpha=i),r},Yt=(e=0)=>{const n=Math.abs(e);return n<=.04045?e/12.92:(Math.sign(e)||1)*Math.pow((n+.055)/1.055,2.4)},$e=({r:e,g:n,b:t,alpha:i})=>{let r={mode:"lrgb",r:Yt(e),g:Yt(n),b:Yt(t)};return i!==void 0&&(r.alpha=i),r},me=e=>{let{r:n,g:t,b:i,alpha:r}=$e(e),a={mode:"xyz65",x:.4123907992659593*n+.357584339383878*t+.1804807884018343*i,y:.2126390058715102*n+.715168678767756*t+.0721923153607337*i,z:.0193308187155918*n+.119194779794626*t+.9505321522496607*i};return r!==void 0&&(a.alpha=r),a},Zt=(e=0)=>{const n=Math.abs(e);return n>.0031308?(Math.sign(e)||1)*(1.055*Math.pow(n,1/2.4)-.055):e*12.92},Ae=({r:e,g:n,b:t,alpha:i},r="rgb")=>{let a={mode:r,r:Zt(e),g:Zt(n),b:Zt(t)};return i!==void 0&&(a.alpha=i),a},ve=({x:e,y:n,z:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Ae({r:e*3.2409699419045226-n*1.537383177570094-.4986107602930034*t,g:e*-.9692436362808796+n*1.8759675015077204+.0415550574071756*t,b:e*.0556300796969936-n*.2039769588889765+1.0569715142428784*t});return i!==void 0&&(r.alpha=i),r},ma={...ze,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:e=>li(me(e)),xyz65:li},toMode:{rgb:e=>ve(si(e)),xyz65:si}},N=e=>(e=e%360)<0?e+360:e,va=(e,n)=>e.map((t,i,r)=>{if(t===void 0)return t;let a=N(t);return i===0||e[i-1]===void 0?a:n(a-N(r[i-1]))}).reduce((t,i)=>!t.length||i===void 0||t[t.length-1]===void 0?(t.push(i),t):(t.push(i+t[t.length-1]),t),[]),V=e=>va(e,n=>Math.abs(n)<=180?n:n-360*Math.sign(n)),E=[-.14861,1.78277,-.29227,-.90649,1.97294,0],xa=Math.PI/180,ya=180/Math.PI;let ci=E[3]*E[4],di=E[1]*E[4],pi=E[1]*E[2]-E[0]*E[3];const Ma=({r:e,g:n,b:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=(pi*t+e*ci-n*di)/(pi+ci-di),a=t-r,o=(E[4]*(n-r)-E[2]*a)/E[3],c={mode:"cubehelix",l:r,s:r===0||r===1?void 0:Math.sqrt(a*a+o*o)/(E[4]*r*(1-r))};return c.s&&(c.h=Math.atan2(o,a)*ya-120),i!==void 0&&(c.alpha=i),c},wa=({h:e,s:n,l:t,alpha:i})=>{let r={mode:"rgb"};e=(e===void 0?0:e+120)*xa,t===void 0&&(t=0);let a=n===void 0?0:n*t*(1-t),o=Math.cos(e),c=Math.sin(e);return r.r=t+a*(E[0]*o+E[1]*c),r.g=t+a*(E[2]*o+E[3]*c),r.b=t+a*(E[4]*o+E[5]*c),i!==void 0&&(r.alpha=i),r},ht=(e,n)=>{if(e.h===void 0||n.h===void 0||!e.s||!n.s)return 0;let t=N(e.h),i=N(n.h),r=Math.sin((i-t+360)/2*Math.PI/180);return 2*Math.sqrt(e.s*n.s)*r},ka=(e,n)=>{if(e.h===void 0||n.h===void 0)return 0;let t=N(e.h),i=N(n.h);return Math.abs(i-t)>180?t-(i-360*Math.sign(i-t)):i-t},ut=(e,n)=>{if(e.h===void 0||n.h===void 0||!e.c||!n.c)return 0;let t=N(e.h),i=N(n.h),r=Math.sin((i-t+360)/2*Math.PI/180);return 2*Math.sqrt(e.c*n.c)*r},J=e=>{let n=e.reduce((i,r)=>{if(r!==void 0){let a=r*Math.PI/180;i.sin+=Math.sin(a),i.cos+=Math.cos(a)}return i},{sin:0,cos:0}),t=Math.atan2(n.sin,n.cos)*180/Math.PI;return t<0?360+t:t},za={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:Ma},toMode:{rgb:wa},interpolate:{h:{use:u,fixup:V},s:u,l:u,alpha:{use:u,fixup:P}},difference:{h:ht},average:{h:J}},ce=({l:e,a:n,b:t,alpha:i},r="lch")=>{n===void 0&&(n=0),t===void 0&&(t=0);let a=Math.sqrt(n*n+t*t),o={mode:r,l:e,c:a};return a&&(o.h=N(Math.atan2(t,n)*180/Math.PI)),i!==void 0&&(o.alpha=i),o},de=({l:e,c:n,h:t,alpha:i},r="lab")=>{t===void 0&&(t=0);let a={mode:r,l:e,a:n?n*Math.cos(t/180*Math.PI):0,b:n?n*Math.sin(t/180*Math.PI):0};return i!==void 0&&(a.alpha=i),a},hi=Math.pow(29,3)/Math.pow(3,3),ui=Math.pow(6,3)/Math.pow(29,3),L={X:.3457/.3585,Y:1,Z:(1-.3457-.3585)/.3585},_e={X:.3127/.329,Y:1,Z:(1-.3127-.329)/.329};let Bt=e=>Math.pow(e,3)>ui?Math.pow(e,3):(116*e-16)/hi;const fi=({l:e,a:n,b:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=(e+16)/116,a=n/500+r,o=r-t/200,c={mode:"xyz65",x:Bt(a)*_e.X,y:Bt(r)*_e.Y,z:Bt(o)*_e.Z};return i!==void 0&&(c.alpha=i),c},ft=e=>ve(fi(e)),Wt=e=>e>ui?Math.cbrt(e):(hi*e+16)/116,bi=({x:e,y:n,z:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Wt(e/_e.X),a=Wt(n/_e.Y),o=Wt(t/_e.Z),c={mode:"lab65",l:116*a-16,a:500*(r-a),b:200*(a-o)};return i!==void 0&&(c.alpha=i),c},bt=e=>{let n=bi(me(e));return e.r===e.b&&e.b===e.g&&(n.a=n.b=0),n},gt=1,gi=1,Fe=26/180*Math.PI,mt=Math.cos(Fe),vt=Math.sin(Fe),mi=100/Math.log(139/100),Gt=({l:e,c:n,h:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r={mode:"lab65",l:(Math.exp(e*gt/mi)-1)/.0039},a=(Math.exp(.0435*n*gi*gt)-1)/.075,o=a*Math.cos(t/180*Math.PI-Fe),c=a*Math.sin(t/180*Math.PI-Fe);return r.a=o*mt-c/.83*vt,r.b=o*vt+c/.83*mt,i!==void 0&&(r.alpha=i),r},Vt=({l:e,a:n,b:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=n*mt+t*vt,a=.83*(t*mt-n*vt),o=Math.sqrt(r*r+a*a),c={mode:"dlch",l:mi/gt*Math.log(1+.0039*e),c:Math.log(1+.075*o)/(.0435*gi*gt)};return c.c&&(c.h=N((Math.atan2(a,r)+Fe)/Math.PI*180)),i!==void 0&&(c.alpha=i),c},vi=e=>Gt(ce(e,"dlch")),xi=e=>de(Vt(e),"dlab"),$a={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:vi,rgb:e=>ft(vi(e))},fromMode:{lab65:xi,rgb:e=>xi(bt(e))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:u,a:u,b:u,alpha:{use:u,fixup:P}}},Aa={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:Gt,dlab:e=>de(e,"dlab"),rgb:e=>ft(Gt(e))},fromMode:{lab65:Vt,dlab:e=>ce(e,"dlch"),rgb:e=>Vt(bt(e))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:u,c:u,h:{use:u,fixup:V},alpha:{use:u,fixup:P}},difference:{h:ut},average:{h:J}};function _a({h:e,s:n,i:t,alpha:i}){e=N(e!==void 0?e:0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.abs(e/60%2-1),a;switch(Math.floor(e/60)){case 0:a={r:t*(1+n*(3/(2-r)-1)),g:t*(1+n*(3*(1-r)/(2-r)-1)),b:t*(1-n)};break;case 1:a={r:t*(1+n*(3*(1-r)/(2-r)-1)),g:t*(1+n*(3/(2-r)-1)),b:t*(1-n)};break;case 2:a={r:t*(1-n),g:t*(1+n*(3/(2-r)-1)),b:t*(1+n*(3*(1-r)/(2-r)-1))};break;case 3:a={r:t*(1-n),g:t*(1+n*(3*(1-r)/(2-r)-1)),b:t*(1+n*(3/(2-r)-1))};break;case 4:a={r:t*(1+n*(3*(1-r)/(2-r)-1)),g:t*(1-n),b:t*(1+n*(3/(2-r)-1))};break;case 5:a={r:t*(1+n*(3/(2-r)-1)),g:t*(1-n),b:t*(1+n*(3*(1-r)/(2-r)-1))};break;default:a={r:t*(1-n),g:t*(1-n),b:t*(1-n)}}return a.mode="rgb",i!==void 0&&(a.alpha=i),a}function Ta({r:e,g:n,b:t,alpha:i}){e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.max(e,n,t),a=Math.min(e,n,t),o={mode:"hsi",s:e+n+t===0?0:1-3*a/(e+n+t),i:(e+n+t)/3};return r-a!==0&&(o.h=(r===e?(n-t)/(r-a)+(n<t)*6:r===n?(t-e)/(r-a)+2:(e-n)/(r-a)+4)*60),i!==void 0&&(o.alpha=i),o}const La={mode:"hsi",toMode:{rgb:_a},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:Ta},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:u,fixup:V},s:u,i:u,alpha:{use:u,fixup:P}},difference:{h:ht},average:{h:J}};function Sa({h:e,s:n,l:t,alpha:i}){e=N(e!==void 0?e:0),n===void 0&&(n=0),t===void 0&&(t=0);let r=t+n*(t<.5?t:1-t),a=r-(r-t)*2*Math.abs(e/60%2-1),o;switch(Math.floor(e/60)){case 0:o={r,g:a,b:2*t-r};break;case 1:o={r:a,g:r,b:2*t-r};break;case 2:o={r:2*t-r,g:r,b:a};break;case 3:o={r:2*t-r,g:a,b:r};break;case 4:o={r:a,g:2*t-r,b:r};break;case 5:o={r,g:2*t-r,b:a};break;default:o={r:2*t-r,g:2*t-r,b:2*t-r}}return o.mode="rgb",i!==void 0&&(o.alpha=i),o}function Ca({r:e,g:n,b:t,alpha:i}){e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.max(e,n,t),a=Math.min(e,n,t),o={mode:"hsl",s:r===a?0:(r-a)/(1-Math.abs(r+a-1)),l:.5*(r+a)};return r-a!==0&&(o.h=(r===e?(n-t)/(r-a)+(n<t)*6:r===n?(t-e)/(r-a)+2:(e-n)/(r-a)+4)*60),i!==void 0&&(o.alpha=i),o}const Pa=(e,n)=>{switch(n){case"deg":return+e;case"rad":return e/Math.PI*180;case"grad":return e/10*9;case"turn":return e*360}},Ha=new RegExp(`^hsla?\\(\\s*${ta}${ke}${Re}${ke}${Re}\\s*(?:,\\s*${Ft}\\s*)?\\)$`),Ea=e=>{let n=e.match(Ha);if(!n)return;let t={mode:"hsl"};return n[3]!==void 0?t.h=+n[3]:n[1]!==void 0&&n[2]!==void 0&&(t.h=Pa(n[1],n[2])),n[4]!==void 0&&(t.s=Math.min(Math.max(0,n[4]/100),1)),n[5]!==void 0&&(t.l=Math.min(Math.max(0,n[5]/100),1)),n[6]!==void 0?t.alpha=Math.max(0,Math.min(1,n[6]/100)):n[7]!==void 0&&(t.alpha=Math.max(0,Math.min(1,+n[7]))),t};function Na(e,n){if(!n||n[0]!=="hsl"&&n[0]!=="hsla")return;const t={mode:"hsl"},[,i,r,a,o]=n;if(i.type!==h.None){if(i.type===h.Percentage)return;t.h=i.value}if(r.type!==h.None){if(r.type===h.Hue)return;t.s=r.value/100}if(a.type!==h.None){if(a.type===h.Hue)return;t.l=a.value/100}return o.type!==h.None&&(t.alpha=Math.min(1,Math.max(0,o.type===h.Number?o.value:o.value/100))),t}const yi={mode:"hsl",toMode:{rgb:Sa},fromMode:{rgb:Ca},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[Na,Ea],serialize:e=>`hsl(${e.h!==void 0?e.h:"none"} ${e.s!==void 0?e.s*100+"%":"none"} ${e.l!==void 0?e.l*100+"%":"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:u,fixup:V},s:u,l:u,alpha:{use:u,fixup:P}},difference:{h:ht},average:{h:J}};function Mi({h:e,s:n,v:t,alpha:i}){e=N(e!==void 0?e:0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.abs(e/60%2-1),a;switch(Math.floor(e/60)){case 0:a={r:t,g:t*(1-n*r),b:t*(1-n)};break;case 1:a={r:t*(1-n*r),g:t,b:t*(1-n)};break;case 2:a={r:t*(1-n),g:t,b:t*(1-n*r)};break;case 3:a={r:t*(1-n),g:t*(1-n*r),b:t};break;case 4:a={r:t*(1-n*r),g:t*(1-n),b:t};break;case 5:a={r:t,g:t*(1-n),b:t*(1-n*r)};break;default:a={r:t*(1-n),g:t*(1-n),b:t*(1-n)}}return a.mode="rgb",i!==void 0&&(a.alpha=i),a}function wi({r:e,g:n,b:t,alpha:i}){e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.max(e,n,t),a=Math.min(e,n,t),o={mode:"hsv",s:r===0?0:1-a/r,v:r};return r-a!==0&&(o.h=(r===e?(n-t)/(r-a)+(n<t)*6:r===n?(t-e)/(r-a)+2:(e-n)/(r-a)+4)*60),i!==void 0&&(o.alpha=i),o}const ki={mode:"hsv",toMode:{rgb:Mi},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:wi},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:u,fixup:V},s:u,v:u,alpha:{use:u,fixup:P}},difference:{h:ht},average:{h:J}};function Ia({h:e,w:n,b:t,alpha:i}){if(n===void 0&&(n=0),t===void 0&&(t=0),n+t>1){let r=n+t;n/=r,t/=r}return Mi({h:e,s:t===1?1:1-n/(1-t),v:1-t,alpha:i})}function Ra(e){let n=wi(e);if(n===void 0)return;let t=n.s!==void 0?n.s:0,i=n.v!==void 0?n.v:0,r={mode:"hwb",w:(1-t)*i,b:1-i};return n.h!==void 0&&(r.h=n.h),n.alpha!==void 0&&(r.alpha=n.alpha),r}function qa(e,n){if(!n||n[0]!=="hwb")return;const t={mode:"hwb"},[,i,r,a,o]=n;if(i.type!==h.None){if(i.type===h.Percentage)return;t.h=i.value}if(r.type!==h.None){if(r.type===h.Hue)return;t.w=r.value/100}if(a.type!==h.None){if(a.type===h.Hue)return;t.b=a.value/100}return o.type!==h.None&&(t.alpha=Math.min(1,Math.max(0,o.type===h.Number?o.value:o.value/100))),t}const Fa={mode:"hwb",toMode:{rgb:Ia},fromMode:{rgb:Ra},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[qa],serialize:e=>`hwb(${e.h!==void 0?e.h:"none"} ${e.w!==void 0?e.w*100+"%":"none"} ${e.b!==void 0?e.b*100+"%":"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:u,fixup:V},w:u,b:u,alpha:{use:u,fixup:P}},difference:{h:ka},average:{h:J}},zi=203,xt=.1593017578125,$i=78.84375,yt=.8359375,Mt=18.8515625,wt=18.6875;function Jt(e){if(e<0)return 0;const n=Math.pow(e,1/$i);return 1e4*Math.pow(Math.max(0,n-yt)/(Mt-wt*n),1/xt)}function Ut(e){if(e<0)return 0;const n=Math.pow(e/1e4,xt);return Math.pow((yt+Mt*n)/(1+wt*n),$i)}const Kt=e=>Math.max(e/zi,0),Ai=({i:e,t:n,p:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);const r=Jt(e+.008609037037932761*n+.11102962500302593*t),a=Jt(e-.00860903703793275*n-.11102962500302599*t),o=Jt(e+.5600313357106791*n-.32062717498731885*t),c={mode:"xyz65",x:Kt(2.070152218389422*r-1.3263473389671556*a+.2066510476294051*o),y:Kt(.3647385209748074*r+.680566024947227*a-.0453045459220346*o),z:Kt(-.049747207535812*r-.0492609666966138*a+1.1880659249923042*o)};return i!==void 0&&(c.alpha=i),c},Qt=(e=0)=>Math.max(e*zi,0),_i=({x:e,y:n,z:t,alpha:i})=>{const r=Qt(e),a=Qt(n),o=Qt(t),c=Ut(.3592832590121217*r+.6976051147779502*a-.0358915932320289*o),p=Ut(-.1920808463704995*r+1.1004767970374323*a+.0753748658519118*o),f=Ut(.0070797844607477*r+.0748396662186366*a+.8433265453898765*o),b=.5*c+.5*p,x=1.61376953125*c-3.323486328125*p+1.709716796875*f,v=4.378173828125*c-4.24560546875*p-.132568359375*f,M={mode:"itp",i:b,t:x,p:v};return i!==void 0&&(M.alpha=i),M},Xa={mode:"itp",channels:["i","t","p","alpha"],parse:["--ictcp"],serialize:"--ictcp",toMode:{xyz65:Ai,rgb:e=>ve(Ai(e))},fromMode:{xyz65:_i,rgb:e=>_i(me(e))},ranges:{i:[0,.581],t:[-.369,.272],p:[-.164,.331]},interpolate:{i:u,t:u,p:u,alpha:{use:u,fixup:P}}},Oa=134.03437499999998,Da=16295499532821565e-27,en=e=>{if(e<0)return 0;let n=Math.pow(e/1e4,xt);return Math.pow((yt+Mt*n)/(1+wt*n),Oa)},tn=(e=0)=>Math.max(e*203,0),Ti=({x:e,y:n,z:t,alpha:i})=>{e=tn(e),n=tn(n),t=tn(t);let r=1.15*e-.15*t,a=.66*n+.34*e,o=en(.41478972*r+.579999*a+.014648*t),c=en(-.20151*r+1.120649*a+.0531008*t),p=en(-.0166008*r+.2648*a+.6684799*t),f=(o+c)/2,b={mode:"jab",j:.44*f/(1-.56*f)-Da,a:3.524*o-4.066708*c+.542708*p,b:.199076*o+1.096799*c-1.295875*p};return i!==void 0&&(b.alpha=i),b},ja=134.03437499999998,Li=16295499532821565e-27,nn=e=>{if(e<0)return 0;let n=Math.pow(e,1/ja);return 1e4*Math.pow((yt-n)/(wt*n-Mt),1/xt)},rn=e=>e/203,Si=({j:e,a:n,b:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=(e+Li)/(.44+.56*(e+Li)),a=nn(r+.13860504*n+.058047316*t),o=nn(r-.13860504*n-.058047316*t),c=nn(r-.096019242*n-.8118919*t),p={mode:"xyz65",x:rn(1.661373024652174*a-.914523081304348*o+.23136208173913045*c),y:rn(-.3250758611844533*a+1.571847026732543*o-.21825383453227928*c),z:rn(-.090982811*a-.31272829*o+1.5227666*c)};return i!==void 0&&(p.alpha=i),p},Ci=e=>{let n=Ti(me(e));return e.r===e.b&&e.b===e.g&&(n.a=n.b=0),n},Pi=e=>ve(Si(e)),Ya={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:Ci,xyz65:Ti},toMode:{rgb:Pi,xyz65:Si},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:u,a:u,b:u,alpha:{use:u,fixup:P}}},Hi=({j:e,a:n,b:t,alpha:i})=>{n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.sqrt(n*n+t*t),a={mode:"jch",j:e,c:r};return r&&(a.h=N(Math.atan2(t,n)*180/Math.PI)),i!==void 0&&(a.alpha=i),a},Ei=({j:e,c:n,h:t,alpha:i})=>{t===void 0&&(t=0);let r={mode:"jab",j:e,a:n?n*Math.cos(t/180*Math.PI):0,b:n?n*Math.sin(t/180*Math.PI):0};return i!==void 0&&(r.alpha=i),r},Za={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:Ei,rgb:e=>Pi(Ei(e))},fromMode:{rgb:e=>Hi(Ci(e)),jab:Hi},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:u,fixup:V},c:u,j:u,alpha:{use:u,fixup:P}},difference:{h:ut},average:{h:J}},kt=Math.pow(29,3)/Math.pow(3,3),an=Math.pow(6,3)/Math.pow(29,3);let on=e=>Math.pow(e,3)>an?Math.pow(e,3):(116*e-16)/kt;const sn=({l:e,a:n,b:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=(e+16)/116,a=n/500+r,o=r-t/200,c={mode:"xyz50",x:on(a)*L.X,y:on(r)*L.Y,z:on(o)*L.Z};return i!==void 0&&(c.alpha=i),c},Xe=({x:e,y:n,z:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Ae({r:e*3.1341359569958707-n*1.6173863321612538-.4906619460083532*t,g:e*-.978795502912089+n*1.916254567259524+.03344273116131949*t,b:e*.07195537988411677-n*.2289768264158322+1.405386058324125*t});return i!==void 0&&(r.alpha=i),r},Ni=e=>Xe(sn(e)),Oe=e=>{let{r:n,g:t,b:i,alpha:r}=$e(e),a={mode:"xyz50",x:.436065742824811*n+.3851514688337912*t+.14307845442264197*i,y:.22249319175623702*n+.7168870538238823*t+.06061979053616537*i,z:.013923904500943465*n+.09708128566574634*t+.7140993584005155*i};return r!==void 0&&(a.alpha=r),a},ln=e=>e>an?Math.cbrt(e):(kt*e+16)/116,cn=({x:e,y:n,z:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=ln(e/L.X),a=ln(n/L.Y),o=ln(t/L.Z),c={mode:"lab",l:116*a-16,a:500*(r-a),b:200*(a-o)};return i!==void 0&&(c.alpha=i),c},Ii=e=>{let n=cn(Oe(e));return e.r===e.b&&e.b===e.g&&(n.a=n.b=0),n};function Ba(e,n){if(!n||n[0]!=="lab")return;const t={mode:"lab"},[,i,r,a,o]=n;if(!(i.type===h.Hue||r.type===h.Hue||a.type===h.Hue))return i.type!==h.None&&(t.l=Math.min(Math.max(0,i.value),100)),r.type!==h.None&&(t.a=r.type===h.Number?r.value:r.value*125/100),a.type!==h.None&&(t.b=a.type===h.Number?a.value:a.value*125/100),o.type!==h.None&&(t.alpha=Math.min(1,Math.max(0,o.type===h.Number?o.value:o.value/100))),t}const dn={mode:"lab",toMode:{xyz50:sn,rgb:Ni},fromMode:{xyz50:cn,rgb:Ii},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-125,125],b:[-125,125]},parse:[Ba],serialize:e=>`lab(${e.l!==void 0?e.l:"none"} ${e.a!==void 0?e.a:"none"} ${e.b!==void 0?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{l:u,a:u,b:u,alpha:{use:u,fixup:P}}},Wa={...dn,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:fi,rgb:ft},fromMode:{xyz65:bi,rgb:bt},ranges:{l:[0,100],a:[-125,125],b:[-125,125]}};function Ga(e,n){if(!n||n[0]!=="lch")return;const t={mode:"lch"},[,i,r,a,o]=n;if(i.type!==h.None){if(i.type===h.Hue)return;t.l=Math.min(Math.max(0,i.value),100)}if(r.type!==h.None&&(t.c=Math.max(0,r.type===h.Number?r.value:r.value*150/100)),a.type!==h.None){if(a.type===h.Percentage)return;t.h=a.value}return o.type!==h.None&&(t.alpha=Math.min(1,Math.max(0,o.type===h.Number?o.value:o.value/100))),t}const pn={mode:"lch",toMode:{lab:de,rgb:e=>Ni(de(e))},fromMode:{rgb:e=>ce(Ii(e)),lab:ce},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[Ga],serialize:e=>`lch(${e.l!==void 0?e.l:"none"} ${e.c!==void 0?e.c:"none"} ${e.h!==void 0?e.h:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:u,fixup:V},c:u,l:u,alpha:{use:u,fixup:P}},difference:{h:ut},average:{h:J}},Va={...pn,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:e=>de(e,"lab65"),rgb:e=>ft(de(e,"lab65"))},fromMode:{rgb:e=>ce(bt(e),"lch65"),lab65:e=>ce(e,"lch65")},ranges:{l:[0,100],c:[0,150],h:[0,360]}},Ri=({l:e,u:n,v:t,alpha:i})=>{n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.sqrt(n*n+t*t),a={mode:"lchuv",l:e,c:r};return r&&(a.h=N(Math.atan2(t,n)*180/Math.PI)),i!==void 0&&(a.alpha=i),a},qi=({l:e,c:n,h:t,alpha:i})=>{t===void 0&&(t=0);let r={mode:"luv",l:e,u:n?n*Math.cos(t/180*Math.PI):0,v:n?n*Math.sin(t/180*Math.PI):0};return i!==void 0&&(r.alpha=i),r},Fi=(e,n,t)=>4*e/(e+15*n+3*t),Xi=(e,n,t)=>9*n/(e+15*n+3*t),Ja=Fi(L.X,L.Y,L.Z),Ua=Xi(L.X,L.Y,L.Z),Ka=e=>e<=an?kt*e:116*Math.cbrt(e)-16,hn=({x:e,y:n,z:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Ka(n/L.Y),a=Fi(e,n,t),o=Xi(e,n,t);!isFinite(a)||!isFinite(o)?r=a=o=0:(a=13*r*(a-Ja),o=13*r*(o-Ua));let c={mode:"luv",l:r,u:a,v:o};return i!==void 0&&(c.alpha=i),c},Qa=(e,n,t)=>4*e/(e+15*n+3*t),eo=(e,n,t)=>9*n/(e+15*n+3*t),to=Qa(L.X,L.Y,L.Z),no=eo(L.X,L.Y,L.Z),un=({l:e,u:n,v:t,alpha:i})=>{if(e===void 0&&(e=0),e===0)return{mode:"xyz50",x:0,y:0,z:0};n===void 0&&(n=0),t===void 0&&(t=0);let r=n/(13*e)+to,a=t/(13*e)+no,o=L.Y*(e<=8?e/kt:Math.pow((e+16)/116,3)),c=o*(9*r)/(4*a),p=o*(12-3*r-20*a)/(4*a),f={mode:"xyz50",x:c,y:o,z:p};return i!==void 0&&(f.alpha=i),f},io={mode:"lchuv",toMode:{luv:qi,rgb:e=>Xe(un(qi(e)))},fromMode:{rgb:e=>Ri(hn(Oe(e))),luv:Ri},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:u,fixup:V},c:u,l:u,alpha:{use:u,fixup:P}},difference:{h:ut},average:{h:J}},ro={...ze,mode:"lrgb",toMode:{rgb:Ae},fromMode:{rgb:$e},parse:["srgb-linear"],serialize:"srgb-linear"},ao={mode:"luv",toMode:{xyz50:un,rgb:e=>Xe(un(e))},fromMode:{xyz50:hn,rgb:e=>hn(Oe(e))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l:u,u,v:u,alpha:{use:u,fixup:P}}},Oi=({r:e,g:n,b:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.cbrt(.412221469470763*e+.5363325372617348*n+.0514459932675022*t),a=Math.cbrt(.2119034958178252*e+.6806995506452344*n+.1073969535369406*t),o=Math.cbrt(.0883024591900564*e+.2817188391361215*n+.6299787016738222*t),c={mode:"oklab",l:.210454268309314*r+.7936177747023054*a-.0040720430116193*o,a:1.9779985324311684*r-2.42859224204858*a+.450593709617411*o,b:.0259040424655478*r+.7827717124575296*a-.8086757549230774*o};return i!==void 0&&(c.alpha=i),c},zt=e=>{let n=Oi($e(e));return e.r===e.b&&e.b===e.g&&(n.a=n.b=0),n},De=({l:e,a:n,b:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Math.pow(e+.3963377773761749*n+.2158037573099136*t,3),a=Math.pow(e-.1055613458156586*n-.0638541728258133*t,3),o=Math.pow(e-.0894841775298119*n-1.2914855480194092*t,3),c={mode:"lrgb",r:4.076741636075957*r-3.3077115392580616*a+.2309699031821044*o,g:-1.2684379732850317*r+2.6097573492876887*a-.3413193760026573*o,b:-.0041960761386756*r-.7034186179359362*a+1.7076146940746117*o};return i!==void 0&&(c.alpha=i),c},$t=e=>Ae(De(e));function fn(e){const i=1.170873786407767;return .5*(i*e-.206+Math.sqrt((i*e-.206)*(i*e-.206)+4*.03*i*e))}function At(e){return(e*e+.206*e)/(1.170873786407767*(e+.03))}function oo(e,n){let t,i,r,a,o,c,p,f;-1.88170328*e-.80936493*n>1?(t=1.19086277,i=1.76576728,r=.59662641,a=.75515197,o=.56771245,c=4.0767416621,p=-3.3077115913,f=.2309699292):1.81444104*e-1.19445276*n>1?(t=.73956515,i=-.45954404,r=.08285427,a=.1254107,o=.14503204,c=-1.2684380046,p=2.6097574011,f=-.3413193965):(t=1.35733652,i=-.00915799,r=-1.1513021,a=-.50559606,o=.00692167,c=-.0041960863,p=-.7034186147,f=1.707614701);let b=t+i*e+r*n+a*e*e+o*e*n,x=.3963377774*e+.2158037573*n,v=-.1055613458*e-.0638541728*n,M=-.0894841775*e-1.291485548*n;{let _=1+b*x,A=1+b*v,S=1+b*M,H=_*_*_,C=A*A*A,ge=S*S*S,We=3*x*_*_,Ge=3*v*A*A,Ve=3*M*S*S,Je=6*x*x*_,Ue=6*v*v*A,Ke=6*M*M*S,Ne=c*H+p*C+f*ge,Me=c*We+p*Ge+f*Ve,Qe=c*Je+p*Ue+f*Ke;b=b-Ne*Me/(Me*Me-.5*Ne*Qe)}return b}function bn(e,n){let t=oo(e,n),i=De({l:1,a:t*e,b:t*n}),r=Math.cbrt(1/Math.max(i.r,i.g,i.b)),a=r*t;return[r,a]}function so(e,n,t,i,r,a=null){a||(a=bn(e,n));let o;if((t-r)*a[1]-(a[0]-r)*i<=0)o=a[1]*r/(i*a[0]+a[1]*(r-t));else{o=a[1]*(r-1)/(i*(a[0]-1)+a[1]*(r-t));{let c=t-r,p=i,f=.3963377774*e+.2158037573*n,b=-.1055613458*e-.0638541728*n,x=-.0894841775*e-1.291485548*n,v=c+p*f,M=c+p*b,_=c+p*x;{let A=r*(1-o)+o*t,S=o*i,H=A+S*f,C=A+S*b,ge=A+S*x,We=H*H*H,Ge=C*C*C,Ve=ge*ge*ge,Je=3*v*H*H,Ue=3*M*C*C,Ke=3*_*ge*ge,Ne=6*v*v*H,Me=6*M*M*C,Qe=6*_*_*ge,Mr=4.0767416621*We-3.3077115913*Ge+.2309699292*Ve-1,Hn=4.0767416621*Je-3.3077115913*Ue+.2309699292*Ke,rs=4.0767416621*Ne-3.3077115913*Me+.2309699292*Qe,wr=Hn/(Hn*Hn-.5*Mr*rs),En=-Mr*wr,kr=-1.2684380046*We+2.6097574011*Ge-.3413193965*Ve-1,Nn=-1.2684380046*Je+2.6097574011*Ue-.3413193965*Ke,as=-1.2684380046*Ne+2.6097574011*Me-.3413193965*Qe,zr=Nn/(Nn*Nn-.5*kr*as),In=-kr*zr,$r=-.0041960863*We-.7034186147*Ge+1.707614701*Ve-1,Rn=-.0041960863*Je-.7034186147*Ue+1.707614701*Ke,os=-.0041960863*Ne-.7034186147*Me+1.707614701*Qe,Ar=Rn/(Rn*Rn-.5*$r*os),qn=-$r*Ar;En=wr>=0?En:1e6,In=zr>=0?In:1e6,qn=Ar>=0?qn:1e6,o+=Math.min(En,Math.min(In,qn))}}}return o}function gn(e,n,t=null){t||(t=bn(e,n));let i=t[0],r=t[1];return[r/i,r/(1-i)]}function Di(e,n,t){let i=bn(n,t),r=so(n,t,e,1,e,i),a=gn(n,t,i),o=.11516993+1/(7.4477897+4.1590124*t+n*(-2.19557347+1.75198401*t+n*(-2.13704948-10.02301043*t+n*(-4.24894561+5.38770819*t+4.69891013*n)))),c=.11239642+1/(1.6132032-.68124379*t+n*(.40370612+.90148123*t+n*(-.27087943+.6122399*t+n*(.00299215-.45399568*t-.14661872*n)))),p=r/Math.min(e*a[0],(1-e)*a[1]),f=e*o,b=(1-e)*c,x=.9*p*Math.sqrt(Math.sqrt(1/(1/(f*f*f*f)+1/(b*b*b*b))));return f=e*.4,b=(1-e)*.8,[Math.sqrt(1/(1/(f*f)+1/(b*b))),x,r]}function ji(e){const n=e.l!==void 0?e.l:0,t=e.a!==void 0?e.a:0,i=e.b!==void 0?e.b:0,r={mode:"okhsl",l:fn(n)};e.alpha!==void 0&&(r.alpha=e.alpha);let a=Math.sqrt(t*t+i*i);if(!a)return r.s=0,r;let[o,c,p]=Di(n,t/a,i/a),f;if(a<c){let b=0,x=.8*o,v=1-x/c;f=(a-b)/(x+v*(a-b))*.8}else{let b=c,x=.2*c*c*1.25*1.25/o,v=1-x/(p-c);f=.8+.2*((a-b)/(x+v*(a-b)))}return f&&(r.s=f,r.h=N(Math.atan2(i,t)*180/Math.PI)),r}function Yi(e){let n=e.h!==void 0?e.h:0,t=e.s!==void 0?e.s:0,i=e.l!==void 0?e.l:0;const r={mode:"oklab",l:At(i)};if(e.alpha!==void 0&&(r.alpha=e.alpha),!t||i===1)return r.a=r.b=0,r;let a=Math.cos(n/180*Math.PI),o=Math.sin(n/180*Math.PI),[c,p,f]=Di(r.l,a,o),b,x,v,M;t<.8?(b=1.25*t,x=0,v=.8*c,M=1-v/p):(b=5*(t-.8),x=p,v=.2*p*p*1.25*1.25/c,M=1-v/(f-p));let _=x+b*v/(1-M*b);return r.a=_*a,r.b=_*o,r}const lo={...yi,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:ji,rgb:e=>ji(zt(e))},toMode:{oklab:Yi,rgb:e=>$t(Yi(e))}};function Zi(e){let n=e.l!==void 0?e.l:0,t=e.a!==void 0?e.a:0,i=e.b!==void 0?e.b:0,r=Math.sqrt(t*t+i*i),a=r?t/r:1,o=r?i/r:1,[c,p]=gn(a,o),f=.5,b=1-f/c,x=p/(r+n*p),v=x*n,M=x*r,_=At(v),A=M*_/v,S=De({l:_,a:a*A,b:o*A}),H=Math.cbrt(1/Math.max(S.r,S.g,S.b,0));n=n/H,r=r/H*fn(n)/n,n=fn(n);const C={mode:"okhsv",s:r?(f+p)*M/(p*f+p*b*M):0,v:n?n/v:0};return C.s&&(C.h=N(Math.atan2(i,t)*180/Math.PI)),e.alpha!==void 0&&(C.alpha=e.alpha),C}function Bi(e){const n={mode:"oklab"};e.alpha!==void 0&&(n.alpha=e.alpha);const t=e.h!==void 0?e.h:0,i=e.s!==void 0?e.s:0,r=e.v!==void 0?e.v:0,a=Math.cos(t/180*Math.PI),o=Math.sin(t/180*Math.PI),[c,p]=gn(a,o),f=.5,b=1-f/c,x=1-i*f/(f+p-p*b*i),v=i*p*f/(f+p-p*b*i),M=At(x),_=v*M/x,A=De({l:M,a:a*_,b:o*_}),S=Math.cbrt(1/Math.max(A.r,A.g,A.b,0)),H=At(r*x),C=v*H/x;return n.l=H*S,n.a=C*a*S,n.b=C*o*S,n}const co={...ki,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:Zi,rgb:e=>Zi(zt(e))},toMode:{oklab:Bi,rgb:e=>$t(Bi(e))}};function po(e,n){if(!n||n[0]!=="oklab")return;const t={mode:"oklab"},[,i,r,a,o]=n;if(!(i.type===h.Hue||r.type===h.Hue||a.type===h.Hue))return i.type!==h.None&&(t.l=Math.min(Math.max(0,i.type===h.Number?i.value:i.value/100),1)),r.type!==h.None&&(t.a=r.type===h.Number?r.value:r.value*.4/100),a.type!==h.None&&(t.b=a.type===h.Number?a.value:a.value*.4/100),o.type!==h.None&&(t.alpha=Math.min(1,Math.max(0,o.type===h.Number?o.value:o.value/100))),t}const ho={...dn,mode:"oklab",toMode:{lrgb:De,rgb:$t},fromMode:{lrgb:Oi,rgb:zt},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[po],serialize:e=>`oklab(${e.l!==void 0?e.l:"none"} ${e.a!==void 0?e.a:"none"} ${e.b!==void 0?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`};function uo(e,n){if(!n||n[0]!=="oklch")return;const t={mode:"oklch"},[,i,r,a,o]=n;if(i.type!==h.None){if(i.type===h.Hue)return;t.l=Math.min(Math.max(0,i.type===h.Number?i.value:i.value/100),1)}if(r.type!==h.None&&(t.c=Math.max(0,r.type===h.Number?r.value:r.value*.4/100)),a.type!==h.None){if(a.type===h.Percentage)return;t.h=a.value}return o.type!==h.None&&(t.alpha=Math.min(1,Math.max(0,o.type===h.Number?o.value:o.value/100))),t}const fo={...pn,mode:"oklch",toMode:{oklab:e=>de(e,"oklab"),rgb:e=>$t(de(e,"oklab"))},fromMode:{rgb:e=>ce(zt(e),"oklch"),oklab:e=>ce(e,"oklch")},parse:[uo],serialize:e=>`oklch(${e.l!==void 0?e.l:"none"} ${e.c!==void 0?e.c:"none"} ${e.h!==void 0?e.h:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,ranges:{l:[0,1],c:[0,.4],h:[0,360]}},Wi=e=>{let{r:n,g:t,b:i,alpha:r}=$e(e),a={mode:"xyz65",x:.486570948648216*n+.265667693169093*t+.1982172852343625*i,y:.2289745640697487*n+.6917385218365062*t+.079286914093745*i,z:0*n+.0451133818589026*t+1.043944368900976*i};return r!==void 0&&(a.alpha=r),a},Gi=({x:e,y:n,z:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r=Ae({r:e*2.4934969119414263-n*.9313836179191242-.402710784450717*t,g:e*-.8294889695615749+n*1.7626640603183465+.0236246858419436*t,b:e*.0358458302437845-n*.0761723892680418+.9568845240076871*t},"p3");return i!==void 0&&(r.alpha=i),r},bo={...ze,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:e=>Gi(me(e)),xyz65:Gi},toMode:{rgb:e=>ve(Wi(e)),xyz65:Wi}},mn=e=>{let n=Math.abs(e);return n>=1/512?Math.sign(e)*Math.pow(n,1/1.8):16*e},Vi=({x:e,y:n,z:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r={mode:"prophoto",r:mn(e*1.3457868816471585-n*.2555720873797946-.0511018649755453*t),g:mn(e*-.5446307051249019+n*1.5082477428451466+.0205274474364214*t),b:mn(e*0+n*0+1.2119675456389452*t)};return i!==void 0&&(r.alpha=i),r},vn=(e=0)=>{let n=Math.abs(e);return n>=16/512?Math.sign(e)*Math.pow(n,1.8):e/16},Ji=e=>{let n=vn(e.r),t=vn(e.g),i=vn(e.b),r={mode:"xyz50",x:.7977666449006423*n+.1351812974005331*t+.0313477341283922*i,y:.2880748288194013*n+.7118352342418731*t+899369387256e-16*i,z:0*n+0*t+.8251046025104602*i};return e.alpha!==void 0&&(r.alpha=e.alpha),r},go={...ze,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:Vi,rgb:e=>Vi(Oe(e))},toMode:{xyz50:Ji,rgb:e=>Xe(Ji(e))}},Ui=1.09929682680944,mo=.018053968510807,xn=e=>{const n=Math.abs(e);return n>mo?(Math.sign(e)||1)*(Ui*Math.pow(n,.45)-(Ui-1)):4.5*e},Ki=({x:e,y:n,z:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);let r={mode:"rec2020",r:xn(e*1.7166511879712683-n*.3556707837763925-.2533662813736599*t),g:xn(e*-.6666843518324893+n*1.6164812366349395+.0157685458139111*t),b:xn(e*.0176398574453108-n*.0427706132578085+.9421031212354739*t)};return i!==void 0&&(r.alpha=i),r},Qi=1.09929682680944,vo=.018053968510807,yn=(e=0)=>{let n=Math.abs(e);return n<vo*4.5?e/4.5:(Math.sign(e)||1)*Math.pow((n+Qi-1)/Qi,1/.45)},er=e=>{let n=yn(e.r),t=yn(e.g),i=yn(e.b),r={mode:"xyz65",x:.6369580483012911*n+.1446169035862083*t+.1688809751641721*i,y:.262700212011267*n+.6779980715188708*t+.059301716469862*i,z:0*n+.0280726930490874*t+1.0609850577107909*i};return e.alpha!==void 0&&(r.alpha=e.alpha),r},xo={...ze,mode:"rec2020",fromMode:{xyz65:Ki,rgb:e=>Ki(me(e))},toMode:{xyz65:er,rgb:e=>ve(er(e))},parse:["rec2020"],serialize:"rec2020"},xe=.0037930732552754493,tr=Math.cbrt(xe),Mn=e=>Math.cbrt(e)-tr,yo=e=>{const{r:n,g:t,b:i,alpha:r}=$e(e),a=Mn(.3*n+.622*t+.078*i+xe),o=Mn(.23*n+.692*t+.078*i+xe),c=Mn(.2434226892454782*n+.2047674442449682*t+.5518098665095535*i+xe),p={mode:"xyb",x:(a-o)/2,y:(a+o)/2,b:c-(a+o)/2};return r!==void 0&&(p.alpha=r),p},wn=e=>Math.pow(e+tr,3),Mo={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:({x:e,y:n,b:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);const r=wn(e+n)-xe,a=wn(n-e)-xe,o=wn(t+n)-xe,c=Ae({r:11.031566904639861*r-9.866943908131562*a-.16462299650829934*o,g:-3.2541473810744237*r+4.418770377582723*a-.16462299650829934*o,b:-3.6588512867136815*r+2.7129230459360922*a+1.9459282407775895*o});return i!==void 0&&(c.alpha=i),c}},fromMode:{rgb:yo},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:u,y:u,b:u,alpha:{use:u,fixup:P}}},wo={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:Xe,lab:cn},fromMode:{rgb:Oe,lab:sn},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:u,y:u,z:u,alpha:{use:u,fixup:P}}},ko={mode:"xyz65",toMode:{rgb:ve,xyz50:e=>{let{x:n,y:t,z:i,alpha:r}=e;n===void 0&&(n=0),t===void 0&&(t=0),i===void 0&&(i=0);let a={mode:"xyz50",x:1.0479298208405488*n+.0229467933410191*t-.0501922295431356*i,y:.0296278156881593*n+.990434484573249*t-.0170738250293851*i,z:-.0092430581525912*n+.0150551448965779*t+.7518742899580008*i};return r!==void 0&&(a.alpha=r),a}},fromMode:{rgb:me,xyz50:e=>{let{x:n,y:t,z:i,alpha:r}=e;n===void 0&&(n=0),t===void 0&&(t=0),i===void 0&&(i=0);let a={mode:"xyz65",x:.9554734527042182*n-.0230985368742614*t+.0632593086610217*i,y:-.0283697069632081*n+1.0099954580058226*t+.021041398966943*i,z:.0123140016883199*n-.0205076964334779*t+1.3303659366080753*i};return r!==void 0&&(a.alpha=r),a}},ranges:{x:[0,.95],y:[0,1],z:[0,1.088]},channels:["x","y","z","alpha"],parse:["xyz","xyz-d65"],serialize:"xyz-d65",interpolate:{x:u,y:u,z:u,alpha:{use:u,fixup:P}}},zo={mode:"yiq",toMode:{rgb:({y:e,i:n,q:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);const r={mode:"rgb",r:e+.95608445*n+.6208885*t,g:e-.27137664*n-.6486059*t,b:e-1.10561724*n+1.70250126*t};return i!==void 0&&(r.alpha=i),r}},fromMode:{rgb:({r:e,g:n,b:t,alpha:i})=>{e===void 0&&(e=0),n===void 0&&(n=0),t===void 0&&(t=0);const r={mode:"yiq",y:.29889531*e+.58662247*n+.11448223*t,i:.59597799*e-.2741761*n-.32180189*t,q:.21147017*e-.52261711*n+.31114694*t};return i!==void 0&&(r.alpha=i),r}},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:u,i:u,q:u,alpha:{use:u,fixup:P}}},$o=e=>Math.max(0,Math.min(1,e||0)),kn=e=>Math.round($o(e)*255),Ao=O("rgb"),_o=e=>{if(e===void 0)return;let n=kn(e.r),t=kn(e.g),i=kn(e.b);return"#"+(1<<24|n<<16|t<<8|i).toString(16).slice(1)},To=e=>_o(Ao(e)),nr=O("rgb"),ir=e=>{const n={mode:e.mode,r:Math.max(0,Math.min(e.r!==void 0?e.r:0,1)),g:Math.max(0,Math.min(e.g!==void 0?e.g:0,1)),b:Math.max(0,Math.min(e.b!==void 0?e.b:0,1))};return e.alpha!==void 0&&(n.alpha=e.alpha),n},Lo=e=>ir(nr(e)),rr=e=>e!==void 0&&(e.r===void 0||e.r>=0&&e.r<=1)&&(e.g===void 0||e.g>=0&&e.g<=1)&&(e.b===void 0||e.b>=0&&e.b<=1);function So(e){return rr(nr(e))}function ar(e="rgb"){const{gamut:n}=lt(e);if(!n)return i=>!0;const t=O(typeof n=="string"?n:e);return i=>rr(t(i))}function Co(e="rgb"){const{gamut:n}=lt(e);if(!n)return a=>ot(a);const t=typeof n=="string"?n:e,i=O(t),r=ar(t);return a=>{const o=ot(a);if(!o)return;const c=i(o);if(r(c))return o;const p=ir(c);return o.mode===p.mode?p:O(o.mode)(p)}}function Po(e,n="lch",t="rgb"){e=ot(e);let i=t==="rgb"?So:ar(t),r=t==="rgb"?Lo:Co(t);if(e===void 0||i(e))return e;let a=O(e.mode);e=O(n)(e);let o={...e,c:0};if(!i(o))return a(r(o));let c=0,p=e.c!==void 0?e.c:0,f=lt(n).ranges.c,b=(f[1]-f[0])/Math.pow(2,13),x=o.c;for(;p-c>b;)o.c=c+(p-c)*.5,i(o)?(x=o.c,c=o.c):p=o.c;return a(i(o)?o:{...o,c:x})}k(ma),k(za),k($a),k(Aa),k(La),k(yi),k(ki),k(Fa),k(Xa),k(Ya),k(Za),k(dn),k(Wa),k(pn),k(Va),k(io),k(ro),k(ao),k(lo),k(co),k(ho);const zn=k(fo);k(bo),k(go),k(xo),k(ze),k(Mo),k(wo),k(ko),k(zo);const Ho=O("rgb");function or(e,n){const t=e.getContext("2d",{willReadFrequently:!0});if(!t)return;const{width:i,height:r}=e,a=t.createImageData(i,r),o=a.data;for(let c=0;c<r;c++){const p=1-c/(r-1||1);for(let f=0;f<i;f++){const b=f/(i-1||1),x=Ho({mode:"hsv",h:n,s:b,v:p,alpha:1}),v=(c*i+f)*4;if(!x){o[v]=o[v+1]=o[v+2]=0,o[v+3]=255;continue}o[v]=Math.round($n((x.r??0)*255)),o[v+1]=Math.round($n((x.g??0)*255)),o[v+2]=Math.round($n((x.b??0)*255)),o[v+3]=255}}t.putImageData(a,0,0)}function $n(e){return Math.min(255,Math.max(0,e))}const Te=O("rgb"),_t=O("hsv"),Eo=O("hsl"),sr=.002,lr=.004;function Tt(e){return e.c<=sr}function No(e){const n=_t({mode:"oklch",...e,alpha:1});return Math.max(0,(n==null?void 0:n.s)??0)}function pe(e){return Tt(e)?!0:No(e)<lr}function Lt(e,n){return pe(e)?{...e,h:D(n)}:e}function X(e){const n=ye(e.l??0),t=Math.max(0,e.c??0),i=D(e.h??0),r=ye(e.alpha??1),a=Po({mode:"oklch",l:n,c:t,h:i,alpha:r},"rgb"),o=Tt({c:t});return{l:a.l??n,c:o?0:a.c??0,h:o?D(i):i,alpha:a.alpha??r}}function he(e){const n=oi(e.trim());if(!n)return null;const t=zn(n);return(t==null?void 0:t.l)==null?null:X({l:t.l,c:t.c??0,h:t.h??0,alpha:t.alpha??1})}function An(e){const{l:n,c:t,h:i,alpha:r}=e;return r>=1?`oklch(${(n*100).toFixed(1)}% ${t.toFixed(4)} ${i.toFixed(1)})`:`oklch(${(n*100).toFixed(1)}% ${t.toFixed(4)} ${i.toFixed(1)} / ${Math.round(r*100)}%)`}function Le(e){return To(Te({mode:"oklch",...e}))??"#000000"}function Io(e){const{r:n,g:t,b:i}=St(e);return e.alpha<1?`rgba(${n}, ${t}, ${i}, ${e.alpha.toFixed(2)})`:`rgb(${n}, ${t}, ${i})`}function St(e){const n=Te({mode:"oklch",...e,alpha:1});return n?{r:Math.round((n.r??0)*255),g:Math.round((n.g??0)*255),b:Math.round((n.b??0)*255)}:{r:0,g:0,b:0}}function Ro(e){const n=D(Math.max(0,Math.min(1,e))*360),t=Te({mode:"hsv",h:n,s:1,v:1,alpha:1});return t?{r:Math.round((t.r??0)*255),g:Math.round((t.g??0)*255),b:Math.round((t.b??0)*255)}:{r:255,g:0,b:0}}function qo(e){const{r:n,g:t,b:i}=St(e);return`linear-gradient(to right, rgba(${n}, ${t}, ${i}, 0), rgb(${n}, ${t}, ${i}))`}function Fo(e){if(pe(e))return D(e.h);const n=_t({mode:"oklch",...e,alpha:1});return D((n==null?void 0:n.h)??e.h)}function cr(e,n){const t=D(n),i=_t({mode:"oklch",...e,alpha:1}),r=Te({mode:"hsv",h:t,s:(i==null?void 0:i.s)??0,v:(i==null?void 0:i.v)??1,alpha:1}),a=zn(r??{mode:"hsv",h:t,s:(i==null?void 0:i.s)??0,v:(i==null?void 0:i.v)??1});if((a==null?void 0:a.l)!=null){const o=a.c??0;return Lt(X({l:a.l,c:o,h:a.h??t,alpha:e.alpha}),t)}return X({...e,h:t})}function je(e,n){switch(n){case"hex":return[{key:"hex",label:"HEX CODE",value:Le(e).replace("#","").toUpperCase()}];case"rgb":{const t=Te({mode:"oklch",...e});return[{key:"r",label:"R",value:String(Math.round((t.r??0)*255)),min:0,max:255},{key:"g",label:"G",value:String(Math.round((t.g??0)*255)),min:0,max:255},{key:"b",label:"B",value:String(Math.round((t.b??0)*255)),min:0,max:255}]}case"hsl":{const t=Eo({mode:"oklch",...e});return[{key:"h",label:"H",value:String(Math.round((t==null?void 0:t.h)??0)),min:0,max:360},{key:"s",label:"S",value:String(Math.round(((t==null?void 0:t.s)??0)*100)),min:0,max:100,suffix:"%"},{key:"l",label:"L",value:String(Math.round(((t==null?void 0:t.l)??0)*100)),min:0,max:100,suffix:"%"}]}case"oklch":return[{key:"l",label:"L",value:String(Math.round(e.l*100)),min:0,max:100,suffix:"%"},{key:"c",label:"C",value:e.c.toFixed(3),min:0,max:.4,step:.001},{key:"h",label:"H",value:String(Math.round(e.h)),min:0,max:360}]}}function Xo(e,n,t){var f,b,x;const i=e.alpha,r=je(e,"hsl"),a=n==="h"?D(t):Number(((f=r.find(v=>v.key==="h"))==null?void 0:f.value)??0);let o=n==="s"?t:Number(((b=r.find(v=>v.key==="s"))==null?void 0:b.value)??0);const c=n==="l"?t:Number(((x=r.find(v=>v.key==="l"))==null?void 0:x.value)??0);n==="h"&&o<1&&(o=1);const p=he(`hsl(${a}, ${Ct(o)}%, ${Ct(c)}%)`);return p?{...p,alpha:i}:e}function Oo(e,n,t,i){switch(n){case"l":{const r=X({...e,l:t/100});return i!=null?Lt(r,i):r}case"c":{const r=Math.max(0,t),a=r<=sr||pe(e)?i!=null?D(i):D(e.h):e.h,o=X({...e,c:r,h:a});return i!=null?Lt(o,i):o}case"h":return cr(e,t)}}function _n(e,n,t){switch(e){case"hex":{const i=(n.hex??"").trim().replace(/^#/,"");if(!/^[0-9a-fA-F]{3,8}$/.test(i))return null;const r=he(`#${i}`);return r?Tn(r,t.alpha):null}case"rgb":{const i=Number(n.r),r=Number(n.g),a=Number(n.b);if([i,r,a].some(c=>Number.isNaN(c)))return null;const o=he(`rgb(${Ln(i)}, ${Ln(r)}, ${Ln(a)})`);return o?Tn(o,t.alpha):null}case"hsl":{const i=Sn(n.h),r=Sn(n.s),a=Sn(n.l);if([i,r,a].some(c=>Number.isNaN(c)))return null;const o=he(`hsl(${i}, ${Ct(r)}%, ${Ct(a)}%)`);return o?Tn(o,t.alpha):null}case"oklch":{const i=Number(n.l);let r=Number(n.c),a=Number(n.h);return[i,r,a].some(o=>Number.isNaN(o))?null:(r<=0&&(r=0,Tt(t)||(a=t.h)),X({l:i/100,c:r,h:a,alpha:t.alpha}))}}}function Do(e){const n=_t({mode:"oklch",...e,alpha:1});return{x:ye((n==null?void 0:n.s)??0),y:ye(1-((n==null?void 0:n.v)??0))}}function jo(e,n,t,i){const r=ye(e),a=ye(n),o=D(t),c=zn(Te({mode:"hsv",h:o,s:r,v:1-a,alpha:1})??{mode:"hsv",h:o,s:r,v:1-a});if((c==null?void 0:c.l)!=null){const p=c.c??0,f=r<lr||Tt({c:p});return X({l:c.l,c:p,h:f?o:c.h??o,alpha:i})}return X({l:.5,c:0,h:o,alpha:i})}function Tn(e,n){return{...e,alpha:ye(n)}}function ye(e){return Math.min(1,Math.max(0,e))}function Ln(e){return Math.min(255,Math.max(0,Math.round(e)))}function Ct(e){return Math.min(100,Math.max(0,e))}function Sn(e){return Number(e.replace(/%/g,"").trim())}function D(e){return Math.min(360,Math.max(0,e))}const Cn={l:.62,c:.24,h:303,alpha:.8},dr="pretty-color-picker-history",pr=16;function hr(e,n){return Le(e)===Le(n)&&e.alpha===n.alpha}function Yo(){try{const e=localStorage.getItem(dr);if(!e)return[];const n=JSON.parse(e);return Array.isArray(n)?n.slice(0,pr):[]}catch{return[]}}function Zo(e,n){const t=n.filter(r=>!hr(r,e)),i=[e,...t].slice(0,pr);try{localStorage.setItem(dr,JSON.stringify(i))}catch{}return i}const Bo="#ededed",Wo="#171717",Go=.52;function Vo(e,n,t){const i=[e,n,t].map(r=>{const a=r/255;return a<=.03928?a/12.92:((a+.055)/1.055)**2.4});return .2126*i[0]+.7152*i[1]+.0722*i[2]}function Jo(e,n,t){return Vo(e,n,t)>Go?Wo:Bo}function Uo(e,n,t){return{backgroundColor:Jo(e,n,t),boxShadow:"none"}}function ur(e){const n=e.replace("#","").trim();return n?n.length===3?{r:Number.parseInt(n[0]+n[0],16),g:Number.parseInt(n[1]+n[1],16),b:Number.parseInt(n[2]+n[2],16)}:n.length===6?{r:Number.parseInt(n.slice(0,2),16),g:Number.parseInt(n.slice(2,4),16),b:Number.parseInt(n.slice(4,6),16)}:null:null}function Ko(e,n,t,i){const r=Math.max(0,Math.min(1,n)),a={r:Math.round((t.r+i.r)/2),g:Math.round((t.g+i.g)/2),b:Math.round((t.b+i.b)/2)};return{r:Math.round(r*e.r+(1-r)*a.r),g:Math.round(r*e.g+(1-r)*a.g),b:Math.round(r*e.b+(1-r)*a.b)}}function fr(e,n){const t=n.getBoundingClientRect(),i=gr((e.clientX-t.left)/t.width),r=gr((e.clientY-t.top)/t.height);return{x:i,y:r}}function br(e,n){let t=!1,i=null;const r=c=>{if(!t||i==null)return;const p=c.clientX-i;i=c.clientX,p!==0&&n.onDelta(p,c)},a=c=>{var p;if(t){if(t=!1,i=null,c.pointerId!=null)try{e.releasePointerCapture(c.pointerId)}catch{}window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",a),(p=n.onEnd)==null||p.call(n,c)}},o=c=>{var p;c.button===0&&(c.preventDefault(),t=!0,i=c.clientX,e.setPointerCapture(c.pointerId),(p=n.onStart)==null||p.call(n,c),window.addEventListener("pointermove",r),window.addEventListener("pointerup",a),window.addEventListener("pointercancel",a))};return e.addEventListener("pointerdown",o),()=>{e.removeEventListener("pointerdown",o),window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",a)}}function Pn(e,n,t,i){let r=!1;const a=p=>{if(!r)return;const{x:f,y:b}=fr(p,e);n(f,b)},o=p=>{if(r){if(r=!1,(p==null?void 0:p.pointerId)!=null)try{e.releasePointerCapture(p.pointerId)}catch{}window.removeEventListener("pointermove",a),window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",o),t==null||t()}},c=p=>{if(p.button!==0)return;r=!0,e.setPointerCapture(p.pointerId),i==null||i();const{x:f,y:b}=fr(p,e);n(f,b),window.addEventListener("pointermove",a),window.addEventListener("pointerup",o),window.addEventListener("pointercancel",o)};return e.addEventListener("pointerdown",c),()=>{e.removeEventListener("pointerdown",c),window.removeEventListener("pointermove",a),window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",o)}}function gr(e){return Math.min(1,Math.max(0,e))}const Pt=48;function Qo(e,n){const t=i=>{if(i.button!==0||i.target.closest(".pcp-header-btn"))return;i.preventDefault();const a=n.getBoundingClientRect(),o=i.clientX-a.left,c=i.clientY-a.top;e.dataset.dragging="true",e.setPointerCapture(i.pointerId);const p=b=>{vr(n,b.clientX-o,b.clientY-c)},f=b=>{e.removeAttribute("data-dragging");try{e.releasePointerCapture(b.pointerId)}catch{}window.removeEventListener("pointermove",p),window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f)};window.addEventListener("pointermove",p),window.addEventListener("pointerup",f),window.addEventListener("pointercancel",f)};return e.addEventListener("pointerdown",t),()=>{e.removeEventListener("pointerdown",t),e.removeAttribute("data-dragging")}}function mr(e){const n=e.offsetWidth,t=e.offsetHeight;vr(e,(window.innerWidth-n)/2,(window.innerHeight-t)/2)}function vr(e,n,t){const i=e.offsetWidth,r=e.offsetHeight,a=window.innerWidth-Pt,o=window.innerHeight-Pt,c=Pt-i,p=Pt-r;e.style.left=`${Math.min(a,Math.max(c,n))}px`,e.style.top=`${Math.min(o,Math.max(p,t))}px`}const xr=8,Se=8;function es(e,n=document){const t=e.trim();if(!t)return null;if(t.startsWith("#"))return n.getElementById(t.slice(1));try{return n.querySelector(t)}catch{return n.getElementById(t)}}function ts(e,n){const t=n.getBoundingClientRect(),i=e.offsetWidth,r=e.offsetHeight,a=window.innerWidth,o=window.innerHeight;let c=t.bottom+xr,p=t.left;p+i>a-Se&&(p=t.right-i),p=Math.min(a-Se-i,Math.max(Se,p)),c+r>o-Se&&(c=t.top-r-xr),c=Math.min(o-Se-r,Math.max(Se,c)),e.style.left=`${p}px`,e.style.top=`${c}px`}const ns=["hex","rgb","hsl","oklch"],is={hex:"HEX",rgb:"RGB",hsl:"HSL",oklch:"OKLCH"};class yr extends HTMLElement{constructor(){super();z(this,s);z(this,$);z(this,y,{...Cn});z(this,R,"hsl");z(this,U,Yo());z(this,Ce,null);z(this,I,[]);z(this,Pe);z(this,Ye);z(this,j);z(this,K);z(this,q);z(this,Q);z(this,Ze);z(this,Y);z(this,He);z(this,ee);z(this,Be);z(this,G);z(this,ue);z(this,Ee);z(this,te,null);z(this,Z,null);z(this,ne,null);z(this,ie,null);z(this,fe,null);z(this,be,null);z(this,re,null);z(this,B,Cn.h);m(this,$,this.attachShadow({mode:"open"}))}static get observedAttributes(){return["value","theme","header-action","movable","mode","anchor","open","history"]}connectedCallback(){d(this,s,Lr).call(this),d(this,s,Sr).call(this),d(this,s,Tr).call(this),d(this,s,rt).call(this,!1),d(this,s,jn).call(this),d(this,s,tt).call(this),this.popoverMode&&this.open&&requestAnimationFrame(()=>d(this,s,et).call(this))}disconnectedCallback(){var t;l(this,re)!=null&&(cancelAnimationFrame(l(this,re)),m(this,re,null)),(t=l(this,Z))==null||t.call(this),m(this,Z,null),d(this,s,Dn).call(this),l(this,I).forEach(i=>i()),m(this,I,[])}attributeChangedCallback(t,i,r){if(this.isConnected){if(t==="value"&&r!=null){const a=he(r);a&&(m(this,y,a),d(this,s,rt).call(this,!1));return}t==="theme"&&d(this,s,nt).call(this),t==="movable"&&d(this,s,tt).call(this),(t==="mode"||t==="anchor")&&(d(this,s,jn).call(this),d(this,s,tt).call(this)),t==="open"&&this.popoverMode&&r!=null&&requestAnimationFrame(()=>{d(this,s,et).call(this),d(this,s,Ie).call(this)}),t==="history"&&d(this,s,Yn).call(this),t==="header-action"&&d(this,s,Pr).call(this)}}get value(){return An(l(this,y))}set value(t){const i=he(t);i&&(m(this,y,i),d(this,s,rt).call(this))}get color(){return{...l(this,y)}}set color(t){m(this,y,X(t)),d(this,s,rt).call(this)}get theme(){const t=this.getAttribute("theme");return t==="light"||t==="system"?t:"dark"}set theme(t){this.setAttribute("theme",t)}get headerAction(){const t=this.getAttribute("header-action");return t==="theme"?"theme":t==="none"?"none":"close"}set headerAction(t){this.setAttribute("header-action",t)}get movable(){return this.hasAttribute("movable")}set movable(t){t?this.setAttribute("movable",""):this.removeAttribute("movable")}get mode(){return this.getAttribute("mode")==="popover"?"popover":"inline"}set mode(t){t==="popover"?this.setAttribute("mode","popover"):this.removeAttribute("mode")}get popoverMode(){return this.mode==="popover"}get anchor(){return this.getAttribute("anchor")}set anchor(t){t?this.setAttribute("anchor",t):this.removeAttribute("anchor")}get open(){return this.hasAttribute("open")}set open(t){t?this.show():this.hide()}show(){if(this.popoverMode){if(this.open){requestAnimationFrame(()=>{d(this,s,et).call(this),d(this,s,Ie).call(this)});return}this.setAttribute("open","")}}hide(){!this.popoverMode||!this.open||this.removeAttribute("open")}toggle(){this.open?this.hide():this.show()}get history(){const t=this.getAttribute("history");return t===null?!0:t!=="false"&&t!=="0"}set history(t){t?this.removeAttribute("history"):this.setAttribute("history","false")}}$=new WeakMap,y=new WeakMap,R=new WeakMap,U=new WeakMap,Ce=new WeakMap,I=new WeakMap,Pe=new WeakMap,Ye=new WeakMap,j=new WeakMap,K=new WeakMap,q=new WeakMap,Q=new WeakMap,Ze=new WeakMap,Y=new WeakMap,He=new WeakMap,ee=new WeakMap,Be=new WeakMap,G=new WeakMap,ue=new WeakMap,Ee=new WeakMap,te=new WeakMap,Z=new WeakMap,ne=new WeakMap,ie=new WeakMap,fe=new WeakMap,be=new WeakMap,re=new WeakMap,B=new WeakMap,s=new WeakSet,Tr=function(){const t=this.getAttribute("value");if(t){const i=he(t);i&&m(this,y,i)}},Lr=function(){const t=this.headerAction==="none"?"":this.headerAction==="theme"?`<button type="button" class="pcp-header-btn pcp-theme-toggle" aria-label="Switch to light mode">${T}</button>`:`<button type="button" class="pcp-header-btn pcp-close" aria-label="Close">
5
+ <svg viewBox="0 0 16 16" fill="none" aria-hidden="true">
6
+ <path
7
+ d="M4.25 4.25L11.75 11.75M11.75 4.25L4.25 11.75"
8
+ stroke="currentColor"
9
+ stroke-width="1.5"
10
+ stroke-linecap="round"
11
+ />
12
+ </svg>
13
+ </button>`;l(this,$).innerHTML=`
14
+ <style>${at}</style>
15
+ <div class="pcp" part="container">
16
+ <header class="pcp-header">
17
+ <h2 class="pcp-title">Pretty Color Picker</h2>
18
+ ${t}
19
+ </header>
20
+ <div class="pcp-plane-wrap pcp-clip">
21
+ <canvas class="pcp-plane" width="240" height="180" aria-label="Color plane"></canvas>
22
+ <div class="pcp-cursor" aria-hidden="true"></div>
23
+ </div>
24
+ <div class="pcp-slider-wrapper">
25
+ <div class="pcp-slider pcp-clip pcp-hue-row" aria-label="Hue">
26
+ <div class="pcp-slider-fill pcp-slider-fill-hue"></div>
27
+ <div class="pcp-slider-handle"></div>
28
+ </div>
29
+ </div>
30
+ <div class="pcp-slider-wrapper">
31
+ <div class="pcp-slider pcp-clip pcp-alpha-row" aria-label="Opacity">
32
+ <div class="pcp-slider-fill pcp-slider-fill-alpha"></div>
33
+ <div class="pcp-slider-handle"></div>
34
+ </div>
35
+ </div>
36
+ <div class="pcp-tabs" role="tablist">
37
+ <div class="pcp-tabs-pill"></div>
38
+ ${ns.map(i=>`<button type="button" class="pcp-tab" role="tab" data-format="${i}">${is[i]}</button>`).join("")}
39
+ </div>
40
+ <div class="pcp-inputs">
41
+ <div class="pcp-swatch pcp-clip" aria-hidden="true">
42
+ <span class="pcp-swatch-fill"></span>
43
+ </div>
44
+ <div class="pcp-fields"></div>
45
+ <div class="pcp-field pcp-alpha-field">
46
+ <span class="pcp-field-label">A</span>
47
+ <input class="pcp-field-input pcp-alpha-input" type="text" inputmode="numeric" value="80%" aria-label="Opacity" />
48
+ </div>
49
+ </div>
50
+ <div class="pcp-history-section">
51
+ <p class="pcp-history-label">Last Used</p>
52
+ <div class="pcp-history"></div>
53
+ </div>
54
+ </div>
55
+ `,m(this,Pe,l(this,$).querySelector(".pcp-plane")),m(this,Ye,l(this,$).querySelector(".pcp-plane-wrap")),m(this,j,l(this,$).querySelector(".pcp-cursor")),m(this,K,l(this,$).querySelector(".pcp-hue-row")),m(this,q,l(this,K).querySelector(".pcp-slider-handle")),m(this,Q,l(this,$).querySelector(".pcp-alpha-row")),m(this,Ze,l(this,$).querySelector(".pcp-slider-fill-alpha")),m(this,Y,l(this,Q).querySelector(".pcp-slider-handle")),m(this,He,l(this,$).querySelector(".pcp-tabs-pill")),m(this,ee,l(this,$).querySelector(".pcp-fields")),m(this,Be,l(this,$).querySelector(".pcp-swatch-fill")),m(this,G,l(this,$).querySelector(".pcp-alpha-input")),m(this,Ee,l(this,$).querySelector(".pcp-history-section")),m(this,ue,l(this,$).querySelector(".pcp-history")),m(this,te,l(this,$).querySelector(".pcp-theme-toggle")),d(this,s,nt).call(this)},Sr=function(){d(this,s,Bn).call(this),l(this,I).push(Pn(l(this,Ye),(t,i)=>d(this,s,Rr).call(this,t,i),()=>d(this,s,se).call(this),()=>d(this,s,ae).call(this))),l(this,I).push(Pn(l(this,K),t=>d(this,s,qr).call(this,t),()=>d(this,s,se).call(this),()=>d(this,s,ae).call(this))),l(this,I).push(Pn(l(this,Q),t=>d(this,s,Fr).call(this,t),()=>d(this,s,se).call(this),()=>d(this,s,ae).call(this))),l(this,I).push(d(this,s,Wn).call(this,l(this,K))),l(this,I).push(d(this,s,Wn).call(this,l(this,Q))),l(this,$).querySelectorAll(".pcp-tab").forEach(t=>{t.addEventListener("click",()=>{const i=t.dataset.format;i&&i!==l(this,R)&&(m(this,R,i),d(this,s,Ie).call(this),d(this,s,ti).call(this),d(this,s,Rt).call(this),d(this,s,Nt).call(this))})}),l(this,G).addEventListener("focus",()=>d(this,s,ae).call(this)),l(this,G).addEventListener("change",()=>d(this,s,Gn).call(this)),l(this,G).addEventListener("keydown",t=>{t.key==="Enter"&&d(this,s,Gn).call(this)}),l(this,I).push(d(this,s,Br).call(this)),d(this,s,tt).call(this),d(this,s,Yn).call(this)},Xn=function(){this.popoverMode&&this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))},On=function(){const t=this.anchor;return t?es(t,this.ownerDocument):null},et=function(){m(this,fe,d(this,s,On).call(this)),l(this,fe)?(ts(this,l(this,fe)),this.setAttribute("data-positioned","")):(this.movable||this.popoverMode)&&(mr(this),this.setAttribute("data-positioned",""))},Dn=function(){if(l(this,ie)){const t=l(this,I).indexOf(l(this,ie));t>=0&&l(this,I).splice(t,1),l(this,ie).call(this),m(this,ie,null)}m(this,fe,null)},jn=function(){if(d(this,s,Dn).call(this),!this.popoverMode){this.removeAttribute("open"),this.movable||(this.style.position="",this.style.left="",this.style.top="",this.style.zIndex="");return}this.movable||(this.style.position="fixed",this.style.zIndex="1000");const t=d(this,s,On).call(this);m(this,fe,t);const i=c=>{c.preventDefault(),c.stopPropagation(),this.toggle()},r=c=>{if(!this.open)return;const p=c.composedPath();p.includes(this)||t&&p.includes(t)||this.hide()},a=c=>{c.key==="Escape"&&this.open&&(c.preventDefault(),d(this,s,Xn).call(this))},o=()=>{this.open&&d(this,s,et).call(this)};t==null||t.addEventListener("click",i),document.addEventListener("pointerdown",r,!0),document.addEventListener("keydown",a),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),m(this,ie,()=>{t==null||t.removeEventListener("click",i),document.removeEventListener("pointerdown",r,!0),document.removeEventListener("keydown",a),window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}),l(this,I).push(l(this,ie))},Yn=function(){if(!this.history){l(this,Ee).hidden=!0,l(this,ue).innerHTML="";return}d(this,s,qt).call(this)},tt=function(){if(l(this,ne)){const r=l(this,I).indexOf(l(this,ne));r>=0&&l(this,I).splice(r,1),l(this,ne).call(this),m(this,ne,null)}if(!(this.movable||this.popoverMode)){this.popoverMode||(this.style.position="",this.style.left="",this.style.top="",this.style.zIndex=""),this.removeAttribute("data-positioned");return}!this.popoverMode&&!this.hasAttribute("data-positioned")&&requestAnimationFrame(()=>{mr(this),this.setAttribute("data-positioned","")});const i=l(this,$).querySelector(".pcp-header");i&&(m(this,ne,Qo(i,this)),l(this,I).push(l(this,ne)))},ae=function(){m(this,Ce,{...l(this,y)})},Zn=function(){return this.theme==="light"?"light":this.theme==="dark"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},Cr=function(){const t=d(this,s,Zn).call(this)==="light"?"dark":"light";this.theme=t,d(this,s,nt).call(this);const i={theme:t};this.dispatchEvent(new CustomEvent("themechange",{detail:i,bubbles:!0,composed:!0}))},nt=function(){if(!l(this,te))return;const t=d(this,s,Zn).call(this)==="light";l(this,te).innerHTML=t?F:T,l(this,te).setAttribute("aria-label",t?"Switch to dark mode":"Switch to light mode")},Bn=function(){var r;(r=l(this,Z))==null||r.call(this),m(this,Z,null);const t=l(this,$).querySelector(".pcp-close");if(t){const a=()=>d(this,s,Xn).call(this);t.addEventListener("click",a),m(this,Z,()=>t.removeEventListener("click",a));return}const i=l(this,$).querySelector(".pcp-theme-toggle");if(i){const a=()=>d(this,s,Cr).call(this);i.addEventListener("click",a),m(this,Z,()=>i.removeEventListener("click",a))}},Pr=function(){var r,a;(r=l(this,Z))==null||r.call(this),m(this,Z,null);const t=l(this,$).querySelector(".pcp-header");if(!t||((a=t.querySelector(".pcp-header-btn"))==null||a.remove(),m(this,te,null),this.headerAction==="none"))return;const i=document.createElement("button");i.type="button",i.className=`pcp-header-btn ${this.headerAction==="theme"?"pcp-theme-toggle":"pcp-close"}`,t.appendChild(i),this.headerAction==="theme"?(m(this,te,i),d(this,s,nt).call(this)):(i.setAttribute("aria-label","Close"),i.innerHTML=`<svg viewBox="0 0 16 16" fill="none" aria-hidden="true">
56
+ <path
57
+ d="M4.25 4.25L11.75 11.75M11.75 4.25L4.25 11.75"
58
+ stroke="currentColor"
59
+ stroke-width="1.5"
60
+ stroke-linecap="round"
61
+ />
62
+ </svg>`),d(this,s,Bn).call(this)},Wn=function(t){const i=()=>{t.dataset.active="true"},r=()=>{const a=t.querySelector(".pcp-slider-handle");a!=null&&a.hasAttribute("data-dragging")||delete t.dataset.active};return t.addEventListener("pointerenter",i),t.addEventListener("pointerleave",r),()=>{t.removeEventListener("pointerenter",i),t.removeEventListener("pointerleave",r)}},Hr=function(t,i){const r=Math.max(0,Math.min(1,i))*100;t.style.left=`max(1px, calc(${r}% - 1.5px))`},Er=function(){const t=getComputedStyle(this),i=ur(t.getPropertyValue("--pcp-checker-base").trim())??{r:255,g:255,b:255},r=ur(t.getPropertyValue("--pcp-checker-tone").trim())??{r:204,g:204,b:204};return{base:i,tone:r}},Nr=function(t,i){const r=t.style.left.match(/calc\(([\d.]+)%/);return r?parseFloat(r[1])/100:i},Ir=function(t,i){if(i==="hue")return Ro(t);const{base:r,tone:a}=d(this,s,Er).call(this);return Ko(St(l(this,y)),t,r,a)},Ht=function(t,i,r){const a=d(this,s,Ir).call(this,i,r),{backgroundColor:o,boxShadow:c}=Uo(a.r,a.g,a.b);t.style.backgroundColor=o,t.style.boxShadow=c},it=function(t,i,r){d(this,s,Hr).call(this,t,i),d(this,s,Ht).call(this,t,i,r)},Rr=function(t,i){l(this,j).dataset.dragging="true";const r=d(this,s,we).call(this);d(this,s,oe).call(this,jo(t,i,r,l(this,y).alpha),!0,{refreshPlane:!1,refreshCursor:!1,refreshSliders:!1,syncPlaneHue:!1}),d(this,s,Kn).call(this,t,i)},qr=function(t){l(this,K).dataset.active="true",l(this,q).dataset.dragging="true",m(this,B,t*360),d(this,s,it).call(this,l(this,q),t,"hue"),d(this,s,oe).call(this,cr(l(this,y),l(this,B)),!0,{refreshPlane:!0,refreshCursor:!1,refreshSliders:!1,syncPlaneHue:!1})},Fr=function(t){l(this,Q).dataset.active="true",l(this,Y).dataset.dragging="true",d(this,s,oe).call(this,X({...l(this,y),alpha:t}),!0,{refreshPlane:!1,refreshSliders:!1,syncPlaneHue:!1}),d(this,s,it).call(this,l(this,Y),t,"alpha")},Xr=function(){const i=l(this,q).style.left.match(/calc\(([\d.]+)%/);return i?parseFloat(i[1])/100*360:l(this,B)},Et=function(){pe(l(this,y))||m(this,B,Fo(l(this,y)))},Gn=function(){const t=l(this,G).value.replace(/%/g,"").trim(),i=Number(t);if(Number.isNaN(i)){d(this,s,It).call(this);return}d(this,s,oe).call(this,X({...l(this,y),alpha:i/100}),!0),d(this,s,se).call(this)},Vn=function(t,i){d(this,s,Or).call(this,{[t]:i},!0)},Or=function(t,i=!0){const r={};je(l(this,y),l(this,R)).forEach(o=>{r[o.key]=t[o.key]??o.value});const a=_n(l(this,R),r,l(this,y));a&&(d(this,s,oe).call(this,a,!0),i&&d(this,s,se).call(this))},Dr=function(t,i){if(t.scrubStep!=null)return i?t.scrubStep*.1:t.scrubStep;const r=t.min??0,o=(t.max??100)-r,c=t.step!=null&&t.step<1?o/120:t.step??1;return i?c*.1:c},jr=function(t,i){return t.step!=null&&t.step<1?i.toFixed(3):String(Math.round(i))},Yr=function(t,i,r,a){const o=l(this,ee).querySelector(`.pcp-field-input[data-key="${t}"]`),c=je(l(this,y),l(this,R)),p=c.find(H=>H.key===t);if(!p)return;const f=i.min??0,b=i.max??100,x=d(this,s,Dr).call(this,i,a),v=Number(o?o.value.replace(/%/g,"").trim():p.value);let M=v+r*x;if(i.step!=null&&i.step<1?(M=Math.round(M/i.step)*i.step,M=Math.min(b,Math.max(f,M))):M=Math.min(b,Math.max(f,Math.round(M))),Math.abs(M-v)<(i.step!=null&&i.step<1?i.step/2:.5))return;const _=d(this,s,jr).call(this,i,M);let A=null;if(l(this,R)==="hsl"&&(t==="h"||t==="s"||t==="l"))A=Xo(l(this,y),t,M);else if(l(this,R)==="oklch"&&(t==="l"||t==="c"||t==="h"))A=Oo(l(this,y),t,M,l(this,B));else{const H={};c.forEach(C=>{H[C.key]=C.key===t?_:C.value}),A=_n(l(this,R),H,l(this,y))}if(!A)return;t==="h"&&m(this,B,D(M));const S=t==="h"||l(this,R)==="oklch"&&(t==="c"||t==="l");d(this,s,oe).call(this,A,!0,{refreshFields:!1,refreshCursor:!0,refreshSliders:!0,syncPlaneHue:!S}),o&&(o.value=_)},Zr=function(t,i){const r=i?.05:.5,a=l(this,y).alpha*100;let o=a+t*r;if(o=Math.min(100,Math.max(0,i?o:Math.round(o))),Math.abs(o-a)<.01)return;const c=o/100;d(this,s,oe).call(this,X({...l(this,y),alpha:c}),!0,{refreshFields:!1,refreshPlane:!1,refreshSliders:!1,syncPlaneHue:!1}),l(this,G).value=`${Math.round(o)}%`},Br=function(){const t=l(this,$).querySelector(".pcp-alpha-field .pcp-field-label");return t?br(t,{onStart:()=>{d(this,s,ae).call(this),t.setAttribute("data-scrubbing","true"),document.body.style.cursor="ew-resize"},onDelta:(i,r)=>d(this,s,Zr).call(this,i,r.shiftKey),onEnd:()=>{t.removeAttribute("data-scrubbing"),document.body.style.cursor="",d(this,s,se).call(this),d(this,s,It).call(this)}}):()=>{}},Wr=function(t){l(this,R)!=="hex"&&l(this,ee).querySelectorAll(".pcp-field-label").forEach(i=>{var c;const r=i.closest(".pcp-field");if(!r)return;const a=(c=[...r.classList].find(p=>p.startsWith("pcp-field-")&&p!=="pcp-field"))==null?void 0:c.slice(10);if(!a)return;const o=t.find(p=>p.key===a);!o||o.min==null||o.max==null||br(i,{onStart:()=>{d(this,s,ae).call(this),i.setAttribute("data-scrubbing","true"),document.body.style.cursor="ew-resize"},onDelta:(p,f)=>d(this,s,Yr).call(this,a,o,p,f.shiftKey),onEnd:()=>{i.removeAttribute("data-scrubbing"),document.body.style.cursor="",d(this,s,se).call(this),d(this,s,Rt).call(this)}})})},oe=function(t,i=!0,r){let a=X(t);pe(a)&&(a=Lt(a,l(this,B))),m(this,y,a),!(l(this,j).hasAttribute("data-dragging")||l(this,q).hasAttribute("data-dragging"))&&(r==null?void 0:r.syncPlaneHue)!==!1&&!pe(a)&&d(this,s,Et).call(this),d(this,s,Jn).call(this,i,r)},rt=function(t=!0){pe(l(this,y))||d(this,s,Et).call(this),d(this,s,Ie).call(this),d(this,s,ti).call(this),d(this,s,Jn).call(this,t),d(this,s,qt).call(this)},Jn=function(t,i){(i==null?void 0:i.refreshFields)!==!1&&d(this,s,Rt).call(this),d(this,s,Vr).call(this),(i==null?void 0:i.refreshSliders)!==!1&&d(this,s,Qn).call(this),(i==null?void 0:i.refreshCursor)!==!1&&!l(this,j).hasAttribute("data-dragging")&&d(this,s,Nt).call(this),(i==null?void 0:i.refreshPlane)===!0?d(this,s,Un).call(this):(i==null?void 0:i.refreshPlane)!==!1&&!l(this,j).hasAttribute("data-dragging")&&!l(this,q).hasAttribute("data-dragging")&&l(this,be)!==d(this,s,we).call(this)&&d(this,s,Un).call(this),t&&d(this,s,Jr).call(this)},Un=function(){l(this,re)==null&&m(this,re,requestAnimationFrame(()=>{m(this,re,null);const t=d(this,s,we).call(this);l(this,be)!==t&&(or(l(this,Pe),t),m(this,be,t))}))},we=function(){return l(this,q).hasAttribute("data-dragging")?d(this,s,Xr).call(this):l(this,B)},Ie=function(){const t=d(this,s,we).call(this);or(l(this,Pe),t),m(this,be,t)},Nt=function(){const{x:t,y:i}=Do(l(this,y));d(this,s,Kn).call(this,t,i)},Kn=function(t,i){l(this,j).style.left=`${t*100}%`,l(this,j).style.top=`${i*100}%`},Qn=function(){const i=d(this,s,we).call(this)/360;l(this,q).hasAttribute("data-dragging")?d(this,s,Ht).call(this,l(this,q),i,"hue"):d(this,s,it).call(this,l(this,q),i,"hue");const r=l(this,Y).hasAttribute("data-dragging")?d(this,s,Nr).call(this,l(this,Y),l(this,y).alpha):l(this,y).alpha;l(this,Y).hasAttribute("data-dragging")?d(this,s,Ht).call(this,l(this,Y),r,"alpha"):d(this,s,it).call(this,l(this,Y),r,"alpha"),d(this,s,Gr).call(this)},Gr=function(){l(this,Ze).style.setProperty("--pcp-alpha-gradient",qo(l(this,y)))},ei=function(t,i){const{r,g:a,b:o}=St(i);t.style.setProperty("--swatch-solid",`rgb(${r}, ${a}, ${o})`),t.style.setProperty("--swatch-alpha",`rgba(${r}, ${a}, ${o}, ${i.alpha})`)},Vr=function(){d(this,s,ei).call(this,l(this,Be),l(this,y))},It=function(){l(this,G).value=`${Math.round(l(this,y).alpha*100)}%`},Rt=function(){const t=je(l(this,y),l(this,R));l(this,ee).dataset.format=l(this,R),l(this,ee).innerHTML=t.map(i=>`
63
+ <div class="pcp-field pcp-field-${i.key}">
64
+ <span class="pcp-field-label">${i.label}</span>
65
+ <input
66
+ class="pcp-field-input"
67
+ type="text"
68
+ data-key="${i.key}"
69
+ value="${i.value}"
70
+ aria-label="${i.label}"
71
+ />
72
+ </div>
73
+ `).join(""),l(this,ee).querySelectorAll(".pcp-field-input").forEach(i=>{const r=i,a=r.dataset.key;r.addEventListener("focus",()=>d(this,s,ae).call(this)),r.addEventListener("change",()=>d(this,s,Vn).call(this,a,r.value)),r.addEventListener("keydown",o=>{o.key==="Enter"&&d(this,s,Vn).call(this,a,r.value)})}),d(this,s,Wr).call(this,t),d(this,s,It).call(this)},ti=function(){const t=l(this,$).querySelectorAll(".pcp-tab");let i=null;if(t.forEach(r=>{const a=r.dataset.format===l(this,R);r.setAttribute("data-active",String(a)),r.setAttribute("aria-selected",String(a)),a&&(i=r)}),i){const r=i,a=r.offsetLeft,o=r.offsetWidth;l(this,He).style.left=`${a}px`,l(this,He).style.width=`${o}px`}},qt=function(){this.history&&(l(this,Ee).hidden=l(this,U).length===0,l(this,ue).innerHTML=l(this,U).map((t,i)=>`
74
+ <button type="button" class="pcp-history-swatch pcp-clip" data-index="${i}" aria-label="Color ${Le(t)}">
75
+ <span class="pcp-swatch-fill" data-history-fill="${i}"></span>
76
+ </button>
77
+ `).join(""),l(this,ue).querySelectorAll("[data-history-fill]").forEach(t=>{const i=Number(t.dataset.historyFill),r=l(this,U)[i];r&&d(this,s,ei).call(this,t,r)}),l(this,ue).querySelectorAll(".pcp-history-swatch").forEach(t=>{t.addEventListener("click",()=>{const i=Number(t.dataset.index),r=l(this,U)[i];r&&(d(this,s,ae).call(this),d(this,s,oe).call(this,{...r},!0,{refreshFields:!0}),d(this,s,se).call(this))})}))},se=function(){const t=l(this,j).hasAttribute("data-dragging"),i=l(this,q).hasAttribute("data-dragging");delete l(this,j).dataset.dragging,delete l(this,q).dataset.dragging,delete l(this,Y).dataset.dragging,delete l(this,K).dataset.active,delete l(this,Q).dataset.active,(t||i)&&(pe(l(this,y))||d(this,s,Et).call(this),d(this,s,Qn).call(this),d(this,s,Nt).call(this),l(this,be)!==d(this,s,we).call(this)&&d(this,s,Ie).call(this));const r=l(this,Ce);m(this,Ce,null),this.history&&r&&!hr(r,l(this,y))&&(m(this,U,Zo(r,l(this,U))),d(this,s,qt).call(this))},Jr=function(){const t={color:{...l(this,y)},css:An(l(this,y)),hex:Le(l(this,y))};this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0}))},customElements.get("pretty-color-picker")||customElements.define("pretty-color-picker",yr),w.DEFAULT_COLOR=Cn,w.PrettyColorPicker=yr,w.formatFieldsFor=je,w.normalizeOklch=X,w.oklchFromCss=he,w.oklchToCss=An,w.oklchToHex=Le,w.oklchToRgbString=Io,w.parseFormatFields=_n,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})}));
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "pretty-color-picker",
3
+ "version": "0.1.0",
4
+ "description": "A perceptually accurate color picker. OKLCH storage, classic saturation × value plane.",
5
+ "type": "module",
6
+ "main": "./dist/pretty-color-picker.umd.cjs",
7
+ "module": "./dist/pretty-color-picker.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/pretty-color-picker.js",
13
+ "require": "./dist/pretty-color-picker.umd.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "dev": "vite --config vite.demo.config.ts",
21
+ "build": "tsc && vite build",
22
+ "build:demo": "vite build --config vite.demo.config.ts",
23
+ "check": "npx tsx scripts/check-release.ts",
24
+ "generate-favicon": "node scripts/generate-favicon.mjs",
25
+ "prepublishOnly": "npm run build",
26
+ "preview": "vite preview --config vite.demo.config.ts"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/kiiradesign/pretty-color-picker.git"
31
+ },
32
+ "homepage": "https://colors.kiira.in",
33
+ "bugs": {
34
+ "url": "https://github.com/kiiradesign/pretty-color-picker/issues"
35
+ },
36
+ "keywords": [
37
+ "color-picker",
38
+ "oklch",
39
+ "web-component",
40
+ "culori"
41
+ ],
42
+ "license": "MIT",
43
+ "devDependencies": {
44
+ "typescript": "^5.8.3",
45
+ "vite": "^6.3.5",
46
+ "vite-plugin-dts": "^4.5.4"
47
+ },
48
+ "dependencies": {
49
+ "culori": "^4.0.2"
50
+ }
51
+ }