@mkbabb/keyframes.js 1.1.5 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,27 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Nr=16.666666666666668,Ht=t=>!!t&&t.constructor===Object;function he(t){return Ht(t)?Object.entries(t).map(([e,r])=>[e,he(r)]).reduce((e,[r,s])=>(e[r]=s,e),{}):t!=null&&typeof t.clone=="function"?t.clone():Array.isArray(t)?t.map(he):t}async function Zs(t){return await new Promise(e=>setTimeout(e,t))}function _(t,e={}){const r=new Map,{maxCacheSize:s=1/0,ttl:n=1/0,keyFn:i=JSON.stringify,shouldCache:o}=e,a=function(...c){const l=i.apply(this,c),u=Date.now();if(r.has(l)){const h=r.get(l);if(u-h.timestamp<=n)return h.value;r.delete(l)}const f=t.apply(this,c);if((!o||o(f,...c))&&(r.set(l,{value:f,timestamp:u}),r.size>s)){const h=r.keys().next().value;r.delete(h)}return f};return a.cache=r,a}const Gs=t=>t.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace("-","").replace("_",""));function Js(t){return t.replace(/([A-Z])/g,e=>`-${e[0].toLowerCase()}`)}function Vr(t,e,r){for(let s=t-1;s>=0;s--)if(r(e[s]))return s}function Oe(t){if(typeof window<"u"&&window.requestAnimationFrame)return window.requestAnimationFrame(t);let e=Nr,r=Date.now();return setTimeout(()=>{let s=Date.now(),n=s-r;r=s,e=Math.max(0,Nr-n),t(s)},e)}function zn(t){if(typeof window<"u"&&window.cancelAnimationFrame)return window.cancelAnimationFrame(t);clearTimeout(t)}const jr=(t,e=2)=>typeof t=="number"&&!Number.isFinite(t)?"none":String(t?.toFixed?.(e)??t).trim().replace(/\.0+$/,""),Rr=(t,e,r)=>`${t}(${e.join(" ")} / ${r})`;let J=class{constructor(t,e=1){this.colorSpace=t,this.alpha=e,this.components=new Map}components;toString(){const t=Array.from(this.components.values()).map(r=>typeof r=="number"&&Number.isNaN(r)?"none":r),e=typeof this.alpha=="number"&&Number.isNaN(this.alpha)?"none":this.alpha;return Rr(this.colorSpace,t,e)}toFormattedString(t=2){const e=Array.from(this.components.values()).map(s=>jr(s,t)),r=jr(this.alpha,t);return Rr(this.colorSpace,e,r)}valueOf(){return[...this.values(),this.alpha]}toJSON(){const t={};for(const[e,r]of this.entries())t[e]=r;return t.alpha=this.alpha,t}clone(){const t=this.constructor,e=new t;return e.alpha=he(this.alpha),this.components.forEach((r,s)=>{e.components.set(s,he(r))}),e}keys(){return[...this.components.keys(),"alpha"]}values(){return[...this.components.values(),this.alpha]}entries(){return[...this.components.entries(),["alpha",this.alpha]]}getComponent(t){return this.components.get(t)}setComponent(t,e){this.components.set(t,e)}};class Zt extends J{constructor(e,r,s){super(e,r),this.whitePoint=s}}class X extends J{constructor(e,r,s,n){super("rgb",n),this.components.set("r",e),this.components.set("g",r),this.components.set("b",s)}get r(){return this.getComponent("r")}set r(e){this.setComponent("r",e)}get g(){return this.getComponent("g")}set g(e){this.setComponent("g",e)}get b(){return this.getComponent("b")}set b(e){this.setComponent("b",e)}}class Pe extends J{constructor(e,r,s,n){super("hsl",n),this.components.set("h",e),this.components.set("s",r),this.components.set("l",s)}get h(){return this.getComponent("h")}set h(e){this.setComponent("h",e)}get s(){return this.getComponent("s")}set s(e){this.setComponent("s",e)}get l(){return this.getComponent("l")}set l(e){this.setComponent("l",e)}}class Gt extends J{constructor(e,r,s,n){super("hsv",n),this.components.set("h",e),this.components.set("s",r),this.components.set("v",s)}get h(){return this.getComponent("h")}set h(e){this.setComponent("h",e)}get s(){return this.getComponent("s")}set s(e){this.setComponent("s",e)}get v(){return this.getComponent("v")}set v(e){this.setComponent("v",e)}}class Jt extends J{constructor(e,r,s,n){super("hwb",n),this.components.set("h",e),this.components.set("w",r),this.components.set("b",s)}get h(){return this.getComponent("h")}set h(e){this.setComponent("h",e)}get w(){return this.getComponent("w")}set w(e){this.setComponent("w",e)}get b(){return this.getComponent("b")}set b(e){this.setComponent("b",e)}}class mt extends Zt{constructor(e,r,s,n){super("lab",n,"D50"),this.components.set("l",e),this.components.set("a",r),this.components.set("b",s)}get l(){return this.getComponent("l")}set l(e){this.setComponent("l",e)}get a(){return this.getComponent("a")}set a(e){this.setComponent("a",e)}get b(){return this.getComponent("b")}set b(e){this.setComponent("b",e)}}class Qt extends J{constructor(e,r,s,n){super("lch",n),this.components.set("l",e),this.components.set("c",r),this.components.set("h",s)}get l(){return this.getComponent("l")}set l(e){this.setComponent("l",e)}get c(){return this.getComponent("c")}set c(e){this.setComponent("c",e)}get h(){return this.getComponent("h")}set h(e){this.setComponent("h",e)}}class dt extends Zt{constructor(e,r,s,n){super("oklab",n,"D50"),this.components.set("l",e),this.components.set("a",r),this.components.set("b",s)}get l(){return this.getComponent("l")}set l(e){this.setComponent("l",e)}get a(){return this.getComponent("a")}set a(e){this.setComponent("a",e)}get b(){return this.getComponent("b")}set b(e){this.setComponent("b",e)}}class _t extends J{constructor(e,r,s,n){super("oklch",n),this.components.set("l",e),this.components.set("c",r),this.components.set("h",s)}get l(){return this.getComponent("l")}set l(e){this.setComponent("l",e)}get c(){return this.getComponent("c")}set c(e){this.setComponent("c",e)}get h(){return this.getComponent("h")}set h(e){this.setComponent("h",e)}}class H extends Zt{constructor(e,r,s,n){super("xyz",n,"D65"),this.components.set("x",e),this.components.set("y",r),this.components.set("z",s)}get x(){return this.getComponent("x")}set x(e){this.setComponent("x",e)}get y(){return this.getComponent("y")}set y(e){this.setComponent("y",e)}get z(){return this.getComponent("z")}set z(e){this.setComponent("z",e)}}class Fn extends J{constructor(e,r){super("kelvin",r),this.components.set("kelvin",e)}get kelvin(){return this.getComponent("kelvin")}set kelvin(e){this.setComponent("kelvin",e)}}class er extends J{constructor(e,r,s,n){super("srgb-linear",n),this.components.set("r",e),this.components.set("g",r),this.components.set("b",s)}get r(){return this.getComponent("r")}set r(e){this.setComponent("r",e)}get g(){return this.getComponent("g")}set g(e){this.setComponent("g",e)}get b(){return this.getComponent("b")}set b(e){this.setComponent("b",e)}}class tr extends J{constructor(e,r,s,n){super("display-p3",n),this.components.set("r",e),this.components.set("g",r),this.components.set("b",s)}get r(){return this.getComponent("r")}set r(e){this.setComponent("r",e)}get g(){return this.getComponent("g")}set g(e){this.setComponent("g",e)}get b(){return this.getComponent("b")}set b(e){this.setComponent("b",e)}}class rr extends J{constructor(e,r,s,n){super("a98-rgb",n),this.components.set("r",e),this.components.set("g",r),this.components.set("b",s)}get r(){return this.getComponent("r")}set r(e){this.setComponent("r",e)}get g(){return this.getComponent("g")}set g(e){this.setComponent("g",e)}get b(){return this.getComponent("b")}set b(e){this.setComponent("b",e)}}class nr extends J{constructor(e,r,s,n){super("prophoto-rgb",n),this.components.set("r",e),this.components.set("g",r),this.components.set("b",s)}get r(){return this.getComponent("r")}set r(e){this.setComponent("r",e)}get g(){return this.getComponent("g")}set g(e){this.setComponent("g",e)}get b(){return this.getComponent("b")}set b(e){this.setComponent("b",e)}}class sr extends J{constructor(e,r,s,n){super("rec2020",n),this.components.set("r",e),this.components.set("g",r),this.components.set("b",s)}get r(){return this.getComponent("r")}set r(e){this.setComponent("r",e)}get g(){return this.getComponent("g")}set g(e){this.setComponent("g",e)}get b(){return this.getComponent("b")}set b(e){this.setComponent("b",e)}}const Lr=new WeakMap;function Qs(t){const e=Lr.get(t);if(e!==void 0)return e;const r=t();return Lr.set(t,r),r}function _s(t){let e;return r=>(e||(e=t()),e.parser(r))}const ce=typeof process<"u"&&process.stderr?.isTTY===!0&&!process.env.NO_COLOR,ve=t=>ce?`\x1B[1m${t}\x1B[22m`:t,ei=t=>ce?`\x1B[3m${t}\x1B[23m`:t,Wr=t=>ce?`\x1B[31m${t}\x1B[39m`:t,tt=t=>ce?`\x1B[32m${t}\x1B[39m`:t,Nn=t=>ce?`\x1B[33m${t}\x1B[39m`:t,rt=t=>ce?`\x1B[36m${t}\x1B[39m`:t,nt=t=>ce?`\x1B[90m${t}\x1B[39m`:t,ti=t=>ce?`\x1B[41m${t}\x1B[49m`:t,qr=t=>ce?`\x1B[42m${t}\x1B[49m`:t;let ri=!1;function ni(){return ri}let xe=-1,We,gt=[],bt=[],wt=[];function N(t,e){if(t.offset>xe)xe=t.offset,We=t,gt=[],bt=[],wt=[],e?t.expected=[e]:t.expected=void 0;else if(t.offset===xe&&e){const r=We;if(!r)throw new Error("mergeErrorState invariant violated: lastState missing");r.expected?r.expected.includes(e)||r.expected.push(e):r.expected=[e]}return We}function Vn(){We=void 0,xe=-1,gt=[],bt=[],wt=[]}function si(){return We}function ii(){return xe}function oi(){return gt}function ai(){return bt}function ci(){return wt}let jn=[];function li(t,e){const r=xe>=0?xe:e,s=t.slice(0,r),n=s.lastIndexOf(`
2
+ `),i=n===-1?1:s.slice(0,n+1).split(`
3
+ `).length,o=n===-1?r:r-n-1,a=t.slice(r,r+20).replace(/\n/g,"\\n");jn.push({offset:e,furthestOffset:r,line:i,column:o,expected:[...gt],suggestions:[...bt],secondarySpans:[...wt],found:a}),Vn()}function ui(){return jn.pop()}const Dr=4,Ur=74;let Ot=0;function fi(t,e=0){const r=t.trimEnd(),s=r.length,n=Math.floor(Ur/2);if(s<=Ur)return r;const i=Math.min(e,s);let o=Math.min(Math.max(i-n,0),s),a=Math.min(i+n,s);return o===0?r.slice(0,a)+"...":a>=s?"..."+r.slice(o):"..."+r.slice(o,a)+"..."}function hi(t){switch(t.length){case 0:return"";case 1:return`expected ${t[0]}`;case 2:return`expected ${t[0]} or ${t[1]}`;default:{const e=t[t.length-1];return`expected ${t.slice(0,-1).join(", ")}, or ${e}`}}}function pi(t){return String(t).length}function mi(t,e="^",r=!1){const s=t.src.split(`
4
+ `),{line:n,column:i}=t.getLineAndColumn?t.getLineAndColumn():{line:t.getLineNumber()+1,column:t.getColumnNumber()},o=n-1,a=Math.max(o-Dr,0),c=Math.min(o+Dr+1,s.length),l=pi(c),u=[];for(let f=a;f<c;f++){const h=f+1,p=f===o,x=fi(s[f],p?i:0),S=nt("|");if(p){const I=ve(String(h).padStart(l)),v=ve(r?Wr(x):tt(x));if(u.push(` ${I} ${S} ${v}`),e){const O=" ".repeat(l+4+i),V=r?Wr(e):tt(e);u.push(`${O}${V}`)}}else{const I=nt(String(h).padStart(l));u.push(` ${I} ${S} ${x}`)}}return u.join(`
5
+ `)}function di(t,e){const r=t.split(`
6
+ `),s=[];for(const n of e){let i=0;for(let o=0;o<r.length;o++){const a=i+r[o].length+1;if(n.offset<a){const c=n.offset-i,l=Math.max(String(o+1).length,3),u=nt("|");s.push(` ${" ".repeat(l)} ${u}`),s.push(` ${nt(String(o+1).padStart(l))} ${u} ${r[o]}`);const f=" ".repeat(l+4+c);s.push(`${f}${rt("-")} ${rt(n.label)}`);break}i=a}}return s.join(`
7
+ `)}function gi(t){const e=[];for(const r of t){const s=r.kind==="unclosed-delimiter"?ve(Nn("help")):ve(rt("note"));e.push(` = ${s}: ${r.message}`)}return e.join(`
8
+ `)}function Rn(t,e="",r=""){const s=t.offset>=t.src.length,n=t.isError;let i;n?i=ti(ve(" Err x ")):s?i=qr(ve(" Done √ ")):i=qr(ve(" Ok √ "));const o=e?` ${Nn(ei(e))}`:"",a=` ${tt(String(t.offset))}`,c=r?` ${tt(r)}`:"",l=`${i}${o}${a}${c}`,u=mi(t,n?"^^^":s?"":"^",n);let f=`${l}
9
+ ${u}`;if(n&&ni()){const h=oi();h.length>0&&(f+=`
10
+ ${rt(hi(h))}`);const p=ci();p.length>0&&(f+=`
11
+ ${di(t.src,p)}`);const x=ai();x.length>0&&(f+=`
12
+ ${gi(x)}`)}return f}const ge=new Map;function Ln(t){if(ge.has(t.id))return ge.get(t.id);const e=(s,n)=>{if(ge.has(s.id))return ge.get(s.id);const{name:i,args:o,parser:a}=s.context,c=a!=null?e(a,n):"unknown",l=(()=>{switch(i){case"string":return`"${o[0]}"`;case"regex":return`${o[0]}`;case"wrap":case"trim":{const[u,f]=o;return`${e(u,n)} ${c} ${e(f,n)}`}case"trimWhitespace":return`${c}?w`;case"not":return`!${c}`;case"opt":return`${c}?`;case"next":{const[u]=o;return`${c} >> ${e(u,n)}`}case"skip":{const[u]=o;return`${c} << ${e(u,n)}`}case"map":return c;case"all":case"then":return`[${o.map(u=>e(u,n)).join(", ")}]`;case"any":case"or":return o.map(u=>e(u,n)).join(" | ");case"many":{const[u,f]=o,h=f===1/0?`${u},`:`${u},${f}`;return`${c} {${h}}`}case"sepBy":return`${c} sepBy ${e(o[0],n)}`;case"lazy":{const[u]=o,f=Qs(u);if(n)return i;{const h=e(f,f.id);return ge.set(f.id,h),h}}case"debug":return c;default:return}})()??i;if(!l)throw new Error("parserPrint: missing parser context name");return n&&ge.set(s.id,l),l},r=e(t);return ge.set(t.id,r),r}function bi(t,e="",r=!1,s=console.error){const n=i=>{Ot++;const o=" ".repeat(Ot-1),a=t.parser(i),c=r?Ln(t):t.context.name??"",l=Rn(a,e,c).split(`
13
+ `).map(u=>o+u).join(`
14
+ `);return s(l),Ot--,a};return new E(n,$("debug",t,s))}class st{constructor(e,r=void 0,s=0,n=!1,i=0){this.src=e,this.value=r,this.offset=s,this.isError=n,this.furthest=i}expected;ok(e,r=0){return this.offset+=r,this.value=e,this.isError=!1,this}err(e,r=0){return this.offset+=r,this.value=e,this.isError=!0,this}from(e,r=0){return this.offset+=r,this.value=e,this}save(){return{offset:this.offset,value:this.value}}restore(e){return this.offset=e.offset,this.value=e.value,this.isError=!1,this}clone(){return new st(this.src,this.value,this.offset,this.isError,this.furthest)}getColumnNumber(){const e=this.offset,r=this.src.lastIndexOf(`
15
+ `,e),s=r===-1?e:e-(r+1);return Math.max(0,s)}getLineNumber(){const e=this.src.lastIndexOf(`
16
+ `,this.offset);return e>=0?this.src.slice(0,e).split(`
17
+ `).length:0}getLineAndColumn(e=this.offset){const r=this.src.lastIndexOf(`
18
+ `,e-1),s=r===-1?1:this.src.slice(0,r+1).split(`
19
+ `).length,n=r===-1?e:e-r-1;return{line:s,column:n}}toString(){return Rn(this)}}function $(t,e,...r){return{name:t,parser:e,args:r}}function ze(t,e){return new E(t,e)}function wi(){return ze(t=>t.offset>=t.src.length?t.ok(void 0):(N(t,"<end of input>"),t.isError=!0,t),$("eof",void 0))}function b(...t){const e=r=>{const s=r.offset;for(const n of t){if(n.parser(r),!r.isError)return r;r.offset=s,r.isError=!1}return N(r),r.isError=!0,r};return ze(t.length===1?t[0].parser:e,$("any",void 0,...t))}function yi(t){const e=new Int8Array(128).fill(-1),r=[];for(const[n,i]of Object.entries(t)){let o=r.indexOf(i);if(o===-1&&(o=r.length,r.push(i)),n.length===3&&n[1]==="-"){const a=n.charCodeAt(0),c=n.charCodeAt(2);for(let l=a;l<=c;l++)e[l]=o}else for(let a=0;a<n.length;a++)e[n.charCodeAt(a)]=o}const s=`one of [${Object.keys(t).map(n=>n.length===3&&n[1]==="-"?`'${n[0]}'-'${n[2]}'`:[...n].map(i=>`'${i}'`).join(", ")).join(", ")}]`;return ze(n=>{const i=n.src.charCodeAt(n.offset),o=i<128?e[i]:-1;return o>=0?r[o].parser(n):(N(n,s),n.isError=!0,n)},$("dispatch",void 0,...r))}function M(...t){const e=r=>{const s=[],n=r.offset;for(const i of t){if(i.parser(r),r.isError)return r.offset=n,r.isError=!0,r;r.value!==void 0&&s.push(r.value)}return r.ok(s)};return ze(t.length===1?t[0].parser:e,$("all",void 0,...t))}function m(t){const e=t.length,r=`"${t}"`;let s;if(e===1){const n=t.charCodeAt(0);s=(i=>i.src.charCodeAt(i.offset)===n?(i.offset+=1,i.value=t,i.isError=!1,i):(N(i,r),i.isError=!0,i))}else s=(n=>n.src.startsWith(t,n.offset)?(n.offset+=e,n.value=t,n.isError=!1,n):(N(n,r),n.isError=!0,n));return ze(s,$("string",void 0,t))}function z(t,e){const r=t.flags.replace(/y/g,""),s=new RegExp(t,r+"y"),n=e!=null,i=`/${t.source}/${t.flags}`;return ze(o=>{if(o.offset>=o.src.length)return o.isError=!0,o;const a=o.offset;if(s.lastIndex=a,n){const c=s.exec(o.src),l=e(c);if(l)return o.ok(l,s.lastIndex-a);if(l==="")return o.ok(void 0)}else if(s.test(o.src)){const c=s.lastIndex;return c>a?(o.offset=c,o.value=o.src.substring(a,c),o.isError=!1,o):(o.value=void 0,o.isError=!1,o)}return N(o,i),o.isError=!0,o},$("regex",void 0,t))}const Me=t=>{const e=t.src,r=e.length;let s=t.offset;if(s>=r||e.charCodeAt(s)>32)return t;for(;s<r;){const n=e.charCodeAt(s);if(n===32||n>=9&&n<=13)s++;else break}return t.offset=s,t};let w;function ki(){w=z(/\s*/),w.context.name="whitespace"}let vi=0;const be=new Map,He=new Map,Wn=20,xi=(1<<Wn)-1,Si=0,Ze=1,Ei=2;class E{constructor(e,r={}){this.parser=e,this.context=r}id=vi++;state;flags=Si;reset(){Vn(),be.clear(),He.clear()}parseState(e){this.reset();const r=new st(e);this.parser(r);const s=si();if(r.isError&&s){const n=ii(),i=new st(e,void 0,n,!0);this.state=i}else this.state=r,r.isError;return r}parse(e){return this.parseState(e).value}getCijKey(e){return this.id<<Wn|e.offset&xi}atLeftRecursionLimit(e){return(He.get(this.getCijKey(e))??0)>e.src.length-e.offset}memoize(){const e=r=>{const s=this.getCijKey(r),n=He.get(s)??0,i=be.get(this.id);if(i&&i.offset>=r.offset)return r.offset=i.offset,r.value=i.value,r.isError=i.isError,r;if(this.atLeftRecursionLimit(r))return r.isError=!0,r;He.set(s,n+1),this.parser(r);const o=be.get(this.id);return o&&o.offset>r.offset?r.offset=o.offset:o||be.set(this.id,r.clone()),r};return new E(e,$("memoize",this))}mergeMemos(){const e=r=>{const s=be.get(this.id);return s?(r.offset=s.offset,r.value=s.value,r.isError=s.isError,r):this.atLeftRecursionLimit(r)?(r.isError=!0,r):(this.parser(r),be.get(this.id)||be.set(this.id,r.clone()),r)};return new E(e,$("mergeMemo",this))}then(e){const r=s=>{const n=s.offset;if(this.parser(s),!s.isError){const i=s.value;if(e.parser(s),!s.isError)return s.ok([i,s.value])}return N(s),s.offset=n,s.isError=!0,s};return new E(r,$("then",this,this,e))}or(e){const r=s=>{const n=s.offset;return this.parser(s),s.isError?(s.offset=n,s.isError=!1,e.parser(s)):s};return new E(r,$("or",this,this,e))}chain(e,r=!1){const s=n=>(this.parser(n),n.isError?n:n.value||r?e(n.value).parser(n):n);return new E(s,$("chain",this,e))}map(e,r=!1){const s=n=>(this.parser(n),!n.isError||r?n.ok(e(n.value)):n);return new E(s,$("map",this))}mapState(e){const r=s=>{const n=s.offset,i=s.value;if(this.parser(s),s.isError)return s;const o=Object.create(s);return o.offset=n,o.value=i,e(s,o)};return new E(r,$("mapState",this))}skip(e){const r=s=>{const n=s.offset;if(this.parser(s),!s.isError){const i=s.value;if(e.parser(s),!s.isError)return s.ok(i)}return N(s),s.offset=n,s.isError=!0,s};return new E(r,$("skip",this,e))}next(e){const r=s=>{const n=s.offset;return this.parser(s),!s.isError&&(e.parser(s),!s.isError)||(N(s),s.offset=n,s.isError=!0),s};return new E(r,$("next",this,e))}opt(){const e=r=>{const s=r.offset;return this.parser(r),r.isError?(N(r),r.offset=s,r.ok(void 0)):r};return new E(e,$("opt",this))}not(e){const r=n=>{const i=n.offset,o=n.value;return this.parser(n),n.isError?(N(n),n.offset=i,n.ok(o)):(n.offset=i,n.isError=!0,n)},s=n=>{const i=n.offset;if(this.parser(n),n.isError)return N(n),n.offset=i,n.isError=!0,n;{const o=n.value,a=n.offset;return e.parser(n),n.isError?(n.offset=a,n.value=o,n.isError=!1,n):(N(n),n.offset=i,n.isError=!0,n)}};return new E(e?s:r,$("not",this,e))}minus(e){const r=this,s=n=>{const i=n.offset;return e.parser(n),n.isError?(n.offset=i,n.isError=!1,r.parser(n),n):(n.offset=i,n.isError=!0,n)};return new E(s,$("minus",this,e))}peek(){const e=this,r=s=>{const n=s.offset;if(e.parser(s),s.isError)return s.offset=n,s;const i=s.value;return s.offset=n,s.value=i,s};return new E(r,$("peek",this))}lookAhead(e){const r=this,s=n=>{const i=n.offset;if(r.parser(n),n.isError)return n.offset=i,n;const o=n.value,a=n.offset;return e.parser(n),n.isError?(n.offset=i,n.isError=!0,n):(n.offset=a,n.value=o,n)};return new E(s,$("lookAhead",this,e))}wrap(e,r,s=!0){if(!s)return M(e,this,r);const n=this,i=o=>{const a=o.offset;if(e.parser(o),o.isError)return o.offset=a,o;const c=o.offset;if(n.parser(o),o.isError)return N(o),o.offset=a,o.isError=!0,o;const l=o.value;return r.parser(o),o.isError?(N(o),o.src.slice(a,c),o.offset=a,o.isError=!0,o):(o.value=l,o)};return new E(i,$("wrap",this,e,r))}call(e){if(this.flags===0)return this.parser(e);if(this.flags===Ze){Me(e);const s=e.offset;return this.parser(e),e.isError?(N(e),e.offset=s,e.isError=!0,e):(Me(e),e)}this.flags&Ze&&Me(e);const r=e.offset;return this.parser(e),e.isError?(N(e),e.offset=r,e.isError=!0,e):(this.flags&Ze&&Me(e),this.flags&Ei&&e.offset<e.src.length&&(N(e,"<end of input>"),e.offset=r,e.isError=!0),e)}trim(e=w,r=!0){if(!r)return M(e,this,e);if(e.context?.name==="whitespace"){const s=this,n=new E((o=>s.call(o)),$("trimWhitespace",this));n.flags=this.flags|Ze;const i=o=>{Me(o);const a=o.offset;return s.parser(o),o.isError?(N(o),o.offset=a,o.isError=!0,o):(Me(o),o)};return new E(i,$("trimWhitespace",this))}return this.wrap(e,e)}many(e=0,r=1/0){const s=n=>{const i=e>0?e:0,o=i>0?new Array(i):[];let a=0;for(let c=0;c<r;c+=1){const l=n.offset;if(this.parser(n),n.isError){n.offset=l,n.isError=!1;break}if(n.offset===l)break;a<i?o[a]=n.value:o.push(n.value),a++}return a<i&&(o.length=a),a>=e?n.ok(o):(N(n),n.isError=!0,n.value=[],n)};return new E(s,$("many",this,e,r))}sepBy(e,r=0,s=1/0){const n=i=>{const o=r>0?r:0,a=o>0?new Array(o):[];let c=0;{const l=i.offset;this.parser(i),i.isError?(i.offset=l,i.isError=!1):i.offset!==l&&(c<o?a[c]=i.value:a.push(i.value),c++)}for(;c>0&&c<s;){const l=i.offset;if(e.parser(i),i.isError){i.offset=l,i.isError=!1;break}const u=i.offset;if(this.parser(i),i.isError||i.offset===u){i.offset=l,i.isError=!1;break}c<o?a[c]=i.value:a.push(i.value),c++}return c<o&&(a.length=c),c>=r?i.ok(a):(N(i),i.isError=!0,i.value=[],i)};return new E(n,$("sepBy",this,e))}eof(){const e=this.skip(wi());return e.context=$("eof",this),e}recover(e,r){const s=this,n=i=>{const o=i.offset;return s.parser(i),i.isError?(li(i.src,o),i.isError=!1,i.offset=o,e.parser(i),i.isError?(ui(),i.offset=o,i.isError=!0,i):i.ok(r)):i};return new E(n,$("recover",this,e,r))}debug(e="",r=!1,s=console.log){return bi(this,e,r,s)}toString(){return Ln(this)}static lazy(e){return new E(_s(e),$("lazy",void 0,e))}}ki();const qn=m(",").trim(),Ci=m(":").trim(),Mi=m("null").map(()=>null),Xr=m("true").or(m("false")).map(t=>t==="true"),Kr=z(/-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/).map(Number),Dn=z(/"(?:[^"\\]|\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4}))*"/).map(t=>t.indexOf("\\")===-1?t.slice(1,-1):JSON.parse(t)),Ii=E.lazy(()=>ir.sepBy(qn).trim().wrap(m("["),m("]"))),Ti=E.lazy(()=>Dn.skip(Ci).then(ir.trim()).sepBy(qn).trim().wrap(m("{"),m("}")).map(t=>Object.fromEntries(t))),ir=yi({"{":Ti,"[":Ii,'"':Dn,"-":Kr,"0-9":Kr,t:Xr,f:Xr,n:Mi});ir.trim();z(/[-]?[a-zA-Z_][\w-]*|--[\w-]+/);z(/"(?:[^"\\]|\\[\s\S])*"|'(?:[^'\\]|\\[\s\S])*'/);z(/\/\*[\s\S]*?\*\//);z(/-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/);z(/(?:px|em|rem|vh|vw|vmin|vmax|ch|ex|cm|mm|in|pt|pc|Q|cap|ic|lh|rlh|vi|vb|svw|svh|lvw|lvh|dvw|dvh|cqw|cqh|cqi|cqb|cqmin|cqmax|deg|rad|grad|turn|ms|s|Hz|kHz|dpi|dpcm|dppx|fr)/i);const $i=m(",").trim(),Yr=m('"'),Hr=m("'"),Oi=b(z(/[^"]+/).wrap(Yr,Yr),z(/[^']+/).wrap(Hr,Hr),z(/[^,]+/)),Bi=Oi.sepBy($i).trim();Bi.many();function R(t,e){const[r,s,n]=t;return[e[0]*r+e[1]*s+e[2]*n,e[3]*r+e[4]*s+e[5]*n,e[6]*r+e[7]*s+e[8]*n]}function pe(t){const[e,r,s,n,i,o,a,c,l]=t,u=i*l-o*c,f=-(n*l-o*a),h=n*c-i*a,p=1/(e*u+r*f+s*h);return[u*p,(s*c-r*l)*p,(r*o-s*i)*p,f*p,(e*l-s*a)*p,(s*n-e*o)*p,h*p,(r*a-e*c)*p,(e*i-r*n)*p]}const L=255,y={"%":{min:0,max:100},number:{min:0,max:1}},Bt={"%":y["%"],number:{min:0,max:L}},D={"%":y["%"],number:y.number},Re={deg:{min:0,max:360},number:{min:0,max:360},"%":y["%"]},k={rgb:{r:Bt,g:Bt,b:Bt,alpha:y},hsl:{h:Re,s:{"%":y["%"],number:y.number},l:{"%":y["%"],number:y.number},alpha:y},hsv:{h:Re,s:{"%":y["%"],number:y.number},v:{"%":y["%"],number:y.number},alpha:y},hwb:{h:Re,w:{"%":y["%"],number:y.number},b:{"%":y["%"],number:y.number},alpha:y},lab:{l:{"%":y["%"],number:y["%"]},a:{number:{min:-125,max:125},"%":{min:-100,max:100}},b:{number:{min:-125,max:125},"%":{min:-100,max:100}},alpha:y},lch:{l:{"%":y["%"],number:y["%"]},c:{number:{min:0,max:150},"%":y["%"]},h:Re,alpha:y},oklab:{l:{"%":y["%"],number:y.number},a:{number:{min:-.4,max:.4},"%":{min:-100,max:100}},b:{number:{min:-.4,max:.4},"%":{min:-100,max:100}},alpha:y},oklch:{l:{"%":y["%"],number:y.number},c:{number:{min:0,max:.5},"%":y["%"]},h:Re,alpha:y},xyz:{x:{"%":y["%"],number:y.number},y:{"%":y["%"],number:y.number},z:{"%":y["%"],number:y.number},alpha:y},kelvin:{kelvin:{number:{min:1e3,max:4e4}},alpha:y},"srgb-linear":{r:D,g:D,b:D,alpha:y},"display-p3":{r:D,g:D,b:D,alpha:y},"a98-rgb":{r:D,g:D,b:D,alpha:y},"prophoto-rgb":{r:D,g:D,b:D,alpha:y},rec2020:{r:D,g:D,b:D,alpha:y}},U="%",Ai={rgb:{r:"",g:"",b:"",alpha:U},hsl:{h:"deg",s:"%",l:"%",alpha:U},hsv:{h:"deg",s:"%",v:"%",alpha:U},hwb:{h:"deg",w:"%",b:"%",alpha:U},lab:{l:"%",a:"",b:"",alpha:U},lch:{l:"%",c:"",h:"deg",alpha:U},oklab:{l:"%",a:"",b:"",alpha:U},oklch:{l:"%",c:"",h:"deg",alpha:U},xyz:{x:"%",y:"%",z:"%",alpha:U},kelvin:{kelvin:"K",alpha:U},"srgb-linear":{r:"",g:"",b:"",alpha:U},"display-p3":{r:"",g:"",b:"",alpha:U},"a98-rgb":{r:"",g:"",b:"",alpha:U},"prophoto-rgb":{r:"",g:"",b:"",alpha:U},rec2020:{r:"",g:"",b:"",alpha:U}},Pi=[.3127/.329,1,(1-.3127-.329)/.329],zi=[.3457/.3585,1,(1-.3457-.3585)/.3585],or=[1.0479297925449969,.022946870601609652,-.05019226628920524,.02962780877005599,.9904344267538799,-.017073799063418826,-.009243040646204504,.015055191490298152,.7518742814281371],Un=pe(or),Xn={D65:Pi,D50:zi},Kn=[.819022437996703,.3619062600528904,-.1288737815209879,.0329836539323885,.9292868615863434,.0361446663506424,.0481771893596242,.2642395317527308,.6335478284694309],Fi=pe(Kn),Yn=[.210454268309314,.7936177747023054,-.0040720430116193,1.9779985324311684,-2.42859224204858,.450593709617411,.0259040424655478,.7827717124575296,-.8086757549230774],Ni=pe(Yn),C=[4.0767416621,-3.3077115913,.2309699292,-1.2684380046,2.6097574011,-.3413193965,-.0041960863,-.7034186147,1.707614701],oe=[.4122214708,.5363325363,.0514459929,.2119034982,.6806995451,.1073969566,.0883024619,.2817188376,.6299787005],W={l:[1,.3963377774,.2158037573],m:[1,-.1055613458,-.0638541728],s:[1,-.0894841775,-1.291485548]},Vi=[{test:(t,e)=>-1.88170328*t-.80936493*e>1,k0:1.19086277,k1:1.76576728,k2:.59662641,k3:.75515197,k4:.56771245,wl:4.0767416621,wm:-3.3077115913,ws:.2309699292},{test:(t,e)=>1.81444104*t-1.19445276*e>1,k0:.73956515,k1:-.45954404,k2:.08285427,k3:.1254107,k4:.14503204,wl:-1.2684380046,wm:2.6097574011,ws:-.3413193965},{test:()=>!0,k0:1.35733652,k1:-.00915799,k2:-1.1513021,k3:-.50559606,k4:.00692167,wl:-.0041960863,wm:-.7034186147,ws:1.707614701}],Zr={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"rgba(0, 0, 0, 0)",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32",padaleckipink:"oklch(100% 0.42 360deg / 71.70%)","lodge blu color":"rgb(53 101 144)",lavendi:"oklch(79.90% 0.11 318.24deg / 100%)",shadyshroom:"oklch(53% 0.07 21.60deg / 100%)",patriarchalplum:"oklch(31.20% 0.11 19.80deg / 100%)",winterwind:"oklch(21.80% 0.28 210.96deg / 82.70%)",blackwellberry:"oklch(53.60% 0.35 267.12deg / 100%)"};function Q(t,e,r){return Math.min(Math.max(t,e),r)}function P(t,e,r,s=0,n=1){const i=(n-s)/(r-e);if(r===e)throw new Error("fromMax and fromMin cannot be equal");return(t-e)*i+s}function Ee(t,e,r){return(1-t)*e+t*r}function it(t,e){const r=e.length-1,s=[...e];for(let n=1;n<=r;n++)for(let i=0;i<=r-n;i++)s[i]=Ee(t,s[i],s[i+1]);return s[0]}function ji(t,e,r,s,n){return[it(t,[0,e,s,1]),it(t,[0,r,n,1])]}function yt(t,e){const r=e.map(n=>n[0]),s=e.map(n=>n[1]);return[it(t,r),it(t,s)]}const Hn=2.4,ot=.055,ar=12.92,Ri=.04045,Zn=Ri/ar;function At(t){const e=t<0?-1:1,r=t*e;return r<=Zn?t/ar:e*((r+ot)/(1+ot))**Hn}function Pt(t){const e=t<0?-1:1,r=t*e;return r<=Zn?t*ar:e*((1+ot)*r**(1/Hn)-ot)}function zt(t,e,r){return Math.min(Math.max(t,e),r)}function cr(t,e,r){const s=t+W.l[1]*e+W.l[2]*r,n=t+W.m[1]*e+W.m[2]*r,i=t+W.s[1]*e+W.s[2]*r,o=s*s*s,a=n*n*n,c=i*i*i;return[C[0]*o+C[1]*a+C[2]*c,C[3]*o+C[4]*a+C[5]*c,C[6]*o+C[7]*a+C[8]*c]}function Li(t,e,r){return t>=0&&t<=1&&e>=0&&e<=1&&r>=0&&r<=1}function Wi(t,e){const r=Vi.find(S=>S.test(t,e)),{k0:s,k1:n,k2:i,k3:o,k4:a,wl:c,wm:l,ws:u}=r;let f=s+n*t+i*e+o*t*t+a*t*e;const h=W.l[1]*t+W.l[2]*e,p=W.m[1]*t+W.m[2]*e,x=W.s[1]*t+W.s[2]*e;{const S=1+f*h,I=1+f*p,v=1+f*x,O=S*S*S,V=I*I*I,T=v*v*v,Y=3*h*S*S,ie=3*p*I*I,Fe=3*x*v*v,Ne=6*h*h*S,Ve=6*p*p*I,je=6*x*x*v,Ce=c*O+l*V+u*T,de=c*Y+l*ie+u*Fe,Ye=c*Ne+l*Ve+u*je;f=f-Ce*de/(de*de-.5*Ce*Ye)}return f}function qi(t,e){const r=Wi(t,e),[s,n,i]=cr(1,r*t,r*e),o=Math.cbrt(1/Math.max(s,n,i)),a=o*r;return{L:o,C:a}}function Di(t,e,r,s,n,i){let o;if((r-n)*i.C-(i.L-n)*s<=0)o=i.C*n/(s*i.L+i.C*(n-r));else{o=i.C*(n-1)/(s*(i.L-1)+i.C*(n-r));const a=r-n,c=s,l=W.l[1]*t+W.l[2]*e,u=W.m[1]*t+W.m[2]*e,f=W.s[1]*t+W.s[2]*e,h=a+c*l,p=a+c*u,x=a+c*f;{const S=n*(1-o)+o*r,I=o*s,v=S+I*l,O=S+I*u,V=S+I*f,T=v*v*v,Y=O*O*O,ie=V*V*V,Fe=3*h*v*v,Ne=3*p*O*O,Ve=3*x*V*V,je=6*h*h*v,Ce=6*p*p*O,de=6*x*x*V,Ye=C[0]*T+C[1]*Y+C[2]*ie-1,Et=C[0]*Fe+C[1]*Ne+C[2]*Ve,Ks=C[0]*je+C[1]*Ce+C[2]*de,Br=Et/(Et*Et-.5*Ye*Ks);let Ct=-Ye*Br;const Ar=C[3]*T+C[4]*Y+C[5]*ie-1,Mt=C[3]*Fe+C[4]*Ne+C[5]*Ve,Ys=C[3]*je+C[4]*Ce+C[5]*de,Pr=Mt/(Mt*Mt-.5*Ar*Ys);let It=-Ar*Pr;const zr=C[6]*T+C[7]*Y+C[8]*ie-1,Tt=C[6]*Fe+C[7]*Ne+C[8]*Ve,Hs=C[6]*je+C[7]*Ce+C[8]*de,Fr=Tt/(Tt*Tt-.5*zr*Hs);let $t=-zr*Fr;Ct=Br>=0?Ct:1/0,It=Pr>=0?It:1/0,$t=Fr>=0?$t:1/0,o+=Math.min(Ct,It,$t)}}return o}const Ui=1e-5,Xi=.05;function Ki(t,e,r){const[s,n,i]=cr(t,e,r);if(Li(s,n,i))return[t,e,r];const o=Math.max(Ui,Math.sqrt(e*e+r*r)),a=e/o,c=r/o,l=qi(a,c),u=t-.5,f=.5+Math.abs(u)+Xi*o,h=.5*(1+Math.sign(u)*(f-Math.sqrt(f*f-2*Math.abs(u)))),p=Di(a,c,t,o,h,l),x=h*(1-p)+p*t,S=p*o;return[x,S*a,S*c]}function Yi(t,e,r){const s=At(t),n=At(e),i=At(r),o=Math.cbrt(oe[0]*s+oe[1]*n+oe[2]*i),a=Math.cbrt(oe[3]*s+oe[4]*n+oe[5]*i),c=Math.cbrt(oe[6]*s+oe[7]*n+oe[8]*i);return[.2104542553*o+.793617785*a-.0040720468*c,1.9779984951*o-2.428592205*a+.4505937099*c,.0259040371*o+.7827717662*a-.808675766*c]}function Hi(t,e,r){if(t>=0&&t<=1&&e>=0&&e<=1&&r>=0&&r<=1)return[t,e,r];const[s,n,i]=Yi(t,e,r),[o,a,c]=Ki(s,n,i),[l,u,f]=cr(o,a,c);return[zt(Pt(l),0,1),zt(Pt(u),0,1),zt(Pt(f),0,1)]}const fe=16,Zi=t=>{if(t=t.slice(1),t.length<=4){const e=parseInt(t[0]+t[0],fe),r=parseInt(t[1]+t[1],fe),s=parseInt(t[2]+t[2],fe),n=t[3]?parseInt(t[3]+t[3],fe)/L:1;return new X(e,r,s,n)}else{const e=parseInt(t.slice(0,2),fe),r=parseInt(t.slice(2,4),fe),s=parseInt(t.slice(4,6),fe),n=t.length===8?parseInt(t.slice(6,8),fe)/L:1;return new X(e,r,s,n)}},Gn=1e3,Jn=4e4,Qn=100,_n=({kelvin:t,alpha:e})=>{t=Q(t,Gn,Jn)/Qn;let r,s,n;return t<=66?r=L:(r=t-60,r=329.698727446*r**-.1332047592),r=Q(r,0,L)/L,t<=66?(s=t,s=99.4708025861*Math.log(s)-161.1195681661):(s=t-60,s=288.1221695283*s**-.0755148492),s=Q(s,0,L)/L,t>=66?n=L:t<=19?n=0:(n=t-10,n=138.5177312231*Math.log(n)-305.0447927307),n=Q(n,0,L)/L,new X(r,s,n,e)},Gi=({r:t,g:e,b:r,alpha:s})=>{t=Q(t*L,0,L),e=Q(e*L,0,L),r=Q(r*L,0,L);let n;if(r===L?n=6600:r===0?n=1900:n=Math.exp((r+305.0447927307)/138.5177312231)+10,t<L){const o=(329.698727446/t)**-7.507239275877164+60;n=Math.max(n,o)}const i=n<=6600?Math.exp((e+161.1195681661)/99.4708025861):(288.1221695283/e)**(1/-.0755148492)+60;return n=(n+i)/2,n=Q(Math.round(n*Qn),Gn,Jn),new Fn(n,s)},es=({h:t,s:e,v:r,alpha:s})=>{const n=r-r*e/2;let i;return n===0||n===1?i=0:i=(r-n)/Math.min(n,1-n),new Pe(t,i,n,s)},ts=({h:t,s:e,l:r,alpha:s})=>{const n=r+e*Math.min(r,1-r);let i;return n===0?i=0:i=2*(1-r/n),new Gt(t,i,n,s)},Ji=({h:t,w:e,b:r,alpha:s})=>{let n,i;const o=e+r;return o>=1?(i=e/o,n=0):(i=1-r,n=i===0?0:1-e/i),es(new Gt(t,n,i,s))},Qi=({h:t,s:e,l:r,alpha:s})=>{const{h:n,s:i,v:o}=ts(new Pe(t,e,r,s));return new Jt(n,o*(1-i),1-o,s)},_i=({r:t,g:e,b:r,alpha:s})=>{const n=Math.max(t,e,r),i=Math.min(t,e,r);let[o,a,c]=[0,0,(n+i)/2];const l=n-i;if(l===0)return new Pe(0,0,c,s);switch(a=l/(1-Math.abs(2*c-1)),n){case t:o=(e-r)/l+(e<r?6:0);break;case e:o=(r-t)/l+2;break;case r:o=(t-e)/l+4;break}return o/=6,a<0&&(o=(o+.5)%1,a=Math.abs(a)%1),o>=1&&(o-=1),new Pe(o,a,c,s)};function eo({h:t,s:e,l:r,alpha:s}){const n=(1-Math.abs(2*r-1))*e,i=n*(1-Math.abs(t*6%2-1)),o=r-n/2;let a,c,l;return t<1/6?[a,c,l]=[n,i,0]:t<2/6?[a,c,l]=[i,n,0]:t<3/6?[a,c,l]=[0,n,i]:t<4/6?[a,c,l]=[0,i,n]:t<5/6?[a,c,l]=[i,0,n]:[a,c,l]=[n,0,i],new X(a+o,c+o,l+o,s)}const to=216/24389,ro=24/116,Wt=24389/27,no=8,qe=16,De=116,rs=500,ns=200;function so(t){if(t.whitePoint==="D50")return[t.x,t.y,t.z];if(t.whitePoint==="D65")return R([t.x,t.y,t.z],or);throw new Error(`Unsupported white point: ${t.whitePoint}`)}function io(t){if(t.whitePoint==="D65")return[t.x,t.y,t.z];if(t.whitePoint==="D50")return R([t.x,t.y,t.z],Un);throw new Error(`Unsupported white point: ${t.whitePoint}`)}function ss(t,e="D50"){const r=v=>v>to?Math.cbrt(v):(Wt*v+qe)/De,s=Xn[e],[n,i,o]=so(t),a=n/s[0],c=i/s[1],l=o/s[2],u=r(a),f=r(c),h=r(l),p=De*f-qe,x=rs*(u-f),S=ns*(f-h),I=new mt(P(p,k.lab.l.number.min,k.lab.l.number.max),P(x,k.lab.a.number.min,k.lab.a.number.max),P(S,k.lab.b.number.min,k.lab.b.number.max),t.alpha);return I.whitePoint=e,I}function is(t){const e=O=>O>ro?O**3:(De*O-qe)/Wt,r=O=>O>no?((O+qe)/De)**3:O/Wt,s=Xn[t.whitePoint];let{l:n,a:i,b:o,alpha:a}=t;n=P(n,0,1,k.lab.l.number.min,k.lab.l.number.max),i=P(i,0,1,k.lab.a.number.min,k.lab.a.number.max),o=P(o,0,1,k.lab.b.number.min,k.lab.b.number.max);const c=(n+qe)/De,l=i/rs+c,u=c-o/ns,[f,h,p]=[e(l),r(n),e(u)];let x=f*s[0],S=h*s[1],I=p*s[2];const v=new H(x,S,I,a);return v.whitePoint=t.whitePoint,[x,S,I]=io(v),v.whitePoint="D65",v.x=x,v.y=S,v.z=I,v}const lr=[.41239079926595934,.357584339383878,.1804807884018343,.21263900587151027,.715168678767756,.07219231536073371,.01933081871559182,.11919477979462598,.9505321522496607],os=pe(lr),as=2.4,at=.055,ur=12.92,oo=.04045,cs=oo/ur;function Be(t){const e=t<0?-1:1,r=t*e;return r<=cs?t/ur:e*((r+at)/(1+at))**as}function Ae(t){const e=t<0?-1:1,r=t*e;return r<=cs?t*ur:e*((1+at)*r**(1/as)-at)}function fr({r:t,g:e,b:r,alpha:s}){const n=[Be(t),Be(e),Be(r)],[i,o,a]=R(n,lr);return new H(i,o,a,s)}const hr=({x:t,y:e,z:r,alpha:s},n=!0)=>{const i=R([t,e,r],os),o=Ae(i[0]),a=Ae(i[1]),c=Ae(i[2]);if(n){const l=No(new X(o,a,c,s));return new X(l.r,l.g,l.b,s)}else return new X(o,a,c,s)};function ao({l:t,c:e,h:r,alpha:s}){e=P(e,0,1,k.lch.c.number.min,k.lch.c.number.max);const n=r*2*Math.PI,i=Math.cos(n)*e,o=Math.sin(n)*e;return new mt(t,P(i,k.lab.a.number.min,k.lab.a.number.max),P(o,k.lab.b.number.min,k.lab.b.number.max),s)}function co({l:t,a:e,b:r,alpha:s}){e=P(e,0,1,k.lab.a.number.min,k.lab.a.number.max),r=P(r,0,1,k.lab.b.number.min,k.lab.b.number.max);const n=Math.hypot(e,r);let i=Math.atan2(r,e)/(2*Math.PI);return i<0&&(i+=1),new Qt(t,P(n,k.lch.c.number.min,k.lch.c.number.max),i,s)}function ls({l:t,a:e,b:r,alpha:s}){e=P(e,0,1,k.oklab.a.number.min,k.oklab.a.number.max),r=P(r,0,1,k.oklab.b.number.min,k.oklab.b.number.max);const n=R([t,e,r],Ni),i=[n[0]*n[0]*n[0],n[1]*n[1]*n[1],n[2]*n[2]*n[2]],[o,a,c]=R(i,Fi);return new H(o,a,c,s)}function us(t){const{x:e,y:r,z:s}=t,n=R([e,r,s],Kn),i=[Math.cbrt(n[0]),Math.cbrt(n[1]),Math.cbrt(n[2])],[o,a,c]=R(i,Yn);return new dt(o,P(a,k.oklab.a.number.min,k.oklab.a.number.max),P(c,k.oklab.b.number.min,k.oklab.b.number.max),t.alpha)}function lo({l:t,a:e,b:r,alpha:s}){e=P(e,0,1,k.oklab.a.number.min,k.oklab.a.number.max),r=P(r,0,1,k.oklab.b.number.min,k.oklab.b.number.max);const n=Math.hypot(e,r);let i=Math.atan2(r,e)/(2*Math.PI);return i<0&&(i+=1),new _t(t,P(n,k.oklch.c.number.min,k.oklch.c.number.max),i,s)}function uo({l:t,c:e,h:r,alpha:s}){e=P(e,0,1,k.oklch.c.number.min,k.oklch.c.number.max);const n=r*2*Math.PI,i=Math.cos(n)*e,o=Math.sin(n)*e;return new dt(t,P(i,k.oklab.a.number.min,k.oklab.a.number.max),P(o,k.oklab.b.number.min,k.oklab.b.number.max),s)}function pr(t){const e=eo(t);return fr(e)}function mr(t){const e=hr(t);return _i(e)}function fo(t){const e=es(t);return pr(e)}function ho(t){const e=mr(t);return ts(e)}function po(t){const e=Ji(t);return pr(e)}function mo(t){const e=mr(t);return Qi(e)}function go(t){const e=ao(t);return is(e)}function bo(t){const e=ss(t);return co(e)}function wo(t){const e=uo(t);return ls(e)}function yo(t){const e=us(t);return lo(e)}function ko(t){const e=_n(t);return fr(e)}function vo(t){const e=hr(t);return Gi(e)}const fs=563/256;function Ft(t){return(t<0?-1:1)*Math.abs(t)**fs}function Nt(t){return(t<0?-1:1)*Math.abs(t)**(1/fs)}const hs=1/512,ps=1.8;function Vt(t){const e=t<0?-1:1,r=Math.abs(t);return e*(r<=hs*16?r/16:r**ps)}function jt(t){const e=t<0?-1:1,r=Math.abs(t);return e*(r>=hs?r**(1/ps):r*16)}const ct=1.09929682680944,ms=.018053968510807;function Rt(t){const e=t<0?-1:1,r=Math.abs(t);return r<ms*4.5?e*r/4.5:e*((r+ct-1)/ct)**(1/.45)}function Lt(t){const e=t<0?-1:1,r=Math.abs(t);return r>=ms?e*(ct*r**.45-(ct-1)):e*4.5*r}const ds=[.4865709486482162,.26566769316909306,.1982172852343625,.22897456406974884,.6917385218365064,.079286914093745,0,.04511338185890264,1.043944368900976],xo=pe(ds),gs=[.5766690429101305,.1855582379065463,.1882286462349947,.29734497525053605,.6273635662554661,.07529145849399788,.02703136138641234,.07068885253582723,.9913375368376388],So=pe(gs),bs=[.7977604896723027,.13518583717574031,.0313493495815248,.2880711282292934,.7118432178101014,8565396060525902e-20,0,0,.8251046025104602],Eo=pe(bs),ws=[.6369580483012914,.14461690358620832,.1688809751641721,.2627002120112671,.6779980715188708,.05930171646986196,0,.028072693049087428,1.0609850577107909],Co=pe(ws);function Mo({r:t,g:e,b:r,alpha:s}){const[n,i,o]=R([t,e,r],lr);return new H(n,i,o,s)}function Io({x:t,y:e,z:r,alpha:s}){const[n,i,o]=R([t,e,r],os);return new er(n,i,o,s)}function To({r:t,g:e,b:r,alpha:s}){const n=[Be(t),Be(e),Be(r)],[i,o,a]=R(n,ds);return new H(i,o,a,s)}function $o({x:t,y:e,z:r,alpha:s}){const n=R([t,e,r],xo);return new tr(Ae(n[0]),Ae(n[1]),Ae(n[2]),s)}function Oo({r:t,g:e,b:r,alpha:s}){const n=[Ft(t),Ft(e),Ft(r)],[i,o,a]=R(n,gs);return new H(i,o,a,s)}function Bo({x:t,y:e,z:r,alpha:s}){const n=R([t,e,r],So);return new rr(Nt(n[0]),Nt(n[1]),Nt(n[2]),s)}function Ao({r:t,g:e,b:r,alpha:s}){const n=[Vt(t),Vt(e),Vt(r)],i=R(n,bs),[o,a,c]=R(i,Un);return new H(o,a,c,s)}function Po({x:t,y:e,z:r,alpha:s}){const n=R([t,e,r],or),i=R(n,Eo);return new nr(jt(i[0]),jt(i[1]),jt(i[2]),s)}function zo({r:t,g:e,b:r,alpha:s}){const n=[Rt(t),Rt(e),Rt(r)],[i,o,a]=R(n,ws);return new H(i,o,a,s)}function Fo({x:t,y:e,z:r,alpha:s}){const n=R([t,e,r],Co);return new sr(Lt(n[0]),Lt(n[1]),Lt(n[2]),s)}const Gr={rgb:{to:fr,from:hr},hsl:{to:pr,from:mr},hsv:{to:fo,from:ho},hwb:{to:po,from:mo},lab:{to:is,from:ss},lch:{to:go,from:bo},oklab:{to:ls,from:us},oklch:{to:wo,from:yo},kelvin:{to:ko,from:vo},xyz:{to:t=>t,from:t=>t},"srgb-linear":{to:Mo,from:Io},"display-p3":{to:To,from:$o},"a98-rgb":{to:Oo,from:Bo},"prophoto-rgb":{to:Ao,from:Po},rec2020:{to:zo,from:Fo}};function Se(t,e){if(t.colorSpace===e)return t;const r=Gr[t.colorSpace];if(!r)throw new Error(`Unknown source color space: "${t.colorSpace}"`);const s=Gr[e];if(!s)throw new Error(`Unknown target color space: "${e}"`);const n=r.to(t),i=s.from;return i(n)}const Ie=1e-6;function No(t){const e=Se(t,"rgb"),r=Number.isNaN(e.r)?0:e.r,s=Number.isNaN(e.g)?0:e.g,n=Number.isNaN(e.b)?0:e.b;if(r>=0&&r<=1&&s>=0&&s<=1&&n>=0&&n<=1)return t;if(r>=-Ie&&r<=1+Ie&&s>=-Ie&&s<=1+Ie&&n>=-Ie&&n<=1+Ie){const l=new X(Q(r,0,1),Q(s,0,1),Q(n,0,1),t.alpha);return Se(l,t.colorSpace)}const[i,o,a]=Hi(r,s,n),c=new X(i,o,a,t.alpha);return Se(c,t.colorSpace)}const Vo={hsl:"h",hsv:"h",hwb:"h",lch:"h",oklch:"h"};function jo(t,e,r,s="shorter"){if(Number.isNaN(t)&&Number.isNaN(e))return 0;if(Number.isNaN(t))return e;if(Number.isNaN(e))return t;let n=e-t;switch(s){case"shorter":n>.5?t+=1:n<-.5&&(e+=1);break;case"longer":n>0&&n<.5?t+=1:n>-.5&&n<=0&&(e+=1);break;case"increasing":n<0&&(e+=1);break;case"decreasing":n>0&&(t+=1);break}let i=t+r*(e-t);return i=(i%1+1)%1,i}function Ro(t,e,r,s,n="oklab",i="shorter"){const o=Se(t,n),a=Se(e,n);r<0&&(r=0),s<0&&(s=0);const c=r+s;c===0?(r=.5,s=.5):c!==1&&(r=r/c,s=s/c);const l=Math.min(c,1),u=Vo[n],f=o.keys().filter(v=>v!=="alpha"),h=Number.isNaN(o.alpha)?a.alpha:o.alpha,p=Number.isNaN(a.alpha)?o.alpha:a.alpha,x=Ee(s,h,p)*l,S=[];for(const v of f){let O=o[v],V=a[v];if(Number.isNaN(O)&&Number.isNaN(V)){S.push(0);continue}if(Number.isNaN(O)&&(O=V),Number.isNaN(V)&&(V=O),v===u)S.push(jo(O,V,s,i));else{const T=O*h,Y=V*p,ie=Ee(s,T,Y);S.push(x>0?ie/x:0)}}const I=o.constructor;return new I(...S,x)}const Lo=(t,e,r)=>{const s=k[e][r];return s[t]??s.number},Wo=(t,e,r,s,n=!1)=>{e=n?Ai[r][s]:e;const{min:i,max:o}=Lo(e,r,s),[a,c,l,u]=n?[i,o,0,1]:[0,1,i,o],f=P(t,l,u,a,c);return new d(f,n?e:"")},qo=(t,e=!1)=>{const r=t.colorSpace;return t.keys().forEach(s=>{const n=t[s]instanceof d?t[s].value:t[s];t[s]=Wo(n,t[s]?.unit,r,s,e)}),t},qt=(t,e=!1,r=!1)=>{t=r?t:t.clone();const s=qo(t.value,e);return r?t:new d(s).coalesce(t,!0)},Jr=(t,e="oklab",r=!1,s=!1,n=!1)=>{const i=r?n?t:t.clone():qt(t,!1,n),o=Se(i.toJSON(),e);return o.entries().forEach(([a,c])=>{let l=c;for(;l instanceof d;)l=l.value;o[a]=new d(l)}),i.value=o,i.superType[1]=e,s?qt(i,!0,!0):i},Do=(t,e,r="oklab",s=!1,n=!1,i=!1,o)=>[Jr(t,r,s,n,i),Jr(e,r,s,n,i),o],ys=["px","cm","mm","Q","in","pc","pt"],ks=["em","ex","ch","cap","ic","rem","lh","rlh","vw","vh","vmin","vmax","vb","vi","svw","svh","svi","svb","svmin","svmax","lvw","lvh","lvi","lvb","lvmin","lvmax","dvw","dvh","dvi","dvb","dvmin","dvmax","cqw","cqh","cqi","cqb","cqmin","cqmax"],vs=[...ys,...ks],xs=["s","ms"],Ss=["deg","rad","grad","turn"],Uo=["%"],Xo=["Hz","kHz"],Es=["dpi","dpcm","dppx"],Ko=["fr"],dr=["var","calc"],Yo=["string","var","calc"],Ho=["accentColor","additiveSymbols","alignContent","alignItems","alignSelf","alignmentBaseline","all","anchorName","animation","animationComposition","animationDelay","animationDirection","animationDuration","animationFillMode","animationIterationCount","animationName","animationPlayState","animationRange","animationRangeEnd","animationRangeStart","animationTimeline","animationTimingFunction","appRegion","appearance","ascentOverride","aspectRatio","backdropFilter","backfaceVisibility","background","backgroundAttachment","backgroundBlendMode","backgroundClip","backgroundColor","backgroundImage","backgroundOrigin","backgroundPosition","backgroundPositionX","backgroundPositionY","backgroundRepeat","backgroundSize","basePalette","baselineShift","baselineSource","blockSize","border","borderBlock","borderBlockColor","borderBlockEnd","borderBlockEndColor","borderBlockEndStyle","borderBlockEndWidth","borderBlockStart","borderBlockStartColor","borderBlockStartStyle","borderBlockStartWidth","borderBlockStyle","borderBlockWidth","borderBottom","borderBottomColor","borderBottomLeftRadius","borderBottomRightRadius","borderBottomStyle","borderBottomWidth","borderCollapse","borderColor","borderEndEndRadius","borderEndStartRadius","borderImage","borderImageOutset","borderImageRepeat","borderImageSlice","borderImageSource","borderImageWidth","borderInline","borderInlineColor","borderInlineEnd","borderInlineEndColor","borderInlineEndStyle","borderInlineEndWidth","borderInlineStart","borderInlineStartColor","borderInlineStartStyle","borderInlineStartWidth","borderInlineStyle","borderInlineWidth","borderLeft","borderLeftColor","borderLeftStyle","borderLeftWidth","borderRadius","borderRight","borderRightColor","borderRightStyle","borderRightWidth","borderSpacing","borderStartEndRadius","borderStartStartRadius","borderStyle","borderTop","borderTopColor","borderTopLeftRadius","borderTopRightRadius","borderTopStyle","borderTopWidth","borderWidth","bottom","boxShadow","boxSizing","breakAfter","breakBefore","breakInside","bufferedRendering","captionSide","caretColor","clear","clip","clipPath","clipRule","color","colorInterpolation","colorInterpolationFilters","colorRendering","colorScheme","columnCount","columnFill","columnGap","columnRule","columnRuleColor","columnRuleStyle","columnRuleWidth","columnSpan","columnWidth","columns","contain","containIntrinsicBlockSize","containIntrinsicHeight","containIntrinsicInlineSize","containIntrinsicSize","containIntrinsicWidth","container","containerName","containerType","content","contentVisibility","counterIncrement","counterReset","counterSet","cursor","cx","cy","d","descentOverride","direction","display","dominantBaseline","emptyCells","fallback","fieldSizing","fill","fillOpacity","fillRule","filter","flex","flexBasis","flexDirection","flexFlow","flexGrow","flexShrink","flexWrap","float","floodColor","floodOpacity","font","fontDisplay","fontFamily","fontFeatureSettings","fontKerning","fontOpticalSizing","fontPalette","fontSize","fontStretch","fontStyle","fontSynthesis","fontSynthesisSmallCaps","fontSynthesisStyle","fontSynthesisWeight","fontVariant","fontVariantAlternates","fontVariantCaps","fontVariantEastAsian","fontVariantLigatures","fontVariantNumeric","fontVariantPosition","fontVariationSettings","fontWeight","forcedColorAdjust","gap","grid","gridArea","gridAutoColumns","gridAutoFlow","gridAutoRows","gridColumn","gridColumnEnd","gridColumnGap","gridColumnStart","gridGap","gridRow","gridRowEnd","gridRowGap","gridRowStart","gridTemplate","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","height","hyphenateCharacter","hyphenateLimitChars","hyphens","imageOrientation","imageRendering","inherits","initialLetter","initialValue","inlineSize","inset","insetArea","insetBlock","insetBlockEnd","insetBlockStart","insetInline","insetInlineEnd","insetInlineStart","isolation","justifyContent","justifyItems","justifySelf","left","letterSpacing","lightingColor","lineBreak","lineGapOverride","lineHeight","listStyle","listStyleImage","listStylePosition","listStyleType","margin","marginBlock","marginBlockEnd","marginBlockStart","marginBottom","marginInline","marginInlineEnd","marginInlineStart","marginLeft","marginRight","marginTop","marker","markerEnd","markerMid","markerStart","mask","maskClip","maskComposite","maskImage","maskMode","maskOrigin","maskPosition","maskRepeat","maskSize","maskType","mathDepth","mathShift","mathStyle","maxBlockSize","maxHeight","maxInlineSize","maxWidth","minBlockSize","minHeight","minInlineSize","minWidth","mixBlendMode","navigation","negative","objectFit","objectPosition","objectViewBox","offset","offsetAnchor","offsetDistance","offsetPath","offsetPosition","offsetRotate","opacity","order","orphans","outline","outlineColor","outlineOffset","outlineStyle","outlineWidth","overflow","overflowAnchor","overflowClipMargin","overflowWrap","overflowX","overflowY","overlay","overrideColors","overscrollBehavior","overscrollBehaviorBlock","overscrollBehaviorInline","overscrollBehaviorX","overscrollBehaviorY","pad","padding","paddingBlock","paddingBlockEnd","paddingBlockStart","paddingBottom","paddingInline","paddingInlineEnd","paddingInlineStart","paddingLeft","paddingRight","paddingTop","page","pageBreakAfter","pageBreakBefore","pageBreakInside","pageOrientation","paintOrder","perspective","perspectiveOrigin","placeContent","placeItems","placeSelf","pointerEvents","position","positionAnchor","positionTry","positionTryOptions","positionTryOrder","positionVisibility","prefix","quotes","r","range","resize","right","rotate","rowGap","rubyPosition","rx","ry","scale","scrollBehavior","scrollMargin","scrollMarginBlock","scrollMarginBlockEnd","scrollMarginBlockStart","scrollMarginBottom","scrollMarginInline","scrollMarginInlineEnd","scrollMarginInlineStart","scrollMarginLeft","scrollMarginRight","scrollMarginTop","scrollPadding","scrollPaddingBlock","scrollPaddingBlockEnd","scrollPaddingBlockStart","scrollPaddingBottom","scrollPaddingInline","scrollPaddingInlineEnd","scrollPaddingInlineStart","scrollPaddingLeft","scrollPaddingRight","scrollPaddingTop","scrollSnapAlign","scrollSnapStop","scrollSnapType","scrollTimeline","scrollTimelineAxis","scrollTimelineName","scrollbarColor","scrollbarGutter","scrollbarWidth","shapeImageThreshold","shapeMargin","shapeOutside","shapeRendering","size","sizeAdjust","speak","speakAs","src","stopColor","stopOpacity","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","suffix","symbols","syntax","system","tabSize","tableLayout","textAlign","textAlignLast","textAnchor","textCombineUpright","textDecoration","textDecorationColor","textDecorationLine","textDecorationSkipInk","textDecorationStyle","textDecorationThickness","textEmphasis","textEmphasisColor","textEmphasisPosition","textEmphasisStyle","textIndent","textOrientation","textOverflow","textRendering","textShadow","textSizeAdjust","textSpacingTrim","textTransform","textUnderlineOffset","textUnderlinePosition","textWrap","timelineScope","top","touchAction","transform","transformBox","transformOrigin","transformStyle","transition","transitionBehavior","transitionDelay","transitionDuration","transitionProperty","transitionTimingFunction","translate","types","unicodeBidi","unicodeRange","userSelect","vectorEffect","verticalAlign","viewTimeline","viewTimelineAxis","viewTimelineInset","viewTimelineName","viewTransitionClass","viewTransitionName","visibility","webkitAlignContent","webkitAlignItems","webkitAlignSelf","webkitAnimation","webkitAnimationDelay","webkitAnimationDirection","webkitAnimationDuration","webkitAnimationFillMode","webkitAnimationIterationCount","webkitAnimationName","webkitAnimationPlayState","webkitAnimationTimingFunction","webkitAppRegion","webkitAppearance","webkitBackfaceVisibility","webkitBackgroundClip","webkitBackgroundOrigin","webkitBackgroundSize","webkitBorderAfter","webkitBorderAfterColor","webkitBorderAfterStyle","webkitBorderAfterWidth","webkitBorderBefore","webkitBorderBeforeColor","webkitBorderBeforeStyle","webkitBorderBeforeWidth","webkitBorderBottomLeftRadius","webkitBorderBottomRightRadius","webkitBorderEnd","webkitBorderEndColor","webkitBorderEndStyle","webkitBorderEndWidth","webkitBorderHorizontalSpacing","webkitBorderImage","webkitBorderRadius","webkitBorderStart","webkitBorderStartColor","webkitBorderStartStyle","webkitBorderStartWidth","webkitBorderTopLeftRadius","webkitBorderTopRightRadius","webkitBorderVerticalSpacing","webkitBoxAlign","webkitBoxDecorationBreak","webkitBoxDirection","webkitBoxFlex","webkitBoxOrdinalGroup","webkitBoxOrient","webkitBoxPack","webkitBoxReflect","webkitBoxShadow","webkitBoxSizing","webkitClipPath","webkitColumnBreakAfter","webkitColumnBreakBefore","webkitColumnBreakInside","webkitColumnCount","webkitColumnGap","webkitColumnRule","webkitColumnRuleColor","webkitColumnRuleStyle","webkitColumnRuleWidth","webkitColumnSpan","webkitColumnWidth","webkitColumns","webkitFilter","webkitFlex","webkitFlexBasis","webkitFlexDirection","webkitFlexFlow","webkitFlexGrow","webkitFlexShrink","webkitFlexWrap","webkitFontFeatureSettings","webkitFontSmoothing","webkitHyphenateCharacter","webkitJustifyContent","webkitLineBreak","webkitLineClamp","webkitLocale","webkitLogicalHeight","webkitLogicalWidth","webkitMarginAfter","webkitMarginBefore","webkitMarginEnd","webkitMarginStart","webkitMask","webkitMaskBoxImage","webkitMaskBoxImageOutset","webkitMaskBoxImageRepeat","webkitMaskBoxImageSlice","webkitMaskBoxImageSource","webkitMaskBoxImageWidth","webkitMaskClip","webkitMaskComposite","webkitMaskImage","webkitMaskOrigin","webkitMaskPosition","webkitMaskPositionX","webkitMaskPositionY","webkitMaskRepeat","webkitMaskSize","webkitMaxLogicalHeight","webkitMaxLogicalWidth","webkitMinLogicalHeight","webkitMinLogicalWidth","webkitOpacity","webkitOrder","webkitPaddingAfter","webkitPaddingBefore","webkitPaddingEnd","webkitPaddingStart","webkitPerspective","webkitPerspectiveOrigin","webkitPerspectiveOriginX","webkitPerspectiveOriginY","webkitPrintColorAdjust","webkitRtlOrdering","webkitRubyPosition","webkitShapeImageThreshold","webkitShapeMargin","webkitShapeOutside","webkitTapHighlightColor","webkitTextCombine","webkitTextDecorationsInEffect","webkitTextEmphasis","webkitTextEmphasisColor","webkitTextEmphasisPosition","webkitTextEmphasisStyle","webkitTextFillColor","webkitTextOrientation","webkitTextSecurity","webkitTextSizeAdjust","webkitTextStroke","webkitTextStrokeColor","webkitTextStrokeWidth","webkitTransform","webkitTransformOrigin","webkitTransformOriginX","webkitTransformOriginY","webkitTransformOriginZ","webkitTransformStyle","webkitTransition","webkitTransitionDelay","webkitTransitionDuration","webkitTransitionProperty","webkitTransitionTimingFunction","webkitUserDrag","webkitUserModify","webkitUserSelect","webkitWritingMode","whiteSpace","whiteSpaceCollapse","widows","width","willChange","wordBreak","wordSpacing","wordWrap","writingMode","x","y","zIndex","zoom"];function Zo(t){return t.unit==="color"}const Cs=t=>{const e={},r=(s,n=void 0)=>{if(Array.isArray(s)){s.forEach((o,a)=>r(o,n));return}else if(s instanceof F){if(s.name==="calc"){const a=s.values.map(u=>u.toString()).join(", "),c=new d(a,"calc"),l=n??"calc";e[l]==null&&(e[l]=new G),e[l].push(c),e[l]=e[l].flat();return}let o=s.name;n&&(n.endsWith(s.name)?o=n:o=`${n}.${s.name}`),s.values.forEach((a,c)=>r(a,o));return}else if(Ht(s)){for(const[o,a]of Object.entries(s)){const c=n?`${n}.${o}`:o;r(a,c)}return}const i=n;e[i]==null&&(e[i]=new G),e[i].push(s),e[i]=e[i].flat()};return r(t),e},Go=t=>{const e={};for(const[r,s]of Object.entries(t)){const n=r.split(".");let i=e;for(let o=0;o<n.length;o++){const a=n[o];o===n.length-1?Array.isArray(i)?i.push(s):i[a]=s:(a in i||(i[a]={}),i=i[a])}}return e},Ms=t=>{const e={};for(const[r,s]of Object.entries(t)){const n=r.split("."),i=n[0];let o=e[i]??"",a="",c="";for(let u=1;u<n.length;u++)a+=`${n[u]}(`,c+=")";let l="";n.length>1&&Array.isArray(s)?l=s.join(", "):l=s.toString(),o+=` ${a}${l}${c}`,e[i]=o.trim()}return e};new Set(Ho);const Is=t=>{const e=t.name,r=t.valueOf();if(!t.name.startsWith("matrix"))throw new Error("Input must be a matrix or matrix3d value");const s={scaleX:1,scaleY:1,scaleZ:1,skewX:0,skewY:0,skewZ:0,translateX:0,translateY:0,translateZ:0,rotateX:0,rotateY:0,rotateZ:0,perspectiveX:0,perspectiveY:0,perspectiveZ:0,perspectiveW:1};if(t.name==="matrix")return{...s,scaleX:r[0]??1,skewY:r[1]??0,skewX:r[2]??0,scaleY:r[3]??1,translateX:r[4]??0,translateY:r[5]??0,rotateZ:Math.atan2(r[1]??0,r[0]??1),rotateY:Math.atan2(-(r[2]??0),r[0]??1),rotateX:Math.atan2(r[1]??0,r[3]??1)};if(e==="matrix3d"){if(r.length===4)return{...s,translateX:r[0]??0,translateY:r[1]??0,translateZ:r[2]??0,perspectiveW:r[3]??1};if(r.length===16)return{scaleX:r[0]??1,skewY:r[1]??0,skewX:r[4]??0,scaleY:r[5]??1,scaleZ:r[10]??1,skewZ:r[2]??0,translateX:r[12]??0,translateY:r[13]??0,translateZ:r[14]??0,rotateX:Math.atan2(-(r[9]??0),r[10]??1),rotateY:Math.atan2(r[8]??0,Math.sqrt(Math.pow(r[0]??1,2)+Math.pow(r[1]??0,2))),rotateZ:Math.atan2(r[1]??0,r[0]??1),perspectiveX:r[3]??0,perspectiveY:r[7]??0,perspectiveZ:r[11]??0,perspectiveW:r[15]??1}}throw new Error("Unsupported matrix type or invalid number of values")};function Jo(t){let e=t.parentElement;for(;e;){const r=getComputedStyle(e).containerType;if(r==="inline-size"||r==="size")return e;e=e.parentElement}return null}function Qo(t){const e=getComputedStyle(t).writingMode;return e?.startsWith("vertical")||e?.startsWith("sideways")||!1}function _o(t,e){let r=t;return e==="cm"?r*=96/2.54:e==="mm"?r*=96/25.4:e==="Q"?r*=96/(25.4*4):e==="in"?r*=96:e==="pt"?r*=4/3:e==="pc"&&(r*=16),r}function ea(t,e,r,s){if(e==="em"&&r)t*=parseFloat(getComputedStyle(r).fontSize);else if(e==="rem")t*=parseFloat(getComputedStyle(document.documentElement).fontSize);else if(e==="vh")t*=window.innerHeight/100;else if(e==="vw")t*=window.innerWidth/100;else if(e==="vmin")t*=Math.min(window.innerHeight,window.innerWidth)/100;else if(e==="vmax")t*=Math.max(window.innerHeight,window.innerWidth)/100;else if(e==="%"&&r?.parentElement&&s){const n=parseFloat(getComputedStyle(r.parentElement).getPropertyValue(s));t=t/100*n}else if(e==="ch"&&r){const n=parseFloat(getComputedStyle(r).fontSize)||16;if(typeof OffscreenCanvas<"u"||typeof document<"u")try{const i=(typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")).getContext("2d");i.font=`${n}px ${getComputedStyle(r).fontFamily}`;const o=i.measureText("0").width;t*=o>0?o:n*.5}catch{t*=n*.5}else t*=n*.5}else if(e==="ex"&&r){const n=parseFloat(getComputedStyle(r).fontSize)||16;t*=n*.5}else if((e==="cqw"||e==="cqh"||e==="cqi"||e==="cqb"||e==="cqmin"||e==="cqmax")&&r){const n=Jo(r);if(n){const i=n.clientWidth,o=n.clientHeight,a=Qo(n);e==="cqw"?t*=i/100:e==="cqh"?t*=o/100:e==="cqi"?t*=(a?o:i)/100:e==="cqb"?t*=(a?i:o)/100:e==="cqmin"?t*=Math.min(i,o)/100:t*=Math.max(i,o)/100}}else t=_o(t,e);return t}function Ts(t,e){return e==="s"&&(t*=1e3),t}function $s(t,e){return e==="grad"?t*=.9:e==="rad"?t*=180/Math.PI:e==="turn"&&(t*=360),t}function ta(t,e){return e==="dpcm"?t*=2.54:e==="dppx"&&(t*=96),t}const g=t=>{const e=new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i");return z(e)},kt=z(/-?[a-zA-Z][a-zA-Z0-9-]*/),gr=g("none"),ra=z(/-?\d+/).map(Number),te=z(/-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/).map(Number);function na(t){return new E(e=>e.ok(t,0))}function sa(t){return new E(e=>e.err(void 0,0))}function se(t,e){const r=t.parseState(e);if(r.isError)throw new Error(`Parse error at offset ${r.offset}`);return r.value}const ia=b(...vs.map(g)),oa=b(...Ss.map(g)),aa=b(...xs.map(g)),ca=b(...Xo.map(g)),la=b(...Es.map(g)),ua=b(...Ko.map(g)),fa=b(...Uo.map(g)),ha=m(","),pa=m(" ");b(ha,pa).trim(w);const Os=M(te,ia).map(([t,e])=>{const r=["length"];return ks.includes(e)?r.push("relative"):ys.includes(e)&&r.push("absolute"),new d(t,e,r)}),Bs=M(te,oa).map(([t,e])=>new d(t,e,["angle"])),br=M(te,aa).map(([t,e])=>new d(t,e,["time"])),ma=E.lazy(()=>b(wr,br)),da=M(te,ca).map(([t,e])=>new d(t,e,["frequency"])),ga=M(te,la).map(([t,e])=>new d(t,e,["resolution"])),ba=M(te,ua).map(([t,e])=>new d(t,e,["flex"])),wr=b(M(te,fa),g("from").map(()=>[0,"%"]),g("to").map(()=>[100,"%"])).map(([t,e])=>new d(t,e,["percentage"])),As=E.lazy(()=>kr.Value),wa=m("/").trim(w).map(()=>new d("/","string")),Ps=b(Os,Bs,br,da,ga,ba,wr,As,wa,te.map(t=>new d(t)),gr.map(()=>new d(NaN))).trim(w),q={Length:Os,Angle:Bs,Time:br,TimePercentage:ma,Percentage:wr,Color:As,Value:Ps};function vt(t){return se(Ps,t)}const K=t=>new d(t,"color",["color",t.colorSpace],void 0,"color");function Dt(t){const e=qt(t).value,r=e.clone();for(const s of e.keys()){const n=e[s];r[s]=n instanceof d?n.value:n}return r}function ya(t){const e=t.replace(/[^0-9.+\-*/() e]/g,"");return new Function(`return (${e})`)()}function Qr(t,e){switch(t.type){case"ref":return e[t.name]??0;case"literal":return t.value;case"none":return NaN;case"calc":{let r=t.expr;const s=Object.keys(e).sort((n,i)=>i.length-n.length);for(const n of s)r=r.replace(new RegExp(`\\b${n}\\b`,"g"),String(e[n]));return ya(r)}}}function ka(t,e,r,s){const n=Dt(t),i=Se(n,e),o={};for(const[f,h]of i.entries())o[f]=h;const a=r.map(f=>Qr(f,o)),c=s?Qr(s,o):o.alpha??1,l={rgb:X,hsl:Pe,hwb:Jt,lab:mt,lch:Qt,oklab:dt,oklch:_t,xyz:H,"srgb-linear":er,"display-p3":tr,"a98-rgb":rr,"prophoto-rgb":nr,rec2020:sr}[e]??X,u=new l(...a,c);return K(u)}const va={srgb:"rgb","srgb-linear":"srgb-linear","display-p3":"display-p3","a98-rgb":"a98-rgb","prophoto-rgb":"prophoto-rgb",rec2020:"rec2020",lab:"lab",oklab:"oklab",oklch:"oklch",hsl:"hsl",hwb:"hwb",lch:"lch",xyz:"xyz","xyz-d65":"xyz","xyz-d50":"xyz"},xa={srgb:{space:"rgb",ctor:X},"srgb-linear":{space:"srgb-linear",ctor:er},"display-p3":{space:"display-p3",ctor:tr},"a98-rgb":{space:"a98-rgb",ctor:rr},"prophoto-rgb":{space:"prophoto-rgb",ctor:nr},rec2020:{space:"rec2020",ctor:sr},xyz:{space:"xyz",ctor:H},"xyz-d65":{space:"xyz",ctor:H},"xyz-d50":{space:"xyz",ctor:H}},Sa=m(","),Ea=z(/\s+/),yr=m("/"),xt=m("("),St=m(")"),Ut=b(Sa.trim(w),Ea),Ca=b(yr.trim(w),Ut),ee=E.lazy(()=>b(q.Percentage,q.Angle.map(t=>{const e=$s(t.value,t.unit);return new d(e,"deg",["angle"])}),b(te,ra).map(t=>new d(t)),gr.map(()=>new d(NaN)))),Ge=b(g("calc").next(z(/\(([^)]+)\)/,t=>t?.[1]??null)).map(t=>({type:"calc",expr:t})),gr.map(()=>({type:"none"})),z(/\b(alpha|r|g|b|h|s|l|c|w|a|x|y|z)\b/).map(t=>({type:"ref",name:t})),ee.map(t=>({type:"literal",value:t.value}))),le=t=>{const e=m(t).skip(g("a").opt()),r=b(M(ee.skip(Ca),ee),ee.map(n=>[n])),s=M(ee.skip(Ut),ee.skip(Ut),r).trim(w).wrap(xt,St);return e.next(s).map(([n,i,[o,a]])=>[n,i,o,a??new d(1)])};function me(t,e){return m(t).skip(g("a").opt()).next(M(g("from").skip(w).next(E.lazy(()=>kr.Value)),w.next(Ge),w.next(Ge),w.next(Ge),yr.trim(w).next(Ge).opt()).trim(w).wrap(xt,St)).map(([r,s,n,i,o])=>ka(r,e,[s,n,i],o))}const Ma=z(/#[0-9a-fA-F]{3,8}/).map(t=>{const{r:e,g:r,b:s,alpha:n}=Zi(t);return K(new X(e,r,s,n))}),Ia=te.skip(g("k")).map(t=>{const e=_n(new Fn(t));return K(e)}),Ta=b(me("rgb","rgb"),le("rgb").map(([t,e,r,s])=>K(new X(t,e,r,s)))),$a=b(me("hsl","hsl"),le("hsl").map(([t,e,r,s])=>K(new Pe(t,e,r,s)))),Oa=le("hsv").map(([t,e,r,s])=>K(new Gt(t,e,r,s))),Ba=b(me("hwb","hwb"),le("hwb").map(([t,e,r,s])=>K(new Jt(t,e,r,s)))),Aa=b(me("lab","lab"),le("lab").map(([t,e,r,s])=>K(new mt(t,e,r,s)))),Pa=b(me("lch","lch"),le("lch").map(([t,e,r,s])=>K(new Qt(t,e,r,s)))),za=b(me("oklab","oklab"),le("oklab").map(([t,e,r,s])=>K(new dt(t,e,r,s)))),Fa=b(me("oklch","oklch"),le("oklch").map(([t,e,r,s])=>K(new _t(t,e,r,s)))),Na=b(me("xyz","xyz"),le("xyz").map(([t,e,r,s])=>K(new H(t,e,r,s)))),Va=b(g("srgb-linear").map(()=>"srgb-linear"),g("srgb").map(()=>"srgb"),g("display-p3").map(()=>"display-p3"),g("a98-rgb").map(()=>"a98-rgb"),g("prophoto-rgb").map(()=>"prophoto-rgb"),g("rec2020").map(()=>"rec2020"),g("oklab").map(()=>"oklab"),g("oklch").map(()=>"oklch"),g("lab").map(()=>"lab"),g("lch").map(()=>"lch"),g("hsl").map(()=>"hsl"),g("hwb").map(()=>"hwb"),g("xyz-d65").map(()=>"xyz-d65"),g("xyz-d50").map(()=>"xyz-d50"),g("xyz").map(()=>"xyz")),ja=b(g("shorter"),g("longer"),g("increasing"),g("decreasing")).skip(w).skip(g("hue")),_r=E.lazy(()=>M(kr.Value,w.next(q.Percentage).opt())),Ra=g("color-mix").next(M(g("in").skip(w).next(M(Va,w.next(ja).opt())),m(",").trim(w).next(_r),m(",").trim(w).next(_r)).trim(w).wrap(xt,St)).map(([[t,e],[r,s],[n,i]])=>{const o=va[t]??"oklab",a=e??"shorter";let c=s!=null?s.value/100:-1,l=i!=null?i.value/100:-1;c<0&&l<0?(c=.5,l=.5):c<0?c=1-l:l<0&&(l=1-c);const u=Dt(r),f=Dt(n),h=Ro(u,f,c,l,o,a);return K(h)}),La=b(g("srgb-linear").map(()=>"srgb-linear"),g("srgb").map(()=>"srgb"),g("display-p3").map(()=>"display-p3"),g("a98-rgb").map(()=>"a98-rgb"),g("prophoto-rgb").map(()=>"prophoto-rgb"),g("rec2020").map(()=>"rec2020"),g("xyz-d65").map(()=>"xyz-d65"),g("xyz-d50").map(()=>"xyz-d50"),g("xyz").map(()=>"xyz")),Wa=g("color").next(M(La.skip(w),ee.skip(w),ee.skip(w),b(M(ee.skip(yr.trim(w)),ee),ee.map(t=>[t,void 0]))).trim(w).wrap(xt,St)).map(([t,e,r,[s,n]])=>{const i=xa[t];if(!i)throw new Error(`Unknown color() space: ${t}`);const o=n??new d(1);if(t==="srgb"){const c=l=>l.value*255;return K(new X(c(e),c(r),c(s),o.value))}const a=new i.ctor(e,r,s,o);return t==="xyz-d50"&&a instanceof H&&(a.whitePoint="D50"),K(a)}),qa=b(...Object.keys(Zr).sort((t,e)=>e.length-t.length).map(g)).chain(t=>{const e=Zr[t.toLowerCase()];if(e){const r=vt(e);if(r)return na(r)}return sa()}),Da=b(Ra,Wa,Ma,Ia,Ta,$a,Oa,Ba,Aa,Pa,za,Fa,Na,qa).trim(w),kr={Value:Da};class d{constructor(e,r,s,n,i,o){this.value=e,this.unit=r,this.superType=s,this.subProperty=n,this.property=i,this.targets=o}setSubProperty(e){this.subProperty=e}setProperty(e){this.property=e}setTargets(e){this.targets=e}valueOf(){return this.value}setValue(e){this.value=e}toString(){return this.value==null?"":this.unit==null||this.unit==="string"?`${this.value}`:Zo(this)?this.value.toString():this.unit==="var"?`var(${this.value})`:this.unit==="calc"?`calc(${this.value})`:`${this.value}${this.unit}`}toJSON(){return this.valueOf()}toFixed(e=2){const r=Number(this.value).toFixed(e).replace(/\.0+$/,"");return new d(r).coalesce(this,!0).toString()}clone(){return new d(he(this.value),this.unit,he(this.superType),this.subProperty,this.property)}coalesce(e,r=!1){return e==null?this:Yo.includes(this.unit)?this:r?(this.unit??=e.unit,this.superType??=e.superType,this.subProperty??=e.subProperty,this.property??=e.property,this.targets??=e.targets,this):new d(he(this.value),this.unit??e.unit,he(this.superType??e.superType),this.subProperty??e.subProperty,this.property??e.property,this.targets??e.targets)}}class F{constructor(e,r){this.name=e,this.values=r,r.forEach(s=>{this.setSubProperty(e)})}setSubProperty(e){this.values.forEach(r=>r.setSubProperty(e))}setProperty(e){this.values.forEach(r=>r.setProperty(e))}setTargets(e){this.values.forEach(r=>r.setTargets(e))}setValue(e,r){r!=null?this.values[r].setValue(e):this.values.forEach(s=>s.setValue(e))}valueOf(){return this.values.map(e=>e.valueOf())}toString(){return(this.name==="+"||this.name==="-"||this.name==="*"||this.name==="/")&&this.values.length===2?`${this.values[0].toString()} ${this.name} ${this.values[1].toString()}`:`${this.name}(${this.values.map(e=>e.toString()).join(", ")})`}toJSON(){return{[this.name]:this.values.map(e=>e.toJSON())}}clone(){return new F(this.name,this.values.map(e=>e.clone()))}}class G extends Array{constructor(...e){super(...e)}setSubProperty(e){this.forEach(r=>r.setSubProperty(e))}setProperty(e){this.forEach(r=>r.setProperty(e))}setTargets(e){this.forEach(r=>r.setTargets(e))}setValue(e,r){r!=null?this[r].setValue(e):this.forEach(s=>s.setValue(e))}valueOf(){return this.map(e=>e.valueOf())}toString(){return this.map(e=>e.toString()).join(" ")}toJSON(){return this.map(e=>e.toJSON())}clone(){return new G(...this.map(e=>e.clone()))}}const re=m("("),ne=m(")"),en=m(",");function Ua(t,e){const r=E.lazy(()=>b(a.trim(w).wrap(re,ne),e,t).trim(w)),s=E.lazy(()=>b(M(m("-").trim(w),r).map(([,c])=>new F("*",[new d(-1),c])),M(m("+").trim(w),r).map(([,c])=>c),r)),n=b(m("*"),m("/")).trim(w),i=b(m("+"),m("-")).trim(w),o=M(s,M(n,s).many()).map(([c,l])=>{let u=c;for(const[f,h]of l)u=new F(f,[u,h]);return u}),a=M(o,M(i,o).many()).map(([c,l])=>{let u=c;for(const[f,h]of l)u=new F(f,[u,h]);return u});return a}function Xa(t){const e=E.lazy(()=>V),r=Ua(t,e),s=m("calc").next(r.trim(w).wrap(re,ne)).map(T=>new F("calc",[T])),n=r.trim(w),i=n.sepBy(en.trim(w)),o=m("min").next(i.wrap(re,ne)).map(T=>new F("min",T)),a=m("max").next(i.wrap(re,ne)).map(T=>new F("max",T)),c=m("clamp").next(i.wrap(re,ne)).map(T=>{if(T.length!==3)throw new Error("clamp() requires exactly 3 arguments");return new F("clamp",T)}),l=b(m("nearest"),m("up"),m("down"),m("to-zero")).trim(w),u=m("round").next(M(l.skip(en.trim(w)).opt(),i).wrap(re,ne)).map(([T,Y])=>{const ie=new d(T??"nearest","string");return new F("round",[ie,...Y])}),f=T=>m(T).next(i.wrap(re,ne)).map(Y=>{if(Y.length!==2)throw new Error(`${T}() requires exactly 2 arguments`);return new F(T,Y)}),h=T=>m(T).next(n.trim(w).wrap(re,ne)).map(Y=>new F(T,[Y])),p=f("pow"),x=f("atan2"),S=m("hypot").next(i.wrap(re,ne)).map(T=>new F("hypot",T)),I=m("log").next(i.wrap(re,ne)).map(T=>{if(T.length<1||T.length>2)throw new Error("log() requires 1 or 2 arguments");return new F("log",T)}),v=z(/[a-zA-Z0-9_-]/),O=b(m("infinity").not(v).map(()=>new d(1/0)),m("-infinity").not(v).map(()=>new d(-1/0)),m("NaN").not(v).map(()=>new d(NaN)),m("pi").not(v).map(()=>new d(Math.PI)),m("e").not(v).map(()=>new d(Math.E))),V=b(s,o,a,c,u,f("mod"),f("rem"),h("abs"),h("sign"),h("sin"),h("cos"),h("tan"),h("asin"),h("acos"),h("atan"),x,p,h("sqrt"),S,I,h("exp"),O);return{calcFn:s,mathFunction:V,calcSum:r}}const lt=m("("),ut=m(")"),Xt=m(","),zs=E.lazy(()=>nc.sepBy(b(Xt,w)).trim(w).map(t=>new G(...t))),vr=t=>M(t||kt,zs.wrap(lt,ut)),Ka=()=>{const t=E.lazy(()=>b(z(/[^()]+/),t.many(1).wrap(lt,ut).map(e=>`(${e.flat().join("")})`)).many(1));return m("var").next(t.trim(w).wrap(lt,ut).map(e=>[e].flat(1/0).join(""))).map(e=>new d(e,"var"))},{mathFunction:Fs}=Xa(q.Value),Ya=["translate","scale","rotate","skew"],Kt=["x","y","z"],Ha=Kt.map(g),Za=Ya.map(g),Ga=()=>{const t=M(b(...Za),b(...Ha,m(""))),e=(r,s)=>r+s.toUpperCase();return vr(t).map(([[r,s],n])=>{const i=r.toLowerCase(),o=i==="skew"?Kt.filter(l=>l!=="z"):Kt,a={};if(s){const l=i+s.toUpperCase();a[l]=n[0]}else n.length===1?o.forEach(l=>{const u=e(i,l);a[u]=n[0]}):n.forEach((l,u)=>{const f=e(i,o[u]);a[f]=l});const c=Object.entries(a).map(([l,u])=>new F(l,[u]));return new G(...c)})},Ja={left:270,right:90,top:0,bottom:180},Qa={"top left":315,"left top":315,"top right":45,"right top":45,"bottom right":135,"right bottom":135,"bottom left":225,"left bottom":225},_a=()=>{const t=b(...["linear-gradient","radial-gradient","conic-gradient","repeating-linear-gradient","repeating-radial-gradient","repeating-conic-gradient"].map(g)),e=b(...["left","right","top","bottom"].map(g)),r=M(m("to").skip(w),e.skip(w),e).map(([,u,f])=>{const h=`${u.toLowerCase()} ${f.toLowerCase()}`,p=Qa[h];if(p==null)throw new Error(`Invalid gradient corner: to ${u} ${f}`);return new d(p,"deg")}),s=M(m("to").skip(w),e).map(([,u])=>new d(Ja[u.toLowerCase()],"deg")),n=b(r,s),i=M(g("from").skip(w),q.Angle).map(([,u])=>u),o=b(q.Angle,n),a=b(q.Length,q.Percentage),c=M(q.Color,a.sepBy(w)).map(([u,f])=>!f||f.length===0?[u]:[u,...f]),l=M(c,Xt.trim(w).next(b(c,a)).many()).map(([u,f])=>[u,...f]);return M(t,M(b(i,o).skip(Xt).opt(),l).trim(w).wrap(lt,ut).map(([u,f])=>u?[u,...f].flat():[f])).map(([u,f])=>new F(u,f))},ec=()=>vr(m("cubic-bezier")).map(t=>new F("cubic-bezier",t[1])),tc=["inherit","initial","unset","revert","revert-layer"],rc=b(...tc.map(g)).map(t=>new d(t.toLowerCase(),"string",["keyword"])),Ns=z(/[^\(\)\{\}\s,;]+/).map(t=>new d(t)),xr=b(Ga(),Ka(),Fs,_a(),ec(),vr().map(([t,e])=>new F(t,e))),nc=b(rc,q.Value,xr,Ns).trim(w),Vs={Function:xr,FunctionArgs:zs},sc=M(m("{"),z(/[^{}]+/),m("}")).map(t=>{const e=t.join(`
20
+ `);let r=JSON.parse(e);return new d(r,"json")}),js=b(Fs,q.Value,xr,sc,Ns).trim(w);js.sepBy(w);const ic=_(t=>se(js,t));_(t=>se(q.Percentage,String(t)).valueOf());_(t=>se(q.Time.map(e=>e.unit==="ms"?e.value:e.unit==="s"?e.value*1e3:e.value),t));_((t,e)=>(()=>{if(!e)return t;if(t.unit==="var"){const r=getComputedStyle(e).getPropertyValue(t.value);return vt(r)}if(t.unit==="calc"&&t.property&&t.subProperty&&t.value&&e){const r=t.property,s=e.style[r],n=t.subProperty?`${t.subProperty}(${t.toString()})`:t.toString();e.style[r]=n;const i=getComputedStyle(e).getPropertyValue(r);e.style[r]=s;const o=ic(i);if(o instanceof d)return o;if(o.name.startsWith("matrix")){const a=Is(o)[t.subProperty];if(a!=null)return new d(a,"px",["length","absolute"])}}return t})().coalesce(t),{keyFn:(t,e)=>`${t.toString()}-${JSON.stringify(e)}`});function oc(t){return t}function tn(t){return t*t}function rn(t){return-t*(t-2)}function nn(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)}function sn(t){return t*t*t}function on(t){return(t=t-1)*t*t+1}function ft(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}function an(t){return t*t*(3-2*t)}function ac(t,e,r,s=1e-6){let n=t;for(let a=0;a<8;a++){const c=n*n,l=c*n,u=1-n,f=u*u,h=3*f*n*e+3*u*c*r+l-t;if(Math.abs(h)<s)return n;const p=3*f*e+6*u*n*(r-e)+3*c*(1-r);if(Math.abs(p)<1e-12)break;n-=h/p}let i=0,o=1;n=t;for(let a=0;a<64;a++){const c=1-n,l=3*c*c*n*e+3*c*n*n*r+n*n*n;if(Math.abs(l-t)<s)return n;t>l?i=n:o=n,n=(i+o)/2}return n}const ae=(t,e,r,s)=>n=>{if(n<=0)return 0;if(n>=1)return 1;const i=ac(n,t,r);return ji(i,t,e,r,s)[1]};function cn(t){return t=ae(.09,.91,.5,1.5)(t),t}function ln(t){return t=ae(.09,.91,.5,1.5)(t),t}function un(t){return t=yt(t,[[0,0],[.026,1.746],[.633,1.06],[1,0]])[1],t}function fn(t){return t=yt(t,[[0,0],[.367,.94],[.974,.254],[1,0]])[1],t}function hn(t){return t=yt(t,[[0,0],[.026,1.746],[.633,1.06],[1,0]])[1],t}function pn(t){return t=yt(t,[[0,0],[.026,1.746],[.633,1.06],[1,0]])[1],t}function mn(t){return 1-Math.cos(t*Math.PI/2)}function dn(t){return Math.sin(t*Math.PI/2)}function gn(t){return-(Math.cos(Math.PI*t)-1)/2}function bn(t){return 1-Math.sqrt(1-t*t)}function wn(t){return Math.sqrt(1- --t*t)}function yn(t){return(t/=.5)<1?-(Math.sqrt(1-t*t)-1)/2:(Math.sqrt(1-(t-=2)*t)+1)/2}function kn(t){return t===0?0:Math.pow(2,10*(t-1))}function vn(t){return t===1?1:1-Math.pow(2,-10*t)}function xn(t){return t===0?0:t===1?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*--t))}function cc(t,e){return Math.ceil(t*e)/e}function lc(t,e){return Math.floor(t*e)/e}function uc(t,e){return Math.floor(t*(e+1))/(e+1)}function fc(t,e){return e<=1?t:Math.floor(t*(e-1))/(e-1)}function Sr(t,e="jump-end"){switch(e){case"jump-none":return r=>fc(r,t);case"jump-start":case"start":return r=>cc(r,t);case"jump-end":case"end":return r=>lc(r,t);case"jump-both":case"both":return r=>uc(r,t)}}function hc(){return Sr(1,"jump-start")}function pc(){return Sr(1,"jump-end")}const we={ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1],"ease-in-back":[.6,-.28,.735,.045],"ease-out-back":[.175,.885,.32,1.275],"ease-in-out-back":[.68,-.55,.265,1.55]},mc={linear:oc,easeInQuad:tn,"ease-in-quad":tn,easeOutQuad:rn,"ease-out-quad":rn,easeInOutQuad:nn,"ease-in-out-quad":nn,easeInCubic:sn,"ease-in-cubic":sn,easeOutCubic:on,"ease-out-cubic":on,easeInOutCubic:ft,"ease-in-out-cubic":ft,easeInBounce:cn,"ease-in-bounce":cn,bounceInEase:ln,"bounce-in-ease":ln,bounceInEaseHalf:un,"bounce-in-ease-half":un,bounceOutEase:fn,"bounce-out-ease":fn,bounceOutEaseHalf:hn,"bounce-out-ease-half":hn,bounceInOutEase:pn,"bounce-in-out-ease":pn,easeInSine:mn,"ease-in-sine":mn,easeOutSine:dn,"ease-out-sine":dn,easeInOutSine:gn,"ease-in-out-sine":gn,easeInCirc:bn,"ease-in-circ":bn,easeOutCirc:wn,"ease-out-circ":wn,easeInOutCirc:yn,"ease-in-out-circ":yn,easeInExpo:kn,"ease-in-expo":kn,easeOutExpo:vn,"ease-out-expo":vn,easeInOutExpo:xn,"ease-in-out-expo":xn,smoothStep3:an,"smooth-step-3":an,ease:ae(...we.ease),"ease-in":ae(...we["ease-in"]),"ease-out":ae(...we["ease-out"]),"ease-in-out":ae(...we["ease-in-out"]),"ease-in-back":ae(...we["ease-in-back"]),"ease-out-back":ae(...we["ease-out-back"]),"ease-in-out-back":ae(...we["ease-in-out-back"]),steps:Sr,"step-start":hc,"step-end":pc},Sn=4;function En(t,e="^",r=!1){const s=t.src.split(`
21
+ `),n=Math.min(s.length-1,t.getLineNumber()),i=Math.max(n-Sn,0),o=Math.min(n+Sn+1,s.length),a=s.slice(i,o);if(e){const l=" ".repeat(t.getColumnNumber())+e;a.splice(n-i+1,0,l)}return a.map((l,u)=>` ${i+u+1}| ${l}`).join(`
22
+ `)}const ye=new Map;function Rs(t){if(ye.has(t.id))return ye.get(t.id);const e=(s,n)=>{if(ye.has(s.id))return ye.get(s.id);const{name:i,args:o,parser:a}=s.context,c=a!=null?e(a,n):"unknown",u=(()=>{switch(i){case"string":return`"${o[0]}"`;case"regex":case"regexConcat":case"regexWrap":return`${o[0]}`;case"wrap":case"trim":{const[f,h]=o;return`${e(f,n)} ${c} ${e(h,n)}`}case"trimWhitespace":return`${c}?w`;case"not":return`!${c}`;case"opt":return`${c}?`;case"next":{const[f]=o;return`${c} >> ${e(f,n)}`}case"skip":{const[f]=o;return`${c} << ${e(f,n)}`}case"map":return c;case"all":case"then":return`[${o.map(h=>e(h,n)).join(", ")}]`;case"any":case"or":return o.map(h=>e(h,n)).join(" | ");case"many":{const[f,h]=o,p=h===1/0?`${f},`:`${f},${h}`;return`${c} {${p}}`}case"sepBy":return`${c} sepBy ${e(o[0],n)}`;case"lazy":{const[f]=o,h=wc(f);if(n)return i;{const p=e(h,h.id);return ye.set(h.id,p),p}}case"debug":return c;default:return}})()??i??"unknown";return n&&ye.set(s.id,u),u},r=e(t);return ye.set(t.id,r),r}function Ls(t,e="",r=""){const s=String(t.value),n=t.offset>=t.src.length,a=`${`[${t.isError?"err":n?"done":"ok"}]`} ${e} offset=${t.offset} value=${s}`,c=t.offset>=t.src.length?En(t,"",t.isError):En(t,"^",t.isError);return`${a}
23
+ ${c}`}function dc(t,e="",r=!1,s=console.log){const n=i=>{const o=t.parser(i),a=r?Rs(t):t.context.name??"",c=Ls(o,e,a);return s(c),o};return new A(n,B("debug",t,s))}class ht{constructor(e,r=void 0,s=0,n=!1,i=0){this.src=e,this.value=r,this.offset=s,this.isError=n,this.furthest=i}expected;ok(e,r=0){return this.offset+=r,this.value=e,this.isError=!1,this}err(e,r=0){return this.offset+=r,this.value=e,this.isError=!0,this}from(e,r=0){return this.offset+=r,this.value=e,this}save(){return{offset:this.offset,value:this.value}}restore(e){return this.offset=e.offset,this.value=e.value,this.isError=!1,this}clone(){return new ht(this.src,this.value,this.offset,this.isError,this.furthest)}getColumnNumber(){const e=this.offset,r=this.src.lastIndexOf(`
24
+ `,e),s=r===-1?e:e-(r+1);return Math.max(0,s)}getLineNumber(){const e=this.src.lastIndexOf(`
25
+ `,this.offset);return e>=0?this.src.slice(0,e).split(`
26
+ `).length:0}toString(){return Ls(this)}}function B(t,e,...r){return{name:t,parser:e,args:r}}let gc=0;const ke=new Map,Je=new Map,Ws=20,bc=(1<<Ws)-1;let Ue=-1,pt;function j(t,e){return t.offset>Ue?(Ue=t.offset,pt=t,t.expected=void 0):t.offset,pt}function wc(t){return t.parser?t.parser:t.parser=t()}function yc(t){let e;return r=>(e||(e=t()),e.parser(r))}const kc=0,Qe=1,vc=2;class A{constructor(e,r={}){this.parser=e,this.context=r}id=gc++;state;flags=kc;reset(){pt=void 0,Ue=-1,ke.clear(),Je.clear()}parseState(e){this.reset();const r=new ht(e);if(this.parser(r),r.isError&&pt){const s=new ht(e,void 0,Ue,!0);this.state=s}else this.state=r,r.isError;return r}parse(e){return this.parseState(e).value}getCijKey(e){return this.id<<Ws|e.offset&bc}atLeftRecursionLimit(e){return(Je.get(this.getCijKey(e))??0)>e.src.length-e.offset}memoize(){const e=r=>{const s=this.getCijKey(r),n=Je.get(s)??0,i=ke.get(this.id);if(i&&i.offset>=r.offset)return r.offset=i.offset,r.value=i.value,r.isError=i.isError,r;if(this.atLeftRecursionLimit(r))return r.isError=!0,r;Je.set(s,n+1),this.parser(r);const o=ke.get(this.id);return o&&o.offset>r.offset?r.offset=o.offset:o||ke.set(this.id,r.clone()),r};return new A(e,B("memoize",this))}mergeMemos(){const e=r=>{const s=ke.get(this.id);return s?(r.offset=s.offset,r.value=s.value,r.isError=s.isError,r):this.atLeftRecursionLimit(r)?(r.isError=!0,r):(this.parser(r),ke.get(this.id)||ke.set(this.id,r.clone()),r)};return new A(e,B("mergeMemo",this))}then(e){const r=s=>{const n=s.offset;if(this.parser(s),!s.isError){const i=s.value;if(e.parser(s),!s.isError)return s.ok([i,s.value])}return j(s),s.offset=n,s.isError=!0,s};return new A(r,B("then",this,this,e))}or(e){const r=s=>{const n=s.offset;return this.parser(s),s.isError?(s.offset=n,s.isError=!1,e.parser(s)):s};return new A(r,B("or",this,this,e))}chain(e,r=!1){const s=n=>(this.parser(n),n.isError?n:n.value||r?e(n.value).parser(n):n);return new A(s,B("chain",this,e))}map(e,r=!1){const s=n=>(this.parser(n),!n.isError||r?n.ok(e(n.value)):n);return new A(s,B("map",this))}mapState(e){const r=s=>{const n=s.offset,i=s.value;if(this.parser(s),s.isError)return s;const o=Object.create(s);return o.offset=n,o.value=i,e(s,o)};return new A(r,B("mapState",this))}skip(e){const r=s=>{const n=s.offset;if(this.parser(s),!s.isError){const i=s.value;if(e.parser(s),!s.isError)return s.ok(i)}return j(s),s.offset=n,s.isError=!0,s};return new A(r,B("skip",this,e))}next(e){const r=s=>{const n=s.offset;return this.parser(s),!s.isError&&(e.parser(s),!s.isError)||(j(s),s.offset=n,s.isError=!0),s};return new A(r,B("next",this,e))}opt(){const e=r=>{const s=r.offset;return this.parser(r),r.isError?(j(r),r.offset=s,r.ok(void 0)):r};return new A(e,B("opt",this))}not(e){const r=n=>{const i=n.offset,o=n.value;return this.parser(n),n.isError?(j(n),n.offset=i,n.ok(o)):(n.offset=i,n.isError=!0,n)},s=n=>{const i=n.offset;if(this.parser(n),n.isError)return j(n),n.offset=i,n.isError=!0,n;{const o=n.value,a=n.offset;return n.offset=i,n.isError=!1,e.parser(n),n.isError?(n.offset=a,n.value=o,n.isError=!1,n):(j(n),n.offset=i,n.isError=!0,n)}};return new A(e?s:r,B("not",this,e))}wrap(e,r,s=!0){if(!s)return Xe(e,this,r);const n=this,i=o=>{const a=o.offset;if(e.parser(o),o.isError)return o.offset=a,o;if(n.parser(o),o.isError)return j(o),o.offset=a,o.isError=!0,o;const c=o.value;return r.parser(o),o.isError?(j(o),o.offset=a,o.isError=!0,o):(o.value=c,o)};return new A(i,B("wrap",this,e,r))}call(e){if(this.flags===0)return this.parser(e);if(this.flags===Qe){Te(e);const s=e.offset;return this.parser(e),e.isError?(j(e),e.offset=s,e.isError=!0,e):(Te(e),e)}this.flags&Qe&&Te(e);const r=e.offset;return this.parser(e),e.isError?(j(e),e.offset=r,e.isError=!0,e):(this.flags&Qe&&Te(e),this.flags&vc&&e.offset<e.src.length&&(j(e),e.offset=r,e.isError=!0),e)}trim(e=Cr,r=!0){if(!r)return Xe(e,this,e);if(e.context?.name==="whitespace"){const s=this,n=new A((o=>s.call(o)),B("trimWhitespace",this));n.flags=this.flags|Qe;const i=o=>{Te(o);const a=o.offset;return s.parser(o),o.isError?(j(o),o.offset=a,o.isError=!0,o):(Te(o),o)};return new A(i,B("trimWhitespace",this))}return this.wrap(e,e)}many(e=0,r=1/0){const s=n=>{const i=e>0?e:0,o=i>0?new Array(i):[];let a=0;for(let c=0;c<r;c+=1){const l=n.offset;if(this.parser(n),n.isError){n.offset=l,n.isError=!1;break}if(n.offset===l)break;a<i?o[a]=n.value:o.push(n.value),a++}return a<i&&(o.length=a),a>=e?n.ok(o):(j(n),n.isError=!0,n.value=[],n)};return new A(s,B("many",this,e,r))}sepBy(e,r=0,s=1/0){const n=i=>{const o=r>0?r:0,a=o>0?new Array(o):[];let c=0;for(let l=0;l<s;l+=1){const u=i.offset;if(this.parser(i),i.isError){i.offset=u,i.isError=!1;break}if(i.offset===u)break;c<o?a[c]=i.value:a.push(i.value),c++;const f=i.offset;if(e.parser(i),i.isError){i.offset=f,i.isError=!1;break}}return c<o&&(a.length=c),c>=r?i.ok(a):(j(i),i.isError=!0,i.value=[],i)};return new A(n,B("sepBy",this,e))}eof(){const e=this.skip(xc());return e.context=B("eof",this),e}debug(e="",r=!1,s=console.log){return dc(this,e,r,s)}toString(){return Rs(this)}static lazy(e){return new A(yc(e),B("lazy",void 0,e))}}function xc(){const t=e=>e.offset>=e.src.length?e.ok(void 0):(j(e),e.isError=!0,e);return new A(t,B("eof",void 0))}function Ke(...t){const e=r=>{const s=r.offset;for(const n of t){if(n.parser(r),!r.isError)return r;r.offset=s,r.isError=!1}return j(r),r.isError=!0,r};return new A(t.length===1?t[0].parser:e,B("any",void 0,...t))}function Xe(...t){const e=r=>{const s=[],n=r.offset;for(const i of t){if(i.parser(r),r.isError)return r.offset=n,r.isError=!0,r;r.value!==void 0&&s.push(r.value)}return r.ok(s)};return new A(t.length===1?t[0].parser:e,B("all",void 0,...t))}function ue(t){const e=t.length;let r;if(e===1){const s=t.charCodeAt(0);r=(n=>n.src.charCodeAt(n.offset)===s?(n.offset+=1,n.value=t,n.isError=!1,n):(j(n),n.isError=!0,n))}else r=(s=>s.src.startsWith(t,s.offset)?(s.offset+=e,s.value=t,s.isError=!1,s):(j(s),s.isError=!0,s));return new A(r,B("string",void 0,t))}function Er(t,e){const r=t.flags.replace(/y/g,""),s=new RegExp(t,r+"y"),n=i=>{if(i.offset>=i.src.length)return i.isError=!0,i;const o=i.offset;if(s.lastIndex=o,s.test(i.src)){const a=s.lastIndex;return a>o?(i.offset=a,i.value=i.src.substring(o,a),i.isError=!1,i):(i.value=void 0,i.isError=!1,i)}return j(i),i.isError=!0,i};return new A(n,B("regex",void 0,t))}const Te=t=>{const e=t.src,r=e.length;let s=t.offset;if(s>=r||e.charCodeAt(s)>32)return t;for(;s<r;){const n=e.charCodeAt(s);if(n===32||n>=9&&n<=13)s++;else break}return t.offset=s,t},Cr=Er(/\s*/);Cr.context.name="whitespace";const Sc=t=>t.replace(/\/\*[\s\S]*?\*\//g,""),Ec=t=>t.replace(/\s*!important/gi,""),Mr=t=>Ec(Sc(t));ue("(");ue(")");const Cc=ue(";"),Mc=ue(":"),Ir=ue("{"),Tr=ue("}"),Ic=ue(","),Tc=ue("."),Z=Cr,$c=t=>{const e=[];for(const r of t.flat(1/0)){if(r instanceof d||r instanceof F){e.push(r);continue}throw new TypeError(`Expected parsed CSS value node, got ${typeof r}.`)}return e},Oc=Vs.Function,Bc=Xe(Ir,Er(/[^{}]+/),Tr).map(t=>{const e=t.join(`
27
+ `),r=JSON.parse(e);return new d(r,"json")}),$r=Ke(q.Value,Oc,Bc,Er(/[^\(\)\{\}\s,;]+/).map(t=>new d(t))).trim(Z),Ac=$r.sepBy(Z),Pc=Xe(kt.skip(Mc).trim(Z).map(t=>Gs(t)),Ac.skip(Cc.opt()).trim(Z)).map(t=>{const[e,r]=t,s=new G(...$c(r));return s.setProperty(e),{[e]:s}}),zc=Ke(q.TimePercentage.trim(Z).map(t=>t.toString()),te.map(t=>`${t}%`)),Fc=zc.sepBy(Ic).trim(Z),qs=Pc.many().trim(Z).wrap(Ir,Tr).map(t=>Object.assign({},...t)),Nc=ue("@keyframes").trim(Z).next(kt),Cn=Xe(Fc,qs).map(([t,e])=>t.reduce((r,s)=>(r.set(s,e),r),new Map)),Ds=Ke(Nc.next(Cn.many(1).trim(Z).wrap(Ir,Tr).trim(Z)),Cn.many(1).trim(Z)).map(t=>t.reduce((e,r)=>{for(const[s,n]of r)e.has(s)?e.set(s,{...e.get(s),...n}):e.set(s,n);return e},new Map)),Vc=Tc.trim(Z).next(kt).trim(Z),jc=qs.map(t=>{const e={};for(const[r,s]of Object.entries(t))if(r.includes("animation")){const n=r.replace(/^animation/i,"").replace(/^\w/,o=>o.toLowerCase()),i=Js(s.toString());e[n]=i,delete t[r]}return{options:e,values:t}}),Rc=Vc.next(jc),Lc=Ke(Rc.map(t=>t),Ds.map(t=>({keyframes:t}))),Wc=Lc.sepBy(Z).map(t=>Object.assign({},...t)),Mn={Value:$r,FunctionArgs:Vs.FunctionArgs},qc=_(t=>se($r,Mr(t))),Dc=_(t=>se(Ds,Mr(t)));_(t=>{const e=se(Wc,Mr(t)),r={keyframes:e.keyframes};return e.options!=null&&(r.options=e.options),e.values!=null&&(r.values=e.values),r});_(t=>se(q.Percentage,String(t)).valueOf());const In=_(t=>se(q.Time.map(e=>e.unit==="ms"?e.value:e.unit==="s"?e.value*1e3:e.value),t));_(t=>t>=5e3?`${t/1e3}s`:`${t}ms`);_(t=>t===1/0?"infinite":String(t));const Uc={duration:1e3,delay:0,iterationCount:1,direction:"normal",fillMode:"forwards",timingFunction:ft,useWAAPI:!0,colorSpace:"oklab"},Xc={zIndex:0,weight:1,blendMode:"replace",enabled:!0},_e=t=>typeof t!="object"||t==null?!1:"value"in t&&typeof t.value=="number";class Us{animations={};transform;superKey;paused=!1;started=!1;done=!1;singleTarget=!0;lastTickTime=0;handleId=void 0;resolvePromise=null;constructor(...e){const r=[];for(const s of e){let n,i;s instanceof Or?n=s:(n=s.animation,i=s.layer),this.transform??=n.frames[0].transform;const o=et(n);this.animations[o]={values:{},animation:n,layer:{...Xc,...i}},n.managed=!0,r.push(n)}this.singleTarget=r.every(s=>s.targets[0]===r[0]?.targets[0])}setSuperKey(e){return this.superKey=e,Object.values(this.animations).forEach(r=>{r.animation.superKey=e}),this}setTargets(...e){Object.values(this.animations).forEach(s=>{s.animation.setTargets(...e)});const r=Object.values(this.animations).map(s=>s.animation);return this.singleTarget=r.every(s=>s.targets[0]===r[0]?.targets[0]),this}onStart(){return this.started=!0,this}onEnd(){return this}transformFramesGrouped(e){const r={},s=Object.values(this.animations);s.sort((i,o)=>i.layer.zIndex-o.layer.zIndex);let n=!0;for(const i of s){const{animation:o,values:a,layer:c}=i;if(n=n&&o.done,!c.enabled)continue;if(!(o.done||o.paused)){const u=o.interpFrames(o.t,!1);Object.assign(a,u)}const l=c.properties?Object.fromEntries(Object.entries(a).filter(([u])=>c.properties.has(u))):a;switch(c.blendMode){case"replace":Object.assign(r,l);break;case"add":for(const[u,f]of Object.entries(l))if(u in r){const h=r[u],p=f;_e(h)&&_e(p)?h.value=h.value+p.value:r[u]=f}else r[u]=f;break;case"weighted":for(const[u,f]of Object.entries(l))if(u in r&&c.weight<1){const h=r[u],p=f;_e(h)&&_e(p)?h.value=Ee(c.weight,h.value,p.value):r[u]=f}else r[u]=f;break}}return this.done=n,this.transform(r,e),r}async tick(e){return this.lastTickTime=e,this.started||this.onStart(),await Promise.all(Object.values(this.animations).map(async r=>{(!r.animation.paused||r.animation.pausedTime===0)&&await r.animation.tick(e)})),this.done&&this.onEnd(),this}async draw(e){await this.tick(e),!this.paused&&(this.singleTarget?this.transformFramesGrouped(e):this.done=Object.values(this.animations).map(({animation:r})=>(r.interpFrames(r.t,!0),r)).every(r=>r.done),this.done?(this.reset(),this.resolvePromise&&this.resolvePromise()):this.handleId=Oe(this.draw.bind(this)))}async play(){return new Promise(e=>{this.resolvePromise=e,this.handleId=Oe(this.draw.bind(this))})}pause(){const e=this.paused;if(this.started){this.paused=!this.paused;const r=this.lastTickTime||performance.now();if(Object.values(this.animations).forEach(s=>{const n=s.animation;this.paused?(n.pause(!1),n.pausedTime===0&&(n.pausedTime=r)):n.paused=!1}),this.paused&&this.singleTarget){for(const s of Object.values(this.animations)){const n=s.animation,i=n.interpFrames(n.t,!1);Object.assign(s.values,i)}this.transformFramesGrouped(r)}}return e&&Oe(this.draw.bind(this)),this}reset(){return Object.values(this.animations).forEach(e=>{const r=e.animation;r.started&&r.frames.length>0&&r.interpFrames(0,!0),r.managed=!1,r.reset()}),this.started=!1,this.done=!1,this.paused=!1,this.lastTickTime=0,this}stop(){return zn(this.handleId),this.reset(),this}playing(){return!(!this.started||this.paused)}forcePause(){this.paused=!0,Object.values(this.animations).forEach(e=>{e.animation.paused=!0})}forcePlay(){this.paused=!1,Object.values(this.animations).forEach(e=>{e.animation.paused=!1})}setLayerConfig(e,r){const s=typeof e=="string"?e:et(e),n=this.animations[s];return n&&Object.assign(n.layer,r),this}setLayerEnabled(e,r){return this.setLayerConfig(e,{enabled:r})}getLayerConfig(e){const r=typeof e=="string"?e:et(e);return this.animations[r]?.layer}}const Kc=new Set(["scaleX","scaleY","scaleZ","skewX","skewY","skewZ","translateX","translateY","translateZ","rotateX","rotateY","rotateZ","perspectiveX","perspectiveY","perspectiveZ","perspectiveW"]),Yc=t=>typeof t=="string"&&vs.includes(t),Hc=t=>typeof t=="string"&&Ss.includes(t),Zc=t=>typeof t=="string"&&xs.includes(t),Gc=t=>typeof t=="string"&&Es.includes(t),Tn=t=>typeof t=="string"&&dr.includes(t),Jc=t=>Kc.has(t),Qc=(t,e)=>{if(typeof t!="number"||!Number.isFinite(t))throw new TypeError(`Expected numeric ${e}, got ${String(t)}.`);return t},$n=t=>{if(t.unit!=="color")throw new TypeError("Expected a color ValueUnit.");return t},_c=t=>t,On=new WeakMap;let el=0;const tl=t=>{let e=On.get(t);return e===void 0&&(e=el++,On.set(t,e)),e},Bn=_((t,e)=>(()=>{if(!e)return t;if(t.unit==="var"){const n=getComputedStyle(e).getPropertyValue(t.value);return vt(n)}if(t.unit==="calc"&&t.property&&t.subProperty&&t.value&&e){const n=_c(e.style),i=n[t.property]??"",o=t.subProperty?`${t.subProperty}(${t.toString()})`:t.toString();n[t.property]=o;const a=getComputedStyle(e).getPropertyValue(t.property);n[t.property]=i;const c=qc(a);if(c instanceof d)return c;if(c.name.startsWith("matrix")){const l=Is(c);if(Jc(t.subProperty)){const u=l[t.subProperty];if(u!=null)return new d(u,"px",["length","absolute"])}}}return t})().coalesce(t),{keyFn:(t,e)=>`${t.toString()}-${e?tl(e):"null"}`,shouldCache:(t,e,r)=>!r||r.isConnected}),rl=(t,e,r=!1)=>{if(t?.superType?.[0]!==e?.superType?.[0])return r?[t,e]:[t.clone(),e.clone()];const s=o=>{const a=o?.superType?.[0],c=Qc(o.value,"ValueUnit");switch(a){case"length":if(!Yc(o.unit))throw new TypeError(`Unsupported length unit: ${String(o.unit)}`);return{value:ea(c,o.unit,o.targets?.[0]),unit:"px"};case"angle":if(!Hc(o.unit))throw new TypeError(`Unsupported angle unit: ${String(o.unit)}`);return{value:$s(c,o.unit),unit:"deg"};case"time":if(!Zc(o.unit))throw new TypeError(`Unsupported time unit: ${String(o.unit)}`);return{value:Ts(c,o.unit),unit:"ms"};case"resolution":if(!Gc(o.unit))throw new TypeError(`Unsupported resolution unit: ${String(o.unit)}`);return{value:ta(c,o.unit),unit:"dpi"};default:return{value:c,unit:typeof o.unit=="string"?o.unit:""}}},[n,i]=[s(t),s(e)];return r?(t.value=n.value,t.unit=n.unit,e.value=i.value,e.unit=i.unit,[t,e]):[new d(n.value,n.unit,t.superType,t.subProperty,t.property,t.targets),new d(i.value,i.unit,e.superType,e.subProperty,e.property,e.targets)]};function nl(t,e,r="oklab",s){t=t.coalesce(e),e=e.coalesce(t);const n={start:t,stop:e,value:t.clone(),computed:!1};if(t.unit==="color"&&e.unit==="color"){const[i,o]=Do($n(t),$n(e),r,!0,!1,!1,s);n.start=i,n.stop=o,n.value=i.clone()}if(t.unit!==e.unit){const[i,o]=rl(t,e,!0);n.start=i,n.stop=o,n.value=i.clone()}return n.computed=Tn(t.unit)||Tn(e.unit),n}const $e=t=>{if(t instanceof d)return[t.clone()];if(t instanceof F)return t.values.flatMap(e=>$e(e));if(t instanceof G)return t.flatMap(e=>$e(e));throw new TypeError(`Expected ValueUnit/FunctionValue/ValueArray, got ${typeof t}`)},sl=t=>{const e=t.split(".").pop(),r=t.split(".").shift();if(!e||!r)throw new Error(`Invalid flattened key: ${t}`);return{mainKey:r,childKey:e}},Le=(t,e,r)=>(t.setProperty(e),r!==e&&t.setSubProperty(r),t),Yt=t=>{if(typeof t=="string"){const e=mc[t];return typeof e=="function"&&e.length<=1?e:void 0}else if(t==null)return;return t};function il(t,{start:e,stop:r,value:s}){const n=e.targets?.[0]??r.targets?.[0];if(!n)throw new Error("Cannot interpolate computed values without a target element.");const i=Bn(e,n),o=Bn(r,n),a=dr.includes(i.unit)?o.unit:i.unit,c=Ee(t,i.value,o.value);return s.value=c,s.unit=a,s}function ol(t,{start:e,stop:r,value:s}){return e.value.keys().forEach(n=>{s.value[n]=Ee(t,e.value[n],r.value[n])}),s}function al(t,e){const{start:r,stop:s,computed:n}=e;return typeof r.value=="number"&&typeof s.value=="number"?e.value.value=Ee(t,r.value,s.value):r.unit==="color"?ol(t,e):n&&il(t,e),e}const An=new Map;function cl(t){const e=Cs(t),r=(n,i)=>{const{childKey:o,mainKey:a}=sl(n);if(i instanceof d)return Le(new G(...$e(i)),a,o);if(i instanceof F){const p=i.values.flatMap(x=>$e(r(n,x)));return Le(new G(...p),a,o)}else if(i instanceof G){const p=i.flatMap(x=>$e(r(n,x)));return Le(new G(...p),a,o)}const c=String(i),l=`${o}:${c}`,u=An.get(l);if(u)return Le(u.clone(),a,o);const f=se(Ke(Mn.FunctionArgs.map(p=>(p.setSubProperty(o),p)),Mn.Value),c),h=Le(new G(...$e(f)),a,o);return An.set(l,h.clone()),h};return Object.entries(e).reduce((n,[i,o])=>(n[i]=r(i,o),n),{})}const ll=(t,e,r,s,n="oklab",i)=>{const o=s[e],a=s[r];if(!o||!a)throw new Error(`Invalid interpolation frame bounds (${e} -> ${r}).`);const c=o[t],l=a[t];if(!c||!l)throw new Error(`Missing variable "${t}" in interpolation bounds.`);const u=Math.max(c.length,l.length),f=x=>{const S=x.map(I=>{if(!(I instanceof d))throw new TypeError(`Interpolation for "${t}" requires ValueUnit leaves.`);return I});for(;S.length<u;)S.push(new d(0));return S},h=f(c),p=f(l);return h.map((x,S)=>{const I=p[S];if(!I)throw new Error(`Missing right-hand interpolation value at index ${S}.`);if(!(x instanceof d)||!(I instanceof d))throw new TypeError(`Interpolation for "${t}" requires ValueUnit leaves.`);return nl(x,I,n,i)})};function ul(t,e,r){const[s,n]=[t.start,e.start];return{start:s.value*r/100,stop:n.value*r/100}}function Xs(t,e,r=!0){t=r?t:Cs(t);const s=Ms(t);e.forEach(n=>{Object.entries(s).forEach(([i,o])=>{n.style.setProperty(i,o)})})}const fl=t=>typeof t.transform=="function",Pn=t=>typeof t=="string"&&dr.includes(t);function hl(t){if(!t.targets||t.targets.length===0)return!1;const e=fl(t)?t.transform:void 0;for(const r of t.frames){const s=r.transform;if(s!==Xs&&s!==e)return!1}if(t.frames.length>1){const r=t.frames[0].timingFunction;for(let s=1;s<t.frames.length;s++)if(t.frames[s].timingFunction!==r)return!1}for(const r of t.frames)for(const s of Object.values(r.interpVars))for(const n of s){const i=n.start?.unit,o=n.stop?.unit;if(Pn(i)||Pn(o))return!1}for(const r of t.frames)for(const s of Object.values(r.interpVars))for(const n of s)if(n.start?.unit==="color"||n.stop?.unit==="color")return!1;return!0}function pl(t){const e=t.options.duration,r=[],s=new Set;for(const i of t.frames)s.add(i.time.start),s.add(i.time.stop);const n=[...s].sort((i,o)=>i-o);for(const i of n){const o=t.interpFrames(i,!1);if(Object.keys(o).length===0)continue;const a=Ms(o),c={offset:Math.max(0,Math.min(1,i/e)),...a};r.push(c)}return r}function ml(t){const e=t.options,r={normal:"normal",reverse:"reverse",alternate:"alternate","alternate-reverse":"alternate-reverse"},s={none:"none",forwards:"forwards",backwards:"backwards",both:"both"};return{duration:e.duration,delay:e.delay,iterations:e.iterationCount===1/0?1/0:e.iterationCount,direction:r[e.direction]??"normal",fill:s[e.fillMode]??"forwards",easing:"linear"}}async function dl(t){const e=pl(t),r=ml(t),s=[];for(const n of t.targets){const i=n.animate(e,r);s.push(i)}return await Promise.all(s.map(n=>n.finished)),s}const gl=t=>typeof t!="object"||t==null?!1:typeof t.clone=="function",et=t=>typeof t=="string"?t:t.name??String(t.id);let bl=0;class Or{id=bl++;name;superKey;targets;options;templateFrames=[];parsedVars=[];frameId=0;frames=[];handleId=void 0;startTime=void 0;pausedTime=0;prevTime=0;t=0;iteration=0;started=!1;done=!1;reversed=!1;paused=!1;managed=!1;unflatten=!0;resolvePromise=null;_playingPromise=null;dispatchAnimationEvent(e){if(!(typeof AnimationEvent>"u"))for(const r of this.targets)typeof r?.dispatchEvent=="function"&&r.dispatchEvent(new AnimationEvent(e,{animationName:this.name??"",elapsedTime:this.t/1e3}))}constructor(e,r,s,n){this.options={},this.setOptions({...Uc,...e??{}}),this.targets=r==null?[]:Array.isArray(r)?r:[r],this.name=s,this.superKey=n}convertFrameStart(e){if(e.start.unit==="s"||e.start.unit==="ms"||!e.start.unit){const r=e.start.unit==="s"?"s":"ms",s=Ts(e.start.value,r);e.start.value=s/this.options.duration*100,e.start.unit="%"}return e.start.value=Q(e.start.value,0,100),e}addFrame(e,r,s,n){typeof e=="number"?e=String(e)+"%":typeof e=="string"?e=e:e instanceof d&&(e=String(e));const i=vt(e);let o={id:this.frameId,start:i,vars:r,transform:s,timingFunction:Yt(n)??this.options.timingFunction};return this.convertFrameStart(o),this.templateFrames.push(o),this.frameId+=1,this}createFrame(e,r){const s=this.templateFrames[e],n=this.templateFrames[r],i={start:e,stop:r},o=ul(s,n,this.options.duration);let a=s.transform;if(a==null){const u=Vr(e,this.frames,f=>f.transform!=null);a=this.frames[u].transform}let c=s.timingFunction;if(c==null){const u=Vr(e,this.frames,f=>f.timingFunction!=null);c=this.frames[u].timingFunction}return{id:this.frameId++,ixs:i,start:s.start,time:o,vars:void 0,flatVars:void 0,interpVars:{},transform:a,timingFunction:c}}reconcileVars(e){const r=this.parsedVars[e];r&&Object.keys(r).forEach(s=>{const n=this.parsedVars.findIndex((l,u)=>u>e&&l[s]!=null);if(n===-1)return;const[i,o]=[e,n],a=this.frames.findIndex(l=>l.ixs.start===i&&l.ixs.stop===o),c=a!==-1?this.frames[a]:this.createFrame(i,o);c.interpVars[s]=ll(s,i,o,this.parsedVars,this.options.colorSpace,this.options.hueMethod),a===-1&&this.frames.push(c)})}parse(){this.frames=[],this.templateFrames.sort((e,r)=>e.start.value-r.start.value),this.parsedVars=this.templateFrames.map(e=>{const r=cl(e.vars);return Object.values(r).forEach(s=>{s.setTargets(this.targets)}),r});for(let e=0;e<this.templateFrames.length-1;e++)this.frames.push(this.createFrame(e,e+1));return this.frames.forEach((e,r)=>this.reconcileVars(r)),this.frames.sort((e,r)=>e.time.start===r.time.start?e.time.stop-r.time.stop:e.time.start-r.time.start),this.frames=this.frames.filter(e=>e.interpVars!=null&&Object.keys(e.interpVars).length>0),this.frames.forEach(e=>{const r=Object.entries(e.interpVars).reduce((s,[n,i])=>(s[n]=i.map(o=>o.value),s),{});e.flatVars=r,e.vars=Go(e.flatVars)}),this}setTimingFunction(e){return this.options.timingFunction=Yt(e)??ft,this}setIterationCount(e){if(!e||e==="infinite"||e==="∞"||e==="Infinity")this.options.iterationCount=1/0;else if(typeof e=="string"){const r=parseFloat(e.trim());if(isNaN(r)||r<0)return this;this.options.iterationCount=r}else{if(isNaN(e)||e<0)return this;this.options.iterationCount=e}return this}setDuration(e){typeof e=="string"&&(e=In(e));const r=e??this.options.duration;if(!isFinite(r)||r<=0)return this;const s=this.options.duration,n=r/s;for(let i=0;i<this.frames.length;i++){const o=this.frames[i];o.time.start*=n,o.time.stop*=n}return this.options.duration=r,this}setDelay(e){return typeof e=="string"&&(e=In(e)),this.options.delay=e??0,this}setDirection(e){return this.options.direction=e??"normal",this.reversed=!1,(this.options.direction==="reverse"||this.options.direction==="alternate-reverse"&&this.iteration%2===0||this.options.direction==="alternate"&&this.iteration%2===1)&&(this.reversed=!0),this}setFillMode(e){return this.options.fillMode=e??"forwards",this}setUseWAAPI(e){return this.options.useWAAPI=e??!0,this}setColorSpace(e){return this.options.colorSpace=e??"oklab",this}setHueMethod(e){return e!==void 0&&(this.options.hueMethod=e),this}setOptions(e){return this.setTimingFunction(e.timingFunction),this.setDuration(e.duration),this.setIterationCount(e.iterationCount),this.setDelay(e.delay),this.setDirection(e.direction),this.setFillMode(e.fillMode),this.setUseWAAPI(e.useWAAPI),this.setColorSpace(e.colorSpace),this.setHueMethod(e.hueMethod),this}reverse(){if(this.startTime!==void 0){const e=this.t,r=this.options.duration-2*e;this.startTime-=r}return this.reversed=!this.reversed,this}fillForwards(){this.interpFrames(this.options.duration,!0)}fillBackwards(){this.interpFrames(0,!0)}interpFrames(e,r=!1){e=this.reversed?this.options.duration-e:e;const s={};for(let n=0;n<this.frames.length;n++){const i=this.frames[n],{start:o,stop:a}=i.time;if(e<o||e>a)continue;const c=P(e,o,a,0,1),l=i.timingFunction(c);for(const u of Object.values(i.interpVars))for(const f of u)al(l,f);r&&i.transform(this.unflatten?i.vars:i.flatVars,e),Object.assign(s,i.flatVars)}return s}async onStart(){this.reversed=!1,(this.options.direction==="reverse"||this.options.direction==="alternate-reverse"&&this.iteration%2===0||this.options.direction==="alternate"&&this.iteration%2===1)&&this.reverse(),(this.options.fillMode==="backwards"||this.options.fillMode==="both")&&this.fillBackwards(),this.options.delay>0&&(this.paused=!0,await Zs(this.options.delay),this.paused=!1),this.started=!0}async onEnd(){this.options.fillMode==="forwards"||this.options.fillMode==="both"?this.fillForwards():(this.options.fillMode==="none"||this.options.fillMode==="backwards")&&this.fillBackwards(),this.startTime=void 0,this.iteration>=this.options.iterationCount-1?(this.done=!0,this.iteration=0,this.dispatchAnimationEvent("animationend")):(this.iteration+=1,this.dispatchAnimationEvent("animationiteration"))}async tick(e){if(this.startTime===void 0&&(await this.onStart(),this.startTime=e+this.options.delay,this.dispatchAnimationEvent("animationstart")),this.paused&&this.pausedTime===0)return this.pausedTime=e,this.t;if(this.pausedTime>0&&!this.paused){const r=e-this.pausedTime;this.startTime+=r,this.pausedTime=0}return this.t=e-this.startTime,this.t>=this.options.duration&&(await this.onEnd(),this.t=this.options.duration),this.t}async draw(e){this.managed||(e=await this.tick(e),!this.paused&&(this.interpFrames(e,!0),this.done?(this.reset(),this.resolvePromise&&this.resolvePromise()):this.handleId=Oe(this.draw.bind(this))))}_playRAF(){return new Promise(e=>{this.resolvePromise=e,this.handleId=Oe(this.draw.bind(this))})}async _playWAAPI(){try{await dl(this),this.reset()}catch{return this._playRAF()}}async play(){if(this.managed)return;if(this._playingPromise)return this._playingPromise;let e;return this.options.useWAAPI&&this.targets.length>0&&typeof this.targets[0]?.animate=="function"&&hl(this)?e=this._playWAAPI():e=this._playRAF(),this._playingPromise=e,e.finally(()=>{this._playingPromise=null}),e}pause(e=!0){return this.paused&&e?this.resume():(this.started&&(this.paused=!0),this)}resume(){return this.started&&this.paused&&(this.paused=!1,this.handleId=Oe(this.draw.bind(this))),this}stop(){zn(this.handleId),this.reset()}playing(){return!(!this.started||this.paused)}get effectiveT(){return this.reversed?this.options.duration-this.t:this.t}reset(){return this.done=!1,this.started=!1,this.paused=!1,this.reversed=!1,this.iteration=0,this.startTime=void 0,this.pausedTime=0,this.t=0,this}setTargets(...e){return this.targets=e,this.frames.forEach(r=>{Object.values(r.interpVars).forEach(s=>{s.forEach(({start:n,stop:i,value:o})=>{n.setTargets(this.targets),i.setTargets(this.targets),o.setTargets(this.targets)})})}),this}group(...e){return new Us(this,...e)}}class wl extends Or{constructor(e,...r){super(e,r),this.unflatten=!1}fromVars(e,r){this.unflatten=r!=null,r??=this.transform.bind(this);for(let s=0;s<e.length;s++){const n=e[s],i=Math.round(s/(e.length-1)*100);this.addFrame(i,n,r)}return this.parse(),this}fromKeyframes(e,r){this.unflatten=r!=null,r??=this.transform.bind(this),Ht(e)&&(e=new Map(Object.entries(e)));const s=e instanceof Map?e.entries():Object.entries(e);for(const[n,i]of s)this.addFrame(n,i,r);return this.parse(),this}fromString(e,r){this.unflatten=r!=null,r??=this.transform.bind(this);const s=Dc(e);for(const[n,i]of s.entries()){const o=Object.fromEntries(Object.entries(i).map(([l,u])=>[l,gl(u)?u.clone():u])),a=o.animationTimingFunction??o.timingFunction;delete o.animationTimingFunction,delete o.timingFunction;const c=a?Yt(a.toString()):void 0;this.addFrame(n,o,r,c)}return this.parse(),this}transform(e){Xs(e,this.targets)}}exports.Animation=Or;exports.AnimationGroup=Us;exports.CSSKeyframesAnimation=wl;exports.getAnimationId=et;
@@ -0,0 +1,218 @@
1
+ import { HueInterpolationMethod } from '@mkbabb/value.js';
2
+ import { InterpolatedVar } from '@mkbabb/value.js';
3
+ import { timingFunctions } from '@mkbabb/value.js';
4
+ import { ValueArray } from '@mkbabb/value.js';
5
+ import { ValueUnit } from '@mkbabb/value.js';
6
+
7
+ declare class Animation_2<V extends Vars = any> {
8
+ id: number;
9
+ name: string | undefined;
10
+ superKey: string | undefined;
11
+ targets: HTMLElement[];
12
+ options: AnimationOptions;
13
+ templateFrames: TemplateAnimationFrame<V>[];
14
+ parsedVars: ParsedVarMap[];
15
+ frameId: number;
16
+ frames: AnimationFrame<V>[];
17
+ handleId: number | any;
18
+ startTime: number | undefined;
19
+ pausedTime: number;
20
+ prevTime: number;
21
+ t: number;
22
+ iteration: number;
23
+ started: boolean;
24
+ done: boolean;
25
+ reversed: boolean;
26
+ paused: boolean;
27
+ /** When true, this animation is managed by an AnimationGroup and should not run its own rAF loop. */
28
+ managed: boolean;
29
+ unflatten: boolean;
30
+ private resolvePromise;
31
+ private _playingPromise;
32
+ private dispatchAnimationEvent;
33
+ constructor(options?: Partial<InputAnimationOptions>, targets?: HTMLElement[] | HTMLElement | undefined, name?: string | undefined, superKey?: string | undefined);
34
+ convertFrameStart(frame: TemplateAnimationFrame<V>): TemplateAnimationFrame<V>;
35
+ addFrame<K extends V>(start: number | string | ValueUnit<number>, vars: Partial<K>, transform?: TransformFunction<K>, timingFunction?: TimingFunction | TimingFunctionNames): Animation_2<K>;
36
+ createFrame(startIx: number, endIx: number): AnimationFrame<V>;
37
+ reconcileVars(ix: number): void;
38
+ parse(): this;
39
+ setTimingFunction(timingFunction: InputAnimationOptions["timingFunction"]): this;
40
+ setIterationCount(iterationCount: InputAnimationOptions["iterationCount"]): this;
41
+ setDuration(duration: InputAnimationOptions["duration"]): this;
42
+ setDelay(delay: InputAnimationOptions["delay"]): this;
43
+ setDirection(direction: InputAnimationOptions["direction"]): this;
44
+ setFillMode(fillMode: InputAnimationOptions["fillMode"]): this;
45
+ setUseWAAPI(useWAAPI: InputAnimationOptions["useWAAPI"]): this;
46
+ setColorSpace(colorSpace: InputAnimationOptions["colorSpace"]): this;
47
+ setHueMethod(hueMethod: InputAnimationOptions["hueMethod"]): this;
48
+ setOptions(options: Partial<InputAnimationOptions>): this;
49
+ reverse(): this;
50
+ fillForwards(): void;
51
+ fillBackwards(): void;
52
+ interpFrames(t: number, transformFrames?: boolean): Record<string, ValueUnit<any, string | undefined>[]>;
53
+ onStart(): Promise<void>;
54
+ onEnd(): Promise<void>;
55
+ tick(t: number): Promise<number>;
56
+ draw(t: number): Promise<void>;
57
+ /** Internal rAF-based play loop. */
58
+ private _playRAF;
59
+ /** Play via the Web Animations API for compositor-thread execution. */
60
+ private _playWAAPI;
61
+ play(): Promise<void>;
62
+ pause(draw?: boolean): this;
63
+ resume(): this;
64
+ stop(): void;
65
+ playing(): boolean;
66
+ /** Returns the effective time accounting for direction reversal. */
67
+ get effectiveT(): number;
68
+ reset(): this;
69
+ setTargets(...targets: HTMLElement[]): this;
70
+ group(...animations: Animation_2<V>[]): AnimationGroup<V>;
71
+ }
72
+ export { Animation_2 as Animation }
73
+
74
+ declare interface AnimationFrame<V extends Vars> {
75
+ id: number;
76
+ start: ValueUnit;
77
+ ixs: {
78
+ start: number;
79
+ stop: number;
80
+ };
81
+ time: {
82
+ start: number;
83
+ stop: number;
84
+ };
85
+ flatVars: V;
86
+ vars: V;
87
+ interpVars: {
88
+ [arg: string]: Array<InterpolatedVar<V>>;
89
+ };
90
+ transform: TransformFunction<V>;
91
+ timingFunction: TimingFunction;
92
+ }
93
+
94
+ export declare class AnimationGroup<V extends Vars> {
95
+ animations: AnimationGroupObject<V>;
96
+ transform: TransformFunction<V>;
97
+ superKey: string | undefined;
98
+ paused: boolean;
99
+ started: boolean;
100
+ done: boolean;
101
+ singleTarget: boolean;
102
+ lastTickTime: number;
103
+ handleId: number | any;
104
+ resolvePromise: ((value: void | PromiseLike<void>) => void) | null;
105
+ constructor(...inputs: (Animation_2<V> | AnimationGroupInput<V>)[]);
106
+ setSuperKey(superKey: string): this;
107
+ setTargets(...targets: HTMLElement[]): this;
108
+ onStart(): this;
109
+ onEnd(): this;
110
+ transformFramesGrouped(t: number): Record<string, unknown>;
111
+ tick(t: number): Promise<this>;
112
+ draw(t: number): Promise<void>;
113
+ play(): Promise<unknown>;
114
+ pause(): this;
115
+ reset(): this;
116
+ stop(): this;
117
+ playing(): boolean;
118
+ forcePause(): void;
119
+ forcePlay(): void;
120
+ /** Set layer config for an animation by name or reference. Chainable. */
121
+ setLayerConfig(nameOrAnim: string | Animation_2<V>, config: Partial<AnimationLayerConfig>): this;
122
+ /** Convenience toggle for enabling/disabling a layer. Chainable. */
123
+ setLayerEnabled(nameOrAnim: string | Animation_2<V>, enabled: boolean): this;
124
+ /** Read the layer config for an animation. */
125
+ getLayerConfig(nameOrAnim: string | Animation_2<V>): AnimationLayerConfig | undefined;
126
+ }
127
+
128
+ declare interface AnimationGroupEntry<V extends Vars> {
129
+ animation: Animation_2<V>;
130
+ values: Record<string, unknown>;
131
+ layer: AnimationLayerConfig;
132
+ }
133
+
134
+ /** Input type for AnimationGroup constructor — bare Animation or Animation with layer config. */
135
+ declare type AnimationGroupInput<V extends Vars> = Animation_2<V> | {
136
+ animation: Animation_2<V>;
137
+ layer?: Partial<AnimationLayerConfig>;
138
+ };
139
+
140
+ declare interface AnimationGroupObject<V extends Vars> {
141
+ [key: string]: AnimationGroupEntry<V>;
142
+ }
143
+
144
+ declare interface AnimationLayerConfig {
145
+ /** Higher wins. Default: 0 */
146
+ zIndex: number;
147
+ /** 0–1 for 'weighted' blend mode. Default: 1 */
148
+ weight: number;
149
+ /** Default: 'replace' (backward compat) */
150
+ blendMode: BlendMode;
151
+ /** Layer toggle. Default: true */
152
+ enabled: boolean;
153
+ /** Optional property whitelist — only these properties will be output from this layer */
154
+ properties?: Set<string>;
155
+ }
156
+
157
+ declare type AnimationOptions = {
158
+ duration: number;
159
+ delay: number;
160
+ iterationCount: number;
161
+ direction: (typeof DIRECTIONS)[number];
162
+ fillMode: (typeof FILL_MODES)[number];
163
+ timingFunction: TimingFunction;
164
+ useWAAPI: boolean;
165
+ colorSpace: string;
166
+ hueMethod?: HueInterpolationMethod;
167
+ };
168
+
169
+ declare type BlendMode = "replace" | "add" | "weighted";
170
+
171
+ export declare class CSSKeyframesAnimation<V extends Vars> extends Animation_2<V> {
172
+ constructor(options?: Partial<InputAnimationOptions>, ...targets: HTMLElement[]);
173
+ fromVars(vars: V[], transform?: TransformFunction<V>): this;
174
+ fromKeyframes(keyframes: Map<string, Partial<V>> | Record<string, Partial<V>>, transform?: TransformFunction<V>): this;
175
+ fromString(keyframes: string, transform?: TransformFunction<V>): this;
176
+ transform(vars: V): void;
177
+ }
178
+
179
+ declare const DIRECTIONS: readonly ["normal", "reverse", "alternate", "alternate-reverse"];
180
+
181
+ declare const FILL_MODES: readonly ["none", "forwards", "backwards", "both"];
182
+
183
+ export declare const getAnimationId: (animation: Animation_2 | string) => string;
184
+
185
+ declare type InputAnimationOptions = Partial<{
186
+ duration: number | string;
187
+ delay: number | string;
188
+ iterationCount: number | string | "infinite" | undefined;
189
+ direction: (typeof DIRECTIONS)[number];
190
+ fillMode: (typeof FILL_MODES)[number];
191
+ timingFunction: TimingFunction | TimingFunctionNames | undefined;
192
+ /** When true (default), eligible animations may use the Web Animations API for compositor-thread execution. Set to false to force rAF. */
193
+ useWAAPI: boolean;
194
+ colorSpace?: string;
195
+ hueMethod?: HueInterpolationMethod;
196
+ }>;
197
+
198
+ declare type ParsedVarMap = Record<string, ValueArray>;
199
+
200
+ declare interface TemplateAnimationFrame<V extends Vars> {
201
+ id: number;
202
+ start: ValueUnit;
203
+ vars: V;
204
+ transform?: TransformFunction<V>;
205
+ timingFunction?: TimingFunction;
206
+ }
207
+
208
+ declare type TimingFunction = (t: number) => number;
209
+
210
+ declare type TimingFunctionNames = keyof typeof timingFunctions;
211
+
212
+ declare type TransformFunction<V extends Vars> = (v: V, t: number) => void;
213
+
214
+ declare type Vars<T = any> = {
215
+ [arg: string]: number | string | T;
216
+ };
217
+
218
+ export { }