@stylexjs/babel-plugin 0.14.3 → 0.15.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
@@ -35,127 +35,98 @@ const defaultMessage = expected => (value, name) => name ? `Expected (${name}) t
35
35
  const defaultUnionMessage = expected => (value, name) => name ? `Expected (${name}) to be ${expected}` : expected;
36
36
  const defaultObjectMessage = expected => (value, name) => name ? `Expected (${name}) to be ${expected} but:` : expected;
37
37
  const indent = str => str.split('\n').filter(line => !line.trim().startsWith('But got:')).map(line => line.includes(', but got') ? line.replace(/, but got.+$/, '') : line).map(line => line.trim()[0] === '-' ? line : `- ${line}`).map(line => `\n\t${line}`).join('');
38
- const string = function () {
39
- let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultMessage('a string');
40
- return (value, name) => {
41
- if (typeof value !== 'string') {
42
- return new Error(message(value, name));
43
- }
44
- return value;
45
- };
38
+ const string = (message = defaultMessage('a string')) => (value, name) => {
39
+ if (typeof value !== 'string') {
40
+ return new Error(message(value, name));
41
+ }
42
+ return value;
46
43
  };
47
- const nullish = function () {
48
- let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultMessage('`null` or `undefined`');
49
- return (value, name) => value == null ? value : new Error(message(value, name));
44
+ const nullish = (message = defaultMessage('`null` or `undefined`')) => (value, name) => value == null ? value : new Error(message(value, name));
45
+ const boolean = (message = defaultMessage('a boolean')) => (value, name) => {
46
+ if (typeof value !== 'boolean') {
47
+ return new Error(message(value, name));
48
+ }
49
+ return value;
50
50
  };
51
- const boolean = function () {
52
- let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultMessage('a boolean');
53
- return (value, name) => {
54
- if (typeof value !== 'boolean') {
55
- return new Error(message(value, name));
56
- }
57
- return value;
58
- };
51
+ const literal = (expected, message = defaultMessage(`the literal ${JSON.stringify(expected)}`)) => (value, name) => {
52
+ if (value === expected) {
53
+ return expected;
54
+ }
55
+ return new Error(message(value, name));
59
56
  };
60
- const literal = function (expected) {
61
- let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultMessage(`the literal ${JSON.stringify(expected)}`);
62
- return (value, name) => {
63
- if (value === expected) {
64
- return expected;
65
- }
57
+ const array = (check, message = defaultMessage('an array')) => (value, name = 'array') => {
58
+ if (!Array.isArray(value)) {
66
59
  return new Error(message(value, name));
67
- };
68
- };
69
- const array = function (check) {
70
- let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultMessage('an array');
71
- return function (value) {
72
- let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'array';
73
- if (!Array.isArray(value)) {
74
- return new Error(message(value, name));
75
- }
76
- const validated = value.map((item, i) => check(item, name ? `${name}[${i}]` : undefined));
77
- const errors = validated.filter(item => item instanceof Error);
78
- if (errors.length > 0) {
79
- const errMessageList = errors.map(item => '\t' + item.message).join('\n');
80
- return new Error(`Failed to validate ${name}:\n${errMessageList}`);
81
- }
82
- return validated.filter(item => !(item instanceof Error));
83
- };
60
+ }
61
+ const validated = value.map((item, i) => check(item, name ? `${name}[${i}]` : undefined));
62
+ const errors = validated.filter(item => item instanceof Error);
63
+ if (errors.length > 0) {
64
+ const errMessageList = errors.map(item => '\t' + item.message).join('\n');
65
+ return new Error(`Failed to validate ${name}:\n${errMessageList}`);
66
+ }
67
+ return validated.filter(item => !(item instanceof Error));
84
68
  };
85
- const object = function (shape) {
86
- let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultMessage('an object where:');
87
- return (value, name) => {
88
- if (typeof value !== 'object' || value == null) {
89
- return new Error(message(value, name));
90
- }
91
- const result = {};
92
- for (const key in shape) {
93
- const check = shape[key];
94
- const item = check(value[key], name ? `${name}.${key}` : `obj.${key}`);
95
- if (item instanceof Error) {
96
- const objectDescription = Object.entries(shape).map(_ref => {
97
- let [key, check] = _ref;
98
- let msg = check(Symbol()).message;
99
- if (msg.includes('\n')) {
100
- msg = indent(indent(msg)).split('\n').slice(1).join('\n');
101
- }
102
- return `\t- Expected "${key}": to be ${msg}`;
103
- }).join('\n');
104
- return new Error(`${message(value, name)}\n${objectDescription}\nBut got: ${indent(JSON.stringify(value))}`);
105
- }
106
- result[key] = item;
69
+ const object = (shape, message = defaultMessage('an object where:')) => (value, name) => {
70
+ if (typeof value !== 'object' || value == null) {
71
+ return new Error(message(value, name));
72
+ }
73
+ const result = {};
74
+ for (const key in shape) {
75
+ const check = shape[key];
76
+ const item = check(value[key], name ? `${name}.${key}` : `obj.${key}`);
77
+ if (item instanceof Error) {
78
+ const objectDescription = Object.entries(shape).map(([key, check]) => {
79
+ let msg = check(Symbol()).message;
80
+ if (msg.includes('\n')) {
81
+ msg = indent(indent(msg)).split('\n').slice(1).join('\n');
82
+ }
83
+ return `\t- Expected "${key}": to be ${msg}`;
84
+ }).join('\n');
85
+ return new Error(`${message(value, name)}\n${objectDescription}\nBut got: ${indent(JSON.stringify(value))}`);
107
86
  }
108
- return result;
109
- };
87
+ result[key] = item;
88
+ }
89
+ return result;
110
90
  };
111
- const objectOf = function (check) {
112
- let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultObjectMessage('an object');
113
- return (value, name) => {
114
- if (typeof value !== 'object' || value == null) {
115
- return new Error(message(value, name));
116
- }
117
- const result = {};
118
- for (const key in value) {
119
- const item = check(value[key], name ? `${name}.${key}` : `With the key '${key}':`);
120
- if (item instanceof Error) {
121
- return new Error(`${message(value, name)}${indent(item.message)}\nBut got: ${indent(JSON.stringify(value))}`);
122
- }
123
- result[key] = item;
91
+ const objectOf = (check, message = defaultObjectMessage('an object')) => (value, name) => {
92
+ if (typeof value !== 'object' || value == null) {
93
+ return new Error(message(value, name));
94
+ }
95
+ const result = {};
96
+ for (const key in value) {
97
+ const item = check(value[key], name ? `${name}.${key}` : `With the key '${key}':`);
98
+ if (item instanceof Error) {
99
+ return new Error(`${message(value, name)}${indent(item.message)}\nBut got: ${indent(JSON.stringify(value))}`);
124
100
  }
125
- return result;
126
- };
101
+ result[key] = item;
102
+ }
103
+ return result;
127
104
  };
128
- const unionOf = function (a, b) {
129
- let message = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultUnionMessage('one of');
130
- return (value, name) => {
131
- const resultA = a(value);
132
- if (!(resultA instanceof Error)) {
133
- return resultA;
134
- }
135
- const resultB = b(value);
136
- if (!(resultB instanceof Error)) {
137
- return resultB;
138
- }
139
- return new Error(`${message(value, name)}${indent(resultA.message)}${indent(resultB.message)}\nBut got: ${JSON.stringify(value)}`);
140
- };
105
+ const unionOf = (a, b, message = defaultUnionMessage('one of')) => (value, name) => {
106
+ const resultA = a(value);
107
+ if (!(resultA instanceof Error)) {
108
+ return resultA;
109
+ }
110
+ const resultB = b(value);
111
+ if (!(resultB instanceof Error)) {
112
+ return resultB;
113
+ }
114
+ return new Error(`${message(value, name)}${indent(resultA.message)}${indent(resultB.message)}\nBut got: ${JSON.stringify(value)}`);
141
115
  };
142
- const unionOf3 = function (a, b, c) {
143
- let message = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : defaultUnionMessage('one of');
144
- return (value, name) => {
145
- const resultA = a(value);
146
- if (!(resultA instanceof Error)) {
147
- return resultA;
148
- }
149
- const resultB = b(value);
150
- if (!(resultB instanceof Error)) {
151
- return resultB;
152
- }
153
- const resultC = c(value);
154
- if (!(resultC instanceof Error)) {
155
- return resultC;
156
- }
157
- return new Error(`${message(value, name)}${indent(resultA.message)}${indent(resultB.message)}${indent(resultC.message)}\nBut got: ${JSON.stringify(value)}`);
158
- };
116
+ const unionOf3 = (a, b, c, message = defaultUnionMessage('one of')) => (value, name) => {
117
+ const resultA = a(value);
118
+ if (!(resultA instanceof Error)) {
119
+ return resultA;
120
+ }
121
+ const resultB = b(value);
122
+ if (!(resultB instanceof Error)) {
123
+ return resultB;
124
+ }
125
+ const resultC = c(value);
126
+ if (!(resultC instanceof Error)) {
127
+ return resultC;
128
+ }
129
+ return new Error(`${message(value, name)}${indent(resultA.message)}${indent(resultB.message)}${indent(resultC.message)}\nBut got: ${JSON.stringify(value)}`);
159
130
  };
160
131
  const logAndDefault = (check, value, def, name) => {
161
132
  const result = check(value, name);
@@ -170,7 +141,7 @@ function getDefaultExportFromCjs (x) {
170
141
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
171
142
  }
172
143
 
173
- var lib$1 = {};
144
+ var lib$2 = {};
174
145
 
175
146
  var importInjector = {};
176
147
 
@@ -636,11 +607,11 @@ function requireImportInjector () {
636
607
  return importInjector;
637
608
  }
638
609
 
639
- var hasRequiredLib$1;
610
+ var hasRequiredLib$2;
640
611
 
641
- function requireLib$1 () {
642
- if (hasRequiredLib$1) return lib$1;
643
- hasRequiredLib$1 = 1;
612
+ function requireLib$2 () {
613
+ if (hasRequiredLib$2) return lib$2;
614
+ hasRequiredLib$2 = 1;
644
615
  (function (exports) {
645
616
 
646
617
  Object.defineProperty(exports, "__esModule", {
@@ -678,11 +649,11 @@ function requireLib$1 () {
678
649
  }
679
650
 
680
651
 
681
- } (lib$1));
682
- return lib$1;
652
+ } (lib$2));
653
+ return lib$2;
683
654
  }
684
655
 
685
- var libExports$1 = requireLib$1();
656
+ var libExports$2 = requireLib$2();
686
657
 
687
658
  const CheckModuleResolution = unionOf3(object({
688
659
  type: literal('commonJS'),
@@ -707,24 +678,24 @@ const checkRuntimeInjection = unionOf3(boolean(), string(), object({
707
678
  }));
708
679
  const DEFAULT_INJECT_PATH = '@stylexjs/stylex/lib/stylex-inject';
709
680
  class StateManager {
710
- importPaths = (() => new Set())();
711
- stylexImport = (() => new Set())();
712
- stylexPropsImport = (() => new Set())();
713
- stylexAttrsImport = (() => new Set())();
714
- stylexCreateImport = (() => new Set())();
715
- stylexIncludeImport = (() => new Set())();
716
- stylexFirstThatWorksImport = (() => new Set())();
717
- stylexKeyframesImport = (() => new Set())();
718
- stylexPositionTryImport = (() => new Set())();
719
- stylexDefineVarsImport = (() => new Set())();
720
- stylexDefineConstsImport = (() => new Set())();
721
- stylexCreateThemeImport = (() => new Set())();
722
- stylexTypesImport = (() => new Set())();
723
- stylexViewTransitionClassImport = (() => new Set())();
681
+ importPaths = new Set();
682
+ stylexImport = new Set();
683
+ stylexPropsImport = new Set();
684
+ stylexAttrsImport = new Set();
685
+ stylexCreateImport = new Set();
686
+ stylexIncludeImport = new Set();
687
+ stylexFirstThatWorksImport = new Set();
688
+ stylexKeyframesImport = new Set();
689
+ stylexPositionTryImport = new Set();
690
+ stylexDefineVarsImport = new Set();
691
+ stylexDefineConstsImport = new Set();
692
+ stylexCreateThemeImport = new Set();
693
+ stylexTypesImport = new Set();
694
+ stylexViewTransitionClassImport = new Set();
724
695
  injectImportInserted = null;
725
- styleMap = (() => new Map())();
726
- styleVars = (() => new Map())();
727
- styleVarsToKeep = (() => new Set())();
696
+ styleMap = new Map();
697
+ styleVars = new Map();
698
+ styleVarsToKeep = new Set();
728
699
  inStyleXCreate = false;
729
700
  constructor(state) {
730
701
  this._state = state;
@@ -740,6 +711,7 @@ class StateManager {
740
711
  const enableFontSizePxToRem = logAndDefault(boolean(), options.enableFontSizePxToRem ?? false, false, 'options.enableFontSizePxToRem');
741
712
  const enableInlinedConditionalMerge = logAndDefault(boolean(), options.enableInlinedConditionalMerge ?? true, true, 'options.enableInlinedConditionalMerge');
742
713
  const enableMinifiedKeys = logAndDefault(boolean(), options.enableMinifiedKeys ?? true, true, 'options.enableMinifiedKeys');
714
+ const enableMediaQueryOrder = logAndDefault(boolean(), options.enableMediaQueryOrder ?? false, false, 'options.enableMediaQueryOrder');
743
715
  const enableLegacyValueFlipping = logAndDefault(boolean(), options.enableLegacyValueFlipping ?? false, false, 'options.enableLegacyValueFlipping');
744
716
  const enableLogicalStylesPolyfill = logAndDefault(boolean(), options.enableLogicalStylesPolyfill ?? false, false, 'options.enableLogicalStylesPolyfill');
745
717
  const test = logAndDefault(boolean(), options.test ?? false, false, 'options.test');
@@ -752,8 +724,7 @@ class StateManager {
752
724
  const unstable_moduleResolution = logAndDefault(unionOf(nullish(), CheckModuleResolution), options.unstable_moduleResolution, null, 'options.unstable_moduleResolution');
753
725
  const treeshakeCompensation = logAndDefault(boolean(), options.treeshakeCompensation ?? false, false, 'options.treeshakeCompensation');
754
726
  const aliasesOption = logAndDefault(unionOf(nullish(), objectOf(unionOf(string(), array(string())))), options.aliases, null, 'options.aliases');
755
- const aliases = aliasesOption == null ? aliasesOption : Object.fromEntries(Object.entries(aliasesOption).map(_ref => {
756
- let [key, value] = _ref;
727
+ const aliases = aliasesOption == null ? aliasesOption : Object.fromEntries(Object.entries(aliasesOption).map(([key, value]) => {
757
728
  if (typeof value === 'string') {
758
729
  return [key, [value]];
759
730
  }
@@ -771,6 +742,7 @@ class StateManager {
771
742
  enableFontSizePxToRem,
772
743
  enableInlinedConditionalMerge,
773
744
  enableMinifiedKeys,
745
+ enableMediaQueryOrder,
774
746
  enableLegacyValueFlipping,
775
747
  enableLogicalStylesPolyfill,
776
748
  importSources,
@@ -819,7 +791,7 @@ class StateManager {
819
791
  } : runInj || null;
820
792
  }
821
793
  addNamedImport(statementPath, as, from, options) {
822
- const identifier = libExports$1.addNamed(statementPath, as, from, options);
794
+ const identifier = libExports$2.addNamed(statementPath, as, from, options);
823
795
  const programPath = getProgramPath(statementPath);
824
796
  if (programPath == null) {
825
797
  return identifier;
@@ -847,7 +819,7 @@ class StateManager {
847
819
  return importName;
848
820
  }
849
821
  addDefaultImport(statementPath, from, options) {
850
- const identifier = libExports$1.addDefault(statementPath, from, options);
822
+ const identifier = libExports$2.addDefault(statementPath, from, options);
851
823
  const programPath = getProgramPath(statementPath);
852
824
  if (programPath == null) {
853
825
  return identifier;
@@ -1229,8 +1201,7 @@ function readRequires(path, state) {
1229
1201
  }
1230
1202
  }
1231
1203
 
1232
- function murmurhash2_32_gc(str) {
1233
- let seed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1204
+ function murmurhash2_32_gc(str, seed = 0) {
1234
1205
  let l = str.length,
1235
1206
  h = seed ^ l,
1236
1207
  i = 0,
@@ -1280,6 +1251,7 @@ const defaultOptions = {
1280
1251
  enableDevClassNames: false,
1281
1252
  enableDebugDataProp: true,
1282
1253
  enableFontSizePxToRem: false,
1254
+ enableMediaQueryOrder: false,
1283
1255
  enableLegacyValueFlipping: false,
1284
1256
  enableLogicalStylesPolyfill: false,
1285
1257
  enableMinifiedKeys: true,
@@ -2014,12 +1986,12 @@ function requireUnit () {
2014
1986
  return unit;
2015
1987
  }
2016
1988
 
2017
- var lib;
2018
- var hasRequiredLib;
1989
+ var lib$1;
1990
+ var hasRequiredLib$1;
2019
1991
 
2020
- function requireLib () {
2021
- if (hasRequiredLib) return lib;
2022
- hasRequiredLib = 1;
1992
+ function requireLib$1 () {
1993
+ if (hasRequiredLib$1) return lib$1;
1994
+ hasRequiredLib$1 = 1;
2023
1995
  var parse = requireParse();
2024
1996
  var walk = requireWalk();
2025
1997
  var stringify = requireStringify();
@@ -2047,12 +2019,12 @@ function requireLib () {
2047
2019
 
2048
2020
  ValueParser.stringify = stringify;
2049
2021
 
2050
- lib = ValueParser;
2051
- return lib;
2022
+ lib$1 = ValueParser;
2023
+ return lib$1;
2052
2024
  }
2053
2025
 
2054
- var libExports = requireLib();
2055
- var parser = /*@__PURE__*/getDefaultExportFromCjs(libExports);
2026
+ var libExports$1 = requireLib$1();
2027
+ var parser = /*@__PURE__*/getDefaultExportFromCjs(libExports$1);
2056
2028
 
2057
2029
  function printNode(node) {
2058
2030
  switch (node.type) {
@@ -2351,6 +2323,2016 @@ function flatMapExpandedShorthands(objEntry, options) {
2351
2323
  return [[key, value]];
2352
2324
  }
2353
2325
 
2326
+ var lib = {};
2327
+
2328
+ var tokenParser = {};
2329
+
2330
+ var tokenTypes = {};
2331
+
2332
+ var dist = {};
2333
+
2334
+ var hasRequiredDist;
2335
+
2336
+ function requireDist () {
2337
+ if (hasRequiredDist) return dist;
2338
+ hasRequiredDist = 1;
2339
+ (function (exports) {
2340
+ 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;
2341
+ } (dist));
2342
+ return dist;
2343
+ }
2344
+
2345
+ var hasRequiredTokenTypes;
2346
+
2347
+ function requireTokenTypes () {
2348
+ if (hasRequiredTokenTypes) return tokenTypes;
2349
+ hasRequiredTokenTypes = 1;
2350
+
2351
+ Object.defineProperty(tokenTypes, "__esModule", {
2352
+ value: true
2353
+ });
2354
+ tokenTypes.TokenList = void 0;
2355
+ var _cssTokenizer = requireDist();
2356
+ class TokenList {
2357
+ constructor(input) {
2358
+ const iterator = typeof input === 'string' ? (0, _cssTokenizer.tokenizer)({
2359
+ css: input
2360
+ }) : input;
2361
+ this.tokenIterator = iterator;
2362
+ this.consumedTokens = [];
2363
+ this.currentIndex = 0;
2364
+ this.isAtEnd = false;
2365
+ }
2366
+ consumeNextToken() {
2367
+ if (this.currentIndex < this.consumedTokens.length) {
2368
+ return this.consumedTokens[this.currentIndex++];
2369
+ }
2370
+ if (this.isAtEnd) {
2371
+ return null;
2372
+ }
2373
+ if (this.tokenIterator.endOfFile()) {
2374
+ this.isAtEnd = true;
2375
+ return null;
2376
+ }
2377
+ const token = this.tokenIterator.nextToken();
2378
+ this.consumedTokens.push(token);
2379
+ this.currentIndex++;
2380
+ if (this.tokenIterator.endOfFile()) {
2381
+ this.isAtEnd = true;
2382
+ }
2383
+ return token;
2384
+ }
2385
+ peek() {
2386
+ if (this.currentIndex < this.consumedTokens.length) {
2387
+ return this.consumedTokens[this.currentIndex];
2388
+ }
2389
+ if (this.isAtEnd || this.tokenIterator.endOfFile()) {
2390
+ return null;
2391
+ }
2392
+ const token = this.tokenIterator.nextToken();
2393
+ this.consumedTokens.push(token);
2394
+ return token;
2395
+ }
2396
+ get first() {
2397
+ return this.peek();
2398
+ }
2399
+ setCurrentIndex(newIndex) {
2400
+ if (newIndex < this.consumedTokens.length) {
2401
+ this.currentIndex = newIndex;
2402
+ return;
2403
+ }
2404
+ while (!this.isAtEnd && !this.tokenIterator.endOfFile() && this.consumedTokens.length <= newIndex) {
2405
+ const token = this.tokenIterator.nextToken();
2406
+ this.consumedTokens.push(token);
2407
+ if (this.tokenIterator.endOfFile()) {
2408
+ this.isAtEnd = true;
2409
+ }
2410
+ }
2411
+ this.currentIndex = Math.min(newIndex, this.consumedTokens.length);
2412
+ }
2413
+ rewind(positions = 1) {
2414
+ this.currentIndex = Math.max(0, this.currentIndex - positions);
2415
+ }
2416
+ get isEmpty() {
2417
+ return this.isAtEnd || this.currentIndex >= this.consumedTokens.length && this.tokenIterator.endOfFile();
2418
+ }
2419
+ getAllTokens() {
2420
+ while (!this.isEmpty) {
2421
+ this.consumeNextToken();
2422
+ }
2423
+ return this.consumedTokens;
2424
+ }
2425
+ slice(start, end = this.currentIndex) {
2426
+ const initialIndex = this.currentIndex;
2427
+ if (start < 0 || end < start) {
2428
+ return [];
2429
+ }
2430
+ this.setCurrentIndex(start);
2431
+ const result = [];
2432
+ while (this.currentIndex < end) {
2433
+ const token = this.consumeNextToken();
2434
+ if (token == null) {
2435
+ break;
2436
+ }
2437
+ result.push(token);
2438
+ }
2439
+ this.setCurrentIndex(initialIndex);
2440
+ return result;
2441
+ }
2442
+ }
2443
+ tokenTypes.TokenList = TokenList;
2444
+ return tokenTypes;
2445
+ }
2446
+
2447
+ var hasRequiredTokenParser;
2448
+
2449
+ function requireTokenParser () {
2450
+ if (hasRequiredTokenParser) return tokenParser;
2451
+ hasRequiredTokenParser = 1;
2452
+
2453
+ Object.defineProperty(tokenParser, "__esModule", {
2454
+ value: true
2455
+ });
2456
+ tokenParser.TokenParser = tokenParser.TokenOneOrMoreParsers = void 0;
2457
+ var _tokenTypes = requireTokenTypes();
2458
+ var _cssTokenizer = requireDist();
2459
+ class TokenParser {
2460
+ constructor(parser, label = 'UnknownParser') {
2461
+ this.run = parser;
2462
+ this.label = label;
2463
+ }
2464
+ parse(css) {
2465
+ const tokens = new _tokenTypes.TokenList(css);
2466
+ return this.run(tokens);
2467
+ }
2468
+ parseToEnd(css) {
2469
+ const tokens = new _tokenTypes.TokenList(css);
2470
+ const initialIndex = tokens.currentIndex;
2471
+ const output = this.run(tokens);
2472
+ if (output instanceof Error) {
2473
+ const consumedTokens = tokens.slice(initialIndex);
2474
+ tokens.setCurrentIndex(initialIndex);
2475
+ throw new Error(`Expected ${this.toString()} but got ${output.message}\n` + `Consumed tokens: ${consumedTokens.map(token => token[0]).join(', ')}`);
2476
+ }
2477
+ if (tokens.peek() != null) {
2478
+ const token = tokens.peek();
2479
+ if (token == null) {
2480
+ return output;
2481
+ }
2482
+ const consumedTokens = tokens.slice(initialIndex);
2483
+ throw new Error(`Expected end of input, got ${token[0]} instead\n` + `Consumed tokens: ${consumedTokens.map(token => token[0]).join(', ')}`);
2484
+ }
2485
+ return output;
2486
+ }
2487
+ map(f, label) {
2488
+ return new TokenParser(input => {
2489
+ const currentIndex = input.currentIndex;
2490
+ const result = this.run(input);
2491
+ if (result instanceof Error) {
2492
+ input.setCurrentIndex(currentIndex);
2493
+ return result;
2494
+ }
2495
+ return f(result);
2496
+ }, `${this.label}.map(${label ?? ''})`);
2497
+ }
2498
+ flatMap(f, label) {
2499
+ return new TokenParser(input => {
2500
+ const currentIndex = input.currentIndex;
2501
+ const output1 = this.run(input);
2502
+ if (output1 instanceof Error) {
2503
+ input.setCurrentIndex(currentIndex);
2504
+ return output1;
2505
+ }
2506
+ const secondParser = f(output1);
2507
+ const output2 = secondParser.run(input);
2508
+ if (output2 instanceof Error) {
2509
+ input.setCurrentIndex(currentIndex);
2510
+ return output2;
2511
+ }
2512
+ return output2;
2513
+ }, `${this.label}.flatMap(${label ?? ''})`);
2514
+ }
2515
+ or(parser2) {
2516
+ return new TokenParser(input => {
2517
+ const currentIndex = input.currentIndex;
2518
+ const output1 = this.run(input);
2519
+ if (output1 instanceof Error) {
2520
+ input.setCurrentIndex(currentIndex);
2521
+ const output2 = parser2.run(input);
2522
+ if (output2 instanceof Error) {
2523
+ input.setCurrentIndex(currentIndex);
2524
+ }
2525
+ return output2;
2526
+ }
2527
+ return output1;
2528
+ }, parser2.label === 'optional' ? `Optional<${this.label}>` : `OneOf<${this.label}, ${parser2.label}>`);
2529
+ }
2530
+ surroundedBy(prefix, suffix = prefix) {
2531
+ return TokenParser.sequence(prefix, this, suffix).map(([_prefix, value, _suffix]) => value);
2532
+ }
2533
+ skip(skipParser) {
2534
+ return this.flatMap(output => skipParser.map(() => output));
2535
+ }
2536
+ get optional() {
2537
+ return new TokenOptionalParser(this);
2538
+ }
2539
+ prefix(prefixParser) {
2540
+ return prefixParser.flatMap(() => this);
2541
+ }
2542
+ suffix(suffixParser) {
2543
+ return this.flatMap(output => suffixParser.map(() => output));
2544
+ }
2545
+ where(predicate, label = '') {
2546
+ return this.flatMap(output => {
2547
+ if (predicate(output)) {
2548
+ return TokenParser.always(output);
2549
+ }
2550
+ return TokenParser.never();
2551
+ }, label);
2552
+ }
2553
+ toString() {
2554
+ return this.label;
2555
+ }
2556
+ static never() {
2557
+ return new TokenParser(() => new Error('Never'), 'Never');
2558
+ }
2559
+ static always(output) {
2560
+ return new TokenParser(() => output, output === undefined ? 'optional' : `Always<${String(output)}>`);
2561
+ }
2562
+ static token(tokenType, label = tokenType) {
2563
+ return new TokenParser(input => {
2564
+ const currentIndex = input.currentIndex;
2565
+ const token = input.consumeNextToken();
2566
+ if (token == null) {
2567
+ input.setCurrentIndex(currentIndex);
2568
+ return new Error('Expected token');
2569
+ }
2570
+ if (token[0] !== tokenType) {
2571
+ input.setCurrentIndex(currentIndex);
2572
+ return new Error(`Expected token type ${tokenType}, got ${token[0]}`);
2573
+ }
2574
+ return token;
2575
+ }, label);
2576
+ }
2577
+ static string(str) {
2578
+ return TokenParser.tokens.Ident.map(token => token[4].value, '.value').where(value => value === str, `=== ${str}`);
2579
+ }
2580
+ static fn(name) {
2581
+ return TokenParser.tokens.Function.map(token => token[4].value, '.value').where(value => value === name, `=== ${name}`);
2582
+ }
2583
+ static tokens = {
2584
+ Comment: TokenParser.token(_cssTokenizer.TokenType.Comment, 'Comment'),
2585
+ AtKeyword: TokenParser.token(_cssTokenizer.TokenType.AtKeyword, 'AtKeyword'),
2586
+ BadString: TokenParser.token(_cssTokenizer.TokenType.BadString, 'BadString'),
2587
+ BadURL: TokenParser.token(_cssTokenizer.TokenType.BadURL, 'BadURL'),
2588
+ CDC: TokenParser.token(_cssTokenizer.TokenType.CDC, 'CDC'),
2589
+ CDO: TokenParser.token(_cssTokenizer.TokenType.CDO, 'CDO'),
2590
+ Colon: TokenParser.token(_cssTokenizer.TokenType.Colon, 'Colon'),
2591
+ Comma: TokenParser.token(_cssTokenizer.TokenType.Comma, 'Comma'),
2592
+ Delim: TokenParser.token(_cssTokenizer.TokenType.Delim, 'Delim'),
2593
+ Dimension: TokenParser.token(_cssTokenizer.TokenType.Dimension, 'Dimension'),
2594
+ EOF: TokenParser.token(_cssTokenizer.TokenType.EOF, 'EOF'),
2595
+ Function: TokenParser.token(_cssTokenizer.TokenType.Function, 'Function'),
2596
+ Hash: TokenParser.token(_cssTokenizer.TokenType.Hash, 'Hash'),
2597
+ Ident: TokenParser.token(_cssTokenizer.TokenType.Ident, 'Ident'),
2598
+ Number: TokenParser.token(_cssTokenizer.TokenType.Number, 'Number'),
2599
+ Percentage: TokenParser.token(_cssTokenizer.TokenType.Percentage, 'Percentage'),
2600
+ Semicolon: TokenParser.token(_cssTokenizer.TokenType.Semicolon, 'Semicolon'),
2601
+ String: TokenParser.token(_cssTokenizer.TokenType.String, 'String'),
2602
+ URL: TokenParser.token(_cssTokenizer.TokenType.URL, 'URL'),
2603
+ Whitespace: TokenParser.token(_cssTokenizer.TokenType.Whitespace, 'Whitespace'),
2604
+ OpenParen: TokenParser.token(_cssTokenizer.TokenType.OpenParen, 'OpenParen'),
2605
+ CloseParen: TokenParser.token(_cssTokenizer.TokenType.CloseParen, 'CloseParen'),
2606
+ OpenSquare: TokenParser.token(_cssTokenizer.TokenType.OpenSquare, 'OpenSquare'),
2607
+ CloseSquare: TokenParser.token(_cssTokenizer.TokenType.CloseSquare, 'CloseSquare'),
2608
+ OpenCurly: TokenParser.token(_cssTokenizer.TokenType.OpenCurly, 'OpenCurly'),
2609
+ CloseCurly: TokenParser.token(_cssTokenizer.TokenType.CloseCurly, 'CloseCurly'),
2610
+ UnicodeRange: TokenParser.token(_cssTokenizer.TokenType.UnicodeRange, 'UnicodeRange')
2611
+ };
2612
+ static oneOf(...parsers) {
2613
+ return new TokenParser(input => {
2614
+ const errors = [];
2615
+ const index = input.currentIndex;
2616
+ for (const parser of parsers) {
2617
+ const output = typeof parser === 'function' ? parser().run(input) : parser.run(input);
2618
+ if (!(output instanceof Error)) {
2619
+ return output;
2620
+ }
2621
+ input.setCurrentIndex(index);
2622
+ errors.push(output);
2623
+ }
2624
+ return new Error('No parser matched\n' + errors.map(err => '- ' + err.toString()).join('\n'));
2625
+ });
2626
+ }
2627
+ static sequence(...parsers) {
2628
+ return new TokenParserSequence(parsers);
2629
+ }
2630
+ static setOf(...parsers) {
2631
+ return new TokenParserSet(parsers);
2632
+ }
2633
+ static zeroOrMore(parser) {
2634
+ return new TokenZeroOrMoreParsers(parser);
2635
+ }
2636
+ static oneOrMore(parser) {
2637
+ return new TokenOneOrMoreParsers(parser);
2638
+ }
2639
+ }
2640
+ tokenParser.TokenParser = TokenParser;
2641
+ class TokenZeroOrMoreParsers extends TokenParser {
2642
+ constructor(parser, separator) {
2643
+ super(input => {
2644
+ const output = [];
2645
+ for (let i = 0; true; i++) {
2646
+ if (i > 0 && separator) {
2647
+ const currentIndex = input.currentIndex;
2648
+ const result = separator.run(input);
2649
+ if (result instanceof Error) {
2650
+ input.setCurrentIndex(currentIndex);
2651
+ return output;
2652
+ }
2653
+ }
2654
+ const currentIndex = input.currentIndex;
2655
+ const result = parser.run(input);
2656
+ if (result instanceof Error) {
2657
+ input.setCurrentIndex(currentIndex);
2658
+ return output;
2659
+ }
2660
+ output.push(result);
2661
+ }
2662
+ return output;
2663
+ }, `ZeroOrMore<${parser.label}>`);
2664
+ this.parser = parser;
2665
+ this.separator = separator;
2666
+ }
2667
+ separatedBy(separator) {
2668
+ const voidedSeparator = separator.map(() => undefined);
2669
+ const newSeparator = this.separator?.surroundedBy(voidedSeparator) ?? voidedSeparator;
2670
+ return new TokenZeroOrMoreParsers(this.parser, newSeparator);
2671
+ }
2672
+ }
2673
+ class TokenOneOrMoreParsers extends TokenParser {
2674
+ constructor(parser, separator) {
2675
+ super(input => {
2676
+ const output = [];
2677
+ for (let i = 0; true; i++) {
2678
+ if (i > 0 && separator) {
2679
+ const currentIndex = input.currentIndex;
2680
+ const result = separator.run(input);
2681
+ if (result instanceof Error) {
2682
+ input.setCurrentIndex(currentIndex);
2683
+ return output;
2684
+ }
2685
+ }
2686
+ const currentIndex = input.currentIndex;
2687
+ const result = parser.run(input);
2688
+ if (result instanceof Error) {
2689
+ if (i === 0) {
2690
+ input.setCurrentIndex(currentIndex);
2691
+ return result;
2692
+ }
2693
+ return output;
2694
+ }
2695
+ output.push(result);
2696
+ }
2697
+ return output;
2698
+ }, `OneOrMore<${parser.label}>`);
2699
+ this.parser = parser;
2700
+ this.separator = separator;
2701
+ }
2702
+ separatedBy(separator) {
2703
+ const voidedSeparator = separator.map(() => undefined);
2704
+ const newSeparator = this.separator?.surroundedBy(voidedSeparator) ?? voidedSeparator;
2705
+ return new TokenOneOrMoreParsers(this.parser, newSeparator);
2706
+ }
2707
+ }
2708
+ tokenParser.TokenOneOrMoreParsers = TokenOneOrMoreParsers;
2709
+ class TokenParserSequence extends TokenParser {
2710
+ constructor(parsers, _separator) {
2711
+ const separator = _separator?.map(() => undefined);
2712
+ super(input => {
2713
+ const currentIndex = input.currentIndex;
2714
+ let failed = null;
2715
+ const output = parsers.map(_parser => {
2716
+ if (failed) {
2717
+ return new Error('already failed');
2718
+ }
2719
+ let parser = _parser;
2720
+ if (separator != null && input.currentIndex > currentIndex) {
2721
+ if (parser instanceof TokenOptionalParser) {
2722
+ parser = TokenParser.sequence(separator, parser.parser).map(([_separator, value]) => value).optional;
2723
+ } else {
2724
+ parser = TokenParser.sequence(separator, parser).map(([_separator, value]) => value);
2725
+ }
2726
+ }
2727
+ const result = parser.run(input);
2728
+ if (result instanceof Error) {
2729
+ failed = result;
2730
+ }
2731
+ return result;
2732
+ });
2733
+ if (failed) {
2734
+ const errorToReturn = failed;
2735
+ input.setCurrentIndex(currentIndex);
2736
+ return errorToReturn;
2737
+ }
2738
+ return output;
2739
+ }, `Sequence<${parsers.map(parser => parser.label).join(', ')}>`);
2740
+ this.parsers = parsers;
2741
+ this.separator = separator;
2742
+ }
2743
+ separatedBy(separator) {
2744
+ const newSeparator = this.separator?.surroundedBy(separator.map(() => undefined)) ?? separator.map(() => undefined);
2745
+ return new TokenParserSequence(this.parsers, newSeparator);
2746
+ }
2747
+ }
2748
+ class TokenOptionalParser extends TokenParser {
2749
+ constructor(parser) {
2750
+ super(parser.or(TokenParser.always(undefined)).run, `Optional<${parser.label}>`);
2751
+ this.parser = parser;
2752
+ }
2753
+ }
2754
+ class TokenParserSet extends TokenParser {
2755
+ constructor(_parsers, separator) {
2756
+ super(input => {
2757
+ const parsers = _parsers.map((parser, i) => [parser, i]).sort(([a], [b]) => {
2758
+ if (a instanceof TokenOptionalParser) {
2759
+ return 1;
2760
+ }
2761
+ if (b instanceof TokenOptionalParser) {
2762
+ return -1;
2763
+ }
2764
+ return 0;
2765
+ });
2766
+ const currentIndex = input.currentIndex;
2767
+ let failed = null;
2768
+ const output = [];
2769
+ const indices = new Set();
2770
+ for (let i = 0; i < parsers.length; i++) {
2771
+ let found = false;
2772
+ const errors = [];
2773
+ for (let j = 0; j < parsers.length; j++) {
2774
+ if (indices.has(j)) {
2775
+ continue;
2776
+ }
2777
+ let [parser, index] = parsers[j];
2778
+ if (separator != null && i > 0) {
2779
+ if (parser instanceof TokenOptionalParser) {
2780
+ parser = TokenParser.sequence(separator, parser.parser).map(([_separator, value]) => value).optional;
2781
+ } else {
2782
+ parser = TokenParser.sequence(separator, parser).map(([_separator, value]) => value);
2783
+ }
2784
+ }
2785
+ const currentIndex = input.currentIndex;
2786
+ const result = parser.run(input);
2787
+ if (result instanceof Error) {
2788
+ input.setCurrentIndex(currentIndex);
2789
+ errors.push(result);
2790
+ } else {
2791
+ found = true;
2792
+ output[index] = result;
2793
+ indices.add(j);
2794
+ break;
2795
+ }
2796
+ }
2797
+ if (found) {
2798
+ continue;
2799
+ } else {
2800
+ failed = new Error(`Expected one of ${parsers.map(parser => parser.toString()).join(', ')} but got ${errors.map(error => error.message).join(', ')}`);
2801
+ break;
2802
+ }
2803
+ }
2804
+ if (failed instanceof Error) {
2805
+ input.setCurrentIndex(currentIndex);
2806
+ return failed;
2807
+ }
2808
+ return output;
2809
+ });
2810
+ this.parsers = _parsers;
2811
+ this.separator = separator;
2812
+ }
2813
+ separatedBy(separator) {
2814
+ const voidedSeparator = separator.map(() => undefined);
2815
+ const sep = this.separator?.surroundedBy(voidedSeparator) ?? voidedSeparator;
2816
+ return new TokenParserSet(this.parsers, sep);
2817
+ }
2818
+ }
2819
+ return tokenParser;
2820
+ }
2821
+
2822
+ var properties = {};
2823
+
2824
+ var transform = {};
2825
+
2826
+ var transformFunction$1 = {};
2827
+
2828
+ var length$1 = {};
2829
+
2830
+ var hasRequiredLength;
2831
+
2832
+ function requireLength () {
2833
+ if (hasRequiredLength) return length$1;
2834
+ hasRequiredLength = 1;
2835
+
2836
+ Object.defineProperty(length$1, "__esModule", {
2837
+ value: true
2838
+ });
2839
+ length$1.UNITS_BASED_ON_VIEWPORT = length$1.UNITS_BASED_ON_FONT = length$1.UNITS_BASED_ON_CONTAINER = length$1.UNITS_BASED_ON_ABSOLUTE_UNITS = length$1.Length = void 0;
2840
+ var _tokenParser = requireTokenParser();
2841
+ const UNITS_BASED_ON_FONT = length$1.UNITS_BASED_ON_FONT = ['ch', 'em', 'ex', 'ic', 'lh', 'rem', 'rlh'];
2842
+ const UNITS_BASED_ON_VIEWPORT = length$1.UNITS_BASED_ON_VIEWPORT = ['vh', 'svh', 'lvh', 'dvh', 'vw', 'svw', 'lvw', 'dvw', 'vmin', 'svmin', 'lvmin', 'dvmin', 'vmax', 'svmax', 'lvmax', 'dvmax'];
2843
+ const UNITS_BASED_ON_CONTAINER = length$1.UNITS_BASED_ON_CONTAINER = ['cqw', 'cqi', 'cqh', 'cqb', 'cqmin', 'cqmax'];
2844
+ const UNITS_BASED_ON_ABSOLUTE_UNITS = length$1.UNITS_BASED_ON_ABSOLUTE_UNITS = ['px', 'cm', 'mm', 'in', 'pt'];
2845
+ class Length {
2846
+ constructor(value, unit) {
2847
+ this.value = value;
2848
+ this.unit = unit;
2849
+ }
2850
+ toString() {
2851
+ return `${this.value}${this.unit}`;
2852
+ }
2853
+ static UNITS = [...UNITS_BASED_ON_FONT, ...UNITS_BASED_ON_VIEWPORT, ...UNITS_BASED_ON_CONTAINER, ...UNITS_BASED_ON_ABSOLUTE_UNITS];
2854
+ static get parser() {
2855
+ const united = _tokenParser.TokenParser.tokens.Dimension.map(token => [token[4].value, token[4].unit]).where(tuple => Length.UNITS.includes(tuple[1])).map(([value, unit]) => new Length(value, unit));
2856
+ return _tokenParser.TokenParser.oneOf(united, _tokenParser.TokenParser.tokens.Number.map(token => token[4].value === 0 ? new Length(0, '') : null).where(value => value != null));
2857
+ }
2858
+ }
2859
+ length$1.Length = Length;
2860
+ return length$1;
2861
+ }
2862
+
2863
+ var angle$1 = {};
2864
+
2865
+ var hasRequiredAngle;
2866
+
2867
+ function requireAngle () {
2868
+ if (hasRequiredAngle) return angle$1;
2869
+ hasRequiredAngle = 1;
2870
+
2871
+ Object.defineProperty(angle$1, "__esModule", {
2872
+ value: true
2873
+ });
2874
+ angle$1.Angle = void 0;
2875
+ var _tokenParser = requireTokenParser();
2876
+ class Angle {
2877
+ constructor(value, unit) {
2878
+ this.value = value;
2879
+ this.unit = unit;
2880
+ }
2881
+ toString() {
2882
+ return `${this.value}${this.unit}`;
2883
+ }
2884
+ static get parser() {
2885
+ const withUnit = _tokenParser.TokenParser.tokens.Dimension.map(v => v[4]).where(v => v.unit === 'deg' || v.unit === 'grad' || v.unit === 'rad' || v.unit === 'turn').map(v => new Angle(v.value, v.unit));
2886
+ return _tokenParser.TokenParser.oneOf(withUnit, _tokenParser.TokenParser.tokens.Number.map(v => v[4].value === 0 ? new Angle(0, 'deg') : null).where(v => v != null));
2887
+ }
2888
+ }
2889
+ angle$1.Angle = Angle;
2890
+ return angle$1;
2891
+ }
2892
+
2893
+ var commonTypes = {};
2894
+
2895
+ var hasRequiredCommonTypes;
2896
+
2897
+ function requireCommonTypes () {
2898
+ if (hasRequiredCommonTypes) return commonTypes;
2899
+ hasRequiredCommonTypes = 1;
2900
+
2901
+ Object.defineProperty(commonTypes, "__esModule", {
2902
+ value: true
2903
+ });
2904
+ commonTypes.unset = commonTypes.revert = commonTypes.numberOrPercentage = commonTypes.initial = commonTypes.inherit = commonTypes.cssWideKeywords = commonTypes.auto = commonTypes.Percentage = commonTypes.CssVariable = void 0;
2905
+ var _tokenParser = requireTokenParser();
2906
+ var _cssTokenizer = requireDist();
2907
+ const cssWideKeywords = commonTypes.cssWideKeywords = _tokenParser.TokenParser.tokens.Ident.map(v => v[4].value).where(v => v === 'inherit' || v === 'initial' || v === 'unset' || v === 'revert');
2908
+ commonTypes.inherit = cssWideKeywords.where(v => v === 'inherit');
2909
+ commonTypes.initial = cssWideKeywords.where(v => v === 'initial');
2910
+ commonTypes.unset = cssWideKeywords.where(v => v === 'unset');
2911
+ commonTypes.revert = cssWideKeywords.where(v => v === 'revert');
2912
+ commonTypes.auto = _tokenParser.TokenParser.token(_cssTokenizer.TokenType.Ident).map(v => v[4].value).where(v => v === 'auto');
2913
+ class CssVariable {
2914
+ constructor(name) {
2915
+ this.name = name;
2916
+ }
2917
+ toString() {
2918
+ return `var(${this.name})`;
2919
+ }
2920
+ static parse = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(v => v[4].value).where(v => v === 'var'), _tokenParser.TokenParser.tokens.Ident.map(v => v[4].value).where(v => v.startsWith('--')), _tokenParser.TokenParser.tokens.CloseParen).map(([_, name, __]) => new CssVariable(name));
2921
+ }
2922
+ commonTypes.CssVariable = CssVariable;
2923
+ class Percentage {
2924
+ constructor(value) {
2925
+ this.value = value;
2926
+ }
2927
+ toString() {
2928
+ return `${this.value}%`;
2929
+ }
2930
+ static get parser() {
2931
+ return _tokenParser.TokenParser.token(_cssTokenizer.TokenType.Percentage).map(v => new Percentage(v[4].value));
2932
+ }
2933
+ }
2934
+ commonTypes.Percentage = Percentage;
2935
+ commonTypes.numberOrPercentage = _tokenParser.TokenParser.oneOf(Percentage.parser, _tokenParser.TokenParser.token(_cssTokenizer.TokenType.Number).map(v => v[4].signCharacter === '-' ? -v[4].value : v[4].value));
2936
+ return commonTypes;
2937
+ }
2938
+
2939
+ var lengthPercentage$1 = {};
2940
+
2941
+ var hasRequiredLengthPercentage;
2942
+
2943
+ function requireLengthPercentage () {
2944
+ if (hasRequiredLengthPercentage) return lengthPercentage$1;
2945
+ hasRequiredLengthPercentage = 1;
2946
+
2947
+ Object.defineProperty(lengthPercentage$1, "__esModule", {
2948
+ value: true
2949
+ });
2950
+ lengthPercentage$1.lengthPercentage = void 0;
2951
+ var _tokenParser = requireTokenParser();
2952
+ var _length = requireLength();
2953
+ var _commonTypes = requireCommonTypes();
2954
+ lengthPercentage$1.lengthPercentage = _tokenParser.TokenParser.oneOf(_commonTypes.Percentage.parser, _length.Length.parser);
2955
+ return lengthPercentage$1;
2956
+ }
2957
+
2958
+ var hasRequiredTransformFunction;
2959
+
2960
+ function requireTransformFunction () {
2961
+ if (hasRequiredTransformFunction) return transformFunction$1;
2962
+ hasRequiredTransformFunction = 1;
2963
+
2964
+ Object.defineProperty(transformFunction$1, "__esModule", {
2965
+ value: true
2966
+ });
2967
+ transformFunction$1.TranslateAxis = transformFunction$1.Translate3d = transformFunction$1.Translate = transformFunction$1.TransformFunction = transformFunction$1.SkewAxis = transformFunction$1.Skew = transformFunction$1.ScaleAxis = transformFunction$1.Scale3d = transformFunction$1.Scale = transformFunction$1.RotateXYZ = transformFunction$1.Rotate3d = transformFunction$1.Rotate = transformFunction$1.Perspective = transformFunction$1.Matrix3d = transformFunction$1.Matrix = void 0;
2968
+ var _length = requireLength();
2969
+ var _tokenParser = requireTokenParser();
2970
+ var _angle = requireAngle();
2971
+ var _commonTypes = requireCommonTypes();
2972
+ var _lengthPercentage = requireLengthPercentage();
2973
+ class TransformFunction {
2974
+ static get parser() {
2975
+ return _tokenParser.TokenParser.oneOf(Matrix.parser, Matrix3d.parser, Perspective.parser, Rotate.parser, RotateXYZ.parser, Rotate3d.parser, Scale.parser, Scale3d.parser, ScaleAxis.parser, Skew.parser, SkewAxis.parser, Translate3d.parser, Translate.parser, TranslateAxis.parser);
2976
+ }
2977
+ }
2978
+ transformFunction$1.TransformFunction = TransformFunction;
2979
+ class Matrix extends TransformFunction {
2980
+ constructor(a, b, c, d, tx, ty) {
2981
+ super();
2982
+ this.a = a;
2983
+ this.b = b;
2984
+ this.c = c;
2985
+ this.d = d;
2986
+ this.tx = tx;
2987
+ this.ty = ty;
2988
+ }
2989
+ toString() {
2990
+ return `matrix(${this.a}, ${this.b}, ${this.c}, ${this.d}, ${this.tx}, ${this.ty})`;
2991
+ }
2992
+ static get parser() {
2993
+ const sixNumbers = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Number.map(v => v[4].value), _tokenParser.TokenParser.tokens.Number.map(v => v[4].value), _tokenParser.TokenParser.tokens.Number.map(v => v[4].value), _tokenParser.TokenParser.tokens.Number.map(v => v[4].value), _tokenParser.TokenParser.tokens.Number.map(v => v[4].value), _tokenParser.TokenParser.tokens.Number.map(v => v[4].value)).separatedBy(_tokenParser.TokenParser.tokens.Comma).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional);
2994
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.fn('matrix'), sixNumbers, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_fn, [a, b, c, d, tx, ty], _closeParen]) => new Matrix(a, b, c, d, tx, ty));
2995
+ }
2996
+ }
2997
+ transformFunction$1.Matrix = Matrix;
2998
+ class Matrix3d extends TransformFunction {
2999
+ constructor(args) {
3000
+ super();
3001
+ this.args = args;
3002
+ }
3003
+ toString() {
3004
+ return `matrix3d(${this.args.join(', ')})`;
3005
+ }
3006
+ static get parser() {
3007
+ const number = _tokenParser.TokenParser.tokens.Number.map(v => v[4].value);
3008
+ const fourNumbers = _tokenParser.TokenParser.sequence(number, number, number, number).separatedBy(_tokenParser.TokenParser.tokens.Comma).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional);
3009
+ const sixteenNumbers = _tokenParser.TokenParser.sequence(fourNumbers, fourNumbers, fourNumbers, fourNumbers).separatedBy(_tokenParser.TokenParser.tokens.Comma).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([f1, f2, f3, f4]) => [...f1, ...f2, ...f3, ...f4]);
3010
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(v => v[4].value).where(v => v === 'matrix3d'), sixteenNumbers, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_, args]) => new Matrix3d(args));
3011
+ }
3012
+ }
3013
+ transformFunction$1.Matrix3d = Matrix3d;
3014
+ class Perspective extends TransformFunction {
3015
+ constructor(length) {
3016
+ super();
3017
+ this.length = length;
3018
+ }
3019
+ toString() {
3020
+ return `perspective(${this.length.toString()})`;
3021
+ }
3022
+ static get parser() {
3023
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(v => v[4].value).where(v => v === 'perspective'), _length.Length.parser, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_, length]) => new Perspective(length));
3024
+ }
3025
+ }
3026
+ transformFunction$1.Perspective = Perspective;
3027
+ class Rotate extends TransformFunction {
3028
+ constructor(angle) {
3029
+ super();
3030
+ this.angle = angle;
3031
+ }
3032
+ toString() {
3033
+ return `rotate(${this.angle.toString()})`;
3034
+ }
3035
+ static get parser() {
3036
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(v => v[4].value).where(v => v === 'rotate'), _angle.Angle.parser, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_, angle]) => new Rotate(angle));
3037
+ }
3038
+ }
3039
+ transformFunction$1.Rotate = Rotate;
3040
+ class RotateXYZ extends TransformFunction {
3041
+ constructor(x, axis) {
3042
+ super();
3043
+ this.x = x;
3044
+ this.axis = axis;
3045
+ }
3046
+ toString() {
3047
+ return `rotate${this.axis}(${this.x.toString()})`;
3048
+ }
3049
+ static get parser() {
3050
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.oneOf(_tokenParser.TokenParser.fn('rotateX').map(() => 'X'), _tokenParser.TokenParser.fn('rotateY').map(() => 'Y'), _tokenParser.TokenParser.fn('rotateZ').map(() => 'Z')), _angle.Angle.parser, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([axis, x]) => new RotateXYZ(x, axis));
3051
+ }
3052
+ }
3053
+ transformFunction$1.RotateXYZ = RotateXYZ;
3054
+ class Rotate3d extends TransformFunction {
3055
+ constructor(x, y, z, angle) {
3056
+ super();
3057
+ this.x = x;
3058
+ this.y = y;
3059
+ this.z = z;
3060
+ this.angle = angle;
3061
+ }
3062
+ toString() {
3063
+ const {
3064
+ x,
3065
+ y,
3066
+ z
3067
+ } = this;
3068
+ switch (true) {
3069
+ case x === 1 && y === 0 && z === 0:
3070
+ return `rotateX(${this.angle.toString()})`;
3071
+ case x === 0 && y === 1 && z === 0:
3072
+ return `rotateY(${this.angle.toString()})`;
3073
+ case x === 0 && y === 0 && z === 1:
3074
+ return `rotateZ(${this.angle.toString()})`;
3075
+ default:
3076
+ return `rotate3d(${this.x}, ${this.y}, ${this.z}, ${this.angle.toString()})`;
3077
+ }
3078
+ }
3079
+ static get parser() {
3080
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(v => v[4].value).where(v => v === 'rotate3d'), _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Number.map(v => v[4].value), _tokenParser.TokenParser.tokens.Number.map(v => v[4].value), _tokenParser.TokenParser.tokens.Number.map(v => v[4].value), _angle.Angle.parser).separatedBy(_tokenParser.TokenParser.tokens.Comma.skip(_tokenParser.TokenParser.tokens.Whitespace.optional)), _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_, [x, y, z, angle]]) => new Rotate3d(x, y, z, angle));
3081
+ }
3082
+ }
3083
+ transformFunction$1.Rotate3d = Rotate3d;
3084
+ class Scale extends TransformFunction {
3085
+ constructor(sx, sy) {
3086
+ super();
3087
+ this.sx = sx;
3088
+ this.sy = sy ?? undefined;
3089
+ }
3090
+ toString() {
3091
+ const {
3092
+ sx,
3093
+ sy
3094
+ } = this;
3095
+ if (sy == null) {
3096
+ return `scale(${sx.toString()})`;
3097
+ }
3098
+ return `scale(${sx.toString()}, ${sy.toString()})`;
3099
+ }
3100
+ static get parser() {
3101
+ const scalesXY = _tokenParser.TokenParser.sequence(_commonTypes.numberOrPercentage.map(v => v instanceof _commonTypes.Percentage ? v.value / 100 : v), _commonTypes.numberOrPercentage.map(v => v instanceof _commonTypes.Percentage ? v.value / 100 : v).optional).separatedBy(_tokenParser.TokenParser.tokens.Comma).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional);
3102
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(v => v[4].value).where(v => v === 'scale'), scalesXY, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_, [sx, sy]]) => new Scale(sx, sy));
3103
+ }
3104
+ }
3105
+ transformFunction$1.Scale = Scale;
3106
+ class Scale3d extends TransformFunction {
3107
+ constructor(sx, sy, sz) {
3108
+ super();
3109
+ this.sx = sx;
3110
+ this.sy = sy;
3111
+ this.sz = sz;
3112
+ }
3113
+ toString() {
3114
+ return `scale3d(${this.sx.toString()}, ${this.sy.toString()}, ${this.sz.toString()})`;
3115
+ }
3116
+ static get parser() {
3117
+ const numberOrPercentageAsNumber = _commonTypes.numberOrPercentage.map(v => v instanceof _commonTypes.Percentage ? v.value / 100 : v);
3118
+ const args = _tokenParser.TokenParser.sequence(numberOrPercentageAsNumber, numberOrPercentageAsNumber, numberOrPercentageAsNumber).separatedBy(_tokenParser.TokenParser.tokens.Comma).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional);
3119
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.fn('scale3d'), args, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_, [sx, sy, sz]]) => new Scale3d(sx, sy, sz));
3120
+ }
3121
+ }
3122
+ transformFunction$1.Scale3d = Scale3d;
3123
+ class ScaleAxis extends TransformFunction {
3124
+ constructor(s, axis) {
3125
+ super();
3126
+ this.s = s;
3127
+ this.axis = axis;
3128
+ }
3129
+ toString() {
3130
+ return `scale${this.axis}(${this.s.toString()})`;
3131
+ }
3132
+ static get parser() {
3133
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.oneOf(_tokenParser.TokenParser.fn('scaleX').map(() => 'X'), _tokenParser.TokenParser.fn('scaleY').map(() => 'Y'), _tokenParser.TokenParser.fn('scaleZ').map(() => 'Z')), _commonTypes.numberOrPercentage.map(v => v instanceof _commonTypes.Percentage ? v.value / 100 : v), _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([axis, s]) => new ScaleAxis(s, axis));
3134
+ }
3135
+ }
3136
+ transformFunction$1.ScaleAxis = ScaleAxis;
3137
+ class Skew extends TransformFunction {
3138
+ constructor(ax, ay) {
3139
+ super();
3140
+ this.ax = ax;
3141
+ this.ay = ay ?? undefined;
3142
+ }
3143
+ toString() {
3144
+ const {
3145
+ ax,
3146
+ ay
3147
+ } = this;
3148
+ if (ay == null) {
3149
+ return `skew(${ax.toString()})`;
3150
+ }
3151
+ return `skew(${ax.toString()}, ${ay.toString()})`;
3152
+ }
3153
+ static get parser() {
3154
+ const args = _tokenParser.TokenParser.oneOf(_tokenParser.TokenParser.sequence(_angle.Angle.parser, _angle.Angle.parser).separatedBy(_tokenParser.TokenParser.tokens.Comma.skip(_tokenParser.TokenParser.tokens.Whitespace.optional)), _angle.Angle.parser).map(arg => {
3155
+ if (Array.isArray(arg)) {
3156
+ return arg;
3157
+ }
3158
+ return [arg, null];
3159
+ });
3160
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(v => v[4].value).where(v => v === 'skew'), args, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_, [ax, ay]]) => new Skew(ax, ay));
3161
+ }
3162
+ }
3163
+ transformFunction$1.Skew = Skew;
3164
+ class SkewAxis extends TransformFunction {
3165
+ constructor(a, axis) {
3166
+ super();
3167
+ this.a = a;
3168
+ this.axis = axis;
3169
+ }
3170
+ toString() {
3171
+ return `skew${this.axis}(${this.a.toString()})`;
3172
+ }
3173
+ static get parser() {
3174
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.oneOf(_tokenParser.TokenParser.fn('skewX').map(() => 'X'), _tokenParser.TokenParser.fn('skewY').map(() => 'Y')), _angle.Angle.parser, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([axis, a]) => new SkewAxis(a, axis));
3175
+ }
3176
+ }
3177
+ transformFunction$1.SkewAxis = SkewAxis;
3178
+ class Translate extends TransformFunction {
3179
+ constructor(tx, ty) {
3180
+ super();
3181
+ this.tx = tx;
3182
+ this.ty = ty ?? undefined;
3183
+ }
3184
+ toString() {
3185
+ const {
3186
+ tx,
3187
+ ty
3188
+ } = this;
3189
+ if (ty == null) {
3190
+ return `translate(${tx.toString()})`;
3191
+ }
3192
+ return `translate(${tx.toString()}, ${ty.toString()})`;
3193
+ }
3194
+ static get parser() {
3195
+ const oneArg = _lengthPercentage.lengthPercentage;
3196
+ const twoArgs = _tokenParser.TokenParser.sequence(_lengthPercentage.lengthPercentage, _lengthPercentage.lengthPercentage).separatedBy(_tokenParser.TokenParser.tokens.Comma.skip(_tokenParser.TokenParser.tokens.Whitespace.optional));
3197
+ const args = _tokenParser.TokenParser.oneOf(twoArgs, oneArg).map(arg => {
3198
+ if (Array.isArray(arg)) {
3199
+ return arg;
3200
+ }
3201
+ return [arg, null];
3202
+ });
3203
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(v => v[4].value).where(v => v === 'translate'), args, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_, [tx, ty]]) => new Translate(tx, ty));
3204
+ }
3205
+ }
3206
+ transformFunction$1.Translate = Translate;
3207
+ class Translate3d extends TransformFunction {
3208
+ constructor(tx, ty, tz) {
3209
+ super();
3210
+ this.tx = tx;
3211
+ this.ty = ty;
3212
+ this.tz = tz;
3213
+ }
3214
+ toString() {
3215
+ return `translate3d(${this.tx.toString()}, ${this.ty.toString()}, ${this.tz.toString()})`;
3216
+ }
3217
+ static get parser() {
3218
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(v => v[4].value).where(v => v === 'translate3d'), _tokenParser.TokenParser.sequence(_lengthPercentage.lengthPercentage, _lengthPercentage.lengthPercentage, _length.Length.parser).separatedBy(_tokenParser.TokenParser.tokens.Comma.skip(_tokenParser.TokenParser.tokens.Whitespace.optional)), _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_, [tx, ty, tz]]) => new Translate3d(tx, ty, tz));
3219
+ }
3220
+ }
3221
+ transformFunction$1.Translate3d = Translate3d;
3222
+ class TranslateAxis extends TransformFunction {
3223
+ constructor(t, axis) {
3224
+ super();
3225
+ this.t = t;
3226
+ this.axis = axis;
3227
+ }
3228
+ toString() {
3229
+ return `translate${this.axis}(${this.t.toString()})`;
3230
+ }
3231
+ static get parser() {
3232
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.oneOf(_tokenParser.TokenParser.fn('translateX').map(() => 'X'), _tokenParser.TokenParser.fn('translateY').map(() => 'Y'), _tokenParser.TokenParser.fn('translateZ').map(() => 'Z')), _lengthPercentage.lengthPercentage, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([axis, t]) => new TranslateAxis(t, axis));
3233
+ }
3234
+ }
3235
+ transformFunction$1.TranslateAxis = TranslateAxis;
3236
+ return transformFunction$1;
3237
+ }
3238
+
3239
+ var hasRequiredTransform;
3240
+
3241
+ function requireTransform () {
3242
+ if (hasRequiredTransform) return transform;
3243
+ hasRequiredTransform = 1;
3244
+
3245
+ Object.defineProperty(transform, "__esModule", {
3246
+ value: true
3247
+ });
3248
+ transform.Transform = void 0;
3249
+ var _tokenParser = requireTokenParser();
3250
+ var _transformFunction = requireTransformFunction();
3251
+ class Transform {
3252
+ constructor(value) {
3253
+ this.value = value;
3254
+ }
3255
+ toString() {
3256
+ return this.value.join(' ');
3257
+ }
3258
+ static get parse() {
3259
+ return _tokenParser.TokenParser.oneOrMore(_transformFunction.TransformFunction.parser).separatedBy(_tokenParser.TokenParser.tokens.Whitespace).map(value => new Transform(value));
3260
+ }
3261
+ }
3262
+ transform.Transform = Transform;
3263
+ return transform;
3264
+ }
3265
+
3266
+ var boxShadow = {};
3267
+
3268
+ var color$1 = {};
3269
+
3270
+ var alphaValue = {};
3271
+
3272
+ var hasRequiredAlphaValue;
3273
+
3274
+ function requireAlphaValue () {
3275
+ if (hasRequiredAlphaValue) return alphaValue;
3276
+ hasRequiredAlphaValue = 1;
3277
+
3278
+ Object.defineProperty(alphaValue, "__esModule", {
3279
+ value: true
3280
+ });
3281
+ alphaValue.AlphaValue = void 0;
3282
+ var _tokenParser = requireTokenParser();
3283
+ class AlphaValue {
3284
+ constructor(value) {
3285
+ this.value = value;
3286
+ }
3287
+ toString() {
3288
+ return this.value.toString();
3289
+ }
3290
+ static parser = _tokenParser.TokenParser.oneOf(_tokenParser.TokenParser.tokens.Percentage.map(v => new AlphaValue((v[4].signCharacter === '-' ? -1 : 1) * v[4].value / 100)), _tokenParser.TokenParser.tokens.Number.map(v => new AlphaValue((v[4].signCharacter === '-' ? -1 : 1) * v[4].value)));
3291
+ }
3292
+ alphaValue.AlphaValue = AlphaValue;
3293
+ return alphaValue;
3294
+ }
3295
+
3296
+ var hasRequiredColor;
3297
+
3298
+ function requireColor () {
3299
+ if (hasRequiredColor) return color$1;
3300
+ hasRequiredColor = 1;
3301
+
3302
+ Object.defineProperty(color$1, "__esModule", {
3303
+ value: true
3304
+ });
3305
+ color$1.Rgba = color$1.Rgb = color$1.Oklch = color$1.Oklab = color$1.NamedColor = color$1.Lch = color$1.Hsla = color$1.Hsl = color$1.HashColor = color$1.Color = void 0;
3306
+ var _tokenParser = requireTokenParser();
3307
+ var _alphaValue = requireAlphaValue();
3308
+ var _angle = requireAngle();
3309
+ var _commonTypes = requireCommonTypes();
3310
+ class Color {
3311
+ static get parser() {
3312
+ return _tokenParser.TokenParser.oneOf(NamedColor.parser, HashColor.parser, Rgb.parser, Rgba.parser, Hsl.parser, Hsla.parser, Lch.parser, Oklch.parser, Oklab.parser);
3313
+ }
3314
+ }
3315
+ color$1.Color = Color;
3316
+ class NamedColor extends Color {
3317
+ constructor(value) {
3318
+ super();
3319
+ this.value = value;
3320
+ }
3321
+ toString() {
3322
+ return this.value;
3323
+ }
3324
+ static parser = _tokenParser.TokenParser.tokens.Ident.map(token => token[4].value).where(str => ['aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'grey', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightgrey', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightslategrey', 'lightsteelblue', 'lightyellow', 'lime', 'limegreen', 'linen', 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'navy', 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'purple', 'rebeccapurple', 'red', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue', 'slateblue', 'slategray', 'slategrey', 'snow', 'springgreen', 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'transparent', 'turquoise', 'violet', 'wheat', 'white', 'whitesmoke', 'yellow', 'yellowgreen'].includes(str)).map(value => new NamedColor(value));
3325
+ }
3326
+ color$1.NamedColor = NamedColor;
3327
+ class HashColor extends Color {
3328
+ constructor(value) {
3329
+ super();
3330
+ this.value = value;
3331
+ }
3332
+ toString() {
3333
+ return `#${this.value}`;
3334
+ }
3335
+ get r() {
3336
+ return parseInt(this.value.slice(0, 2), 16);
3337
+ }
3338
+ get g() {
3339
+ return parseInt(this.value.slice(2, 4), 16);
3340
+ }
3341
+ get b() {
3342
+ return parseInt(this.value.slice(4, 6), 16);
3343
+ }
3344
+ get a() {
3345
+ return this.value.length === 8 ? parseInt(this.value.slice(6, 8), 16) / 255 : 1;
3346
+ }
3347
+ static get parser() {
3348
+ return _tokenParser.TokenParser.tokens.Hash.map(token => token[4].value).where(value => [3, 6, 8].includes(value.length) && /^[0-9a-fA-F]+$/.test(value)).map(value => new HashColor(value));
3349
+ }
3350
+ }
3351
+ color$1.HashColor = HashColor;
3352
+ const rgbNumberParser = _tokenParser.TokenParser.tokens.Number.map(token => token[4].value).where(value => value >= 0 && value <= 255);
3353
+ const alphaAsNumber = _alphaValue.AlphaValue.parser.map(alpha => alpha.value);
3354
+ const slashParser = _tokenParser.TokenParser.tokens.Delim.map(token => token[4].value).where(value => value === '/').surroundedBy(_tokenParser.TokenParser.tokens.Whitespace);
3355
+ class Rgb extends Color {
3356
+ constructor(r, g, b) {
3357
+ super();
3358
+ this.r = r;
3359
+ this.g = g;
3360
+ this.b = b;
3361
+ }
3362
+ toString() {
3363
+ return `rgb(${this.r},${this.g},${this.b})`;
3364
+ }
3365
+ static get parser() {
3366
+ const rgbCommaSeparated = _tokenParser.TokenParser.sequence(rgbNumberParser, rgbNumberParser, rgbNumberParser).separatedBy(_tokenParser.TokenParser.tokens.Comma).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional);
3367
+ const commaParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(token => token[4].value).where(value => value === 'rgb'), rgbCommaSeparated, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_fn, [r, g, b], _closeParen]) => new Rgb(r, g, b));
3368
+ const spaceSeparatedRGB = _tokenParser.TokenParser.sequence(rgbNumberParser, rgbNumberParser, rgbNumberParser).separatedBy(_tokenParser.TokenParser.tokens.Whitespace).surroundedBy(_tokenParser.TokenParser.tokens.Whitespace.optional);
3369
+ const spaceParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(token => token[4].value).where(value => value === 'rgb'), spaceSeparatedRGB, _tokenParser.TokenParser.tokens.CloseParen).map(([_fn, [r, g, b], _closeParen]) => new Rgb(r, g, b));
3370
+ return _tokenParser.TokenParser.oneOf(commaParser, spaceParser);
3371
+ }
3372
+ }
3373
+ color$1.Rgb = Rgb;
3374
+ class Rgba extends Color {
3375
+ constructor(r, g, b, a) {
3376
+ super();
3377
+ this.r = r;
3378
+ this.g = g;
3379
+ this.b = b;
3380
+ this.a = a;
3381
+ }
3382
+ toString() {
3383
+ return `rgba(${this.r},${this.g},${this.b},${this.a})`;
3384
+ }
3385
+ static get parser() {
3386
+ const commaParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(token => token[4].value).where(value => value === 'rgba'), rgbNumberParser, _tokenParser.TokenParser.tokens.Comma, rgbNumberParser, _tokenParser.TokenParser.tokens.Comma, rgbNumberParser, _tokenParser.TokenParser.tokens.Comma, alphaAsNumber, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_fn, r, _comma, g, _comma2, b, _comma3, a, _closeParen]) => new Rgba(r, g, b, a));
3387
+ const spaceParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(token => token[4].value).where(value => value === 'rgb'), _tokenParser.TokenParser.tokens.Whitespace.optional, rgbNumberParser, _tokenParser.TokenParser.tokens.Whitespace, rgbNumberParser, _tokenParser.TokenParser.tokens.Whitespace, rgbNumberParser, slashParser, alphaAsNumber, _tokenParser.TokenParser.tokens.Whitespace.optional, _tokenParser.TokenParser.tokens.CloseParen).map(([_fn, _preSpace, r, _space, g, _space2, b, _slash, a, _postSpace, _closeParen]) => new Rgba(r, g, b, a));
3388
+ return _tokenParser.TokenParser.oneOf(commaParser, spaceParser);
3389
+ }
3390
+ }
3391
+ color$1.Rgba = Rgba;
3392
+ class Hsl extends Color {
3393
+ constructor(h, s, l) {
3394
+ super();
3395
+ this.h = h;
3396
+ this.s = s;
3397
+ this.l = l;
3398
+ }
3399
+ toString() {
3400
+ return `hsl(${this.h.toString()},${this.s.toString()},${this.l.toString()})`;
3401
+ }
3402
+ static get parser() {
3403
+ const commaParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(token => token[4].value).where(value => value === 'hsl'), _angle.Angle.parser, _tokenParser.TokenParser.tokens.Comma, _commonTypes.Percentage.parser, _tokenParser.TokenParser.tokens.Comma, _commonTypes.Percentage.parser, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(tokens => new Hsl(tokens[1], tokens[3], tokens[5]));
3404
+ const spaceParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(token => token[4].value).where(value => value === 'hsl'), _angle.Angle.parser, _tokenParser.TokenParser.tokens.Whitespace, _commonTypes.Percentage.parser, _tokenParser.TokenParser.tokens.Whitespace, _commonTypes.Percentage.parser, _tokenParser.TokenParser.tokens.Whitespace, _tokenParser.TokenParser.tokens.CloseParen).map(tokens => new Hsl(tokens[1], tokens[3], tokens[5]));
3405
+ return _tokenParser.TokenParser.oneOf(commaParser, spaceParser);
3406
+ }
3407
+ }
3408
+ color$1.Hsl = Hsl;
3409
+ class Hsla extends Color {
3410
+ constructor(h, s, l, a) {
3411
+ super();
3412
+ this.h = h;
3413
+ this.s = s;
3414
+ this.l = l;
3415
+ this.a = a;
3416
+ }
3417
+ toString() {
3418
+ return `hsla(${this.h.toString()},${this.s.toString()},${this.l.toString()},${this.a})`;
3419
+ }
3420
+ static get parser() {
3421
+ const commaParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(token => token[4].value).where(value => value === 'hsla'), _angle.Angle.parser, _tokenParser.TokenParser.tokens.Comma, _commonTypes.Percentage.parser, _tokenParser.TokenParser.tokens.Comma, _commonTypes.Percentage.parser, _tokenParser.TokenParser.tokens.Comma, alphaAsNumber, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_fn, h, _comma, s, _comma2, l, _comma3, a, _closeParen]) => new Hsla(h, s, l, a));
3422
+ const spaceParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(token => token[4].value).where(value => value === 'hsl'), _angle.Angle.parser, _tokenParser.TokenParser.tokens.Whitespace, _commonTypes.Percentage.parser, _tokenParser.TokenParser.tokens.Whitespace, _commonTypes.Percentage.parser, slashParser, alphaAsNumber, _tokenParser.TokenParser.tokens.Whitespace.optional, _tokenParser.TokenParser.tokens.CloseParen).map(([_fn, h, _space, s, _space2, l, _slash, a, _postSpace, _closeParen]) => new Hsla(h, s, l, a));
3423
+ return _tokenParser.TokenParser.oneOf(commaParser, spaceParser);
3424
+ }
3425
+ }
3426
+ color$1.Hsla = Hsla;
3427
+ class Lch extends Color {
3428
+ constructor(l, c, h, alpha) {
3429
+ super();
3430
+ this.l = l;
3431
+ this.c = c;
3432
+ this.h = h;
3433
+ this.alpha = alpha;
3434
+ }
3435
+ toString() {
3436
+ return `lch(${this.l} ${this.c} ${this.h.toString()}${this.alpha ? ` / ${this.alpha}` : ''})`;
3437
+ }
3438
+ static get parser() {
3439
+ const l = _tokenParser.TokenParser.oneOf(_commonTypes.Percentage.parser.map(p => p.value), _tokenParser.TokenParser.tokens.Number.map(token => token[4].value).where(value => value >= 0), _tokenParser.TokenParser.tokens.Ident.map(token => token[4].value).where(value => value === 'none').map(() => 0));
3440
+ const c = _tokenParser.TokenParser.oneOf(_commonTypes.Percentage.parser.map(p => 150 * p.value / 100), _tokenParser.TokenParser.tokens.Number.map(token => token[4].value).where(value => value >= 0));
3441
+ const h = _tokenParser.TokenParser.oneOf(_angle.Angle.parser, _tokenParser.TokenParser.tokens.Number.map(token => token[4].value));
3442
+ const a = _tokenParser.TokenParser.sequence(slashParser, alphaAsNumber).separatedBy(_tokenParser.TokenParser.tokens.Whitespace).map(([_, a]) => a);
3443
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(token => token[4].value).where(value => value === 'lch'), _tokenParser.TokenParser.sequence(l, c, h).separatedBy(_tokenParser.TokenParser.tokens.Whitespace), a.suffix(_tokenParser.TokenParser.tokens.Whitespace.optional).optional, _tokenParser.TokenParser.tokens.CloseParen).map(([_fn, [l, c, h], a, _closeParen]) => new Lch(l, c, h, a));
3444
+ }
3445
+ }
3446
+ color$1.Lch = Lch;
3447
+ class Oklch extends Color {
3448
+ constructor(l, c, h, alpha) {
3449
+ super();
3450
+ this.l = l;
3451
+ this.c = c;
3452
+ this.h = h;
3453
+ this.alpha = alpha;
3454
+ }
3455
+ toString() {
3456
+ return `oklch(${this.l} ${this.c} ${this.h.toString()}${this.alpha ? ` / ${this.alpha}` : ''})`;
3457
+ }
3458
+ static get parser() {
3459
+ const lc = _tokenParser.TokenParser.oneOf(alphaAsNumber, _tokenParser.TokenParser.tokens.Ident.map(token => token[4].value).where(value => value === 'none').map(() => 0)).prefix(_tokenParser.TokenParser.tokens.Whitespace.optional);
3460
+ const h = _tokenParser.TokenParser.oneOf(_angle.Angle.parser, lc.map(num => new _angle.Angle(num * 360, 'deg')));
3461
+ const a = _tokenParser.TokenParser.sequence(slashParser, alphaAsNumber).map(([_, a]) => a);
3462
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(token => token[4].value).where(value => value === 'oklch'), lc, _tokenParser.TokenParser.tokens.Whitespace, lc, _tokenParser.TokenParser.tokens.Whitespace, h, a.suffix(_tokenParser.TokenParser.tokens.Whitespace.optional).optional, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_fn, l, _comma, c, _comma2, h, a, _closeParen]) => new Lch(l, c, h, a));
3463
+ }
3464
+ }
3465
+ color$1.Oklch = Oklch;
3466
+ class Oklab extends Color {
3467
+ constructor(l, a, b, alpha) {
3468
+ super();
3469
+ this.l = l;
3470
+ this.a = a;
3471
+ this.b = b;
3472
+ this.alpha = alpha;
3473
+ }
3474
+ toString() {
3475
+ return `oklab(${this.l} ${this.a} ${this.b}${this.alpha ? ` / ${this.alpha}` : ''})`;
3476
+ }
3477
+ static get parser() {
3478
+ const lab = _tokenParser.TokenParser.oneOf(alphaAsNumber, _tokenParser.TokenParser.tokens.Ident.map(token => token[4].value).where(value => value === 'none').map(() => 0)).prefix(_tokenParser.TokenParser.tokens.Whitespace.optional);
3479
+ const a = _tokenParser.TokenParser.sequence(slashParser, alphaAsNumber).map(([_, a]) => a);
3480
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(token => token[4].value).where(value => value === 'oklab'), lab, _tokenParser.TokenParser.tokens.Whitespace, lab, _tokenParser.TokenParser.tokens.Whitespace, lab, a.suffix(_tokenParser.TokenParser.tokens.Whitespace.optional).optional, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_fn, l, _comma, a, _comma2, b, alpha, _closeParen]) => new Oklab(l, a, b, alpha));
3481
+ }
3482
+ }
3483
+ color$1.Oklab = Oklab;
3484
+ return color$1;
3485
+ }
3486
+
3487
+ var hasRequiredBoxShadow;
3488
+
3489
+ function requireBoxShadow () {
3490
+ if (hasRequiredBoxShadow) return boxShadow;
3491
+ hasRequiredBoxShadow = 1;
3492
+
3493
+ Object.defineProperty(boxShadow, "__esModule", {
3494
+ value: true
3495
+ });
3496
+ boxShadow.BoxShadowList = boxShadow.BoxShadow = void 0;
3497
+ var _tokenParser = requireTokenParser();
3498
+ var _length = requireLength();
3499
+ var _color = requireColor();
3500
+ class BoxShadow {
3501
+ constructor(offsetX, offsetY, blurRadius, spreadRadius, color, inset = false) {
3502
+ this.offsetX = offsetX;
3503
+ this.offsetY = offsetY;
3504
+ this.blurRadius = blurRadius;
3505
+ this.spreadRadius = spreadRadius;
3506
+ this.color = color;
3507
+ this.inset = inset;
3508
+ }
3509
+ static get parse() {
3510
+ const outerShadow = _tokenParser.TokenParser.sequence(_length.Length.parser, _length.Length.parser, _length.Length.parser.optional, _length.Length.parser.optional, _color.Color.parser).separatedBy(_tokenParser.TokenParser.tokens.Whitespace).map(([offsetX, offsetY, blurRadius, spreadRadius, color]) => new BoxShadow(offsetX, offsetY, blurRadius ?? new _length.Length(0, 'px'), spreadRadius ?? new _length.Length(0, 'px'), color));
3511
+ const insetShadow = _tokenParser.TokenParser.sequence(outerShadow, _tokenParser.TokenParser.string('inset')).separatedBy(_tokenParser.TokenParser.tokens.Whitespace).map(([shadow, _inset]) => new BoxShadow(shadow.offsetX, shadow.offsetY, shadow.blurRadius, shadow.spreadRadius, shadow.color, true));
3512
+ return _tokenParser.TokenParser.oneOf(insetShadow, outerShadow);
3513
+ }
3514
+ }
3515
+ boxShadow.BoxShadow = BoxShadow;
3516
+ class BoxShadowList {
3517
+ constructor(shadows) {
3518
+ this.shadows = shadows;
3519
+ }
3520
+ static get parse() {
3521
+ return _tokenParser.TokenParser.oneOrMore(BoxShadow.parse).separatedBy(_tokenParser.TokenParser.tokens.Comma.surroundedBy(_tokenParser.TokenParser.tokens.Whitespace.optional)).map(shadows => new BoxShadowList(shadows));
3522
+ }
3523
+ }
3524
+ boxShadow.BoxShadowList = BoxShadowList;
3525
+ return boxShadow;
3526
+ }
3527
+
3528
+ var borderRadius = {};
3529
+
3530
+ var hasRequiredBorderRadius;
3531
+
3532
+ function requireBorderRadius () {
3533
+ if (hasRequiredBorderRadius) return borderRadius;
3534
+ hasRequiredBorderRadius = 1;
3535
+
3536
+ Object.defineProperty(borderRadius, "__esModule", {
3537
+ value: true
3538
+ });
3539
+ borderRadius.BorderRadiusShorthand = borderRadius.BorderRadiusIndividual = void 0;
3540
+ var _tokenParser = requireTokenParser();
3541
+ var _lengthPercentage = requireLengthPercentage();
3542
+ class BorderRadiusIndividual {
3543
+ constructor(horizontal, vertical) {
3544
+ this.horizontal = horizontal;
3545
+ this.vertical = vertical ?? horizontal;
3546
+ }
3547
+ toString() {
3548
+ const horizontal = this.horizontal.toString();
3549
+ const vertical = this.vertical.toString();
3550
+ if (horizontal === vertical) {
3551
+ return horizontal;
3552
+ }
3553
+ return `${horizontal} ${vertical}`;
3554
+ }
3555
+ static get parse() {
3556
+ return _tokenParser.TokenParser.oneOf(_tokenParser.TokenParser.sequence(_lengthPercentage.lengthPercentage, _lengthPercentage.lengthPercentage).separatedBy(_tokenParser.TokenParser.tokens.Whitespace), _lengthPercentage.lengthPercentage.map(p => [p, p])).map(([horizontal, vertical]) => new BorderRadiusIndividual(horizontal, vertical));
3557
+ }
3558
+ }
3559
+ borderRadius.BorderRadiusIndividual = BorderRadiusIndividual;
3560
+ class BorderRadiusShorthand {
3561
+ constructor(horizontalTopLeft, horizontalTopRight = horizontalTopLeft, horizontalBottomRight = horizontalTopLeft, horizontalBottomLeft = horizontalTopRight, verticalTopLeft = horizontalTopLeft, verticalTopRight = verticalTopLeft, verticalBottomRight = verticalTopLeft, verticalBottomLeft = verticalTopRight) {
3562
+ this.horizontalTopLeft = horizontalTopLeft;
3563
+ this.horizontalTopRight = horizontalTopRight;
3564
+ this.horizontalBottomRight = horizontalBottomRight;
3565
+ this.horizontalBottomLeft = horizontalBottomLeft;
3566
+ this.verticalTopLeft = verticalTopLeft;
3567
+ this.verticalTopRight = verticalTopRight;
3568
+ this.verticalBottomRight = verticalBottomRight;
3569
+ this.verticalBottomLeft = verticalBottomLeft;
3570
+ }
3571
+ toString() {
3572
+ const horizontalTopLeft = this.horizontalTopLeft.toString();
3573
+ const horizontalTopRight = this.horizontalTopRight.toString();
3574
+ const horizontalBottomRight = this.horizontalBottomRight.toString();
3575
+ const horizontalBottomLeft = this.horizontalBottomLeft.toString();
3576
+ let pStr = `${horizontalTopLeft} ${horizontalTopRight} ${horizontalBottomRight} ${horizontalBottomLeft}`;
3577
+ if (horizontalTopLeft === horizontalTopRight && horizontalTopRight === horizontalBottomRight && horizontalBottomRight === horizontalBottomLeft) {
3578
+ pStr = horizontalTopLeft;
3579
+ } else if (horizontalTopLeft === horizontalBottomRight && horizontalTopRight === horizontalBottomLeft) {
3580
+ pStr = `${horizontalTopLeft} ${horizontalTopRight}`;
3581
+ } else if (horizontalTopRight === horizontalBottomLeft) {
3582
+ pStr = `${horizontalTopLeft} ${horizontalTopRight} ${horizontalBottomRight}`;
3583
+ }
3584
+ const verticalTopLeft = this.verticalTopLeft.toString();
3585
+ const verticalTopRight = this.verticalTopRight.toString();
3586
+ const verticalBottomRight = this.verticalBottomRight.toString();
3587
+ const verticalBottomLeft = this.verticalBottomLeft.toString();
3588
+ let sStr = `${horizontalTopLeft} ${horizontalTopRight} ${horizontalBottomRight} ${horizontalBottomLeft}`;
3589
+ if (verticalTopLeft === verticalTopRight && verticalTopRight === verticalBottomRight && verticalBottomRight === verticalBottomLeft) {
3590
+ sStr = verticalTopLeft;
3591
+ } else if (verticalTopLeft === verticalBottomRight && verticalTopRight === verticalBottomLeft) {
3592
+ sStr = `${verticalTopLeft} ${verticalTopRight}`;
3593
+ } else if (verticalTopRight === verticalBottomLeft) {
3594
+ sStr = `${verticalTopLeft} ${verticalTopRight} ${verticalBottomRight}`;
3595
+ }
3596
+ if (pStr === sStr) {
3597
+ return pStr;
3598
+ }
3599
+ return `${pStr} / ${sStr}`;
3600
+ }
3601
+ static get parse() {
3602
+ const spaceSeparatedRadii = _tokenParser.TokenParser.sequence(_lengthPercentage.lengthPercentage, _lengthPercentage.lengthPercentage.prefix(_tokenParser.TokenParser.tokens.Whitespace).optional, _lengthPercentage.lengthPercentage.prefix(_tokenParser.TokenParser.tokens.Whitespace).optional, _lengthPercentage.lengthPercentage.prefix(_tokenParser.TokenParser.tokens.Whitespace).optional).map(([topLeft, topRight = topLeft, bottomRight = topLeft, bottomLeft = topRight]) => [topLeft, topRight, bottomRight, bottomLeft]);
3603
+ const assymtricBorder = _tokenParser.TokenParser.sequence(spaceSeparatedRadii, spaceSeparatedRadii).separatedBy(_tokenParser.TokenParser.tokens.Delim.map(delim => delim[4].value).where(d => d === '/').surroundedBy(_tokenParser.TokenParser.tokens.Whitespace)).map(([pRadii, sRadii = pRadii]) => new BorderRadiusShorthand(...pRadii, ...sRadii));
3604
+ return _tokenParser.TokenParser.oneOf(assymtricBorder, spaceSeparatedRadii.map(borders => new BorderRadiusShorthand(...borders)));
3605
+ }
3606
+ }
3607
+ borderRadius.BorderRadiusShorthand = BorderRadiusShorthand;
3608
+ return borderRadius;
3609
+ }
3610
+
3611
+ var hasRequiredProperties;
3612
+
3613
+ function requireProperties () {
3614
+ if (hasRequiredProperties) return properties;
3615
+ hasRequiredProperties = 1;
3616
+ (function (exports) {
3617
+
3618
+ Object.defineProperty(exports, "__esModule", {
3619
+ value: true
3620
+ });
3621
+ Object.defineProperty(exports, "BorderRadiusIndividual", {
3622
+ enumerable: true,
3623
+ get: function () {
3624
+ return _borderRadius.BorderRadiusIndividual;
3625
+ }
3626
+ });
3627
+ Object.defineProperty(exports, "BorderRadiusShorthand", {
3628
+ enumerable: true,
3629
+ get: function () {
3630
+ return _borderRadius.BorderRadiusShorthand;
3631
+ }
3632
+ });
3633
+ Object.defineProperty(exports, "BoxShadow", {
3634
+ enumerable: true,
3635
+ get: function () {
3636
+ return _boxShadow.BoxShadow;
3637
+ }
3638
+ });
3639
+ Object.defineProperty(exports, "BoxShadowList", {
3640
+ enumerable: true,
3641
+ get: function () {
3642
+ return _boxShadow.BoxShadowList;
3643
+ }
3644
+ });
3645
+ Object.defineProperty(exports, "Transform", {
3646
+ enumerable: true,
3647
+ get: function () {
3648
+ return _transform.Transform;
3649
+ }
3650
+ });
3651
+ var _transform = requireTransform();
3652
+ var _boxShadow = requireBoxShadow();
3653
+ var _borderRadius = requireBorderRadius();
3654
+ } (properties));
3655
+ return properties;
3656
+ }
3657
+
3658
+ var mediaQueryTransform = {};
3659
+
3660
+ var mediaQuery = {};
3661
+
3662
+ var calc = {};
3663
+
3664
+ var calcConstant = {};
3665
+
3666
+ var hasRequiredCalcConstant;
3667
+
3668
+ function requireCalcConstant () {
3669
+ if (hasRequiredCalcConstant) return calcConstant;
3670
+ hasRequiredCalcConstant = 1;
3671
+
3672
+ Object.defineProperty(calcConstant, "__esModule", {
3673
+ value: true
3674
+ });
3675
+ calcConstant.calcConstant = calcConstant.allCalcConstants = void 0;
3676
+ var _tokenParser = requireTokenParser();
3677
+ calcConstant.allCalcConstants = ['pi', 'e', 'infinity', '-infinity', 'NaN'];
3678
+ calcConstant.calcConstant = _tokenParser.TokenParser.oneOf(_tokenParser.TokenParser.string('pi'), _tokenParser.TokenParser.string('e'), _tokenParser.TokenParser.string('infinity'), _tokenParser.TokenParser.string('-infinity'), _tokenParser.TokenParser.string('NaN'));
3679
+ return calcConstant;
3680
+ }
3681
+
3682
+ var hasRequiredCalc;
3683
+
3684
+ function requireCalc () {
3685
+ if (hasRequiredCalc) return calc;
3686
+ hasRequiredCalc = 1;
3687
+
3688
+ Object.defineProperty(calc, "__esModule", {
3689
+ value: true
3690
+ });
3691
+ calc.valueParser = calc.Calc = void 0;
3692
+ var _calcConstant = requireCalcConstant();
3693
+ var _commonTypes = requireCommonTypes();
3694
+ var _tokenParser = requireTokenParser();
3695
+ const valueParser = calc.valueParser = _tokenParser.TokenParser.oneOf(_calcConstant.calcConstant, _tokenParser.TokenParser.tokens.Number.map(number => number[4].value), _tokenParser.TokenParser.tokens.Dimension.map(dimension => dimension[4]), _commonTypes.Percentage.parser);
3696
+ const composeAddAndSubtraction = valuesAndOperators => {
3697
+ if (valuesAndOperators.length === 1) {
3698
+ if (typeof valuesAndOperators[0] === 'string') {
3699
+ if (_calcConstant.allCalcConstants.includes(valuesAndOperators[0])) {
3700
+ return valuesAndOperators[0];
3701
+ }
3702
+ throw new Error('Invalid operator');
3703
+ }
3704
+ return valuesAndOperators[0];
3705
+ }
3706
+ const firstOperator = valuesAndOperators.findIndex(op => op === '+' || op === '-');
3707
+ if (firstOperator === -1) {
3708
+ throw new Error('No valid operator found');
3709
+ }
3710
+ const left = valuesAndOperators.slice(0, firstOperator);
3711
+ const right = valuesAndOperators.slice(firstOperator + 1);
3712
+ if (valuesAndOperators[firstOperator] === '+') {
3713
+ return {
3714
+ type: '+',
3715
+ left: composeAddAndSubtraction(left),
3716
+ right: composeAddAndSubtraction(right)
3717
+ };
3718
+ }
3719
+ return {
3720
+ type: '-',
3721
+ left: composeAddAndSubtraction(left),
3722
+ right: composeAddAndSubtraction(right)
3723
+ };
3724
+ };
3725
+ const splitByMultiplicationOrDivision = valuesAndOperators => {
3726
+ if (valuesAndOperators.length === 1) {
3727
+ if (typeof valuesAndOperators[0] === 'string') {
3728
+ throw new Error('Invalid operator');
3729
+ }
3730
+ return valuesAndOperators[0];
3731
+ }
3732
+ const firstOperator = valuesAndOperators.findIndex(op => op === '*' || op === '/');
3733
+ if (firstOperator === -1) {
3734
+ return composeAddAndSubtraction(valuesAndOperators);
3735
+ }
3736
+ const left = valuesAndOperators.slice(0, firstOperator);
3737
+ const right = valuesAndOperators.slice(firstOperator + 1);
3738
+ if (valuesAndOperators[firstOperator] === '*') {
3739
+ return {
3740
+ type: '*',
3741
+ left: composeAddAndSubtraction(left),
3742
+ right: splitByMultiplicationOrDivision(right)
3743
+ };
3744
+ }
3745
+ return {
3746
+ type: '/',
3747
+ left: composeAddAndSubtraction(left),
3748
+ right: splitByMultiplicationOrDivision(right)
3749
+ };
3750
+ };
3751
+ let operationsParser;
3752
+ const parenthesizedParser = _tokenParser.TokenParser.tokens.OpenParen.skip(_tokenParser.TokenParser.tokens.Whitespace.optional).flatMap(() => operationsParser.skip(_tokenParser.TokenParser.tokens.Whitespace.optional).skip(_tokenParser.TokenParser.tokens.CloseParen)).map(expr => ({
3753
+ type: 'group',
3754
+ expr
3755
+ }));
3756
+ operationsParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.oneOf(valueParser, parenthesizedParser), _tokenParser.TokenParser.zeroOrMore(_tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Delim.map(delim => delim[4].value).where(delim => delim === '*' || delim === '/' || delim === '+' || delim === '-'), _tokenParser.TokenParser.oneOf(valueParser, parenthesizedParser)).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional)).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional)).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([firstValue, restOfTheValues]) => {
3757
+ if (restOfTheValues == null || restOfTheValues.length === 0) {
3758
+ return firstValue;
3759
+ }
3760
+ const valuesAndOperators = [firstValue, ...restOfTheValues.flat()];
3761
+ return splitByMultiplicationOrDivision(valuesAndOperators);
3762
+ });
3763
+ class Calc {
3764
+ constructor(value) {
3765
+ this.value = value;
3766
+ }
3767
+ toString() {
3768
+ return `calc(${calcValueToString(this.value)})`;
3769
+ }
3770
+ static get parser() {
3771
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Function.map(func => func[4].value).where(func => func === 'calc'), _tokenParser.TokenParser.oneOf(operationsParser, valueParser), _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_, value, _closeParen]) => new Calc(value));
3772
+ }
3773
+ }
3774
+ calc.Calc = Calc;
3775
+ function calcValueToString(value) {
3776
+ if (typeof value === 'number') {
3777
+ return value.toString();
3778
+ }
3779
+ if (typeof value === 'string') {
3780
+ return value;
3781
+ }
3782
+ if (value != null && typeof value === 'object' && 'expr' in value) {
3783
+ const group = value;
3784
+ return '(' + calcValueToString(group.expr) + ')';
3785
+ }
3786
+ if (value != null && typeof value === 'object' && 'left' in value && 'right' in value && typeof value.type === 'string') {
3787
+ const opNode = value;
3788
+ return [calcValueToString(opNode.left), opNode.type, calcValueToString(opNode.right)].join(' ');
3789
+ }
3790
+ if (value != null && typeof value === 'object' && 'value' in value && 'unit' in value) {
3791
+ const d = value;
3792
+ return `${d.value}${d.unit}`;
3793
+ }
3794
+ return String(value);
3795
+ }
3796
+ return calc;
3797
+ }
3798
+
3799
+ var messages$1 = {};
3800
+
3801
+ var hasRequiredMessages;
3802
+
3803
+ function requireMessages () {
3804
+ if (hasRequiredMessages) return messages$1;
3805
+ hasRequiredMessages = 1;
3806
+
3807
+ Object.defineProperty(messages$1, "__esModule", {
3808
+ value: true
3809
+ });
3810
+ messages$1.MediaQueryErrors = void 0;
3811
+ messages$1.MediaQueryErrors = {
3812
+ SYNTAX_ERROR: 'Invalid media query syntax.',
3813
+ UNBALANCED_PARENS: 'Unbalanced parentheses in media query.'
3814
+ };
3815
+ return messages$1;
3816
+ }
3817
+
3818
+ var hasRequiredMediaQuery;
3819
+
3820
+ function requireMediaQuery () {
3821
+ if (hasRequiredMediaQuery) return mediaQuery;
3822
+ hasRequiredMediaQuery = 1;
3823
+
3824
+ Object.defineProperty(mediaQuery, "__esModule", {
3825
+ value: true
3826
+ });
3827
+ mediaQuery.MediaQuery = void 0;
3828
+ mediaQuery.validateMediaQuery = validateMediaQuery;
3829
+ var _tokenParser = requireTokenParser();
3830
+ var _calc = requireCalc();
3831
+ var _messages = requireMessages();
3832
+ function adjustDimension(dimension, op, eq, isMaxWidth = false) {
3833
+ let adjustedValue = dimension.value;
3834
+ const epsilon = 0.01;
3835
+ if (eq !== '=') {
3836
+ if (isMaxWidth) {
3837
+ adjustedValue -= epsilon;
3838
+ } else {
3839
+ adjustedValue += epsilon;
3840
+ }
3841
+ }
3842
+ return {
3843
+ ...dimension,
3844
+ value: adjustedValue
3845
+ };
3846
+ }
3847
+ const basicMediaTypeParser = _tokenParser.TokenParser.tokens.Ident.map(token => token[4].value, '.stringValue').where(key => key === 'screen' || key === 'print' || key === 'all');
3848
+ const mediaKeywordParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.string('not').optional, _tokenParser.TokenParser.string('only').optional, basicMediaTypeParser).separatedBy(_tokenParser.TokenParser.tokens.Whitespace).map(([not, only, keyword]) => ({
3849
+ type: 'media-keyword',
3850
+ key: keyword,
3851
+ not: not === 'not',
3852
+ only: only === 'only'
3853
+ }));
3854
+ const mediaWordRuleParser = _tokenParser.TokenParser.tokens.Ident.map(token => token[4].value, '.stringValue').surroundedBy(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.CloseParen).where(key => key === 'color' || key === 'monochrome' || key === 'grid' || key === 'color-index').map(key => ({
3855
+ type: 'word-rule',
3856
+ keyValue: key
3857
+ }));
3858
+ const mediaRuleValueParser = _tokenParser.TokenParser.oneOf(_calc.Calc.parser.map(calc => calc.toString()), _tokenParser.TokenParser.tokens.Dimension.map(token => token[4]), _tokenParser.TokenParser.tokens.Ident.map(token => token[4].value), _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Number.map(token => token[4].value), _tokenParser.TokenParser.tokens.Delim.where(token => token[4].value === '/').map(() => '/'), _tokenParser.TokenParser.tokens.Number.map(token => token[4].value)).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional), _tokenParser.TokenParser.tokens.Number.map(token => token[4].value));
3859
+ const simplePairParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.Ident.map(token => token[4].value, '.stringValue'), _tokenParser.TokenParser.tokens.Colon, mediaRuleValueParser, _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_openParen, key, _colon, value, _closeParen]) => ({
3860
+ type: 'pair',
3861
+ key,
3862
+ value
3863
+ }));
3864
+ const mediaInequalityRuleParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.Ident.map(token => token[4].value, '.stringValue').where(val => val === 'width' || val === 'height'), _tokenParser.TokenParser.tokens.Delim.map(token => token[4].value).where(val => val === '>' || val === '<'), _tokenParser.TokenParser.tokens.Delim.map(token => token[4].value).where(val => val === '=').optional, _tokenParser.TokenParser.tokens.Dimension.map(token => token[4]), _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_openParen, key, op, eq, dimension, _closeParen]) => {
3865
+ const finalKey = op === '>' ? `min-${key}` : `max-${key}`;
3866
+ const isMaxWidth = finalKey.startsWith('max-');
3867
+ const adjustedDimension = adjustDimension(dimension, op, eq, isMaxWidth);
3868
+ return {
3869
+ type: 'pair',
3870
+ key: finalKey,
3871
+ value: adjustedDimension
3872
+ };
3873
+ });
3874
+ const mediaInequalityRuleParserReversed = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.Dimension.map(token => token[4]), _tokenParser.TokenParser.tokens.Delim.map(token => token[4].value).where(val => val === '>' || val === '<'), _tokenParser.TokenParser.tokens.Delim.map(token => token[4].value).where(val => val === '=').optional, _tokenParser.TokenParser.tokens.Ident.map(token => token[4].value, '.stringValue').where(val => val === 'width' || val === 'height'), _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_openParen, dimension, op, eq, key, _closeParen]) => {
3875
+ const finalKey = op === '>' ? `max-${key}` : `min-${key}`;
3876
+ const isMaxWidth = finalKey.startsWith('max-');
3877
+ const adjustedDimension = adjustDimension(dimension, op, eq, isMaxWidth);
3878
+ return {
3879
+ type: 'pair',
3880
+ key: finalKey,
3881
+ value: adjustedDimension
3882
+ };
3883
+ });
3884
+ const combinedInequalityParser = _tokenParser.TokenParser.oneOf(mediaInequalityRuleParser, mediaInequalityRuleParserReversed);
3885
+ const doubleInequalityRuleParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.Dimension.map(token => token[4]), _tokenParser.TokenParser.tokens.Delim.map(token => token[4].value).where(val => val === '>' || val === '<'), _tokenParser.TokenParser.tokens.Delim.map(token => token[4].value).where(val => val === '=').optional, _tokenParser.TokenParser.tokens.Ident.map(token => token[4].value, '.stringValue').where(val => val === 'width' || val === 'height'), _tokenParser.TokenParser.tokens.Delim.map(token => token[4].value).where(val => val === '>' || val === '<'), _tokenParser.TokenParser.tokens.Delim.map(token => token[4].value).where(val => val === '=').optional, _tokenParser.TokenParser.tokens.Dimension.map(token => token[4]), _tokenParser.TokenParser.tokens.CloseParen).separatedBy(_tokenParser.TokenParser.tokens.Whitespace.optional).map(([_openParen, lower, op, eq, key, op2, eq2, upper, _closeParen]) => {
3886
+ const lowerKey = op === '>' ? `max-${key}` : `min-${key}`;
3887
+ const upperKey = op2 === '>' ? `min-${key}` : `max-${key}`;
3888
+ const lowerIsMaxWidth = lowerKey.startsWith('max-');
3889
+ const upperIsMaxWidth = upperKey.startsWith('max-');
3890
+ const lowerValue = adjustDimension(lower, op, eq, lowerIsMaxWidth);
3891
+ const upperValue = adjustDimension(upper, op2, eq2, upperIsMaxWidth);
3892
+ return {
3893
+ type: 'and',
3894
+ rules: [{
3895
+ type: 'pair',
3896
+ key: lowerKey,
3897
+ value: lowerValue
3898
+ }, {
3899
+ type: 'pair',
3900
+ key: upperKey,
3901
+ value: upperValue
3902
+ }]
3903
+ };
3904
+ });
3905
+ const mediaAndRulesParser = _tokenParser.TokenParser.oneOrMore(_tokenParser.TokenParser.oneOf(mediaKeywordParser, () => mediaOrRulesParser.surroundedBy(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.CloseParen), () => mediaAndRulesParser.surroundedBy(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.CloseParen), () => notParser, doubleInequalityRuleParser, combinedInequalityParser, simplePairParser, mediaWordRuleParser)).separatedBy(_tokenParser.TokenParser.string('and').surroundedBy(_tokenParser.TokenParser.tokens.Whitespace)).where(rules => Array.isArray(rules) && rules.length > 1).map(rules => rules.length === 1 ? rules[0] : {
3906
+ type: 'and',
3907
+ rules
3908
+ });
3909
+ const mediaOrRulesParser = _tokenParser.TokenParser.oneOrMore(_tokenParser.TokenParser.oneOf(mediaKeywordParser, () => mediaOrRulesParser.surroundedBy(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.CloseParen), () => mediaAndRulesParser.surroundedBy(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.CloseParen), () => notParser, doubleInequalityRuleParser, combinedInequalityParser, simplePairParser, mediaWordRuleParser)).separatedBy(_tokenParser.TokenParser.string('or').surroundedBy(_tokenParser.TokenParser.tokens.Whitespace)).where(rules => rules.length > 1).map(rules => rules.length === 1 ? rules[0] : {
3910
+ type: 'or',
3911
+ rules
3912
+ });
3913
+ let notParser;
3914
+ const getNormalRuleParser = () => _tokenParser.TokenParser.oneOf(() => basicMediaTypeParser.surroundedBy(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.CloseParen).map(keyword => ({
3915
+ type: 'media-keyword',
3916
+ key: keyword,
3917
+ not: false
3918
+ })), mediaAndRulesParser, mediaOrRulesParser, simplePairParser, mediaWordRuleParser, () => notParser, () => mediaOrRulesParser.surroundedBy(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.CloseParen), () => mediaAndRulesParser.surroundedBy(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.CloseParen)).skip(_tokenParser.TokenParser.tokens.Whitespace.optional);
3919
+ notParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.string('not'), _tokenParser.TokenParser.tokens.Whitespace, getNormalRuleParser(), _tokenParser.TokenParser.tokens.CloseParen).map(([_openParen, _not, _space, rule, _closeParen]) => ({
3920
+ type: 'not',
3921
+ rule
3922
+ }));
3923
+ function isNumericLength(val) {
3924
+ return typeof val === 'object' && val !== null && !Array.isArray(val) && typeof val.value === 'number' && typeof val.unit === 'string' && (val.type === 'integer' || val.type === 'number');
3925
+ }
3926
+ function mergeIntervalsForAnd(rules) {
3927
+ const epsilon = 0.01;
3928
+ const dimensions = ['width', 'height'];
3929
+ const intervals = {
3930
+ width: [],
3931
+ height: []
3932
+ };
3933
+ for (const rule of rules) {
3934
+ if (rule.type === 'not' && rule.rule.type === 'and') {
3935
+ const inner = rule.rule.rules;
3936
+ if (inner.length === 2) {
3937
+ const [left, right] = inner;
3938
+ const leftBranch = mergeIntervalsForAnd([...rules.filter(r => r !== rule), {
3939
+ type: 'not',
3940
+ rule: left
3941
+ }]);
3942
+ const rightBranch = mergeIntervalsForAnd([...rules.filter(r => r !== rule), {
3943
+ type: 'not',
3944
+ rule: right
3945
+ }]);
3946
+ return [{
3947
+ type: 'or',
3948
+ rules: [leftBranch, rightBranch].filter(branch => branch.length > 0).map(branch => branch.length === 1 ? branch[0] : {
3949
+ type: 'and',
3950
+ rules: branch
3951
+ })
3952
+ }];
3953
+ }
3954
+ }
3955
+ }
3956
+ for (const rule of rules) {
3957
+ for (const dim of dimensions) {
3958
+ if (rule.type === 'pair' && (rule.key === `min-${dim}` || rule.key === `max-${dim}`) && isNumericLength(rule.value)) {
3959
+ const val = rule.value;
3960
+ intervals[dim].push(rule.key === `min-${dim}` ? [val.value, Infinity] : [-Infinity, val.value]);
3961
+ break;
3962
+ } else if (rule.type === 'not' && rule.rule && rule.rule.type === 'pair' && (rule.rule.key === `min-${dim}` || rule.rule.key === `max-${dim}`) && isNumericLength(rule.rule.value)) {
3963
+ const val = rule.rule.value;
3964
+ if (rule.rule.key === `min-${dim}`) {
3965
+ intervals[dim].push([-Infinity, val.value - epsilon]);
3966
+ } else {
3967
+ intervals[dim].push([val.value + epsilon, Infinity]);
3968
+ }
3969
+ break;
3970
+ }
3971
+ }
3972
+ if (!(rule.type === 'pair' && (rule.key === 'min-width' || rule.key === 'max-width' || rule.key === 'min-height' || rule.key === 'max-height') && isNumericLength(rule.value) || rule.type === 'not' && rule.rule && rule.rule.type === 'pair' && (rule.rule.key === 'min-width' || rule.rule.key === 'max-width' || rule.rule.key === 'min-height' || rule.rule.key === 'max-height') && isNumericLength(rule.rule.value))) {
3973
+ return rules;
3974
+ }
3975
+ }
3976
+ const result = [];
3977
+ for (const dim of dimensions) {
3978
+ const dimIntervals = intervals[dim];
3979
+ if (dimIntervals.length === 0) continue;
3980
+ let lower = -Infinity;
3981
+ let upper = Infinity;
3982
+ for (const [l, u] of dimIntervals) {
3983
+ if (l > lower) lower = l;
3984
+ if (u < upper) upper = u;
3985
+ }
3986
+ if (lower > upper) {
3987
+ return [];
3988
+ }
3989
+ if (lower !== -Infinity) {
3990
+ result.push({
3991
+ type: 'pair',
3992
+ key: `min-${dim}`,
3993
+ value: {
3994
+ value: lower,
3995
+ unit: 'px',
3996
+ type: 'integer'
3997
+ }
3998
+ });
3999
+ }
4000
+ if (upper !== Infinity) {
4001
+ result.push({
4002
+ type: 'pair',
4003
+ key: `max-${dim}`,
4004
+ value: {
4005
+ value: upper,
4006
+ unit: 'px',
4007
+ type: 'integer'
4008
+ }
4009
+ });
4010
+ }
4011
+ }
4012
+ return result.length > 0 ? result : rules;
4013
+ }
4014
+ function mergeAndSimplifyRanges(rules) {
4015
+ try {
4016
+ return mergeIntervalsForAnd(rules);
4017
+ } catch (e) {
4018
+ return rules;
4019
+ }
4020
+ }
4021
+ class MediaQuery {
4022
+ constructor(queries) {
4023
+ this.queries = MediaQuery.normalize(queries);
4024
+ }
4025
+ toString() {
4026
+ return `@media ${this.#toString(this.queries, true)}`;
4027
+ }
4028
+ #toString(queries, isTopLevel = false) {
4029
+ switch (queries.type) {
4030
+ case 'media-keyword':
4031
+ {
4032
+ const prefix = queries.not ? 'not ' : queries.only ? 'only ' : '';
4033
+ return prefix + queries.key;
4034
+ }
4035
+ case 'word-rule':
4036
+ return `(${queries.keyValue})`;
4037
+ case 'pair':
4038
+ {
4039
+ const {
4040
+ key,
4041
+ value
4042
+ } = queries;
4043
+ if (Array.isArray(value)) {
4044
+ return `(${key}: ${value[0]} / ${value[2]})`;
4045
+ }
4046
+ if (typeof value === 'string') {
4047
+ return `(${key}: ${value})`;
4048
+ }
4049
+ if (value != null && typeof value === 'object' && typeof value.value === 'number' && typeof value.unit === 'string') {
4050
+ const len = value;
4051
+ return `(${key}: ${len.value}${len.unit})`;
4052
+ }
4053
+ if (value != null && typeof value.toString === 'function') {
4054
+ return `(${key}: ${value.toString()})`;
4055
+ }
4056
+ throw new Error(`cannot serialize media-pair value for key "${key}": ${String(value)}`);
4057
+ }
4058
+ case 'not':
4059
+ return queries.rule && (queries.rule.type === 'and' || queries.rule.type === 'or') ? `(not (${this.#toString(queries.rule)}))` : `(not ${this.#toString(queries.rule)})`;
4060
+ case 'and':
4061
+ return queries.rules.map(rule => this.#toString(rule)).join(' and ');
4062
+ case 'or':
4063
+ {
4064
+ const validRules = queries.rules.filter(r => !(r.type === 'or' && r.rules.length === 0));
4065
+ if (validRules.length === 0) return 'not all';
4066
+ if (validRules.length === 1) return this.#toString(validRules[0], isTopLevel);
4067
+ const formattedRules = validRules.map(rule => {
4068
+ if (rule.type === 'and' || rule.type === 'or') {
4069
+ const ruleString = this.#toString(rule);
4070
+ const result = !isTopLevel ? `(${ruleString})` : ruleString;
4071
+ return result;
4072
+ }
4073
+ return this.#toString(rule);
4074
+ });
4075
+ return isTopLevel ? formattedRules.join(', ') : formattedRules.join(' or ');
4076
+ }
4077
+ default:
4078
+ return '';
4079
+ }
4080
+ }
4081
+ static normalize(rule) {
4082
+ switch (rule.type) {
4083
+ case 'and':
4084
+ {
4085
+ const flattened = [];
4086
+ for (const r of rule.rules) {
4087
+ const norm = MediaQuery.normalize(r);
4088
+ if (norm.type === 'and') {
4089
+ flattened.push(...norm.rules);
4090
+ } else {
4091
+ flattened.push(norm);
4092
+ }
4093
+ }
4094
+ const merged = mergeAndSimplifyRanges(flattened);
4095
+ if (merged.length === 0) return {
4096
+ type: 'media-keyword',
4097
+ key: 'all',
4098
+ not: true
4099
+ };
4100
+ return {
4101
+ type: 'and',
4102
+ rules: merged
4103
+ };
4104
+ }
4105
+ case 'or':
4106
+ return {
4107
+ type: 'or',
4108
+ rules: rule.rules.map(r => MediaQuery.normalize(r))
4109
+ };
4110
+ case 'not':
4111
+ {
4112
+ const normalizedOperand = MediaQuery.normalize(rule.rule);
4113
+ if (normalizedOperand.type === 'media-keyword' && normalizedOperand.key === 'all' && normalizedOperand.not) {
4114
+ return {
4115
+ type: 'media-keyword',
4116
+ key: 'all',
4117
+ not: false
4118
+ };
4119
+ }
4120
+ if (normalizedOperand.type === 'not') {
4121
+ return MediaQuery.normalize(normalizedOperand.rule);
4122
+ }
4123
+ return {
4124
+ type: 'not',
4125
+ rule: normalizedOperand
4126
+ };
4127
+ }
4128
+ default:
4129
+ return rule;
4130
+ }
4131
+ }
4132
+ static get parser() {
4133
+ const leadingNotParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.Ident.map(token => token[4].value, '.stringValue').where(key => key === 'not'), _tokenParser.TokenParser.oneOf(() => mediaOrRulesParser.surroundedBy(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.CloseParen), () => mediaAndRulesParser.surroundedBy(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.CloseParen), () => notParser, combinedInequalityParser, simplePairParser, mediaWordRuleParser)).separatedBy(_tokenParser.TokenParser.tokens.Whitespace).map(([_not, queries]) => ({
4134
+ type: 'not',
4135
+ rule: queries
4136
+ }));
4137
+ const normalRuleParser = _tokenParser.TokenParser.oneOf(mediaAndRulesParser, mediaOrRulesParser, mediaKeywordParser, () => notParser, doubleInequalityRuleParser, combinedInequalityParser, simplePairParser, mediaWordRuleParser, () => mediaOrRulesParser.surroundedBy(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.CloseParen), () => mediaAndRulesParser.surroundedBy(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.CloseParen));
4138
+ return _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.AtKeyword.where(token => token[4].value === 'media'), _tokenParser.TokenParser.oneOrMore(_tokenParser.TokenParser.oneOf(leadingNotParser, normalRuleParser)).separatedBy(_tokenParser.TokenParser.tokens.Comma.surroundedBy(_tokenParser.TokenParser.tokens.Whitespace.optional))).separatedBy(_tokenParser.TokenParser.tokens.Whitespace).map(([_at, querySets]) => {
4139
+ const rule = querySets.length > 1 ? {
4140
+ type: 'or',
4141
+ rules: querySets
4142
+ } : querySets[0];
4143
+ return new MediaQuery(rule);
4144
+ });
4145
+ }
4146
+ }
4147
+ mediaQuery.MediaQuery = MediaQuery;
4148
+ function _hasBalancedParens(str) {
4149
+ let count = 0;
4150
+ for (const char of Array.from(str)) {
4151
+ if (char === '(') count++;
4152
+ if (char === ')') count--;
4153
+ if (count < 0) return false;
4154
+ }
4155
+ return count === 0;
4156
+ }
4157
+ function validateMediaQuery(input) {
4158
+ if (!_hasBalancedParens(input)) {
4159
+ throw new Error(_messages.MediaQueryErrors.UNBALANCED_PARENS);
4160
+ }
4161
+ try {
4162
+ return MediaQuery.parser.parseToEnd(input);
4163
+ } catch (err) {
4164
+ throw new Error(_messages.MediaQueryErrors.SYNTAX_ERROR);
4165
+ }
4166
+ }
4167
+ return mediaQuery;
4168
+ }
4169
+
4170
+ var hasRequiredMediaQueryTransform;
4171
+
4172
+ function requireMediaQueryTransform () {
4173
+ if (hasRequiredMediaQueryTransform) return mediaQueryTransform;
4174
+ hasRequiredMediaQueryTransform = 1;
4175
+
4176
+ Object.defineProperty(mediaQueryTransform, "__esModule", {
4177
+ value: true
4178
+ });
4179
+ mediaQueryTransform.lastMediaQueryWinsTransform = lastMediaQueryWinsTransform;
4180
+ var _mediaQuery = requireMediaQuery();
4181
+ function lastMediaQueryWinsTransform(styles) {
4182
+ return dfsProcessQueries(styles, 0);
4183
+ }
4184
+ function combineMediaQueryWithNegations(current, negations) {
4185
+ if (negations.length === 0) {
4186
+ return current;
4187
+ }
4188
+ let combinedAst;
4189
+ if (current.queries.type === 'or') {
4190
+ combinedAst = {
4191
+ type: 'or',
4192
+ rules: current.queries.rules.map(rule => ({
4193
+ type: 'and',
4194
+ rules: [rule, ...negations.map(mq => ({
4195
+ type: 'not',
4196
+ rule: mq.queries
4197
+ }))]
4198
+ }))
4199
+ };
4200
+ } else {
4201
+ combinedAst = {
4202
+ type: 'and',
4203
+ rules: [current.queries, ...negations.map(mq => ({
4204
+ type: 'not',
4205
+ rule: mq.queries
4206
+ }))]
4207
+ };
4208
+ }
4209
+ return new _mediaQuery.MediaQuery(combinedAst);
4210
+ }
4211
+ function dfsProcessQueries(obj, depth) {
4212
+ if (Array.isArray(obj)) {
4213
+ return obj;
4214
+ }
4215
+ const result = {};
4216
+ Object.entries(obj).forEach(([key, value]) => {
4217
+ if (typeof value === 'object' && value !== null) {
4218
+ result[key] = dfsProcessQueries(value, depth + 1);
4219
+ } else {
4220
+ result[key] = value;
4221
+ }
4222
+ });
4223
+ if (depth >= 1 && Object.keys(result).some(key => key.startsWith('@media '))) {
4224
+ const mediaKeys = Object.keys(result).filter(key => key.startsWith('@media '));
4225
+ const negations = [];
4226
+ const accumulatedNegations = [];
4227
+ for (let i = mediaKeys.length - 1; i > 0; i--) {
4228
+ const mediaQuery = _mediaQuery.MediaQuery.parser.parseToEnd(mediaKeys[i]);
4229
+ negations.push(mediaQuery);
4230
+ accumulatedNegations.push([...negations]);
4231
+ }
4232
+ accumulatedNegations.reverse();
4233
+ accumulatedNegations.push([]);
4234
+ for (let i = 0; i < mediaKeys.length; i++) {
4235
+ const currentKey = mediaKeys[i];
4236
+ const currentValue = result[currentKey];
4237
+ const baseMediaQuery = _mediaQuery.MediaQuery.parser.parseToEnd(currentKey);
4238
+ const reversedNegations = [...accumulatedNegations[i]].reverse();
4239
+ const combinedQuery = combineMediaQueryWithNegations(baseMediaQuery, reversedNegations);
4240
+ const newMediaKey = combinedQuery.toString();
4241
+ delete result[currentKey];
4242
+ result[newMediaKey] = currentValue;
4243
+ }
4244
+ }
4245
+ return result;
4246
+ }
4247
+ return mediaQueryTransform;
4248
+ }
4249
+
4250
+ var hasRequiredLib;
4251
+
4252
+ function requireLib () {
4253
+ if (hasRequiredLib) return lib;
4254
+ hasRequiredLib = 1;
4255
+ (function (exports) {
4256
+
4257
+ Object.defineProperty(exports, "__esModule", {
4258
+ value: true
4259
+ });
4260
+ Object.defineProperty(exports, "lastMediaQueryWinsTransform", {
4261
+ enumerable: true,
4262
+ get: function () {
4263
+ return _mediaQueryTransform.lastMediaQueryWinsTransform;
4264
+ }
4265
+ });
4266
+ exports.tokenParser = exports.properties = void 0;
4267
+ var _tokenParser = _interopRequireWildcard(requireTokenParser());
4268
+ exports.tokenParser = _tokenParser;
4269
+ var _properties = _interopRequireWildcard(requireProperties());
4270
+ exports.properties = _properties;
4271
+ var _mediaQueryTransform = requireMediaQueryTransform();
4272
+ 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); }
4273
+ } (lib));
4274
+ return lib;
4275
+ }
4276
+
4277
+ var libExports = requireLib();
4278
+
4279
+ const illegalArgumentLength = (fn, argLength) => `${fn}() should have ${argLength} argument${argLength === 1 ? '' : 's'}.`;
4280
+ const nonStaticValue = fn => `Only static values are allowed inside of a ${fn}() call.`;
4281
+ const nonStyleObject = fn => `${fn}() can only accept an object.`;
4282
+ const nonExportNamedDeclaration = fn => `The return value of ${fn}() must be bound to a named export.`;
4283
+ const unboundCallValue = fn => `${fn}() calls must be bound to a bare variable.`;
4284
+ const cannotGenerateHash = fn => `Unable to generate hash for ${fn}(). Check that the file has a valid extension and that unstable_moduleResolution is configured.`;
4285
+ const DUPLICATE_CONDITIONAL = 'The same pseudo selector or at-rule cannot be used more than once.';
4286
+ const ESCAPED_STYLEX_VALUE = 'Escaping a create() value is not allowed.';
4287
+ const ILLEGAL_NESTED_PSEUDO = "Pseudo objects can't be nested more than one level deep.";
4288
+ const ILLEGAL_PROP_VALUE = 'A style value can only contain an array, string or number.';
4289
+ const ILLEGAL_PROP_ARRAY_VALUE = 'A style array value can only contain strings or numbers.';
4290
+ const ILLEGAL_NAMESPACE_VALUE = 'A StyleX namespace must be an object.';
4291
+ const INVALID_CONST_KEY = 'Keys in defineConsts() cannot start with "--".';
4292
+ const INVALID_PSEUDO = 'Invalid pseudo selector, not on the whitelist.';
4293
+ const INVALID_PSEUDO_OR_AT_RULE = 'Invalid pseudo or at-rule.';
4294
+ const INVALID_MEDIA_QUERY_SYNTAX = 'Invalid media query syntax.';
4295
+ const LINT_UNCLOSED_FUNCTION = 'Rule contains an unclosed function';
4296
+ const LOCAL_ONLY = 'The return value of create() should not be exported.';
4297
+ const NON_OBJECT_KEYFRAME = 'Every frame within a keyframes() call must be an object.';
4298
+ const NON_CONTIGUOUS_VARS = 'All variables passed to firstThatWorks() must be contiguous.';
4299
+ const NO_OBJECT_SPREADS = 'Object spreads are not allowed in create() calls.';
4300
+ const ONLY_NAMED_PARAMETERS_IN_DYNAMIC_STYLE_FUNCTIONS = 'Only named parameters are allowed in Dynamic Style functions. Destructuring, spreading or default values are not allowed.';
4301
+ const ONLY_TOP_LEVEL = 'create() is only allowed at the root of a program.';
4302
+ const UNKNOWN_PROP_KEY = 'Unknown property key';
4303
+ const POSITION_TRY_INVALID_PROPERTY = 'Invalid property in `positionTry()` call. It may only contain, positionAnchor, positionArea, inset properties (top, left, insetInline etc.), margin properties, size properties (height, inlineSize, etc.), and self-alignment properties (alignSelf, justifySelf, placeSelf)';
4304
+ const VIEW_TRANSITION_CLASS_INVALID_PROPERTY = 'Invalid property in `viewTransitionClass()` call. It may only contain group, imagePair, old, and new properties';
4305
+
4306
+ var m = /*#__PURE__*/Object.freeze({
4307
+ __proto__: null,
4308
+ DUPLICATE_CONDITIONAL: DUPLICATE_CONDITIONAL,
4309
+ ESCAPED_STYLEX_VALUE: ESCAPED_STYLEX_VALUE,
4310
+ ILLEGAL_NAMESPACE_VALUE: ILLEGAL_NAMESPACE_VALUE,
4311
+ ILLEGAL_NESTED_PSEUDO: ILLEGAL_NESTED_PSEUDO,
4312
+ ILLEGAL_PROP_ARRAY_VALUE: ILLEGAL_PROP_ARRAY_VALUE,
4313
+ ILLEGAL_PROP_VALUE: ILLEGAL_PROP_VALUE,
4314
+ INVALID_CONST_KEY: INVALID_CONST_KEY,
4315
+ INVALID_MEDIA_QUERY_SYNTAX: INVALID_MEDIA_QUERY_SYNTAX,
4316
+ INVALID_PSEUDO: INVALID_PSEUDO,
4317
+ INVALID_PSEUDO_OR_AT_RULE: INVALID_PSEUDO_OR_AT_RULE,
4318
+ LINT_UNCLOSED_FUNCTION: LINT_UNCLOSED_FUNCTION,
4319
+ LOCAL_ONLY: LOCAL_ONLY,
4320
+ NON_CONTIGUOUS_VARS: NON_CONTIGUOUS_VARS,
4321
+ NON_OBJECT_KEYFRAME: NON_OBJECT_KEYFRAME,
4322
+ NO_OBJECT_SPREADS: NO_OBJECT_SPREADS,
4323
+ ONLY_NAMED_PARAMETERS_IN_DYNAMIC_STYLE_FUNCTIONS: ONLY_NAMED_PARAMETERS_IN_DYNAMIC_STYLE_FUNCTIONS,
4324
+ ONLY_TOP_LEVEL: ONLY_TOP_LEVEL,
4325
+ POSITION_TRY_INVALID_PROPERTY: POSITION_TRY_INVALID_PROPERTY,
4326
+ UNKNOWN_PROP_KEY: UNKNOWN_PROP_KEY,
4327
+ VIEW_TRANSITION_CLASS_INVALID_PROPERTY: VIEW_TRANSITION_CLASS_INVALID_PROPERTY,
4328
+ cannotGenerateHash: cannotGenerateHash,
4329
+ illegalArgumentLength: illegalArgumentLength,
4330
+ nonExportNamedDeclaration: nonExportNamedDeclaration,
4331
+ nonStaticValue: nonStaticValue,
4332
+ nonStyleObject: nonStyleObject,
4333
+ unboundCallValue: unboundCallValue
4334
+ });
4335
+
2354
4336
  function dashify(str) {
2355
4337
  return str.replace(/(^|[a-z])([A-Z])/g, '$1-$2').toLowerCase();
2356
4338
  }
@@ -2499,61 +4481,6 @@ function normalizeZeroDimensions(ast, _) {
2499
4481
  return ast;
2500
4482
  }
2501
4483
 
2502
- const illegalArgumentLength = (fn, argLength) => `${fn}() should have ${argLength} argument${argLength === 1 ? '' : 's'}.`;
2503
- const nonStaticValue = fn => `Only static values are allowed inside of a ${fn}() call.`;
2504
- const nonStyleObject = fn => `${fn}() can only accept an object.`;
2505
- const nonExportNamedDeclaration = fn => `The return value of ${fn}() must be bound to a named export.`;
2506
- const unboundCallValue = fn => `${fn}() calls must be bound to a bare variable.`;
2507
- const cannotGenerateHash = fn => `Unable to generate hash for ${fn}(). Check that the file has a valid extension and that unstable_moduleResolution is configured.`;
2508
- const DUPLICATE_CONDITIONAL = 'The same pseudo selector or at-rule cannot be used more than once.';
2509
- const ESCAPED_STYLEX_VALUE = 'Escaping a create() value is not allowed.';
2510
- const ILLEGAL_NESTED_PSEUDO = "Pseudo objects can't be nested more than one level deep.";
2511
- const ILLEGAL_PROP_VALUE = 'A style value can only contain an array, string or number.';
2512
- const ILLEGAL_PROP_ARRAY_VALUE = 'A style array value can only contain strings or numbers.';
2513
- const ILLEGAL_NAMESPACE_VALUE = 'A StyleX namespace must be an object.';
2514
- const INVALID_CONST_KEY = 'Keys in defineConsts() cannot start with "--".';
2515
- const INVALID_PSEUDO = 'Invalid pseudo selector, not on the whitelist.';
2516
- const INVALID_PSEUDO_OR_AT_RULE = 'Invalid pseudo or at-rule.';
2517
- const LINT_UNCLOSED_FUNCTION = 'Rule contains an unclosed function';
2518
- const LOCAL_ONLY = 'The return value of create() should not be exported.';
2519
- const NON_OBJECT_KEYFRAME = 'Every frame within a keyframes() call must be an object.';
2520
- const NON_CONTIGUOUS_VARS = 'All variables passed to firstThatWorks() must be contiguous.';
2521
- const NO_OBJECT_SPREADS = 'Object spreads are not allowed in create() calls.';
2522
- const ONLY_NAMED_PARAMETERS_IN_DYNAMIC_STYLE_FUNCTIONS = 'Only named parameters are allowed in Dynamic Style functions. Destructuring, spreading or default values are not allowed.';
2523
- const ONLY_TOP_LEVEL = 'create() is only allowed at the root of a program.';
2524
- const UNKNOWN_PROP_KEY = 'Unknown property key';
2525
- const POSITION_TRY_INVALID_PROPERTY = 'Invalid property in `positionTry()` call. It may only contain, positionAnchor, positionArea, inset properties (top, left, insetInline etc.), margin properties, size properties (height, inlineSize, etc.), and self-alignment properties (alignSelf, justifySelf, placeSelf)';
2526
- const VIEW_TRANSITION_CLASS_INVALID_PROPERTY = 'Invalid property in `viewTransitionClass()` call. It may only contain group, imagePair, old, and new properties';
2527
-
2528
- var m = /*#__PURE__*/Object.freeze({
2529
- __proto__: null,
2530
- DUPLICATE_CONDITIONAL: DUPLICATE_CONDITIONAL,
2531
- ESCAPED_STYLEX_VALUE: ESCAPED_STYLEX_VALUE,
2532
- ILLEGAL_NAMESPACE_VALUE: ILLEGAL_NAMESPACE_VALUE,
2533
- ILLEGAL_NESTED_PSEUDO: ILLEGAL_NESTED_PSEUDO,
2534
- ILLEGAL_PROP_ARRAY_VALUE: ILLEGAL_PROP_ARRAY_VALUE,
2535
- ILLEGAL_PROP_VALUE: ILLEGAL_PROP_VALUE,
2536
- INVALID_CONST_KEY: INVALID_CONST_KEY,
2537
- INVALID_PSEUDO: INVALID_PSEUDO,
2538
- INVALID_PSEUDO_OR_AT_RULE: INVALID_PSEUDO_OR_AT_RULE,
2539
- LINT_UNCLOSED_FUNCTION: LINT_UNCLOSED_FUNCTION,
2540
- LOCAL_ONLY: LOCAL_ONLY,
2541
- NON_CONTIGUOUS_VARS: NON_CONTIGUOUS_VARS,
2542
- NON_OBJECT_KEYFRAME: NON_OBJECT_KEYFRAME,
2543
- NO_OBJECT_SPREADS: NO_OBJECT_SPREADS,
2544
- ONLY_NAMED_PARAMETERS_IN_DYNAMIC_STYLE_FUNCTIONS: ONLY_NAMED_PARAMETERS_IN_DYNAMIC_STYLE_FUNCTIONS,
2545
- ONLY_TOP_LEVEL: ONLY_TOP_LEVEL,
2546
- POSITION_TRY_INVALID_PROPERTY: POSITION_TRY_INVALID_PROPERTY,
2547
- UNKNOWN_PROP_KEY: UNKNOWN_PROP_KEY,
2548
- VIEW_TRANSITION_CLASS_INVALID_PROPERTY: VIEW_TRANSITION_CLASS_INVALID_PROPERTY,
2549
- cannotGenerateHash: cannotGenerateHash,
2550
- illegalArgumentLength: illegalArgumentLength,
2551
- nonExportNamedDeclaration: nonExportNamedDeclaration,
2552
- nonStaticValue: nonStaticValue,
2553
- nonStyleObject: nonStyleObject,
2554
- unboundCallValue: unboundCallValue
2555
- });
2556
-
2557
4484
  function detectUnclosedFns(ast, _) {
2558
4485
  ast.walk(node => {
2559
4486
  if (node.type === 'function' && node.unclosed) {
@@ -2580,10 +4507,9 @@ function convertCamelCasedValues(ast, key) {
2580
4507
  }
2581
4508
 
2582
4509
  const normalizers = [detectUnclosedFns, normalizeWhitespace, normalizeTimings, normalizeZeroDimensions, normalizeLeadingZero, normalizeQuotes, convertCamelCasedValues];
2583
- function normalizeValue(value, key, _ref) {
2584
- let {
2585
- enableFontSizePxToRem
2586
- } = _ref;
4510
+ function normalizeValue(value, key, {
4511
+ enableFontSizePxToRem
4512
+ }) {
2587
4513
  if (value == null) {
2588
4514
  return value;
2589
4515
  }
@@ -2640,177 +4566,53 @@ const logicalToPhysical$1 = {
2640
4566
  'inline-end': 'right'
2641
4567
  };
2642
4568
  const legacyValuesPolyfill$1 = {
2643
- float: _ref => {
2644
- let [key, val] = _ref;
2645
- return [key, logicalToPhysical$1[val] ?? val];
2646
- },
2647
- clear: _ref2 => {
2648
- let [key, val] = _ref2;
2649
- return [key, logicalToPhysical$1[val] ?? val];
2650
- }
4569
+ float: ([key, val]) => [key, logicalToPhysical$1[val] ?? val],
4570
+ clear: ([key, val]) => [key, logicalToPhysical$1[val] ?? val]
2651
4571
  };
2652
4572
  const inlinePropertyToLTR = {
2653
- 'margin-inline-start': _ref3 => {
2654
- let [_key, val] = _ref3;
2655
- return ['margin-left', val];
2656
- },
2657
- 'margin-inline-end': _ref4 => {
2658
- let [_key, val] = _ref4;
2659
- return ['margin-right', val];
2660
- },
2661
- 'padding-inline-start': _ref5 => {
2662
- let [_key, val] = _ref5;
2663
- return ['padding-left', val];
2664
- },
2665
- 'padding-inline-end': _ref6 => {
2666
- let [_key, val] = _ref6;
2667
- return ['padding-right', val];
2668
- },
2669
- 'border-inline-start': _ref7 => {
2670
- let [_key, val] = _ref7;
2671
- return ['border-left', val];
2672
- },
2673
- 'border-inline-end': _ref8 => {
2674
- let [_key, val] = _ref8;
2675
- return ['border-right', val];
2676
- },
2677
- 'border-inline-start-width': _ref9 => {
2678
- let [_key, val] = _ref9;
2679
- return ['border-left-width', val];
2680
- },
2681
- 'border-inline-end-width': _ref0 => {
2682
- let [_key, val] = _ref0;
2683
- return ['border-right-width', val];
2684
- },
2685
- 'border-inline-start-color': _ref1 => {
2686
- let [_key, val] = _ref1;
2687
- return ['border-left-color', val];
2688
- },
2689
- 'border-inline-end-color': _ref10 => {
2690
- let [_key, val] = _ref10;
2691
- return ['border-right-color', val];
2692
- },
2693
- 'border-inline-start-style': _ref11 => {
2694
- let [_key, val] = _ref11;
2695
- return ['border-left-style', val];
2696
- },
2697
- 'border-inline-end-style': _ref12 => {
2698
- let [_key, val] = _ref12;
2699
- return ['border-right-style', val];
2700
- },
2701
- 'border-start-start-radius': _ref13 => {
2702
- let [_key, val] = _ref13;
2703
- return ['border-top-left-radius', val];
2704
- },
2705
- 'border-end-start-radius': _ref14 => {
2706
- let [_key, val] = _ref14;
2707
- return ['border-bottom-left-radius', val];
2708
- },
2709
- 'border-start-end-radius': _ref15 => {
2710
- let [_key, val] = _ref15;
2711
- return ['border-top-right-radius', val];
2712
- },
2713
- 'border-end-end-radius': _ref16 => {
2714
- let [_key, val] = _ref16;
2715
- return ['border-bottom-right-radius', val];
2716
- },
2717
- 'inset-inline-start': _ref17 => {
2718
- let [_key, val] = _ref17;
2719
- return ['left', val];
2720
- },
2721
- 'inset-inline-end': _ref18 => {
2722
- let [_key, val] = _ref18;
2723
- return ['right', val];
2724
- }
4573
+ 'margin-inline-start': ([_key, val]) => ['margin-left', val],
4574
+ 'margin-inline-end': ([_key, val]) => ['margin-right', val],
4575
+ 'padding-inline-start': ([_key, val]) => ['padding-left', val],
4576
+ 'padding-inline-end': ([_key, val]) => ['padding-right', val],
4577
+ 'border-inline-start': ([_key, val]) => ['border-left', val],
4578
+ 'border-inline-end': ([_key, val]) => ['border-right', val],
4579
+ 'border-inline-start-width': ([_key, val]) => ['border-left-width', val],
4580
+ 'border-inline-end-width': ([_key, val]) => ['border-right-width', val],
4581
+ 'border-inline-start-color': ([_key, val]) => ['border-left-color', val],
4582
+ 'border-inline-end-color': ([_key, val]) => ['border-right-color', val],
4583
+ 'border-inline-start-style': ([_key, val]) => ['border-left-style', val],
4584
+ 'border-inline-end-style': ([_key, val]) => ['border-right-style', val],
4585
+ 'border-start-start-radius': ([_key, val]) => ['border-top-left-radius', val],
4586
+ 'border-end-start-radius': ([_key, val]) => ['border-bottom-left-radius', val],
4587
+ 'border-start-end-radius': ([_key, val]) => ['border-top-right-radius', val],
4588
+ 'border-end-end-radius': ([_key, val]) => ['border-bottom-right-radius', val],
4589
+ 'inset-inline-start': ([_key, val]) => ['left', val],
4590
+ 'inset-inline-end': ([_key, val]) => ['right', val]
2725
4591
  };
2726
4592
  const propertyToLTR = {
2727
- 'margin-start': _ref19 => {
2728
- let [_key, val] = _ref19;
2729
- return ['margin-left', val];
2730
- },
2731
- 'margin-end': _ref20 => {
2732
- let [_key, val] = _ref20;
2733
- return ['margin-right', val];
2734
- },
2735
- 'padding-start': _ref21 => {
2736
- let [_key, val] = _ref21;
2737
- return ['padding-left', val];
2738
- },
2739
- 'padding-end': _ref22 => {
2740
- let [_key, val] = _ref22;
2741
- return ['padding-right', val];
2742
- },
2743
- 'border-start': _ref23 => {
2744
- let [_key, val] = _ref23;
2745
- return ['border-left', val];
2746
- },
2747
- 'border-end': _ref24 => {
2748
- let [_key, val] = _ref24;
2749
- return ['border-right', val];
2750
- },
2751
- 'border-start-width': _ref25 => {
2752
- let [_key, val] = _ref25;
2753
- return ['border-left-width', val];
2754
- },
2755
- 'border-end-width': _ref26 => {
2756
- let [_key, val] = _ref26;
2757
- return ['border-right-width', val];
2758
- },
2759
- 'border-start-color': _ref27 => {
2760
- let [_key, val] = _ref27;
2761
- return ['border-left-color', val];
2762
- },
2763
- 'border-end-color': _ref28 => {
2764
- let [_key, val] = _ref28;
2765
- return ['border-right-color', val];
2766
- },
2767
- 'border-start-style': _ref29 => {
2768
- let [_key, val] = _ref29;
2769
- return ['border-left-style', val];
2770
- },
2771
- 'border-end-style': _ref30 => {
2772
- let [_key, val] = _ref30;
2773
- return ['border-right-style', val];
2774
- },
2775
- 'border-top-start-radius': _ref31 => {
2776
- let [_key, val] = _ref31;
2777
- return ['border-top-left-radius', val];
2778
- },
2779
- 'border-bottom-start-radius': _ref32 => {
2780
- let [_key, val] = _ref32;
2781
- return ['border-bottom-left-radius', val];
2782
- },
2783
- 'border-top-end-radius': _ref33 => {
2784
- let [_key, val] = _ref33;
2785
- return ['border-top-right-radius', val];
2786
- },
2787
- 'border-bottom-end-radius': _ref34 => {
2788
- let [_key, val] = _ref34;
2789
- return ['border-bottom-right-radius', val];
2790
- },
2791
- float: _ref35 => {
2792
- let [key, val] = _ref35;
2793
- return [key, logicalToPhysical$1[val] ?? val];
2794
- },
2795
- clear: _ref36 => {
2796
- let [key, val] = _ref36;
2797
- return [key, logicalToPhysical$1[val] ?? val];
2798
- },
2799
- start: _ref37 => {
2800
- let [_key, val] = _ref37;
2801
- return ['left', val];
2802
- },
2803
- end: _ref38 => {
2804
- let [_key, val] = _ref38;
2805
- return ['right', val];
2806
- },
2807
- 'background-position': _ref39 => {
2808
- let [key, val] = _ref39;
2809
- return [key, val.split(' ').map(word => word === 'start' || word === 'insetInlineStart' ? 'left' : word === 'end' || word === 'insetInlineEnd' ? 'right' : word).join(' ')];
2810
- }
4593
+ 'margin-start': ([_key, val]) => ['margin-left', val],
4594
+ 'margin-end': ([_key, val]) => ['margin-right', val],
4595
+ 'padding-start': ([_key, val]) => ['padding-left', val],
4596
+ 'padding-end': ([_key, val]) => ['padding-right', val],
4597
+ 'border-start': ([_key, val]) => ['border-left', val],
4598
+ 'border-end': ([_key, val]) => ['border-right', val],
4599
+ 'border-start-width': ([_key, val]) => ['border-left-width', val],
4600
+ 'border-end-width': ([_key, val]) => ['border-right-width', val],
4601
+ 'border-start-color': ([_key, val]) => ['border-left-color', val],
4602
+ 'border-end-color': ([_key, val]) => ['border-right-color', val],
4603
+ 'border-start-style': ([_key, val]) => ['border-left-style', val],
4604
+ 'border-end-style': ([_key, val]) => ['border-right-style', val],
4605
+ 'border-top-start-radius': ([_key, val]) => ['border-top-left-radius', val],
4606
+ 'border-bottom-start-radius': ([_key, val]) => ['border-bottom-left-radius', val],
4607
+ 'border-top-end-radius': ([_key, val]) => ['border-top-right-radius', val],
4608
+ 'border-bottom-end-radius': ([_key, val]) => ['border-bottom-right-radius', val],
4609
+ float: ([key, val]) => [key, logicalToPhysical$1[val] ?? val],
4610
+ clear: ([key, val]) => [key, logicalToPhysical$1[val] ?? val],
4611
+ start: ([_key, val]) => ['left', val],
4612
+ end: ([_key, val]) => ['right', val],
4613
+ 'background-position': ([key, val]) => [key, val.split(' ').map(word => word === 'start' || word === 'insetInlineStart' ? 'left' : word === 'end' || word === 'insetInlineEnd' ? 'right' : word).join(' ')]
2811
4614
  };
2812
- function generateLTR(pair) {
2813
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
4615
+ function generateLTR(pair, options = defaultOptions) {
2814
4616
  const {
2815
4617
  enableLogicalStylesPolyfill,
2816
4618
  styleResolution
@@ -2894,198 +4696,71 @@ const logicalToPhysical = {
2894
4696
  'inline-end': 'left'
2895
4697
  };
2896
4698
  const legacyValuesPolyfill = {
2897
- float: _ref => {
2898
- let [key, val] = _ref;
2899
- return [key, logicalToPhysical[val] ?? val];
2900
- },
2901
- clear: _ref2 => {
2902
- let [key, val] = _ref2;
2903
- return [key, logicalToPhysical[val] ?? val];
2904
- }
4699
+ float: ([key, val]) => [key, logicalToPhysical[val] ?? val],
4700
+ clear: ([key, val]) => [key, logicalToPhysical[val] ?? val]
2905
4701
  };
2906
4702
  const inlinePropertyToRTL = {
2907
- 'margin-inline-start': _ref3 => {
2908
- let [_key, val] = _ref3;
2909
- return ['margin-right', val];
2910
- },
2911
- 'margin-inline-end': _ref4 => {
2912
- let [_key, val] = _ref4;
2913
- return ['margin-left', val];
2914
- },
2915
- 'padding-inline-start': _ref5 => {
2916
- let [_key, val] = _ref5;
2917
- return ['padding-right', val];
2918
- },
2919
- 'padding-inline-end': _ref6 => {
2920
- let [_key, val] = _ref6;
2921
- return ['padding-left', val];
2922
- },
2923
- 'border-inline-start': _ref7 => {
2924
- let [_key, val] = _ref7;
2925
- return ['border-right', val];
2926
- },
2927
- 'border-inline-end': _ref8 => {
2928
- let [_key, val] = _ref8;
2929
- return ['border-left', val];
2930
- },
2931
- 'border-inline-start-width': _ref9 => {
2932
- let [_key, val] = _ref9;
2933
- return ['border-right-width', val];
2934
- },
2935
- 'border-inline-end-width': _ref0 => {
2936
- let [_key, val] = _ref0;
2937
- return ['border-left-width', val];
2938
- },
2939
- 'border-inline-start-color': _ref1 => {
2940
- let [_key, val] = _ref1;
2941
- return ['border-right-color', val];
2942
- },
2943
- 'border-inline-end-color': _ref10 => {
2944
- let [_key, val] = _ref10;
2945
- return ['border-left-color', val];
2946
- },
2947
- 'border-inline-start-style': _ref11 => {
2948
- let [_key, val] = _ref11;
2949
- return ['border-right-style', val];
2950
- },
2951
- 'border-inline-end-style': _ref12 => {
2952
- let [_key, val] = _ref12;
2953
- return ['border-left-style', val];
2954
- },
2955
- 'border-start-start-radius': _ref13 => {
2956
- let [_key, val] = _ref13;
2957
- return ['border-top-right-radius', val];
2958
- },
2959
- 'border-end-start-radius': _ref14 => {
2960
- let [_key, val] = _ref14;
2961
- return ['border-bottom-right-radius', val];
2962
- },
2963
- 'border-start-end-radius': _ref15 => {
2964
- let [_key, val] = _ref15;
2965
- return ['border-top-left-radius', val];
2966
- },
2967
- 'border-end-end-radius': _ref16 => {
2968
- let [_key, val] = _ref16;
2969
- return ['border-bottom-left-radius', val];
2970
- },
2971
- 'inset-inline-start': _ref17 => {
2972
- let [_key, val] = _ref17;
2973
- return ['right', val];
2974
- },
2975
- 'inset-inline-end': _ref18 => {
2976
- let [_key, val] = _ref18;
2977
- return ['left', val];
2978
- }
4703
+ 'margin-inline-start': ([_key, val]) => ['margin-right', val],
4704
+ 'margin-inline-end': ([_key, val]) => ['margin-left', val],
4705
+ 'padding-inline-start': ([_key, val]) => ['padding-right', val],
4706
+ 'padding-inline-end': ([_key, val]) => ['padding-left', val],
4707
+ 'border-inline-start': ([_key, val]) => ['border-right', val],
4708
+ 'border-inline-end': ([_key, val]) => ['border-left', val],
4709
+ 'border-inline-start-width': ([_key, val]) => ['border-right-width', val],
4710
+ 'border-inline-end-width': ([_key, val]) => ['border-left-width', val],
4711
+ 'border-inline-start-color': ([_key, val]) => ['border-right-color', val],
4712
+ 'border-inline-end-color': ([_key, val]) => ['border-left-color', val],
4713
+ 'border-inline-start-style': ([_key, val]) => ['border-right-style', val],
4714
+ 'border-inline-end-style': ([_key, val]) => ['border-left-style', val],
4715
+ 'border-start-start-radius': ([_key, val]) => ['border-top-right-radius', val],
4716
+ 'border-end-start-radius': ([_key, val]) => ['border-bottom-right-radius', val],
4717
+ 'border-start-end-radius': ([_key, val]) => ['border-top-left-radius', val],
4718
+ 'border-end-end-radius': ([_key, val]) => ['border-bottom-left-radius', val],
4719
+ 'inset-inline-start': ([_key, val]) => ['right', val],
4720
+ 'inset-inline-end': ([_key, val]) => ['left', val]
2979
4721
  };
2980
4722
  const propertyToRTL = {
2981
- 'margin-start': _ref19 => {
2982
- let [_key, val] = _ref19;
2983
- return ['margin-right', val];
2984
- },
2985
- 'margin-end': _ref20 => {
2986
- let [_key, val] = _ref20;
2987
- return ['margin-left', val];
2988
- },
2989
- 'padding-start': _ref21 => {
2990
- let [_key, val] = _ref21;
2991
- return ['padding-right', val];
2992
- },
2993
- 'padding-end': _ref22 => {
2994
- let [_key, val] = _ref22;
2995
- return ['padding-left', val];
2996
- },
2997
- 'border-start': _ref23 => {
2998
- let [_key, val] = _ref23;
2999
- return ['border-right', val];
3000
- },
3001
- 'border-end': _ref24 => {
3002
- let [_key, val] = _ref24;
3003
- return ['border-left', val];
3004
- },
3005
- 'border-start-width': _ref25 => {
3006
- let [_key, val] = _ref25;
3007
- return ['border-right-width', val];
3008
- },
3009
- 'border-end-width': _ref26 => {
3010
- let [_key, val] = _ref26;
3011
- return ['border-left-width', val];
3012
- },
3013
- 'border-start-color': _ref27 => {
3014
- let [_key, val] = _ref27;
3015
- return ['border-right-color', val];
3016
- },
3017
- 'border-end-color': _ref28 => {
3018
- let [_key, val] = _ref28;
3019
- return ['border-left-color', val];
3020
- },
3021
- 'border-start-style': _ref29 => {
3022
- let [_key, val] = _ref29;
3023
- return ['border-right-style', val];
3024
- },
3025
- 'border-end-style': _ref30 => {
3026
- let [_key, val] = _ref30;
3027
- return ['border-left-style', val];
3028
- },
3029
- 'border-top-start-radius': _ref31 => {
3030
- let [_key, val] = _ref31;
3031
- return ['border-top-right-radius', val];
3032
- },
3033
- 'border-bottom-start-radius': _ref32 => {
3034
- let [_key, val] = _ref32;
3035
- return ['border-bottom-right-radius', val];
3036
- },
3037
- 'border-top-end-radius': _ref33 => {
3038
- let [_key, val] = _ref33;
3039
- return ['border-top-left-radius', val];
3040
- },
3041
- 'border-bottom-end-radius': _ref34 => {
3042
- let [_key, val] = _ref34;
3043
- return ['border-bottom-left-radius', val];
3044
- },
3045
- float: _ref35 => {
3046
- let [key, val] = _ref35;
3047
- return logicalToPhysical[val] != null ? [key, logicalToPhysical[val]] : null;
3048
- },
3049
- clear: _ref36 => {
3050
- let [key, val] = _ref36;
3051
- return logicalToPhysical[val] != null ? [key, logicalToPhysical[val]] : null;
3052
- },
3053
- start: _ref37 => {
3054
- let [_key, val] = _ref37;
3055
- return ['right', val];
3056
- },
3057
- end: _ref38 => {
3058
- let [_key, val] = _ref38;
3059
- return ['left', val];
3060
- },
3061
- 'background-position': _ref39 => {
3062
- let [key, val] = _ref39;
4723
+ 'margin-start': ([_key, val]) => ['margin-right', val],
4724
+ 'margin-end': ([_key, val]) => ['margin-left', val],
4725
+ 'padding-start': ([_key, val]) => ['padding-right', val],
4726
+ 'padding-end': ([_key, val]) => ['padding-left', val],
4727
+ 'border-start': ([_key, val]) => ['border-right', val],
4728
+ 'border-end': ([_key, val]) => ['border-left', val],
4729
+ 'border-start-width': ([_key, val]) => ['border-right-width', val],
4730
+ 'border-end-width': ([_key, val]) => ['border-left-width', val],
4731
+ 'border-start-color': ([_key, val]) => ['border-right-color', val],
4732
+ 'border-end-color': ([_key, val]) => ['border-left-color', val],
4733
+ 'border-start-style': ([_key, val]) => ['border-right-style', val],
4734
+ 'border-end-style': ([_key, val]) => ['border-left-style', val],
4735
+ 'border-top-start-radius': ([_key, val]) => ['border-top-right-radius', val],
4736
+ 'border-bottom-start-radius': ([_key, val]) => ['border-bottom-right-radius', val],
4737
+ 'border-top-end-radius': ([_key, val]) => ['border-top-left-radius', val],
4738
+ 'border-bottom-end-radius': ([_key, val]) => ['border-bottom-left-radius', val],
4739
+ float: ([key, val]) => logicalToPhysical[val] != null ? [key, logicalToPhysical[val]] : null,
4740
+ clear: ([key, val]) => logicalToPhysical[val] != null ? [key, logicalToPhysical[val]] : null,
4741
+ start: ([_key, val]) => ['right', val],
4742
+ end: ([_key, val]) => ['left', val],
4743
+ 'background-position': ([key, val]) => {
3063
4744
  const words = val.split(' ');
3064
4745
  if (!words.includes('start') && !words.includes('end')) {
3065
4746
  return null;
3066
4747
  }
3067
4748
  return [key, words.map(word => word === 'start' || word === 'insetInlineStart' ? 'right' : word === 'end' || word === 'insetInlineEnd' ? 'left' : word).join(' ')];
3068
4749
  },
3069
- cursor: function (_ref40) {
3070
- let [key, val] = _ref40;
3071
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
4750
+ cursor: ([key, val], options = defaultOptions) => {
3072
4751
  if (!options.enableLegacyValueFlipping) {
3073
4752
  return null;
3074
4753
  }
3075
4754
  return cursorFlip[val] != null ? [key, cursorFlip[val]] : null;
3076
4755
  },
3077
- 'box-shadow': function (_ref41) {
3078
- let [key, val] = _ref41;
3079
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
4756
+ 'box-shadow': ([key, val], options = defaultOptions) => {
3080
4757
  if (!options.enableLegacyValueFlipping) {
3081
4758
  return null;
3082
4759
  }
3083
4760
  const rtlVal = flipShadow(val);
3084
4761
  return rtlVal ? [key, rtlVal] : null;
3085
4762
  },
3086
- 'text-shadow': function (_ref42) {
3087
- let [key, val] = _ref42;
3088
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
4763
+ 'text-shadow': ([key, val], options = defaultOptions) => {
3089
4764
  if (!options.enableLegacyValueFlipping) {
3090
4765
  return null;
3091
4766
  }
@@ -3093,8 +4768,7 @@ const propertyToRTL = {
3093
4768
  return rtlVal ? [key, rtlVal] : null;
3094
4769
  }
3095
4770
  };
3096
- function generateRTL(pair) {
3097
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
4771
+ function generateRTL(pair, options = defaultOptions) {
3098
4772
  const {
3099
4773
  enableLogicalStylesPolyfill,
3100
4774
  styleResolution
@@ -3659,8 +5333,7 @@ function buildNestedCSSRule(className, decls, pseudos, atRules, constRules) {
3659
5333
  }
3660
5334
  return combinedAtRules.reduce((acc, combinedAtRules) => `${combinedAtRules}{${acc}}`, `${selectorForAtRules}{${decls}}`);
3661
5335
  }
3662
- function generateCSSRule(className, key, value, pseudos, atRules, constRules) {
3663
- let options = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : defaultOptions;
5336
+ function generateCSSRule(className, key, value, pseudos, atRules, constRules, options = defaultOptions) {
3664
5337
  const pairs = Array.isArray(value) ? value.map(eachValue => [key, eachValue]) : [[key, value]];
3665
5338
  const ltrPairs = pairs.map(pair => generateLTR(pair, options));
3666
5339
  const ltrDecls = ltrPairs.map(pair => pair.join(':')).join(';');
@@ -3693,22 +5366,13 @@ function objFromEntries(entries) {
3693
5366
  return retVal;
3694
5367
  }
3695
5368
  function objMapKeys(obj, mapper) {
3696
- return objFromEntries(objEntries(obj).map(_ref => {
3697
- let [key, value] = _ref;
3698
- return [mapper(key), value];
3699
- }));
5369
+ return objFromEntries(objEntries(obj).map(([key, value]) => [mapper(key), value]));
3700
5370
  }
3701
5371
  function objMapEntry(obj, mapper) {
3702
- return objFromEntries(objEntries(obj).map(_ref2 => {
3703
- let [key, value] = _ref2;
3704
- return mapper([key, value]);
3705
- }));
5372
+ return objFromEntries(objEntries(obj).map(([key, value]) => mapper([key, value])));
3706
5373
  }
3707
5374
  function objMap(obj, mapper) {
3708
- return objFromEntries(objEntries(obj).map(_ref3 => {
3709
- let [key, value] = _ref3;
3710
- return [key, mapper(value, key)];
3711
- }));
5375
+ return objFromEntries(objEntries(obj).map(([key, value]) => [key, mapper(value, key)]));
3712
5376
  }
3713
5377
  class Pipe {
3714
5378
  constructor(val) {
@@ -3725,8 +5389,7 @@ class Pipe {
3725
5389
  }
3726
5390
  }
3727
5391
  const arraySort = (arr, fn) => [...arr].sort(fn);
3728
- const arrayEquals = function (arr1, arr2) {
3729
- let equals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : (a, b) => a === b;
5392
+ const arrayEquals = (arr1, arr2, equals = (a, b) => a === b) => {
3730
5393
  if (arr1.length !== arr2.length) {
3731
5394
  return false;
3732
5395
  }
@@ -3771,8 +5434,7 @@ const stringComparator = (a, b) => {
3771
5434
  return a.localeCompare(b);
3772
5435
  };
3773
5436
 
3774
- function convertStyleToClassName(objEntry, pseudos, atRules, constRules) {
3775
- let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : defaultOptions;
5437
+ function convertStyleToClassName(objEntry, pseudos, atRules, constRules, options = defaultOptions) {
3776
5438
  const {
3777
5439
  classNamePrefix = 'x',
3778
5440
  debug = false,
@@ -3807,10 +5469,7 @@ function variableFallbacks(values) {
3807
5469
  varValues = varValues.map(val => val.slice(4, -1));
3808
5470
  return [...(valuesBeforeFirstVar.length > 0 ? valuesBeforeFirstVar.map(val => composeVars(...varValues, val)) : [composeVars(...varValues)]), ...valuesAfterLastVar];
3809
5471
  }
3810
- function composeVars() {
3811
- for (var _len = arguments.length, vars = new Array(_len), _key = 0; _key < _len; _key++) {
3812
- vars[_key] = arguments[_key];
3813
- }
5472
+ function composeVars(...vars) {
3814
5473
  const [first, ...rest] = vars;
3815
5474
  if (rest.length > 0) {
3816
5475
  return `var(${first},${composeVars(...rest)})`;
@@ -3890,7 +5549,13 @@ class PreRuleSet {
3890
5549
  }
3891
5550
 
3892
5551
  function flattenRawStyleObject(style, options) {
3893
- return _flattenRawStyleObject(style, [], options);
5552
+ let processedStyle = style;
5553
+ try {
5554
+ processedStyle = options.enableMediaQueryOrder ? libExports.lastMediaQueryWinsTransform(style) : style;
5555
+ } catch (error) {
5556
+ throw new Error(INVALID_MEDIA_QUERY_SYNTAX);
5557
+ }
5558
+ return _flattenRawStyleObject(processedStyle, [], options);
3894
5559
  }
3895
5560
  function _flattenRawStyleObject(style, keyPath, options) {
3896
5561
  const flattened = [];
@@ -3926,14 +5591,7 @@ function _flattenRawStyleObject(style, keyPath, options) {
3926
5591
  }
3927
5592
  }
3928
5593
  }
3929
- Object.entries(equivalentPairs).map(_ref => {
3930
- let [property, values] = _ref;
3931
- return [property, [...new Set(values.filter(Boolean))]];
3932
- }).map(_ref2 => {
3933
- let [property, values] = _ref2;
3934
- return [property, values.length === 0 ? null : values.length === 1 ? values[0] : values];
3935
- }).forEach(_ref3 => {
3936
- let [property, value] = _ref3;
5594
+ Object.entries(equivalentPairs).map(([property, values]) => [property, [...new Set(values.filter(Boolean))]]).map(([property, values]) => [property, values.length === 0 ? null : values.length === 1 ? values[0] : values]).forEach(([property, value]) => {
3937
5595
  if (value === null) {
3938
5596
  flattened.push([property, new NullPreRule()]);
3939
5597
  } else {
@@ -3978,8 +5636,7 @@ function _flattenRawStyleObject(style, keyPath, options) {
3978
5636
  return flattened;
3979
5637
  }
3980
5638
 
3981
- function validateNamespace(namespace) {
3982
- let conditions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
5639
+ function validateNamespace(namespace, conditions = []) {
3983
5640
  if (!isPlainObject(namespace)) {
3984
5641
  throw new Error(ILLEGAL_NAMESPACE_VALUE);
3985
5642
  }
@@ -4012,8 +5669,7 @@ function validateNamespace(namespace) {
4012
5669
  throw new Error(ILLEGAL_PROP_VALUE);
4013
5670
  }
4014
5671
  }
4015
- function validateConditionalStyles(val) {
4016
- let conditions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
5672
+ function validateConditionalStyles(val, conditions = []) {
4017
5673
  for (const key in val) {
4018
5674
  const v = val[key];
4019
5675
  if (!(key.startsWith('@') || key.startsWith(':') || key.startsWith('var(--') || key === 'default')) {
@@ -4042,8 +5698,7 @@ function validateConditionalStyles(val) {
4042
5698
  }
4043
5699
  }
4044
5700
 
4045
- function styleXCreateSet(namespaces) {
4046
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
5701
+ function styleXCreateSet(namespaces, options = defaultOptions) {
4047
5702
  const resolvedNamespaces = {};
4048
5703
  const injectedStyles = {};
4049
5704
  const namespaceToClassPaths = {};
@@ -4060,8 +5715,7 @@ function styleXCreateSet(namespaces) {
4060
5715
  arr.unshift(curr);
4061
5716
  return arr;
4062
5717
  }, []);
4063
- const compiledNamespaceTuples = flattenedNamespace.map(_ref => {
4064
- let [key, value] = _ref;
5718
+ const compiledNamespaceTuples = flattenedNamespace.map(([key, value]) => {
4065
5719
  if (options.enableMinifiedKeys === true && !key.startsWith('--')) {
4066
5720
  const hashedKey = createShortHash('<>' + key);
4067
5721
  const displayKey = options.debug === true ? `${key}-k${hashedKey}` : `k${hashedKey}`;
@@ -4073,14 +5727,10 @@ function styleXCreateSet(namespaces) {
4073
5727
  const namespaceObj = {};
4074
5728
  for (const [key, value] of compiledNamespaceTuples) {
4075
5729
  const classNameTuples = value.map(v => Array.isArray(v) ? v : null).filter(Boolean);
4076
- classNameTuples.forEach(_ref2 => {
4077
- let [_className, _, classesToOriginalPath] = _ref2;
5730
+ classNameTuples.forEach(([_className, _, classesToOriginalPath]) => {
4078
5731
  Object.assign(classPathsInNamespace, classesToOriginalPath);
4079
5732
  });
4080
- const classNames = classNameTuples.map(_ref3 => {
4081
- let [className] = _ref3;
4082
- return className;
4083
- });
5733
+ const classNames = classNameTuples.map(([className]) => className);
4084
5734
  const uniqueClassNames = new Set(classNames);
4085
5735
  const className = Array.from(uniqueClassNames).join(' ');
4086
5736
  namespaceObj[key] = className !== '' ? className : null;
@@ -4259,13 +5909,10 @@ var stylexTypes = /*#__PURE__*/Object.freeze({
4259
5909
  });
4260
5910
 
4261
5911
  const SPLIT_TOKEN = '__$$__';
4262
- function collectVarsByAtRule(key, _ref) {
4263
- let {
4264
- nameHash,
4265
- value
4266
- } = _ref;
4267
- let collection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
4268
- let atRules = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
5912
+ function collectVarsByAtRule(key, {
5913
+ nameHash,
5914
+ value
5915
+ }, collection = {}, atRules = []) {
4269
5916
  if (typeof value === 'string' || typeof value === 'number') {
4270
5917
  const val = typeof value === 'number' ? value.toString() : value;
4271
5918
  const key = atRules.length === 0 ? 'default' : [...atRules].sort().join(SPLIT_TOKEN);
@@ -4350,24 +5997,18 @@ function styleXDefineVars(variables, options) {
4350
5997
  value: value
4351
5998
  };
4352
5999
  });
4353
- const themeVariablesObject = objMap(variablesMap, _ref => {
4354
- let {
4355
- nameHash
4356
- } = _ref;
4357
- return `var(--${nameHash})`;
4358
- });
6000
+ const themeVariablesObject = objMap(variablesMap, ({
6001
+ nameHash
6002
+ }) => `var(--${nameHash})`);
4359
6003
  const injectableStyles = constructCssVariablesString(variablesMap, varGroupHash);
4360
- const injectableTypes = objMap(typedVariables, (_ref2, nameHash) => {
4361
- let {
4362
- initialValue: iv,
4363
- syntax
4364
- } = _ref2;
4365
- return {
4366
- ltr: `@property --${nameHash} { syntax: "${syntax}"; inherits: true;${iv != null ? ` initial-value: ${iv}` : ''} }`,
4367
- rtl: null,
4368
- priority: 0
4369
- };
4370
- });
6004
+ const injectableTypes = objMap(typedVariables, ({
6005
+ initialValue: iv,
6006
+ syntax
6007
+ }, nameHash) => ({
6008
+ ltr: `@property --${nameHash} { syntax: "${syntax}"; inherits: true;${iv != null ? ` initial-value: ${iv}` : ''} }`,
6009
+ rtl: null,
6010
+ priority: 0
6011
+ }));
4371
6012
  return [{
4372
6013
  ...themeVariablesObject,
4373
6014
  __varGroupHash__: varGroupHash
@@ -4482,8 +6123,7 @@ function styleXCreateTheme(themeVars, variables, options) {
4482
6123
  }, stylesToInject];
4483
6124
  }
4484
6125
 
4485
- function styleXKeyframes(frames) {
4486
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
6126
+ function styleXKeyframes(frames, options = defaultOptions) {
4487
6127
  const {
4488
6128
  classNamePrefix = 'x'
4489
6129
  } = options;
@@ -4502,29 +6142,18 @@ function styleXKeyframes(frames) {
4502
6142
  }];
4503
6143
  }
4504
6144
  function expandFrameShorthands(frame, options) {
4505
- return objFromEntries(objEntries(frame).flatMap(pair => flatMapExpandedShorthands(pair, options).map(_ref => {
4506
- let [key, value] = _ref;
6145
+ return objFromEntries(objEntries(frame).flatMap(pair => flatMapExpandedShorthands(pair, options).map(([key, value]) => {
4507
6146
  if (typeof value === 'string' || typeof value === 'number') {
4508
6147
  return [key, value];
4509
6148
  }
4510
6149
  return null;
4511
- }).filter(Boolean)).filter(_ref2 => {
4512
- let [_key, value] = _ref2;
4513
- return value != null;
4514
- }));
6150
+ }).filter(Boolean)).filter(([_key, value]) => value != null));
4515
6151
  }
4516
6152
  function constructKeyframesObj(frames) {
4517
- return objEntries(frames).map(_ref3 => {
4518
- let [key, value] = _ref3;
4519
- return `${key}{${objEntries(value).map(_ref4 => {
4520
- let [k, v] = _ref4;
4521
- return `${k}:${v};`;
4522
- }).join('')}}`;
4523
- }).join('');
6153
+ return objEntries(frames).map(([key, value]) => `${key}{${objEntries(value).map(([k, v]) => `${k}:${v};`).join('')}}`).join('');
4524
6154
  }
4525
6155
 
4526
- function styleXPositionTry(styles) {
4527
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
6156
+ function styleXPositionTry(styles, options = defaultOptions) {
4528
6157
  const {
4529
6158
  classNamePrefix = 'x'
4530
6159
  } = options;
@@ -4543,16 +6172,12 @@ function styleXPositionTry(styles) {
4543
6172
  }];
4544
6173
  }
4545
6174
  function preprocessProperties$1(styles, options) {
4546
- return objFromEntries(objEntries(styles).flatMap(pair => flatMapExpandedShorthands(pair, options).map(_ref => {
4547
- let [key, value] = _ref;
6175
+ return objFromEntries(objEntries(styles).flatMap(pair => flatMapExpandedShorthands(pair, options).map(([key, value]) => {
4548
6176
  if (typeof value === 'string' || typeof value === 'number') {
4549
6177
  return [key, value];
4550
6178
  }
4551
6179
  return null;
4552
- }).filter(Boolean)).filter(_ref2 => {
4553
- let [_key, value] = _ref2;
4554
- return value != null;
4555
- }));
6180
+ }).filter(Boolean)).filter(([_key, value]) => value != null));
4556
6181
  }
4557
6182
  function constructPositionTryObj(styles) {
4558
6183
  return Object.keys(styles).sort().map(k => {
@@ -4562,10 +6187,7 @@ function constructPositionTryObj(styles) {
4562
6187
  }
4563
6188
 
4564
6189
  const isVar = arg => typeof arg === 'string' && arg.match(/^var\(--[a-zA-Z0-9-_]+\)$/);
4565
- function stylexFirstThatWorks() {
4566
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
4567
- args[_key] = arguments[_key];
4568
- }
6190
+ function stylexFirstThatWorks(...args) {
4569
6191
  const firstVar = args.findIndex(isVar);
4570
6192
  if (firstVar === -1) {
4571
6193
  return [...args].reverse();
@@ -4582,12 +6204,11 @@ function stylexFirstThatWorks() {
4582
6204
  return returnValue;
4583
6205
  }
4584
6206
 
4585
- function genFileBasedIdentifier(_ref) {
4586
- let {
4587
- fileName,
4588
- exportName,
4589
- key
4590
- } = _ref;
6207
+ function genFileBasedIdentifier({
6208
+ fileName,
6209
+ exportName,
6210
+ key
6211
+ }) {
4591
6212
  return `${fileName}//${exportName}${key != null ? `.${key}` : ''}`;
4592
6213
  }
4593
6214
 
@@ -4693,10 +6314,7 @@ function convertToTestStyles(obj, varName, state) {
4693
6314
  }
4694
6315
 
4695
6316
  function convertObjectToAST(obj) {
4696
- return t__namespace.objectExpression(Object.entries(obj).map(_ref => {
4697
- let [key, value] = _ref;
4698
- return t__namespace.objectProperty(canBeIdentifier(key) ? t__namespace.identifier(key) : t__namespace.stringLiteral(key), typeof value === 'string' ? t__namespace.stringLiteral(value) : typeof value === 'number' ? t__namespace.numericLiteral(value) : typeof value === 'boolean' ? t__namespace.booleanLiteral(value) : value === null ? t__namespace.nullLiteral() : convertObjectToAST(value));
4699
- }));
6317
+ return t__namespace.objectExpression(Object.entries(obj).map(([key, value]) => t__namespace.objectProperty(canBeIdentifier(key) ? t__namespace.identifier(key) : t__namespace.stringLiteral(key), typeof value === 'string' ? t__namespace.stringLiteral(value) : typeof value === 'number' ? t__namespace.numericLiteral(value) : typeof value === 'boolean' ? t__namespace.booleanLiteral(value) : value === null ? t__namespace.nullLiteral() : convertObjectToAST(value))));
4700
6318
  }
4701
6319
  function removeObjectsWithSpreads(obj) {
4702
6320
  return Object.fromEntries(Object.entries(obj).filter(Boolean));
@@ -4863,10 +6481,7 @@ function _evaluate(path, state) {
4863
6481
  const identParams = params.filter(param => param.isIdentifier()).map(paramPath => paramPath.node.name);
4864
6482
  if (body.isExpression() && identParams.length === params.length) {
4865
6483
  const expr = body;
4866
- return function () {
4867
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
4868
- args[_key] = arguments[_key];
4869
- }
6484
+ return (...args) => {
4870
6485
  const identifierEntries = identParams.map((ident, index) => [ident, args[index]]);
4871
6486
  const identifiersObj = Object.fromEntries(identifierEntries);
4872
6487
  const result = evaluate(expr, state.traversalState, {
@@ -5291,8 +6906,7 @@ function _evaluate(path, state) {
5291
6906
  }
5292
6907
  deopt(path, state, UNSUPPORTED_EXPRESSION(path.node.type));
5293
6908
  }
5294
- function evaluateQuasis(path, quasis, state) {
5295
- let raw = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
6909
+ function evaluateQuasis(path, quasis, state, raw = false) {
5296
6910
  let str = '';
5297
6911
  let i = 0;
5298
6912
  const exprs = path.isTemplateLiteral() ? path.get('expressions') : path.isTaggedTemplateExpression() ? path.get('quasi').get('expressions') : [];
@@ -5306,12 +6920,10 @@ function evaluateQuasis(path, quasis, state) {
5306
6920
  return str;
5307
6921
  }
5308
6922
  const importsForState = new WeakMap();
5309
- function evaluate(path, traversalState) {
5310
- let functions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
5311
- identifiers: {},
5312
- memberExpressions: {}
5313
- };
5314
- let seen = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Map();
6923
+ function evaluate(path, traversalState, functions = {
6924
+ identifiers: {},
6925
+ memberExpressions: {}
6926
+ }, seen = new Map()) {
5315
6927
  const addedImports = importsForState.get(traversalState) ?? new Set();
5316
6928
  importsForState.set(traversalState, addedImports);
5317
6929
  const state = {
@@ -5332,11 +6944,10 @@ function evaluate(path, traversalState) {
5332
6944
  };
5333
6945
  }
5334
6946
 
5335
- function evaluateStyleXCreateArg(path, traversalState) {
5336
- let functions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
5337
- identifiers: {},
5338
- memberExpressions: {}
5339
- };
6947
+ function evaluateStyleXCreateArg(path, traversalState, functions = {
6948
+ identifiers: {},
6949
+ memberExpressions: {}
6950
+ }) {
5340
6951
  if (!path.isObjectExpression()) {
5341
6952
  return evaluate(path, traversalState, functions);
5342
6953
  }
@@ -5400,12 +7011,10 @@ function evaluateStyleXCreateArg(path, traversalState) {
5400
7011
  fns
5401
7012
  };
5402
7013
  }
5403
- function evaluatePartialObjectRecursively(path, traversalState) {
5404
- let functions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
5405
- identifiers: {},
5406
- memberExpressions: {}
5407
- };
5408
- let keyPath = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
7014
+ function evaluatePartialObjectRecursively(path, traversalState, functions = {
7015
+ identifiers: {},
7016
+ memberExpressions: {}
7017
+ }, keyPath = []) {
5409
7018
  const obj = {};
5410
7019
  const inlineStyles = {};
5411
7020
  const props = path.get('properties');
@@ -5509,7 +7118,26 @@ function validateDynamicStyleParams(path, params) {
5509
7118
  }
5510
7119
 
5511
7120
  function isSafeToSkipNullCheck(expr) {
5512
- return t__namespace.isBinaryExpression(expr) && ['+', '-', '*', '/', '**'].includes(expr.operator) || t__namespace.isUnaryExpression(expr) && ['-', '+'].includes(expr.operator);
7121
+ if (t__namespace.isTemplateLiteral(expr)) return true;
7122
+ if (t__namespace.isStringLiteral(expr) || t__namespace.isNumericLiteral(expr) || t__namespace.isBooleanLiteral(expr)) return true;
7123
+ if (t__namespace.isBinaryExpression(expr)) {
7124
+ return ['+', '-', '*', '/', '%', '**'].includes(expr.operator);
7125
+ }
7126
+ if (t__namespace.isUnaryExpression(expr)) {
7127
+ return ['-', '+'].includes(expr.operator);
7128
+ }
7129
+ if (t__namespace.isConditionalExpression(expr)) {
7130
+ return isSafeToSkipNullCheck(expr.consequent) && isSafeToSkipNullCheck(expr.alternate);
7131
+ }
7132
+ if (t__namespace.isLogicalExpression(expr)) {
7133
+ if (expr.operator === '??' || expr.operator === '||') {
7134
+ return isSafeToSkipNullCheck(expr.left) || isSafeToSkipNullCheck(expr.right);
7135
+ }
7136
+ if (expr.operator === '&&') {
7137
+ return isSafeToSkipNullCheck(expr.left) && isSafeToSkipNullCheck(expr.right);
7138
+ }
7139
+ }
7140
+ return false;
5513
7141
  }
5514
7142
  function transformStyleXCreate(path, state) {
5515
7143
  const {
@@ -5581,18 +7209,14 @@ function transformStyleXCreate(path, state) {
5581
7209
  const plainObject = value;
5582
7210
  const injectedInheritStyles = {};
5583
7211
  if (fns != null) {
5584
- const dynamicFnsNames = Object.values(fns)?.map(entry => Object.entries(entry[1]).map(_ref => {
5585
- let [variableName, obj] = _ref;
5586
- return {
5587
- variableName,
5588
- path: obj.path
5589
- };
5590
- })).flat();
5591
- dynamicFnsNames.forEach(_ref2 => {
5592
- let {
5593
- variableName,
5594
- path
5595
- } = _ref2;
7212
+ const dynamicFnsNames = Object.values(fns)?.map(entry => Object.entries(entry[1]).map(([variableName, obj]) => ({
7213
+ variableName,
7214
+ path: obj.path
7215
+ }))).flat();
7216
+ dynamicFnsNames.forEach(({
7217
+ variableName,
7218
+ path
7219
+ }) => {
5596
7220
  const isPseudoElement = path.some(p => p.startsWith('::'));
5597
7221
  injectedInheritStyles[variableName] = {
5598
7222
  priority: 0,
@@ -5645,14 +7269,11 @@ function transformStyleXCreate(path, state) {
5645
7269
  for (const [className, classPaths] of Object.entries(classPathsPerNamespace[key])) {
5646
7270
  origClassPaths[className] = classPaths.join('_');
5647
7271
  }
5648
- let dynamicStyles = Object.entries(inlineStyles).map(_ref3 => {
5649
- let [_key, v] = _ref3;
5650
- return {
5651
- expression: v.originalExpression,
5652
- key: v.path.slice(0, v.path.findIndex(p => !p.startsWith(':') && !p.startsWith('@')) + 1).join('_'),
5653
- path: v.path.join('_')
5654
- };
5655
- });
7272
+ let dynamicStyles = Object.entries(inlineStyles).map(([_key, v]) => ({
7273
+ expression: v.originalExpression,
7274
+ key: v.path.slice(0, v.path.findIndex(p => !p.startsWith(':') && !p.startsWith('@')) + 1).join('_'),
7275
+ path: v.path.join('_')
7276
+ }));
5656
7277
  if (state.options.styleResolution === 'legacy-expand-shorthands') {
5657
7278
  dynamicStyles = legacyExpandShorthands(dynamicStyles);
5658
7279
  }
@@ -5672,12 +7293,9 @@ function transformStyleXCreate(path, state) {
5672
7293
  const classList = t__namespace.isStringLiteral(objProp.value) ? objProp.value.value.split(' ') : [];
5673
7294
  const exprList = [];
5674
7295
  classList.forEach(cls => {
5675
- const expr = dynamicStyles.find(_ref4 => {
5676
- let {
5677
- path
5678
- } = _ref4;
5679
- return origClassPaths[cls] === path;
5680
- })?.expression;
7296
+ const expr = dynamicStyles.find(({
7297
+ path
7298
+ }) => origClassPaths[cls] === path)?.expression;
5681
7299
  if (expr && !isSafeToSkipNullCheck(expr)) {
5682
7300
  exprList.push(t__namespace.conditionalExpression(t__namespace.binaryExpression('!=', expr, t__namespace.nullLiteral()), t__namespace.stringLiteral(cls), expr));
5683
7301
  } else {
@@ -5688,23 +7306,17 @@ function transformStyleXCreate(path, state) {
5688
7306
  conditionalProps.push(t__namespace.objectProperty(objProp.key, joined));
5689
7307
  });
5690
7308
  const conditionalObj = t__namespace.objectExpression(conditionalProps);
5691
- prop.value = t__namespace.arrowFunctionExpression(params, t__namespace.arrayExpression([conditionalObj, t__namespace.objectExpression(Object.entries(inlineStyles).map(_ref5 => {
5692
- let [key, val] = _ref5;
5693
- return t__namespace.objectProperty(t__namespace.stringLiteral(key), val.expression);
5694
- }))]));
7309
+ prop.value = t__namespace.arrowFunctionExpression(params, t__namespace.arrayExpression([conditionalObj, t__namespace.objectExpression(Object.entries(inlineStyles).map(([key, val]) => t__namespace.objectProperty(t__namespace.stringLiteral(key), val.expression)))]));
5695
7310
  }
5696
7311
  }
5697
7312
  }
5698
7313
  return prop;
5699
7314
  });
5700
7315
  }
5701
- const listOfStyles = Object.entries(injectedStyles).map(_ref6 => {
5702
- let [key, {
5703
- priority,
5704
- ...rest
5705
- }] = _ref6;
5706
- return [key, rest, priority];
5707
- });
7316
+ const listOfStyles = Object.entries(injectedStyles).map(([key, {
7317
+ priority,
7318
+ ...rest
7319
+ }]) => [key, rest, priority]);
5708
7320
  state.registerStyles(listOfStyles, path);
5709
7321
  path.replaceWith(resultAst);
5710
7322
  if (Object.keys(injectedStyles).length === 0) {
@@ -5743,15 +7355,13 @@ function findNearestStatementAncestor(path) {
5743
7355
  return findNearestStatementAncestor(path.parentPath);
5744
7356
  }
5745
7357
  function legacyExpandShorthands(dynamicStyles) {
5746
- const expandedKeysToKeyPaths = dynamicStyles.flatMap((_ref7, i) => {
5747
- let {
5748
- key
5749
- } = _ref7;
7358
+ const expandedKeysToKeyPaths = dynamicStyles.flatMap(({
7359
+ key
7360
+ }, i) => {
5750
7361
  return flatMapExpandedShorthands([key, 'p' + i], {
5751
7362
  styleResolution: 'legacy-expand-shorthands'
5752
7363
  });
5753
- }).map(_ref8 => {
5754
- let [key, value] = _ref8;
7364
+ }).map(([key, value]) => {
5755
7365
  if (typeof value !== 'string') {
5756
7366
  return null;
5757
7367
  }
@@ -5871,13 +7481,10 @@ function transformStyleXCreateTheme(callExpressionPath, state) {
5871
7481
  const listOfStyles = Object.entries({
5872
7482
  ...otherInjectedCSSRules,
5873
7483
  ...injectedStyles
5874
- }).map(_ref => {
5875
- let [key, {
5876
- priority,
5877
- ...rest
5878
- }] = _ref;
5879
- return [key, rest, priority];
5880
- });
7484
+ }).map(([key, {
7485
+ priority,
7486
+ ...rest
7487
+ }]) => [key, rest, priority]);
5881
7488
  state.registerStyles(listOfStyles, variableDeclaratorPath);
5882
7489
  }
5883
7490
  }
@@ -5980,13 +7587,10 @@ function transformStyleXDefineVars(callExpressionPath, state) {
5980
7587
  ...injectedStylesSansKeyframes
5981
7588
  };
5982
7589
  callExpressionPath.replaceWith(convertObjectToAST(variablesObj));
5983
- const listOfStyles = Object.entries(injectedStyles).map(_ref => {
5984
- let [key, {
5985
- priority,
5986
- ...rest
5987
- }] = _ref;
5988
- return [key, rest, priority];
5989
- });
7590
+ const listOfStyles = Object.entries(injectedStyles).map(([key, {
7591
+ priority,
7592
+ ...rest
7593
+ }]) => [key, rest, priority]);
5990
7594
  state.registerStyles(listOfStyles, variableDeclaratorPath);
5991
7595
  }
5992
7596
  }
@@ -6040,15 +7644,12 @@ function transformStyleXDefineConsts(callExpressionPath, state) {
6040
7644
  exportId
6041
7645
  });
6042
7646
  callExpressionPath.replaceWith(convertObjectToAST(transformedJsOutput));
6043
- const styles = Object.entries(jsOutput).map(_ref => {
6044
- let [_, obj] = _ref;
6045
- return [obj.constKey, {
6046
- constKey: obj.constKey,
6047
- constVal: obj.constVal,
6048
- ltr: obj.ltr,
6049
- rtl: obj.rtl ?? null
6050
- }, obj.priority];
6051
- });
7647
+ const styles = Object.entries(jsOutput).map(([_, obj]) => [obj.constKey, {
7648
+ constKey: obj.constKey,
7649
+ constVal: obj.constVal,
7650
+ ltr: obj.ltr,
7651
+ rtl: obj.rtl ?? null
7652
+ }, obj.priority]);
6052
7653
  state.registerStyles(styles);
6053
7654
  }
6054
7655
  }
@@ -6673,8 +8274,7 @@ function isCalleeMemberExpression(path, state) {
6673
8274
  return node != null && node.callee != null && node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier' && node.callee.property.type === 'Identifier' && node.callee.property.name === 'props' && state.stylexImport.has(node.callee.object.name);
6674
8275
  }
6675
8276
 
6676
- function styleXViewTransitionClass(styles) {
6677
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
8277
+ function styleXViewTransitionClass(styles, options = defaultOptions) {
6678
8278
  const {
6679
8279
  classNamePrefix = 'x'
6680
8280
  } = options;
@@ -6690,28 +8290,18 @@ function styleXViewTransitionClass(styles) {
6690
8290
  }];
6691
8291
  }
6692
8292
  function preprocessProperties(styles, options) {
6693
- return objFromEntries(objEntries(styles).flatMap(pair => flatMapExpandedShorthands(pair, options).map(_ref => {
6694
- let [key, value] = _ref;
8293
+ return objFromEntries(objEntries(styles).flatMap(pair => flatMapExpandedShorthands(pair, options).map(([key, value]) => {
6695
8294
  if (typeof value === 'string' || typeof value === 'number') {
6696
8295
  return [key, value];
6697
8296
  }
6698
8297
  return null;
6699
- }).filter(Boolean)).filter(_ref2 => {
6700
- let [_key, value] = _ref2;
6701
- return value != null;
6702
- }));
8298
+ }).filter(Boolean)).filter(([_key, value]) => value != null));
6703
8299
  }
6704
8300
  function constructViewTransitionClassStyleStr(style) {
6705
- return objEntries(style).map(_ref3 => {
6706
- let [k, v] = _ref3;
6707
- return `${k}:${v};`;
6708
- }).join('');
8301
+ return objEntries(style).map(([k, v]) => `${k}:${v};`).join('');
6709
8302
  }
6710
8303
  function constructFinalViewTransitionCSSStr(styles, className) {
6711
- return objEntries(styles).map(_ref4 => {
6712
- let [k, v] = _ref4;
6713
- return `${k}(*.${className}){${v}}`;
6714
- }).join('');
8304
+ return objEntries(styles).map(([k, v]) => `${k}(*.${className}){${v}}`).join('');
6715
8305
  }
6716
8306
 
6717
8307
  function transformStyleXViewTransitionClass(path, state) {
@@ -6791,13 +8381,10 @@ function transformStyleXViewTransitionClass(path, state) {
6791
8381
  rtl
6792
8382
  }
6793
8383
  };
6794
- const listOfStyles = Object.entries(injectedStyles).map(_ref => {
6795
- let [key, {
6796
- priority,
6797
- ...rest
6798
- }] = _ref;
6799
- return [key, rest, priority];
6800
- });
8384
+ const listOfStyles = Object.entries(injectedStyles).map(([key, {
8385
+ priority,
8386
+ ...rest
8387
+ }]) => [key, rest, priority]);
6801
8388
  state.registerStyles(listOfStyles, path);
6802
8389
  }
6803
8390
  }
@@ -6911,10 +8498,7 @@ function styleXTransform() {
6911
8498
  }
6912
8499
  }
6913
8500
  }
6914
- const varsToKeepOld = new Set([...state.styleVarsToKeep.values()].map(_ref => {
6915
- let [varName, _namespaceName] = _ref;
6916
- return varName;
6917
- }));
8501
+ const varsToKeepOld = new Set([...state.styleVarsToKeep.values()].map(([varName, _namespaceName]) => varName));
6918
8502
  state.styleVars.forEach((path, varName) => {
6919
8503
  if (isExported(path)) {
6920
8504
  return;
@@ -6938,13 +8522,7 @@ function styleXTransform() {
6938
8522
  if (!namespacesToKeep.includes(keyAsString)) {
6939
8523
  prop.remove();
6940
8524
  } else {
6941
- const allNullsToKeep = [...state.styleVarsToKeep.values()].filter(_ref2 => {
6942
- let [v, namespaceName] = _ref2;
6943
- return v === varName && namespaceName === keyAsString;
6944
- }).map(_ref3 => {
6945
- let [_v, _namespaceName, nullPropsToKeep] = _ref3;
6946
- return nullPropsToKeep;
6947
- });
8525
+ const allNullsToKeep = [...state.styleVarsToKeep.values()].filter(([v, namespaceName]) => v === varName && namespaceName === keyAsString).map(([_v, _namespaceName, nullPropsToKeep]) => nullPropsToKeep);
6948
8526
  if (!allNullsToKeep.includes(true)) {
6949
8527
  const nullsToKeep = new Set(allNullsToKeep.filter(x => x !== true).flat());
6950
8528
  const styleObject = prop.get('value');
@@ -7002,27 +8580,19 @@ function isExported(path) {
7002
8580
  }
7003
8581
  return isExported(path.parentPath);
7004
8582
  }
7005
- function processStylexRules(rules) {
7006
- let useLayers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
8583
+ function processStylexRules(rules, useLayers = false) {
7007
8584
  if (rules.length === 0) {
7008
8585
  return '';
7009
8586
  }
7010
- const constantRules = rules.filter(_ref4 => {
7011
- let [, ruleObj] = _ref4;
7012
- return ruleObj?.constKey != null && ruleObj?.constVal != null;
7013
- });
7014
- const nonConstantRules = rules.filter(_ref5 => {
7015
- let [, ruleObj] = _ref5;
7016
- return !(ruleObj?.constKey != null && ruleObj?.constVal != null);
7017
- });
8587
+ const constantRules = rules.filter(([, ruleObj]) => ruleObj?.constKey != null && ruleObj?.constVal != null);
8588
+ const nonConstantRules = rules.filter(([, ruleObj]) => !(ruleObj?.constKey != null && ruleObj?.constVal != null));
7018
8589
  const constsMap = new Map();
7019
8590
  for (const [keyhash, ruleObj] of constantRules) {
7020
8591
  const constVal = ruleObj.constVal;
7021
8592
  const constName = `var(--${keyhash})`;
7022
8593
  constsMap.set(constName, constVal);
7023
8594
  }
7024
- function resolveConstant(value) {
7025
- let visited = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set();
8595
+ function resolveConstant(value, visited = new Set()) {
7026
8596
  if (typeof value !== 'string') return value;
7027
8597
  const regex = /var\((--[A-Za-z0-9_-]+)\)/g;
7028
8598
  let result = value;
@@ -7047,13 +8617,11 @@ function processStylexRules(rules) {
7047
8617
  for (const [key, value] of constsMap.entries()) {
7048
8618
  constsMap.set(key, resolveConstant(value));
7049
8619
  }
7050
- const sortedRules = nonConstantRules.sort((_ref6, _ref7) => {
7051
- let [, {
7052
- ltr: rule1
7053
- }, firstPriority] = _ref6;
7054
- let [, {
7055
- ltr: rule2
7056
- }, secondPriority] = _ref7;
8620
+ const sortedRules = nonConstantRules.sort(([, {
8621
+ ltr: rule1
8622
+ }, firstPriority], [, {
8623
+ ltr: rule2
8624
+ }, secondPriority]) => {
7057
8625
  const priorityComparison = firstPriority - secondPriority;
7058
8626
  if (priorityComparison !== 0) return priorityComparison;
7059
8627
  if (rule1.startsWith('@') && !rule2.startsWith('@')) {
@@ -7092,10 +8660,7 @@ function processStylexRules(rules) {
7092
8660
  const header = useLayers ? '\n@layer ' + grouped.map((_, index) => `priority${index + 1}`).join(', ') + ';\n' : '';
7093
8661
  const collectedCSS = grouped.map((group, index) => {
7094
8662
  const pri = group[0][2];
7095
- const collectedCSS = Array.from(new Map(group.map(_ref8 => {
7096
- let [a, b] = _ref8;
7097
- return [a, b];
7098
- })).values()).flatMap(rule => {
8663
+ const collectedCSS = Array.from(new Map(group.map(([a, b]) => [a, b])).values()).flatMap(rule => {
7099
8664
  const {
7100
8665
  ltr,
7101
8666
  rtl