From 76cb9c2a39d477a64824a985ade40507e3bbade1 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Fri, 13 Feb 2026 21:34:48 -0800 Subject: feat(vanilla): add testing infrastructure and tests (NK-wjnczv) --- vanilla/node_modules/@asamuzakjp/css-color/LICENSE | 21 + .../node_modules/@asamuzakjp/css-color/README.md | 316 ++ .../css-color/dist/browser/css-color.min.js | 1 + .../css-color/dist/browser/css-color.min.js.map | 1 + .../@asamuzakjp/css-color/dist/cjs/index.cjs | 5764 ++++++++++++++++++++ .../@asamuzakjp/css-color/dist/cjs/index.cjs.map | 1 + .../@asamuzakjp/css-color/dist/cjs/index.d.cts | 110 + .../@asamuzakjp/css-color/dist/esm/index.d.ts | 18 + .../@asamuzakjp/css-color/dist/esm/index.js | 22 + .../@asamuzakjp/css-color/dist/esm/index.js.map | 1 + .../@asamuzakjp/css-color/dist/esm/js/cache.d.ts | 44 + .../@asamuzakjp/css-color/dist/esm/js/cache.js | 72 + .../@asamuzakjp/css-color/dist/esm/js/cache.js.map | 1 + .../@asamuzakjp/css-color/dist/esm/js/color.d.ts | 537 ++ .../@asamuzakjp/css-color/dist/esm/js/color.js | 2833 ++++++++++ .../@asamuzakjp/css-color/dist/esm/js/color.js.map | 1 + .../@asamuzakjp/css-color/dist/esm/js/common.d.ts | 21 + .../@asamuzakjp/css-color/dist/esm/js/common.js | 7 + .../css-color/dist/esm/js/common.js.map | 1 + .../css-color/dist/esm/js/constant.d.ts | 43 + .../@asamuzakjp/css-color/dist/esm/js/constant.js | 101 + .../css-color/dist/esm/js/constant.js.map | 1 + .../@asamuzakjp/css-color/dist/esm/js/convert.d.ts | 99 + .../@asamuzakjp/css-color/dist/esm/js/convert.js | 361 ++ .../css-color/dist/esm/js/convert.js.map | 1 + .../css-color/dist/esm/js/css-calc.d.ts | 89 + .../@asamuzakjp/css-color/dist/esm/js/css-calc.js | 826 +++ .../css-color/dist/esm/js/css-calc.js.map | 1 + .../css-color/dist/esm/js/css-gradient.d.ts | 79 + .../css-color/dist/esm/js/css-gradient.js | 261 + .../css-color/dist/esm/js/css-gradient.js.map | 1 + .../@asamuzakjp/css-color/dist/esm/js/css-var.d.ts | 31 + .../@asamuzakjp/css-color/dist/esm/js/css-var.js | 195 + .../css-color/dist/esm/js/css-var.js.map | 1 + .../css-color/dist/esm/js/relative-color.d.ts | 29 + .../css-color/dist/esm/js/relative-color.js | 535 ++ .../css-color/dist/esm/js/relative-color.js.map | 1 + .../@asamuzakjp/css-color/dist/esm/js/resolve.d.ts | 52 + .../@asamuzakjp/css-color/dist/esm/js/resolve.js | 350 ++ .../css-color/dist/esm/js/resolve.js.map | 1 + .../@asamuzakjp/css-color/dist/esm/js/typedef.d.ts | 80 + .../@asamuzakjp/css-color/dist/esm/js/util.d.ts | 53 + .../@asamuzakjp/css-color/dist/esm/js/util.js | 359 ++ .../@asamuzakjp/css-color/dist/esm/js/util.js.map | 1 + .../@asamuzakjp/css-color/package.json | 82 + .../@asamuzakjp/css-color/src/index.ts | 30 + .../@asamuzakjp/css-color/src/js/cache.ts | 114 + .../@asamuzakjp/css-color/src/js/color.ts | 3511 ++++++++++++ .../@asamuzakjp/css-color/src/js/common.ts | 31 + .../@asamuzakjp/css-color/src/js/constant.ts | 68 + .../@asamuzakjp/css-color/src/js/convert.ts | 469 ++ .../@asamuzakjp/css-color/src/js/css-calc.ts | 955 ++++ .../@asamuzakjp/css-color/src/js/css-gradient.ts | 384 ++ .../@asamuzakjp/css-color/src/js/css-var.ts | 250 + .../@asamuzakjp/css-color/src/js/relative-color.ts | 635 +++ .../@asamuzakjp/css-color/src/js/resolve.ts | 443 ++ .../@asamuzakjp/css-color/src/js/typedef.ts | 88 + .../@asamuzakjp/css-color/src/js/util.ts | 443 ++ 58 files changed, 20826 insertions(+) create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/LICENSE create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/README.md create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/browser/css-color.min.js create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/browser/css-color.min.js.map create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/cjs/index.cjs create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/cjs/index.cjs.map create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/cjs/index.d.cts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/index.d.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/index.js create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/index.js.map create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/cache.d.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/cache.js create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/cache.js.map create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/color.d.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/color.js create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/color.js.map create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/common.d.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/common.js create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/common.js.map create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/constant.d.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/constant.js create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/constant.js.map create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/convert.d.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/convert.js create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/convert.js.map create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/css-calc.d.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/css-calc.js create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/css-calc.js.map create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/css-gradient.d.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/css-gradient.js create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/css-gradient.js.map create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/css-var.d.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/css-var.js create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/css-var.js.map create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/relative-color.d.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/relative-color.js create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/relative-color.js.map create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/resolve.d.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/resolve.js create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/resolve.js.map create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/typedef.d.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/util.d.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/util.js create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/dist/esm/js/util.js.map create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/package.json create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/src/index.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/src/js/cache.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/src/js/color.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/src/js/common.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/src/js/constant.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/src/js/convert.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/src/js/css-calc.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/src/js/css-gradient.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/src/js/css-var.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/src/js/relative-color.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/src/js/resolve.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/src/js/typedef.ts create mode 100644 vanilla/node_modules/@asamuzakjp/css-color/src/js/util.ts (limited to 'vanilla/node_modules/@asamuzakjp/css-color') diff --git a/vanilla/node_modules/@asamuzakjp/css-color/LICENSE b/vanilla/node_modules/@asamuzakjp/css-color/LICENSE new file mode 100644 index 0000000..0004c52 --- /dev/null +++ b/vanilla/node_modules/@asamuzakjp/css-color/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 asamuzaK (Kazz) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vanilla/node_modules/@asamuzakjp/css-color/README.md b/vanilla/node_modules/@asamuzakjp/css-color/README.md new file mode 100644 index 0000000..715b6c3 --- /dev/null +++ b/vanilla/node_modules/@asamuzakjp/css-color/README.md @@ -0,0 +1,316 @@ +# CSS color + +[![build](https://github.com/asamuzaK/cssColor/actions/workflows/node.js.yml/badge.svg)](https://github.com/asamuzaK/cssColor/actions/workflows/node.js.yml) +[![CodeQL](https://github.com/asamuzaK/cssColor/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/asamuzaK/cssColor/actions/workflows/github-code-scanning/codeql) +[![npm (scoped)](https://img.shields.io/npm/v/@asamuzakjp/css-color)](https://www.npmjs.com/package/@asamuzakjp/css-color) + +Resolve and convert CSS colors. + +## Install + +```console +npm i @asamuzakjp/css-color +``` + +## Usage + +```javascript +import { convert, resolve, utils } from '@asamuzakjp/css-color'; + +const resolvedValue = resolve( + 'color-mix(in oklab, lch(67.5345 42.5 258.2), color(srgb 0 0.5 0))' +); +// 'oklab(0.620754 -0.0931934 -0.00374881)' + +const convertedValue = convert.colorToHex('lab(46.2775% -47.5621 48.5837)'); +// '#008000' + +const result = utils.isColor('green'); +// true +``` + + + +### resolve(color, opt) + +resolves CSS color + +#### Parameters + +- `color` **[string][133]** color value + - system colors are not supported +- `opt` **[object][135]?** options (optional, default `{}`) + - `opt.currentColor` **[string][133]?** + - color to use for `currentcolor` keyword + - if omitted, it will be treated as a missing color, + i.e. `rgb(none none none / none)` + - `opt.customProperty` **[object][135]?** + - custom properties + - pair of `--` prefixed property name as a key and it's value, + e.g. + ```javascript + const opt = { + customProperty: { + '--some-color': '#008000', + '--some-length': '16px' + } + }; + ``` + - and/or `callback` function to get the value of the custom property, + e.g. + ```javascript + const node = document.getElementById('foo'); + const opt = { + customProperty: { + callback: node.style.getPropertyValue + } + }; + ``` + - `opt.dimension` **[object][135]?** + - dimension, e.g. for converting relative length to pixels + - pair of unit as a key and number in pixels as it's value, + e.g. suppose `1em === 12px`, `1rem === 16px` and `100vw === 1024px`, then + ```javascript + const opt = { + dimension: { + em: 12, + rem: 16, + vw: 10.24 + } + }; + ``` + - and/or `callback` function to get the value as a number in pixels, + e.g. + ```javascript + const opt = { + dimension: { + callback: unit => { + switch (unit) { + case 'em': + return 12; + case 'rem': + return 16; + case 'vw': + return 10.24; + default: + return; + } + } + } + }; + ``` + - `opt.format` **[string][133]?** + - output format, one of below + - `computedValue` (default), [computed value][139] of the color + - `specifiedValue`, [specified value][140] of the color + - `hex`, hex color notation, i.e. `#rrggbb` + - `hexAlpha`, hex color notation with alpha channel, i.e. `#rrggbbaa` + +Returns **[string][133]?** one of `rgba?()`, `#rrggbb(aa)?`, `color-name`, `color(color-space r g b / alpha)`, `color(color-space x y z / alpha)`, `(ok)?lab(l a b / alpha)`, `(ok)?lch(l c h / alpha)`, `'(empty-string)'`, `null` + +- in `computedValue`, values are numbers, however `rgb()` values are integers +- in `specifiedValue`, returns `empty string` for unknown and/or invalid color +- in `hex`, returns `null` for `transparent`, and also returns `null` if any of `r`, `g`, `b`, `alpha` is not a number +- in `hexAlpha`, returns `#00000000` for `transparent`, however returns `null` if any of `r`, `g`, `b`, `alpha` is not a number + +### convert + +Contains various color conversion functions. + +### convert.numberToHex(value) + +convert number to hex string + +#### Parameters + +- `value` **[number][134]** color value + +Returns **[string][133]** hex string: 00..ff + +### convert.colorToHex(value, opt) + +convert color to hex + +#### Parameters + +- `value` **[string][133]** color value +- `opt` **[object][135]?** options (optional, default `{}`) + - `opt.alpha` **[boolean][136]?** return in #rrggbbaa notation + - `opt.customProperty` **[object][135]?** + - custom properties, see `resolve()` function above + - `opt.dimension` **[object][135]?** + - dimension, see `resolve()` function above + +Returns **[string][133]** #rrggbb(aa)? + +### convert.colorToHsl(value, opt) + +convert color to hsl + +#### Parameters + +- `value` **[string][133]** color value +- `opt` **[object][135]?** options (optional, default `{}`) + - `opt.customProperty` **[object][135]?** + - custom properties, see `resolve()` function above + - `opt.dimension` **[object][135]?** + - dimension, see `resolve()` function above + +Returns **[Array][137]<[number][134]>** \[h, s, l, alpha] + +### convert.colorToHwb(value, opt) + +convert color to hwb + +#### Parameters + +- `value` **[string][133]** color value +- `opt` **[object][135]?** options (optional, default `{}`) + - `opt.customProperty` **[object][135]?** + - custom properties, see `resolve()` function above + - `opt.dimension` **[object][135]?** + - dimension, see `resolve()` function above + +Returns **[Array][137]<[number][134]>** \[h, w, b, alpha] + +### convert.colorToLab(value, opt) + +convert color to lab + +#### Parameters + +- `value` **[string][133]** color value +- `opt` **[object][135]?** options (optional, default `{}`) + - `opt.customProperty` **[object][135]?** + - custom properties, see `resolve()` function above + - `opt.dimension` **[object][135]?** + - dimension, see `resolve()` function above + +Returns **[Array][137]<[number][134]>** \[l, a, b, alpha] + +### convert.colorToLch(value, opt) + +convert color to lch + +#### Parameters + +- `value` **[string][133]** color value +- `opt` **[object][135]?** options (optional, default `{}`) + - `opt.customProperty` **[object][135]?** + - custom properties, see `resolve()` function above + - `opt.dimension` **[object][135]?** + - dimension, see `resolve()` function above + +Returns **[Array][137]<[number][134]>** \[l, c, h, alpha] + +### convert.colorToOklab(value, opt) + +convert color to oklab + +#### Parameters + +- `value` **[string][133]** color value +- `opt` **[object][135]?** options (optional, default `{}`) + - `opt.customProperty` **[object][135]?** + - custom properties, see `resolve()` function above + - `opt.dimension` **[object][135]?** + - dimension, see `resolve()` function above + +Returns **[Array][137]<[number][134]>** \[l, a, b, alpha] + +### convert.colorToOklch(value, opt) + +convert color to oklch + +#### Parameters + +- `value` **[string][133]** color value +- `opt` **[object][135]?** options (optional, default `{}`) + - `opt.customProperty` **[object][135]?** + - custom properties, see `resolve()` function above + - `opt.dimension` **[object][135]?** + - dimension, see `resolve()` function above + +Returns **[Array][137]<[number][134]>** \[l, c, h, alpha] + +### convert.colorToRgb(value, opt) + +convert color to rgb + +#### Parameters + +- `value` **[string][133]** color value +- `opt` **[object][135]?** options (optional, default `{}`) + - `opt.customProperty` **[object][135]?** + - custom properties, see `resolve()` function above + - `opt.dimension` **[object][135]?** + - dimension, see `resolve()` function above + +Returns **[Array][137]<[number][134]>** \[r, g, b, alpha] + +### convert.colorToXyz(value, opt) + +convert color to xyz + +#### Parameters + +- `value` **[string][133]** color value +- `opt` **[object][135]?** options (optional, default `{}`) + - `opt.customProperty` **[object][135]?** + - custom properties, see `resolve()` function above + - `opt.dimension` **[object][135]?** + - dimension, see `resolve()` function above + - `opt.d50` **[boolean][136]?** xyz in d50 white point + +Returns **[Array][137]<[number][134]>** \[x, y, z, alpha] + +### convert.colorToXyzD50(value, opt) + +convert color to xyz-d50 + +#### Parameters + +- `value` **[string][133]** color value +- `opt` **[object][135]?** options (optional, default `{}`) + - `opt.customProperty` **[object][135]?** + - custom properties, see `resolve()` function above + - `opt.dimension` **[object][135]?** + - dimension, see `resolve()` function above + +Returns **[Array][137]<[number][134]>** \[x, y, z, alpha] + +### utils + +Contains utility functions. + +### utils.isColor(color) + +is valid color type + +#### Parameters + +- `color` **[string][133]** color value + - system colors are not supported + +Returns **[boolean][136]** + +## Acknowledgments + +The following resources have been of great help in the development of the CSS color. + +- [csstools/postcss-plugins](https://github.com/csstools/postcss-plugins) +- [lru-cache](https://github.com/isaacs/node-lru-cache) + +--- + +Copyright (c) 2024 [asamuzaK (Kazz)](https://github.com/asamuzaK/) + +[133]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[134]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +[135]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object +[136]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +[137]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array +[138]: https://w3c.github.io/csswg-drafts/css-color-4/#color-conversion-code +[139]: https://developer.mozilla.org/en-US/docs/Web/CSS/computed_value +[140]: https://developer.mozilla.org/en-US/docs/Web/CSS/specified_value +[141]: https://www.npmjs.com/package/@csstools/css-calc diff --git a/vanilla/node_modules/@asamuzakjp/css-color/dist/browser/css-color.min.js b/vanilla/node_modules/@asamuzakjp/css-color/dist/browser/css-color.min.js new file mode 100644 index 0000000..3061ad6 --- /dev/null +++ b/vanilla/node_modules/@asamuzakjp/css-color/dist/browser/css-color.min.js @@ -0,0 +1 @@ +class En extends Error{sourceStart;sourceEnd;parserState;constructor(t,n,r,s){super(t),this.name="ParseError",this.sourceStart=n,this.sourceEnd=r,this.parserState=s}}class At extends En{token;constructor(t,n,r,s,a){super(t,n,r,s),this.token=a}}const wt={UnexpectedNewLineInString:"Unexpected newline while consuming a string token.",UnexpectedEOFInString:"Unexpected EOF while consuming a string token.",UnexpectedEOFInComment:"Unexpected EOF while consuming a comment.",UnexpectedEOFInURL:"Unexpected EOF while consuming a url token.",UnexpectedEOFInEscapedCodePoint:"Unexpected EOF while consuming an escaped code point.",UnexpectedCharacterInURL:"Unexpected character while consuming a url token.",InvalidEscapeSequenceInURL:"Invalid escape sequence while consuming a url token.",InvalidEscapeSequenceAfterBackslash:'Invalid escape sequence after "\\"'};function $t(...e){let t="";for(let n=0;n=48&&e<=57}function Ko(e){return e>=65&&e<=90}function Zo(e){return e>=97&&e<=122}function Yt(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function Jo(e){return Zo(e)||Ko(e)}function Xt(e){return Jo(e)||Qo(e)||e===95}function Lr(e){return Xt(e)||qe(e)||e===be}function Qo(e){return e===183||e===8204||e===8205||e===8255||e===8256||e===8204||192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=893||895<=e&&e<=8191||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||63744<=e&&e<=64975||65008<=e&&e<=65533||e===0||!!Kt(e)||e>=65536}function ei(e){return e===11||e===127||0<=e&&e<=8||14<=e&&e<=31}function Jn(e){return e===jt||e===Vt||e===12}function Lt(e){return e===32||e===jt||e===9||e===Vt||e===12}function Kt(e){return e>=55296&&e<=57343}function Zt(e){return e.source.codePointAt(e.cursor)===92&&!Jn(e.source.codePointAt(e.cursor+1)??-1)}function Qn(e,t){return t.source.codePointAt(t.cursor)===be?t.source.codePointAt(t.cursor+1)===be||!!Xt(t.source.codePointAt(t.cursor+1)??-1)||t.source.codePointAt(t.cursor+1)===92&&!Jn(t.source.codePointAt(t.cursor+2)??-1):!!Xt(t.source.codePointAt(t.cursor)??-1)||Zt(t)}function js(e){return e.source.codePointAt(e.cursor)===qt||e.source.codePointAt(e.cursor)===be?!!qe(e.source.codePointAt(e.cursor+1)??-1)||e.source.codePointAt(e.cursor+1)===46&&qe(e.source.codePointAt(e.cursor+2)??-1):e.source.codePointAt(e.cursor)===46?qe(e.source.codePointAt(e.cursor+1)??-1):qe(e.source.codePointAt(e.cursor)??-1)}function ti(e){return e.source.codePointAt(e.cursor)===47&&e.source.codePointAt(e.cursor+1)===42}function ni(e){return e.source.codePointAt(e.cursor)===be&&e.source.codePointAt(e.cursor+1)===be&&e.source.codePointAt(e.cursor+2)===62}var g,F,er;function ri(e){switch(e){case g.OpenParen:return g.CloseParen;case g.CloseParen:return g.OpenParen;case g.OpenCurly:return g.CloseCurly;case g.CloseCurly:return g.OpenCurly;case g.OpenSquare:return g.CloseSquare;case g.CloseSquare:return g.OpenSquare;default:return null}}function si(e){switch(e[0]){case g.OpenParen:return[g.CloseParen,")",-1,-1,void 0];case g.CloseParen:return[g.OpenParen,"(",-1,-1,void 0];case g.OpenCurly:return[g.CloseCurly,"}",-1,-1,void 0];case g.CloseCurly:return[g.OpenCurly,"{",-1,-1,void 0];case g.OpenSquare:return[g.CloseSquare,"]",-1,-1,void 0];case g.CloseSquare:return[g.OpenSquare,"[",-1,-1,void 0];default:return null}}function ai(e,t){for(t.advanceCodePoint(2);;){const n=t.readCodePoint();if(n===void 0){const r=[g.Comment,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return e.onParseError(new At(wt.UnexpectedEOFInComment,t.representationStart,t.representationEnd,["4.3.2. Consume comments","Unexpected EOF"],r)),r}if(n===42&&t.source.codePointAt(t.cursor)!==void 0&&t.source.codePointAt(t.cursor)===47){t.advanceCodePoint();break}}return[g.Comment,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0]}function tr(e,t){const n=t.readCodePoint();if(n===void 0)return e.onParseError(new En(wt.UnexpectedEOFInEscapedCodePoint,t.representationStart,t.representationEnd,["4.3.7. Consume an escaped code point","Unexpected EOF"])),Pt;if(Yt(n)){const r=[n];let s;for(;(s=t.source.codePointAt(t.cursor))!==void 0&&Yt(s)&&r.length<6;)r.push(s),t.advanceCodePoint();Lt(t.source.codePointAt(t.cursor)??-1)&&(t.source.codePointAt(t.cursor)===Vt&&t.source.codePointAt(t.cursor+1)===jt&&t.advanceCodePoint(),t.advanceCodePoint());const a=parseInt(String.fromCodePoint(...r),16);return a===0||Kt(a)||a>1114111?Pt:a}return n===0||Kt(n)?Pt:n}function nr(e,t){const n=[];for(;;){const r=t.source.codePointAt(t.cursor)??-1;if(r===0||Kt(r))n.push(Pt),t.advanceCodePoint(+(r>65535)+1);else if(Lr(r))n.push(r),t.advanceCodePoint(+(r>65535)+1);else{if(!Zt(t))return n;t.advanceCodePoint(),n.push(tr(e,t))}}}function oi(e,t){t.advanceCodePoint();const n=t.source.codePointAt(t.cursor);if(n!==void 0&&(Lr(n)||Zt(t))){let r=er.Unrestricted;Qn(0,t)&&(r=er.ID);const s=nr(e,t);return[g.Hash,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:String.fromCodePoint(...s),type:r}]}return[g.Delim,"#",t.representationStart,t.representationEnd,{value:"#"}]}function ii(e,t){let n=F.Integer;for(t.source.codePointAt(t.cursor)!==qt&&t.source.codePointAt(t.cursor)!==be||t.advanceCodePoint();qe(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();if(t.source.codePointAt(t.cursor)===46&&qe(t.source.codePointAt(t.cursor+1)??-1))for(t.advanceCodePoint(2),n=F.Number;qe(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();if(t.source.codePointAt(t.cursor)===101||t.source.codePointAt(t.cursor)===69){if(qe(t.source.codePointAt(t.cursor+1)??-1))t.advanceCodePoint(2);else{if(t.source.codePointAt(t.cursor+1)!==be&&t.source.codePointAt(t.cursor+1)!==qt||!qe(t.source.codePointAt(t.cursor+2)??-1))return n;t.advanceCodePoint(3)}for(n=F.Number;qe(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint()}return n}function Tr(e,t){let n;{const a=t.source.codePointAt(t.cursor);a===be?n="-":a===qt&&(n="+")}const r=ii(0,t),s=parseFloat(t.source.slice(t.representationStart,t.representationEnd+1));if(Qn(0,t)){const a=nr(e,t);return[g.Dimension,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s,signCharacter:n,type:r,unit:String.fromCodePoint(...a)}]}return t.source.codePointAt(t.cursor)===37?(t.advanceCodePoint(),[g.Percentage,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s,signCharacter:n}]):[g.Number,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s,signCharacter:n,type:r}]}function li(e){for(;Lt(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();return[g.Whitespace,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0]}(function(e){e.Comment="comment",e.AtKeyword="at-keyword-token",e.BadString="bad-string-token",e.BadURL="bad-url-token",e.CDC="CDC-token",e.CDO="CDO-token",e.Colon="colon-token",e.Comma="comma-token",e.Delim="delim-token",e.Dimension="dimension-token",e.EOF="EOF-token",e.Function="function-token",e.Hash="hash-token",e.Ident="ident-token",e.Number="number-token",e.Percentage="percentage-token",e.Semicolon="semicolon-token",e.String="string-token",e.URL="url-token",e.Whitespace="whitespace-token",e.OpenParen="(-token",e.CloseParen=")-token",e.OpenSquare="[-token",e.CloseSquare="]-token",e.OpenCurly="{-token",e.CloseCurly="}-token",e.UnicodeRange="unicode-range-token"})(g||(g={})),(function(e){e.Integer="integer",e.Number="number"})(F||(F={})),(function(e){e.Unrestricted="unrestricted",e.ID="id"})(er||(er={}));class ci{cursor=0;source="";representationStart=0;representationEnd=-1;constructor(t){this.source=t}advanceCodePoint(t=1){this.cursor=this.cursor+t,this.representationEnd=this.cursor-1}readCodePoint(){const t=this.source.codePointAt(this.cursor);if(t!==void 0)return this.cursor=this.cursor+1,this.representationEnd=this.cursor-1,t}unreadCodePoint(t=1){this.cursor=this.cursor-t,this.representationEnd=this.cursor-1}resetRepresentation(){this.representationStart=this.cursor,this.representationEnd=-1}}function ui(e,t){let n="";const r=t.readCodePoint();for(;;){const s=t.readCodePoint();if(s===void 0){const a=[g.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:n}];return e.onParseError(new At(wt.UnexpectedEOFInString,t.representationStart,t.representationEnd,["4.3.5. Consume a string token","Unexpected EOF"],a)),a}if(Jn(s)){t.unreadCodePoint();const a=[g.BadString,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return e.onParseError(new At(wt.UnexpectedNewLineInString,t.representationStart,t.source.codePointAt(t.cursor)===Vt&&t.source.codePointAt(t.cursor+1)===jt?t.representationEnd+2:t.representationEnd+1,["4.3.5. Consume a string token","Unexpected newline"],a)),a}if(s===r)return[g.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:n}];if(s!==92)s===0||Kt(s)?n+=String.fromCodePoint(Pt):n+=String.fromCodePoint(s);else{if(t.source.codePointAt(t.cursor)===void 0)continue;if(Jn(t.source.codePointAt(t.cursor)??-1)){t.source.codePointAt(t.cursor)===Vt&&t.source.codePointAt(t.cursor+1)===jt&&t.advanceCodePoint(),t.advanceCodePoint();continue}n+=String.fromCodePoint(tr(e,t))}}}function hi(e){return!(e.length!==3||e[0]!==117&&e[0]!==85||e[1]!==114&&e[1]!==82||e[2]!==108&&e[2]!==76)}function _r(e,t){for(;;){const n=t.source.codePointAt(t.cursor);if(n===void 0)return;if(n===41)return void t.advanceCodePoint();Zt(t)?(t.advanceCodePoint(),tr(e,t)):t.advanceCodePoint()}}function fi(e,t){for(;Lt(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();let n="";for(;;){if(t.source.codePointAt(t.cursor)===void 0){const s=[g.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:n}];return e.onParseError(new At(wt.UnexpectedEOFInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token","Unexpected EOF"],s)),s}if(t.source.codePointAt(t.cursor)===41)return t.advanceCodePoint(),[g.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:n}];if(Lt(t.source.codePointAt(t.cursor)??-1)){for(t.advanceCodePoint();Lt(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();if(t.source.codePointAt(t.cursor)===void 0){const s=[g.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:n}];return e.onParseError(new At(wt.UnexpectedEOFInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token","Consume as much whitespace as possible","Unexpected EOF"],s)),s}return t.source.codePointAt(t.cursor)===41?(t.advanceCodePoint(),[g.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:n}]):(_r(e,t),[g.BadURL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0])}const r=t.source.codePointAt(t.cursor);if(r===34||r===39||r===40||ei(r??-1)){_r(e,t);const s=[g.BadURL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return e.onParseError(new At(wt.UnexpectedCharacterInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token",`Unexpected U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point`],s)),s}if(r===92){if(Zt(t)){t.advanceCodePoint(),n+=String.fromCodePoint(tr(e,t));continue}_r(e,t);const s=[g.BadURL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return e.onParseError(new At(wt.InvalidEscapeSequenceInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],s)),s}t.source.codePointAt(t.cursor)===0||Kt(t.source.codePointAt(t.cursor)??-1)?(n+=String.fromCodePoint(Pt),t.advanceCodePoint()):(n+=t.source[t.cursor],t.advanceCodePoint())}}function Wr(e,t){const n=nr(e,t);if(t.source.codePointAt(t.cursor)!==40)return[g.Ident,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:String.fromCodePoint(...n)}];if(hi(n)){t.advanceCodePoint();let r=0;for(;;){const s=Lt(t.source.codePointAt(t.cursor)??-1),a=Lt(t.source.codePointAt(t.cursor+1)??-1);if(s&&a){r+=1,t.advanceCodePoint(1);continue}const o=s?t.source.codePointAt(t.cursor+1):t.source.codePointAt(t.cursor);if(o===34||o===39)return r>0&&t.unreadCodePoint(r),[g.Function,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:String.fromCodePoint(...n)}];break}return fi(e,t)}return t.advanceCodePoint(),[g.Function,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:String.fromCodePoint(...n)}]}function pi(e){return!(e.source.codePointAt(e.cursor)!==117&&e.source.codePointAt(e.cursor)!==85||e.source.codePointAt(e.cursor+1)!==qt||e.source.codePointAt(e.cursor+2)!==63&&!Yt(e.source.codePointAt(e.cursor+2)??-1))}function di(e,t){t.advanceCodePoint(2);const n=[],r=[];let s;for(;(s=t.source.codePointAt(t.cursor))!==void 0&&n.length<6&&Yt(s);)n.push(s),t.advanceCodePoint();for(;(s=t.source.codePointAt(t.cursor))!==void 0&&n.length<6&&s===63;)r.length===0&&r.push(...n),n.push(48),r.push(70),t.advanceCodePoint();if(!r.length&&t.source.codePointAt(t.cursor)===be&&Yt(t.source.codePointAt(t.cursor+1)??-1))for(t.advanceCodePoint();(s=t.source.codePointAt(t.cursor))!==void 0&&r.length<6&&Yt(s);)r.push(s),t.advanceCodePoint();if(!r.length){const i=parseInt(String.fromCodePoint(...n),16);return[g.UnicodeRange,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{startOfRange:i,endOfRange:i}]}const a=parseInt(String.fromCodePoint(...n),16),o=parseInt(String.fromCodePoint(...r),16);return[g.UnicodeRange,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{startOfRange:a,endOfRange:o}]}function Nt(e,t){const n=qs(e),r=[];for(;!n.endOfFile();)r.push(n.nextToken());return r.push(n.nextToken()),r}function qs(e,t){const n=e.css.valueOf(),r=e.unicodeRangesAllowed??!1,s=new ci(n),a={onParseError:mi};return{nextToken:function(){s.resetRepresentation();const o=s.source.codePointAt(s.cursor);if(o===void 0)return[g.EOF,"",-1,-1,void 0];if(o===47&&ti(s))return ai(a,s);if(r&&(o===117||o===85)&&pi(s))return di(0,s);if(Xt(o))return Wr(a,s);if(qe(o))return Tr(a,s);switch(o){case 44:return s.advanceCodePoint(),[g.Comma,",",s.representationStart,s.representationEnd,void 0];case 58:return s.advanceCodePoint(),[g.Colon,":",s.representationStart,s.representationEnd,void 0];case 59:return s.advanceCodePoint(),[g.Semicolon,";",s.representationStart,s.representationEnd,void 0];case 40:return s.advanceCodePoint(),[g.OpenParen,"(",s.representationStart,s.representationEnd,void 0];case 41:return s.advanceCodePoint(),[g.CloseParen,")",s.representationStart,s.representationEnd,void 0];case 91:return s.advanceCodePoint(),[g.OpenSquare,"[",s.representationStart,s.representationEnd,void 0];case 93:return s.advanceCodePoint(),[g.CloseSquare,"]",s.representationStart,s.representationEnd,void 0];case 123:return s.advanceCodePoint(),[g.OpenCurly,"{",s.representationStart,s.representationEnd,void 0];case 125:return s.advanceCodePoint(),[g.CloseCurly,"}",s.representationStart,s.representationEnd,void 0];case 39:case 34:return ui(a,s);case 35:return oi(a,s);case qt:case 46:return js(s)?Tr(a,s):(s.advanceCodePoint(),[g.Delim,s.source[s.representationStart],s.representationStart,s.representationEnd,{value:s.source[s.representationStart]}]);case jt:case Vt:case 12:case 9:case 32:return li(s);case be:return js(s)?Tr(a,s):ni(s)?(s.advanceCodePoint(3),[g.CDC,"-->",s.representationStart,s.representationEnd,void 0]):Qn(0,s)?Wr(a,s):(s.advanceCodePoint(),[g.Delim,"-",s.representationStart,s.representationEnd,{value:"-"}]);case 60:return Xo(s)?(s.advanceCodePoint(4),[g.CDO,"