@stylexjs/babel-plugin 0.17.4 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -327,6 +327,7 @@ const defaultOptions = {
327
327
  classNamePrefix: 'x',
328
328
  dev: false,
329
329
  debug: false,
330
+ propertyValidationMode: 'silent',
330
331
  enableDebugClassNames: false,
331
332
  enableDevClassNames: false,
332
333
  enableDebugDataProp: true,
@@ -369,6 +370,12 @@ const checkRuntimeInjection = unionOf3(boolean(), string(), object({
369
370
  from: string(),
370
371
  as: string()
371
372
  }));
373
+ const checkEnvOption = (value, name = 'options.env') => {
374
+ if (typeof value !== 'object' || value == null || Array.isArray(value)) {
375
+ return new Error(`Expected (${name}) to be an object, but got \`${String(JSON.stringify(value))}\`.`);
376
+ }
377
+ return value;
378
+ };
372
379
  const DEFAULT_INJECT_PATH = '@stylexjs/stylex/lib/stylex-inject';
373
380
  class StateManager {
374
381
  importPaths = new Set();
@@ -388,6 +395,7 @@ class StateManager {
388
395
  stylexViewTransitionClassImport = new Set();
389
396
  stylexDefaultMarkerImport = new Set();
390
397
  stylexWhenImport = new Set();
398
+ stylexEnvImport = new Set();
391
399
  injectImportInserted = null;
392
400
  styleMap = new Map();
393
401
  styleVars = new Map();
@@ -418,8 +426,13 @@ class StateManager {
418
426
  const configuredImportSources = logAndDefault(checkImportSources, options.importSources ?? defaultOptions.importSources, [], 'options.importSources');
419
427
  const importSources = [name, 'stylex', ...configuredImportSources];
420
428
  const styleResolution = logAndDefault(unionOf3(literal('application-order'), literal('property-specificity'), literal('legacy-expand-shorthands')), options.styleResolution ?? defaultOptions.styleResolution, 'property-specificity', 'options.styleResolution');
429
+ const propertyValidationMode = logAndDefault(unionOf3(literal('throw'), literal('warn'), literal('silent')), options.propertyValidationMode ?? defaultOptions.propertyValidationMode, 'silent', 'options.propertyValidationMode');
421
430
  const unstable_moduleResolution = logAndDefault(unionOf(nullish(), CheckModuleResolution), options.unstable_moduleResolution, null, 'options.unstable_moduleResolution');
422
431
  const treeshakeCompensation = logAndDefault(boolean(), options.treeshakeCompensation ?? defaultOptions.treeshakeCompensation, false, 'options.treeshakeCompensation');
432
+ const envInput = logAndDefault(checkEnvOption, options.env ?? {}, {}, 'options.env');
433
+ const env = Object.freeze({
434
+ ...envInput
435
+ });
423
436
  const aliasesOption = logAndDefault(unionOf(nullish(), objectOf(unionOf(string(), array(string())))), options.aliases, null, 'options.aliases');
424
437
  const aliases = aliasesOption == null ? aliasesOption : Object.fromEntries(Object.entries(aliasesOption).map(([key, value]) => {
425
438
  if (typeof value === 'string') {
@@ -434,6 +447,8 @@ class StateManager {
434
447
  debug,
435
448
  definedStylexCSSVariables: {},
436
449
  dev,
450
+ propertyValidationMode,
451
+ env,
437
452
  enableDebugClassNames,
438
453
  enableDebugDataProp,
439
454
  enableDevClassNames,
@@ -475,6 +490,31 @@ class StateManager {
475
490
  }
476
491
  return null;
477
492
  }
493
+ applyStylexEnv(identifiers) {
494
+ const env = this.options.env;
495
+ this.stylexImport.forEach(importName => {
496
+ const current = identifiers[importName];
497
+ if (current != null && typeof current === 'object' && !Array.isArray(current)) {
498
+ if ('fn' in current) {
499
+ identifiers[importName] = {
500
+ env
501
+ };
502
+ } else {
503
+ identifiers[importName] = {
504
+ ...current,
505
+ env
506
+ };
507
+ }
508
+ return;
509
+ }
510
+ identifiers[importName] = {
511
+ env
512
+ };
513
+ });
514
+ this.stylexEnvImport.forEach(importName => {
515
+ identifiers[importName] = env;
516
+ });
517
+ }
478
518
  get canReferenceTheme() {
479
519
  return !!this.inStyleXCreate;
480
520
  }
@@ -793,6 +833,9 @@ function readImportDeclarations(path, state) {
793
833
  if (importedName === 'defaultMarker') {
794
834
  state.stylexDefaultMarkerImport.add(localName);
795
835
  }
836
+ if (importedName === 'env') {
837
+ state.stylexEnvImport.add(localName);
838
+ }
796
839
  }
797
840
  }
798
841
  }
@@ -859,6 +902,9 @@ function readRequires(path, state) {
859
902
  if (prop.key.name === 'defaultMarker') {
860
903
  state.stylexDefaultMarkerImport.add(value.name);
861
904
  }
905
+ if (prop.key.name === 'env') {
906
+ state.stylexEnvImport.add(value.name);
907
+ }
862
908
  }
863
909
  }
864
910
  }
@@ -954,6 +1000,15 @@ const shorthands$2 = {
954
1000
  borderTopRightRadius: value => [['borderTopRightRadius', value], ['borderStartStartRadius', null], ['borderStartEndRadius', null]],
955
1001
  borderBottomLeftRadius: value => [['borderBottomLeftRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
956
1002
  borderBottomRightRadius: value => [['borderBottomRightRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
1003
+ cornerShape: value => [['cornerShape', value], ['cornerStartStartShape', null], ['cornerStartEndShape', null], ['cornerEndStartShape', null], ['cornerEndEndShape', null], ['cornerTopLeftShape', null], ['cornerTopRightShape', null], ['cornerBottomLeftShape', null], ['cornerBottomRightShape', null]],
1004
+ cornerStartStartShape: value => [['cornerStartStartShape', value], ['cornerTopLeftShape', null], ['cornerTopRightShape', null]],
1005
+ cornerStartEndShape: value => [['cornerStartEndShape', value], ['cornerTopLeftShape', null], ['cornerTopRightShape', null]],
1006
+ cornerEndStartShape: value => [['cornerEndStartShape', value], ['cornerBottomLeftShape', null], ['cornerBottomRightShape', null]],
1007
+ cornerEndEndShape: value => [['cornerEndEndShape', value], ['cornerBottomLeftShape', null], ['cornerBottomRightShape', null]],
1008
+ cornerTopLeftShape: value => [['cornerTopLeftShape', value], ['cornerStartStartShape', null], ['cornerStartEndShape', null]],
1009
+ cornerTopRightShape: value => [['cornerTopRightShape', value], ['cornerStartStartShape', null], ['cornerStartEndShape', null]],
1010
+ cornerBottomLeftShape: value => [['cornerBottomLeftShape', value], ['cornerEndStartShape', null], ['cornerEndEndShape', null]],
1011
+ cornerBottomRightShape: value => [['cornerBottomRightShape', value], ['cornerEndStartShape', null], ['cornerEndEndShape', null]],
957
1012
  borderImage: value => [['borderImage', value], ['borderImageOutset', null], ['borderImageRepeat', null], ['borderImageSlice', null], ['borderImageSource', null], ['borderImageWidth', null]],
958
1013
  columnRule: value => [['columnRule', value], ['columnRuleColor', null], ['columnRuleStyle', null], ['columnRuleWidth', null]],
959
1014
  columns: value => [['columns', value], ['columnCount', null], ['columnWidth', null]],
@@ -1451,7 +1506,19 @@ function flatMapExpandedShorthands(objEntry, options) {
1451
1506
  if (Array.isArray(value)) {
1452
1507
  throw new Error('Cannot use fallbacks for shorthands. Use the expansion instead.');
1453
1508
  }
1454
- return expansion(value);
1509
+ try {
1510
+ return expansion(value);
1511
+ } catch (error) {
1512
+ const validationMode = options.propertyValidationMode ?? 'silent';
1513
+ if (validationMode === 'throw') {
1514
+ throw error;
1515
+ } else if (validationMode === 'warn') {
1516
+ console.warn(`[stylex] ${error.message}`);
1517
+ return [];
1518
+ } else {
1519
+ return [];
1520
+ }
1521
+ }
1455
1522
  }
1456
1523
  return [[key, value]];
1457
1524
  }
@@ -1469,8 +1536,8 @@ var hasRequiredDist;
1469
1536
  function requireDist () {
1470
1537
  if (hasRequiredDist) return dist;
1471
1538
  hasRequiredDist = 1;
1472
- (function (exports) {
1473
- class ParseError extends Error{sourceStart;sourceEnd;parserState;constructor(e,n,o,t){super(e),this.name="ParseError",this.sourceStart=n,this.sourceEnd=o,this.parserState=t;}}class ParseErrorWithToken extends ParseError{token;constructor(e,n,o,t,r){super(e,n,o,t),this.token=r;}}const e={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 "\\"'},n="undefined"!=typeof globalThis&&"structuredClone"in globalThis;const o=13,t=45,r=10,s=43,i=65533;function checkIfFourCodePointsWouldStartCDO(e){return 60===e.source.codePointAt(e.cursor)&&33===e.source.codePointAt(e.cursor+1)&&e.source.codePointAt(e.cursor+2)===t&&e.source.codePointAt(e.cursor+3)===t}function isDigitCodePoint(e){return e>=48&&e<=57}function isUppercaseLetterCodePoint(e){return e>=65&&e<=90}function isLowercaseLetterCodePoint(e){return e>=97&&e<=122}function isHexDigitCodePoint(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function isLetterCodePoint(e){return isLowercaseLetterCodePoint(e)||isUppercaseLetterCodePoint(e)}function isIdentStartCodePoint(e){return isLetterCodePoint(e)||isNonASCII_IdentCodePoint(e)||95===e}function isIdentCodePoint(e){return isIdentStartCodePoint(e)||isDigitCodePoint(e)||e===t}function isNonASCII_IdentCodePoint(e){return 183===e||8204===e||8205===e||8255===e||8256===e||8204===e||(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||(0===e||(!!isSurrogate(e)||e>=65536)))}function isNewLine(e){return e===r||e===o||12===e}function isWhitespace(e){return 32===e||e===r||9===e||e===o||12===e}function isSurrogate(e){return e>=55296&&e<=57343}function checkIfTwoCodePointsAreAValidEscape(e){return 92===e.source.codePointAt(e.cursor)&&!isNewLine(e.source.codePointAt(e.cursor+1)??-1)}function checkIfThreeCodePointsWouldStartAnIdentSequence(e,n){return n.source.codePointAt(n.cursor)===t?n.source.codePointAt(n.cursor+1)===t||(!!isIdentStartCodePoint(n.source.codePointAt(n.cursor+1)??-1)||92===n.source.codePointAt(n.cursor+1)&&!isNewLine(n.source.codePointAt(n.cursor+2)??-1)):!!isIdentStartCodePoint(n.source.codePointAt(n.cursor)??-1)||checkIfTwoCodePointsAreAValidEscape(n)}function checkIfThreeCodePointsWouldStartANumber(e){return e.source.codePointAt(e.cursor)===s||e.source.codePointAt(e.cursor)===t?!!isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1)||46===e.source.codePointAt(e.cursor+1)&&isDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1):46===e.source.codePointAt(e.cursor)?isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1):isDigitCodePoint(e.source.codePointAt(e.cursor)??-1)}function checkIfTwoCodePointsStartAComment(e){return 47===e.source.codePointAt(e.cursor)&&42===e.source.codePointAt(e.cursor+1)}function checkIfThreeCodePointsWouldStartCDC(e){return e.source.codePointAt(e.cursor)===t&&e.source.codePointAt(e.cursor+1)===t&&62===e.source.codePointAt(e.cursor+2)}var c,a,u;function consumeComment(n,o){for(o.advanceCodePoint(2);;){const t=o.readCodePoint();if(void 0===t){const t=[exports.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInComment,o.representationStart,o.representationEnd,["4.3.2. Consume comments","Unexpected EOF"],t)),t}if(42===t&&(void 0!==o.source.codePointAt(o.cursor)&&47===o.source.codePointAt(o.cursor))){o.advanceCodePoint();break}}return [exports.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0]}function consumeEscapedCodePoint(n,t){const s=t.readCodePoint();if(void 0===s)return n.onParseError(new ParseError(e.UnexpectedEOFInEscapedCodePoint,t.representationStart,t.representationEnd,["4.3.7. Consume an escaped code point","Unexpected EOF"])),i;if(isHexDigitCodePoint(s)){const e=[s];let n;for(;void 0!==(n=t.source.codePointAt(t.cursor))&&isHexDigitCodePoint(n)&&e.length<6;)e.push(n),t.advanceCodePoint();isWhitespace(t.source.codePointAt(t.cursor)??-1)&&(t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint());const c=parseInt(String.fromCodePoint(...e),16);return 0===c||isSurrogate(c)||c>1114111?i:c}return 0===s||isSurrogate(s)?i:s}function consumeIdentSequence(e,n){const o=[];for(;;){const t=n.source.codePointAt(n.cursor)??-1;if(0===t||isSurrogate(t))o.push(i),n.advanceCodePoint(+(t>65535)+1);else if(isIdentCodePoint(t))o.push(t),n.advanceCodePoint(+(t>65535)+1);else {if(!checkIfTwoCodePointsAreAValidEscape(n))return o;n.advanceCodePoint(),o.push(consumeEscapedCodePoint(e,n));}}}function consumeHashToken(e,n){n.advanceCodePoint();const o=n.source.codePointAt(n.cursor);if(void 0!==o&&(isIdentCodePoint(o)||checkIfTwoCodePointsAreAValidEscape(n))){let o=exports.HashType.Unrestricted;checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)&&(o=exports.HashType.ID);const t=consumeIdentSequence(e,n);return [exports.TokenType.Hash,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...t),type:o}]}return [exports.TokenType.Delim,"#",n.representationStart,n.representationEnd,{value:"#"}]}function consumeNumber(e,n){let o=exports.NumberType.Integer;for(n.source.codePointAt(n.cursor)!==s&&n.source.codePointAt(n.cursor)!==t||n.advanceCodePoint();isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(46===n.source.codePointAt(n.cursor)&&isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint(2),o=exports.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(101===n.source.codePointAt(n.cursor)||69===n.source.codePointAt(n.cursor)){if(isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))n.advanceCodePoint(2);else {if(n.source.codePointAt(n.cursor+1)!==t&&n.source.codePointAt(n.cursor+1)!==s||!isDigitCodePoint(n.source.codePointAt(n.cursor+2)??-1))return o;n.advanceCodePoint(3);}for(o=exports.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();}return o}function consumeNumericToken(e,n){let o;{const e=n.source.codePointAt(n.cursor);e===t?o="-":e===s&&(o="+");}const r=consumeNumber(0,n),i=parseFloat(n.source.slice(n.representationStart,n.representationEnd+1));if(checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)){const t=consumeIdentSequence(e,n);return [exports.TokenType.Dimension,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r,unit:String.fromCodePoint(...t)}]}return 37===n.source.codePointAt(n.cursor)?(n.advanceCodePoint(),[exports.TokenType.Percentage,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o}]):[exports.TokenType.Number,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r}]}function consumeWhiteSpace(e){for(;isWhitespace(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();return [exports.TokenType.Whitespace,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0]}exports.TokenType=void 0,(c=exports.TokenType||(exports.TokenType={})).Comment="comment",c.AtKeyword="at-keyword-token",c.BadString="bad-string-token",c.BadURL="bad-url-token",c.CDC="CDC-token",c.CDO="CDO-token",c.Colon="colon-token",c.Comma="comma-token",c.Delim="delim-token",c.Dimension="dimension-token",c.EOF="EOF-token",c.Function="function-token",c.Hash="hash-token",c.Ident="ident-token",c.Number="number-token",c.Percentage="percentage-token",c.Semicolon="semicolon-token",c.String="string-token",c.URL="url-token",c.Whitespace="whitespace-token",c.OpenParen="(-token",c.CloseParen=")-token",c.OpenSquare="[-token",c.CloseSquare="]-token",c.OpenCurly="{-token",c.CloseCurly="}-token",c.UnicodeRange="unicode-range-token",exports.NumberType=void 0,(a=exports.NumberType||(exports.NumberType={})).Integer="integer",a.Number="number",exports.HashType=void 0,(u=exports.HashType||(exports.HashType={})).Unrestricted="unrestricted",u.ID="id";class Reader{cursor=0;source="";representationStart=0;representationEnd=-1;constructor(e){this.source=e;}advanceCodePoint(e=1){this.cursor=this.cursor+e,this.representationEnd=this.cursor-1;}readCodePoint(){const e=this.source.codePointAt(this.cursor);if(void 0!==e)return this.cursor=this.cursor+1,this.representationEnd=this.cursor-1,e}unreadCodePoint(e=1){this.cursor=this.cursor-e,this.representationEnd=this.cursor-1;}resetRepresentation(){this.representationStart=this.cursor,this.representationEnd=-1;}}function consumeStringToken(n,t){let s="";const c=t.readCodePoint();for(;;){const a=t.readCodePoint();if(void 0===a){const o=[exports.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInString,t.representationStart,t.representationEnd,["4.3.5. Consume a string token","Unexpected EOF"],o)),o}if(isNewLine(a)){t.unreadCodePoint();const s=[exports.TokenType.BadString,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedNewLineInString,t.representationStart,t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r?t.representationEnd+2:t.representationEnd+1,["4.3.5. Consume a string token","Unexpected newline"],s)),s}if(a===c)return [exports.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];if(92!==a)0===a||isSurrogate(a)?s+=String.fromCodePoint(i):s+=String.fromCodePoint(a);else {if(void 0===t.source.codePointAt(t.cursor))continue;if(isNewLine(t.source.codePointAt(t.cursor)??-1)){t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint();continue}s+=String.fromCodePoint(consumeEscapedCodePoint(n,t));}}}function checkIfCodePointsMatchURLIdent(e){return !(3!==e.length||117!==e[0]&&85!==e[0]||114!==e[1]&&82!==e[1]||108!==e[2]&&76!==e[2])}function consumeBadURL(e,n){for(;;){const o=n.source.codePointAt(n.cursor);if(void 0===o)return;if(41===o)return void n.advanceCodePoint();checkIfTwoCodePointsAreAValidEscape(n)?(n.advanceCodePoint(),consumeEscapedCodePoint(e,n)):n.advanceCodePoint();}}function consumeUrlToken(n,o){for(;isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();let t="";for(;;){if(void 0===o.source.codePointAt(o.cursor)){const r=[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected EOF"],r)),r}if(41===o.source.codePointAt(o.cursor))return o.advanceCodePoint(),[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];if(isWhitespace(o.source.codePointAt(o.cursor)??-1)){for(o.advanceCodePoint();isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();if(void 0===o.source.codePointAt(o.cursor)){const r=[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Consume as much whitespace as possible","Unexpected EOF"],r)),r}return 41===o.source.codePointAt(o.cursor)?(o.advanceCodePoint(),[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}]):(consumeBadURL(n,o),[exports.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0])}const s=o.source.codePointAt(o.cursor);if(34===s||39===s||40===s||(11===(r=s??-1)||127===r||0<=r&&r<=8||14<=r&&r<=31)){consumeBadURL(n,o);const t=[exports.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedCharacterInURL,o.representationStart,o.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"],t)),t}if(92===s){if(checkIfTwoCodePointsAreAValidEscape(o)){o.advanceCodePoint(),t+=String.fromCodePoint(consumeEscapedCodePoint(n,o));continue}consumeBadURL(n,o);const r=[exports.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],r)),r}0===o.source.codePointAt(o.cursor)||isSurrogate(o.source.codePointAt(o.cursor)??-1)?(t+=String.fromCodePoint(i),o.advanceCodePoint()):(t+=o.source[o.cursor],o.advanceCodePoint());}var r;}function consumeIdentLikeToken(e,n){const o=consumeIdentSequence(e,n);if(40!==n.source.codePointAt(n.cursor))return [exports.TokenType.Ident,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];if(checkIfCodePointsMatchURLIdent(o)){n.advanceCodePoint();let t=0;for(;;){const e=isWhitespace(n.source.codePointAt(n.cursor)??-1),r=isWhitespace(n.source.codePointAt(n.cursor+1)??-1);if(e&&r){t+=1,n.advanceCodePoint(1);continue}const s=e?n.source.codePointAt(n.cursor+1):n.source.codePointAt(n.cursor);if(34===s||39===s)return t>0&&n.unreadCodePoint(t),[exports.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];break}return consumeUrlToken(e,n)}return n.advanceCodePoint(),[exports.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}]}function checkIfThreeCodePointsWouldStartAUnicodeRange(e){return !(117!==e.source.codePointAt(e.cursor)&&85!==e.source.codePointAt(e.cursor)||e.source.codePointAt(e.cursor+1)!==s||63!==e.source.codePointAt(e.cursor+2)&&!isHexDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1))}function consumeUnicodeRangeToken(e,n){n.advanceCodePoint(2);const o=[],r=[];let s;for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&isHexDigitCodePoint(s);)o.push(s),n.advanceCodePoint();for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&63===s;)0===r.length&&r.push(...o),o.push(48),r.push(70),n.advanceCodePoint();if(!r.length&&n.source.codePointAt(n.cursor)===t&&isHexDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint();void 0!==(s=n.source.codePointAt(n.cursor))&&r.length<6&&isHexDigitCodePoint(s);)r.push(s),n.advanceCodePoint();if(!r.length){const e=parseInt(String.fromCodePoint(...o),16);return [exports.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:e,endOfRange:e}]}const i=parseInt(String.fromCodePoint(...o),16),c=parseInt(String.fromCodePoint(...r),16);return [exports.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:i,endOfRange:c}]}function tokenizer(n,i){const c=n.css.valueOf(),a=n.unicodeRangesAllowed??false,u=new Reader(c),d={onParseError:i?.onParseError??noop};return {nextToken:function nextToken(){u.resetRepresentation();const n=u.source.codePointAt(u.cursor);if(void 0===n)return [exports.TokenType.EOF,"",-1,-1,void 0];if(47===n&&checkIfTwoCodePointsStartAComment(u))return consumeComment(d,u);if(a&&(117===n||85===n)&&checkIfThreeCodePointsWouldStartAUnicodeRange(u))return consumeUnicodeRangeToken(0,u);if(isIdentStartCodePoint(n))return consumeIdentLikeToken(d,u);if(isDigitCodePoint(n))return consumeNumericToken(d,u);switch(n){case 44:return u.advanceCodePoint(),[exports.TokenType.Comma,",",u.representationStart,u.representationEnd,void 0];case 58:return u.advanceCodePoint(),[exports.TokenType.Colon,":",u.representationStart,u.representationEnd,void 0];case 59:return u.advanceCodePoint(),[exports.TokenType.Semicolon,";",u.representationStart,u.representationEnd,void 0];case 40:return u.advanceCodePoint(),[exports.TokenType.OpenParen,"(",u.representationStart,u.representationEnd,void 0];case 41:return u.advanceCodePoint(),[exports.TokenType.CloseParen,")",u.representationStart,u.representationEnd,void 0];case 91:return u.advanceCodePoint(),[exports.TokenType.OpenSquare,"[",u.representationStart,u.representationEnd,void 0];case 93:return u.advanceCodePoint(),[exports.TokenType.CloseSquare,"]",u.representationStart,u.representationEnd,void 0];case 123:return u.advanceCodePoint(),[exports.TokenType.OpenCurly,"{",u.representationStart,u.representationEnd,void 0];case 125:return u.advanceCodePoint(),[exports.TokenType.CloseCurly,"}",u.representationStart,u.representationEnd,void 0];case 39:case 34:return consumeStringToken(d,u);case 35:return consumeHashToken(d,u);case s:case 46:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):(u.advanceCodePoint(),[exports.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]);case r:case o:case 12:case 9:case 32:return consumeWhiteSpace(u);case t:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):checkIfThreeCodePointsWouldStartCDC(u)?(u.advanceCodePoint(3),[exports.TokenType.CDC,"--\x3e",u.representationStart,u.representationEnd,void 0]):checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)?consumeIdentLikeToken(d,u):(u.advanceCodePoint(),[exports.TokenType.Delim,"-",u.representationStart,u.representationEnd,{value:"-"}]);case 60:return checkIfFourCodePointsWouldStartCDO(u)?(u.advanceCodePoint(4),[exports.TokenType.CDO,"\x3c!--",u.representationStart,u.representationEnd,void 0]):(u.advanceCodePoint(),[exports.TokenType.Delim,"<",u.representationStart,u.representationEnd,{value:"<"}]);case 64:if(u.advanceCodePoint(),checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)){const e=consumeIdentSequence(d,u);return [exports.TokenType.AtKeyword,u.source.slice(u.representationStart,u.representationEnd+1),u.representationStart,u.representationEnd,{value:String.fromCodePoint(...e)}]}return [exports.TokenType.Delim,"@",u.representationStart,u.representationEnd,{value:"@"}];case 92:{if(checkIfTwoCodePointsAreAValidEscape(u))return consumeIdentLikeToken(d,u);u.advanceCodePoint();const n=[exports.TokenType.Delim,"\\",u.representationStart,u.representationEnd,{value:"\\"}];return d.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceAfterBackslash,u.representationStart,u.representationEnd,["4.3.1. Consume a token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],n)),n}}return u.advanceCodePoint(),[exports.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]},endOfFile:function endOfFile(){return void 0===u.source.codePointAt(u.cursor)}}}function noop(){}function serializeIdent(e){let n=0;if(0===e[0])e.splice(0,1,i),n=1;else if(e[0]===t&&e[1]===t)n=2;else if(e[0]===t&&e[1])n=2,isIdentStartCodePoint(e[1])||(n+=insertEscapedCodePoint(e,1,e[1]));else {if(e[0]===t&&!e[1])return [92,e[0]];isIdentStartCodePoint(e[0])?n=1:(n=1,n+=insertEscapedCodePoint(e,0,e[0]));}for(let o=n;o<e.length;o++)0!==e[o]?isIdentCodePoint(e[o])||(o+=insertEscapedCharacter(e,o,e[o])):(e.splice(o,1,i),o++);return e}function insertEscapedCharacter(e,n,o){return e.splice(n,1,92,o),1}function insertEscapedCodePoint(e,n,o){const t=o.toString(16),r=[];for(const e of t)r.push(e.codePointAt(0));return e.splice(n,1,92,...r,32),1+r.length}const d=Object.values(exports.TokenType);exports.ParseError=ParseError,exports.ParseErrorMessage=e,exports.ParseErrorWithToken=ParseErrorWithToken,exports.cloneTokens=function cloneTokens(e){return n?structuredClone(e):JSON.parse(JSON.stringify(e))},exports.isToken=function isToken(e){return !!Array.isArray(e)&&(!(e.length<4)&&(!!d.includes(e[0])&&("string"==typeof e[1]&&("number"==typeof e[2]&&"number"==typeof e[3]))))},exports.isTokenAtKeyword=function isTokenAtKeyword(e){return !!e&&e[0]===exports.TokenType.AtKeyword},exports.isTokenBadString=function isTokenBadString(e){return !!e&&e[0]===exports.TokenType.BadString},exports.isTokenBadURL=function isTokenBadURL(e){return !!e&&e[0]===exports.TokenType.BadURL},exports.isTokenCDC=function isTokenCDC(e){return !!e&&e[0]===exports.TokenType.CDC},exports.isTokenCDO=function isTokenCDO(e){return !!e&&e[0]===exports.TokenType.CDO},exports.isTokenCloseCurly=function isTokenCloseCurly(e){return !!e&&e[0]===exports.TokenType.CloseCurly},exports.isTokenCloseParen=function isTokenCloseParen(e){return !!e&&e[0]===exports.TokenType.CloseParen},exports.isTokenCloseSquare=function isTokenCloseSquare(e){return !!e&&e[0]===exports.TokenType.CloseSquare},exports.isTokenColon=function isTokenColon(e){return !!e&&e[0]===exports.TokenType.Colon},exports.isTokenComma=function isTokenComma(e){return !!e&&e[0]===exports.TokenType.Comma},exports.isTokenComment=function isTokenComment(e){return !!e&&e[0]===exports.TokenType.Comment},exports.isTokenDelim=function isTokenDelim(e){return !!e&&e[0]===exports.TokenType.Delim},exports.isTokenDimension=function isTokenDimension(e){return !!e&&e[0]===exports.TokenType.Dimension},exports.isTokenEOF=function isTokenEOF(e){return !!e&&e[0]===exports.TokenType.EOF},exports.isTokenFunction=function isTokenFunction(e){return !!e&&e[0]===exports.TokenType.Function},exports.isTokenHash=function isTokenHash(e){return !!e&&e[0]===exports.TokenType.Hash},exports.isTokenIdent=function isTokenIdent(e){return !!e&&e[0]===exports.TokenType.Ident},exports.isTokenNumber=function isTokenNumber(e){return !!e&&e[0]===exports.TokenType.Number},exports.isTokenNumeric=function isTokenNumeric(e){if(!e)return false;switch(e[0]){case exports.TokenType.Dimension:case exports.TokenType.Number:case exports.TokenType.Percentage:return true;default:return false}},exports.isTokenOpenCurly=function isTokenOpenCurly(e){return !!e&&e[0]===exports.TokenType.OpenCurly},exports.isTokenOpenParen=function isTokenOpenParen(e){return !!e&&e[0]===exports.TokenType.OpenParen},exports.isTokenOpenSquare=function isTokenOpenSquare(e){return !!e&&e[0]===exports.TokenType.OpenSquare},exports.isTokenPercentage=function isTokenPercentage(e){return !!e&&e[0]===exports.TokenType.Percentage},exports.isTokenSemicolon=function isTokenSemicolon(e){return !!e&&e[0]===exports.TokenType.Semicolon},exports.isTokenString=function isTokenString(e){return !!e&&e[0]===exports.TokenType.String},exports.isTokenURL=function isTokenURL(e){return !!e&&e[0]===exports.TokenType.URL},exports.isTokenUnicodeRange=function isTokenUnicodeRange(e){return !!e&&e[0]===exports.TokenType.UnicodeRange},exports.isTokenWhiteSpaceOrComment=function isTokenWhiteSpaceOrComment(e){if(!e)return false;switch(e[0]){case exports.TokenType.Whitespace:case exports.TokenType.Comment:return true;default:return false}},exports.isTokenWhitespace=function isTokenWhitespace(e){return !!e&&e[0]===exports.TokenType.Whitespace},exports.mirrorVariant=function mirrorVariant(e){switch(e[0]){case exports.TokenType.OpenParen:return [exports.TokenType.CloseParen,")",-1,-1,void 0];case exports.TokenType.CloseParen:return [exports.TokenType.OpenParen,"(",-1,-1,void 0];case exports.TokenType.OpenCurly:return [exports.TokenType.CloseCurly,"}",-1,-1,void 0];case exports.TokenType.CloseCurly:return [exports.TokenType.OpenCurly,"{",-1,-1,void 0];case exports.TokenType.OpenSquare:return [exports.TokenType.CloseSquare,"]",-1,-1,void 0];case exports.TokenType.CloseSquare:return [exports.TokenType.OpenSquare,"[",-1,-1,void 0];default:return null}},exports.mirrorVariantType=function mirrorVariantType(e){switch(e){case exports.TokenType.OpenParen:return exports.TokenType.CloseParen;case exports.TokenType.CloseParen:return exports.TokenType.OpenParen;case exports.TokenType.OpenCurly:return exports.TokenType.CloseCurly;case exports.TokenType.CloseCurly:return exports.TokenType.OpenCurly;case exports.TokenType.OpenSquare:return exports.TokenType.CloseSquare;case exports.TokenType.CloseSquare:return exports.TokenType.OpenSquare;default:return null}},exports.mutateIdent=function mutateIdent(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=String.fromCodePoint(...serializeIdent(o));e[1]=t,e[4].value=n;},exports.mutateUnit=function mutateUnit(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=serializeIdent(o);101===t[0]&&insertEscapedCodePoint(t,0,t[0]);const r=String.fromCodePoint(...t),s="+"===e[4].signCharacter?e[4].signCharacter:"",i=e[4].value.toString();e[1]=`${s}${i}${r}`,e[4].unit=n;},exports.stringify=function stringify(...e){let n="";for(let o=0;o<e.length;o++)n+=e[o][1];return n},exports.tokenize=function tokenize(e,n){const o=tokenizer(e,n),t=[];for(;!o.endOfFile();)t.push(o.nextToken());return t.push(o.nextToken()),t},exports.tokenizer=tokenizer;
1539
+ (function (exports$1) {
1540
+ class ParseError extends Error{sourceStart;sourceEnd;parserState;constructor(e,n,o,t){super(e),this.name="ParseError",this.sourceStart=n,this.sourceEnd=o,this.parserState=t;}}class ParseErrorWithToken extends ParseError{token;constructor(e,n,o,t,r){super(e,n,o,t),this.token=r;}}const e={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 "\\"'},n="undefined"!=typeof globalThis&&"structuredClone"in globalThis;const o=13,t=45,r=10,s=43,i=65533;function checkIfFourCodePointsWouldStartCDO(e){return 60===e.source.codePointAt(e.cursor)&&33===e.source.codePointAt(e.cursor+1)&&e.source.codePointAt(e.cursor+2)===t&&e.source.codePointAt(e.cursor+3)===t}function isDigitCodePoint(e){return e>=48&&e<=57}function isUppercaseLetterCodePoint(e){return e>=65&&e<=90}function isLowercaseLetterCodePoint(e){return e>=97&&e<=122}function isHexDigitCodePoint(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function isLetterCodePoint(e){return isLowercaseLetterCodePoint(e)||isUppercaseLetterCodePoint(e)}function isIdentStartCodePoint(e){return isLetterCodePoint(e)||isNonASCII_IdentCodePoint(e)||95===e}function isIdentCodePoint(e){return isIdentStartCodePoint(e)||isDigitCodePoint(e)||e===t}function isNonASCII_IdentCodePoint(e){return 183===e||8204===e||8205===e||8255===e||8256===e||8204===e||(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||(0===e||(!!isSurrogate(e)||e>=65536)))}function isNewLine(e){return e===r||e===o||12===e}function isWhitespace(e){return 32===e||e===r||9===e||e===o||12===e}function isSurrogate(e){return e>=55296&&e<=57343}function checkIfTwoCodePointsAreAValidEscape(e){return 92===e.source.codePointAt(e.cursor)&&!isNewLine(e.source.codePointAt(e.cursor+1)??-1)}function checkIfThreeCodePointsWouldStartAnIdentSequence(e,n){return n.source.codePointAt(n.cursor)===t?n.source.codePointAt(n.cursor+1)===t||(!!isIdentStartCodePoint(n.source.codePointAt(n.cursor+1)??-1)||92===n.source.codePointAt(n.cursor+1)&&!isNewLine(n.source.codePointAt(n.cursor+2)??-1)):!!isIdentStartCodePoint(n.source.codePointAt(n.cursor)??-1)||checkIfTwoCodePointsAreAValidEscape(n)}function checkIfThreeCodePointsWouldStartANumber(e){return e.source.codePointAt(e.cursor)===s||e.source.codePointAt(e.cursor)===t?!!isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1)||46===e.source.codePointAt(e.cursor+1)&&isDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1):46===e.source.codePointAt(e.cursor)?isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1):isDigitCodePoint(e.source.codePointAt(e.cursor)??-1)}function checkIfTwoCodePointsStartAComment(e){return 47===e.source.codePointAt(e.cursor)&&42===e.source.codePointAt(e.cursor+1)}function checkIfThreeCodePointsWouldStartCDC(e){return e.source.codePointAt(e.cursor)===t&&e.source.codePointAt(e.cursor+1)===t&&62===e.source.codePointAt(e.cursor+2)}var c,a,u;function consumeComment(n,o){for(o.advanceCodePoint(2);;){const t=o.readCodePoint();if(void 0===t){const t=[exports$1.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInComment,o.representationStart,o.representationEnd,["4.3.2. Consume comments","Unexpected EOF"],t)),t}if(42===t&&(void 0!==o.source.codePointAt(o.cursor)&&47===o.source.codePointAt(o.cursor))){o.advanceCodePoint();break}}return [exports$1.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0]}function consumeEscapedCodePoint(n,t){const s=t.readCodePoint();if(void 0===s)return n.onParseError(new ParseError(e.UnexpectedEOFInEscapedCodePoint,t.representationStart,t.representationEnd,["4.3.7. Consume an escaped code point","Unexpected EOF"])),i;if(isHexDigitCodePoint(s)){const e=[s];let n;for(;void 0!==(n=t.source.codePointAt(t.cursor))&&isHexDigitCodePoint(n)&&e.length<6;)e.push(n),t.advanceCodePoint();isWhitespace(t.source.codePointAt(t.cursor)??-1)&&(t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint());const c=parseInt(String.fromCodePoint(...e),16);return 0===c||isSurrogate(c)||c>1114111?i:c}return 0===s||isSurrogate(s)?i:s}function consumeIdentSequence(e,n){const o=[];for(;;){const t=n.source.codePointAt(n.cursor)??-1;if(0===t||isSurrogate(t))o.push(i),n.advanceCodePoint(+(t>65535)+1);else if(isIdentCodePoint(t))o.push(t),n.advanceCodePoint(+(t>65535)+1);else {if(!checkIfTwoCodePointsAreAValidEscape(n))return o;n.advanceCodePoint(),o.push(consumeEscapedCodePoint(e,n));}}}function consumeHashToken(e,n){n.advanceCodePoint();const o=n.source.codePointAt(n.cursor);if(void 0!==o&&(isIdentCodePoint(o)||checkIfTwoCodePointsAreAValidEscape(n))){let o=exports$1.HashType.Unrestricted;checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)&&(o=exports$1.HashType.ID);const t=consumeIdentSequence(e,n);return [exports$1.TokenType.Hash,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...t),type:o}]}return [exports$1.TokenType.Delim,"#",n.representationStart,n.representationEnd,{value:"#"}]}function consumeNumber(e,n){let o=exports$1.NumberType.Integer;for(n.source.codePointAt(n.cursor)!==s&&n.source.codePointAt(n.cursor)!==t||n.advanceCodePoint();isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(46===n.source.codePointAt(n.cursor)&&isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint(2),o=exports$1.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(101===n.source.codePointAt(n.cursor)||69===n.source.codePointAt(n.cursor)){if(isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))n.advanceCodePoint(2);else {if(n.source.codePointAt(n.cursor+1)!==t&&n.source.codePointAt(n.cursor+1)!==s||!isDigitCodePoint(n.source.codePointAt(n.cursor+2)??-1))return o;n.advanceCodePoint(3);}for(o=exports$1.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();}return o}function consumeNumericToken(e,n){let o;{const e=n.source.codePointAt(n.cursor);e===t?o="-":e===s&&(o="+");}const r=consumeNumber(0,n),i=parseFloat(n.source.slice(n.representationStart,n.representationEnd+1));if(checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)){const t=consumeIdentSequence(e,n);return [exports$1.TokenType.Dimension,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r,unit:String.fromCodePoint(...t)}]}return 37===n.source.codePointAt(n.cursor)?(n.advanceCodePoint(),[exports$1.TokenType.Percentage,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o}]):[exports$1.TokenType.Number,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r}]}function consumeWhiteSpace(e){for(;isWhitespace(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();return [exports$1.TokenType.Whitespace,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0]}exports$1.TokenType=void 0,(c=exports$1.TokenType||(exports$1.TokenType={})).Comment="comment",c.AtKeyword="at-keyword-token",c.BadString="bad-string-token",c.BadURL="bad-url-token",c.CDC="CDC-token",c.CDO="CDO-token",c.Colon="colon-token",c.Comma="comma-token",c.Delim="delim-token",c.Dimension="dimension-token",c.EOF="EOF-token",c.Function="function-token",c.Hash="hash-token",c.Ident="ident-token",c.Number="number-token",c.Percentage="percentage-token",c.Semicolon="semicolon-token",c.String="string-token",c.URL="url-token",c.Whitespace="whitespace-token",c.OpenParen="(-token",c.CloseParen=")-token",c.OpenSquare="[-token",c.CloseSquare="]-token",c.OpenCurly="{-token",c.CloseCurly="}-token",c.UnicodeRange="unicode-range-token",exports$1.NumberType=void 0,(a=exports$1.NumberType||(exports$1.NumberType={})).Integer="integer",a.Number="number",exports$1.HashType=void 0,(u=exports$1.HashType||(exports$1.HashType={})).Unrestricted="unrestricted",u.ID="id";class Reader{cursor=0;source="";representationStart=0;representationEnd=-1;constructor(e){this.source=e;}advanceCodePoint(e=1){this.cursor=this.cursor+e,this.representationEnd=this.cursor-1;}readCodePoint(){const e=this.source.codePointAt(this.cursor);if(void 0!==e)return this.cursor=this.cursor+1,this.representationEnd=this.cursor-1,e}unreadCodePoint(e=1){this.cursor=this.cursor-e,this.representationEnd=this.cursor-1;}resetRepresentation(){this.representationStart=this.cursor,this.representationEnd=-1;}}function consumeStringToken(n,t){let s="";const c=t.readCodePoint();for(;;){const a=t.readCodePoint();if(void 0===a){const o=[exports$1.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInString,t.representationStart,t.representationEnd,["4.3.5. Consume a string token","Unexpected EOF"],o)),o}if(isNewLine(a)){t.unreadCodePoint();const s=[exports$1.TokenType.BadString,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedNewLineInString,t.representationStart,t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r?t.representationEnd+2:t.representationEnd+1,["4.3.5. Consume a string token","Unexpected newline"],s)),s}if(a===c)return [exports$1.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];if(92!==a)0===a||isSurrogate(a)?s+=String.fromCodePoint(i):s+=String.fromCodePoint(a);else {if(void 0===t.source.codePointAt(t.cursor))continue;if(isNewLine(t.source.codePointAt(t.cursor)??-1)){t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint();continue}s+=String.fromCodePoint(consumeEscapedCodePoint(n,t));}}}function checkIfCodePointsMatchURLIdent(e){return !(3!==e.length||117!==e[0]&&85!==e[0]||114!==e[1]&&82!==e[1]||108!==e[2]&&76!==e[2])}function consumeBadURL(e,n){for(;;){const o=n.source.codePointAt(n.cursor);if(void 0===o)return;if(41===o)return void n.advanceCodePoint();checkIfTwoCodePointsAreAValidEscape(n)?(n.advanceCodePoint(),consumeEscapedCodePoint(e,n)):n.advanceCodePoint();}}function consumeUrlToken(n,o){for(;isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();let t="";for(;;){if(void 0===o.source.codePointAt(o.cursor)){const r=[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected EOF"],r)),r}if(41===o.source.codePointAt(o.cursor))return o.advanceCodePoint(),[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];if(isWhitespace(o.source.codePointAt(o.cursor)??-1)){for(o.advanceCodePoint();isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();if(void 0===o.source.codePointAt(o.cursor)){const r=[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Consume as much whitespace as possible","Unexpected EOF"],r)),r}return 41===o.source.codePointAt(o.cursor)?(o.advanceCodePoint(),[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}]):(consumeBadURL(n,o),[exports$1.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0])}const s=o.source.codePointAt(o.cursor);if(34===s||39===s||40===s||(11===(r=s??-1)||127===r||0<=r&&r<=8||14<=r&&r<=31)){consumeBadURL(n,o);const t=[exports$1.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedCharacterInURL,o.representationStart,o.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"],t)),t}if(92===s){if(checkIfTwoCodePointsAreAValidEscape(o)){o.advanceCodePoint(),t+=String.fromCodePoint(consumeEscapedCodePoint(n,o));continue}consumeBadURL(n,o);const r=[exports$1.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],r)),r}0===o.source.codePointAt(o.cursor)||isSurrogate(o.source.codePointAt(o.cursor)??-1)?(t+=String.fromCodePoint(i),o.advanceCodePoint()):(t+=o.source[o.cursor],o.advanceCodePoint());}var r;}function consumeIdentLikeToken(e,n){const o=consumeIdentSequence(e,n);if(40!==n.source.codePointAt(n.cursor))return [exports$1.TokenType.Ident,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];if(checkIfCodePointsMatchURLIdent(o)){n.advanceCodePoint();let t=0;for(;;){const e=isWhitespace(n.source.codePointAt(n.cursor)??-1),r=isWhitespace(n.source.codePointAt(n.cursor+1)??-1);if(e&&r){t+=1,n.advanceCodePoint(1);continue}const s=e?n.source.codePointAt(n.cursor+1):n.source.codePointAt(n.cursor);if(34===s||39===s)return t>0&&n.unreadCodePoint(t),[exports$1.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];break}return consumeUrlToken(e,n)}return n.advanceCodePoint(),[exports$1.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}]}function checkIfThreeCodePointsWouldStartAUnicodeRange(e){return !(117!==e.source.codePointAt(e.cursor)&&85!==e.source.codePointAt(e.cursor)||e.source.codePointAt(e.cursor+1)!==s||63!==e.source.codePointAt(e.cursor+2)&&!isHexDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1))}function consumeUnicodeRangeToken(e,n){n.advanceCodePoint(2);const o=[],r=[];let s;for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&isHexDigitCodePoint(s);)o.push(s),n.advanceCodePoint();for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&63===s;)0===r.length&&r.push(...o),o.push(48),r.push(70),n.advanceCodePoint();if(!r.length&&n.source.codePointAt(n.cursor)===t&&isHexDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint();void 0!==(s=n.source.codePointAt(n.cursor))&&r.length<6&&isHexDigitCodePoint(s);)r.push(s),n.advanceCodePoint();if(!r.length){const e=parseInt(String.fromCodePoint(...o),16);return [exports$1.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:e,endOfRange:e}]}const i=parseInt(String.fromCodePoint(...o),16),c=parseInt(String.fromCodePoint(...r),16);return [exports$1.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:i,endOfRange:c}]}function tokenizer(n,i){const c=n.css.valueOf(),a=n.unicodeRangesAllowed??false,u=new Reader(c),d={onParseError:i?.onParseError??noop};return {nextToken:function nextToken(){u.resetRepresentation();const n=u.source.codePointAt(u.cursor);if(void 0===n)return [exports$1.TokenType.EOF,"",-1,-1,void 0];if(47===n&&checkIfTwoCodePointsStartAComment(u))return consumeComment(d,u);if(a&&(117===n||85===n)&&checkIfThreeCodePointsWouldStartAUnicodeRange(u))return consumeUnicodeRangeToken(0,u);if(isIdentStartCodePoint(n))return consumeIdentLikeToken(d,u);if(isDigitCodePoint(n))return consumeNumericToken(d,u);switch(n){case 44:return u.advanceCodePoint(),[exports$1.TokenType.Comma,",",u.representationStart,u.representationEnd,void 0];case 58:return u.advanceCodePoint(),[exports$1.TokenType.Colon,":",u.representationStart,u.representationEnd,void 0];case 59:return u.advanceCodePoint(),[exports$1.TokenType.Semicolon,";",u.representationStart,u.representationEnd,void 0];case 40:return u.advanceCodePoint(),[exports$1.TokenType.OpenParen,"(",u.representationStart,u.representationEnd,void 0];case 41:return u.advanceCodePoint(),[exports$1.TokenType.CloseParen,")",u.representationStart,u.representationEnd,void 0];case 91:return u.advanceCodePoint(),[exports$1.TokenType.OpenSquare,"[",u.representationStart,u.representationEnd,void 0];case 93:return u.advanceCodePoint(),[exports$1.TokenType.CloseSquare,"]",u.representationStart,u.representationEnd,void 0];case 123:return u.advanceCodePoint(),[exports$1.TokenType.OpenCurly,"{",u.representationStart,u.representationEnd,void 0];case 125:return u.advanceCodePoint(),[exports$1.TokenType.CloseCurly,"}",u.representationStart,u.representationEnd,void 0];case 39:case 34:return consumeStringToken(d,u);case 35:return consumeHashToken(d,u);case s:case 46:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):(u.advanceCodePoint(),[exports$1.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]);case r:case o:case 12:case 9:case 32:return consumeWhiteSpace(u);case t:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):checkIfThreeCodePointsWouldStartCDC(u)?(u.advanceCodePoint(3),[exports$1.TokenType.CDC,"--\x3e",u.representationStart,u.representationEnd,void 0]):checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)?consumeIdentLikeToken(d,u):(u.advanceCodePoint(),[exports$1.TokenType.Delim,"-",u.representationStart,u.representationEnd,{value:"-"}]);case 60:return checkIfFourCodePointsWouldStartCDO(u)?(u.advanceCodePoint(4),[exports$1.TokenType.CDO,"\x3c!--",u.representationStart,u.representationEnd,void 0]):(u.advanceCodePoint(),[exports$1.TokenType.Delim,"<",u.representationStart,u.representationEnd,{value:"<"}]);case 64:if(u.advanceCodePoint(),checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)){const e=consumeIdentSequence(d,u);return [exports$1.TokenType.AtKeyword,u.source.slice(u.representationStart,u.representationEnd+1),u.representationStart,u.representationEnd,{value:String.fromCodePoint(...e)}]}return [exports$1.TokenType.Delim,"@",u.representationStart,u.representationEnd,{value:"@"}];case 92:{if(checkIfTwoCodePointsAreAValidEscape(u))return consumeIdentLikeToken(d,u);u.advanceCodePoint();const n=[exports$1.TokenType.Delim,"\\",u.representationStart,u.representationEnd,{value:"\\"}];return d.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceAfterBackslash,u.representationStart,u.representationEnd,["4.3.1. Consume a token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],n)),n}}return u.advanceCodePoint(),[exports$1.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]},endOfFile:function endOfFile(){return void 0===u.source.codePointAt(u.cursor)}}}function noop(){}function serializeIdent(e){let n=0;if(0===e[0])e.splice(0,1,i),n=1;else if(e[0]===t&&e[1]===t)n=2;else if(e[0]===t&&e[1])n=2,isIdentStartCodePoint(e[1])||(n+=insertEscapedCodePoint(e,1,e[1]));else {if(e[0]===t&&!e[1])return [92,e[0]];isIdentStartCodePoint(e[0])?n=1:(n=1,n+=insertEscapedCodePoint(e,0,e[0]));}for(let o=n;o<e.length;o++)0!==e[o]?isIdentCodePoint(e[o])||(o+=insertEscapedCharacter(e,o,e[o])):(e.splice(o,1,i),o++);return e}function insertEscapedCharacter(e,n,o){return e.splice(n,1,92,o),1}function insertEscapedCodePoint(e,n,o){const t=o.toString(16),r=[];for(const e of t)r.push(e.codePointAt(0));return e.splice(n,1,92,...r,32),1+r.length}const d=Object.values(exports$1.TokenType);exports$1.ParseError=ParseError,exports$1.ParseErrorMessage=e,exports$1.ParseErrorWithToken=ParseErrorWithToken,exports$1.cloneTokens=function cloneTokens(e){return n?structuredClone(e):JSON.parse(JSON.stringify(e))},exports$1.isToken=function isToken(e){return !!Array.isArray(e)&&(!(e.length<4)&&(!!d.includes(e[0])&&("string"==typeof e[1]&&("number"==typeof e[2]&&"number"==typeof e[3]))))},exports$1.isTokenAtKeyword=function isTokenAtKeyword(e){return !!e&&e[0]===exports$1.TokenType.AtKeyword},exports$1.isTokenBadString=function isTokenBadString(e){return !!e&&e[0]===exports$1.TokenType.BadString},exports$1.isTokenBadURL=function isTokenBadURL(e){return !!e&&e[0]===exports$1.TokenType.BadURL},exports$1.isTokenCDC=function isTokenCDC(e){return !!e&&e[0]===exports$1.TokenType.CDC},exports$1.isTokenCDO=function isTokenCDO(e){return !!e&&e[0]===exports$1.TokenType.CDO},exports$1.isTokenCloseCurly=function isTokenCloseCurly(e){return !!e&&e[0]===exports$1.TokenType.CloseCurly},exports$1.isTokenCloseParen=function isTokenCloseParen(e){return !!e&&e[0]===exports$1.TokenType.CloseParen},exports$1.isTokenCloseSquare=function isTokenCloseSquare(e){return !!e&&e[0]===exports$1.TokenType.CloseSquare},exports$1.isTokenColon=function isTokenColon(e){return !!e&&e[0]===exports$1.TokenType.Colon},exports$1.isTokenComma=function isTokenComma(e){return !!e&&e[0]===exports$1.TokenType.Comma},exports$1.isTokenComment=function isTokenComment(e){return !!e&&e[0]===exports$1.TokenType.Comment},exports$1.isTokenDelim=function isTokenDelim(e){return !!e&&e[0]===exports$1.TokenType.Delim},exports$1.isTokenDimension=function isTokenDimension(e){return !!e&&e[0]===exports$1.TokenType.Dimension},exports$1.isTokenEOF=function isTokenEOF(e){return !!e&&e[0]===exports$1.TokenType.EOF},exports$1.isTokenFunction=function isTokenFunction(e){return !!e&&e[0]===exports$1.TokenType.Function},exports$1.isTokenHash=function isTokenHash(e){return !!e&&e[0]===exports$1.TokenType.Hash},exports$1.isTokenIdent=function isTokenIdent(e){return !!e&&e[0]===exports$1.TokenType.Ident},exports$1.isTokenNumber=function isTokenNumber(e){return !!e&&e[0]===exports$1.TokenType.Number},exports$1.isTokenNumeric=function isTokenNumeric(e){if(!e)return false;switch(e[0]){case exports$1.TokenType.Dimension:case exports$1.TokenType.Number:case exports$1.TokenType.Percentage:return true;default:return false}},exports$1.isTokenOpenCurly=function isTokenOpenCurly(e){return !!e&&e[0]===exports$1.TokenType.OpenCurly},exports$1.isTokenOpenParen=function isTokenOpenParen(e){return !!e&&e[0]===exports$1.TokenType.OpenParen},exports$1.isTokenOpenSquare=function isTokenOpenSquare(e){return !!e&&e[0]===exports$1.TokenType.OpenSquare},exports$1.isTokenPercentage=function isTokenPercentage(e){return !!e&&e[0]===exports$1.TokenType.Percentage},exports$1.isTokenSemicolon=function isTokenSemicolon(e){return !!e&&e[0]===exports$1.TokenType.Semicolon},exports$1.isTokenString=function isTokenString(e){return !!e&&e[0]===exports$1.TokenType.String},exports$1.isTokenURL=function isTokenURL(e){return !!e&&e[0]===exports$1.TokenType.URL},exports$1.isTokenUnicodeRange=function isTokenUnicodeRange(e){return !!e&&e[0]===exports$1.TokenType.UnicodeRange},exports$1.isTokenWhiteSpaceOrComment=function isTokenWhiteSpaceOrComment(e){if(!e)return false;switch(e[0]){case exports$1.TokenType.Whitespace:case exports$1.TokenType.Comment:return true;default:return false}},exports$1.isTokenWhitespace=function isTokenWhitespace(e){return !!e&&e[0]===exports$1.TokenType.Whitespace},exports$1.mirrorVariant=function mirrorVariant(e){switch(e[0]){case exports$1.TokenType.OpenParen:return [exports$1.TokenType.CloseParen,")",-1,-1,void 0];case exports$1.TokenType.CloseParen:return [exports$1.TokenType.OpenParen,"(",-1,-1,void 0];case exports$1.TokenType.OpenCurly:return [exports$1.TokenType.CloseCurly,"}",-1,-1,void 0];case exports$1.TokenType.CloseCurly:return [exports$1.TokenType.OpenCurly,"{",-1,-1,void 0];case exports$1.TokenType.OpenSquare:return [exports$1.TokenType.CloseSquare,"]",-1,-1,void 0];case exports$1.TokenType.CloseSquare:return [exports$1.TokenType.OpenSquare,"[",-1,-1,void 0];default:return null}},exports$1.mirrorVariantType=function mirrorVariantType(e){switch(e){case exports$1.TokenType.OpenParen:return exports$1.TokenType.CloseParen;case exports$1.TokenType.CloseParen:return exports$1.TokenType.OpenParen;case exports$1.TokenType.OpenCurly:return exports$1.TokenType.CloseCurly;case exports$1.TokenType.CloseCurly:return exports$1.TokenType.OpenCurly;case exports$1.TokenType.OpenSquare:return exports$1.TokenType.CloseSquare;case exports$1.TokenType.CloseSquare:return exports$1.TokenType.OpenSquare;default:return null}},exports$1.mutateIdent=function mutateIdent(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=String.fromCodePoint(...serializeIdent(o));e[1]=t,e[4].value=n;},exports$1.mutateUnit=function mutateUnit(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=serializeIdent(o);101===t[0]&&insertEscapedCodePoint(t,0,t[0]);const r=String.fromCodePoint(...t),s="+"===e[4].signCharacter?e[4].signCharacter:"",i=e[4].value.toString();e[1]=`${s}${i}${r}`,e[4].unit=n;},exports$1.stringify=function stringify(...e){let n="";for(let o=0;o<e.length;o++)n+=e[o][1];return n},exports$1.tokenize=function tokenize(e,n){const o=tokenizer(e,n),t=[];for(;!o.endOfFile();)t.push(o.nextToken());return t.push(o.nextToken()),t},exports$1.tokenizer=tokenizer;
1474
1541
  } (dist));
1475
1542
  return dist;
1476
1543
  }
@@ -2746,36 +2813,36 @@ var hasRequiredProperties;
2746
2813
  function requireProperties () {
2747
2814
  if (hasRequiredProperties) return properties;
2748
2815
  hasRequiredProperties = 1;
2749
- (function (exports) {
2816
+ (function (exports$1) {
2750
2817
 
2751
- Object.defineProperty(exports, "__esModule", {
2818
+ Object.defineProperty(exports$1, "__esModule", {
2752
2819
  value: true
2753
2820
  });
2754
- Object.defineProperty(exports, "BorderRadiusIndividual", {
2821
+ Object.defineProperty(exports$1, "BorderRadiusIndividual", {
2755
2822
  enumerable: true,
2756
2823
  get: function () {
2757
2824
  return _borderRadius.BorderRadiusIndividual;
2758
2825
  }
2759
2826
  });
2760
- Object.defineProperty(exports, "BorderRadiusShorthand", {
2827
+ Object.defineProperty(exports$1, "BorderRadiusShorthand", {
2761
2828
  enumerable: true,
2762
2829
  get: function () {
2763
2830
  return _borderRadius.BorderRadiusShorthand;
2764
2831
  }
2765
2832
  });
2766
- Object.defineProperty(exports, "BoxShadow", {
2833
+ Object.defineProperty(exports$1, "BoxShadow", {
2767
2834
  enumerable: true,
2768
2835
  get: function () {
2769
2836
  return _boxShadow.BoxShadow;
2770
2837
  }
2771
2838
  });
2772
- Object.defineProperty(exports, "BoxShadowList", {
2839
+ Object.defineProperty(exports$1, "BoxShadowList", {
2773
2840
  enumerable: true,
2774
2841
  get: function () {
2775
2842
  return _boxShadow.BoxShadowList;
2776
2843
  }
2777
2844
  });
2778
- Object.defineProperty(exports, "Transform", {
2845
+ Object.defineProperty(exports$1, "Transform", {
2779
2846
  enumerable: true,
2780
2847
  get: function () {
2781
2848
  return _transform.Transform;
@@ -3400,22 +3467,22 @@ var hasRequiredLib$1;
3400
3467
  function requireLib$1 () {
3401
3468
  if (hasRequiredLib$1) return lib$1;
3402
3469
  hasRequiredLib$1 = 1;
3403
- (function (exports) {
3470
+ (function (exports$1) {
3404
3471
 
3405
- Object.defineProperty(exports, "__esModule", {
3472
+ Object.defineProperty(exports$1, "__esModule", {
3406
3473
  value: true
3407
3474
  });
3408
- Object.defineProperty(exports, "lastMediaQueryWinsTransform", {
3475
+ Object.defineProperty(exports$1, "lastMediaQueryWinsTransform", {
3409
3476
  enumerable: true,
3410
3477
  get: function () {
3411
3478
  return _mediaQueryTransform.lastMediaQueryWinsTransform;
3412
3479
  }
3413
3480
  });
3414
- exports.tokenParser = exports.properties = void 0;
3481
+ exports$1.tokenParser = exports$1.properties = void 0;
3415
3482
  var _tokenParser = _interopRequireWildcard(requireTokenParser());
3416
- exports.tokenParser = _tokenParser;
3483
+ exports$1.tokenParser = _tokenParser;
3417
3484
  var _properties = _interopRequireWildcard(requireProperties());
3418
- exports.properties = _properties;
3485
+ exports$1.properties = _properties;
3419
3486
  var _mediaQueryTransform = requireMediaQueryTransform();
3420
3487
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
3421
3488
  } (lib$1));
@@ -3436,7 +3503,6 @@ const ILLEGAL_NESTED_PSEUDO = "Pseudo objects can't be nested more than one leve
3436
3503
  const ILLEGAL_PROP_VALUE = 'A style value can only contain an array, string or number.';
3437
3504
  const ILLEGAL_PROP_ARRAY_VALUE = 'A style array value can only contain strings or numbers.';
3438
3505
  const ILLEGAL_NAMESPACE_VALUE = 'A StyleX namespace must be an object.';
3439
- const INVALID_CONST_KEY = 'Keys in defineConsts() cannot start with "--".';
3440
3506
  const INVALID_PSEUDO = 'Invalid pseudo selector, not on the whitelist.';
3441
3507
  const INVALID_PSEUDO_OR_AT_RULE = 'Invalid pseudo or at-rule.';
3442
3508
  const INVALID_MEDIA_QUERY_SYNTAX = 'Invalid media query syntax.';
@@ -3459,7 +3525,6 @@ var m = /*#__PURE__*/Object.freeze({
3459
3525
  ILLEGAL_NESTED_PSEUDO: ILLEGAL_NESTED_PSEUDO,
3460
3526
  ILLEGAL_PROP_ARRAY_VALUE: ILLEGAL_PROP_ARRAY_VALUE,
3461
3527
  ILLEGAL_PROP_VALUE: ILLEGAL_PROP_VALUE,
3462
- INVALID_CONST_KEY: INVALID_CONST_KEY,
3463
3528
  INVALID_MEDIA_QUERY_SYNTAX: INVALID_MEDIA_QUERY_SYNTAX,
3464
3529
  INVALID_PSEUDO: INVALID_PSEUDO,
3465
3530
  INVALID_PSEUDO_OR_AT_RULE: INVALID_PSEUDO_OR_AT_RULE,
@@ -3598,7 +3663,10 @@ const angles = ['deg', 'grad', 'turn', 'rad'];
3598
3663
  const timings = ['ms', 's'];
3599
3664
  const fraction = 'fr';
3600
3665
  const percentage$1 = '%';
3601
- function normalizeZeroDimensions(ast, _) {
3666
+ function normalizeZeroDimensions(ast, key) {
3667
+ if (typeof key === 'string' && key.startsWith('--')) {
3668
+ return ast;
3669
+ }
3602
3670
  let endFunction = 0;
3603
3671
  ast.walk(node => {
3604
3672
  if (node.type === 'function' && !endFunction) {
@@ -4043,6 +4111,15 @@ function requirePropertyPriorities () {
4043
4111
  longHandPhysical.add('border-top-right-radius');
4044
4112
  longHandPhysical.add('border-bottom-left-radius');
4045
4113
  longHandPhysical.add('border-bottom-right-radius');
4114
+ shorthandsOfLonghands.add('corner-shape');
4115
+ longHandLogical.add('corner-start-start-shape');
4116
+ longHandLogical.add('corner-start-end-shape');
4117
+ longHandLogical.add('corner-end-start-shape');
4118
+ longHandLogical.add('corner-end-end-shape');
4119
+ longHandPhysical.add('corner-top-left-shape');
4120
+ longHandPhysical.add('corner-top-right-shape');
4121
+ longHandPhysical.add('corner-bottom-left-shape');
4122
+ longHandPhysical.add('corner-bottom-right-shape');
4046
4123
  longHandLogical.add('box-shadow');
4047
4124
  longHandLogical.add('accent-color');
4048
4125
  longHandLogical.add('appearance');
@@ -4448,6 +4525,16 @@ function requirePropertyPriorities () {
4448
4525
  SIBLING_AFTER: /^:where\(:has\(~\s\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\)\)$/,
4449
4526
  ANY_SIBLING: /^:where\(\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\s+~\s+\*,\s+:has\(~\s\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\)\)$/
4450
4527
  };
4528
+ const PSEUDO_PART_REGEX = /::[a-zA-Z-]+|:[a-zA-Z-]+(?:\([^)]*\))?/g;
4529
+ function getCompoundPseudoPriority(key) {
4530
+ const parts = key.match(PSEUDO_PART_REGEX);
4531
+ if (!parts || parts.length <= 1 || parts.some(p => p.includes('('))) return;
4532
+ let total = 0;
4533
+ for (const part of parts) {
4534
+ total += part.startsWith('::') ? PSEUDO_ELEMENT_PRIORITY : PSEUDO_CLASS_PRIORITIES[part] ?? 40;
4535
+ }
4536
+ return total;
4537
+ }
4451
4538
  function getAtRulePriority(key) {
4452
4539
  if (key.startsWith('--')) {
4453
4540
  return 1;
@@ -4488,7 +4575,7 @@ function requirePropertyPriorities () {
4488
4575
  return 40 + pseudoBase(siblingAfterMatch[1]);
4489
4576
  }
4490
4577
  if (key.startsWith(':')) {
4491
- const prop = key.startsWith(':') && key.includes('(') ? key.slice(0, key.indexOf('(')) : key;
4578
+ const prop = key.split('(')[0];
4492
4579
  return PSEUDO_CLASS_PRIORITIES[prop] ?? 40;
4493
4580
  }
4494
4581
  }
@@ -4509,6 +4596,8 @@ function requirePropertyPriorities () {
4509
4596
  function getPriority(key) {
4510
4597
  const atRulePriority = getAtRulePriority(key);
4511
4598
  if (atRulePriority) return atRulePriority;
4599
+ const compoundPriority = getCompoundPseudoPriority(key);
4600
+ if (compoundPriority != null) return compoundPriority;
4512
4601
  const pseudoElementPriority = getPseudoElementPriority(key);
4513
4602
  if (pseudoElementPriority) return pseudoElementPriority;
4514
4603
  const pseudoClassPriority = getPseudoClassPriority(key);
@@ -4719,7 +4808,7 @@ class PreRule {
4719
4808
  this.value = value;
4720
4809
  }
4721
4810
  get pseudos() {
4722
- const unsortedPseudos = this.keyPath.filter(key => key.startsWith(':'));
4811
+ const unsortedPseudos = this.keyPath.filter(key => key.startsWith(':') || key.startsWith('['));
4723
4812
  return sortPseudos(unsortedPseudos);
4724
4813
  }
4725
4814
  get atRules() {
@@ -4824,7 +4913,7 @@ function _flattenRawStyleObject(style, keyPath, options) {
4824
4913
  });
4825
4914
  continue;
4826
4915
  }
4827
- if (typeof value === 'object' && !key.startsWith(':') && !key.startsWith('@')) {
4916
+ if (typeof value === 'object' && !key.startsWith(':') && !key.startsWith('@') && !key.startsWith('[')) {
4828
4917
  const equivalentPairs = {};
4829
4918
  for (const condition in value) {
4830
4919
  const innerValue = value[condition];
@@ -4850,7 +4939,7 @@ function _flattenRawStyleObject(style, keyPath, options) {
4850
4939
  flattened.push([property, PreRuleSet.create(rules)]);
4851
4940
  }
4852
4941
  }
4853
- if (typeof value === 'object' && (key.startsWith(':') || key.startsWith('@'))) {
4942
+ if (typeof value === 'object' && (key.startsWith(':') || key.startsWith('@') || key.startsWith('['))) {
4854
4943
  const pairs = _flattenRawStyleObject(value, [...keyPath, _key], options);
4855
4944
  for (const [property, preRule] of pairs) {
4856
4945
  flattened.push([key + '_' + property, preRule]);
@@ -4880,7 +4969,7 @@ function validateNamespace(namespace, conditions = []) {
4880
4969
  continue;
4881
4970
  }
4882
4971
  if (isPlainObject(val)) {
4883
- if (key.startsWith('@') || key.startsWith(':')) {
4972
+ if (key.startsWith('@') || key.startsWith(':') || key.startsWith('[')) {
4884
4973
  if (conditions.includes(key)) {
4885
4974
  throw new Error(DUPLICATE_CONDITIONAL);
4886
4975
  }
@@ -4896,7 +4985,7 @@ function validateNamespace(namespace, conditions = []) {
4896
4985
  function validateConditionalStyles(val, conditions = []) {
4897
4986
  for (const key in val) {
4898
4987
  const v = val[key];
4899
- if (!(key.startsWith('@') || key.startsWith(':') || key.startsWith('var(--') || key === 'default')) {
4988
+ if (!(key.startsWith('@') || key.startsWith(':') || key.startsWith('[') || key.startsWith('var(--') || key === 'default')) {
4900
4989
  throw new Error(INVALID_PSEUDO_OR_AT_RULE);
4901
4990
  }
4902
4991
  if (conditions.includes(key)) {
@@ -5282,11 +5371,8 @@ function styleXDefineConsts(constants, options) {
5282
5371
  const jsOutput = {};
5283
5372
  const injectableStyles = {};
5284
5373
  for (const [key, value] of Object.entries(constants)) {
5285
- if (key.startsWith('--')) {
5286
- throw new Error(INVALID_CONST_KEY);
5287
- }
5288
5374
  const varSafeKey = (key[0] >= '0' && key[0] <= '9' ? `_${key}` : key).replace(/[^a-zA-Z0-9]/g, '_');
5289
- const constKey = debug && enableDebugClassNames ? `${varSafeKey}-${classNamePrefix}${hash(`${exportId}.${key}`)}` : `${classNamePrefix}${hash(`${exportId}.${key}`)}`;
5375
+ const constKey = key.startsWith('--') ? key.slice(2) : debug && enableDebugClassNames ? `${varSafeKey}-${classNamePrefix}${hash(`${exportId}.${key}`)}` : `${classNamePrefix}${hash(`${exportId}.${key}`)}`;
5290
5376
  jsOutput[key] = value;
5291
5377
  injectableStyles[constKey] = {
5292
5378
  constKey,
@@ -5458,12 +5544,15 @@ function getDefaultMarkerClassName(options = defaultOptions) {
5458
5544
  return `${prefix}default-marker`;
5459
5545
  }
5460
5546
  function validatePseudoSelector(pseudo) {
5461
- if (!pseudo.startsWith(':')) {
5462
- throw new Error('Pseudo selector must start with ":"');
5547
+ if (!(pseudo.startsWith(':') || pseudo.startsWith('['))) {
5548
+ throw new Error('Pseudo selector must start with ":" or "["');
5463
5549
  }
5464
5550
  if (pseudo.startsWith('::')) {
5465
5551
  throw new Error('Pseudo selector cannot start with "::" (pseudo-elements are not supported)');
5466
5552
  }
5553
+ if (pseudo.startsWith('[') && !pseudo.endsWith(']')) {
5554
+ throw new Error('Attribute selector must end with "]"');
5555
+ }
5467
5556
  }
5468
5557
  function ancestor(pseudo, options = defaultOptions) {
5469
5558
  validatePseudoSelector(pseudo);
@@ -6497,6 +6586,18 @@ function isSafeToSkipNullCheck(expr) {
6497
6586
  }
6498
6587
  return false;
6499
6588
  }
6589
+ function hasExplicitNullishFallback(expr) {
6590
+ if (t__namespace.isNullLiteral(expr)) return true;
6591
+ if (t__namespace.isIdentifier(expr) && expr.name === 'undefined') return true;
6592
+ if (t__namespace.isUnaryExpression(expr) && expr.operator === 'void') return true;
6593
+ if (t__namespace.isConditionalExpression(expr)) {
6594
+ return hasExplicitNullishFallback(expr.consequent) || hasExplicitNullishFallback(expr.alternate);
6595
+ }
6596
+ if (t__namespace.isLogicalExpression(expr)) {
6597
+ return hasExplicitNullishFallback(expr.left) || hasExplicitNullishFallback(expr.right);
6598
+ }
6599
+ return false;
6600
+ }
6500
6601
  function transformStyleXCreate(path, state) {
6501
6602
  const {
6502
6603
  node
@@ -6565,6 +6666,7 @@ function transformStyleXCreate(path, state) {
6565
6666
  when: stylexWhen
6566
6667
  };
6567
6668
  });
6669
+ state.applyStylexEnv(identifiers);
6568
6670
  const {
6569
6671
  confident,
6570
6672
  value,
@@ -6592,7 +6694,7 @@ function transformStyleXCreate(path, state) {
6592
6694
  const isPseudoElement = path.some(p => p.startsWith('::'));
6593
6695
  injectedInheritStyles[variableName] = {
6594
6696
  priority: 0,
6595
- ltr: `@property ${variableName} { syntax: "*";${isPseudoElement ? '' : ' inherits: false;'}}`,
6697
+ ltr: `@property ${variableName} { syntax: "*"; inherits: ${isPseudoElement ? 'true' : 'false'};}`,
6596
6698
  rtl: null
6597
6699
  };
6598
6700
  });
@@ -6641,14 +6743,21 @@ function transformStyleXCreate(path, state) {
6641
6743
  for (const [className, classPaths] of Object.entries(classPathsPerNamespace[key])) {
6642
6744
  origClassPaths[className] = classPaths.join('_');
6643
6745
  }
6644
- let dynamicStyles = Object.entries(inlineStyles).map(([_key, v]) => ({
6746
+ let dynamicStyles = Object.entries(inlineStyles).map(([varName, v]) => ({
6645
6747
  expression: v.originalExpression,
6646
6748
  key: v.path.slice(0, v.path.findIndex(p => !p.startsWith(':') && !p.startsWith('@')) + 1).join('_'),
6749
+ varName,
6647
6750
  path: v.path.join('_')
6648
6751
  }));
6649
6752
  if (state.options.styleResolution === 'legacy-expand-shorthands') {
6650
6753
  dynamicStyles = legacyExpandShorthands(dynamicStyles);
6651
6754
  }
6755
+ const nullishVarExpressions = new Map();
6756
+ dynamicStyles.forEach(style => {
6757
+ if (hasExplicitNullishFallback(style.expression)) {
6758
+ nullishVarExpressions.set(style.varName, style.expression);
6759
+ }
6760
+ });
6652
6761
  if (t__namespace.isObjectExpression(prop.value)) {
6653
6762
  const value = prop.value;
6654
6763
  let cssTagValue = t__namespace.booleanLiteral(true);
@@ -6672,9 +6781,23 @@ function transformStyleXCreate(path, state) {
6672
6781
  let isStatic = true;
6673
6782
  const exprList = [];
6674
6783
  classList.forEach((cls, index) => {
6675
- const expr = dynamicStyles.find(({
6784
+ let expr = dynamicStyles.find(({
6676
6785
  path
6677
6786
  }) => origClassPaths[cls] === path)?.expression;
6787
+ if (expr == null && nullishVarExpressions.size > 0) {
6788
+ const injectedStyle = injectedStyles[cls];
6789
+ const rule = injectedStyle != null ? typeof injectedStyle.ltr === 'string' ? injectedStyle.ltr : typeof injectedStyle.rtl === 'string' ? injectedStyle.rtl : null : null;
6790
+ if (rule != null) {
6791
+ const matches = rule.matchAll(/var\((--x-[^,)]+)[^)]*\)/g);
6792
+ for (const match of matches) {
6793
+ const varExpr = nullishVarExpressions.get(match[1]);
6794
+ if (varExpr != null) {
6795
+ expr = varExpr;
6796
+ break;
6797
+ }
6798
+ }
6799
+ }
6800
+ }
6678
6801
  const isLast = index === classList.length - 1;
6679
6802
  const clsWithSpace = isLast ? cls : cls + ' ';
6680
6803
  if (expr && !isSafeToSkipNullCheck(expr)) {
@@ -6835,6 +6958,7 @@ function transformStyleXCreateTheme(callExpressionPath, state) {
6835
6958
  types: stylexTypes
6836
6959
  };
6837
6960
  });
6961
+ state.applyStylexEnv(identifiers);
6838
6962
  const {
6839
6963
  confident: confident2,
6840
6964
  value: overrides
@@ -6949,6 +7073,7 @@ function transformStyleXDefineVars(callExpressionPath, state) {
6949
7073
  types: stylexTypes
6950
7074
  };
6951
7075
  });
7076
+ state.applyStylexEnv(identifiers);
6952
7077
  const {
6953
7078
  confident,
6954
7079
  value
@@ -7011,10 +7136,16 @@ function transformStyleXDefineConsts(callExpressionPath, state) {
7011
7136
  const varId = variableDeclaratorNode.id;
7012
7137
  const args = callExpressionPath.get('arguments');
7013
7138
  const firstArg = args[0];
7139
+ const evaluatePathFnConfig = {
7140
+ identifiers: {},
7141
+ memberExpressions: {},
7142
+ disableImports: true
7143
+ };
7144
+ state.applyStylexEnv(evaluatePathFnConfig.identifiers);
7014
7145
  const {
7015
7146
  confident,
7016
7147
  value
7017
- } = evaluate(firstArg, state);
7148
+ } = evaluate(firstArg, state, evaluatePathFnConfig);
7018
7149
  if (!confident) {
7019
7150
  throw callExpressionPath.buildCodeFrameError(messages.nonStaticValue('defineConsts'), SyntaxError);
7020
7151
  }
@@ -7096,6 +7227,7 @@ function transformStyleXKeyframes(path, state) {
7096
7227
  fn: firstThatWorks
7097
7228
  };
7098
7229
  });
7230
+ state.applyStylexEnv(identifiers);
7099
7231
  const {
7100
7232
  confident,
7101
7233
  value
@@ -7167,6 +7299,7 @@ function transformStyleXPositionTry(path, state) {
7167
7299
  fn: firstThatWorks
7168
7300
  };
7169
7301
  });
7302
+ state.applyStylexEnv(identifiers);
7170
7303
  const {
7171
7304
  confident,
7172
7305
  value
@@ -7221,6 +7354,12 @@ function transformStyleXMerge(path, state) {
7221
7354
  if (node == null || node.callee.type !== 'Identifier' || !state.stylexImport.has(node.callee.name)) {
7222
7355
  return;
7223
7356
  }
7357
+ const evaluatePathFnConfig = {
7358
+ identifiers: {},
7359
+ memberExpressions: {},
7360
+ disableImports: true
7361
+ };
7362
+ state.applyStylexEnv(evaluatePathFnConfig.identifiers);
7224
7363
  let bailOut = false;
7225
7364
  let conditional = 0;
7226
7365
  let currentIndex = -1;
@@ -7327,7 +7466,7 @@ function transformStyleXMerge(path, state) {
7327
7466
  const {
7328
7467
  confident,
7329
7468
  value: styleValue
7330
- } = evaluate(path, state);
7469
+ } = evaluate(path, state, evaluatePathFnConfig);
7331
7470
  if (!confident || styleValue == null) {
7332
7471
  nonNullProps = true;
7333
7472
  styleNonNullProps = true;
@@ -7463,6 +7602,7 @@ function transformStylexProps(path, state) {
7463
7602
  }
7464
7603
  };
7465
7604
  });
7605
+ state.applyStylexEnv(identifiers);
7466
7606
  const evaluatePathFnConfig = {
7467
7607
  identifiers,
7468
7608
  memberExpressions,
@@ -7788,6 +7928,7 @@ function transformStyleXViewTransitionClass(path, state) {
7788
7928
  fn: keyframes$1
7789
7929
  };
7790
7930
  });
7931
+ state.applyStylexEnv(identifiers);
7791
7932
  const {
7792
7933
  confident,
7793
7934
  value