hdr-color-input 0.3.1 → 0.3.2
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.
- package/dist/color-input.min.js +1 -1
- package/dist/color-input.min.js.map +1 -1
- package/dist/index.js +30 -32
- package/dist/index.js.map +1 -1
- package/docs/src/content/docs/advanced.mdx +9 -0
- package/docs/src/content/docs/api.mdx +36 -0
- package/docs/src/content/docs/index.mdx +4 -4
- package/docs/src/content/docs/styling.mdx +2 -0
- package/package.json +1 -1
package/dist/color-input.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* color-input web component - https://github.com/pops/css-color-component */
|
|
2
|
-
var ColorInput=function(e){"use strict";var t,n,r,a,o,i,s,l,c,h,u,p,d,g,f,m,b,v,y,w,x,M,k,$,S,C,L,A,E,B,R,z,I,W,H,q,P,j,T,O,N,D,G,F,X,Z,_,Y,V=Object.defineProperty,J=e=>{throw TypeError(e)},U=(e,t,n)=>((e,t,n)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),Q=(e,t,n)=>t.has(e)||J("Cannot "+n),K=(e,t,n)=>(Q(e,t,"read from private field"),n?n.call(e):t.get(e)),ee=(e,t,n)=>t.has(e)?J("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),te=(e,t,n,r)=>(Q(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ne=(e,t,n)=>(Q(e,t,"access private method"),n),re=Symbol.for("preact-signals");function ae(){if(le>1)le--;else{for(var e,t=!1;void 0!==se;){var n=se;for(se=void 0,ce++;void 0!==n;){var r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&ge(n))try{n.c()}catch(a){t||(e=a,t=!0)}n=r}}if(ce=0,le--,t)throw e}}var oe=void 0;function ie(e){var t=oe;oe=void 0;try{return e()}finally{oe=t}}var se=void 0,le=0,ce=0,he=0;function ue(e){if(void 0!==oe){var t=e.n;if(void 0===t||t.t!==oe)return t={i:0,S:e,p:oe.s,n:void 0,t:oe,e:void 0,x:void 0,r:t},void 0!==oe.s&&(oe.s.n=t),oe.s=t,e.n=t,32&oe.f&&e.S(t),t;if(-1===t.i)return t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=oe.s,t.n=void 0,oe.s.n=t,oe.s=t),t}}function pe(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function de(e,t){return new pe(e,t)}function ge(e){for(var t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function fe(e){for(var t=e.s;void 0!==t;t=t.n){var n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function me(e){for(var t=e.s,n=void 0;void 0!==t;){var r=t.p;-1===t.i?(t.S.U(t),void 0!==r&&(r.n=t.n),void 0!==t.n&&(t.n.p=r)):n=t,t.S.n=t.r,void 0!==t.r&&(t.r=void 0),t=r}e.s=n}function be(e,t){pe.call(this,void 0),this.x=e,this.s=void 0,this.g=he-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function ve(e,t){return new be(e,t)}function ye(e){var t=e.u;if(e.u=void 0,"function"==typeof t){le++;var n=oe;oe=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,we(e),r}finally{oe=n,ae()}}}function we(e){for(var t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ye(e)}function xe(e){if(oe!==this)throw new Error("Out-of-order effect");me(this),oe=e,this.f&=-2,8&this.f&&we(this),ae()}function Me(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function ke(e,t){var n=new Me(e,t);try{n.c()}catch(a){throw n.d(),a}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}function $e(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Se(e,t,n=[0,0,0]){const r=$e(e,t[0]),a=$e(e,t[1]),o=$e(e,t[2]);return n[0]=r,n[1]=a,n[2]=o,n}function Ce(e){return"string"===Le(e)}function Le(e){return(Object.prototype.toString.call(e).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function Ae(e,{precision:t=16,unit:n}){return Ee(e)?"none":(e=+Be(e,t))+(null!=n?n:"")}function Ee(e){return null===e}function Be(e,t){if(0===e)return 0;let n=~~e,r=0;n&&t&&(r=1+~~Math.log10(Math.abs(n)));const a=10**(t-r);return Math.floor(e*a+.5)/a}function Re(e,t,n){return isNaN(e)?t:isNaN(t)?e:e+(t-e)*n}function ze(e,t,n){return!e||!t||e===t||e[0]===t[0]&&e[1]===t[1]||isNaN(n)||null===n?n:Re(t[0],t[1],function(e,t,n){return(n-e)/(t-e)}(e[0],e[1],n))}function Ie(e,t,n){return Math.max(Math.min(n,t),e)}function We(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function He(e,t){return We(Math.abs(e)**t,e)}function qe(e,t){return 0===t?0:e/t}function Pe(e,t){var n;if(e instanceof t)return!0;const r=t.name;for(;e;){const t=Object.getPrototypeOf(e),a=null==(n=null==t?void 0:t.constructor)?void 0:n.name;if(a===r)return!0;if(!a||"Object"===a)return!1;e=t}return!1}pe.prototype.brand=re,pe.prototype.h=function(){return!0},pe.prototype.S=function(e){var t=this,n=this.t;n!==e&&void 0===e.e&&(e.x=n,this.t=e,void 0!==n?n.e=e:ie(function(){var e;null==(e=t.W)||e.call(t)}))},pe.prototype.U=function(e){var t=this;if(void 0!==this.t){var n=e.e,r=e.x;void 0!==n&&(n.x=r,e.e=void 0),void 0!==r&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,void 0===r&&ie(function(){var e;null==(e=t.Z)||e.call(t)}))}},pe.prototype.subscribe=function(e){var t=this;return ke(function(){var n=t.value,r=oe;oe=void 0;try{e(n)}finally{oe=r}},{name:"sub"})},pe.prototype.valueOf=function(){return this.value},pe.prototype.toString=function(){return this.value+""},pe.prototype.toJSON=function(){return this.value},pe.prototype.peek=function(){var e=oe;oe=void 0;try{return this.value}finally{oe=e}},Object.defineProperty(pe.prototype,"value",{get:function(){var e=ue(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(ce>100)throw new Error("Cycle detected");this.v=e,this.i++,he++,le++;try{for(var t=this.t;void 0!==t;t=t.x)t.t.N()}finally{ae()}}}}),be.prototype=new pe,be.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===he)return!0;if(this.g=he,this.f|=1,this.i>0&&!ge(this))return this.f&=-2,!0;var e=oe;try{fe(this),oe=this;var t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return oe=e,me(this),this.f&=-2,!0},be.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var t=this.s;void 0!==t;t=t.n)t.S.S(t)}pe.prototype.S.call(this,e)},be.prototype.U=function(e){if(void 0!==this.t&&(pe.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var t=this.s;void 0!==t;t=t.n)t.S.U(t)}},be.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(be.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=ue(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Me.prototype.c=function(){var e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var t=this.x();"function"==typeof t&&(this.u=t)}finally{e()}},Me.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ye(this),fe(this),le++;var e=oe;return oe=this,xe.bind(this,e)},Me.prototype.N=function(){2&this.f||(this.f|=2,this.o=se,se=this)},Me.prototype.d=function(){this.f|=8,1&this.f||we(this)},Me.prototype.dispose=function(){this.d()};class je{constructor(e,t){var n;if(U(this,"type"),U(this,"coordMeta"),U(this,"coordRange"),U(this,"range"),"object"==typeof e&&(this.coordMeta=e),t&&(this.coordMeta=t,this.coordRange=null!=(n=t.range)?n:t.refRange),"string"==typeof e){let t=e.trim().match(/^(?<type><[a-z]+>)(\[(?<min>-?[.\d]+),\s*(?<max>-?[.\d]+)\])?$/);if(!t)throw new TypeError(`Cannot parse ${e} as a type definition.`);this.type=t.groups.type;let{min:n,max:r}=t.groups;(n||r)&&(this.range=[+n,+r])}}get computedRange(){return this.range?this.range:"<percentage>"===this.type?this.percentageRange():"<angle>"===this.type?[0,360]:null}get unit(){return"<percentage>"===this.type?"%":"<angle>"===this.type?"deg":""}resolve(e){if("<angle>"===this.type)return e;let t=this.computedRange,n=this.coordRange;return"<percentage>"===this.type&&(null!=n||(n=this.percentageRange())),ze(t,n,e)}serialize(e,t){let n="<percentage>"===this.type?this.percentageRange(100):this.computedRange,r=this.unit;return Ae(e=ze(this.coordRange,n,e),{unit:r,precision:t})}toString(){let e=this.type;if(this.range){let[t="",n=""]=this.range;e+=`[${t},${n}]`}return e}percentageRange(e=1){let t;return t=this.coordMeta&&this.coordMeta.range||this.coordRange&&this.coordRange[0]>=0?[0,1]:[-1,1],[t[0]*e,t[1]*e]}static get(e,t){return Pe(e,this)?e:new this(e,t)}}const Te=Symbol("instance");class Oe{constructor(e,t=e.space){U(this,"type"),U(this,"name"),U(this,"spaceCoords"),U(this,"coords"),U(this,"id"),U(this,"alpha"),e[Te]=this,this.type="function",this.name="color",Object.assign(this,e),this.space=t,"custom"!==this.type&&(this.spaceCoords=Object.values(t.coords),this.coords||(this.coords=this.spaceCoords.map(e=>{let t=["<number>","<percentage>"];return"angle"===e.type&&t.push("<angle>"),t})),this.coords=this.coords.map((e,t)=>{let n=this.spaceCoords[t];return"string"==typeof e&&(e=e.trim().split(/\s*\|\s*/)),e.map(e=>je.get(e,n))}))}serializeCoords(e,t,n){return n=e.map((e,t)=>{var r;return je.get(null!=(r=null==n?void 0:n[t])?r:this.coords[t][0],this.spaceCoords[t])}),e.map((e,r)=>n[r].serialize(e,t))}coerceCoords(e,t){return Object.entries(this.space.coords).map(([n,r],a)=>{var o;let i=e[a];if(Ee(i)||isNaN(i))return i;let s=t[a],l=this.coords[a].find(e=>e.type==s);if(!l){let e=r.name||n;throw new TypeError(`${null!=(o=null!=s?s:null==i?void 0:i.raw)?o:i} not allowed for ${e} in ${this.name}()`)}return i=l.resolve(i),l.range&&(t[a]=l.toString()),i})}canSerialize(){return"function"===this.type||this.serialize}parse(e){return null}static get(e,...t){return!e||Pe(e,this)?e:e[Te]?e[Te]:new Oe(e,...t)}}const Ne=new class{add(e,t,n){if("string"==typeof arguments[0])(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][n?"unshift":"push"](t)},this);else for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1])}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},De={D50:[.3457/.3585,1,.2958/.3585],D65:[.3127/.329,1,.3583/.329]};function Ge(e){return Array.isArray(e)?e:De[e]}function Fe(e,t,n,r={}){if(e=Ge(e),t=Ge(t),!e||!t)throw new TypeError(`Missing white point to convert ${e?"":"from"}${e||t?"":"/"}${t?"":"to"}`);if(e===t)return n;let a={W1:e,W2:t,XYZ:n,options:r};if(Ne.run("chromatic-adaptation-start",a),a.M||(a.W1===De.D65&&a.W2===De.D50?a.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:a.W1===De.D50&&a.W2===De.D65&&(a.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),Ne.run("chromatic-adaptation-end",a),a.M)return Se(a.XYZ,a.M);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const Xe={gamut_mapping:"css",precision:5,deltaE:"76",verbose:"test"!==(null==(r=null==(n=null==(t=null==globalThis?void 0:globalThis.process)?void 0:t.env)?void 0:n.NODE_ENV)?void 0:r.toLowerCase()),warn:function(e){var t,n;this.verbose&&(null==(n=null==(t=null==globalThis?void 0:globalThis.console)?void 0:t.warn)||n.call(t,e))}};function Ze(e,t){var n,r,a,o;let i,s={str:null==(n=String(e))?void 0:n.trim(),options:t};if(Ne.run("parse-start",s),s.color)return s.color;s.parsed=function(e){if(!e)return;let t=(e=e.trim()).match(Ye.function);if(t){let e=[],n=[],r=!1,a=t[1].toLowerCase(),o=t[2].replace(Ye.singleArgument,(t,o)=>{let{value:i,meta:s}=function(e){var t;let n={},r=null==(t=e.match(Ye.unitValue))?void 0:t[0],a=n.raw=e;return r?(n.type="%"===r?"<percentage>":"<angle>",n.unit=r,n.unitless=Number(a.slice(0,-r.length)),a=n.unitless*_e[r]):Ye.number.test(a)?(a=Number(a),n.type="<number>"):"none"===a?a=null:"NaN"===a||"calc(NaN)"===a?(a=NaN,n.type="<number>"):n.type="<ident>",{value:a,meta:n}}(o);return(t.startsWith("/")||"color"!==a&&3===e.length)&&(r=!0),e.push(i),n.push(s),""});return{name:a,args:e,argMeta:n,lastAlpha:r,commas:o.includes(","),rawName:t[1],rawArgs:t[2]}}}(s.str);let l=s.options?null!=(r=s.options.parseMeta)?r:s.options.meta:null;if(s.parsed){let t,n,r=s.parsed.name,c=s.parsed.args,h=c.map((e,t)=>{var n;return null==(n=s.parsed.argMeta[t])?void 0:n.type});if("color"===r){let i=c.shift();h.shift();let l=i.startsWith("--")?i.substring(2):`--${i}`,u=[i,l];if(t=Ue.findFormat({name:r,id:u,type:"function"}),!t){let t,n=i in Ue.registry?i:l;if(n in Ue.registry){let r=null==(o=null==(a=Ue.registry[n].formats)?void 0:a.color)?void 0:o.id;r&&(t=`Did you mean ${e.replace("color("+i,"color("+r)}?`)}throw new TypeError(`Cannot parse ${s.str}. `+(null!=t?t:"Missing a plugin?"))}n=t.space,t.id.startsWith("--")&&!i.startsWith("--")&&Xe.warn(`${n.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${t.id}) instead of color(${i}).`),i.startsWith("--")&&!t.id.startsWith("--")&&Xe.warn(`${n.name} is a standard space and supported in the CSS spec. Use color(${t.id}) instead of prefixed color(${i}).`)}else t=Ue.findFormat({name:r,type:"function"}),n=t.space;l&&Object.assign(l,{format:t,formatId:t.name,types:h,commas:s.parsed.commas});let u=1;s.parsed.lastAlpha&&(u=s.parsed.args.pop(),l&&(l.alphaType=h.pop()));let p=t.coords.length;if(c.length!==p)throw new TypeError(`Expected ${p} coordinates for ${n.id} in ${s.str}), got ${c.length}`);c=t.coerceCoords(c,h),i={spaceId:n.id,coords:c,alpha:u}}else e:for(let c of Ue.all)for(let e in c.formats){let t=c.formats[e];if("custom"!==t.type)continue;if(t.test&&!t.test(s.str))continue;let n=c.getFormat(t),r=n.parse(s.str);if(r){l&&Object.assign(l,{format:n,formatId:e}),i=r;break e}}if(!i)throw new TypeError(`Could not parse ${e} as a color. Missing a plugin?`);return i.alpha=Ee(i.alpha)?i.alpha:void 0===i.alpha?1:Ie(0,i.alpha,1),i}const _e={"%":.01,deg:1,grad:.9,rad:180/Math.PI,turn:360},Ye={function:/^([a-z]+)\(((?:calc\(NaN\)|.)+?)\)$/i,number:/^([-+]?(?:[0-9]*\.)?[0-9]+(e[-+]?[0-9]+)?)$/i,unitValue:RegExp(`(${Object.keys(_e).join("|")})$`),singleArgument:/\/?\s*(none|NaN|calc\(NaN\)|[-+\w.]+(?:%|deg|g?rad|turn)?)/g};function Ve(e,t){if(Array.isArray(e))return e.map(e=>Ve(e,t));if(!e)throw new TypeError("Empty color reference");Ce(e)&&(e=Ze(e,t));let n=e.space||e.spaceId;return"string"==typeof n&&(e.space=Ue.get(n)),void 0===e.alpha&&(e.alpha=1),e}const Je=class e{constructor(t){var n,r,a,o,i,s;this.id=t.id,this.name=t.name,this.base=t.base?e.get(t.base):null,this.aliases=t.aliases,this.base&&(this.fromBase=t.fromBase,this.toBase=t.toBase);let l=null!=(n=t.coords)?n:this.base.coords;for(let e in l)"name"in l[e]||(l[e].name=e);this.coords=l;let c=null!=(a=null!=(r=t.white)?r:this.base.white)?a:"D65";this.white=Ge(c),this.formats=null!=(o=t.formats)?o:{};for(let e in this.formats){let t=this.formats[e];t.type||(t.type="function"),t.name||(t.name=e)}(null==(i=this.formats.color)?void 0:i.id)||(this.formats.color={...null!=(s=this.formats.color)?s:{},id:t.cssId||this.id}),t.gamutSpace?this.gamutSpace="self"===t.gamutSpace?this:e.get(t.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(e,t)=>!0),this.referred=t.referred,Object.defineProperty(this,"path",{value:Qe(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),Ne.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=75e-6}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let n=Object.values(this.coords);return e.every((e,r)=>{let a=n[r];if("angle"!==a.type&&a.range){if(Ee(e))return!0;let[n,r]=a.range;return(void 0===n||e>=n-t)&&(void 0===r||e<=r+t)}return!0})}get isUnbounded(){return Object.values(this.coords).every(e=>!("range"in e))}get cssId(){var e,t;return(null==(t=null==(e=this.formats)?void 0:e.color)?void 0:t.id)||this.id}get isPolar(){for(let e in this.coords)if("angle"===this.coords[e].type)return!0;return!1}getFormat(e){if(!e)return null;"default"===e?e=Object.values(this.formats)[0]:"string"==typeof e&&(e=this.formats[e]);let t=Oe.get(e,this);return t!==e&&e.name in this.formats&&(this.formats[e.name]=t),t}equals(e){return!!e&&(this===e||this.id===e||this.id===e.id)}to(t,n){if(1===arguments.length){const e=Ve(t);[t,n]=[e.space,e.coords]}if(t=e.get(t),this.equals(t))return n;n=n.map(e=>Ee(e)?0:e);let r,a,o=this.path,i=t.path;for(let e=0;e<o.length&&o[e].equals(i[e]);e++)r=o[e],a=e;if(!r)throw new Error(`Cannot convert between color spaces ${this} and ${t}: no connection space was found`);for(let e=o.length-1;e>a;e--)n=o[e].toBase(n);for(let e=a+1;e<i.length;e++)n=i[e].fromBase(n);return n}from(t,n){if(1===arguments.length){const e=Ve(t);[t,n]=[e.space,e.coords]}return(t=e.get(t)).to(this,n)}toString(){return`${this.name} (${this.id})`}getMinCoords(){var e;let t=[];for(let n in this.coords){let r=this.coords[n],a=r.range||r.refRange;t.push(null!=(e=null==a?void 0:a.min)?e:0)}return t}static get all(){return[...new Set(Object.values(e.registry))]}static register(e,t){if(1===arguments.length&&(e=(t=arguments[0]).id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,1===arguments.length&&t.aliases)for(let n of t.aliases)this.register(n,t);return t}static get(t,...n){if(!t||Pe(t,this))return t;if("string"===Le(t)){let n=e.registry[t.toLowerCase()];if(!n)throw new TypeError(`No color space found with id = "${t}"`);return n}if(n.length)return e.get(...n);throw new TypeError(`${t} is not a valid color space`)}static findFormat(t,n=e.all){if(!t)return null;"string"==typeof t&&(t={name:t});for(let e of n)for(let[n,r]of Object.entries(e.formats)){null!=r.name||(r.name=n),null!=r.type||(r.type="function");let a=!(t.name&&r.name!==t.name||t.type&&r.type!==t.type);if(t.id){let e=r.ids||[r.id],n=Array.isArray(t.id)?t.id:[t.id];a&&(a=n.some(t=>e.includes(t)))}if(a){let t=Oe.get(r,e);return t!==r&&(e.formats[r.name]=t),t}}return null}static resolveCoord(t,n){var r;let a,o,i=Le(t);if("string"===i?t.includes(".")?[a,o]=t.split("."):[a,o]=[,t]:Array.isArray(t)?[a,o]=t:(a=t.space,o=t.coordId),a=e.get(a),a||(a=n),!a)throw new TypeError(`Cannot resolve coordinate reference ${t}: No color space specified and relative references are not allowed here`);if(i=Le(o),"number"===i||"string"===i&&o>=0){let e=Object.entries(a.coords)[o];if(e)return{space:a,id:e[0],index:o,...e[1]}}a=e.get(a);let s=o.toLowerCase(),l=0;for(let e in a.coords){let t=a.coords[e];if(e.toLowerCase()===s||(null==(r=t.name)?void 0:r.toLowerCase())===s)return{space:a,id:e,index:l,...t};l++}throw new TypeError(`No "${o}" coordinate found in ${a.name}. Its coordinates are: ${Object.keys(a.coords).join(", ")}`)}};U(Je,"registry",{}),U(Je,"DEFAULT_FORMAT",{type:"functions",name:"color"});let Ue=Je;function Qe(e){let t=[e];for(let n=e;n=n.base;)t.push(n);return t}const Ke=new Ue({id:"xyz-d65",name:"XYZ D65",coords:{x:{refRange:[0,1],name:"X"},y:{refRange:[0,1],name:"Y"},z:{refRange:[0,1],name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class et extends Ue{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=Ke),e.toXYZ_M&&e.fromXYZ_M&&(null!=e.toBase||(e.toBase=t=>{let n=Se(t,e.toXYZ_M);return this.white!==this.base.white&&(n=Fe(this.white,this.base.white,n)),n}),null!=e.fromBase||(e.fromBase=t=>Se(t=Fe(this.base.white,this.white,t),e.fromXYZ_M))),null!=e.referred||(e.referred="display"),super(e)}}function tt(e,t){e=Ve(e);let n,r=Ue.get(t,null==t?void 0:t.space),a=null==t?void 0:t.precision;return n=!r||e.space.equals(r)?e.coords.slice():r.from(e),void 0===a?n:n.map(e=>Be(e,a))}function nt(e,t){var n;if(e=Ve(e),"alpha"===t)return null!=(n=e.alpha)?n:1;let{space:r,index:a}=Ue.resolveCoord(t,e.space);return tt(e,r)[a]}function rt(e,t,n,r){return e=Ve(e),Array.isArray(t)&&([t,n,r]=[e.space,t,n]),t=Ue.get(t),e.coords=t===e.space?n.slice():t.to(e.space,n),void 0!==r&&(e.alpha=r),e}function at(e,t,n){if(e=Ve(e),2===arguments.length&&"object"===Le(arguments[1])){let t=arguments[1];for(let n in t)at(e,n,t[n])}else if("function"==typeof n&&(n=n(nt(e,t))),"alpha"===t)e.alpha=n;else{let{space:r,index:a}=Ue.resolveCoord(t,e.space),o=tt(e,r);o[a]=n,rt(e,r,o)}return e}rt.returns="color",at.returns="color";const ot=new Ue({id:"xyz-d50",name:"XYZ D50",white:"D50",base:Ke,fromBase:e=>Fe(Ke.white,"D50",e),toBase:e=>Fe("D50",Ke.white,e)}),it=216/24389,st=24/116,lt=24389/27;let ct=De.D50;const ht=new Ue({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:ct,base:ot,fromBase(e){let t=e.map((e,t)=>e/ct[t]).map(e=>e>it?Math.cbrt(e):(lt*e+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(e){let[t,n,r]=e,a=[];return a[1]=(t+16)/116,a[0]=n/500+a[1],a[2]=a[1]-r/200,[a[0]>st?Math.pow(a[0],3):(116*a[0]-16)/lt,e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/lt,a[2]>st?Math.pow(a[2],3):(116*a[2]-16)/lt].map((e,t)=>e*ct[t])},formats:{lab:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <percentage>"]}}});function ut(e){return"number"!=typeof e?e:(e%360+360)%360}const pt=new Ue({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:ht,fromBase(e){if(void 0===this.ε){let e=Object.values(this.base.coords)[1].refRange,t=e[1]-e[0];this.ε=t/1e5}let[t,n,r]=e,a=Math.abs(n)<this.ε&&Math.abs(r)<this.ε,o=a?null:ut(180*Math.atan2(r,n)/Math.PI);return[t,a?0:Math.sqrt(n**2+r**2),o]},toBase(e){let[t,n,r]=e,a=null,o=null;return Ee(r)||(n=n<0?0:n,a=n*Math.cos(r*Math.PI/180),o=n*Math.sin(r*Math.PI/180)),[t,a,o]},formats:{lch:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <angle>"]}}}),dt=25**7,gt=Math.PI,ft=180/gt,mt=gt/180;function bt(e){const t=e*e;return t*t*t*e}function vt(e,t,{kL:n=1,kC:r=1,kH:a=1}={}){[e,t]=Ve([e,t]);let[o,i,s]=ht.from(e),l=pt.from(ht,[o,i,s])[1],[c,h,u]=ht.from(t),p=pt.from(ht,[c,h,u])[1];l<0&&(l=0),p<0&&(p=0);let d=bt((l+p)/2),g=.5*(1-Math.sqrt(d/(d+dt))),f=(1+g)*i,m=(1+g)*h,b=Math.sqrt(f**2+s**2),v=Math.sqrt(m**2+u**2),y=0===f&&0===s?0:Math.atan2(s,f),w=0===m&&0===u?0:Math.atan2(u,m);y<0&&(y+=2*gt),w<0&&(w+=2*gt),y*=ft,w*=ft;let x,M=c-o,k=v-b,$=w-y,S=y+w,C=Math.abs($);b*v===0?x=0:C<=180?x=$:$>180?x=$-360:$<-180?x=$+360:Xe.warn("the unthinkable has happened");let L,A=2*Math.sqrt(v*b)*Math.sin(x*mt/2),E=(o+c)/2,B=(b+v)/2,R=bt(B);L=b*v===0?S:C<=180?S/2:S<360?(S+360)/2:(S-360)/2;let z=(E-50)**2,I=1+.015*z/Math.sqrt(20+z),W=1+.045*B,H=1;H-=.17*Math.cos((L-30)*mt),H+=.24*Math.cos(2*L*mt),H+=.32*Math.cos((3*L+6)*mt),H-=.2*Math.cos((4*L-63)*mt);let q=1+.015*B*H,P=30*Math.exp(-1*((L-275)/25)**2),j=2*Math.sqrt(R/(R+dt)),T=(M/(n*I))**2;return T+=(k/(r*W))**2,T+=(A/(a*q))**2,T+=-1*Math.sin(2*P*mt)*j*(k/(r*W))*(A/(a*q)),Math.sqrt(T)}const yt=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],wt=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],xt=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],Mt=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],kt=new Ue({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:Ke,fromBase(e){let t=Se(e,yt);return t[0]=Math.cbrt(t[0]),t[1]=Math.cbrt(t[1]),t[2]=Math.cbrt(t[2]),Se(t,xt,t)},toBase(e){let t=Se(e,Mt);return t[0]=t[0]**3,t[1]=t[1]**3,t[2]=t[2]**3,Se(t,wt,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <percentage>"]}}});function $t(e,t){[e,t]=Ve([e,t]);let[n,r,a]=kt.from(e),[o,i,s]=kt.from(t),l=n-o,c=r-i,h=a-s;return Math.sqrt(l**2+c**2+h**2)}function St(e,t,{epsilon:n=75e-6}={}){e=Ve(e),t||(t=e.space),t=Ue.get(t);let r=e.coords;return t!==e.space&&(r=t.from(e)),t.inGamut(r,{epsilon:n})}function Ct(e){return{space:e.space,coords:e.coords.slice(),alpha:e.alpha}}const Lt=Math.PI/180,At=new Ue({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:Ke,fromBase:e=>e.map(e=>203*e),toBase:e=>e.map(e=>e/203)}),Et=1.15,Bt=.66,Rt=2610/16384,zt=16384/2610,It=.8359375,Wt=2413/128,Ht=18.6875,qt=1.7*2523/32,Pt=32/(1.7*2523),jt=-.56,Tt=16295499532821565e-27,Ot=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],Nt=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],Dt=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],Gt=[[1,.13860504327153927,.05804731615611883],[1,-.1386050432715393,-.058047316156118904],[1,-.09601924202631895,-.811891896056039]],Ft=new Ue({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.21,.21]},bz:{refRange:[-.21,.21]}},base:At,fromBase(e){let[t,n,r]=e,a=Se([Et*t-(Et-1)*r,Bt*n-(Bt-1)*t,r],Ot).map(function(e){let t=It+Wt*He(e/1e4,Rt),n=1+Ht*He(e/1e4,Rt);return He(t/n,qt)}),[o,i,s]=Se(a,Dt);return[(1+jt)*o/(1+jt*o)-Tt,i,s]},toBase(e){let[t,n,r]=e,a=Se([(t+Tt)/(1+jt-jt*(t+Tt)),n,r],Gt).map(function(e){let t=It-He(e,Pt),n=Ht*He(e,Pt)-Wt;return 1e4*He(t/n,zt)}),[o,i,s]=Se(a,Nt),l=(o+(Et-1)*s)/Et;return[l,(i+(Bt-1)*l)/Bt,s]},formats:{jzazbz:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <percentage>"]}}}),Xt=new Ue({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,.26],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:Ft,fromBase:pt.fromBase,toBase:pt.toBase,formats:{jzczhz:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <angle>"]}}}),Zt=.8359375,_t=2413/128,Yt=18.6875,Vt=2610/16384,Jt=16384/2610,Ut=32/2523,Qt=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],Kt=[[.5,.5,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],en=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],tn=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]],nn=new Ue({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:At,fromBase:e=>{return t=Se(e,Qt),Se(t.map(function(e){return((Zt+_t*(e/1e4)**Vt)/(1+Yt*(e/1e4)**Vt))**78.84375}),Kt);var t},toBase(e){let t=function(e){return Se(e,en).map(function(e){return 1e4*(Math.max(e**Ut-Zt,0)/(_t-Yt*e**Ut))**Jt})}(e);return Se(t,tn)},formats:{ictcp:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <percentage>"]}}}),rn=De.D65,an=1/.42,on=2*Math.PI,sn=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],ln=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],cn=[[460,451,288],[460,-891,-261],[460,-220,-6300]],hn={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},un={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},pn=180/Math.PI,dn=Math.PI/180;function gn(e,t){return e.map(e=>{const n=He(t*Math.abs(e)*.01,.42);return 400*We(n,e)/(n+27.13)})}function fn(e,t,n,r,a){const o={};o.discounting=a,o.refWhite=e,o.surround=r;const i=e.map(e=>100*e);o.la=t,o.yb=n;const s=i[1],l=Se(i,sn);let c=hn[o.surround];const h=c[0];o.c=c[1],o.nc=c[2];const u=(1/(5*o.la+1))**4;o.fl=u*o.la+.1*(1-u)*(1-u)*Math.cbrt(5*o.la),o.flRoot=o.fl**.25,o.n=o.yb/s,o.z=1.48+Math.sqrt(o.n),o.nbb=.725*o.n**-.2,o.ncb=o.nbb;const p=Math.max(Math.min(h*(1-1/3.6*Math.exp((-o.la-42)/92)),1),0);o.dRgb=l.map(e=>Re(1,s/e,p)),o.dRgbInv=o.dRgb.map(e=>1/e);const d=gn(l.map((e,t)=>e*o.dRgb[t]),o.fl);return o.aW=o.nbb*(2*d[0]+d[1]+.05*d[2]),o}const mn=fn(rn,64/Math.PI*.2,20,"average",!1);function bn(e,t){if(!(void 0!==e.J^void 0!==e.Q))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(void 0!==e.C^void 0!==e.M^void 0!==e.s))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(void 0!==e.h^void 0!==e.H))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(0===e.J||0===e.Q)return[0,0,0];let n=0;n=void 0!==e.h?ut(e.h)*dn:function(e){let t=(e%400+400)%400;const n=Math.floor(.01*t);t%=100;const[r,a]=un.h.slice(n,n+2),[o,i]=un.e.slice(n,n+2);return ut((t*(i*r-o*a)-100*r*i)/(t*(i-o)-100*i))}(e.H)*dn;const r=Math.cos(n),a=Math.sin(n);let o=0;void 0!==e.J?o=.1*He(e.J,.5):void 0!==e.Q&&(o=.25*t.c*e.Q/((t.aW+4)*t.flRoot));let i=0;void 0!==e.C?i=e.C/o:void 0!==e.M?i=e.M/t.flRoot/o:void 0!==e.s&&(i=4e-4*e.s**2*(t.aW+4)/t.c);const s=He(i*Math.pow(1.64-Math.pow(.29,t.n),-.73),10/9),l=.25*(Math.cos(n+2)+3.8),c=t.aW*He(o,2/t.c/t.z),h=5e4/13*t.nc*t.ncb*l,u=c/t.nbb,p=23*(u+.305)*qe(s,23*h+s*(11*r+108*a)),d=function(e,t){const n=100/t*2588.068098016295;return e.map(e=>{const t=Math.abs(e);return We(n*He(t/(400-t),an),e)})}(Se([u,p*r,p*a],cn).map(e=>1*e/1403),t.fl);return Se(d.map((e,n)=>e*t.dRgbInv[n]),ln).map(e=>e/100)}function vn(e,t){const n=gn(Se(e.map(e=>100*e),sn).map((e,n)=>e*t.dRgb[n]),t.fl),r=n[0]+(-12*n[1]+n[2])/11,a=(n[0]+n[1]-2*n[2])/9,o=(Math.atan2(a,r)%on+on)%on,i=.25*(Math.cos(o+2)+3.8),s=He(5e4/13*t.nc*t.ncb*qe(i*Math.sqrt(r**2+a**2),n[0]+n[1]+1.05*n[2]+.305),.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),l=He(t.nbb*(2*n[0]+n[1]+.05*n[2])/t.aW,.5*t.c*t.z),c=100*He(l,2),h=4/t.c*l*(t.aW+4)*t.flRoot,u=s*l,p=u*t.flRoot,d=ut(o*pn),g=function(e){let t=ut(e);t<=un.h[0]&&(t+=360);const n=function(e,t,n=0,r=e.length){for(;n<r;){const a=n+r>>1;e[a]<t?n=a+1:r=a}return n}(un.h,t)-1,[r,a]=un.h.slice(n,n+2),[o,i]=un.e.slice(n,n+2),s=(t-r)/o;return un.H[n]+100*s/(s+(a-t)/i)}(d);return{J:c,C:u,h:d,s:50*He(t.c*s/(t.aW+4),.5),Q:h,M:p,H:g}}new Ue({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Ke,fromBase(e){void 0===this.ε&&(this.ε=Object.values(this.coords)[1].refRange[1]/1e5);const t=vn(e,mn),n=Math.abs(t.M)<this.ε;return[t.J,n?0:t.M,n?null:t.h]},toBase:e=>bn({J:e[0],M:e[1],h:e[2]},mn)});const yn=216/24389,wn=24389/27;function xn(e){return e>8?Math.pow((e+16)/116,3):e/wn}const Mn=fn(De.D65,200/Math.PI*xn(50),100*xn(50),"average",!1),kn=new Ue({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:Ke,fromBase(e){void 0===this.ε&&(this.ε=Object.values(this.coords)[1].refRange[1]/1e5);let t=function(e){const t=116*((n=e[1])>yn?Math.cbrt(n):(wn*n+16)/116)-16;var n;if(0===t)return[0,0,0];const r=vn(e,Mn);return[ut(r.h),r.C,t]}(e);return t[1]<this.ε&&(t[1]=0,t[0]=null),t},toBase:e=>function(e,t){let[n,r,a]=e,o=[],i=0;if(0===a)return[0,0,0];let s=xn(a);i=a>0?.00379058511492914*a**2+.608983189401032*a+.9155088574762233:9514440756550361e-21*a**2+.08693057439788597*a-21.928975842194614;let l=0,c=1/0;for(;l<=15;){o=bn({J:i,C:r,h:n},t);const e=Math.abs(o[1]-s);if(e<c){if(e<=2e-12)return o;c=e}i-=(o[1]-s)*i/(2*o[1]),l+=1}return bn({J:i,C:r,h:n},t)}(e,Mn),formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),$n=Math.PI/180,Sn=[1,.007,.0228];function Cn(e){e[1]<0&&(e=kn.fromBase(kn.toBase(e)));const t=Math.log(Math.max(1+Sn[2]*e[1]*Mn.flRoot,1))/Sn[2],n=e[0]*$n,r=t*Math.cos(n),a=t*Math.sin(n);return[e[2],r,a]}const Ln={deltaE76:function(e,t){return function(e,t,n="lab"){let r=(n=Ue.get(n)).from(e),a=n.from(t);return Math.sqrt(r.reduce((e,t,n)=>{let r=a[n];return Ee(t)||Ee(r)?e:e+(r-t)**2},0))}(e,t,"lab")},deltaECMC:function(e,t,{l:n=2,c:r=1}={}){[e,t]=Ve([e,t]);let[a,o,i]=ht.from(e),[,s,l]=pt.from(ht,[a,o,i]),[c,h,u]=ht.from(t),p=pt.from(ht,[c,h,u])[1];s<0&&(s=0),p<0&&(p=0);let d=a-c,g=s-p,f=(o-h)**2+(i-u)**2-g**2,m=.511;a>=16&&(m=.040975*a/(1+.01765*a));let b,v=.0638*s/(1+.0131*s)+.638;Ee(l)&&(l=0),b=l>=164&&l<=345?.56+Math.abs(.2*Math.cos((l+168)*Lt)):.36+Math.abs(.4*Math.cos((l+35)*Lt));let y=Math.pow(s,4),w=Math.sqrt(y/(y+1900)),x=(d/(n*m))**2;return x+=(g/(r*v))**2,x+=f/(v*(w*b+1-w))**2,Math.sqrt(x)},deltaE2000:vt,deltaEJz:function(e,t){[e,t]=Ve([e,t]);let[n,r,a]=Xt.from(e),[o,i,s]=Xt.from(t),l=n-o,c=r-i;Ee(a)&&Ee(s)?(a=0,s=0):Ee(a)?a=s:Ee(s)&&(s=a);let h=a-s,u=2*Math.sqrt(r*i)*Math.sin(h/2*(Math.PI/180));return Math.sqrt(l**2+c**2+u**2)},deltaEITP:function(e,t){[e,t]=Ve([e,t]);let[n,r,a]=nn.from(e),[o,i,s]=nn.from(t);return 720*Math.sqrt((n-o)**2+.25*(r-i)**2+(a-s)**2)},deltaEOK:$t,deltaEOK2:function(e,t){[e,t]=Ve([e,t]);let[n,r,a]=kt.from(e),[o,i,s]=kt.from(t),l=n-o,c=2*(r-i),h=2*(a-s);return Math.sqrt(l**2+c**2+h**2)},deltaEHCT:function(e,t){[e,t]=Ve([e,t]);let[n,r,a]=Cn(kn.from(e)),[o,i,s]=Cn(kn.from(t));return Math.sqrt((n-o)**2+(r-i)**2+(a-s)**2)}},An={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function En(e,{method:t=Xe.gamut_mapping,space:n,deltaEMethod:r="",jnd:a=2,blackWhiteClamp:o}={}){if(e=Ve(e),Ce(arguments[1])?n=arguments[1]:n||(n=e.space),St(e,n=Ue.get(n),{epsilon:0}))return e;let i;if("css"===t)i=function(e,{space:t}={}){const n=.02,r=1e-4;e=Ve(e),t||(t=e.space),t=Ue.get(t);const a=Ue.get("oklch");if(t.isUnbounded)return Rn(e,t);const o=Rn(e,a);let i=o.coords[0];if(i>=1){const n=Rn(Bn.WHITE,t);return n.alpha=e.alpha,Rn(n,t)}if(i<=0){const n=Rn(Bn.BLACK,t);return n.alpha=e.alpha,Rn(n,t)}if(St(o,t,{epsilon:0}))return Rn(o,t);function s(e){const n=Rn(e,t),r=Object.values(t.coords);return n.coords=n.coords.map((e,t)=>{if("range"in r[t]){const[n,a]=r[t].range;return Ie(n,e,a)}return e}),n}let l=0,c=o.coords[1],h=!0,u=Ct(o),p=s(u),d=$t(p,u);if(d<n)return p;for(;c-l>r;){const e=(l+c)/2;if(u.coords[1]=e,h&&St(u,t,{epsilon:0}))l=e;else if(p=s(u),d=$t(p,u),d<n){if(n-d<r)break;h=!1,l=e}else c=e}return p}(e,{space:n});else{if("clip"===t||St(e,n))i=Rn(e,n);else{Object.prototype.hasOwnProperty.call(An,t)&&({method:t,jnd:a,deltaEMethod:r,blackWhiteClamp:o}=An[t]);let s=vt;if(""!==r)for(let e in Ln)if("deltae"+r.toLowerCase()===e.toLowerCase()){s=Ln[e];break}0===a&&(a=1e-16);let l=En(Rn(e,n),{method:"clip",space:n});if(s(e,l)>a){if(o&&3===Object.keys(o).length){let t=Ue.resolveCoord(o.channel),n=nt(Rn(e,t.space),t.id);if(Ee(n)&&(n=0),n>=o.max)return Rn({space:"xyz-d65",coords:De.D65},e.space);if(n<=o.min)return Rn({space:"xyz-d65",coords:[0,0,0]},e.space)}let r=Ue.resolveCoord(t),l=r.space,c=r.id,h=Rn(e,l);h.coords.forEach((e,t)=>{Ee(e)&&(h.coords[t]=0)});let u=(r.range||r.refRange)[0],p=function(e){const t=e?Math.floor(Math.log10(Math.abs(e))):0;return Math.max(parseFloat("1e"+(t-2)),1e-6)}(a),d=u,g=nt(h,c);for(;g-d>p;){let e=Ct(h);e=En(e,{space:n,method:"clip"}),s(h,e)-a<p?d=nt(h,c):g=nt(h,c),at(h,c,(d+g)/2)}i=Rn(h,n)}else i=l}if("clip"===t||!St(i,n,{epsilon:0})){let e=Object.values(n.coords).map(e=>e.range||[]);i.coords=i.coords.map((t,n)=>{let[r,a]=e[n];return void 0!==r&&(t=Math.max(r,t)),void 0!==a&&(t=Math.min(t,a)),t})}}return n!==e.space&&(i=Rn(i,e.space)),e.coords=i.coords,e}En.returns="color";const Bn={WHITE:{space:kt,coords:[1,0,0],alpha:1},BLACK:{space:kt,coords:[0,0,0],alpha:1}};function Rn(e,t,{inGamut:n}={}){e=Ve(e);let r=(t=Ue.get(t)).from(e),a={space:t,coords:r,alpha:e.alpha};return n&&(a=En(a,!0===n?void 0:n)),a}function zn(e,t={}){var n,r,a,o;let i,{precision:s=Xe.precision,format:l,inGamut:c=!0,coords:h,alpha:u,commas:p}=t,d=Ve(e),g=l,f=d.parseMeta;f&&!l&&(f.format.canSerialize()&&(l=f.format,g=f.formatId),null!=h||(h=f.types),null!=u||(u=f.alphaType),null!=p||(p=f.commas)),g&&(l=null!=(n=d.space.getFormat(l))?n:Ue.findFormat(g)),l||(l=null!=(r=d.space.getFormat("default"))?r:Ue.DEFAULT_FORMAT,g=l.name),l&&l.space&&l.space!==d.space&&(d=Rn(d,l.space));let m=d.coords.slice();if(c||(c=l.toGamut),c&&!St(d)&&(m=En(Ct(d),!0===c?void 0:c).coords),"custom"===l.type){if(!l.serialize)throw new TypeError(`format ${g} can only be used to parse colors, not for serialization`);i=l.serialize(m,d.alpha,t)}else{let e=l.name||"color",t=l.serializeCoords(m,s,h);if("color"===e){let e=l.id||(null==(a=l.ids)?void 0:a[0])||d.space.cssId||d.space.id;t.unshift(e)}let n=d.alpha;void 0!==u&&"object"!=typeof u&&(u="string"==typeof u?{type:u}:{include:u});let r=null!=(o=null==u?void 0:u.type)?o:"<number>",c=!0===(null==u?void 0:u.include)||!0===l.alpha||!1!==(null==u?void 0:u.include)&&!1!==l.alpha&&n<1,g="";if(null!=p||(p=l.commas),c){if(null!==s){let e;"<percentage>"===r&&(e="%",n*=100),n=Ae(n,{precision:s,unit:e})}g=`${p?",":" /"} ${n}`}i=`${e}(${t.join(p?", ":" ")}${g})`}return i}Rn.returns="color";const In=new et({id:"rec2020-linear",cssId:"--rec2020-linear",name:"Linear REC.2020",white:"D65",toXYZ_M:[[.6369580483012914,.14461690358620832,.1688809751641721],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],fromXYZ_M:[[1.716651187971268,-.355670783776392,-.25336628137366],[-.666684351832489,1.616481236634939,.0157685458139111],[.017639857445311,-.042770613257809,.942103121235474]]}),Wn=new et({id:"rec2020",name:"REC.2020",base:In,toBase:e=>e.map(function(e){let t=e<0?-1:1,n=e*t;return t*Math.pow(n,2.4)}),fromBase:e=>e.map(function(e){let t=e<0?-1:1,n=e*t;return t*Math.pow(n,1/2.4)})}),Hn=new et({id:"p3-linear",cssId:"display-p3-linear",name:"Linear P3",white:"D65",toXYZ_M:[[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],fromXYZ_M:[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]]}),qn=new et({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],fromXYZ_M:[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]]}),Pn={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[.6,50/255,.8],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,.6],lightslategrey:[119/255,136/255,.6],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[.4,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,.8],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[.4,.2,.6],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let jn=Array(3).fill("<percentage> | <number>[0, 255]"),Tn=Array(3).fill("<number>[0, 255]");const On=new et({id:"srgb",name:"sRGB",base:qn,fromBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n>.0031308?t*(1.055*n**(1/2.4)-.055):12.92*e}),toBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n<=.04045?e/12.92:t*((n+.055)/1.055)**2.4}),formats:{rgb:{coords:jn},rgb_number:{name:"rgb",commas:!0,coords:Tn,alpha:!1},color:{},rgba:{coords:jn,commas:!0,alpha:!0},rgba_number:{name:"rgba",commas:!0,coords:Tn},hex:{type:"custom",toGamut:!0,test:e=>/^#(([a-f0-9]{2}){3,4}|[a-f0-9]{3,4})$/i.test(e),parse(e){e.length<=5&&(e=e.replace(/[a-f0-9]/gi,"$&$&"));let t=[];return e.replace(/[a-f0-9]{2}/gi,e=>{t.push(parseInt(e,16)/255)}),{spaceId:"srgb",coords:t.slice(0,3),alpha:t.slice(3)[0]}},serialize:(e,t,{collapse:n=!0,alpha:r}={})=>{(!1!==r&&t<1||!0===r)&&e.push(t),e=e.map(e=>Math.round(255*e));let a=n&&e.every(e=>e%17==0);return"#"+e.map(e=>a?(e/17).toString(16):e.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:e=>/^[a-z]+$/i.test(e),parse(e){let t={spaceId:"srgb",coords:null,alpha:1};if("transparent"===(e=e.toLowerCase())?(t.coords=Pn.black,t.alpha=0):t.coords=Pn[e],t.coords)return t}}}}),Nn=new et({id:"p3",cssId:"display-p3",name:"P3",base:Hn,fromBase:On.fromBase,toBase:On.toBase});function Dn(e){return nt(e,[Ke,"y"])}function Gn(e){return e>=.022?e:e+(.022-e)**1.414}function Fn(e){let t=e<0?-1:1,n=Math.abs(e);return t*Math.pow(n,2.4)}function Xn(e,t){e=Ve(e),t=Ve(t);let n=nt(e,[ht,"l"]),r=nt(t,[ht,"l"]);return Math.abs(n-r)}const Zn=216/24389,_n=24/116,Yn=24389/27;let Vn=De.D65;const Jn=new Ue({id:"lab-d65",name:"Lab D65",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:Vn,base:Ke,fromBase(e){let t=e.map((e,t)=>e/Vn[t]).map(e=>e>Zn?Math.cbrt(e):(Yn*e+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(e){let t=[];return t[1]=(e[0]+16)/116,t[0]=e[1]/500+t[1],t[2]=t[1]-e[2]/200,[t[0]>_n?Math.pow(t[0],3):(116*t[0]-16)/Yn,e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/Yn,t[2]>_n?Math.pow(t[2],3):(116*t[2]-16)/Yn].map((e,t)=>e*Vn[t])},formats:{"lab-d65":{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <percentage>"]}}}),Un=.5*Math.pow(5,.5)+.5,Qn=Object.freeze(Object.defineProperty({__proto__:null,contrastAPCA:function(e,t){let n,r,a,o,i,s;t=Ve(t),e=Ve(e),t=Rn(t,"srgb"),[o,i,s]=t.coords.map(e=>Ee(e)?0:e);let l=.2126729*Fn(o)+.7151522*Fn(i)+.072175*Fn(s);e=Rn(e,"srgb"),[o,i,s]=e.coords.map(e=>Ee(e)?0:e);let c=.2126729*Fn(o)+.7151522*Fn(i)+.072175*Fn(s),h=Gn(l),u=Gn(c),p=u>h;return Math.abs(u-h)<5e-4?r=0:p?(n=u**.56-h**.57,r=1.14*n):(n=u**.65-h**.62,r=1.14*n),a=Math.abs(r)<.1?0:r>0?r-.027:r+.027,100*a},contrastDeltaPhi:function(e,t){e=Ve(e),t=Ve(t);let n=nt(e,[Jn,"l"]),r=nt(t,[Jn,"l"]),a=Math.abs(Math.pow(n,Un)-Math.pow(r,Un)),o=Math.pow(a,1/Un)*Math.SQRT2-40;return o<7.5?0:o},contrastLstar:Xn,contrastMichelson:function(e,t){e=Ve(e),t=Ve(t);let n=Math.max(Dn(e),0),r=Math.max(Dn(t),0);r>n&&([n,r]=[r,n]);let a=n+r;return 0===a?0:(n-r)/a},contrastWCAG21:function(e,t){e=Ve(e),t=Ve(t);let n=Math.max(Dn(e),0),r=Math.max(Dn(t),0);return r>n&&([n,r]=[r,n]),(n+.05)/(r+.05)},contrastWeber:function(e,t){e=Ve(e),t=Ve(t);let n=Math.max(Dn(e),0),r=Math.max(Dn(t),0);return r>n&&([n,r]=[r,n]),0===r?5e4:(n-r)/r}},Symbol.toStringTag,{value:"Module"}));function Kn(e,t,n){Ce(n)&&(n={algorithm:n});let{algorithm:r,...a}=n||{};if(!r){let e=Object.keys(Qn).map(e=>e.replace(/^contrast/,"")).join(", ");throw new TypeError(`contrast() function needs a contrast algorithm. Please specify one of: ${e}`)}e=Ve(e),t=Ve(t);for(let o in Qn)if("contrast"+r.toLowerCase()===o.toLowerCase())return Qn[o](e,t,a);throw new TypeError(`Unknown contrast algorithm: ${r}`)}const er=new Ue({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:On,fromBase:e=>{let t=Math.max(...e),n=Math.min(...e),[r,a,o]=e,[i,s,l]=[null,0,(n+t)/2],c=t-n;if(0!==c){switch(s=0===l||1===l?0:(t-l)/Math.min(l,1-l),t){case r:i=(a-o)/c+(a<o?6:0);break;case a:i=(o-r)/c+2;break;case o:i=(r-a)/c+4}i*=60}return s<0&&(i+=180,s=Math.abs(s)),i>=360&&(i-=360),[i,100*s,100*l]},toBase:e=>{let[t,n,r]=e;function a(e){let a=(e+t/30)%12,o=n*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(a-3,9-a,1))}return t%=360,t<0&&(t+=360),n/=100,r/=100,[a(0),a(8),a(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]},hsla:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"],commas:!0,alpha:!0}}}),tr=new Ue({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:On,fromBase(e){let t=Math.max(...e),n=Math.min(...e),[r,a,o]=e,[i,s,l]=[null,0,t],c=t-n;if(0!==c){switch(t){case r:i=(a-o)/c+(a<o?6:0);break;case a:i=(o-r)/c+2;break;case o:i=(r-a)/c+4}i*=60}return l&&(s=c/l),i>=360&&(i-=360),[i,100*s,100*l]},toBase(e){let[t,n,r]=e;function a(e){let a=(e+t/60)%6;return r-r*n*Math.max(0,Math.min(a,4-a,1))}return t%=360,t<0&&(t+=360),n/=100,r/=100,[a(5),a(3),a(1)]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),nr=new Ue({id:"hwb",name:"HWB",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},w:{range:[0,100],name:"Whiteness"},b:{range:[0,100],name:"Blackness"}},base:tr,fromBase(e){let[t,n,r]=e;return[t,r*(100-n)/100,100-r]},toBase(e){let[t,n,r]=e;n/=100,r/=100;let a=n+r;if(a>=1)return[t,0,n/a*100];let o=1-r;return[t,100*(0===o?0:1-n/o),100*o]},formats:{hwb:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),rr=new et({id:"a98rgb-linear",cssId:"--a98-rgb-linear",name:"Linear Adobe® 98 RGB compatible",white:"D65",toXYZ_M:[[.5766690429101305,.1855582379065463,.1882286462349947],[.29734497525053605,.6273635662554661,.07529145849399788],[.02703136138641234,.07068885253582723,.9913375368376388]],fromXYZ_M:[[2.0415879038107465,-.5650069742788596,-.34473135077832956],[-.9692436362808795,1.8759675015077202,.04155505740717557],[.013444280632031142,-.11836239223101838,1.0151749943912054]]}),ar=new et({id:"a98rgb",cssId:"a98-rgb",name:"Adobe® 98 RGB compatible",base:rr,toBase:e=>e.map(e=>Math.pow(Math.abs(e),563/256)*Math.sign(e)),fromBase:e=>e.map(e=>Math.pow(Math.abs(e),256/563)*Math.sign(e))}),or=new et({id:"prophoto-linear",cssId:"--prophoto-rgb-linear",name:"Linear ProPhoto",white:"D50",base:ot,toXYZ_M:[[.7977666449006423,.13518129740053308,.0313477341283922],[.2880748288194013,.711835234241873,8993693872564e-17],[0,0,.8251046025104602]],fromXYZ_M:[[1.3457868816471583,-.25557208737979464,-.05110186497554526],[-.5446307051249019,1.5082477428451468,.02052744743642139],[0,0,1.2119675456389452]]}),ir=1/512,sr=new et({id:"prophoto",cssId:"prophoto-rgb",name:"ProPhoto",base:or,toBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n<.03125?e/16:t*n**1.8}),fromBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n>=ir?t*n**(1/1.8):16*e})}),lr=new Ue({id:"oklch",name:"OkLCh",coords:{l:{refRange:[0,1],name:"Lightness"},c:{refRange:[0,.4],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},white:"D65",base:kt,fromBase:pt.fromBase,toBase:pt.toBase,formats:{oklch:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <angle>"]}}}),cr=2*Math.PI,hr=[[4.076741636075958,-3.307711539258063,.2309699031821043],[-1.2684379732850315,2.609757349287688,-.341319376002657],[-.0041960761386756,-.7034186179359362,1.7076146940746117]],ur=[[[-1.8817031,-.80936501],[1.19086277,1.76576728,.59662641,.75515197,.56771245]],[[1.8144408,-1.19445267],[.73956515,-.45954404,.08285427,.12541073,-.14503204]],[[.13110758,1.81333971],[1.35733652,-.00915799,-1.1513021,-.50559606,.00692167]]],pr=Number.MAX_VALUE,dr=.206,gr=(1+dr)/1.03;function fr(e,t){let n=e.length;if(n!==t.length)throw new Error(`Vectors of size ${n} and ${t.length} are not aligned`);let r=0;return e.forEach((e,n)=>{r+=e*t[n]}),r}function mr(e){return.5*(gr*e-dr+Math.sqrt((gr*e-dr)*(gr*e-dr)+.12*gr*e))}function br(e){return(e**2+dr*e)/(gr*(e+.03))}function vr(e){let[t,n]=e;return[n/t,n/(1-t)]}function yr(e,t){let n=Se(e,Mt);return n[0]=n[0]**3,n[1]=n[1]**3,n[2]=n[2]**3,Se(n,t,n)}function wr(e,t,n,r){let a=function(e,t,n,r){let a,o,i,s,l,c,h,u;fr(r[0][0],[e,t])>1?([a,o,i,s,l]=r[0][1],[c,h,u]=n[0]):fr(r[1][0],[e,t])>1?([a,o,i,s,l]=r[1][1],[c,h,u]=n[1]):([a,o,i,s,l]=r[2][1],[c,h,u]=n[2]);let p=a+o*e+i*t+s*e**2+l*e*t,d=fr(Mt[0].slice(1),[e,t]),g=fr(Mt[1].slice(1),[e,t]),f=fr(Mt[2].slice(1),[e,t]),m=1+p*d,b=1+p*g,v=1+p*f,y=c*m**3+h*b**3+u*v**3,w=c*(3*d*m**2)+h*(3*g*b**2)+u*(3*f*v**2);return p-=y*w/(w**2-.5*y*(c*(6*d**2*m)+h*(6*g**2*b)+u*(6*f**2*v))),p}(e,t,n,r),o=yr([1,a*e,a*t],n),i=He(1/Math.max(...o),1/3);return[i,i*a]}function xr(e,t,n){let[r,a,o]=e,i=wr(a,o,t,n),s=function(e,t,n,r,a,o,i,s){let l;if(void 0===s&&(s=wr(e,t,o,i)),(n-a)*s[1]-1*(s[0]-a)<=0)l=s[1]*a/(1*s[0]+s[1]*(a-n));else{l=s[1]*(a-1)/(1*(s[0]-1)+s[1]*(a-n));let r=n-a,i=1,c=fr(Mt[0].slice(1),[e,t]),h=fr(Mt[1].slice(1),[e,t]),u=fr(Mt[2].slice(1),[e,t]),p=r+i*c,d=r+i*h,g=r+i*u,f=a*(1-l)+l*n,m=1*l,b=f+m*c,v=f+m*h,y=f+m*u,w=b**3,x=v**3,M=y**3,k=3*p*b**2,$=3*d*v**2,S=3*g*y**2,C=6*p**2*b,L=6*d**2*v,A=6*g**2*y,E=fr(o[0],[w,x,M])-1,B=fr(o[0],[k,$,S]),R=B/(B*B-.5*E*fr(o[0],[C,L,A])),z=-E*R,I=fr(o[1],[w,x,M])-1,W=fr(o[1],[k,$,S]),H=W/(W*W-.5*I*fr(o[1],[C,L,A])),q=-I*H,P=fr(o[2],[w,x,M])-1,j=fr(o[2],[k,$,S]),T=j/(j*j-.5*P*fr(o[2],[C,L,A])),O=-P*T;z=R>=0?z:pr,q=H>=0?q:pr,O=T>=0?O:pr,l+=Math.min(z,Math.min(q,O))}return l}(a,o,r,0,r,t,n,i),l=vr(i),c=s/Math.min(r*l[0],(1-r)*l[1]),h=function(e,t){return[.11516993+1/(7.4477897+4.1590124*t+e*(1.75198401*t-2.19557347+e*(-2.13704948-10.02301043*t+e*(5.38770819*t-4.24894561+4.69891013*e)))),.11239642+1/(1.6132032-.68124379*t+e*(.40370612+.90148123*t+e*(.6122399*t-.27087943+e*(.00299215-.45399568*t-.14661872*e))))]}(a,o),u=r*h[0],p=(1-r)*h[1],d=.9*c*Math.sqrt(Math.sqrt(1/(1/u**4+1/p**4)));return u=.4*r,p=.8*(1-r),[Math.sqrt(1/(1/u**2+1/p**2)),d,s]}new Ue({id:"okhsl",name:"Okhsl",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,1],name:"Saturation"},l:{range:[0,1],name:"Lightness"}},base:kt,gamutSpace:"self",fromBase:e=>function(e,t,n){let r=e[0],a=0,o=mr(r),i=Math.sqrt(e[1]**2+e[2]**2),s=.5+Math.atan2(-e[2],-e[1])/cr;if(0!==o&&1!==o&&0!==i){let o,s,l,c,h=e[1]/i,u=e[2]/i,[p,d,g]=xr([r,h,u],t,n),f=.8;i<d?(s=f*p,l=1-s/d,c=i/(s+l*i),a=c*f):(o=d,s=.2*d**2*1.5625/p,l=1-s/(g-d),c=(i-o)/(s+l*(i-o)),a=f+.2*c)}const l=Math.abs(a)<1e-4;return l||0===o||Math.abs(1-o)<1e-7?(s=null,l||(a=0)):s=ut(360*s),[s,a,o]}(e,hr,ur),toBase:e=>function(e,t,n){let[r,a,o]=e,i=br(o),s=null,l=null;if(r=ut(r)/360,0!==i&&1!==i&&0!==a){let e,o,c,h,u=Math.cos(cr*r),p=Math.sin(cr*r),[d,g,f]=xr([i,u,p],t,n),m=.8;a<m?(e=1.25*a,o=0,c=m*d,h=1-c/g):(e=5*(a-.8),o=g,c=.2*g**2*1.5625/d,h=1-c/(f-g));let b=o+e*c/(1-h*e);s=b*u,l=b*p}return[i,s,l]}(e,hr,ur),formats:{color:{id:"--okhsl",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const Mr=new Ue({id:"okhsv",name:"Okhsv",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,1],name:"Saturation"},v:{range:[0,1],name:"Value"}},base:kt,gamutSpace:"self",fromBase:e=>function(e,t,n){let r=e[0],a=0,o=mr(r),i=Math.sqrt(e[1]**2+e[2]**2),s=.5+Math.atan2(-e[2],-e[1])/cr;if(0!==r&&1!==r&&0!==i){let s=e[1]/i,l=e[2]/i,c=wr(s,l,t,n),[h,u]=vr(c),p=.5,d=1-p/h,g=u/(i+r*u),f=g*r,m=g*i,b=br(f),v=m*b/f,[y,w,x]=yr([b,s*v,l*v],t),M=He(1/Math.max(Math.max(y,w),Math.max(x,0)),1/3);r/=M,i/=M,i=i*mr(r)/r,r=mr(r),o=r/f,a=(p+u)*m/(u*p+u*d*m)}return s=Math.abs(a)<1e-4||0===o?null:ut(360*s),[s,a,o]}(e,hr,ur),toBase:e=>function(e,t,n){let[r,a,o]=e;r=ut(r)/360;let i=br(o),s=null,l=null;if(0!==i&&0!==a){let e=Math.cos(cr*r),c=Math.sin(cr*r),h=wr(e,c,t,n),[u,p]=vr(h),d=.5,g=1-d/u,f=1-a*d/(d+p-p*g*a),m=a*p*d/(d+p-p*g*a);i=o*f;let b=o*m,v=br(f),y=m*v/f,w=br(i);b=b*w/i,i=w;let[x,M,k]=yr([v,e*y,c*y],t),$=He(1/Math.max(Math.max(x,M),Math.max(k,0)),1/3);i*=$,b*=$,s=b*e,l=b*c}return[i,s,l]}(e,hr,ur),formats:{color:{id:"--okhsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});function kr(e){return"display-p3"===e?"p3":"a98-rgb"===e?"a98rgb":e}function $r(e){return"p3"===e?"display-p3":"a98rgb"===e?"a98-rgb":e}function Sr(e){return"100"===e||100===e?"":` / ${e}%`}function Cr(e){return["srgb-linear","display-p3","rec2020","a98-rgb","prophoto","xyz","xyz-d50","xyz-d65"].includes(e)}function Lr(e,t=0){return null==e?"0":Number(e.toFixed(t)).toString()}function Ar(e,t){var n,r,a,o,i,s,l,c,h,u;const p=null!=(n=t.L)?n:50,d=null!=(r=t.A)?r:0,g=null!=(a=t.B)?a:0,f=null!=(o=t.C)?o:0,m=null!=(i=t.H)?i:0,b=null!=(s=t.S)?s:0,v=null!=(l=t.W)?l:0,y=null!=(c=t.R)?c:0,w=null!=(h=t.G)?h:0,x=null!=(u=t.ALP)?u:100;switch(e){case"oklab":return`oklab(${p}% ${d} ${g}${Sr(x)})`;case"oklch":return`oklch(${p}% ${f}% ${m}${Sr(x)})`;case"lab":return`lab(${p}% ${d} ${g}${Sr(x)})`;case"lch":return`lch(${p}% ${f}% ${m}${Sr(x)})`;case"hsl":return`hsl(${m} ${b}% ${p}%${Sr(x)})`;case"hwb":return`hwb(${m} ${v}% ${g}%${Sr(x)})`;case"srgb":return`rgb(${y}% ${w}% ${g}%${Sr(x)})`;case"hex":{const e=Math.round(2.55*Number(y)),t=Math.round(2.55*Number(w)),n=Math.round(2.55*Number(g)),r=Number(x),a=e.toString(16).padStart(2,"0"),o=t.toString(16).padStart(2,"0"),i=n.toString(16).padStart(2,"0"),s=a[0]===a[1]&&o[0]===o[1]&&i[0]===i[1];if(r<100){const e=Math.round(r/100*255).toString(16).padStart(2,"0");return s&&e[0]===e[1]?`#${a[0]}${o[0]}${i[0]}${e[0]}`:`#${a}${o}${i}${e}`}return s?`#${a[0]}${o[0]}${i[0]}`:`#${a}${o}${i}`}default:return Cr(e)?function(e,t,n,r,a){return`color(${"prophoto"===e?"prophoto-rgb":e} ${t}% ${n}% ${r}%${Sr(a)})`}(e,y,w,g,x):"oklch(75% 75% 180)"}}function Er(e,t){var n,r,a,o,i,s;let l=Ve(Ze(t));const c=kr("hex"===e?"srgb":e);l.space.id!==c&&(l=Rn(l,c));const h=$r(l.space.id),u="rgb"===h?"srgb":h,p={},d=null!=(n=l.alpha)?n:1;if("oklab"===u){const[e,t,n]=l.coords;p.L=Lr(100*(null!=e?e:0)),p.A=Lr(t,2),p.B=Lr(n,2),p.ALP=Lr(100*d)}else if("oklch"===u){const[e,t]=null!=(r=lr.coords.c.refRange)?r:[0,1],[n,a,o]=l.coords,i=(null!=a?a:0-e)/(t-e)*100;p.L=Lr(100*(null!=n?n:0)),p.C=Lr(Math.min(100,i),0),p.H=Lr(o),p.ALP=Lr(100*d)}else if("lab"===u){const[e,t,n]=l.coords;p.L=Lr(e),p.A=Lr(t),p.B=Lr(n),p.ALP=Lr(100*d)}else if("lch"===u){const[e,t,n]=l.coords;p.L=Lr(e),p.C=Lr(Math.min(100,(null!=t?t:0)/1.5),0),p.H=Lr(n),p.ALP=Lr(100*d)}else if("hsl"===u){const e=l.coords[0],t=null!=(a=l.coords[1])?a:0,n=null!=(o=l.coords[2])?o:0;p.H=Lr(e),p.S=Lr(t>1?t:100*t),p.L=Lr(n>1?n:100*n),p.ALP=Lr(100*d)}else if("hwb"===u){const e=l.coords[0],t=null!=(i=l.coords[1])?i:0,n=null!=(s=l.coords[2])?s:0;p.H=Lr(e),p.W=Lr(t>1?t:100*t),p.B=Lr(n>1?n:100*n),p.ALP=Lr(100*d)}else if("srgb"===u||"hex"===u){const[e,t,n]=En(l,{space:"srgb",method:"clip"}).coords;p.R=Lr(100*(null!=e?e:0)),p.G=Lr(100*(null!=t?t:0)),p.B=Lr(100*(null!=n?n:0)),p.ALP=Lr(100*d)}else if(Cr(u)){const[e,t,n]=l.coords;p.R=Lr(100*(null!=e?e:0)),p.G=Lr(100*(null!=t?t:0)),p.B=Lr(100*(null!=n?n:0)),p.ALP=Lr(100*d)}return{space:u,ch:p}}Ue.register(On),Ue.register(qn),Ue.register(er),Ue.register(nr),Ue.register(ht),Ue.register(pt),Ue.register(kt),Ue.register(lr),Ue.register(Nn),Ue.register(ar),Ue.register(sr),Ue.register(Wn),Ue.register(Ke),Ue.register(ot),Ue.register(Mr);const Br={okhsv:{fixedIndex:0,xIndex:1,xMax:1,xStep:.01,yIndex:2,yMax:1,yStep:.01},oklch:{fixedIndex:2,xIndex:1,xMax:.4,xStep:.004,yIndex:0,yMax:1,yStep:.01},hsl:{fixedIndex:0,xIndex:1,xMax:100,xStep:1,yIndex:2,yMax:100,yStep:1}},Rr=e=>{if(e)return Br[e.spaceId]};class zr{constructor(e,t){ee(this,a),ee(this,o,de(!1)),ee(this,i,new AbortController),ee(this,s,de(null)),ee(this,l,de(null)),te(this,a,e);const n=null==e?void 0:e.querySelector(".area-canvas");if(!e||!n)return;const r=ve(()=>{var e;const t=K(this,s).value,n=Rr(t);return n&&null!=(e=null==t?void 0:t.coords[n.fixedIndex])?e:0}),c=de(null),h=e=>{if(!K(this,l).value)return;const n=K(this,l).value,r=zn(Rn(e,kr("hex"===n?"srgb":n),{inGamut:!0}),{format:"hex"===n?"hex":void 0});t(Ar(n,Er(n,r).ch))},u=t=>{const n=K(this,s).value,r=Rr(n);if(!n||!r)return;const a=e.getBoundingClientRect(),o=Math.max(0,Math.min(1,(t.clientX-a.left)/a.width)),i=Math.max(0,Math.min(1,1-(t.clientY-a.top)/a.height)),l=structuredClone(n.coords);l[r.xIndex]=o*r.xMax,l[r.yIndex]=i*r.yMax,h({...n,coords:l})};e.addEventListener("pointerdown",t=>{K(this,o).value=!0,e.setPointerCapture(t.pointerId),u(t),c.value=r.value},{signal:K(this,i).signal}),e.addEventListener("pointermove",e=>{K(this,o).value&&(e.preventDefault(),u(e))},{signal:K(this,i).signal}),e.addEventListener("pointerup",t=>{K(this,o).value=!1,e.releasePointerCapture(t.pointerId),c.value=null},{signal:K(this,i).signal}),e.addEventListener("pointercancel",()=>{K(this,o).value=!1,c.value=null},{signal:K(this,i).signal}),e.addEventListener("keydown",e=>{var t,n;const r=K(this,s).value,a=Rr(r);if(!r||!a)return;let o=0,i=0;switch(e.key){case"ArrowRight":o=1;break;case"ArrowLeft":o=-1;break;case"ArrowUp":i=1;break;case"ArrowDown":i=-1;break;default:return}e.preventDefault();const l=null!=(t=r.coords[a.xIndex])?t:0,c=null!=(n=r.coords[a.yIndex])?n:0,u=Math.max(0,Math.min(a.xMax,l+o*a.xStep)),p=Math.max(0,Math.min(a.yMax,c+i*a.yStep)),d=structuredClone(r.coords);d[a.xIndex]=u,d[a.yIndex]=p,h({...r,coords:d})},{signal:K(this,i).signal});const p=ke(()=>{e.classList.toggle("dragging",K(this,o).value),document.body.inert=K(this,o).value}),d=ke(()=>{var e,t,n,r;const o=K(this,s).value,i=Rr(o);if(!o||!i)return;const l=(null!=(e=o.coords[i.xIndex])?e:0)/i.xMax*100,c=(null!=(t=o.coords[i.yIndex])?t:0)/i.yMax*100;null==(n=K(this,a))||n.style.setProperty("--thumb-x",`${l}%`),null==(r=K(this,a))||r.style.setProperty("--thumb-y",100-c+"%")});let g=null,f=null;const m=ke(()=>{var e;f=null!=(e=c.value)?e:r.value,null===g&&(g=requestAnimationFrame(()=>{if(n&&null!==f&&K(this,l).value){const e=K(this,s).value,t=Rr(e);if(!e||!t)return;!function(e,t){const n=160;e.width=n,e.height=100;const r=e.getContext("2d");if(!r)return;const a=r.createImageData(n,100),o=a.data;for(let i=0;i<100;i++){const e=1-i/99;for(let r=0;r<n;r++){const a=r/159,[s,l,c]=Rn(t(a,e),"srgb").coords,h=4*(i*n+r);o[h]=Math.round(255*(null!=s?s:0)),o[h+1]=Math.round(255*(null!=l?l:0)),o[h+2]=Math.round(255*(null!=c?c:0)),o[h+3]=255}}r.putImageData(a,0,0)}(n,(n,r)=>{const a=[0,0,0];return a[t.fixedIndex]=null!=f?f:0,a[t.xIndex]=n*t.xMax,a[t.yIndex]=r*t.yMax,{spaceId:e.spaceId,coords:a,alpha:null}})}g=null,f=null}))});K(this,i).signal.addEventListener("abort",()=>{p(),d(),m(),g&&(cancelAnimationFrame(g),g=null)})}setValue(e,t){K(this,l).value=t;try{let n;n=Rn(e,"oklch"===t||"lch"===t?"oklch":"hsl"===t?"hsl":"okhsv"),K(this,s).value={spaceId:n.space.id,coords:n.coords,alpha:n.alpha}}catch{K(this,s).value=null}}unmount(){K(this,i).abort()}}a=new WeakMap,o=new WeakMap,i=new WeakMap,s=new WeakMap,l=new WeakMap;let Ir=null;function Wr(e,t){return e.left>=t.left&&e.top>=t.top&&e.right<=t.right&&e.bottom<=t.bottom}function Hr(e,t){const n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),a=Math.min(e.right,t.right),o=Math.min(e.bottom,t.bottom);return a<=n||o<=r?0:(a-n)*(o-r)}const qr=':root{--radius-round: 1e5px;--radius-2: 5px;--radius-3: 1rem}:host{--canvas: Canvas;--canvas-text: CanvasText;--radius-2: .5rem;--radius-3: .75rem;--radius-round: 1e4px;--shadow-elev: #0305081f 0px -1px 2px 0px, #03050821 0px 2px 1px -2px, #03050821 0px 5px 5px -2px, #03050824 0px 10px 10px -2px, #03050826 0px 20px 20px -2px, #0305082b 0px 40px 40px -2px;--shadow-inner: inset 0 0 0 1px color-mix(in oklab, var(--canvas-text), transparent 94%);--checker: repeating-conic-gradient(color-mix(in oklab, var(--canvas-text), transparent 90%) 0% 25%, transparent 0% 50%) 50%/1rem 1rem;color-scheme:light dark;display:flex;align-items:center;gap:10px;position:relative;@media (width < 350px){overflow:hidden}}:host([hidden]){display:none}button{border:1px solid color-mix(in oklab,var(--canvas-text),var(--canvas) 80%);outline-offset:2px;&.trigger{flex-shrink:0;background:none;padding:0;border:none;display:inline-flex;place-content:center;border-radius:var(--radius-round);.chip{display:inline-block;inline-size:1.25rem;block-size:1.25rem;border-radius:var(--radius-round);box-shadow:inset 0 0 0 1px color-mix(in oklab,var(--canvas-text),transparent 92%);background:linear-gradient(var(--value) 0 0),var(--checker);forced-color-adjust:none}}}.input-wrapper{position:relative;display:flex;flex-direction:column;flex:1;min-width:0}.text-input{field-sizing:content;font-family:inherit;padding:1ch 1.5ch;border:1px solid color-mix(in oklab,var(--canvas-text),var(--canvas) 80%);border-radius:var(--radius-2);background:color-mix(in oklab,var(--canvas-text),var(--canvas) 92%);color:var(--canvas-text);box-shadow:var(--shadow-inner);outline-offset:2px;&[aria-invalid=true]{outline-color:red}}.error-message{position:absolute;bottom:-1.5rem;left:0;font-size:12px;color:#ef4444;font-weight:500;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .2s ease}.error-message:not(:empty){opacity:1}.panel{margin:0;max-inline-size:min(92vw,560px);background:var(--canvas);color:var(--canvas-text);box-shadow:var(--shadow-elev);border-radius:var(--radius-3);padding:0;border:1px solid #0000;overflow:hidden}.area-picker{position:relative;width:100%;aspect-ratio:16 / 9;overflow:hidden;touch-action:none;box-shadow:var(--shadow-inner)}.area-picker:focus-visible{outline-offset:0px}.area-canvas{width:100%;height:100%}.area-thumb{position:absolute;box-sizing:border-box;height:calc(1rem + 8px);aspect-ratio:1;margin-left:calc(-.5rem - 4px);margin-top:calc(-.5rem - 4px);border-radius:var(--radius-round);border:4px solid white;box-shadow:0 0 1px 1px #00000040,inset 0 1px 2px #00000026;left:var(--thumb-x, 50%);top:var(--thumb-y, 50%);z-index:1;cursor:grab}.area-picker.dragging .area-thumb{cursor:grabbing}.preview{position:relative;min-inline-size:35ch;display:grid;align-content:end;justify-items:start;padding:.75rem;gap:6px;box-shadow:var(--shadow-inner);background:linear-gradient(var(--value) 0 0),var(--checker);forced-color-adjust:none;&:hover .copy-btn,&:focus-within .copy-btn{opacity:1}>*:not(:hover){opacity:.9}.copy-wrap{position:absolute;top:.5rem;right:.5rem;display:flex;flex-direction:column;align-items:flex-end;gap:.25rem}.copy-btn{color:var(--contrast);background:none;border:1px solid #0000;border-radius:0;padding:0;cursor:pointer;opacity:0;transition:opacity .2s ease;display:inline-flex;align-items:center}.copy-btn svg{display:block}.copy-message{color:var(--contrast);font-size:.8rem;font-weight:500;opacity:0;pointer-events:none;transition:opacity .2s ease;white-space:nowrap}.copy-message.show{opacity:1}.visually-hidden:not(:focus):not(:active){clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}}.space{-webkit-appearance:base-select;-moz-appearance:base-select;appearance:base-select;min-block-size:1lh;line-height:1.1;font-weight:700;margin:0;padding:0;color:var(--contrast);background:transparent;border-radius:0;border:none;&::picker-icon{content:"›";-webkit-appearance:none;transform:rotate(90deg) scale(1.5)}}@supports not selector(::picker-icon){.space{background-image:url(https://api.iconify.design/basil:caret-down-solid.svg);background-size:1rem;background-position:right .5rem center;background-repeat:no-repeat}}.gamut,.info{line-height:1.1;text-box:cap alphabetic;display:block;color:var(--contrast);background:transparent}.gamut{font-size:1rem}.info{font-size:1.25rem}.controls{display:grid;gap:.5rem;padding:.75rem;border-radius:0 0 var(--radius-3) var(--radius-3);.control{display:grid;grid-template-columns:min-content 1fr 4ch;align-items:center;gap:.5rem}.control .num-wrapper{position:relative;display:flex;align-items:center}.control .num-wrapper sup{opacity:.5;font-size:.5em;place-self:start}.control label{font:500 12px/1.2 ui-monospace,SFMono-Regular,Menlo,Consolas,Liberation Mono,monospace}.control input[type=number]{text-align:end;font-size:12px;padding:0;background:none;border:1px solid var(--canvas);border-radius:.25rem;-moz-appearance:textfield;font-variant:tabular-nums;font-family:monospace;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}}.control input[type=range]{width:100%;height:1rem;border-radius:999px;border:1px solid var(--canvas);background:var(--canvas);box-shadow:var(--shadow-inner);-webkit-appearance:none;-moz-appearance:none;appearance:none;forced-color-adjust:none}.control input[type=range].alpha{background:linear-gradient(to right,#0000,#000),var(--checker)}.control input[type=range]::-webkit-slider-thumb{cursor:grab;-webkit-appearance:none;appearance:none;border:4px solid white;height:calc(1rem + 8px);aspect-ratio:1;border-radius:var(--radius-round);box-shadow:0 0 1px 1px #00000040,inset 0 1px 2px #00000026}.control input[type=range]:active::-webkit-slider-thumb{cursor:grabbing}.control input[type=range]::-moz-range-thumb{cursor:grab;-moz-appearance:none;appearance:none;border:4px solid white;height:calc(1rem + 8px);aspect-ratio:1;border-radius:var(--radius-round);box-shadow:0 0 1px 1px #00000040,inset 0 1px 2px #00000026;width:calc(8px + 1rem);background:none;box-sizing:border-box}.control input[type=range]:active::-moz-range-thumb{cursor:grabbing}}',Pr="oklch(75% 75% 180)",jr="oklch",Tr=new CSSStyleSheet;"function"==typeof Tr.replaceSync&&Tr.replaceSync(qr);class Or extends HTMLElement{constructor(){if(super(),ee(this,H),ee(this,c,de(Pr)),ee(this,h,de(jr)),ee(this,u,de("auto")),ee(this,p,de(!1)),ee(this,d,de(null)),ee(this,g,de(null)),ee(this,f,de(!1)),ee(this,m,ve(()=>function(e){var t,n;try{const r=Ze(e);let a,o;try{a=null!=(t=Kn(r,"white","WCAG21"))?t:Xn(r,"white"),o=null!=(n=Kn(r,"black","WCAG21"))?n:Xn(r,"black")}catch{a=Xn(r,"white"),o=Xn(r,"black")}return a>o?"white":"black"}catch{return"black"}}(K(this,c).value))),ee(this,b,ve(()=>function(e){let t="srgb";if(!e||e.startsWith("#"))return t;try{const n=Ze(e),r={spaceId:"srgb",coords:Rn(n,"srgb").coords,alpha:null},a={spaceId:"p3",coords:Rn(n,"p3").coords,alpha:null},o={spaceId:"rec2020",coords:Rn(n,"rec2020").coords,alpha:null};St({spaceId:"xyz",coords:Rn(n,"xyz").coords,alpha:null})&&(t="xyz"),St(o)&&(t="rec2020"),St(a)&&(t="p3"),St(r)&&(t="srgb")}catch{}return t}(K(this,c).value))),ee(this,v,null),ee(this,y,null),ee(this,w,null),ee(this,x,null),ee(this,M,null),ee(this,k),ee(this,$,!1),ee(this,S),ee(this,C),ee(this,L),ee(this,A),ee(this,E),ee(this,B),ee(this,R),ee(this,z),ee(this,I),ee(this,W,null),ee(this,j,null),ee(this,T,null),ee(this,O,[]),ee(this,N,null),te(this,S,this.attachShadow({mode:"open",delegatesFocus:!0})),"adoptedStyleSheets"in K(this,S)&&"function"==typeof Tr.replaceSync)K(this,S).adoptedStyleSheets=[Tr];else{const e=document.createElement("style");e.textContent=qr,K(this,S).appendChild(e)}const e=function(){const e=document.createElement("template");return e.innerHTML='\n <button class="trigger" part="trigger" aria-haspopup="dialog" aria-label="Open color picker" title="Open color picker">\n <span class="chip" part="chip"></span>\n </button>\n <div class="input-wrapper">\n <span class="error-message" part="error" role="alert" aria-live="polite"></span>\n <input type="text" class="text-input" part="input" aria-label="Color value" title="Color value" aria-invalid="false" spellcheck="false" />\n </div>\n <div class="panel" popover="auto" part="panel">\n <div class="area-picker" part="area" role="slider" aria-label="Color area picker" tabindex="0">\n <canvas class="area-canvas"></canvas>\n <div class="area-thumb"></div>\n </div>\n <div class="controls" part="controls"></div>\n <div class="preview">\n <div class="copy-wrap">\n <button class="copy-btn">\n <span class="visually-hidden">Copy color</span>\n <svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true"><title>Copy color</title><path fill="currentColor" d="M5 22q-.825 0-1.413-.588T3 20V6h2v14h11v2H5Zm4-4q-.825 0-1.413-.588T7 16V4q0-.825.588-1.413T9 2h9q.825 0 1.413.588T20 4v12q0 .825-.588 1.413T18 18H9Z"/></svg>\n </button>\n <span class="copy-message" aria-hidden="true">Copied!</span>\n <span class="copy-message-live-region visually-hidden" role="status"></span>\n </div>\n <select class="space" title="Colorspace"></select>\n <output class="info" part="output"></output>\n <span class="gamut" title="Color\'s gamut" part="gamut"></span>\n </div>\n </div>\n ',e}();K(this,S).appendChild(e.content.cloneNode(!0))}static get observedAttributes(){return["value","colorspace","theme","no-alpha"]}get value(){return K(this,c).value}set value(e){if("string"==typeof e&&e)try{const t=$r(Ze(e).spaceId),n="string"==typeof e&&e.trim().startsWith("#");K(this,h).value=n?"hex":"rgb"===t?"srgb":t,K(this,c).value=e,te(this,$,!0),this.setAttribute("value",e),this.setAttribute("colorspace",K(this,h).value),te(this,$,!1),ne(this,H,q).call(this)}catch{}}get colorspace(){return K(this,h).value}set colorspace(e){const t=e||jr;K(this,h).value=t,te(this,$,!0),this.setAttribute("colorspace",t);try{const e=Ze(K(this,c).value),n=Ar(t,Er(t,zn(En(Rn(e,kr("hex"===t?"srgb":t))),{precision:12})).ch);K(this,c).value=n,this.setAttribute("value",n),ne(this,H,q).call(this)}catch{}te(this,$,!1),K(this,L)&&ne(this,H,Y).call(this)}get theme(){return K(this,u).value}set theme(e){const t="light"===e||"dark"===e?e:"auto";K(this,u).value=t,"auto"===t?this.removeAttribute("theme"):this.setAttribute("theme",t)}get noAlpha(){return K(this,f).value}set noAlpha(e){K(this,f).value=!!e,e?this.setAttribute("no-alpha",""):this.removeAttribute("no-alpha")}get gamut(){return K(this,b).value}get contrastColor(){return K(this,m).value}show(e){var t,n;e&&(K(this,d).value=e),null==(n=null==(t=K(this,C))?void 0:t.showPopover)||n.call(t),ne(this,H,D).call(this)}close(){var e,t;null==(t=null==(e=K(this,C))?void 0:e.hidePopover)||t.call(e),ne(this,H,G).call(this)}showPicker(){this.show()}setAnchor(e){K(this,d).value=e}set setColor(e){this.value=e}set setAnchorElement(e){this.setAnchor(e)}connectedCallback(){var e;const t=K(this,S).querySelector("button.trigger");te(this,R,null!=t?t:void 0),te(this,C,K(this,S).querySelector(".panel")),te(this,L,K(this,S).querySelector(".controls")),te(this,A,K(this,S).querySelector(".space")),te(this,E,K(this,S).querySelector("output.info")),te(this,B,K(this,S).querySelector(".chip")),te(this,z,K(this,S).querySelector(".text-input")),te(this,I,K(this,S).querySelector(".error-message"));const n=K(this,S).querySelector(".area-picker");n&&"none"!==getComputedStyle(n).display&&(te(this,k,new zr(n,e=>{K(this,c).value=e,this.setAttribute("value",e),ne(this,H,q).call(this),ne(this,H,Y).call(this)})),te(this,M,ke(()=>{var e;const t=K(this,c).value,n=K(this,h).value;null==(e=K(this,k))||e.setValue(t,n)})));const r=K(this,S).querySelector("button.copy-btn"),a=K(this,S).querySelector(".copy-message"),o=K(this,S).querySelector(".copy-message-live-region");if(r&&a&&o){let e=null;r.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(K(this,c).value),a.classList.add("show"),o.innerText=a.innerText,null!==e&&clearTimeout(e),e=window.setTimeout(()=>{a.classList.remove("show"),o.innerText="",e=null},3e3)}catch{}})}K(this,A).innerHTML='\n <optgroup label="Standard">\n <option value="hex">hex</option>\n <option value="srgb">rgb</option>\n <option value="srgb-linear">srgb-linear</option>\n <option value="hsl">hsl</option>\n <option value="hwb">hwb</option>\n </optgroup>\n <optgroup label="HDR">\n <option value="display-p3">display-p3</option>\n <option value="a98-rgb">a98-rgb</option>\n </optgroup>\n <optgroup label="Ultra HDR">\n <option value="lab">lab</option>\n <option value="lch">lch</option>\n <option value="oklch">oklch</option>\n <option value="oklab">oklab</option>\n <option value="rec2020">rec2020</option>\n <option value="prophoto">prophoto</option>\n <option value="xyz">xyz</option>\n <option value="xyz-d50">xyz-d50</option>\n <option value="xyz-d65">xyz-d65</option>\n </optgroup>\n ',t&&t.addEventListener("click",()=>this.show(t)),K(this,z)&&(K(this,z).value=K(this,c).value,K(this,z).addEventListener("input",e=>{const t=e.target.value;ne(this,H,P).call(this,t)}),K(this,z).addEventListener("paste",e=>{})),this.addEventListener("command",e=>{const t=e.command;if(!t)return;const n=e.source||e.invoker||(document.activeElement instanceof HTMLElement?document.activeElement:null);n&&(te(this,W,n),this.setAnchor(n)),"show-popover"===t||"show"===t?this.show(K(this,W)):"hide-popover"===t||"close"===t?this.close():"toggle-popover"!==t&&"toggle"!==t||(K(this,p).value?this.close():this.show(K(this,W)))}),null==(e=K(this,C))||e.addEventListener("toggle",()=>{var e;const t=K(this,C);let n=!t.hasAttribute("hidden");try{n=null!=(e=t.matches(":popover-open"))&&e}catch{}K(this,p).value=n,n?ne(this,H,D).call(this):ne(this,H,G).call(this),this.dispatchEvent(new CustomEvent(n?"open":"close",{bubbles:!0}))}),K(this,A).addEventListener("change",()=>{this.colorspace=K(this,A).value,ne(this,H,Y).call(this)}),te(this,v,ke(()=>{const e=K(this,c).value,t=K(this,b).value,n=K(this,m).value;K(this,E)&&(K(this,E).value=e),K(this,B)&&K(this,B).style.setProperty("--value",e),K(this,z)&&K(this,z).value!==e&&(K(this,z).value=e),this.style.setProperty("--contrast",n),this.style.setProperty("--counter","white"===n?"black":"white");const r=K(this,S).querySelector(".gamut");r&&(r.textContent=t);const a=K(this,S).querySelector(".preview");a&&a.style.setProperty("--value",e)})),te(this,w,ke(()=>{const e=K(this,g).value;e?(this.setAttribute("data-error",""),K(this,I)&&(K(this,I).textContent=e),K(this,z)&&K(this,z).setAttribute("aria-invalid","true")):(this.removeAttribute("data-error"),K(this,I)&&(K(this,I).textContent=""),K(this,z)&&K(this,z).setAttribute("aria-invalid","false"))})),te(this,y,ke(()=>{const e=K(this,u).value,t="auto"===e?"light dark":e;this.style.setProperty("color-scheme",t)})),this.hasAttribute("value")||this.setAttribute("value",Pr),this.hasAttribute("colorspace")||this.setAttribute("colorspace",K(this,h).value),K(this,A).value=K(this,h).value,ne(this,H,Y).call(this)}disconnectedCallback(){var e,t,n,r,a;null==(e=K(this,y))||e.call(this),null==(t=K(this,v))||t.call(this),null==(n=K(this,w))||n.call(this),null==(r=K(this,M))||r.call(this),null==(a=K(this,k))||a.unmount()}attributeChangedCallback(e,t,n){if(n!==t&&!K(this,$)){if("value"===e&&"string"==typeof n)try{const e=$r(Ze(n).spaceId),t="string"==typeof n&&n.trim().startsWith("#");K(this,c).value=n,K(this,h).value=t?"hex":"rgb"===e?"srgb":e,K(this,A)&&(K(this,A).value=K(this,h).value)}catch{}"colorspace"===e&&n&&(K(this,h).value=n,K(this,A)&&(K(this,A).value=n)),"theme"===e&&(K(this,u).value=n||"auto"),"no-alpha"===e&&(K(this,f).value=null!==n,K(this,L)&&ne(this,H,Y).call(this))}}}return c=new WeakMap,h=new WeakMap,u=new WeakMap,p=new WeakMap,d=new WeakMap,g=new WeakMap,f=new WeakMap,m=new WeakMap,b=new WeakMap,v=new WeakMap,y=new WeakMap,w=new WeakMap,x=new WeakMap,M=new WeakMap,k=new WeakMap,$=new WeakMap,S=new WeakMap,C=new WeakMap,L=new WeakMap,A=new WeakMap,E=new WeakMap,B=new WeakMap,R=new WeakMap,z=new WeakMap,I=new WeakMap,W=new WeakMap,H=new WeakSet,q=function(){const e={value:K(this,c).value,colorspace:K(this,h).value,gamut:K(this,b).value};this.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0}))},P=function(e){if(e&&e.trim())try{const t=$r(Ze(e).spaceId),n="string"==typeof e&&e.trim().startsWith("#");K(this,g).value=null,K(this,h).value=n?"hex":"rgb"===t?"srgb":t,K(this,c).value=e,this.setAttribute("value",e),this.setAttribute("colorspace",K(this,h).value),K(this,A)&&(K(this,A).value=K(this,h).value),ne(this,H,q).call(this)}catch(t){K(this,g).value="Invalid color format"}else K(this,g).value="Invalid color format"},j=new WeakMap,T=new WeakMap,O=new WeakMap,N=new WeakMap,D=function(){var e,t;if(K(this,O).length)return;ne(this,H,F).call(this);const n=null!=(t=null!=(e=K(this,d).value)?e:K(this,W))?t:K(this,R);if(n&&K(this,C)){if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>ne(this,H,F).call(this));e.observe(n),e.observe(K(this,C)),e.observe(document.documentElement),K(this,O).push(()=>e.disconnect())}else{const e=()=>ne(this,H,F).call(this);window.addEventListener("resize",e),K(this,O).push(()=>window.removeEventListener("resize",e))}if(window.visualViewport){const e=()=>ne(this,H,F).call(this);window.visualViewport.addEventListener("resize",e),window.visualViewport.addEventListener("scroll",e),K(this,O).push(()=>{var t,n;null==(t=window.visualViewport)||t.removeEventListener("resize",e),null==(n=window.visualViewport)||n.removeEventListener("scroll",e)})}if(function(e){const t=[];let n=e.parentElement;for(;n&&n!==document.documentElement;){const e=getComputedStyle(n),r=e.overflowY,a=e.overflowX;"auto"!==r&&"scroll"!==r&&"auto"!==a&&"scroll"!==a||!(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)||t.push(n),n=n.parentElement}return document.scrollingElement&&t.push(document.scrollingElement),t}(n).forEach(e=>{const t=()=>ne(this,H,F).call(this);e.addEventListener("scroll",t,{passive:!0}),K(this,O).push(()=>e.removeEventListener("scroll",t))}),"undefined"!=typeof IntersectionObserver){const e=new IntersectionObserver(()=>ne(this,H,F).call(this),{threshold:0});e.observe(n),K(this,O).push(()=>e.disconnect())}}},G=function(){K(this,O).forEach(e=>e()),te(this,O,[]),null!==K(this,N)&&(cancelAnimationFrame(K(this,N)),te(this,N,null))},F=function(){null===K(this,N)&&te(this,N,requestAnimationFrame(()=>{te(this,N,null),ne(this,H,X).call(this)}))},X=function(){if(!K(this,C))return;const e=K(this,C),t=ne(this,H,Z).call(this),n=function(){if(Ir)return Ir;const e=document.createElement("div");e.style.position="fixed",e.style.left="-9999px",e.style.top="0",e.style.paddingTop="env(safe-area-inset-top)",e.style.paddingRight="env(safe-area-inset-right)",e.style.paddingBottom="env(safe-area-inset-bottom)",e.style.paddingLeft="env(safe-area-inset-left)",document.documentElement.appendChild(e);const t=getComputedStyle(e),n=parseFloat(t.paddingTop)||0,r=parseFloat(t.paddingRight)||0,a=parseFloat(t.paddingBottom)||0,o=parseFloat(t.paddingLeft)||0;return document.documentElement.removeChild(e),Ir={top:n,right:r,bottom:a,left:o},Ir}(),r=function(e){var t,n,r,a;const o=null!=(n=null==(t=window.visualViewport)?void 0:t.width)?n:window.innerWidth,i=null!=(a=null==(r=window.visualViewport)?void 0:r.height)?a:window.innerHeight,s=window.pageXOffset||document.documentElement.scrollLeft,l=window.pageYOffset||document.documentElement.scrollTop,c=e.left+8+s,h=e.top+8+l,u=o-e.right-8+s,p=i-e.bottom-8+l;return{left:c,top:h,right:u,bottom:p,width:u-c,height:p-h}}(n),a=ne(this,H,_).call(this,e),o=function(e,t){const{width:n,height:r}=t,a=[{placement:"bottom-center",left:e.left+e.width/2-n/2,top:e.bottom+8,right:0,bottom:0},{placement:"top-center",left:e.left+e.width/2-n/2,top:e.top-8-r,right:0,bottom:0},{placement:"right-start",left:e.right+8,top:e.top,right:0,bottom:0},{placement:"left-start",left:e.left-8-n,top:e.top,right:0,bottom:0},{placement:"bottom-left",left:e.left,top:e.bottom+8,right:0,bottom:0},{placement:"bottom-right",left:e.right-n,top:e.bottom+8,right:0,bottom:0},{placement:"top-left",left:e.left,top:e.top-8-r,right:0,bottom:0},{placement:"top-right",left:e.right-n,top:e.top-8-r,right:0,bottom:0}];return a.forEach(e=>{e.right=e.left+n,e.bottom=e.top+r}),a}(t,a),i=function(e,t,n){if(n){const r=e.find(e=>e.placement===n);if(r&&Wr(r,t))return r}for(const o of e)if(Wr(o,t))return o;let r=e[0],a=Hr(r,t);for(let o=1;o<e.length;o++){const n=Hr(e[o],t);n>a&&(a=n,r=e[o])}return r}(o,r,K(this,j));te(this,j,i.placement);const s=Math.round(Math.min(Math.max(i.left,r.left),r.right-a.width)),l=Math.round(Math.min(Math.max(i.top,r.top),r.bottom-a.height)),c=r.bottom-r.top;a.height>c?(e.style.maxHeight=`${c}px`,e.style.overflow="auto"):e.style.maxHeight&&(e.style.maxHeight="",e.style.overflow=""),e.style.position="absolute",e.style.left=`${s}px`,e.style.top=`${l}px`,e.style.setProperty("--ci-panel-placement",i.placement),e.dataset.placement=i.placement},Z=function(){var e,t,n,r,a,o,i;const s=null!=(n=null!=(t=null!=(e=K(this,d).value)?e:K(this,W))?t:K(this,R))?n:this,l=window.pageXOffset||document.documentElement.scrollLeft,c=window.pageYOffset||document.documentElement.scrollTop;if(!s.isConnected){const e=(null!=(a=null==(r=window.visualViewport)?void 0:r.width)?a:window.innerWidth)/2+l,t=(null!=(i=null==(o=window.visualViewport)?void 0:o.height)?i:window.innerHeight)/2+c;return{left:e,top:t,right:e,bottom:t,width:0,height:0}}const h=s.getBoundingClientRect();return{left:h.left+l,top:h.top+c,right:h.right+l,bottom:h.bottom+c,width:h.width,height:h.height}},_=function(e){var t;const n=e.getBoundingClientRect();if(n.width>0&&n.height>0)return te(this,T,{width:n.width,height:n.height}),K(this,T);const r={display:e.style.display,position:e.style.position,left:e.style.left,top:e.style.top,visibility:e.style.visibility,maxHeight:e.style.maxHeight};e.style.display="block",e.style.position="absolute",e.style.left="-99999px",e.style.top="0",e.style.visibility="hidden",e.style.maxHeight="none";const a=e.getBoundingClientRect();return e.style.display=r.display,e.style.position=r.position,e.style.left=r.left,e.style.top=r.top,e.style.visibility=r.visibility,e.style.maxHeight=r.maxHeight,a.width>0&&a.height>0?(te(this,T,{width:a.width,height:a.height}),K(this,T)):null!=(t=K(this,T))?t:{width:560,height:400}},Y=function(){var e,t,n,r,a,o,i,s,l,u,p,d,g,m,b,v;K(this,x)&&K(this,x).call(this);const y=K(this,h).value;if(!K(this,L))return;const w=Er(y,K(this,c).value).ch,M={};Object.keys(w).forEach(e=>{M[e]=de(String(w[e]))});const k=(e,t,n,r,a=1,o,i)=>{var s,l;const h="H"===t,u=["L","S","C","W","B","R","G","ALP"].includes(t),p="H"===t,d=document.createElement("div");d.className="control";const g=document.createElement("label");g.textContent=e;const f={L:"Lightness",C:"Chroma",H:"Hue",S:"Saturation",A:"A (green-red axis)",W:"Whiteness",R:"Red",G:"Green",ALP:"Alpha"};"B"===t?g.title="oklab"===y||"lab"===y?"B (blue-yellow axis)":"hwb"===y?"Blackness":"Blue":f[t]&&(g.title=f[t]);const m=document.createElement("input");if(m.type="range",m.min=String(n),m.max=String(r),m.step=String(a),m.classList.add(`ch-${t.toLowerCase()}`),o&&(m.style.backgroundImage=o),i&&(m.style.backgroundColor=i),m.value=String(null!=(s=w[t])?s:0),"ALP"===t){m.classList.add("alpha");try{const e=Ar(y,{...w,ALP:"0"}),t=Ar(y,{...w,ALP:"100"}),n="hsl"===y?"hsl":"lch"===y?"lch":"oklch"===y?"oklch":"oklab";m.style.background=`linear-gradient(to right in ${n}, ${e}, ${t}), var(--checker)`}catch{}}const b=document.createElement("input");b.type="number",b.min=String(n),b.max=String(r),b.step=String(a),b.classList.add(`ch-${t.toLowerCase()}`),b.value=String(null!=(l=w[t])?l:0);const v=document.createElement("div");if(v.className="num-wrapper",v.appendChild(b),u||p){const e=document.createElement("sup");e.textContent=p?"°":"%",v.appendChild(e)}const x=()=>{const e=Ar(y,w);K(this,c).value=e,this.setAttribute("value",e),ne(this,H,q).call(this)},k=e=>{const a=e.target;let o=Number(a.value);if(!Number.isFinite(o))return;o=h?(o%360+360)%360:Math.max(n,Math.min(r,o));const i=function(e,t,n){const r=(e,t=0)=>Number(e.toFixed(t));if("oklab"===e){if("L"===t)return String(r(n,0));if("A"===t||"B"===t)return String(r(n,2))}else if("oklch"===e){if("L"===t)return String(r(n,0));if("C"===t)return String(r(n,0));if("H"===t)return String(r(n,0))}else if("lab"===e){if("L"===t)return String(r(n,0));if("A"===t||"B"===t)return String(r(n,0))}else if("lch"===e){if("L"===t||"C"===t||"H"===t)return String(r(n,0))}else if("hsl"===e||"hwb"===e){if("H"===t)return String(r(n,0));if("S"===t||"L"===t||"W"===t||"B"===t)return String(r(n,0))}else if("srgb"===e||"hex"===e){if("R"===t||"G"===t||"B"===t)return String(r(n,0))}else if(["srgb-linear","display-p3","rec2020","a98-rgb","prophoto","xyz","xyz-d50","xyz-d65"].includes(e)&&("R"===t||"G"===t||"B"===t))return String(r(n,0));return String(r(n,"ALP"===t?0:2))}(y,t,o);w[t]=i,M[t].value=i,m.value=String(w[t]),b.value=String(w[t]),x()};return m.addEventListener("input",k),b.addEventListener("input",k),d.append(g,m,v),d};if(K(this,L).innerHTML="","oklab"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("L","L",0,100,1,"linear-gradient(in oklab to right, black, white)"),k("A","A",-.5,.5,.01,"linear-gradient(to right in oklab, oklab(65% -.5 .5), oklab(65% .5 .5))"),k("B","B",-.5,.5,.01,"linear-gradient(to right in oklab, oklab(47% -.03 -.32), oklab(96% 0 .25))"),e);const t=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.L.value||"50",n=M.A.value||"0",r=M.B.value||"0";t&&(t.style.background=`linear-gradient(to right in oklab, oklab(${e}% ${n} ${r} / 0%), oklab(${e}% ${n} ${r} / 100%)), var(--checker)`)}))}else if("oklch"===y){const a=k("A","ALP",0,100,1);K(this,f).value&&(a.style.display="none"),K(this,L).append(k("L","L",0,100,1,"linear-gradient(in oklab to right, black, white)"),k("C","C",0,100,1,`linear-gradient(in oklch to right, oklch(${null!=(e=w.L)?e:0}% 1% ${null!=(t=w.H)?t:0}), oklch(${null!=(n=w.L)?n:0}% 100% ${null!=(r=w.H)?r:0}))`),k("H","H",0,359,1,"linear-gradient(to right in oklch longer hue, oklch(90% 75% 0), oklch(90% 75% 0))"),a);const o=K(this,L).querySelector('input[type="range"].ch-c'),i=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.L.value||"0",t=M.C.value||"0",n=M.H.value||"0";o&&(o.style.backgroundImage=`linear-gradient(in oklch to right, oklch(${e}% 1% ${n}deg), oklch(${e}% 100% ${n}deg))`),i&&(i.style.background=`linear-gradient(to right in oklch, oklch(${e}% ${t}% ${n} / 0%), oklch(${e}% ${t}% ${n} / 100%)), var(--checker)`)}))}else if("lab"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("L","L",0,100,1,"linear-gradient(in lab to right, black, white)"),k("A","A",-160,160,1,"linear-gradient(to right in oklab, lab(85% -100 100), lab(55% 100 100))"),k("B","B",-160,160,1,"linear-gradient(to right in oklab, lab(31% 70 -120), lab(96% 0 120))"),e);const t=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.L.value||"50",n=M.A.value||"0",r=M.B.value||"0";t&&(t.style.background=`linear-gradient(to right in lab, lab(${e}% ${n} ${r} / 0%), lab(${e}% ${n} ${r} / 100%)), var(--checker)`)}))}else if("lch"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("L","L",0,100,1,"linear-gradient(in lab to right, black, white)"),k("C","C",0,100,1,`linear-gradient(in lch to right, lch(${null!=(a=w.L)?a:0}% 1% ${null!=(o=w.H)?o:0}), lch(${null!=(i=w.L)?i:0}% 100% ${null!=(s=w.H)?s:0}))`),k("H","H",0,359,1,"linear-gradient(to right in lch longer hue, lch(90% 75% 0), lch(90% 75% 0))"),e);const t=K(this,L).querySelector('input[type="range"].ch-c'),n=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.L.value||"50",r=M.C.value||"0",a=M.H.value||"0";t&&(t.style.backgroundImage=`linear-gradient(in lch to right, lch(${e}% 1% ${a}), lch(${e}% 100% ${a}))`),n&&(n.style.background=`linear-gradient(to right in lch, lch(${e}% ${r}% ${a} / 0%), lch(${e}% ${r}% ${a} / 100%)), var(--checker)`)}))}else if("hsl"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("H","H",0,359,1,"linear-gradient(to right in hsl longer hue, hsl(0 100% 50%), hsl(360 100% 50%))"),k("S","S",0,100,1,`linear-gradient(in hsl to right, hsl(${null!=(l=w.H)?l:0} 0% ${null!=(u=w.L)?u:50}% / 100%), hsl(${null!=(p=w.H)?p:0} 100% ${null!=(d=w.L)?d:50}% / 100%))`),k("L","L",0,100,1,`linear-gradient(in oklab to right, hsl(${null!=(g=w.H)?g:0} ${null!=(m=w.S)?m:100}% 0%), hsl(${null!=(b=w.H)?b:0} ${null!=(v=w.S)?v:100}% 100%))`),e);const t=K(this,L).querySelector('input[type="range"].ch-s'),n=K(this,L).querySelector('input[type="range"].ch-l'),r=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.H.value||"0",a=M.S.value||"100",o=M.L.value||"50";t&&(t.style.backgroundImage=`linear-gradient(in hsl to right, hsl(${e} 0% ${o}% / 100%), hsl(${e} 100% ${o}% / 100%))`),n&&(n.style.backgroundImage=`linear-gradient(in oklab to right, hsl(${e} ${a}% 0%), hsl(${e} ${a}% 100%))`),r&&(r.style.background=`linear-gradient(to right in hsl, hsl(${e} ${a}% ${o}% / 0%), hsl(${e} ${a}% ${o}% / 100%)), var(--checker)`)}))}else if("hwb"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("H","H",0,359,1,"linear-gradient(to right in hsl longer hue, hsl(0 100% 50%), hsl(360 100% 50%))"),k("W","W",0,100,1,"linear-gradient(to right in oklab, #fff0, #fff)","black"),k("B","B",0,100,1,"linear-gradient(to right in oklab, #0000, #000)","white"),e);const t=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.H.value||"0",n=M.W.value||"0",r=M.B.value||"0";t&&(t.style.background=`linear-gradient(to right in hwb, hwb(${e} ${n}% ${r}% / 0%), hwb(${e} ${n}% ${r}% / 100%)), var(--checker)`)}))}else if("srgb"===y||"hex"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("R","R",0,100,1,"linear-gradient(to right in oklab, #f000, #f00)","black"),k("G","G",0,100,1,"linear-gradient(to right in oklab, #0f00, #0f0)","black"),k("B","B",0,100,1,"linear-gradient(to right in oklab, #00f0, #00f)","black"),e);const t=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.R.value||"0",n=M.G.value||"0",r=M.B.value||"0";t&&(t.style.background=`linear-gradient(to right in srgb, rgb(${e}% ${n}% ${r}% / 0%), rgb(${e}% ${n}% ${r}% / 100%)), var(--checker)`)}))}else if(Cr(y)){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("R","R",0,100,1,"linear-gradient(to right in oklab, #f000, #f00)","black"),k("G","G",0,100,1,"linear-gradient(to right in oklab, #0f00, #0f0)","black"),k("B","B",0,100,1,"linear-gradient(to right in oklab, #00f0, #00f)","black"),e);const t=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.R.value||"0",n=M.G.value||"0",r=M.B.value||"0";if(t){const a=Ar(y,{...w,R:e,G:n,B:r,ALP:"0"}),o=Ar(y,{...w,R:e,G:n,B:r,ALP:"100"});t.style.background=`linear-gradient(to right, ${a}, ${o}), var(--checker)`}}))}},customElements.define("color-input",Or),e.ColorInput=Or,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
|
|
2
|
+
var ColorInput=function(e){"use strict";var t,n,r,a,o,i,s,l,c,h,u,p,d,g,f,m,b,v,y,w,x,M,k,$,S,C,L,A,E,B,R,z,I,W,H,q,P,j,T,O,N,D,G,F,X,Z,_,Y,V=Object.defineProperty,J=e=>{throw TypeError(e)},U=(e,t,n)=>((e,t,n)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),Q=(e,t,n)=>t.has(e)||J("Cannot "+n),K=(e,t,n)=>(Q(e,t,"read from private field"),n?n.call(e):t.get(e)),ee=(e,t,n)=>t.has(e)?J("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),te=(e,t,n,r)=>(Q(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ne=(e,t,n)=>(Q(e,t,"access private method"),n),re=Symbol.for("preact-signals");function ae(){if(le>1)le--;else{for(var e,t=!1;void 0!==se;){var n=se;for(se=void 0,ce++;void 0!==n;){var r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&ge(n))try{n.c()}catch(a){t||(e=a,t=!0)}n=r}}if(ce=0,le--,t)throw e}}var oe=void 0;function ie(e){var t=oe;oe=void 0;try{return e()}finally{oe=t}}var se=void 0,le=0,ce=0,he=0;function ue(e){if(void 0!==oe){var t=e.n;if(void 0===t||t.t!==oe)return t={i:0,S:e,p:oe.s,n:void 0,t:oe,e:void 0,x:void 0,r:t},void 0!==oe.s&&(oe.s.n=t),oe.s=t,e.n=t,32&oe.f&&e.S(t),t;if(-1===t.i)return t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=oe.s,t.n=void 0,oe.s.n=t,oe.s=t),t}}function pe(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function de(e,t){return new pe(e,t)}function ge(e){for(var t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function fe(e){for(var t=e.s;void 0!==t;t=t.n){var n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function me(e){for(var t=e.s,n=void 0;void 0!==t;){var r=t.p;-1===t.i?(t.S.U(t),void 0!==r&&(r.n=t.n),void 0!==t.n&&(t.n.p=r)):n=t,t.S.n=t.r,void 0!==t.r&&(t.r=void 0),t=r}e.s=n}function be(e,t){pe.call(this,void 0),this.x=e,this.s=void 0,this.g=he-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function ve(e,t){return new be(e,t)}function ye(e){var t=e.u;if(e.u=void 0,"function"==typeof t){le++;var n=oe;oe=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,we(e),r}finally{oe=n,ae()}}}function we(e){for(var t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ye(e)}function xe(e){if(oe!==this)throw new Error("Out-of-order effect");me(this),oe=e,this.f&=-2,8&this.f&&we(this),ae()}function Me(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function ke(e,t){var n=new Me(e,t);try{n.c()}catch(a){throw n.d(),a}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}function $e(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Se(e,t,n=[0,0,0]){const r=$e(e,t[0]),a=$e(e,t[1]),o=$e(e,t[2]);return n[0]=r,n[1]=a,n[2]=o,n}function Ce(e){return"string"===Le(e)}function Le(e){return(Object.prototype.toString.call(e).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function Ae(e,{precision:t=16,unit:n}){return Ee(e)?"none":(e=+Be(e,t))+(null!=n?n:"")}function Ee(e){return null===e}function Be(e,t){if(0===e)return 0;let n=~~e,r=0;n&&t&&(r=1+~~Math.log10(Math.abs(n)));const a=10**(t-r);return Math.floor(e*a+.5)/a}function Re(e,t,n){return isNaN(e)?t:isNaN(t)?e:e+(t-e)*n}function ze(e,t,n){return!e||!t||e===t||e[0]===t[0]&&e[1]===t[1]||isNaN(n)||null===n?n:Re(t[0],t[1],function(e,t,n){return(n-e)/(t-e)}(e[0],e[1],n))}function Ie(e,t,n){return Math.max(Math.min(n,t),e)}function We(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function He(e,t){return We(Math.abs(e)**t,e)}function qe(e,t){return 0===t?0:e/t}function Pe(e,t){var n;if(e instanceof t)return!0;const r=t.name;for(;e;){const t=Object.getPrototypeOf(e),a=null==(n=null==t?void 0:t.constructor)?void 0:n.name;if(a===r)return!0;if(!a||"Object"===a)return!1;e=t}return!1}pe.prototype.brand=re,pe.prototype.h=function(){return!0},pe.prototype.S=function(e){var t=this,n=this.t;n!==e&&void 0===e.e&&(e.x=n,this.t=e,void 0!==n?n.e=e:ie(function(){var e;null==(e=t.W)||e.call(t)}))},pe.prototype.U=function(e){var t=this;if(void 0!==this.t){var n=e.e,r=e.x;void 0!==n&&(n.x=r,e.e=void 0),void 0!==r&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,void 0===r&&ie(function(){var e;null==(e=t.Z)||e.call(t)}))}},pe.prototype.subscribe=function(e){var t=this;return ke(function(){var n=t.value,r=oe;oe=void 0;try{e(n)}finally{oe=r}},{name:"sub"})},pe.prototype.valueOf=function(){return this.value},pe.prototype.toString=function(){return this.value+""},pe.prototype.toJSON=function(){return this.value},pe.prototype.peek=function(){var e=oe;oe=void 0;try{return this.value}finally{oe=e}},Object.defineProperty(pe.prototype,"value",{get:function(){var e=ue(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(ce>100)throw new Error("Cycle detected");this.v=e,this.i++,he++,le++;try{for(var t=this.t;void 0!==t;t=t.x)t.t.N()}finally{ae()}}}}),be.prototype=new pe,be.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===he)return!0;if(this.g=he,this.f|=1,this.i>0&&!ge(this))return this.f&=-2,!0;var e=oe;try{fe(this),oe=this;var t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return oe=e,me(this),this.f&=-2,!0},be.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var t=this.s;void 0!==t;t=t.n)t.S.S(t)}pe.prototype.S.call(this,e)},be.prototype.U=function(e){if(void 0!==this.t&&(pe.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var t=this.s;void 0!==t;t=t.n)t.S.U(t)}},be.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(be.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=ue(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Me.prototype.c=function(){var e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var t=this.x();"function"==typeof t&&(this.u=t)}finally{e()}},Me.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ye(this),fe(this),le++;var e=oe;return oe=this,xe.bind(this,e)},Me.prototype.N=function(){2&this.f||(this.f|=2,this.o=se,se=this)},Me.prototype.d=function(){this.f|=8,1&this.f||we(this)},Me.prototype.dispose=function(){this.d()};class je{constructor(e,t){var n;if(U(this,"type"),U(this,"coordMeta"),U(this,"coordRange"),U(this,"range"),"object"==typeof e&&(this.coordMeta=e),t&&(this.coordMeta=t,this.coordRange=null!=(n=t.range)?n:t.refRange),"string"==typeof e){let t=e.trim().match(/^(?<type><[a-z]+>)(\[(?<min>-?[.\d]+),\s*(?<max>-?[.\d]+)\])?$/);if(!t)throw new TypeError(`Cannot parse ${e} as a type definition.`);this.type=t.groups.type;let{min:n,max:r}=t.groups;(n||r)&&(this.range=[+n,+r])}}get computedRange(){return this.range?this.range:"<percentage>"===this.type?this.percentageRange():"<angle>"===this.type?[0,360]:null}get unit(){return"<percentage>"===this.type?"%":"<angle>"===this.type?"deg":""}resolve(e){if("<angle>"===this.type)return e;let t=this.computedRange,n=this.coordRange;return"<percentage>"===this.type&&(null!=n||(n=this.percentageRange())),ze(t,n,e)}serialize(e,t){let n="<percentage>"===this.type?this.percentageRange(100):this.computedRange,r=this.unit;return Ae(e=ze(this.coordRange,n,e),{unit:r,precision:t})}toString(){let e=this.type;if(this.range){let[t="",n=""]=this.range;e+=`[${t},${n}]`}return e}percentageRange(e=1){let t;return t=this.coordMeta&&this.coordMeta.range||this.coordRange&&this.coordRange[0]>=0?[0,1]:[-1,1],[t[0]*e,t[1]*e]}static get(e,t){return Pe(e,this)?e:new this(e,t)}}const Te=Symbol("instance");class Oe{constructor(e,t=e.space){U(this,"type"),U(this,"name"),U(this,"spaceCoords"),U(this,"coords"),U(this,"id"),U(this,"alpha"),e[Te]=this,this.type="function",this.name="color",Object.assign(this,e),this.space=t,"custom"!==this.type&&(this.spaceCoords=Object.values(t.coords),this.coords||(this.coords=this.spaceCoords.map(e=>{let t=["<number>","<percentage>"];return"angle"===e.type&&t.push("<angle>"),t})),this.coords=this.coords.map((e,t)=>{let n=this.spaceCoords[t];return"string"==typeof e&&(e=e.trim().split(/\s*\|\s*/)),e.map(e=>je.get(e,n))}))}serializeCoords(e,t,n){return n=e.map((e,t)=>{var r;return je.get(null!=(r=null==n?void 0:n[t])?r:this.coords[t][0],this.spaceCoords[t])}),e.map((e,r)=>n[r].serialize(e,t))}coerceCoords(e,t){return Object.entries(this.space.coords).map(([n,r],a)=>{var o;let i=e[a];if(Ee(i)||isNaN(i))return i;let s=t[a],l=this.coords[a].find(e=>e.type==s);if(!l){let e=r.name||n;throw new TypeError(`${null!=(o=null!=s?s:null==i?void 0:i.raw)?o:i} not allowed for ${e} in ${this.name}()`)}return i=l.resolve(i),l.range&&(t[a]=l.toString()),i})}canSerialize(){return"function"===this.type||this.serialize}parse(e){return null}static get(e,...t){return!e||Pe(e,this)?e:e[Te]?e[Te]:new Oe(e,...t)}}const Ne=new class{add(e,t,n){if("string"==typeof arguments[0])(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][n?"unshift":"push"](t)},this);else for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1])}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},De={D50:[.3457/.3585,1,.2958/.3585],D65:[.3127/.329,1,.3583/.329]};function Ge(e){return Array.isArray(e)?e:De[e]}function Fe(e,t,n,r={}){if(e=Ge(e),t=Ge(t),!e||!t)throw new TypeError(`Missing white point to convert ${e?"":"from"}${e||t?"":"/"}${t?"":"to"}`);if(e===t)return n;let a={W1:e,W2:t,XYZ:n,options:r};if(Ne.run("chromatic-adaptation-start",a),a.M||(a.W1===De.D65&&a.W2===De.D50?a.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:a.W1===De.D50&&a.W2===De.D65&&(a.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),Ne.run("chromatic-adaptation-end",a),a.M)return Se(a.XYZ,a.M);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const Xe={gamut_mapping:"css",precision:5,deltaE:"76",verbose:"test"!==(null==(r=null==(n=null==(t=null==globalThis?void 0:globalThis.process)?void 0:t.env)?void 0:n.NODE_ENV)?void 0:r.toLowerCase()),warn:function(e){var t,n;this.verbose&&(null==(n=null==(t=null==globalThis?void 0:globalThis.console)?void 0:t.warn)||n.call(t,e))}};function Ze(e,t){var n,r,a,o;let i,s={str:null==(n=String(e))?void 0:n.trim(),options:t};if(Ne.run("parse-start",s),s.color)return s.color;s.parsed=function(e){if(!e)return;let t=(e=e.trim()).match(Ye.function);if(t){let e=[],n=[],r=!1,a=t[1].toLowerCase(),o=t[2].replace(Ye.singleArgument,(t,o)=>{let{value:i,meta:s}=function(e){var t;let n={},r=null==(t=e.match(Ye.unitValue))?void 0:t[0],a=n.raw=e;return r?(n.type="%"===r?"<percentage>":"<angle>",n.unit=r,n.unitless=Number(a.slice(0,-r.length)),a=n.unitless*_e[r]):Ye.number.test(a)?(a=Number(a),n.type="<number>"):"none"===a?a=null:"NaN"===a||"calc(NaN)"===a?(a=NaN,n.type="<number>"):n.type="<ident>",{value:a,meta:n}}(o);return(t.startsWith("/")||"color"!==a&&3===e.length)&&(r=!0),e.push(i),n.push(s),""});return{name:a,args:e,argMeta:n,lastAlpha:r,commas:o.includes(","),rawName:t[1],rawArgs:t[2]}}}(s.str);let l=s.options?null!=(r=s.options.parseMeta)?r:s.options.meta:null;if(s.parsed){let t,n,r=s.parsed.name,c=s.parsed.args,h=c.map((e,t)=>{var n;return null==(n=s.parsed.argMeta[t])?void 0:n.type});if("color"===r){let i=c.shift();h.shift();let l=i.startsWith("--")?i.substring(2):`--${i}`,u=[i,l];if(t=Ue.findFormat({name:r,id:u,type:"function"}),!t){let t,n=i in Ue.registry?i:l;if(n in Ue.registry){let r=null==(o=null==(a=Ue.registry[n].formats)?void 0:a.color)?void 0:o.id;r&&(t=`Did you mean ${e.replace("color("+i,"color("+r)}?`)}throw new TypeError(`Cannot parse ${s.str}. `+(null!=t?t:"Missing a plugin?"))}n=t.space,t.id.startsWith("--")&&!i.startsWith("--")&&Xe.warn(`${n.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${t.id}) instead of color(${i}).`),i.startsWith("--")&&!t.id.startsWith("--")&&Xe.warn(`${n.name} is a standard space and supported in the CSS spec. Use color(${t.id}) instead of prefixed color(${i}).`)}else t=Ue.findFormat({name:r,type:"function"}),n=t.space;l&&Object.assign(l,{format:t,formatId:t.name,types:h,commas:s.parsed.commas});let u=1;s.parsed.lastAlpha&&(u=s.parsed.args.pop(),l&&(l.alphaType=h.pop()));let p=t.coords.length;if(c.length!==p)throw new TypeError(`Expected ${p} coordinates for ${n.id} in ${s.str}), got ${c.length}`);c=t.coerceCoords(c,h),i={spaceId:n.id,coords:c,alpha:u}}else e:for(let c of Ue.all)for(let e in c.formats){let t=c.formats[e];if("custom"!==t.type)continue;if(t.test&&!t.test(s.str))continue;let n=c.getFormat(t),r=n.parse(s.str);if(r){l&&Object.assign(l,{format:n,formatId:e}),i=r;break e}}if(!i)throw new TypeError(`Could not parse ${e} as a color. Missing a plugin?`);return i.alpha=Ee(i.alpha)?i.alpha:void 0===i.alpha?1:Ie(0,i.alpha,1),i}const _e={"%":.01,deg:1,grad:.9,rad:180/Math.PI,turn:360},Ye={function:/^([a-z]+)\(((?:calc\(NaN\)|.)+?)\)$/i,number:/^([-+]?(?:[0-9]*\.)?[0-9]+(e[-+]?[0-9]+)?)$/i,unitValue:RegExp(`(${Object.keys(_e).join("|")})$`),singleArgument:/\/?\s*(none|NaN|calc\(NaN\)|[-+\w.]+(?:%|deg|g?rad|turn)?)/g};function Ve(e,t){if(Array.isArray(e))return e.map(e=>Ve(e,t));if(!e)throw new TypeError("Empty color reference");Ce(e)&&(e=Ze(e,t));let n=e.space||e.spaceId;return"string"==typeof n&&(e.space=Ue.get(n)),void 0===e.alpha&&(e.alpha=1),e}const Je=class e{constructor(t){var n,r,a,o,i,s;this.id=t.id,this.name=t.name,this.base=t.base?e.get(t.base):null,this.aliases=t.aliases,this.base&&(this.fromBase=t.fromBase,this.toBase=t.toBase);let l=null!=(n=t.coords)?n:this.base.coords;for(let e in l)"name"in l[e]||(l[e].name=e);this.coords=l;let c=null!=(a=null!=(r=t.white)?r:this.base.white)?a:"D65";this.white=Ge(c),this.formats=null!=(o=t.formats)?o:{};for(let e in this.formats){let t=this.formats[e];t.type||(t.type="function"),t.name||(t.name=e)}(null==(i=this.formats.color)?void 0:i.id)||(this.formats.color={...null!=(s=this.formats.color)?s:{},id:t.cssId||this.id}),t.gamutSpace?this.gamutSpace="self"===t.gamutSpace?this:e.get(t.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(e,t)=>!0),this.referred=t.referred,Object.defineProperty(this,"path",{value:Qe(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),Ne.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=75e-6}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let n=Object.values(this.coords);return e.every((e,r)=>{let a=n[r];if("angle"!==a.type&&a.range){if(Ee(e))return!0;let[n,r]=a.range;return(void 0===n||e>=n-t)&&(void 0===r||e<=r+t)}return!0})}get isUnbounded(){return Object.values(this.coords).every(e=>!("range"in e))}get cssId(){var e,t;return(null==(t=null==(e=this.formats)?void 0:e.color)?void 0:t.id)||this.id}get isPolar(){for(let e in this.coords)if("angle"===this.coords[e].type)return!0;return!1}getFormat(e){if(!e)return null;"default"===e?e=Object.values(this.formats)[0]:"string"==typeof e&&(e=this.formats[e]);let t=Oe.get(e,this);return t!==e&&e.name in this.formats&&(this.formats[e.name]=t),t}equals(e){return!!e&&(this===e||this.id===e||this.id===e.id)}to(t,n){if(1===arguments.length){const e=Ve(t);[t,n]=[e.space,e.coords]}if(t=e.get(t),this.equals(t))return n;n=n.map(e=>Ee(e)?0:e);let r,a,o=this.path,i=t.path;for(let e=0;e<o.length&&o[e].equals(i[e]);e++)r=o[e],a=e;if(!r)throw new Error(`Cannot convert between color spaces ${this} and ${t}: no connection space was found`);for(let e=o.length-1;e>a;e--)n=o[e].toBase(n);for(let e=a+1;e<i.length;e++)n=i[e].fromBase(n);return n}from(t,n){if(1===arguments.length){const e=Ve(t);[t,n]=[e.space,e.coords]}return(t=e.get(t)).to(this,n)}toString(){return`${this.name} (${this.id})`}getMinCoords(){var e;let t=[];for(let n in this.coords){let r=this.coords[n],a=r.range||r.refRange;t.push(null!=(e=null==a?void 0:a.min)?e:0)}return t}static get all(){return[...new Set(Object.values(e.registry))]}static register(e,t){if(1===arguments.length&&(e=(t=arguments[0]).id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,1===arguments.length&&t.aliases)for(let n of t.aliases)this.register(n,t);return t}static get(t,...n){if(!t||Pe(t,this))return t;if("string"===Le(t)){let n=e.registry[t.toLowerCase()];if(!n)throw new TypeError(`No color space found with id = "${t}"`);return n}if(n.length)return e.get(...n);throw new TypeError(`${t} is not a valid color space`)}static findFormat(t,n=e.all){if(!t)return null;"string"==typeof t&&(t={name:t});for(let e of n)for(let[n,r]of Object.entries(e.formats)){null!=r.name||(r.name=n),null!=r.type||(r.type="function");let a=!(t.name&&r.name!==t.name||t.type&&r.type!==t.type);if(t.id){let e=r.ids||[r.id],n=Array.isArray(t.id)?t.id:[t.id];a&&(a=n.some(t=>e.includes(t)))}if(a){let t=Oe.get(r,e);return t!==r&&(e.formats[r.name]=t),t}}return null}static resolveCoord(t,n){var r;let a,o,i=Le(t);if("string"===i?t.includes(".")?[a,o]=t.split("."):[a,o]=[,t]:Array.isArray(t)?[a,o]=t:(a=t.space,o=t.coordId),a=e.get(a),a||(a=n),!a)throw new TypeError(`Cannot resolve coordinate reference ${t}: No color space specified and relative references are not allowed here`);if(i=Le(o),"number"===i||"string"===i&&o>=0){let e=Object.entries(a.coords)[o];if(e)return{space:a,id:e[0],index:o,...e[1]}}a=e.get(a);let s=o.toLowerCase(),l=0;for(let e in a.coords){let t=a.coords[e];if(e.toLowerCase()===s||(null==(r=t.name)?void 0:r.toLowerCase())===s)return{space:a,id:e,index:l,...t};l++}throw new TypeError(`No "${o}" coordinate found in ${a.name}. Its coordinates are: ${Object.keys(a.coords).join(", ")}`)}};U(Je,"registry",{}),U(Je,"DEFAULT_FORMAT",{type:"functions",name:"color"});let Ue=Je;function Qe(e){let t=[e];for(let n=e;n=n.base;)t.push(n);return t}const Ke=new Ue({id:"xyz-d65",name:"XYZ D65",coords:{x:{refRange:[0,1],name:"X"},y:{refRange:[0,1],name:"Y"},z:{refRange:[0,1],name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class et extends Ue{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=Ke),e.toXYZ_M&&e.fromXYZ_M&&(null!=e.toBase||(e.toBase=t=>{let n=Se(t,e.toXYZ_M);return this.white!==this.base.white&&(n=Fe(this.white,this.base.white,n)),n}),null!=e.fromBase||(e.fromBase=t=>Se(t=Fe(this.base.white,this.white,t),e.fromXYZ_M))),null!=e.referred||(e.referred="display"),super(e)}}function tt(e,t){e=Ve(e);let n,r=Ue.get(t,null==t?void 0:t.space),a=null==t?void 0:t.precision;return n=!r||e.space.equals(r)?e.coords.slice():r.from(e),void 0===a?n:n.map(e=>Be(e,a))}function nt(e,t){var n;if(e=Ve(e),"alpha"===t)return null!=(n=e.alpha)?n:1;let{space:r,index:a}=Ue.resolveCoord(t,e.space);return tt(e,r)[a]}function rt(e,t,n,r){return e=Ve(e),Array.isArray(t)&&([t,n,r]=[e.space,t,n]),t=Ue.get(t),e.coords=t===e.space?n.slice():t.to(e.space,n),void 0!==r&&(e.alpha=r),e}function at(e,t,n){if(e=Ve(e),2===arguments.length&&"object"===Le(arguments[1])){let t=arguments[1];for(let n in t)at(e,n,t[n])}else if("function"==typeof n&&(n=n(nt(e,t))),"alpha"===t)e.alpha=n;else{let{space:r,index:a}=Ue.resolveCoord(t,e.space),o=tt(e,r);o[a]=n,rt(e,r,o)}return e}rt.returns="color",at.returns="color";const ot=new Ue({id:"xyz-d50",name:"XYZ D50",white:"D50",base:Ke,fromBase:e=>Fe(Ke.white,"D50",e),toBase:e=>Fe("D50",Ke.white,e)}),it=216/24389,st=24/116,lt=24389/27;let ct=De.D50;const ht=new Ue({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:ct,base:ot,fromBase(e){let t=e.map((e,t)=>e/ct[t]).map(e=>e>it?Math.cbrt(e):(lt*e+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(e){let[t,n,r]=e,a=[];return a[1]=(t+16)/116,a[0]=n/500+a[1],a[2]=a[1]-r/200,[a[0]>st?Math.pow(a[0],3):(116*a[0]-16)/lt,e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/lt,a[2]>st?Math.pow(a[2],3):(116*a[2]-16)/lt].map((e,t)=>e*ct[t])},formats:{lab:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <percentage>"]}}});function ut(e){return"number"!=typeof e?e:(e%360+360)%360}const pt=new Ue({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:ht,fromBase(e){if(void 0===this.ε){let e=Object.values(this.base.coords)[1].refRange,t=e[1]-e[0];this.ε=t/1e5}let[t,n,r]=e,a=Math.abs(n)<this.ε&&Math.abs(r)<this.ε,o=a?null:ut(180*Math.atan2(r,n)/Math.PI);return[t,a?0:Math.sqrt(n**2+r**2),o]},toBase(e){let[t,n,r]=e,a=null,o=null;return Ee(r)||(n=n<0?0:n,a=n*Math.cos(r*Math.PI/180),o=n*Math.sin(r*Math.PI/180)),[t,a,o]},formats:{lch:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <angle>"]}}}),dt=25**7,gt=Math.PI,ft=180/gt,mt=gt/180;function bt(e){const t=e*e;return t*t*t*e}function vt(e,t,{kL:n=1,kC:r=1,kH:a=1}={}){[e,t]=Ve([e,t]);let[o,i,s]=ht.from(e),l=pt.from(ht,[o,i,s])[1],[c,h,u]=ht.from(t),p=pt.from(ht,[c,h,u])[1];l<0&&(l=0),p<0&&(p=0);let d=bt((l+p)/2),g=.5*(1-Math.sqrt(d/(d+dt))),f=(1+g)*i,m=(1+g)*h,b=Math.sqrt(f**2+s**2),v=Math.sqrt(m**2+u**2),y=0===f&&0===s?0:Math.atan2(s,f),w=0===m&&0===u?0:Math.atan2(u,m);y<0&&(y+=2*gt),w<0&&(w+=2*gt),y*=ft,w*=ft;let x,M=c-o,k=v-b,$=w-y,S=y+w,C=Math.abs($);b*v===0?x=0:C<=180?x=$:$>180?x=$-360:$<-180?x=$+360:Xe.warn("the unthinkable has happened");let L,A=2*Math.sqrt(v*b)*Math.sin(x*mt/2),E=(o+c)/2,B=(b+v)/2,R=bt(B);L=b*v===0?S:C<=180?S/2:S<360?(S+360)/2:(S-360)/2;let z=(E-50)**2,I=1+.015*z/Math.sqrt(20+z),W=1+.045*B,H=1;H-=.17*Math.cos((L-30)*mt),H+=.24*Math.cos(2*L*mt),H+=.32*Math.cos((3*L+6)*mt),H-=.2*Math.cos((4*L-63)*mt);let q=1+.015*B*H,P=30*Math.exp(-1*((L-275)/25)**2),j=2*Math.sqrt(R/(R+dt)),T=(M/(n*I))**2;return T+=(k/(r*W))**2,T+=(A/(a*q))**2,T+=-1*Math.sin(2*P*mt)*j*(k/(r*W))*(A/(a*q)),Math.sqrt(T)}const yt=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],wt=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],xt=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],Mt=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],kt=new Ue({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:Ke,fromBase(e){let t=Se(e,yt);return t[0]=Math.cbrt(t[0]),t[1]=Math.cbrt(t[1]),t[2]=Math.cbrt(t[2]),Se(t,xt,t)},toBase(e){let t=Se(e,Mt);return t[0]=t[0]**3,t[1]=t[1]**3,t[2]=t[2]**3,Se(t,wt,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <percentage>"]}}});function $t(e,t){[e,t]=Ve([e,t]);let[n,r,a]=kt.from(e),[o,i,s]=kt.from(t),l=n-o,c=r-i,h=a-s;return Math.sqrt(l**2+c**2+h**2)}function St(e,t,{epsilon:n=75e-6}={}){e=Ve(e),t||(t=e.space),t=Ue.get(t);let r=e.coords;return t!==e.space&&(r=t.from(e)),t.inGamut(r,{epsilon:n})}function Ct(e){return{space:e.space,coords:e.coords.slice(),alpha:e.alpha}}const Lt=Math.PI/180,At=new Ue({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:Ke,fromBase:e=>e.map(e=>203*e),toBase:e=>e.map(e=>e/203)}),Et=1.15,Bt=.66,Rt=2610/16384,zt=16384/2610,It=.8359375,Wt=2413/128,Ht=18.6875,qt=1.7*2523/32,Pt=32/(1.7*2523),jt=-.56,Tt=16295499532821565e-27,Ot=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],Nt=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],Dt=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],Gt=[[1,.13860504327153927,.05804731615611883],[1,-.1386050432715393,-.058047316156118904],[1,-.09601924202631895,-.811891896056039]],Ft=new Ue({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.21,.21]},bz:{refRange:[-.21,.21]}},base:At,fromBase(e){let[t,n,r]=e,a=Se([Et*t-(Et-1)*r,Bt*n-(Bt-1)*t,r],Ot).map(function(e){let t=It+Wt*He(e/1e4,Rt),n=1+Ht*He(e/1e4,Rt);return He(t/n,qt)}),[o,i,s]=Se(a,Dt);return[(1+jt)*o/(1+jt*o)-Tt,i,s]},toBase(e){let[t,n,r]=e,a=Se([(t+Tt)/(1+jt-jt*(t+Tt)),n,r],Gt).map(function(e){let t=It-He(e,Pt),n=Ht*He(e,Pt)-Wt;return 1e4*He(t/n,zt)}),[o,i,s]=Se(a,Nt),l=(o+(Et-1)*s)/Et;return[l,(i+(Bt-1)*l)/Bt,s]},formats:{jzazbz:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <percentage>"]}}}),Xt=new Ue({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,.26],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:Ft,fromBase:pt.fromBase,toBase:pt.toBase,formats:{jzczhz:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <angle>"]}}}),Zt=.8359375,_t=2413/128,Yt=18.6875,Vt=2610/16384,Jt=16384/2610,Ut=32/2523,Qt=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],Kt=[[.5,.5,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],en=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],tn=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]],nn=new Ue({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:At,fromBase:e=>{return t=Se(e,Qt),Se(t.map(function(e){return((Zt+_t*(e/1e4)**Vt)/(1+Yt*(e/1e4)**Vt))**78.84375}),Kt);var t},toBase(e){let t=function(e){return Se(e,en).map(function(e){return 1e4*(Math.max(e**Ut-Zt,0)/(_t-Yt*e**Ut))**Jt})}(e);return Se(t,tn)},formats:{ictcp:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <percentage>"]}}}),rn=De.D65,an=1/.42,on=2*Math.PI,sn=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],ln=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],cn=[[460,451,288],[460,-891,-261],[460,-220,-6300]],hn={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},un={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},pn=180/Math.PI,dn=Math.PI/180;function gn(e,t){return e.map(e=>{const n=He(t*Math.abs(e)*.01,.42);return 400*We(n,e)/(n+27.13)})}function fn(e,t,n,r,a){const o={};o.discounting=a,o.refWhite=e,o.surround=r;const i=e.map(e=>100*e);o.la=t,o.yb=n;const s=i[1],l=Se(i,sn);let c=hn[o.surround];const h=c[0];o.c=c[1],o.nc=c[2];const u=(1/(5*o.la+1))**4;o.fl=u*o.la+.1*(1-u)*(1-u)*Math.cbrt(5*o.la),o.flRoot=o.fl**.25,o.n=o.yb/s,o.z=1.48+Math.sqrt(o.n),o.nbb=.725*o.n**-.2,o.ncb=o.nbb;const p=Math.max(Math.min(h*(1-1/3.6*Math.exp((-o.la-42)/92)),1),0);o.dRgb=l.map(e=>Re(1,s/e,p)),o.dRgbInv=o.dRgb.map(e=>1/e);const d=gn(l.map((e,t)=>e*o.dRgb[t]),o.fl);return o.aW=o.nbb*(2*d[0]+d[1]+.05*d[2]),o}const mn=fn(rn,64/Math.PI*.2,20,"average",!1);function bn(e,t){if(!(void 0!==e.J^void 0!==e.Q))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(void 0!==e.C^void 0!==e.M^void 0!==e.s))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(void 0!==e.h^void 0!==e.H))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(0===e.J||0===e.Q)return[0,0,0];let n=0;n=void 0!==e.h?ut(e.h)*dn:function(e){let t=(e%400+400)%400;const n=Math.floor(.01*t);t%=100;const[r,a]=un.h.slice(n,n+2),[o,i]=un.e.slice(n,n+2);return ut((t*(i*r-o*a)-100*r*i)/(t*(i-o)-100*i))}(e.H)*dn;const r=Math.cos(n),a=Math.sin(n);let o=0;void 0!==e.J?o=.1*He(e.J,.5):void 0!==e.Q&&(o=.25*t.c*e.Q/((t.aW+4)*t.flRoot));let i=0;void 0!==e.C?i=e.C/o:void 0!==e.M?i=e.M/t.flRoot/o:void 0!==e.s&&(i=4e-4*e.s**2*(t.aW+4)/t.c);const s=He(i*Math.pow(1.64-Math.pow(.29,t.n),-.73),10/9),l=.25*(Math.cos(n+2)+3.8),c=t.aW*He(o,2/t.c/t.z),h=5e4/13*t.nc*t.ncb*l,u=c/t.nbb,p=23*(u+.305)*qe(s,23*h+s*(11*r+108*a)),d=function(e,t){const n=100/t*2588.068098016295;return e.map(e=>{const t=Math.abs(e);return We(n*He(t/(400-t),an),e)})}(Se([u,p*r,p*a],cn).map(e=>1*e/1403),t.fl);return Se(d.map((e,n)=>e*t.dRgbInv[n]),ln).map(e=>e/100)}function vn(e,t){const n=gn(Se(e.map(e=>100*e),sn).map((e,n)=>e*t.dRgb[n]),t.fl),r=n[0]+(-12*n[1]+n[2])/11,a=(n[0]+n[1]-2*n[2])/9,o=(Math.atan2(a,r)%on+on)%on,i=.25*(Math.cos(o+2)+3.8),s=He(5e4/13*t.nc*t.ncb*qe(i*Math.sqrt(r**2+a**2),n[0]+n[1]+1.05*n[2]+.305),.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),l=He(t.nbb*(2*n[0]+n[1]+.05*n[2])/t.aW,.5*t.c*t.z),c=100*He(l,2),h=4/t.c*l*(t.aW+4)*t.flRoot,u=s*l,p=u*t.flRoot,d=ut(o*pn),g=function(e){let t=ut(e);t<=un.h[0]&&(t+=360);const n=function(e,t,n=0,r=e.length){for(;n<r;){const a=n+r>>1;e[a]<t?n=a+1:r=a}return n}(un.h,t)-1,[r,a]=un.h.slice(n,n+2),[o,i]=un.e.slice(n,n+2),s=(t-r)/o;return un.H[n]+100*s/(s+(a-t)/i)}(d);return{J:c,C:u,h:d,s:50*He(t.c*s/(t.aW+4),.5),Q:h,M:p,H:g}}new Ue({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Ke,fromBase(e){void 0===this.ε&&(this.ε=Object.values(this.coords)[1].refRange[1]/1e5);const t=vn(e,mn),n=Math.abs(t.M)<this.ε;return[t.J,n?0:t.M,n?null:t.h]},toBase:e=>bn({J:e[0],M:e[1],h:e[2]},mn)});const yn=216/24389,wn=24389/27;function xn(e){return e>8?Math.pow((e+16)/116,3):e/wn}const Mn=fn(De.D65,200/Math.PI*xn(50),100*xn(50),"average",!1),kn=new Ue({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:Ke,fromBase(e){void 0===this.ε&&(this.ε=Object.values(this.coords)[1].refRange[1]/1e5);let t=function(e){const t=116*((n=e[1])>yn?Math.cbrt(n):(wn*n+16)/116)-16;var n;if(0===t)return[0,0,0];const r=vn(e,Mn);return[ut(r.h),r.C,t]}(e);return t[1]<this.ε&&(t[1]=0,t[0]=null),t},toBase:e=>function(e,t){let[n,r,a]=e,o=[],i=0;if(0===a)return[0,0,0];let s=xn(a);i=a>0?.00379058511492914*a**2+.608983189401032*a+.9155088574762233:9514440756550361e-21*a**2+.08693057439788597*a-21.928975842194614;let l=0,c=1/0;for(;l<=15;){o=bn({J:i,C:r,h:n},t);const e=Math.abs(o[1]-s);if(e<c){if(e<=2e-12)return o;c=e}i-=(o[1]-s)*i/(2*o[1]),l+=1}return bn({J:i,C:r,h:n},t)}(e,Mn),formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),$n=Math.PI/180,Sn=[1,.007,.0228];function Cn(e){e[1]<0&&(e=kn.fromBase(kn.toBase(e)));const t=Math.log(Math.max(1+Sn[2]*e[1]*Mn.flRoot,1))/Sn[2],n=e[0]*$n,r=t*Math.cos(n),a=t*Math.sin(n);return[e[2],r,a]}const Ln={deltaE76:function(e,t){return function(e,t,n="lab"){let r=(n=Ue.get(n)).from(e),a=n.from(t);return Math.sqrt(r.reduce((e,t,n)=>{let r=a[n];return Ee(t)||Ee(r)?e:e+(r-t)**2},0))}(e,t,"lab")},deltaECMC:function(e,t,{l:n=2,c:r=1}={}){[e,t]=Ve([e,t]);let[a,o,i]=ht.from(e),[,s,l]=pt.from(ht,[a,o,i]),[c,h,u]=ht.from(t),p=pt.from(ht,[c,h,u])[1];s<0&&(s=0),p<0&&(p=0);let d=a-c,g=s-p,f=(o-h)**2+(i-u)**2-g**2,m=.511;a>=16&&(m=.040975*a/(1+.01765*a));let b,v=.0638*s/(1+.0131*s)+.638;Ee(l)&&(l=0),b=l>=164&&l<=345?.56+Math.abs(.2*Math.cos((l+168)*Lt)):.36+Math.abs(.4*Math.cos((l+35)*Lt));let y=Math.pow(s,4),w=Math.sqrt(y/(y+1900)),x=(d/(n*m))**2;return x+=(g/(r*v))**2,x+=f/(v*(w*b+1-w))**2,Math.sqrt(x)},deltaE2000:vt,deltaEJz:function(e,t){[e,t]=Ve([e,t]);let[n,r,a]=Xt.from(e),[o,i,s]=Xt.from(t),l=n-o,c=r-i;Ee(a)&&Ee(s)?(a=0,s=0):Ee(a)?a=s:Ee(s)&&(s=a);let h=a-s,u=2*Math.sqrt(r*i)*Math.sin(h/2*(Math.PI/180));return Math.sqrt(l**2+c**2+u**2)},deltaEITP:function(e,t){[e,t]=Ve([e,t]);let[n,r,a]=nn.from(e),[o,i,s]=nn.from(t);return 720*Math.sqrt((n-o)**2+.25*(r-i)**2+(a-s)**2)},deltaEOK:$t,deltaEOK2:function(e,t){[e,t]=Ve([e,t]);let[n,r,a]=kt.from(e),[o,i,s]=kt.from(t),l=n-o,c=2*(r-i),h=2*(a-s);return Math.sqrt(l**2+c**2+h**2)},deltaEHCT:function(e,t){[e,t]=Ve([e,t]);let[n,r,a]=Cn(kn.from(e)),[o,i,s]=Cn(kn.from(t));return Math.sqrt((n-o)**2+(r-i)**2+(a-s)**2)}},An={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function En(e,{method:t=Xe.gamut_mapping,space:n,deltaEMethod:r="",jnd:a=2,blackWhiteClamp:o}={}){if(e=Ve(e),Ce(arguments[1])?n=arguments[1]:n||(n=e.space),St(e,n=Ue.get(n),{epsilon:0}))return e;let i;if("css"===t)i=function(e,{space:t}={}){const n=.02,r=1e-4;e=Ve(e),t||(t=e.space),t=Ue.get(t);const a=Ue.get("oklch");if(t.isUnbounded)return Rn(e,t);const o=Rn(e,a);let i=o.coords[0];if(i>=1){const n=Rn(Bn.WHITE,t);return n.alpha=e.alpha,Rn(n,t)}if(i<=0){const n=Rn(Bn.BLACK,t);return n.alpha=e.alpha,Rn(n,t)}if(St(o,t,{epsilon:0}))return Rn(o,t);function s(e){const n=Rn(e,t),r=Object.values(t.coords);return n.coords=n.coords.map((e,t)=>{if("range"in r[t]){const[n,a]=r[t].range;return Ie(n,e,a)}return e}),n}let l=0,c=o.coords[1],h=!0,u=Ct(o),p=s(u),d=$t(p,u);if(d<n)return p;for(;c-l>r;){const e=(l+c)/2;if(u.coords[1]=e,h&&St(u,t,{epsilon:0}))l=e;else if(p=s(u),d=$t(p,u),d<n){if(n-d<r)break;h=!1,l=e}else c=e}return p}(e,{space:n});else{if("clip"===t||St(e,n))i=Rn(e,n);else{Object.prototype.hasOwnProperty.call(An,t)&&({method:t,jnd:a,deltaEMethod:r,blackWhiteClamp:o}=An[t]);let s=vt;if(""!==r)for(let e in Ln)if("deltae"+r.toLowerCase()===e.toLowerCase()){s=Ln[e];break}0===a&&(a=1e-16);let l=En(Rn(e,n),{method:"clip",space:n});if(s(e,l)>a){if(o&&3===Object.keys(o).length){let t=Ue.resolveCoord(o.channel),n=nt(Rn(e,t.space),t.id);if(Ee(n)&&(n=0),n>=o.max)return Rn({space:"xyz-d65",coords:De.D65},e.space);if(n<=o.min)return Rn({space:"xyz-d65",coords:[0,0,0]},e.space)}let r=Ue.resolveCoord(t),l=r.space,c=r.id,h=Rn(e,l);h.coords.forEach((e,t)=>{Ee(e)&&(h.coords[t]=0)});let u=(r.range||r.refRange)[0],p=function(e){const t=e?Math.floor(Math.log10(Math.abs(e))):0;return Math.max(parseFloat("1e"+(t-2)),1e-6)}(a),d=u,g=nt(h,c);for(;g-d>p;){let e=Ct(h);e=En(e,{space:n,method:"clip"}),s(h,e)-a<p?d=nt(h,c):g=nt(h,c),at(h,c,(d+g)/2)}i=Rn(h,n)}else i=l}if("clip"===t||!St(i,n,{epsilon:0})){let e=Object.values(n.coords).map(e=>e.range||[]);i.coords=i.coords.map((t,n)=>{let[r,a]=e[n];return void 0!==r&&(t=Math.max(r,t)),void 0!==a&&(t=Math.min(t,a)),t})}}return n!==e.space&&(i=Rn(i,e.space)),e.coords=i.coords,e}En.returns="color";const Bn={WHITE:{space:kt,coords:[1,0,0],alpha:1},BLACK:{space:kt,coords:[0,0,0],alpha:1}};function Rn(e,t,{inGamut:n}={}){e=Ve(e);let r=(t=Ue.get(t)).from(e),a={space:t,coords:r,alpha:e.alpha};return n&&(a=En(a,!0===n?void 0:n)),a}function zn(e,t={}){var n,r,a,o;let i,{precision:s=Xe.precision,format:l,inGamut:c=!0,coords:h,alpha:u,commas:p}=t,d=Ve(e),g=l,f=d.parseMeta;f&&!l&&(f.format.canSerialize()&&(l=f.format,g=f.formatId),null!=h||(h=f.types),null!=u||(u=f.alphaType),null!=p||(p=f.commas)),g&&(l=null!=(n=d.space.getFormat(l))?n:Ue.findFormat(g)),l||(l=null!=(r=d.space.getFormat("default"))?r:Ue.DEFAULT_FORMAT,g=l.name),l&&l.space&&l.space!==d.space&&(d=Rn(d,l.space));let m=d.coords.slice();if(c||(c=l.toGamut),c&&!St(d)&&(m=En(Ct(d),!0===c?void 0:c).coords),"custom"===l.type){if(!l.serialize)throw new TypeError(`format ${g} can only be used to parse colors, not for serialization`);i=l.serialize(m,d.alpha,t)}else{let e=l.name||"color",t=l.serializeCoords(m,s,h);if("color"===e){let e=l.id||(null==(a=l.ids)?void 0:a[0])||d.space.cssId||d.space.id;t.unshift(e)}let n=d.alpha;void 0!==u&&"object"!=typeof u&&(u="string"==typeof u?{type:u}:{include:u});let r=null!=(o=null==u?void 0:u.type)?o:"<number>",c=!0===(null==u?void 0:u.include)||!0===l.alpha||!1!==(null==u?void 0:u.include)&&!1!==l.alpha&&n<1,g="";if(null!=p||(p=l.commas),c){if(null!==s){let e;"<percentage>"===r&&(e="%",n*=100),n=Ae(n,{precision:s,unit:e})}g=`${p?",":" /"} ${n}`}i=`${e}(${t.join(p?", ":" ")}${g})`}return i}Rn.returns="color";const In=new et({id:"rec2020-linear",cssId:"--rec2020-linear",name:"Linear REC.2020",white:"D65",toXYZ_M:[[.6369580483012914,.14461690358620832,.1688809751641721],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],fromXYZ_M:[[1.716651187971268,-.355670783776392,-.25336628137366],[-.666684351832489,1.616481236634939,.0157685458139111],[.017639857445311,-.042770613257809,.942103121235474]]}),Wn=new et({id:"rec2020",name:"REC.2020",base:In,toBase:e=>e.map(function(e){let t=e<0?-1:1,n=e*t;return t*Math.pow(n,2.4)}),fromBase:e=>e.map(function(e){let t=e<0?-1:1,n=e*t;return t*Math.pow(n,1/2.4)})}),Hn=new et({id:"p3-linear",cssId:"display-p3-linear",name:"Linear P3",white:"D65",toXYZ_M:[[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],fromXYZ_M:[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]]}),qn=new et({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],fromXYZ_M:[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]]}),Pn={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[.6,50/255,.8],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,.6],lightslategrey:[119/255,136/255,.6],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[.4,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,.8],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[.4,.2,.6],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let jn=Array(3).fill("<percentage> | <number>[0, 255]"),Tn=Array(3).fill("<number>[0, 255]");const On=new et({id:"srgb",name:"sRGB",base:qn,fromBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n>.0031308?t*(1.055*n**(1/2.4)-.055):12.92*e}),toBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n<=.04045?e/12.92:t*((n+.055)/1.055)**2.4}),formats:{rgb:{coords:jn},rgb_number:{name:"rgb",commas:!0,coords:Tn,alpha:!1},color:{},rgba:{coords:jn,commas:!0,alpha:!0},rgba_number:{name:"rgba",commas:!0,coords:Tn},hex:{type:"custom",toGamut:!0,test:e=>/^#(([a-f0-9]{2}){3,4}|[a-f0-9]{3,4})$/i.test(e),parse(e){e.length<=5&&(e=e.replace(/[a-f0-9]/gi,"$&$&"));let t=[];return e.replace(/[a-f0-9]{2}/gi,e=>{t.push(parseInt(e,16)/255)}),{spaceId:"srgb",coords:t.slice(0,3),alpha:t.slice(3)[0]}},serialize:(e,t,{collapse:n=!0,alpha:r}={})=>{(!1!==r&&t<1||!0===r)&&e.push(t),e=e.map(e=>Math.round(255*e));let a=n&&e.every(e=>e%17==0);return"#"+e.map(e=>a?(e/17).toString(16):e.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:e=>/^[a-z]+$/i.test(e),parse(e){let t={spaceId:"srgb",coords:null,alpha:1};if("transparent"===(e=e.toLowerCase())?(t.coords=Pn.black,t.alpha=0):t.coords=Pn[e],t.coords)return t}}}}),Nn=new et({id:"p3",cssId:"display-p3",name:"P3",base:Hn,fromBase:On.fromBase,toBase:On.toBase});function Dn(e){return nt(e,[Ke,"y"])}function Gn(e){return e>=.022?e:e+(.022-e)**1.414}function Fn(e){let t=e<0?-1:1,n=Math.abs(e);return t*Math.pow(n,2.4)}function Xn(e,t){e=Ve(e),t=Ve(t);let n=nt(e,[ht,"l"]),r=nt(t,[ht,"l"]);return Math.abs(n-r)}const Zn=216/24389,_n=24/116,Yn=24389/27;let Vn=De.D65;const Jn=new Ue({id:"lab-d65",name:"Lab D65",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:Vn,base:Ke,fromBase(e){let t=e.map((e,t)=>e/Vn[t]).map(e=>e>Zn?Math.cbrt(e):(Yn*e+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(e){let t=[];return t[1]=(e[0]+16)/116,t[0]=e[1]/500+t[1],t[2]=t[1]-e[2]/200,[t[0]>_n?Math.pow(t[0],3):(116*t[0]-16)/Yn,e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/Yn,t[2]>_n?Math.pow(t[2],3):(116*t[2]-16)/Yn].map((e,t)=>e*Vn[t])},formats:{"lab-d65":{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <percentage>"]}}}),Un=.5*Math.pow(5,.5)+.5,Qn=Object.freeze(Object.defineProperty({__proto__:null,contrastAPCA:function(e,t){let n,r,a,o,i,s;t=Ve(t),e=Ve(e),t=Rn(t,"srgb"),[o,i,s]=t.coords.map(e=>Ee(e)?0:e);let l=.2126729*Fn(o)+.7151522*Fn(i)+.072175*Fn(s);e=Rn(e,"srgb"),[o,i,s]=e.coords.map(e=>Ee(e)?0:e);let c=.2126729*Fn(o)+.7151522*Fn(i)+.072175*Fn(s),h=Gn(l),u=Gn(c),p=u>h;return Math.abs(u-h)<5e-4?r=0:p?(n=u**.56-h**.57,r=1.14*n):(n=u**.65-h**.62,r=1.14*n),a=Math.abs(r)<.1?0:r>0?r-.027:r+.027,100*a},contrastDeltaPhi:function(e,t){e=Ve(e),t=Ve(t);let n=nt(e,[Jn,"l"]),r=nt(t,[Jn,"l"]),a=Math.abs(Math.pow(n,Un)-Math.pow(r,Un)),o=Math.pow(a,1/Un)*Math.SQRT2-40;return o<7.5?0:o},contrastLstar:Xn,contrastMichelson:function(e,t){e=Ve(e),t=Ve(t);let n=Math.max(Dn(e),0),r=Math.max(Dn(t),0);r>n&&([n,r]=[r,n]);let a=n+r;return 0===a?0:(n-r)/a},contrastWCAG21:function(e,t){e=Ve(e),t=Ve(t);let n=Math.max(Dn(e),0),r=Math.max(Dn(t),0);return r>n&&([n,r]=[r,n]),(n+.05)/(r+.05)},contrastWeber:function(e,t){e=Ve(e),t=Ve(t);let n=Math.max(Dn(e),0),r=Math.max(Dn(t),0);return r>n&&([n,r]=[r,n]),0===r?5e4:(n-r)/r}},Symbol.toStringTag,{value:"Module"}));function Kn(e,t,n){Ce(n)&&(n={algorithm:n});let{algorithm:r,...a}=n||{};if(!r){let e=Object.keys(Qn).map(e=>e.replace(/^contrast/,"")).join(", ");throw new TypeError(`contrast() function needs a contrast algorithm. Please specify one of: ${e}`)}e=Ve(e),t=Ve(t);for(let o in Qn)if("contrast"+r.toLowerCase()===o.toLowerCase())return Qn[o](e,t,a);throw new TypeError(`Unknown contrast algorithm: ${r}`)}const er=new Ue({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:On,fromBase:e=>{let t=Math.max(...e),n=Math.min(...e),[r,a,o]=e,[i,s,l]=[null,0,(n+t)/2],c=t-n;if(0!==c){switch(s=0===l||1===l?0:(t-l)/Math.min(l,1-l),t){case r:i=(a-o)/c+(a<o?6:0);break;case a:i=(o-r)/c+2;break;case o:i=(r-a)/c+4}i*=60}return s<0&&(i+=180,s=Math.abs(s)),i>=360&&(i-=360),[i,100*s,100*l]},toBase:e=>{let[t,n,r]=e;function a(e){let a=(e+t/30)%12,o=n*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(a-3,9-a,1))}return t%=360,t<0&&(t+=360),n/=100,r/=100,[a(0),a(8),a(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]},hsla:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"],commas:!0,alpha:!0}}}),tr=new Ue({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:On,fromBase(e){let t=Math.max(...e),n=Math.min(...e),[r,a,o]=e,[i,s,l]=[null,0,t],c=t-n;if(0!==c){switch(t){case r:i=(a-o)/c+(a<o?6:0);break;case a:i=(o-r)/c+2;break;case o:i=(r-a)/c+4}i*=60}return l&&(s=c/l),i>=360&&(i-=360),[i,100*s,100*l]},toBase(e){let[t,n,r]=e;function a(e){let a=(e+t/60)%6;return r-r*n*Math.max(0,Math.min(a,4-a,1))}return t%=360,t<0&&(t+=360),n/=100,r/=100,[a(5),a(3),a(1)]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),nr=new Ue({id:"hwb",name:"HWB",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},w:{range:[0,100],name:"Whiteness"},b:{range:[0,100],name:"Blackness"}},base:tr,fromBase(e){let[t,n,r]=e;return[t,r*(100-n)/100,100-r]},toBase(e){let[t,n,r]=e;n/=100,r/=100;let a=n+r;if(a>=1)return[t,0,n/a*100];let o=1-r;return[t,100*(0===o?0:1-n/o),100*o]},formats:{hwb:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),rr=new et({id:"a98rgb-linear",cssId:"--a98-rgb-linear",name:"Linear Adobe® 98 RGB compatible",white:"D65",toXYZ_M:[[.5766690429101305,.1855582379065463,.1882286462349947],[.29734497525053605,.6273635662554661,.07529145849399788],[.02703136138641234,.07068885253582723,.9913375368376388]],fromXYZ_M:[[2.0415879038107465,-.5650069742788596,-.34473135077832956],[-.9692436362808795,1.8759675015077202,.04155505740717557],[.013444280632031142,-.11836239223101838,1.0151749943912054]]}),ar=new et({id:"a98rgb",cssId:"a98-rgb",name:"Adobe® 98 RGB compatible",base:rr,toBase:e=>e.map(e=>Math.pow(Math.abs(e),563/256)*Math.sign(e)),fromBase:e=>e.map(e=>Math.pow(Math.abs(e),256/563)*Math.sign(e))}),or=new et({id:"prophoto-linear",cssId:"--prophoto-rgb-linear",name:"Linear ProPhoto",white:"D50",base:ot,toXYZ_M:[[.7977666449006423,.13518129740053308,.0313477341283922],[.2880748288194013,.711835234241873,8993693872564e-17],[0,0,.8251046025104602]],fromXYZ_M:[[1.3457868816471583,-.25557208737979464,-.05110186497554526],[-.5446307051249019,1.5082477428451468,.02052744743642139],[0,0,1.2119675456389452]]}),ir=1/512,sr=new et({id:"prophoto",cssId:"prophoto-rgb",name:"ProPhoto",base:or,toBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n<.03125?e/16:t*n**1.8}),fromBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n>=ir?t*n**(1/1.8):16*e})}),lr=new Ue({id:"oklch",name:"OkLCh",coords:{l:{refRange:[0,1],name:"Lightness"},c:{refRange:[0,.4],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},white:"D65",base:kt,fromBase:pt.fromBase,toBase:pt.toBase,formats:{oklch:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <angle>"]}}}),cr=2*Math.PI,hr=[[4.076741636075958,-3.307711539258063,.2309699031821043],[-1.2684379732850315,2.609757349287688,-.341319376002657],[-.0041960761386756,-.7034186179359362,1.7076146940746117]],ur=[[[-1.8817031,-.80936501],[1.19086277,1.76576728,.59662641,.75515197,.56771245]],[[1.8144408,-1.19445267],[.73956515,-.45954404,.08285427,.12541073,-.14503204]],[[.13110758,1.81333971],[1.35733652,-.00915799,-1.1513021,-.50559606,.00692167]]],pr=Number.MAX_VALUE,dr=.206,gr=(1+dr)/1.03;function fr(e,t){let n=e.length;if(n!==t.length)throw new Error(`Vectors of size ${n} and ${t.length} are not aligned`);let r=0;return e.forEach((e,n)=>{r+=e*t[n]}),r}function mr(e){return.5*(gr*e-dr+Math.sqrt((gr*e-dr)*(gr*e-dr)+.12*gr*e))}function br(e){return(e**2+dr*e)/(gr*(e+.03))}function vr(e){let[t,n]=e;return[n/t,n/(1-t)]}function yr(e,t){let n=Se(e,Mt);return n[0]=n[0]**3,n[1]=n[1]**3,n[2]=n[2]**3,Se(n,t,n)}function wr(e,t,n,r){let a=function(e,t,n,r){let a,o,i,s,l,c,h,u;fr(r[0][0],[e,t])>1?([a,o,i,s,l]=r[0][1],[c,h,u]=n[0]):fr(r[1][0],[e,t])>1?([a,o,i,s,l]=r[1][1],[c,h,u]=n[1]):([a,o,i,s,l]=r[2][1],[c,h,u]=n[2]);let p=a+o*e+i*t+s*e**2+l*e*t,d=fr(Mt[0].slice(1),[e,t]),g=fr(Mt[1].slice(1),[e,t]),f=fr(Mt[2].slice(1),[e,t]),m=1+p*d,b=1+p*g,v=1+p*f,y=c*m**3+h*b**3+u*v**3,w=c*(3*d*m**2)+h*(3*g*b**2)+u*(3*f*v**2);return p-=y*w/(w**2-.5*y*(c*(6*d**2*m)+h*(6*g**2*b)+u*(6*f**2*v))),p}(e,t,n,r),o=yr([1,a*e,a*t],n),i=He(1/Math.max(...o),1/3);return[i,i*a]}function xr(e,t,n){let[r,a,o]=e,i=wr(a,o,t,n),s=function(e,t,n,r,a,o,i,s){let l;if(void 0===s&&(s=wr(e,t,o,i)),(n-a)*s[1]-1*(s[0]-a)<=0)l=s[1]*a/(1*s[0]+s[1]*(a-n));else{l=s[1]*(a-1)/(1*(s[0]-1)+s[1]*(a-n));let r=n-a,i=1,c=fr(Mt[0].slice(1),[e,t]),h=fr(Mt[1].slice(1),[e,t]),u=fr(Mt[2].slice(1),[e,t]),p=r+i*c,d=r+i*h,g=r+i*u,f=a*(1-l)+l*n,m=1*l,b=f+m*c,v=f+m*h,y=f+m*u,w=b**3,x=v**3,M=y**3,k=3*p*b**2,$=3*d*v**2,S=3*g*y**2,C=6*p**2*b,L=6*d**2*v,A=6*g**2*y,E=fr(o[0],[w,x,M])-1,B=fr(o[0],[k,$,S]),R=B/(B*B-.5*E*fr(o[0],[C,L,A])),z=-E*R,I=fr(o[1],[w,x,M])-1,W=fr(o[1],[k,$,S]),H=W/(W*W-.5*I*fr(o[1],[C,L,A])),q=-I*H,P=fr(o[2],[w,x,M])-1,j=fr(o[2],[k,$,S]),T=j/(j*j-.5*P*fr(o[2],[C,L,A])),O=-P*T;z=R>=0?z:pr,q=H>=0?q:pr,O=T>=0?O:pr,l+=Math.min(z,Math.min(q,O))}return l}(a,o,r,0,r,t,n,i),l=vr(i),c=s/Math.min(r*l[0],(1-r)*l[1]),h=function(e,t){return[.11516993+1/(7.4477897+4.1590124*t+e*(1.75198401*t-2.19557347+e*(-2.13704948-10.02301043*t+e*(5.38770819*t-4.24894561+4.69891013*e)))),.11239642+1/(1.6132032-.68124379*t+e*(.40370612+.90148123*t+e*(.6122399*t-.27087943+e*(.00299215-.45399568*t-.14661872*e))))]}(a,o),u=r*h[0],p=(1-r)*h[1],d=.9*c*Math.sqrt(Math.sqrt(1/(1/u**4+1/p**4)));return u=.4*r,p=.8*(1-r),[Math.sqrt(1/(1/u**2+1/p**2)),d,s]}new Ue({id:"okhsl",name:"Okhsl",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,1],name:"Saturation"},l:{range:[0,1],name:"Lightness"}},base:kt,gamutSpace:"self",fromBase:e=>function(e,t,n){let r=e[0],a=0,o=mr(r),i=Math.sqrt(e[1]**2+e[2]**2),s=.5+Math.atan2(-e[2],-e[1])/cr;if(0!==o&&1!==o&&0!==i){let o,s,l,c,h=e[1]/i,u=e[2]/i,[p,d,g]=xr([r,h,u],t,n),f=.8;i<d?(s=f*p,l=1-s/d,c=i/(s+l*i),a=c*f):(o=d,s=.2*d**2*1.5625/p,l=1-s/(g-d),c=(i-o)/(s+l*(i-o)),a=f+.2*c)}const l=Math.abs(a)<1e-4;return l||0===o||Math.abs(1-o)<1e-7?(s=null,l||(a=0)):s=ut(360*s),[s,a,o]}(e,hr,ur),toBase:e=>function(e,t,n){let[r,a,o]=e,i=br(o),s=null,l=null;if(r=ut(r)/360,0!==i&&1!==i&&0!==a){let e,o,c,h,u=Math.cos(cr*r),p=Math.sin(cr*r),[d,g,f]=xr([i,u,p],t,n),m=.8;a<m?(e=1.25*a,o=0,c=m*d,h=1-c/g):(e=5*(a-.8),o=g,c=.2*g**2*1.5625/d,h=1-c/(f-g));let b=o+e*c/(1-h*e);s=b*u,l=b*p}return[i,s,l]}(e,hr,ur),formats:{color:{id:"--okhsl",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const Mr=new Ue({id:"okhsv",name:"Okhsv",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,1],name:"Saturation"},v:{range:[0,1],name:"Value"}},base:kt,gamutSpace:"self",fromBase:e=>function(e,t,n){let r=e[0],a=0,o=mr(r),i=Math.sqrt(e[1]**2+e[2]**2),s=.5+Math.atan2(-e[2],-e[1])/cr;if(0!==r&&1!==r&&0!==i){let s=e[1]/i,l=e[2]/i,c=wr(s,l,t,n),[h,u]=vr(c),p=.5,d=1-p/h,g=u/(i+r*u),f=g*r,m=g*i,b=br(f),v=m*b/f,[y,w,x]=yr([b,s*v,l*v],t),M=He(1/Math.max(Math.max(y,w),Math.max(x,0)),1/3);r/=M,i/=M,i=i*mr(r)/r,r=mr(r),o=r/f,a=(p+u)*m/(u*p+u*d*m)}return s=Math.abs(a)<1e-4||0===o?null:ut(360*s),[s,a,o]}(e,hr,ur),toBase:e=>function(e,t,n){let[r,a,o]=e;r=ut(r)/360;let i=br(o),s=null,l=null;if(0!==i&&0!==a){let e=Math.cos(cr*r),c=Math.sin(cr*r),h=wr(e,c,t,n),[u,p]=vr(h),d=.5,g=1-d/u,f=1-a*d/(d+p-p*g*a),m=a*p*d/(d+p-p*g*a);i=o*f;let b=o*m,v=br(f),y=m*v/f,w=br(i);b=b*w/i,i=w;let[x,M,k]=yr([v,e*y,c*y],t),$=He(1/Math.max(Math.max(x,M),Math.max(k,0)),1/3);i*=$,b*=$,s=b*e,l=b*c}return[i,s,l]}(e,hr,ur),formats:{color:{id:"--okhsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});function kr(e){return"display-p3"===e?"p3":"a98-rgb"===e?"a98rgb":e}function $r(e){return"p3"===e?"display-p3":"a98rgb"===e?"a98-rgb":e}function Sr(e){return"100"===e||100===e?"":` / ${e}%`}function Cr(e){return["srgb-linear","display-p3","rec2020","a98-rgb","prophoto","xyz","xyz-d50","xyz-d65"].includes(e)}function Lr(e,t=0){return null==e?"0":Number(e.toFixed(t)).toString()}function Ar(e,t){var n,r,a,o,i,s,l,c,h,u;const p=null!=(n=t.L)?n:50,d=null!=(r=t.A)?r:0,g=null!=(a=t.B)?a:0,f=null!=(o=t.C)?o:0,m=null!=(i=t.H)?i:0,b=null!=(s=t.S)?s:0,v=null!=(l=t.W)?l:0,y=null!=(c=t.R)?c:0,w=null!=(h=t.G)?h:0,x=null!=(u=t.ALP)?u:100;switch(e){case"oklab":return`oklab(${p}% ${d} ${g}${Sr(x)})`;case"oklch":return`oklch(${p}% ${f}% ${m}${Sr(x)})`;case"lab":return`lab(${p}% ${d} ${g}${Sr(x)})`;case"lch":return`lch(${p}% ${f}% ${m}${Sr(x)})`;case"hsl":return`hsl(${m} ${b}% ${p}%${Sr(x)})`;case"hwb":return`hwb(${m} ${v}% ${g}%${Sr(x)})`;case"srgb":return`rgb(${y}% ${w}% ${g}%${Sr(x)})`;case"hex":{const e=Math.round(2.55*Number(y)),t=Math.round(2.55*Number(w)),n=Math.round(2.55*Number(g)),r=Number(x),a=e.toString(16).padStart(2,"0"),o=t.toString(16).padStart(2,"0"),i=n.toString(16).padStart(2,"0"),s=a[0]===a[1]&&o[0]===o[1]&&i[0]===i[1];if(r<100){const e=Math.round(r/100*255).toString(16).padStart(2,"0");return s&&e[0]===e[1]?`#${a[0]}${o[0]}${i[0]}${e[0]}`:`#${a}${o}${i}${e}`}return s?`#${a[0]}${o[0]}${i[0]}`:`#${a}${o}${i}`}default:return Cr(e)?function(e,t,n,r,a){return`color(${"prophoto"===e?"prophoto-rgb":e} ${t}% ${n}% ${r}%${Sr(a)})`}(e,y,w,g,x):"oklch(75% 75% 180)"}}function Er(e,t){var n,r,a,o,i,s;let l=Ve(Ze(t));const c=kr("hex"===e?"srgb":e);l.space.id!==c&&(l=Rn(l,c));const h=$r(l.space.id),u="rgb"===h?"srgb":h,p={},d=null!=(n=l.alpha)?n:1;if("oklab"===u){const[e,t,n]=l.coords;p.L=Lr(100*(null!=e?e:0)),p.A=Lr(t,2),p.B=Lr(n,2),p.ALP=Lr(100*d)}else if("oklch"===u){const[e,t]=null!=(r=lr.coords.c.refRange)?r:[0,1],[n,a,o]=l.coords,i=(null!=a?a:0-e)/(t-e)*100;p.L=Lr(100*(null!=n?n:0)),p.C=Lr(Math.min(100,i),0),p.H=Lr(o),p.ALP=Lr(100*d)}else if("lab"===u){const[e,t,n]=l.coords;p.L=Lr(e),p.A=Lr(t),p.B=Lr(n),p.ALP=Lr(100*d)}else if("lch"===u){const[e,t,n]=l.coords;p.L=Lr(e),p.C=Lr(Math.min(100,(null!=t?t:0)/1.5),0),p.H=Lr(n),p.ALP=Lr(100*d)}else if("hsl"===u){const e=l.coords[0],t=null!=(a=l.coords[1])?a:0,n=null!=(o=l.coords[2])?o:0;p.H=Lr(e),p.S=Lr(t>1?t:100*t),p.L=Lr(n>1?n:100*n),p.ALP=Lr(100*d)}else if("hwb"===u){const e=l.coords[0],t=null!=(i=l.coords[1])?i:0,n=null!=(s=l.coords[2])?s:0;p.H=Lr(e),p.W=Lr(t>1?t:100*t),p.B=Lr(n>1?n:100*n),p.ALP=Lr(100*d)}else if("srgb"===u||"hex"===u){const[e,t,n]=En(l,{space:"srgb",method:"clip"}).coords;p.R=Lr(100*(null!=e?e:0)),p.G=Lr(100*(null!=t?t:0)),p.B=Lr(100*(null!=n?n:0)),p.ALP=Lr(100*d)}else if(Cr(u)){const[e,t,n]=l.coords;p.R=Lr(100*(null!=e?e:0)),p.G=Lr(100*(null!=t?t:0)),p.B=Lr(100*(null!=n?n:0)),p.ALP=Lr(100*d)}return{space:u,ch:p}}Ue.register(On),Ue.register(qn),Ue.register(er),Ue.register(nr),Ue.register(ht),Ue.register(pt),Ue.register(kt),Ue.register(lr),Ue.register(Nn),Ue.register(ar),Ue.register(sr),Ue.register(Wn),Ue.register(Ke),Ue.register(ot),Ue.register(Mr);const Br={okhsv:{fixedIndex:0,xIndex:1,xMax:1,xStep:.01,yIndex:2,yMax:1,yStep:.01},oklch:{fixedIndex:2,xIndex:1,xMax:.4,xStep:.004,yIndex:0,yMax:1,yStep:.01},hsl:{fixedIndex:0,xIndex:1,xMax:100,xStep:1,yIndex:2,yMax:100,yStep:1}},Rr=e=>{if(e)return Br[e.spaceId]};class zr{constructor(e,t){ee(this,a),ee(this,o,new AbortController),ee(this,i,de(null)),ee(this,s,de(null)),ee(this,l,de(null)),te(this,a,e);const n=null==e?void 0:e.querySelector(".area-canvas");if(!e||!n)return;const r=e=>{if(!K(this,s).value)return;const n=K(this,s).value,r=zn(Rn(e,kr("hex"===n?"srgb":n),{inGamut:!0}),{format:"hex"===n?"hex":void 0});t(Ar(n,Er(n,r).ch))},c=t=>{var n;const a=null!=(n=K(this,l).value)?n:K(this,i).value,o=Rr(a);if(!a||!o)return;const s=e.getBoundingClientRect(),c=Math.max(0,Math.min(1,(t.clientX-s.left)/s.width)),h=Math.max(0,Math.min(1,1-(t.clientY-s.top)/s.height)),u=structuredClone(a.coords);u[o.xIndex]=c*o.xMax,u[o.yIndex]=h*o.yMax,K(this,l).value={...a,coords:u},r(K(this,l).value)};e.addEventListener("pointerdown",t=>{e.setPointerCapture(t.pointerId),c(t)},{signal:K(this,o).signal}),e.addEventListener("pointermove",e=>{K(this,l).value&&(e.preventDefault(),c(e))},{signal:K(this,o).signal}),e.addEventListener("pointerup",t=>{e.releasePointerCapture(t.pointerId),K(this,l).value=null},{signal:K(this,o).signal}),e.addEventListener("pointercancel",()=>{K(this,l).value=null},{signal:K(this,o).signal}),e.addEventListener("keydown",e=>{var t,n;const a=K(this,i).value,o=Rr(a);if(!a||!o)return;let s=0,l=0;switch(e.key){case"ArrowRight":s=1;break;case"ArrowLeft":s=-1;break;case"ArrowUp":l=1;break;case"ArrowDown":l=-1;break;default:return}e.preventDefault();const c=null!=(t=a.coords[o.xIndex])?t:0,h=null!=(n=a.coords[o.yIndex])?n:0,u=Math.max(0,Math.min(o.xMax,c+s*o.xStep)),p=Math.max(0,Math.min(o.yMax,h+l*o.yStep)),d=structuredClone(a.coords);d[o.xIndex]=u,d[o.yIndex]=p,r({...a,coords:d})},{signal:K(this,o).signal});const h=ke(()=>{const t=null!=K(this,l).value;e.classList.toggle("dragging",t),document.body.inert=t}),u=ke(()=>{var e,t,n,r,o;const s=null!=(e=K(this,l).value)?e:K(this,i).value,c=Rr(s);if(!s||!c)return;const h=(null!=(t=s.coords[c.xIndex])?t:0)/c.xMax*100,u=(null!=(n=s.coords[c.yIndex])?n:0)/c.yMax*100;null==(r=K(this,a))||r.style.setProperty("--thumb-x",`${h}%`),null==(o=K(this,a))||o.style.setProperty("--thumb-y",100-u+"%")});let p=null,d=null;const g=ve(()=>{var e,t;const n=null!=(e=K(this,l).value)?e:K(this,i).value,r=Rr(n);return r&&null!=(t=null==n?void 0:n.coords[r.fixedIndex])?t:0}),f=ke(()=>{d=g.value,null===p&&(p=requestAnimationFrame(()=>{if(n&&null!==d&&K(this,s).value){const e=K(this,i).value,t=Rr(e);if(!e||!t)return;!function(e,t){const n=160;e.width=n,e.height=100;const r=e.getContext("2d");if(!r)return;const a=r.createImageData(n,100),o=a.data;for(let i=0;i<100;i++){const e=1-i/99;for(let r=0;r<n;r++){const a=r/159,[s,l,c]=Rn(t(a,e),"srgb").coords,h=4*(i*n+r);o[h]=Math.round(255*(null!=s?s:0)),o[h+1]=Math.round(255*(null!=l?l:0)),o[h+2]=Math.round(255*(null!=c?c:0)),o[h+3]=255}}r.putImageData(a,0,0)}(n,(n,r)=>{const a=[0,0,0];return a[t.fixedIndex]=null!=d?d:0,a[t.xIndex]=n*t.xMax,a[t.yIndex]=r*t.yMax,{spaceId:e.spaceId,coords:a,alpha:null}})}p=null,d=null}))});K(this,o).signal.addEventListener("abort",()=>{h(),u(),f(),p&&(cancelAnimationFrame(p),p=null)})}setValue(e,t){K(this,s).value=t;try{let n;n=Rn(e,"oklch"===t||"lch"===t?"oklch":"hsl"===t?"hsl":"okhsv"),K(this,i).value={spaceId:n.space.id,coords:n.coords,alpha:n.alpha}}catch{K(this,i).value=null}}unmount(){K(this,o).abort()}}a=new WeakMap,o=new WeakMap,i=new WeakMap,s=new WeakMap,l=new WeakMap;let Ir=null;function Wr(e,t){return e.left>=t.left&&e.top>=t.top&&e.right<=t.right&&e.bottom<=t.bottom}function Hr(e,t){const n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),a=Math.min(e.right,t.right),o=Math.min(e.bottom,t.bottom);return a<=n||o<=r?0:(a-n)*(o-r)}const qr=':root{--radius-round: 1e5px;--radius-2: 5px;--radius-3: 1rem}:host{--canvas: Canvas;--canvas-text: CanvasText;--radius-2: .5rem;--radius-3: .75rem;--radius-round: 1e4px;--shadow-elev: #0305081f 0px -1px 2px 0px, #03050821 0px 2px 1px -2px, #03050821 0px 5px 5px -2px, #03050824 0px 10px 10px -2px, #03050826 0px 20px 20px -2px, #0305082b 0px 40px 40px -2px;--shadow-inner: inset 0 0 0 1px color-mix(in oklab, var(--canvas-text), transparent 94%);--checker: repeating-conic-gradient(color-mix(in oklab, var(--canvas-text), transparent 90%) 0% 25%, transparent 0% 50%) 50%/1rem 1rem;color-scheme:light dark;display:flex;align-items:center;gap:10px;position:relative;@media (width < 350px){overflow:hidden}}:host([hidden]){display:none}button{border:1px solid color-mix(in oklab,var(--canvas-text),var(--canvas) 80%);outline-offset:2px;&.trigger{flex-shrink:0;background:none;padding:0;border:none;display:inline-flex;place-content:center;border-radius:var(--radius-round);.chip{display:inline-block;inline-size:1.25rem;block-size:1.25rem;border-radius:var(--radius-round);box-shadow:inset 0 0 0 1px color-mix(in oklab,var(--canvas-text),transparent 92%);background:linear-gradient(var(--value) 0 0),var(--checker);forced-color-adjust:none}}}.input-wrapper{position:relative;display:flex;flex-direction:column;flex:1;min-width:0}.text-input{field-sizing:content;font-family:inherit;padding:1ch 1.5ch;border:1px solid color-mix(in oklab,var(--canvas-text),var(--canvas) 80%);border-radius:var(--radius-2);background:color-mix(in oklab,var(--canvas-text),var(--canvas) 92%);color:var(--canvas-text);box-shadow:var(--shadow-inner);outline-offset:2px;&[aria-invalid=true]{outline-color:red}}.error-message{position:absolute;bottom:-1.5rem;left:0;font-size:12px;color:#ef4444;font-weight:500;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .2s ease}.error-message:not(:empty){opacity:1}.panel{margin:0;max-inline-size:min(92vw,560px);background:var(--canvas);color:var(--canvas-text);box-shadow:var(--shadow-elev);border-radius:var(--radius-3);padding:0;border:1px solid #0000;overflow:hidden}.area-picker{position:relative;width:100%;aspect-ratio:16 / 9;overflow:hidden;touch-action:none;box-shadow:var(--shadow-inner)}.area-picker:focus-visible{outline-offset:0px}.area-canvas{width:100%;height:100%}.area-thumb{position:absolute;box-sizing:border-box;height:calc(1rem + 8px);aspect-ratio:1;margin-left:calc(-.5rem - 4px);margin-top:calc(-.5rem - 4px);border-radius:var(--radius-round);border:4px solid white;box-shadow:0 0 1px 1px #00000040,inset 0 1px 2px #00000026;left:var(--thumb-x, 50%);top:var(--thumb-y, 50%);z-index:1;cursor:grab}.area-picker.dragging .area-thumb{cursor:grabbing}.preview{position:relative;min-inline-size:35ch;display:grid;align-content:end;justify-items:start;padding:.75rem;gap:6px;box-shadow:var(--shadow-inner);background:linear-gradient(var(--value) 0 0),var(--checker);forced-color-adjust:none;&:hover .copy-btn,&:focus-within .copy-btn{opacity:1}>*:not(:hover){opacity:.9}.copy-wrap{position:absolute;top:.5rem;right:.5rem;display:flex;flex-direction:column;align-items:flex-end;gap:.25rem}.copy-btn{color:var(--contrast);background:none;border:1px solid #0000;border-radius:0;padding:0;cursor:pointer;opacity:0;transition:opacity .2s ease;display:inline-flex;align-items:center}.copy-btn svg{display:block}.copy-message{color:var(--contrast);font-size:.8rem;font-weight:500;opacity:0;pointer-events:none;transition:opacity .2s ease;white-space:nowrap}.copy-message.show{opacity:1}.visually-hidden:not(:focus):not(:active){clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}}.space{-webkit-appearance:base-select;-moz-appearance:base-select;appearance:base-select;min-block-size:1lh;line-height:1.1;font-weight:700;margin:0;padding:0;color:var(--contrast);background:transparent;border-radius:0;border:none;&::picker-icon{content:"›";-webkit-appearance:none;transform:rotate(90deg) scale(1.5)}}@supports not selector(::picker-icon){.space{background-image:url(https://api.iconify.design/basil:caret-down-solid.svg);background-size:1rem;background-position:right .5rem center;background-repeat:no-repeat}}.gamut,.info{line-height:1.1;text-box:cap alphabetic;display:block;color:var(--contrast);background:transparent}.gamut{font-size:1rem}.info{font-size:1.25rem}.controls{display:grid;gap:.5rem;padding:.75rem;border-radius:0 0 var(--radius-3) var(--radius-3);.control{display:grid;grid-template-columns:min-content 1fr 4ch;align-items:center;gap:.5rem}.control .num-wrapper{position:relative;display:flex;align-items:center}.control .num-wrapper sup{opacity:.5;font-size:.5em;place-self:start}.control label{font:500 12px/1.2 ui-monospace,SFMono-Regular,Menlo,Consolas,Liberation Mono,monospace}.control input[type=number]{text-align:end;font-size:12px;padding:0;background:none;border:1px solid var(--canvas);border-radius:.25rem;-moz-appearance:textfield;font-variant:tabular-nums;font-family:monospace;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}}.control input[type=range]{width:100%;height:1rem;border-radius:999px;border:1px solid var(--canvas);background:var(--canvas);box-shadow:var(--shadow-inner);-webkit-appearance:none;-moz-appearance:none;appearance:none;forced-color-adjust:none}.control input[type=range].alpha{background:linear-gradient(to right,#0000,#000),var(--checker)}.control input[type=range]::-webkit-slider-thumb{cursor:grab;-webkit-appearance:none;appearance:none;border:4px solid white;height:calc(1rem + 8px);aspect-ratio:1;border-radius:var(--radius-round);box-shadow:0 0 1px 1px #00000040,inset 0 1px 2px #00000026}.control input[type=range]:active::-webkit-slider-thumb{cursor:grabbing}.control input[type=range]::-moz-range-thumb{cursor:grab;-moz-appearance:none;appearance:none;border:4px solid white;height:calc(1rem + 8px);aspect-ratio:1;border-radius:var(--radius-round);box-shadow:0 0 1px 1px #00000040,inset 0 1px 2px #00000026;width:calc(8px + 1rem);background:none;box-sizing:border-box}.control input[type=range]:active::-moz-range-thumb{cursor:grabbing}}',Pr="oklch(75% 75% 180)",jr="oklch",Tr=new CSSStyleSheet;"function"==typeof Tr.replaceSync&&Tr.replaceSync(qr);class Or extends HTMLElement{constructor(){if(super(),ee(this,H),ee(this,c,de(Pr)),ee(this,h,de(jr)),ee(this,u,de("auto")),ee(this,p,de(!1)),ee(this,d,de(null)),ee(this,g,de(null)),ee(this,f,de(!1)),ee(this,m,ve(()=>function(e){var t,n;try{const r=Ze(e);let a,o;try{a=null!=(t=Kn(r,"white","WCAG21"))?t:Xn(r,"white"),o=null!=(n=Kn(r,"black","WCAG21"))?n:Xn(r,"black")}catch{a=Xn(r,"white"),o=Xn(r,"black")}return a>o?"white":"black"}catch{return"black"}}(K(this,c).value))),ee(this,b,ve(()=>function(e){let t="srgb";if(!e||e.startsWith("#"))return t;try{const n=Ze(e),r={spaceId:"srgb",coords:Rn(n,"srgb").coords,alpha:null},a={spaceId:"p3",coords:Rn(n,"p3").coords,alpha:null},o={spaceId:"rec2020",coords:Rn(n,"rec2020").coords,alpha:null};St({spaceId:"xyz",coords:Rn(n,"xyz").coords,alpha:null})&&(t="xyz"),St(o)&&(t="rec2020"),St(a)&&(t="p3"),St(r)&&(t="srgb")}catch{}return t}(K(this,c).value))),ee(this,v,null),ee(this,y,null),ee(this,w,null),ee(this,x,null),ee(this,M,null),ee(this,k),ee(this,$,!1),ee(this,S),ee(this,C),ee(this,L),ee(this,A),ee(this,E),ee(this,B),ee(this,R),ee(this,z),ee(this,I),ee(this,W,null),ee(this,j,null),ee(this,T,null),ee(this,O,[]),ee(this,N,null),te(this,S,this.attachShadow({mode:"open",delegatesFocus:!0})),"adoptedStyleSheets"in K(this,S)&&"function"==typeof Tr.replaceSync)K(this,S).adoptedStyleSheets=[Tr];else{const e=document.createElement("style");e.textContent=qr,K(this,S).appendChild(e)}const e=function(){const e=document.createElement("template");return e.innerHTML='\n <button class="trigger" part="trigger" aria-haspopup="dialog" aria-label="Open color picker" title="Open color picker">\n <span class="chip" part="chip"></span>\n </button>\n <div class="input-wrapper">\n <span class="error-message" part="error" role="alert" aria-live="polite"></span>\n <input type="text" class="text-input" part="input" aria-label="Color value" title="Color value" aria-invalid="false" spellcheck="false" />\n </div>\n <div class="panel" popover="auto" part="panel">\n <div class="area-picker" part="area" role="slider" aria-label="Color area picker" tabindex="0">\n <canvas class="area-canvas"></canvas>\n <div class="area-thumb"></div>\n </div>\n <div class="controls" part="controls"></div>\n <div class="preview">\n <div class="copy-wrap">\n <button class="copy-btn">\n <span class="visually-hidden">Copy color</span>\n <svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true"><title>Copy color</title><path fill="currentColor" d="M5 22q-.825 0-1.413-.588T3 20V6h2v14h11v2H5Zm4-4q-.825 0-1.413-.588T7 16V4q0-.825.588-1.413T9 2h9q.825 0 1.413.588T20 4v12q0 .825-.588 1.413T18 18H9Z"/></svg>\n </button>\n <span class="copy-message" aria-hidden="true">Copied!</span>\n <span class="copy-message-live-region visually-hidden" role="status"></span>\n </div>\n <select class="space" title="Colorspace"></select>\n <output class="info" part="output"></output>\n <span class="gamut" title="Color\'s gamut" part="gamut"></span>\n </div>\n </div>\n ',e}();K(this,S).appendChild(e.content.cloneNode(!0))}static get observedAttributes(){return["value","colorspace","theme","no-alpha"]}get value(){return K(this,c).value}set value(e){if("string"==typeof e&&e)try{const t=$r(Ze(e).spaceId),n="string"==typeof e&&e.trim().startsWith("#");K(this,h).value=n?"hex":"rgb"===t?"srgb":t,K(this,c).value=e,te(this,$,!0),this.setAttribute("value",e),this.setAttribute("colorspace",K(this,h).value),te(this,$,!1),ne(this,H,q).call(this)}catch{}}get colorspace(){return K(this,h).value}set colorspace(e){const t=e||jr;K(this,h).value=t,te(this,$,!0),this.setAttribute("colorspace",t);try{const e=Ze(K(this,c).value),n=Ar(t,Er(t,zn(En(Rn(e,kr("hex"===t?"srgb":t))),{precision:12})).ch);K(this,c).value=n,this.setAttribute("value",n),ne(this,H,q).call(this)}catch{}te(this,$,!1),K(this,L)&&ne(this,H,Y).call(this)}get theme(){return K(this,u).value}set theme(e){const t="light"===e||"dark"===e?e:"auto";K(this,u).value=t,"auto"===t?this.removeAttribute("theme"):this.setAttribute("theme",t)}get noAlpha(){return K(this,f).value}set noAlpha(e){K(this,f).value=!!e,e?this.setAttribute("no-alpha",""):this.removeAttribute("no-alpha")}get gamut(){return K(this,b).value}get contrastColor(){return K(this,m).value}show(e){var t,n;e&&(K(this,d).value=e),null==(n=null==(t=K(this,C))?void 0:t.showPopover)||n.call(t),ne(this,H,D).call(this)}close(){var e,t;null==(t=null==(e=K(this,C))?void 0:e.hidePopover)||t.call(e),ne(this,H,G).call(this)}showPicker(){this.show()}setAnchor(e){K(this,d).value=e}set setColor(e){this.value=e}set setAnchorElement(e){this.setAnchor(e)}connectedCallback(){var e;const t=K(this,S).querySelector("button.trigger");te(this,R,null!=t?t:void 0),te(this,C,K(this,S).querySelector(".panel")),te(this,L,K(this,S).querySelector(".controls")),te(this,A,K(this,S).querySelector(".space")),te(this,E,K(this,S).querySelector("output.info")),te(this,B,K(this,S).querySelector(".chip")),te(this,z,K(this,S).querySelector(".text-input")),te(this,I,K(this,S).querySelector(".error-message"));const n=K(this,S).querySelector(".area-picker");n&&"none"!==getComputedStyle(n).display&&(te(this,k,new zr(n,e=>{K(this,c).value=e,this.setAttribute("value",e),ne(this,H,q).call(this),ne(this,H,Y).call(this)})),te(this,M,ke(()=>{var e;const t=K(this,c).value,n=K(this,h).value;null==(e=K(this,k))||e.setValue(t,n)})));const r=K(this,S).querySelector("button.copy-btn"),a=K(this,S).querySelector(".copy-message"),o=K(this,S).querySelector(".copy-message-live-region");if(r&&a&&o){let e=null;r.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(K(this,c).value),a.classList.add("show"),o.innerText=a.innerText,null!==e&&clearTimeout(e),e=window.setTimeout(()=>{a.classList.remove("show"),o.innerText="",e=null},3e3)}catch{}})}K(this,A).innerHTML='\n <optgroup label="Standard">\n <option value="hex">hex</option>\n <option value="srgb">rgb</option>\n <option value="srgb-linear">srgb-linear</option>\n <option value="hsl">hsl</option>\n <option value="hwb">hwb</option>\n </optgroup>\n <optgroup label="HDR">\n <option value="display-p3">display-p3</option>\n <option value="a98-rgb">a98-rgb</option>\n </optgroup>\n <optgroup label="Ultra HDR">\n <option value="lab">lab</option>\n <option value="lch">lch</option>\n <option value="oklch">oklch</option>\n <option value="oklab">oklab</option>\n <option value="rec2020">rec2020</option>\n <option value="prophoto">prophoto</option>\n <option value="xyz">xyz</option>\n <option value="xyz-d50">xyz-d50</option>\n <option value="xyz-d65">xyz-d65</option>\n </optgroup>\n ',t&&t.addEventListener("click",()=>this.show(t)),K(this,z)&&(K(this,z).value=K(this,c).value,K(this,z).addEventListener("input",e=>{const t=e.target.value;ne(this,H,P).call(this,t)}),K(this,z).addEventListener("paste",e=>{})),this.addEventListener("command",e=>{const t=e.command;if(!t)return;const n=e.source||e.invoker||(document.activeElement instanceof HTMLElement?document.activeElement:null);n&&(te(this,W,n),this.setAnchor(n)),"show-popover"===t||"show"===t?this.show(K(this,W)):"hide-popover"===t||"close"===t?this.close():"toggle-popover"!==t&&"toggle"!==t||(K(this,p).value?this.close():this.show(K(this,W)))}),null==(e=K(this,C))||e.addEventListener("toggle",()=>{var e;const t=K(this,C);let n=!t.hasAttribute("hidden");try{n=null!=(e=t.matches(":popover-open"))&&e}catch{}K(this,p).value=n,n?ne(this,H,D).call(this):ne(this,H,G).call(this),this.dispatchEvent(new CustomEvent(n?"open":"close",{bubbles:!0}))}),K(this,A).addEventListener("change",()=>{this.colorspace=K(this,A).value,ne(this,H,Y).call(this)}),te(this,v,ke(()=>{const e=K(this,c).value,t=K(this,b).value,n=K(this,m).value;K(this,E)&&(K(this,E).value=e),K(this,B)&&K(this,B).style.setProperty("--value",e),K(this,z)&&K(this,z).value!==e&&(K(this,z).value=e),this.style.setProperty("--contrast",n),this.style.setProperty("--counter","white"===n?"black":"white");const r=K(this,S).querySelector(".gamut");r&&(r.textContent=t);const a=K(this,S).querySelector(".preview");a&&a.style.setProperty("--value",e)})),te(this,w,ke(()=>{const e=K(this,g).value;e?(this.setAttribute("data-error",""),K(this,I)&&(K(this,I).textContent=e),K(this,z)&&K(this,z).setAttribute("aria-invalid","true")):(this.removeAttribute("data-error"),K(this,I)&&(K(this,I).textContent=""),K(this,z)&&K(this,z).setAttribute("aria-invalid","false"))})),te(this,y,ke(()=>{const e=K(this,u).value,t="auto"===e?"light dark":e;this.style.setProperty("color-scheme",t)})),this.hasAttribute("value")||this.setAttribute("value",Pr),this.hasAttribute("colorspace")||this.setAttribute("colorspace",K(this,h).value),K(this,A).value=K(this,h).value,ne(this,H,Y).call(this)}disconnectedCallback(){var e,t,n,r,a;null==(e=K(this,y))||e.call(this),null==(t=K(this,v))||t.call(this),null==(n=K(this,w))||n.call(this),null==(r=K(this,M))||r.call(this),null==(a=K(this,k))||a.unmount()}attributeChangedCallback(e,t,n){if(n!==t&&!K(this,$)){if("value"===e&&"string"==typeof n)try{const e=$r(Ze(n).spaceId),t="string"==typeof n&&n.trim().startsWith("#");K(this,c).value=n,K(this,h).value=t?"hex":"rgb"===e?"srgb":e,K(this,A)&&(K(this,A).value=K(this,h).value)}catch{}"colorspace"===e&&n&&(K(this,h).value=n,K(this,A)&&(K(this,A).value=n)),"theme"===e&&(K(this,u).value=n||"auto"),"no-alpha"===e&&(K(this,f).value=null!==n,K(this,L)&&ne(this,H,Y).call(this))}}}return c=new WeakMap,h=new WeakMap,u=new WeakMap,p=new WeakMap,d=new WeakMap,g=new WeakMap,f=new WeakMap,m=new WeakMap,b=new WeakMap,v=new WeakMap,y=new WeakMap,w=new WeakMap,x=new WeakMap,M=new WeakMap,k=new WeakMap,$=new WeakMap,S=new WeakMap,C=new WeakMap,L=new WeakMap,A=new WeakMap,E=new WeakMap,B=new WeakMap,R=new WeakMap,z=new WeakMap,I=new WeakMap,W=new WeakMap,H=new WeakSet,q=function(){const e={value:K(this,c).value,colorspace:K(this,h).value,gamut:K(this,b).value};this.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0}))},P=function(e){if(e&&e.trim())try{const t=$r(Ze(e).spaceId),n="string"==typeof e&&e.trim().startsWith("#");K(this,g).value=null,K(this,h).value=n?"hex":"rgb"===t?"srgb":t,K(this,c).value=e,this.setAttribute("value",e),this.setAttribute("colorspace",K(this,h).value),K(this,A)&&(K(this,A).value=K(this,h).value),ne(this,H,q).call(this)}catch(t){K(this,g).value="Invalid color format"}else K(this,g).value="Invalid color format"},j=new WeakMap,T=new WeakMap,O=new WeakMap,N=new WeakMap,D=function(){var e,t;if(K(this,O).length)return;ne(this,H,F).call(this);const n=null!=(t=null!=(e=K(this,d).value)?e:K(this,W))?t:K(this,R);if(n&&K(this,C)){if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>ne(this,H,F).call(this));e.observe(n),e.observe(K(this,C)),e.observe(document.documentElement),K(this,O).push(()=>e.disconnect())}else{const e=()=>ne(this,H,F).call(this);window.addEventListener("resize",e),K(this,O).push(()=>window.removeEventListener("resize",e))}if(window.visualViewport){const e=()=>ne(this,H,F).call(this);window.visualViewport.addEventListener("resize",e),window.visualViewport.addEventListener("scroll",e),K(this,O).push(()=>{var t,n;null==(t=window.visualViewport)||t.removeEventListener("resize",e),null==(n=window.visualViewport)||n.removeEventListener("scroll",e)})}if(function(e){const t=[];let n=e.parentElement;for(;n&&n!==document.documentElement;){const e=getComputedStyle(n),r=e.overflowY,a=e.overflowX;"auto"!==r&&"scroll"!==r&&"auto"!==a&&"scroll"!==a||!(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)||t.push(n),n=n.parentElement}return document.scrollingElement&&t.push(document.scrollingElement),t}(n).forEach(e=>{const t=()=>ne(this,H,F).call(this);e.addEventListener("scroll",t,{passive:!0}),K(this,O).push(()=>e.removeEventListener("scroll",t))}),"undefined"!=typeof IntersectionObserver){const e=new IntersectionObserver(()=>ne(this,H,F).call(this),{threshold:0});e.observe(n),K(this,O).push(()=>e.disconnect())}}},G=function(){K(this,O).forEach(e=>e()),te(this,O,[]),null!==K(this,N)&&(cancelAnimationFrame(K(this,N)),te(this,N,null))},F=function(){null===K(this,N)&&te(this,N,requestAnimationFrame(()=>{te(this,N,null),ne(this,H,X).call(this)}))},X=function(){if(!K(this,C))return;const e=K(this,C),t=ne(this,H,Z).call(this),n=function(){if(Ir)return Ir;const e=document.createElement("div");e.style.position="fixed",e.style.left="-9999px",e.style.top="0",e.style.paddingTop="env(safe-area-inset-top)",e.style.paddingRight="env(safe-area-inset-right)",e.style.paddingBottom="env(safe-area-inset-bottom)",e.style.paddingLeft="env(safe-area-inset-left)",document.documentElement.appendChild(e);const t=getComputedStyle(e),n=parseFloat(t.paddingTop)||0,r=parseFloat(t.paddingRight)||0,a=parseFloat(t.paddingBottom)||0,o=parseFloat(t.paddingLeft)||0;return document.documentElement.removeChild(e),Ir={top:n,right:r,bottom:a,left:o},Ir}(),r=function(e){var t,n,r,a;const o=null!=(n=null==(t=window.visualViewport)?void 0:t.width)?n:window.innerWidth,i=null!=(a=null==(r=window.visualViewport)?void 0:r.height)?a:window.innerHeight,s=window.pageXOffset||document.documentElement.scrollLeft,l=window.pageYOffset||document.documentElement.scrollTop,c=e.left+8+s,h=e.top+8+l,u=o-e.right-8+s,p=i-e.bottom-8+l;return{left:c,top:h,right:u,bottom:p,width:u-c,height:p-h}}(n),a=ne(this,H,_).call(this,e),o=function(e,t){const{width:n,height:r}=t,a=[{placement:"bottom-center",left:e.left+e.width/2-n/2,top:e.bottom+8,right:0,bottom:0},{placement:"top-center",left:e.left+e.width/2-n/2,top:e.top-8-r,right:0,bottom:0},{placement:"right-start",left:e.right+8,top:e.top,right:0,bottom:0},{placement:"left-start",left:e.left-8-n,top:e.top,right:0,bottom:0},{placement:"bottom-left",left:e.left,top:e.bottom+8,right:0,bottom:0},{placement:"bottom-right",left:e.right-n,top:e.bottom+8,right:0,bottom:0},{placement:"top-left",left:e.left,top:e.top-8-r,right:0,bottom:0},{placement:"top-right",left:e.right-n,top:e.top-8-r,right:0,bottom:0}];return a.forEach(e=>{e.right=e.left+n,e.bottom=e.top+r}),a}(t,a),i=function(e,t,n){if(n){const r=e.find(e=>e.placement===n);if(r&&Wr(r,t))return r}for(const o of e)if(Wr(o,t))return o;let r=e[0],a=Hr(r,t);for(let o=1;o<e.length;o++){const n=Hr(e[o],t);n>a&&(a=n,r=e[o])}return r}(o,r,K(this,j));te(this,j,i.placement);const s=Math.round(Math.min(Math.max(i.left,r.left),r.right-a.width)),l=Math.round(Math.min(Math.max(i.top,r.top),r.bottom-a.height)),c=r.bottom-r.top;a.height>c?(e.style.maxHeight=`${c}px`,e.style.overflow="auto"):e.style.maxHeight&&(e.style.maxHeight="",e.style.overflow=""),e.style.position="absolute",e.style.left=`${s}px`,e.style.top=`${l}px`,e.style.setProperty("--ci-panel-placement",i.placement),e.dataset.placement=i.placement},Z=function(){var e,t,n,r,a,o,i;const s=null!=(n=null!=(t=null!=(e=K(this,d).value)?e:K(this,W))?t:K(this,R))?n:this,l=window.pageXOffset||document.documentElement.scrollLeft,c=window.pageYOffset||document.documentElement.scrollTop;if(!s.isConnected){const e=(null!=(a=null==(r=window.visualViewport)?void 0:r.width)?a:window.innerWidth)/2+l,t=(null!=(i=null==(o=window.visualViewport)?void 0:o.height)?i:window.innerHeight)/2+c;return{left:e,top:t,right:e,bottom:t,width:0,height:0}}const h=s.getBoundingClientRect();return{left:h.left+l,top:h.top+c,right:h.right+l,bottom:h.bottom+c,width:h.width,height:h.height}},_=function(e){var t;const n=e.getBoundingClientRect();if(n.width>0&&n.height>0)return te(this,T,{width:n.width,height:n.height}),K(this,T);const r={display:e.style.display,position:e.style.position,left:e.style.left,top:e.style.top,visibility:e.style.visibility,maxHeight:e.style.maxHeight};e.style.display="block",e.style.position="absolute",e.style.left="-99999px",e.style.top="0",e.style.visibility="hidden",e.style.maxHeight="none";const a=e.getBoundingClientRect();return e.style.display=r.display,e.style.position=r.position,e.style.left=r.left,e.style.top=r.top,e.style.visibility=r.visibility,e.style.maxHeight=r.maxHeight,a.width>0&&a.height>0?(te(this,T,{width:a.width,height:a.height}),K(this,T)):null!=(t=K(this,T))?t:{width:560,height:400}},Y=function(){var e,t,n,r,a,o,i,s,l,u,p,d,g,m,b,v;K(this,x)&&K(this,x).call(this);const y=K(this,h).value;if(!K(this,L))return;const w=Er(y,K(this,c).value).ch,M={};Object.keys(w).forEach(e=>{M[e]=de(String(w[e]))});const k=(e,t,n,r,a=1,o,i)=>{var s,l;const h="H"===t,u=["L","S","C","W","B","R","G","ALP"].includes(t),p="H"===t,d=document.createElement("div");d.className="control";const g=document.createElement("label");g.textContent=e;const f={L:"Lightness",C:"Chroma",H:"Hue",S:"Saturation",A:"A (green-red axis)",W:"Whiteness",R:"Red",G:"Green",ALP:"Alpha"};"B"===t?g.title="oklab"===y||"lab"===y?"B (blue-yellow axis)":"hwb"===y?"Blackness":"Blue":f[t]&&(g.title=f[t]);const m=document.createElement("input");if(m.type="range",m.min=String(n),m.max=String(r),m.step=String(a),m.classList.add(`ch-${t.toLowerCase()}`),o&&(m.style.backgroundImage=o),i&&(m.style.backgroundColor=i),m.value=String(null!=(s=w[t])?s:0),"ALP"===t){m.classList.add("alpha");try{const e=Ar(y,{...w,ALP:"0"}),t=Ar(y,{...w,ALP:"100"}),n="hsl"===y?"hsl":"lch"===y?"lch":"oklch"===y?"oklch":"oklab";m.style.background=`linear-gradient(to right in ${n}, ${e}, ${t}), var(--checker)`}catch{}}const b=document.createElement("input");b.type="number",b.min=String(n),b.max=String(r),b.step=String(a),b.classList.add(`ch-${t.toLowerCase()}`),b.value=String(null!=(l=w[t])?l:0);const v=document.createElement("div");if(v.className="num-wrapper",v.appendChild(b),u||p){const e=document.createElement("sup");e.textContent=p?"°":"%",v.appendChild(e)}const x=()=>{const e=Ar(y,w);K(this,c).value=e,this.setAttribute("value",e),ne(this,H,q).call(this)},k=e=>{const a=e.target;let o=Number(a.value);if(!Number.isFinite(o))return;o=h?(o%360+360)%360:Math.max(n,Math.min(r,o));const i=function(e,t,n){const r=(e,t=0)=>Number(e.toFixed(t));if("oklab"===e){if("L"===t)return String(r(n,0));if("A"===t||"B"===t)return String(r(n,2))}else if("oklch"===e){if("L"===t)return String(r(n,0));if("C"===t)return String(r(n,0));if("H"===t)return String(r(n,0))}else if("lab"===e){if("L"===t)return String(r(n,0));if("A"===t||"B"===t)return String(r(n,0))}else if("lch"===e){if("L"===t||"C"===t||"H"===t)return String(r(n,0))}else if("hsl"===e||"hwb"===e){if("H"===t)return String(r(n,0));if("S"===t||"L"===t||"W"===t||"B"===t)return String(r(n,0))}else if("srgb"===e||"hex"===e){if("R"===t||"G"===t||"B"===t)return String(r(n,0))}else if(["srgb-linear","display-p3","rec2020","a98-rgb","prophoto","xyz","xyz-d50","xyz-d65"].includes(e)&&("R"===t||"G"===t||"B"===t))return String(r(n,0));return String(r(n,"ALP"===t?0:2))}(y,t,o);w[t]=i,M[t].value=i,m.value=String(w[t]),b.value=String(w[t]),x()};return m.addEventListener("input",k),b.addEventListener("input",k),d.append(g,m,v),d};if(K(this,L).innerHTML="","oklab"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("L","L",0,100,1,"linear-gradient(in oklab to right, black, white)"),k("A","A",-.5,.5,.01,"linear-gradient(to right in oklab, oklab(65% -.5 .5), oklab(65% .5 .5))"),k("B","B",-.5,.5,.01,"linear-gradient(to right in oklab, oklab(47% -.03 -.32), oklab(96% 0 .25))"),e);const t=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.L.value||"50",n=M.A.value||"0",r=M.B.value||"0";t&&(t.style.background=`linear-gradient(to right in oklab, oklab(${e}% ${n} ${r} / 0%), oklab(${e}% ${n} ${r} / 100%)), var(--checker)`)}))}else if("oklch"===y){const a=k("A","ALP",0,100,1);K(this,f).value&&(a.style.display="none"),K(this,L).append(k("L","L",0,100,1,"linear-gradient(in oklab to right, black, white)"),k("C","C",0,100,1,`linear-gradient(in oklch to right, oklch(${null!=(e=w.L)?e:0}% 1% ${null!=(t=w.H)?t:0}), oklch(${null!=(n=w.L)?n:0}% 100% ${null!=(r=w.H)?r:0}))`),k("H","H",0,359,1,"linear-gradient(to right in oklch longer hue, oklch(90% 75% 0), oklch(90% 75% 0))"),a);const o=K(this,L).querySelector('input[type="range"].ch-c'),i=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.L.value||"0",t=M.C.value||"0",n=M.H.value||"0";o&&(o.style.backgroundImage=`linear-gradient(in oklch to right, oklch(${e}% 1% ${n}deg), oklch(${e}% 100% ${n}deg))`),i&&(i.style.background=`linear-gradient(to right in oklch, oklch(${e}% ${t}% ${n} / 0%), oklch(${e}% ${t}% ${n} / 100%)), var(--checker)`)}))}else if("lab"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("L","L",0,100,1,"linear-gradient(in lab to right, black, white)"),k("A","A",-160,160,1,"linear-gradient(to right in oklab, lab(85% -100 100), lab(55% 100 100))"),k("B","B",-160,160,1,"linear-gradient(to right in oklab, lab(31% 70 -120), lab(96% 0 120))"),e);const t=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.L.value||"50",n=M.A.value||"0",r=M.B.value||"0";t&&(t.style.background=`linear-gradient(to right in lab, lab(${e}% ${n} ${r} / 0%), lab(${e}% ${n} ${r} / 100%)), var(--checker)`)}))}else if("lch"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("L","L",0,100,1,"linear-gradient(in lab to right, black, white)"),k("C","C",0,100,1,`linear-gradient(in lch to right, lch(${null!=(a=w.L)?a:0}% 1% ${null!=(o=w.H)?o:0}), lch(${null!=(i=w.L)?i:0}% 100% ${null!=(s=w.H)?s:0}))`),k("H","H",0,359,1,"linear-gradient(to right in lch longer hue, lch(90% 75% 0), lch(90% 75% 0))"),e);const t=K(this,L).querySelector('input[type="range"].ch-c'),n=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.L.value||"50",r=M.C.value||"0",a=M.H.value||"0";t&&(t.style.backgroundImage=`linear-gradient(in lch to right, lch(${e}% 1% ${a}), lch(${e}% 100% ${a}))`),n&&(n.style.background=`linear-gradient(to right in lch, lch(${e}% ${r}% ${a} / 0%), lch(${e}% ${r}% ${a} / 100%)), var(--checker)`)}))}else if("hsl"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("H","H",0,359,1,"linear-gradient(to right in hsl longer hue, hsl(0 100% 50%), hsl(360 100% 50%))"),k("S","S",0,100,1,`linear-gradient(in hsl to right, hsl(${null!=(l=w.H)?l:0} 0% ${null!=(u=w.L)?u:50}% / 100%), hsl(${null!=(p=w.H)?p:0} 100% ${null!=(d=w.L)?d:50}% / 100%))`),k("L","L",0,100,1,`linear-gradient(in oklab to right, hsl(${null!=(g=w.H)?g:0} ${null!=(m=w.S)?m:100}% 0%), hsl(${null!=(b=w.H)?b:0} ${null!=(v=w.S)?v:100}% 100%))`),e);const t=K(this,L).querySelector('input[type="range"].ch-s'),n=K(this,L).querySelector('input[type="range"].ch-l'),r=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.H.value||"0",a=M.S.value||"100",o=M.L.value||"50";t&&(t.style.backgroundImage=`linear-gradient(in hsl to right, hsl(${e} 0% ${o}% / 100%), hsl(${e} 100% ${o}% / 100%))`),n&&(n.style.backgroundImage=`linear-gradient(in oklab to right, hsl(${e} ${a}% 0%), hsl(${e} ${a}% 100%))`),r&&(r.style.background=`linear-gradient(to right in hsl, hsl(${e} ${a}% ${o}% / 0%), hsl(${e} ${a}% ${o}% / 100%)), var(--checker)`)}))}else if("hwb"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("H","H",0,359,1,"linear-gradient(to right in hsl longer hue, hsl(0 100% 50%), hsl(360 100% 50%))"),k("W","W",0,100,1,"linear-gradient(to right in oklab, #fff0, #fff)","black"),k("B","B",0,100,1,"linear-gradient(to right in oklab, #0000, #000)","white"),e);const t=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.H.value||"0",n=M.W.value||"0",r=M.B.value||"0";t&&(t.style.background=`linear-gradient(to right in hwb, hwb(${e} ${n}% ${r}% / 0%), hwb(${e} ${n}% ${r}% / 100%)), var(--checker)`)}))}else if("srgb"===y||"hex"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("R","R",0,100,1,"linear-gradient(to right in oklab, #f000, #f00)","black"),k("G","G",0,100,1,"linear-gradient(to right in oklab, #0f00, #0f0)","black"),k("B","B",0,100,1,"linear-gradient(to right in oklab, #00f0, #00f)","black"),e);const t=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.R.value||"0",n=M.G.value||"0",r=M.B.value||"0";t&&(t.style.background=`linear-gradient(to right in srgb, rgb(${e}% ${n}% ${r}% / 0%), rgb(${e}% ${n}% ${r}% / 100%)), var(--checker)`)}))}else if(Cr(y)){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("R","R",0,100,1,"linear-gradient(to right in oklab, #f000, #f00)","black"),k("G","G",0,100,1,"linear-gradient(to right in oklab, #0f00, #0f0)","black"),k("B","B",0,100,1,"linear-gradient(to right in oklab, #00f0, #00f)","black"),e);const t=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.R.value||"0",n=M.G.value||"0",r=M.B.value||"0";if(t){const a=Ar(y,{...w,R:e,G:n,B:r,ALP:"0"}),o=Ar(y,{...w,R:e,G:n,B:r,ALP:"100"});t.style.background=`linear-gradient(to right, ${a}, ${o}), var(--checker)`}}))}},customElements.define("color-input",Or),e.ColorInput=Or,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
|
|
3
3
|
//# sourceMappingURL=color-input.min.js.map
|