weapp-tailwindcss 5.0.0-next.8 → 5.0.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.
Files changed (167) hide show
  1. package/README.md +2 -2
  2. package/dist/auto-DEHRmEAx.mjs +200 -0
  3. package/dist/auto-dPpsm6FB.js +238 -0
  4. package/dist/bundle-state-CnaJxkFY.mjs +413 -0
  5. package/dist/bundle-state-DgGEhk_z.js +529 -0
  6. package/dist/bundlers/shared/cache.d.ts +9 -7
  7. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -2
  8. package/dist/bundlers/shared/css-cleanup.d.ts +1 -3
  9. package/dist/bundlers/shared/css-imports.d.ts +3 -3
  10. package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
  11. package/dist/bundlers/shared/generator-css/directives.d.ts +12 -3
  12. package/dist/bundlers/shared/generator-css/markers.d.ts +12 -0
  13. package/dist/bundlers/shared/generator-css/source-files.d.ts +9 -6
  14. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +16 -2
  15. package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +10 -0
  16. package/dist/bundlers/shared/generator-css.d.ts +6 -2
  17. package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
  18. package/dist/bundlers/shared/style-requests.d.ts +2 -0
  19. package/dist/bundlers/vite/bundle-state.d.ts +1 -0
  20. package/dist/bundlers/vite/css-finalizer.d.ts +6 -0
  21. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +1 -1
  22. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -1
  23. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +1 -0
  24. package/dist/bundlers/vite/generate-bundle.d.ts +13 -1
  25. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +10 -2
  26. package/dist/bundlers/vite/index.d.ts +5 -2
  27. package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
  28. package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -5
  29. package/dist/bundlers/vite/runtime-class-set.d.ts +5 -1
  30. package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
  31. package/dist/bundlers/vite/source-candidates.d.ts +24 -2
  32. package/dist/bundlers/vite/source-scan.d.ts +26 -0
  33. package/dist/bundlers/vite/static-config-content.d.ts +5 -0
  34. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +5 -0
  35. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +5 -1
  36. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +8 -3
  37. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
  38. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
  39. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -8
  40. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
  41. package/dist/cache/index.d.ts +6 -6
  42. package/dist/{chunk-8l464Juk.js → chunk-C5U5_Hdc.js} +14 -0
  43. package/dist/cli/context.d.ts +1 -11
  44. package/dist/cli/doctor/types.d.ts +11 -11
  45. package/dist/cli/vscode-entry.d.ts +3 -3
  46. package/dist/cli.js +684 -41
  47. package/dist/cli.mjs +682 -40
  48. package/dist/context/runtime-package-replacements.d.ts +2 -0
  49. package/dist/context/style-options.d.ts +3 -0
  50. package/dist/context/tailwindcss.d.ts +1 -1
  51. package/dist/core.js +1 -2
  52. package/dist/core.mjs +1 -1
  53. package/dist/css-macro/auto.d.ts +11 -0
  54. package/dist/css-macro/constants.d.ts +5 -2
  55. package/dist/css-macro/postcss.d.ts +1 -0
  56. package/dist/css-macro/postcss.js +7 -46
  57. package/dist/css-macro/postcss.mjs +2 -46
  58. package/dist/css-macro.js +16 -7
  59. package/dist/css-macro.mjs +15 -6
  60. package/dist/defaults-8xrgzxFY.mjs +151 -0
  61. package/dist/defaults-zKUH2mDe.js +193 -0
  62. package/dist/defaults.js +6 -150
  63. package/dist/defaults.mjs +1 -143
  64. package/dist/escape.js +10 -2
  65. package/dist/escape.mjs +10 -2
  66. package/dist/generator/options.d.ts +11 -6
  67. package/dist/generator/types.d.ts +3 -3
  68. package/dist/generator--0-ekuVO.js +92 -0
  69. package/dist/generator-B76ovqsv.mjs +67 -0
  70. package/dist/generator.js +12 -12
  71. package/dist/generator.mjs +2 -1
  72. package/dist/gulp.js +163 -40
  73. package/dist/gulp.mjs +155 -32
  74. package/dist/incremental-runtime-class-set-CN6K_97P.js +2366 -0
  75. package/dist/incremental-runtime-class-set-x10M9bn_.mjs +2291 -0
  76. package/dist/index.d.ts +2 -1
  77. package/dist/index.js +17 -5
  78. package/dist/index.mjs +6 -5
  79. package/dist/js/babel/cache-options.d.ts +3 -0
  80. package/dist/js/babel/parse.d.ts +7 -4
  81. package/dist/js/precheck.d.ts +2 -2
  82. package/dist/js/replacement-cache.d.ts +5 -0
  83. package/dist/postcss-C7BMYpEF.mjs +169 -0
  84. package/dist/{postcss-w48mGIhe.mjs → postcss-CR9UCaIK.mjs} +54 -114
  85. package/dist/postcss-CiYLsqZn.js +192 -0
  86. package/dist/{postcss-QIXwT40c.js → postcss-hYimKoN_.js} +60 -121
  87. package/dist/postcss-html-transform.js +1 -1
  88. package/dist/postcss.js +1 -1
  89. package/dist/postcss.mjs +1 -1
  90. package/dist/precheck-BrNwLG2e.mjs +4716 -0
  91. package/dist/precheck-DPtJjZmV.js +4842 -0
  92. package/dist/presets/index.d.ts +1 -0
  93. package/dist/presets/uni-app-x.d.ts +1 -0
  94. package/dist/presets.js +27 -13
  95. package/dist/presets.mjs +25 -13
  96. package/dist/reset.js +1 -1
  97. package/dist/runtime-registry-DpcR3IHI.js +5496 -0
  98. package/dist/shared/mpx.d.ts +1 -0
  99. package/dist/source-candidates-DN1mihlU.mjs +322 -0
  100. package/dist/source-candidates-DSxme_O2.js +335 -0
  101. package/dist/tailwindcss/miniprogram.d.ts +1 -5
  102. package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
  103. package/dist/tailwindcss/runtime/cache.d.ts +4 -3
  104. package/dist/tailwindcss/runtime.d.ts +9 -9
  105. package/dist/tailwindcss/source-scan.d.ts +35 -0
  106. package/dist/tailwindcss/v3-engine/types.d.ts +19 -14
  107. package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
  108. package/dist/tailwindcss/v4/patcher.d.ts +1 -1
  109. package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
  110. package/dist/tailwindcss/v4-engine/types.d.ts +18 -5
  111. package/dist/{tailwindcss-C5IgPlQ0.mjs → tailwindcss-DWtPieNE.mjs} +72 -60
  112. package/dist/{tailwindcss-Bu-RWIHx.js → tailwindcss-glCm_d3H.js} +81 -69
  113. package/dist/typedoc.export.d.ts +1 -1
  114. package/dist/types/index.d.ts +51 -41
  115. package/dist/types/shared.d.ts +3 -0
  116. package/dist/types/typedoc-tailwindcss-patch.d.ts +67 -0
  117. package/dist/types/user-defined-options/general.d.ts +25 -22
  118. package/dist/types/user-defined-options/important.d.ts +32 -27
  119. package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
  120. package/dist/types/user-defined-options/matcher.d.ts +6 -6
  121. package/dist/unocss/index.d.ts +2 -0
  122. package/dist/utils/object.d.ts +9 -0
  123. package/dist/utils/options.d.ts +2 -0
  124. package/dist/utils/regex.d.ts +1 -0
  125. package/dist/{utils-BiShvil9.js → utils-D7Ygohep.js} +2 -2
  126. package/dist/{utils-Btw1iOVV.mjs → utils-DsaS975I.mjs} +1 -1
  127. package/dist/v3-engine-D3BMLVAN.js +3712 -0
  128. package/dist/v3-engine-DCxNPBVs.mjs +3417 -0
  129. package/dist/vite-DOprpdH-.mjs +24493 -0
  130. package/dist/vite-Ec0uX6kF.js +24507 -0
  131. package/dist/vite.js +1 -1
  132. package/dist/vite.mjs +1 -1
  133. package/dist/weapp-tw-css-import-rewrite-loader.js +5444 -22
  134. package/dist/weapp-tw-runtime-classset-loader.js +32 -9
  135. package/dist/{webpack-CNV2dx3Q.js → webpack-Ccohlg3A.js} +341 -96
  136. package/dist/{webpack-CT6EEENx.mjs → webpack-DFlZcqAU.mjs} +323 -79
  137. package/dist/webpack.d.ts +1 -3
  138. package/dist/webpack.js +3 -4
  139. package/dist/webpack.mjs +2 -2
  140. package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -4
  141. package/package.json +22 -20
  142. package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +0 -3
  143. package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +0 -4
  144. package/dist/bundlers/shared/css-cleanup/selectors.d.ts +0 -8
  145. package/dist/cache-BVAiJV3J.js +0 -502
  146. package/dist/cache-CHs4DXui.mjs +0 -434
  147. package/dist/constants-BoB_6lFw.js +0 -73
  148. package/dist/constants-E_loJC49.mjs +0 -44
  149. package/dist/generator-DKkhJbOg.js +0 -1531
  150. package/dist/generator-UBmfduYg.mjs +0 -1432
  151. package/dist/generator-css-BIapP56i.mjs +0 -1323
  152. package/dist/generator-css-Mksw8PgB.js +0 -1362
  153. package/dist/lightningcss/index.d.ts +0 -8
  154. package/dist/lightningcss/style-handler/options.d.ts +0 -3
  155. package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
  156. package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
  157. package/dist/lightningcss/style-handler.d.ts +0 -17
  158. package/dist/precheck-B32p-gLI.js +0 -2736
  159. package/dist/precheck-B4RH6ZNN.mjs +0 -2622
  160. package/dist/run-tasks-B50A3pxt.js +0 -128
  161. package/dist/run-tasks-DdNi-hkk.mjs +0 -91
  162. package/dist/runtime-patch-CwN5ya72.mjs +0 -71
  163. package/dist/runtime-patch-D6mBo_KB.js +0 -85
  164. package/dist/vite-BwgRVgxH.mjs +0 -2405
  165. package/dist/vite-DyZuiyap.js +0 -2418
  166. /package/dist/{logger-Bub1jggA.mjs → logger-BNzxZbZj.mjs} +0 -0
  167. /package/dist/{logger-BRy6XPQ2.js → logger-TlKT3xmR.js} +0 -0
@@ -0,0 +1,4842 @@
1
+ const require_chunk = require("./chunk-C5U5_Hdc.js");
2
+ const require_v3_engine = require("./v3-engine-D3BMLVAN.js");
3
+ const require_defaults = require("./defaults-zKUH2mDe.js");
4
+ require("./utils-D7Ygohep.js");
5
+ const require_tailwindcss = require("./tailwindcss-glCm_d3H.js");
6
+ let tailwindcss_patch = require("tailwindcss-patch");
7
+ let node_process = require("node:process");
8
+ node_process = require_chunk.__toESM(node_process);
9
+ let node_path = require("node:path");
10
+ node_path = require_chunk.__toESM(node_path);
11
+ let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
12
+ let node_fs_promises = require("node:fs/promises");
13
+ let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
14
+ let node_buffer = require("node:buffer");
15
+ let lru_cache = require("lru-cache");
16
+ let _weapp_tailwindcss_shared_node = require("@weapp-tailwindcss/shared/node");
17
+ let _weapp_core_escape = require("@weapp-core/escape");
18
+ let _babel_traverse = require("@babel/traverse");
19
+ _babel_traverse = require_chunk.__toESM(_babel_traverse);
20
+ let _babel_parser = require("@babel/parser");
21
+ let magic_string = require("magic-string");
22
+ magic_string = require_chunk.__toESM(magic_string);
23
+ let _ast_core_escape = require("@ast-core/escape");
24
+ let _babel_types = require("@babel/types");
25
+ _babel_types = require_chunk.__toESM(_babel_types);
26
+ let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
27
+ //#region src/cache/index.ts
28
+ function isProcessResult(value) {
29
+ return typeof value === "object" && value !== null && "result" in value;
30
+ }
31
+ function createCache(options) {
32
+ const disabled = options === false;
33
+ const hashMap = /* @__PURE__ */ new Map();
34
+ const instance = new lru_cache.LRUCache({
35
+ max: 1024,
36
+ ttl: 0,
37
+ ttlAutopurge: false
38
+ });
39
+ const cache = {
40
+ hashMap,
41
+ instance,
42
+ hasHashKey(key) {
43
+ return hashMap.has(key);
44
+ },
45
+ getHashValue(key) {
46
+ return hashMap.get(key);
47
+ },
48
+ setHashValue(key, value) {
49
+ return hashMap.set(key, value);
50
+ },
51
+ get(key) {
52
+ return instance.get(key);
53
+ },
54
+ set(key, value) {
55
+ return instance.set(key, value);
56
+ },
57
+ computeHash(message) {
58
+ return (0, _weapp_tailwindcss_shared_node.md5)(message);
59
+ },
60
+ calcHashValueChanged(key, hash) {
61
+ const hit = hashMap.get(key);
62
+ if (hit) hashMap.set(key, {
63
+ changed: hash !== hit.hash,
64
+ hash
65
+ });
66
+ else hashMap.set(key, {
67
+ changed: true,
68
+ hash
69
+ });
70
+ return cache;
71
+ },
72
+ has(key) {
73
+ return instance.has(key);
74
+ },
75
+ async process({ key, hashKey, rawSource, hash, resolveCache, transform, onCacheHit }) {
76
+ if (disabled) {
77
+ const value = await transform();
78
+ return isProcessResult(value) ? value.result : value;
79
+ }
80
+ const cacheHashKey = hashKey ?? key;
81
+ let hasChanged = true;
82
+ if (hash != null || rawSource != null) {
83
+ const nextHash = hash ?? cache.computeHash(rawSource);
84
+ cache.calcHashValueChanged(cacheHashKey, nextHash);
85
+ hasChanged = cache.getHashValue(cacheHashKey)?.changed ?? true;
86
+ }
87
+ const readCache = resolveCache ?? (() => cache.get(key));
88
+ if (!hasChanged) {
89
+ const cached = readCache();
90
+ if (cached !== void 0) {
91
+ await onCacheHit?.(cached);
92
+ return cached;
93
+ }
94
+ }
95
+ const value = await transform();
96
+ const normalized = isProcessResult(value) ? value : { result: value };
97
+ const stored = normalized.cacheValue ?? normalized.result;
98
+ cache.set(key, stored);
99
+ return normalized.result;
100
+ }
101
+ };
102
+ return cache;
103
+ }
104
+ function initializeCache(cacheConfig) {
105
+ if (typeof cacheConfig === "boolean" || cacheConfig === void 0) return createCache(cacheConfig);
106
+ return cacheConfig;
107
+ }
108
+ //#endregion
109
+ //#region src/tailwindcss/runtime.ts
110
+ const debug$1 = require_v3_engine.createDebug("[tailwindcss:runtime] ");
111
+ const refreshTailwindcssPatcherSymbol = Symbol.for("weapp-tailwindcss.refreshTailwindcssPatcher");
112
+ function createTailwindRuntimeReadyPromise(twPatcher) {
113
+ return Promise.resolve().then(async () => {
114
+ await require_v3_engine.ensureTailwindcssRuntimePatch(twPatcher);
115
+ require_v3_engine.invalidateRuntimeClassSet(twPatcher);
116
+ });
117
+ }
118
+ const runtimeClassSetStateCache = /* @__PURE__ */ new WeakMap();
119
+ function getRuntimeClassSetStateEntry(state) {
120
+ let entry = runtimeClassSetStateCache.get(state);
121
+ if (!entry) {
122
+ entry = {};
123
+ runtimeClassSetStateCache.set(state, entry);
124
+ }
125
+ return entry;
126
+ }
127
+ async function refreshTailwindRuntimeState(state, forceOrOptions) {
128
+ const normalizedOptions = typeof forceOrOptions === "boolean" ? { force: forceOrOptions } : forceOrOptions;
129
+ const force = normalizedOptions.force;
130
+ const clearCache = normalizedOptions.clearCache === true;
131
+ if (!force) return false;
132
+ debug$1("refresh runtime state start, clearCache=%s major=%s", clearCache, state.twPatcher.majorVersion ?? "unknown");
133
+ await state.readyPromise;
134
+ let refreshed = false;
135
+ if (typeof state.refreshTailwindcssPatcher === "function") {
136
+ const next = await state.refreshTailwindcssPatcher({ clearCache });
137
+ if (next !== state.twPatcher) state.twPatcher = next;
138
+ refreshed = true;
139
+ }
140
+ if (refreshed) state.readyPromise = createTailwindRuntimeReadyPromise(state.twPatcher);
141
+ debug$1("refresh runtime state end, refreshed=%s major=%s", refreshed, state.twPatcher.majorVersion ?? "unknown");
142
+ return refreshed;
143
+ }
144
+ async function ensureRuntimeClassSet(state, options = {}) {
145
+ const forceRefresh = options.forceRefresh === true;
146
+ const forceCollect = options.forceCollect === true;
147
+ const clearCache = options.clearCache === true;
148
+ const allowEmpty = options.allowEmpty === true;
149
+ if (forceRefresh) await refreshTailwindRuntimeState(state, {
150
+ force: true,
151
+ clearCache
152
+ });
153
+ await state.readyPromise;
154
+ const entry = getRuntimeClassSetStateEntry(state);
155
+ const signature = await require_v3_engine.getRuntimeClassSetSignatureWithSources(state.twPatcher);
156
+ const signatureChanged = entry.signature !== signature;
157
+ const shouldForceCollect = forceCollect || forceRefresh || signatureChanged;
158
+ if (!shouldForceCollect) {
159
+ if (entry.value && (allowEmpty || entry.value.size > 0)) return entry.value;
160
+ if (entry.promise) return entry.promise;
161
+ }
162
+ const task = (async () => {
163
+ const collected = await collectRuntimeClassSet(state.twPatcher, {
164
+ force: shouldForceCollect,
165
+ skipRefresh: true,
166
+ clearCache
167
+ });
168
+ if (allowEmpty || collected.size > 0) return collected;
169
+ await refreshTailwindRuntimeState(state, {
170
+ force: true,
171
+ clearCache: true
172
+ });
173
+ await state.readyPromise;
174
+ return collectRuntimeClassSet(state.twPatcher, {
175
+ force: true,
176
+ skipRefresh: true,
177
+ clearCache: true
178
+ });
179
+ })();
180
+ entry.promise = task;
181
+ try {
182
+ const runtimeSet = await task;
183
+ entry.value = runtimeSet;
184
+ entry.signature = await require_v3_engine.getRuntimeClassSetSignatureWithSources(state.twPatcher);
185
+ return runtimeSet;
186
+ } finally {
187
+ if (entry.promise === task) entry.promise = void 0;
188
+ }
189
+ }
190
+ function shouldPreferSync(majorVersion) {
191
+ if (majorVersion == null) return true;
192
+ if (majorVersion === 3) return true;
193
+ if (majorVersion === 4) return true;
194
+ return false;
195
+ }
196
+ function tryGetRuntimeClassSetSync(twPatcher) {
197
+ if (typeof twPatcher.getClassSetSync !== "function") return;
198
+ if (!shouldPreferSync(twPatcher.majorVersion)) return;
199
+ try {
200
+ const set = twPatcher.getClassSetSync();
201
+ if (set && set.size === 0) return;
202
+ return set;
203
+ } catch (error) {
204
+ if (twPatcher.majorVersion === 4) debug$1("getClassSetSync() unavailable for tailwindcss v4, fallback to async getClassSet(): %O", error);
205
+ else debug$1("getClassSetSync() failed, fallback to async getClassSet(): %O", error);
206
+ return;
207
+ }
208
+ }
209
+ async function collectTailwindV4GeneratorClassSet(twPatcher) {
210
+ try {
211
+ const generated = await require_v3_engine.createTailwindV4Engine(await require_v3_engine.resolveTailwindV4SourceFromPatcher(twPatcher)).generate({
212
+ scanSources: true,
213
+ target: "tailwind"
214
+ });
215
+ debug$1("runtime class set resolved via tailwindcss v4 generator source scan, size=%d", generated.classSet.size);
216
+ return generated.classSet;
217
+ } catch (error) {
218
+ debug$1("tailwindcss v4 generator source scan failed, continuing fallback chain: %O", error);
219
+ return;
220
+ }
221
+ }
222
+ async function collectRuntimeClassSet(twPatcher, options = {}) {
223
+ let activePatcher = twPatcher;
224
+ if (options.force && !options.skipRefresh) {
225
+ const refresh = activePatcher[refreshTailwindcssPatcherSymbol];
226
+ if (typeof refresh === "function") try {
227
+ const refreshed = await refresh({ clearCache: options.clearCache === true });
228
+ if (refreshed) activePatcher = refreshed;
229
+ } catch (error) {
230
+ debug$1("refreshTailwindcssPatcher failed, continuing with existing patcher: %O", error);
231
+ }
232
+ }
233
+ const entry = require_v3_engine.getRuntimeClassSetCacheEntry(activePatcher);
234
+ const signature = await require_v3_engine.getRuntimeClassSetSignatureWithSources(activePatcher);
235
+ if (!options.force) {
236
+ if (entry.value && entry.signature === signature) return entry.value;
237
+ if (entry.promise) return entry.promise;
238
+ } else entry.value = void 0;
239
+ const task = (async () => {
240
+ await require_v3_engine.ensureTailwindcssRuntimePatch(activePatcher);
241
+ const preExtractSyncSet = options.force ? tryGetRuntimeClassSetSync(activePatcher) : void 0;
242
+ if (preExtractSyncSet) debug$1("runtime class set snapshot via getClassSetSync() before extract(), size=%d", preExtractSyncSet.size);
243
+ const preferExtract = options.force === true;
244
+ try {
245
+ const result = await activePatcher.extract({ write: false });
246
+ if (result?.classSet) {
247
+ if (result.classSet.size > 0) {
248
+ debug$1("runtime class set resolved via extract(), size=%d", result.classSet.size);
249
+ return result.classSet;
250
+ }
251
+ if (preferExtract && activePatcher.majorVersion !== 4) {
252
+ debug$1("runtime class set resolved via empty extract() on force collect, size=0");
253
+ return result.classSet;
254
+ }
255
+ if (preferExtract) debug$1("runtime class set from extract() is empty on force collect, fallback to generator/sync/async class set");
256
+ else debug$1("runtime class set from extract() is empty, fallback to sync/async class set");
257
+ }
258
+ } catch (error) {
259
+ debug$1("extract() failed, fallback to getClassSet(): %O", error);
260
+ }
261
+ if (activePatcher.majorVersion === 4) {
262
+ const generatorClassSet = await collectTailwindV4GeneratorClassSet(activePatcher);
263
+ if (generatorClassSet && generatorClassSet.size > 0) return generatorClassSet;
264
+ }
265
+ if (preExtractSyncSet) {
266
+ debug$1("runtime class set fallback to pre-extract sync snapshot, size=%d", preExtractSyncSet.size);
267
+ return preExtractSyncSet;
268
+ }
269
+ const syncSet = tryGetRuntimeClassSetSync(activePatcher);
270
+ if (syncSet) {
271
+ debug$1("runtime class set resolved via getClassSetSync(), size=%d", syncSet.size);
272
+ return syncSet;
273
+ }
274
+ try {
275
+ const fallbackSet = await Promise.resolve(activePatcher.getClassSet());
276
+ if (fallbackSet) {
277
+ debug$1("runtime class set resolved via getClassSet(), size=%d", fallbackSet.size);
278
+ return fallbackSet;
279
+ }
280
+ } catch (error) {
281
+ debug$1("getClassSet() failed, returning empty set: %O", error);
282
+ }
283
+ return /* @__PURE__ */ new Set();
284
+ })();
285
+ entry.promise = task;
286
+ entry.signature = signature;
287
+ try {
288
+ const resolved = await task;
289
+ entry.value = resolved;
290
+ entry.promise = void 0;
291
+ entry.signature = signature;
292
+ return resolved;
293
+ } catch (error) {
294
+ entry.promise = void 0;
295
+ throw error;
296
+ }
297
+ }
298
+ //#endregion
299
+ //#region src/tailwindcss/runtime-logs.ts
300
+ const runtimeLogDedupeHolder = globalThis;
301
+ const runtimeLogDedupe = runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ ?? (runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ = /* @__PURE__ */ new Set());
302
+ function createRuntimeLogKey(category, baseDir, rootPath, version) {
303
+ return JSON.stringify([
304
+ category,
305
+ baseDir ?? node_process.default.cwd(),
306
+ rootPath ?? "",
307
+ version ?? ""
308
+ ]);
309
+ }
310
+ function markRuntimeLog(category, baseDir, rootPath, version) {
311
+ const key = createRuntimeLogKey(category, baseDir, rootPath, version);
312
+ if (runtimeLogDedupe.has(key)) return false;
313
+ runtimeLogDedupe.add(key);
314
+ return true;
315
+ }
316
+ function logRuntimeTailwindcssTarget(baseDir, rootPath, version) {
317
+ if (!markRuntimeLog("target", baseDir, rootPath, version)) return;
318
+ const versionText = version ? ` (v${version})` : "";
319
+ _weapp_tailwindcss_logger.logger.info("%s 使用 Tailwind CSS%s", "Weapp-tailwindcss", versionText);
320
+ }
321
+ function logRuntimeTailwindcssVersion(baseDir, rootPath, version) {
322
+ if (version) {
323
+ if (!markRuntimeLog("version", baseDir, rootPath, version)) return;
324
+ _weapp_tailwindcss_logger.logger.success(`当前使用 ${_weapp_tailwindcss_logger.pc.cyanBright("Tailwind CSS")} 版本为: ${_weapp_tailwindcss_logger.pc.underline(_weapp_tailwindcss_logger.pc.bold(_weapp_tailwindcss_logger.pc.green(version)))}`);
325
+ return;
326
+ }
327
+ if (!markRuntimeLog("missing", baseDir, rootPath, version)) return;
328
+ _weapp_tailwindcss_logger.logger.warn(`${_weapp_tailwindcss_logger.pc.cyanBright("Tailwind CSS")} 未安装,已跳过版本检测与运行时初始化。`);
329
+ }
330
+ //#endregion
331
+ //#region src/tailwindcss/targets.ts
332
+ function formatRelativeToBase(targetPath, baseDir) {
333
+ const normalized = node_path.default.normalize(targetPath);
334
+ if (!baseDir) return normalized.replace(/\\/g, "/");
335
+ const relative = node_path.default.relative(baseDir, normalized);
336
+ if (!relative || relative === ".") return ".";
337
+ if (relative.startsWith("..")) return normalized.replace(/\\/g, "/");
338
+ return node_path.default.join(".", relative).replace(/\\/g, "/");
339
+ }
340
+ function logTailwindcssTarget(patcher, baseDir) {
341
+ const packageInfo = patcher?.packageInfo;
342
+ const label = "Weapp-tailwindcss";
343
+ if (!packageInfo?.rootPath) {
344
+ _weapp_tailwindcss_logger.logger.warn("%s 未找到 Tailwind CSS 依赖,请检查在 %s 是否已安装 tailwindcss", label, baseDir ?? node_process.default.cwd());
345
+ return;
346
+ }
347
+ const displayPath = formatRelativeToBase(packageInfo.rootPath, baseDir);
348
+ const version = packageInfo.version ? ` (v${packageInfo.version})` : "";
349
+ logRuntimeTailwindcssTarget(baseDir, packageInfo.rootPath, packageInfo.version);
350
+ _weapp_tailwindcss_logger.logger.debug("%s 解析 Tailwind CSS -> %s%s", label, displayPath, version);
351
+ }
352
+ //#endregion
353
+ //#region src/unocss/index.ts
354
+ function normalizeUnocssOptions(unocss) {
355
+ return require_v3_engine.resolveBooleanObjectOption(unocss, {});
356
+ }
357
+ function resolveUnocssBareArbitraryValues(arbitraryValues, unocss) {
358
+ const baseArbitraryValues = arbitraryValues ?? {};
359
+ const options = normalizeUnocssOptions(unocss);
360
+ if (!options) return baseArbitraryValues;
361
+ if (baseArbitraryValues.bareArbitraryValues !== void 0 && baseArbitraryValues.bareArbitraryValues !== false) return baseArbitraryValues;
362
+ const bareArbitraryValues = options.bareArbitraryValues ?? true;
363
+ if (bareArbitraryValues === false) return baseArbitraryValues;
364
+ return {
365
+ ...baseArbitraryValues,
366
+ bareArbitraryValues
367
+ };
368
+ }
369
+ //#endregion
370
+ //#region src/context/compiler-context-cache.ts
371
+ const PAREN_CONTENT_RE = /\(([^)]+)\)/u;
372
+ const AT_LOCATION_RE = /at\s+(\S.*)$/u;
373
+ const TRAILING_LINE_COL_RE = /:\d+(?::\d+)?$/u;
374
+ const globalCacheHolder = globalThis;
375
+ const compilerContextCache = globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ ?? (globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ = /* @__PURE__ */ new Map());
376
+ const compilerContextKeyCacheByOptions = /* @__PURE__ */ new WeakMap();
377
+ const compilerContextKeyCacheWithoutOptions = /* @__PURE__ */ new Map();
378
+ function withCircularGuard(value, stack, factory) {
379
+ if (stack.has(value)) throw new TypeError("Cannot serialize circular structure in compiler context options");
380
+ stack.add(value);
381
+ try {
382
+ return factory();
383
+ } finally {
384
+ stack.delete(value);
385
+ }
386
+ }
387
+ function encodeTaggedValue(type, value) {
388
+ const record = { __type: type };
389
+ if (value !== void 0) record["value"] = value;
390
+ return record;
391
+ }
392
+ function hasExplicitOptionBasedir(opts) {
393
+ return typeof opts?.tailwindcssBasedir === "string" && opts.tailwindcssBasedir.length > 0;
394
+ }
395
+ function shouldProbeCallerLocation(opts) {
396
+ if (hasExplicitOptionBasedir(opts)) return false;
397
+ return !(node_process.default.env["WEAPP_TAILWINDCSS_BASEDIR"] || node_process.default.env["WEAPP_TAILWINDCSS_BASE_DIR"] || node_process.default.env["TAILWINDCSS_BASEDIR"] || node_process.default.env["TAILWINDCSS_BASE_DIR"]);
398
+ }
399
+ function detectCallerLocation() {
400
+ const stack = (/* @__PURE__ */ new Error("compiler-context-cache stack probe")).stack;
401
+ if (!stack) return;
402
+ const lines = stack.split("\n");
403
+ for (const line of lines) {
404
+ const location = (line.match(PAREN_CONTENT_RE) ?? line.match(AT_LOCATION_RE))?.[1];
405
+ if (!location) continue;
406
+ const candidatePath = location.replace(TRAILING_LINE_COL_RE, "");
407
+ if (!candidatePath || !node_path.default.isAbsolute(candidatePath)) continue;
408
+ if (candidatePath.includes(`${node_path.default.sep}weapp-tailwindcss${node_path.default.sep}src${node_path.default.sep}`) || candidatePath.includes(`${node_path.default.sep}weapp-tailwindcss${node_path.default.sep}dist${node_path.default.sep}`) || candidatePath.includes(`${node_path.default.sep}node_modules${node_path.default.sep}weapp-tailwindcss${node_path.default.sep}`)) continue;
409
+ return candidatePath;
410
+ }
411
+ }
412
+ function getRuntimeCacheScope(opts) {
413
+ if (hasExplicitOptionBasedir(opts)) return { caller: void 0 };
414
+ const runtimeScope = {
415
+ caller: void 0,
416
+ cwd: node_process.default.cwd(),
417
+ init_cwd: node_process.default.env["INIT_CWD"],
418
+ npm_config_local_prefix: node_process.default.env["npm_config_local_prefix"],
419
+ npm_package_json: node_process.default.env["npm_package_json"],
420
+ pnpm_package_name: node_process.default.env["PNPM_PACKAGE_NAME"],
421
+ pwd: node_process.default.env["PWD"],
422
+ tailwindcss_base_dir: node_process.default.env["TAILWINDCSS_BASE_DIR"],
423
+ tailwindcss_basedir: node_process.default.env["TAILWINDCSS_BASEDIR"],
424
+ uni_app_input_dir: node_process.default.env["UNI_APP_INPUT_DIR"],
425
+ uni_cli_root: node_process.default.env["UNI_CLI_ROOT"],
426
+ uni_input_dir: node_process.default.env["UNI_INPUT_DIR"],
427
+ uni_input_root: node_process.default.env["UNI_INPUT_ROOT"],
428
+ weapp_tailwindcss_base_dir: node_process.default.env["WEAPP_TAILWINDCSS_BASE_DIR"],
429
+ weapp_tailwindcss_basedir: node_process.default.env["WEAPP_TAILWINDCSS_BASEDIR"]
430
+ };
431
+ if (shouldProbeCallerLocation(opts)) runtimeScope.caller = detectCallerLocation();
432
+ return runtimeScope;
433
+ }
434
+ function serializeNormalizedValue(value) {
435
+ return JSON.stringify(value);
436
+ }
437
+ function createRuntimeCacheScopeKey(opts) {
438
+ return serializeNormalizedValue(normalizeOptionsValue(getRuntimeCacheScope(opts)));
439
+ }
440
+ function getCompilerContextKeyCacheStore(opts) {
441
+ if (!opts) return compilerContextKeyCacheWithoutOptions;
442
+ let store = compilerContextKeyCacheByOptions.get(opts);
443
+ if (!store) {
444
+ store = /* @__PURE__ */ new Map();
445
+ compilerContextKeyCacheByOptions.set(opts, store);
446
+ }
447
+ return store;
448
+ }
449
+ function createComparableNormalizedValue(rawValue, stack) {
450
+ const normalized = normalizeOptionsValue(rawValue, stack);
451
+ return {
452
+ normalized,
453
+ sortKey: serializeNormalizedValue(normalized)
454
+ };
455
+ }
456
+ function getRuntimeCacheScopeValue(opts) {
457
+ return {
458
+ options: opts ?? {},
459
+ runtime: getRuntimeCacheScope(opts)
460
+ };
461
+ }
462
+ function normalizeOptionsValue(rawValue, stack = /* @__PURE__ */ new WeakSet()) {
463
+ if (rawValue === null) return null;
464
+ if (rawValue === void 0) return encodeTaggedValue("Undefined");
465
+ const type = typeof rawValue;
466
+ if (type === "string") return rawValue;
467
+ if (type === "boolean") return rawValue;
468
+ if (type === "number") {
469
+ const numericValue = rawValue;
470
+ if (Number.isNaN(numericValue)) return encodeTaggedValue("Number", "NaN");
471
+ if (!Number.isFinite(numericValue)) return encodeTaggedValue("Number", numericValue > 0 ? "Infinity" : "-Infinity");
472
+ if (Object.is(numericValue, -0)) return encodeTaggedValue("Number", "-0");
473
+ return numericValue;
474
+ }
475
+ if (type === "bigint") return encodeTaggedValue("BigInt", rawValue.toString());
476
+ if (type === "symbol") {
477
+ const symbolValue = rawValue;
478
+ return encodeTaggedValue("Symbol", symbolValue.description ?? String(symbolValue));
479
+ }
480
+ if (type === "function") return encodeTaggedValue("Function", rawValue.toString());
481
+ if (Array.isArray(rawValue)) return withCircularGuard(rawValue, stack, () => rawValue.map((item) => normalizeOptionsValue(item, stack)));
482
+ if (rawValue instanceof Date) return encodeTaggedValue("Date", rawValue.toISOString());
483
+ if (rawValue instanceof RegExp) return {
484
+ __type: "RegExp",
485
+ source: rawValue.source,
486
+ flags: rawValue.flags
487
+ };
488
+ if (typeof node_buffer.Buffer !== "undefined" && node_buffer.Buffer.isBuffer(rawValue)) return encodeTaggedValue("Buffer", rawValue.toString("base64"));
489
+ if (ArrayBuffer.isView(rawValue)) {
490
+ const view = rawValue;
491
+ const buffer = node_buffer.Buffer.from(view.buffer, view.byteOffset, view.byteLength);
492
+ return encodeTaggedValue(view.constructor?.name ?? "ArrayBufferView", buffer.toString("base64"));
493
+ }
494
+ if (rawValue instanceof ArrayBuffer) return encodeTaggedValue("ArrayBuffer", node_buffer.Buffer.from(rawValue).toString("base64"));
495
+ if (rawValue instanceof Set) return withCircularGuard(rawValue, stack, () => {
496
+ const normalizedEntries = Array.from(rawValue, (element) => createComparableNormalizedValue(element, stack));
497
+ normalizedEntries.sort((a, b) => a.sortKey.localeCompare(b.sortKey));
498
+ return {
499
+ __type: "Set",
500
+ value: normalizedEntries.map((entry) => entry.normalized)
501
+ };
502
+ });
503
+ if (rawValue instanceof Map) return withCircularGuard(rawValue, stack, () => {
504
+ const normalizedEntries = Array.from(rawValue.entries(), ([key, entryValue]) => {
505
+ const normalizedKey = createComparableNormalizedValue(key, stack);
506
+ return {
507
+ key: normalizedKey.normalized,
508
+ sortKey: normalizedKey.sortKey,
509
+ value: normalizeOptionsValue(entryValue, stack)
510
+ };
511
+ });
512
+ normalizedEntries.sort((a, b) => a.sortKey.localeCompare(b.sortKey));
513
+ return {
514
+ __type: "Map",
515
+ value: normalizedEntries.map((entry) => [entry.key, entry.value])
516
+ };
517
+ });
518
+ if (typeof URL !== "undefined" && rawValue instanceof URL) return encodeTaggedValue("URL", rawValue.toString());
519
+ if (rawValue instanceof Error) {
520
+ const errorValue = rawValue;
521
+ return {
522
+ __type: "Error",
523
+ name: errorValue.name,
524
+ message: errorValue.message,
525
+ stack: errorValue.stack ?? ""
526
+ };
527
+ }
528
+ if (rawValue instanceof Promise) return encodeTaggedValue("Promise");
529
+ if (rawValue instanceof WeakMap) return encodeTaggedValue("WeakMap");
530
+ if (rawValue instanceof WeakSet) return encodeTaggedValue("WeakSet");
531
+ if (rawValue && typeof rawValue === "object") return withCircularGuard(rawValue, stack, () => {
532
+ const result = {};
533
+ const entries = Object.entries(rawValue);
534
+ entries.sort(([a], [b]) => a.localeCompare(b));
535
+ for (const [key, entryValue] of entries) result[key] = normalizeOptionsValue(entryValue, stack);
536
+ return result;
537
+ });
538
+ return encodeTaggedValue(typeof rawValue, String(rawValue));
539
+ }
540
+ function createCompilerContextCacheKey(opts) {
541
+ try {
542
+ const runtimeCacheScopeKey = createRuntimeCacheScopeKey(opts);
543
+ const keyStore = getCompilerContextKeyCacheStore(opts);
544
+ const cached = keyStore.get(runtimeCacheScopeKey);
545
+ if (cached !== void 0) return cached;
546
+ const cacheKey = (0, _weapp_tailwindcss_shared_node.md5)(serializeNormalizedValue(normalizeOptionsValue(getRuntimeCacheScopeValue(opts))));
547
+ keyStore.set(runtimeCacheScopeKey, cacheKey);
548
+ return cacheKey;
549
+ } catch (error) {
550
+ _weapp_tailwindcss_logger.logger.debug("skip compiler context cache: %O", error);
551
+ return;
552
+ }
553
+ }
554
+ function withCompilerContextCache(opts, factory) {
555
+ const cacheKey = createCompilerContextCacheKey(opts);
556
+ if (cacheKey) {
557
+ const cached = compilerContextCache.get(cacheKey);
558
+ if (cached) return cached;
559
+ }
560
+ const ctx = factory();
561
+ if (cacheKey) compilerContextCache.set(cacheKey, ctx);
562
+ return ctx;
563
+ }
564
+ //#endregion
565
+ //#region src/context/custom-attributes.ts
566
+ function toCustomAttributesEntities(customAttributes) {
567
+ if (!customAttributes) return [];
568
+ if ((0, _weapp_tailwindcss_shared.isMap)(customAttributes)) return [...customAttributes.entries()];
569
+ return Object.entries(customAttributes);
570
+ }
571
+ //#endregion
572
+ //#region src/babel/index.ts
573
+ function _interopDefaultCompat(e) {
574
+ return e && typeof e === "object" && "default" in e ? e.default : e;
575
+ }
576
+ const traverse = _interopDefaultCompat(_babel_traverse.default);
577
+ //#endregion
578
+ //#region src/utils/regex.ts
579
+ function escapeStringRegexp(str) {
580
+ if (typeof str !== "string") throw new TypeError("Expected a string");
581
+ return str.replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&").replaceAll("-", "\\x2d");
582
+ }
583
+ //#endregion
584
+ //#region src/utils/nameMatcher.ts
585
+ const NEVER_MATCH_NAME$1 = () => false;
586
+ const GLOBAL_FLAG_REGEXP = /g/g;
587
+ function buildFuzzyMatcher(fuzzyStrings) {
588
+ if (fuzzyStrings.length === 0) return;
589
+ if (fuzzyStrings.length === 1) {
590
+ const [needle] = fuzzyStrings;
591
+ if (needle === void 0) return;
592
+ return (value) => value.includes(needle);
593
+ }
594
+ const unique = [...new Set(fuzzyStrings)];
595
+ const pattern = new RegExp(unique.map(escapeStringRegexp).join("|"));
596
+ return (value) => pattern.test(value);
597
+ }
598
+ function normaliseRegex(regex) {
599
+ const { source, flags } = regex;
600
+ if (!flags.includes("g")) return regex;
601
+ return new RegExp(source, flags.replace(GLOBAL_FLAG_REGEXP, ""));
602
+ }
603
+ function createNameMatcher(list, { exact = false } = {}) {
604
+ if (!list || list.length === 0) return NEVER_MATCH_NAME$1;
605
+ const exactStrings = exact ? /* @__PURE__ */ new Set() : void 0;
606
+ const fuzzyStrings = [];
607
+ const regexList = [];
608
+ for (const item of list) if (typeof item === "string") if (exact) exactStrings.add(item);
609
+ else fuzzyStrings.push(item);
610
+ else regexList.push(normaliseRegex(item));
611
+ if (exact) {
612
+ const exactStringCount = exactStrings?.size ?? 0;
613
+ if (exactStringCount === 1 && regexList.length === 0) {
614
+ const [needle] = exactStrings;
615
+ if (needle === void 0) return NEVER_MATCH_NAME$1;
616
+ return (value) => value === needle;
617
+ }
618
+ if (regexList.length === 0) return (value) => exactStrings.has(value);
619
+ if (exactStringCount === 0 && regexList.length === 1) {
620
+ const [regex] = regexList;
621
+ if (!regex) return NEVER_MATCH_NAME$1;
622
+ return (value) => regex.test(value);
623
+ }
624
+ return (value) => {
625
+ if (exactStrings?.has(value)) return true;
626
+ return regexList.some((regex) => regex.test(value));
627
+ };
628
+ }
629
+ const fuzzyMatcher = exact ? void 0 : buildFuzzyMatcher(fuzzyStrings);
630
+ const hasRegex = regexList.length > 0;
631
+ if (fuzzyMatcher && !hasRegex) return fuzzyMatcher;
632
+ if (!fuzzyMatcher && regexList.length === 1) {
633
+ const [regex] = regexList;
634
+ if (!regex) return NEVER_MATCH_NAME$1;
635
+ return (value) => regex.test(value);
636
+ }
637
+ return (value) => {
638
+ if (fuzzyMatcher?.(value)) return true;
639
+ if (!hasRegex) return false;
640
+ return regexList.some((regex) => regex.test(value));
641
+ };
642
+ }
643
+ //#endregion
644
+ //#region src/js/babel/parse.ts
645
+ const parseCache = new lru_cache.LRUCache({ max: require_defaults.HARD_PARSE_CACHE_MAX_ENTRIES });
646
+ function genCacheKey(source, options) {
647
+ if (typeof options === "string") return `${(0, _weapp_tailwindcss_shared_node.md5)(source)}:${options}`;
648
+ return `${(0, _weapp_tailwindcss_shared_node.md5)(source)}:${JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val)}`;
649
+ }
650
+ function normalizeCacheMaxEntries(value) {
651
+ if (typeof value !== "number" || !Number.isFinite(value)) return 128;
652
+ return Math.min(Math.max(Math.floor(value), 0), require_defaults.HARD_PARSE_CACHE_MAX_ENTRIES);
653
+ }
654
+ function normalizeCacheMaxSourceLength(value) {
655
+ if (typeof value !== "number" || !Number.isFinite(value)) return require_defaults.DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH;
656
+ return Math.max(Math.floor(value), 0);
657
+ }
658
+ function trimParseCache(maxEntries) {
659
+ while (parseCache.size > maxEntries) parseCache.pop();
660
+ }
661
+ function babelParse(code, opts = {}) {
662
+ const { cache, cacheKey, cacheMaxEntries, cacheMaxSourceLength, ...rest } = opts;
663
+ const maxEntries = normalizeCacheMaxEntries(cacheMaxEntries);
664
+ const maxSourceLength = normalizeCacheMaxSourceLength(cacheMaxSourceLength);
665
+ const shouldCache = cache === true && maxEntries > 0 && code.length <= maxSourceLength;
666
+ const cacheKeyString = shouldCache ? genCacheKey(code, cacheKey ?? rest) : void 0;
667
+ let result;
668
+ if (shouldCache) {
669
+ trimParseCache(maxEntries);
670
+ result = parseCache.get(cacheKeyString);
671
+ }
672
+ if (!result) {
673
+ const { cache: _cache, cacheKey: _cacheKey, cacheMaxEntries: _cacheMaxEntries, cacheMaxSourceLength: _cacheMaxSourceLength, ...parseOptions } = opts;
674
+ result = (0, _babel_parser.parse)(code, parseOptions);
675
+ if (shouldCache) {
676
+ parseCache.set(cacheKeyString, result);
677
+ trimParseCache(maxEntries);
678
+ }
679
+ }
680
+ return result;
681
+ }
682
+ //#endregion
683
+ //#region src/wxml/shared.ts
684
+ const NEWLINE_RE = /[\n\r]+/g;
685
+ function replaceWxml(original, options = {
686
+ keepEOL: false,
687
+ escapeMap: _weapp_core_escape.MappingChars2String
688
+ }) {
689
+ const { keepEOL, escapeMap, ignoreHead } = options;
690
+ let res = original;
691
+ if (!keepEOL) res = res.replaceAll(NEWLINE_RE, "");
692
+ res = (0, _weapp_core_escape.escape)(res, require_v3_engine.omitUndefined({
693
+ map: escapeMap,
694
+ ignoreHead
695
+ }));
696
+ return res;
697
+ }
698
+ //#endregion
699
+ //#region src/shared/classname-transform.ts
700
+ const escapedCandidateCacheByEscapeMap = /* @__PURE__ */ new WeakMap();
701
+ const defaultEscapedCandidateCache = /* @__PURE__ */ new Map();
702
+ let lastEscapedCandidateEscapeMap;
703
+ let lastEscapedCandidateCacheStore;
704
+ function isUrlLikeCandidate(candidate) {
705
+ return candidate.startsWith("//") || candidate.startsWith("http://") || candidate.startsWith("https://");
706
+ }
707
+ function isArbitraryValueCandidate(candidate) {
708
+ let hasOpenBracket = false;
709
+ let hasCloseBracket = false;
710
+ for (let i = 0; i < candidate.length; i++) {
711
+ const char = candidate[i];
712
+ if (char === "[") hasOpenBracket = true;
713
+ else if (char === "]") hasCloseBracket = true;
714
+ if (hasOpenBracket && hasCloseBracket) break;
715
+ }
716
+ if (!hasOpenBracket || !hasCloseBracket) return false;
717
+ if (isUrlLikeCandidate(candidate.trim())) return false;
718
+ return true;
719
+ }
720
+ function shouldEnableArbitraryValueFallbackByInputs(classNameSet, jsArbitraryValueFallback, tailwindcssMajorVersion) {
721
+ if (jsArbitraryValueFallback === true) return true;
722
+ if (jsArbitraryValueFallback === false) return false;
723
+ return tailwindcssMajorVersion === 4 && (!classNameSet || classNameSet.size === 0);
724
+ }
725
+ function shouldEnableArbitraryValueFallback({ classNameSet, jsArbitraryValueFallback, tailwindcssMajorVersion }) {
726
+ return shouldEnableArbitraryValueFallbackByInputs(classNameSet, jsArbitraryValueFallback, tailwindcssMajorVersion);
727
+ }
728
+ const SKIP_RESULT = { decision: "skip" };
729
+ const DIRECT_RESULT = { decision: "direct" };
730
+ const FALLBACK_RESULT = { decision: "fallback" };
731
+ function getEscapedCandidateCacheStore(escapeMap) {
732
+ if (!escapeMap) return defaultEscapedCandidateCache;
733
+ if (escapeMap === lastEscapedCandidateEscapeMap && lastEscapedCandidateCacheStore) return lastEscapedCandidateCacheStore;
734
+ let store = escapedCandidateCacheByEscapeMap.get(escapeMap);
735
+ if (!store) {
736
+ store = /* @__PURE__ */ new Map();
737
+ escapedCandidateCacheByEscapeMap.set(escapeMap, store);
738
+ }
739
+ lastEscapedCandidateEscapeMap = escapeMap;
740
+ lastEscapedCandidateCacheStore = store;
741
+ return store;
742
+ }
743
+ function getEscapedCandidate(candidate, escapeMap, store = getEscapedCandidateCacheStore(escapeMap)) {
744
+ let cached = store.get(candidate);
745
+ if (cached === void 0) {
746
+ cached = replaceWxml(candidate, { escapeMap });
747
+ store.set(candidate, cached);
748
+ }
749
+ return cached;
750
+ }
751
+ /**
752
+ * JS 转译严格遵循 runtime class set:
753
+ * 1. 直接命中 classNameSet 原始值;
754
+ * 2. 兼容命中 classNameSet 中已转义值;
755
+ * 3. 仅在受控条件下允许 class 语义兜底。
756
+ *
757
+ * 返回结构化结果,附带已计算的 escapedValue 以避免下游重复 escape。
758
+ */
759
+ function resolveClassNameTransformWithResult(candidate, { alwaysEscape, classNameSet, escapeMap, jsArbitraryValueFallback, jsPreserveClass, tailwindcssMajorVersion, classContext }) {
760
+ if (alwaysEscape) return DIRECT_RESULT;
761
+ if (jsPreserveClass?.(candidate)) return SKIP_RESULT;
762
+ if (classNameSet?.has(candidate)) return DIRECT_RESULT;
763
+ if (classNameSet && classNameSet.size > 0) {
764
+ const escapedCandidate = getEscapedCandidate(candidate, escapeMap);
765
+ if (escapedCandidate !== candidate && classNameSet.has(escapedCandidate)) return {
766
+ decision: "escaped",
767
+ escapedValue: escapedCandidate
768
+ };
769
+ }
770
+ if (classContext && shouldEnableArbitraryValueFallbackByInputs(classNameSet, jsArbitraryValueFallback, tailwindcssMajorVersion) && isArbitraryValueCandidate(candidate)) return FALLBACK_RESULT;
771
+ return SKIP_RESULT;
772
+ }
773
+ //#endregion
774
+ //#region src/utils/decode.ts
775
+ const unicodeEscapeRE = /\\u([\dA-Fa-f]{4})/g;
776
+ const unicodeEscapeTestRE = /\\u[\dA-Fa-f]{4}/;
777
+ function decodeUnicode(value) {
778
+ if (!unicodeEscapeTestRE.test(value)) return value;
779
+ return value.replace(unicodeEscapeRE, (_match, hex) => {
780
+ const codePoint = Number.parseInt(hex, 16);
781
+ return Number.isNaN(codePoint) ? _match : String.fromCharCode(codePoint);
782
+ });
783
+ }
784
+ function decodeUnicode2(input) {
785
+ if (!unicodeEscapeTestRE.test(input)) return input;
786
+ try {
787
+ return JSON.parse(`"${input}"`);
788
+ } catch (_error) {
789
+ return decodeUnicode(input);
790
+ }
791
+ }
792
+ //#endregion
793
+ //#region src/js/class-context.ts
794
+ const CLASS_LIKE_KEYWORDS = new Set([
795
+ "class",
796
+ "classname",
797
+ "hoverclass",
798
+ "virtualhostclass",
799
+ "rootclass"
800
+ ]);
801
+ const CLASS_HELPER_IDENTIFIERS = new Set([
802
+ "cn",
803
+ "clsx",
804
+ "classnames",
805
+ "twmerge",
806
+ "cva",
807
+ "tv",
808
+ "cx",
809
+ "r"
810
+ ]);
811
+ const DASH_CODE = 45;
812
+ const COLON_CODE = 58;
813
+ const UPPERCASE_A_CODE = 65;
814
+ const UPPERCASE_Z_CODE = 90;
815
+ const UNDERSCORE_CODE = 95;
816
+ const ASCII_MAX_CODE = 127;
817
+ const NORMALIZE_KEYWORD_REGEXP = /[-_:]/g;
818
+ function normalizeKeyword(name) {
819
+ const length = name.length;
820
+ let firstNormalizedIndex = -1;
821
+ for (let i = 0; i < length; i++) {
822
+ const code = name.charCodeAt(i);
823
+ if (code === DASH_CODE || code === UNDERSCORE_CODE || code === COLON_CODE || code >= UPPERCASE_A_CODE && code <= UPPERCASE_Z_CODE) {
824
+ firstNormalizedIndex = i;
825
+ break;
826
+ }
827
+ if (code > ASCII_MAX_CODE) return name.replace(NORMALIZE_KEYWORD_REGEXP, "").toLowerCase();
828
+ }
829
+ if (firstNormalizedIndex === -1) return name;
830
+ let normalized = name.slice(0, firstNormalizedIndex);
831
+ for (let i = firstNormalizedIndex; i < length; i++) {
832
+ const code = name.charCodeAt(i);
833
+ if (code === DASH_CODE || code === UNDERSCORE_CODE || code === COLON_CODE) continue;
834
+ if (code >= UPPERCASE_A_CODE && code <= UPPERCASE_Z_CODE) {
835
+ normalized += String.fromCharCode(code + 32);
836
+ continue;
837
+ }
838
+ if (code > ASCII_MAX_CODE) return name.replace(NORMALIZE_KEYWORD_REGEXP, "").toLowerCase();
839
+ normalized += name[i];
840
+ }
841
+ return normalized;
842
+ }
843
+ function readObjectKeyName(path) {
844
+ if (path.isIdentifier()) return path.node.name;
845
+ if (path.isStringLiteral()) return path.node.value;
846
+ if (path.isTemplateLiteral() && path.node.expressions.length === 0) return path.node.quasis[0]?.value.cooked ?? path.node.quasis[0]?.value.raw;
847
+ }
848
+ function isClassLikeObjectProperty(path, valuePath) {
849
+ if (!path.isObjectProperty()) return false;
850
+ if (path.get("value") !== valuePath) return false;
851
+ const keyName = readObjectKeyName(path.get("key"));
852
+ if (!keyName) return false;
853
+ return CLASS_LIKE_KEYWORDS.has(normalizeKeyword(keyName));
854
+ }
855
+ function isClassLikeJsxAttribute(path) {
856
+ if (!path.isJSXAttribute()) return false;
857
+ const namePath = path.get("name");
858
+ if (!namePath.isJSXIdentifier()) return false;
859
+ return CLASS_LIKE_KEYWORDS.has(normalizeKeyword(namePath.node.name));
860
+ }
861
+ function readCallHelperName(calleePath) {
862
+ if (calleePath.isIdentifier()) return calleePath.node.name;
863
+ if (calleePath.isMemberExpression()) {
864
+ const propertyPath = calleePath.get("property");
865
+ if (propertyPath.isIdentifier()) return propertyPath.node.name;
866
+ if (propertyPath.isStringLiteral()) return propertyPath.node.value;
867
+ }
868
+ }
869
+ function isClassLikeCallExpression(path, valuePath) {
870
+ if (!path.isCallExpression()) return false;
871
+ const helperName = readCallHelperName(path.get("callee"));
872
+ if (!helperName || !CLASS_HELPER_IDENTIFIERS.has(normalizeKeyword(helperName))) return false;
873
+ return path.get("arguments").some((argumentPath) => argumentPath.node === valuePath.node);
874
+ }
875
+ /**
876
+ * 判断字符串字面量是否处于 class 语义上下文。
877
+ * 仅用于受控兜底场景,避免将普通业务文本误判为 class。
878
+ */
879
+ function isClassContextLiteralPath(path) {
880
+ let current = path;
881
+ while (current.parentPath) {
882
+ const parent = current.parentPath;
883
+ if (isClassLikeObjectProperty(parent, current)) return true;
884
+ if (isClassLikeJsxAttribute(parent)) return true;
885
+ if (isClassLikeCallExpression(parent, current)) return true;
886
+ current = parent;
887
+ }
888
+ return false;
889
+ }
890
+ //#endregion
891
+ //#region src/js/replacement-cache.ts
892
+ const replacementCacheByEscapeMap = /* @__PURE__ */ new WeakMap();
893
+ const defaultReplacementCache = /* @__PURE__ */ new Map();
894
+ function getReplacementCacheStore(escapeMap) {
895
+ if (!escapeMap) return defaultReplacementCache;
896
+ let store = replacementCacheByEscapeMap.get(escapeMap);
897
+ if (!store) {
898
+ store = /* @__PURE__ */ new Map();
899
+ replacementCacheByEscapeMap.set(escapeMap, store);
900
+ }
901
+ return store;
902
+ }
903
+ function getReplacement(candidate, escapeMap, store = getReplacementCacheStore(escapeMap)) {
904
+ let cached = store.get(candidate);
905
+ if (cached === void 0) {
906
+ cached = replaceWxml(candidate, { escapeMap });
907
+ store.set(candidate, cached);
908
+ }
909
+ return cached;
910
+ }
911
+ //#endregion
912
+ //#region src/js/handlers.ts
913
+ const debug = require_v3_engine.createDebug("[js:handlers] ");
914
+ const WEAPP_TW_IGNORE_MARKER = "weapp-tw";
915
+ const IGNORE_MARKER = "ignore";
916
+ function hasIgnoreComment(node) {
917
+ const { leadingComments } = node;
918
+ if (!Array.isArray(leadingComments) || leadingComments.length === 0) return false;
919
+ for (const comment of leadingComments) {
920
+ const { value } = comment;
921
+ if (value.includes(WEAPP_TW_IGNORE_MARKER) && value.includes(IGNORE_MARKER)) return true;
922
+ }
923
+ return false;
924
+ }
925
+ function extractLiteralValue(path, { unescapeUnicode }) {
926
+ const { node } = path;
927
+ let offset = 0;
928
+ let original;
929
+ if (node.type === "StringLiteral") {
930
+ offset = 1;
931
+ original = node.value;
932
+ } else if (node.type === "TemplateElement") original = node.value.raw;
933
+ else original = "";
934
+ let literal = original;
935
+ if (unescapeUnicode && original.includes("\\u")) literal = decodeUnicode2(original);
936
+ return {
937
+ literal,
938
+ offset,
939
+ original
940
+ };
941
+ }
942
+ function createCandidatePlanResolver(options, classContext) {
943
+ const { escapeMap } = options;
944
+ const replacementCache = getReplacementCacheStore(escapeMap);
945
+ const transformOptions = classContext ? {
946
+ ...options,
947
+ classContext
948
+ } : options;
949
+ let firstCandidate = "";
950
+ let firstPlan;
951
+ let cache;
952
+ const buildCandidatePlan = (candidate) => {
953
+ const result = resolveClassNameTransformWithResult(candidate, transformOptions);
954
+ if (result.decision === "skip") return { result };
955
+ let replacement;
956
+ if (result.decision === "escaped" && result.escapedValue) {
957
+ replacement = result.escapedValue;
958
+ replacementCache.set(candidate, replacement);
959
+ } else replacement = getReplacement(candidate, escapeMap, replacementCache);
960
+ return {
961
+ result,
962
+ replacement
963
+ };
964
+ };
965
+ return (candidate) => {
966
+ if (cache) {
967
+ const cached = cache.get(candidate);
968
+ if (cached) return cached;
969
+ } else if (firstPlan && candidate === firstCandidate) return firstPlan;
970
+ const plan = buildCandidatePlan(candidate);
971
+ if (!firstPlan) {
972
+ firstCandidate = candidate;
973
+ firstPlan = plan;
974
+ return plan;
975
+ }
976
+ if (!cache) {
977
+ cache = /* @__PURE__ */ new Map();
978
+ cache.set(firstCandidate, firstPlan);
979
+ }
980
+ cache.set(candidate, plan);
981
+ return plan;
982
+ };
983
+ }
984
+ function replaceHandleValue(path, options) {
985
+ const { needEscaped = false } = options;
986
+ const { classNameSet, alwaysEscape } = options;
987
+ const fallbackEnabled = shouldEnableArbitraryValueFallback(options);
988
+ if (!alwaysEscape && !fallbackEnabled && (!classNameSet || classNameSet.size === 0)) return;
989
+ if (hasIgnoreComment(path.node)) return;
990
+ const { literal, original, offset } = extractLiteralValue(path, options);
991
+ const candidates = (0, tailwindcss_patch.splitCandidateTokens)(literal);
992
+ if (candidates.length === 0) return;
993
+ const debugEnabled = debug.enabled;
994
+ const classContext = options.wrapExpression || isClassContextLiteralPath(path);
995
+ let transformed = literal;
996
+ let mutated = false;
997
+ let matchedCandidateCount = 0;
998
+ let escapedDecisionCount = 0;
999
+ let fallbackDecisionCount = 0;
1000
+ let escapedSamples;
1001
+ let skippedSamples;
1002
+ const resolveCandidatePlan = createCandidatePlanResolver(options, classContext);
1003
+ for (const candidate of candidates) {
1004
+ const plan = resolveCandidatePlan(candidate);
1005
+ if (plan.result.decision === "skip") {
1006
+ if (debugEnabled) {
1007
+ if (!skippedSamples) skippedSamples = [];
1008
+ if (skippedSamples.length < 6) skippedSamples.push(candidate);
1009
+ }
1010
+ continue;
1011
+ }
1012
+ if (debugEnabled) {
1013
+ matchedCandidateCount += 1;
1014
+ if (plan.result.decision === "escaped") {
1015
+ escapedDecisionCount += 1;
1016
+ if (!escapedSamples) escapedSamples = [];
1017
+ if (escapedSamples.length < 6) escapedSamples.push(candidate);
1018
+ }
1019
+ if (plan.result.decision === "fallback") fallbackDecisionCount += 1;
1020
+ }
1021
+ const replaced = transformed.replace(candidate, plan.replacement);
1022
+ if (replaced !== transformed) {
1023
+ transformed = replaced;
1024
+ mutated = true;
1025
+ }
1026
+ }
1027
+ const node = path.node;
1028
+ if (!mutated || typeof node.start !== "number" || typeof node.end !== "number") return;
1029
+ if (debugEnabled) debug("runtimeSet size=%d fallbackTriggered=%s candidates=%d matched=%d escapedHits=%d skipped=%d file=%s escapedSamples=%s skippedSamples=%s", classNameSet?.size ?? 0, fallbackDecisionCount > 0, candidates.length, matchedCandidateCount, escapedDecisionCount, skippedSamples?.length ?? 0, options.filename ?? "unknown", escapedSamples?.join(",") || "-", skippedSamples?.join(",") || "-");
1030
+ const start = node.start + offset;
1031
+ const end = node.end - offset;
1032
+ if (start >= end || transformed === original) return;
1033
+ return {
1034
+ start,
1035
+ end,
1036
+ value: needEscaped ? (0, _ast_core_escape.jsStringEscape)(transformed) : transformed,
1037
+ path
1038
+ };
1039
+ }
1040
+ //#endregion
1041
+ //#region src/js/sourceAnalysis.ts
1042
+ function hasReplacementEntries(replacements) {
1043
+ for (const key in replacements) if (Object.hasOwn(replacements, key)) return true;
1044
+ return false;
1045
+ }
1046
+ function createModuleSpecifierReplacementToken(path, replacement) {
1047
+ const node = path.node;
1048
+ if (node.value === replacement) return;
1049
+ if (typeof node.start !== "number" || typeof node.end !== "number") return;
1050
+ const start = node.start + 1;
1051
+ const end = node.end - 1;
1052
+ if (start >= end) return;
1053
+ return {
1054
+ start,
1055
+ end,
1056
+ value: replacement,
1057
+ path
1058
+ };
1059
+ }
1060
+ function collectModuleSpecifierReplacementTokens(analysis, replacements) {
1061
+ if (!hasReplacementEntries(replacements)) return [];
1062
+ if (analysis.importDeclarations.size === 0 && analysis.exportDeclarations.size === 0 && analysis.requireCallPaths.length === 0 && analysis.walker.imports.size === 0) return [];
1063
+ const tokens = [];
1064
+ const applyReplacement = (path) => {
1065
+ const replacement = replacements[path.node.value];
1066
+ if (!replacement) return;
1067
+ const token = createModuleSpecifierReplacementToken(path, replacement);
1068
+ if (token) tokens.push(token);
1069
+ };
1070
+ for (const importPath of analysis.importDeclarations) {
1071
+ const source = importPath.get("source");
1072
+ if (source.isStringLiteral()) applyReplacement(source);
1073
+ }
1074
+ for (const exportPath of analysis.exportDeclarations) if (exportPath.isExportNamedDeclaration() || exportPath.isExportAllDeclaration()) {
1075
+ const source = exportPath.get("source");
1076
+ if (source && !Array.isArray(source) && source.isStringLiteral()) applyReplacement(source);
1077
+ }
1078
+ for (const literalPath of analysis.requireCallPaths) applyReplacement(literalPath);
1079
+ for (const token of analysis.walker.imports) {
1080
+ const replacement = replacements[token.source];
1081
+ if (replacement) token.source = replacement;
1082
+ }
1083
+ return tokens;
1084
+ }
1085
+ //#endregion
1086
+ //#region src/js/babel/process.ts
1087
+ const optionVariantsCache = /* @__PURE__ */ new WeakMap();
1088
+ function getNeedEscapedOptions(options, needEscaped) {
1089
+ if (options.needEscaped === needEscaped) return options;
1090
+ let cached = optionVariantsCache.get(options);
1091
+ if (!cached) {
1092
+ cached = {};
1093
+ optionVariantsCache.set(options, cached);
1094
+ }
1095
+ if (needEscaped) {
1096
+ if (!cached.stringLiteralOptions) cached.stringLiteralOptions = {
1097
+ ...options,
1098
+ needEscaped: true
1099
+ };
1100
+ return cached.stringLiteralOptions;
1101
+ }
1102
+ if (!cached.templateLiteralOptions) cached.templateLiteralOptions = {
1103
+ ...options,
1104
+ needEscaped: false
1105
+ };
1106
+ return cached.templateLiteralOptions;
1107
+ }
1108
+ function processUpdatedSource(rawSource, options, analysis) {
1109
+ const { targetPaths, jsTokenUpdater, ignoredPaths } = analysis;
1110
+ if (targetPaths.length === 0 && !options.moduleSpecifierReplacements && jsTokenUpdater.length === 0) return new magic_string.default(rawSource);
1111
+ const replacementTokens = [];
1112
+ for (const path of targetPaths) {
1113
+ if (ignoredPaths.has(path)) continue;
1114
+ const token = replaceHandleValue(path, path.isStringLiteral() ? getNeedEscapedOptions(options, true) : getNeedEscapedOptions(options, false));
1115
+ if (token) replacementTokens.push(token);
1116
+ }
1117
+ if (options.moduleSpecifierReplacements) replacementTokens.push(...collectModuleSpecifierReplacementTokens(analysis, options.moduleSpecifierReplacements));
1118
+ if (jsTokenUpdater.length + replacementTokens.length === 0) return new magic_string.default(rawSource);
1119
+ const ms = new magic_string.default(rawSource);
1120
+ jsTokenUpdater.push(...replacementTokens).filter((token) => !ignoredPaths.has(token.path)).updateMagicString(ms);
1121
+ return ms;
1122
+ }
1123
+ //#endregion
1124
+ //#region src/js/evalTransforms.ts
1125
+ const evalHandlerOptionsCache = /* @__PURE__ */ new WeakMap();
1126
+ const EVAL_SCOPE_ERROR_REGEXP = /pass a scope and parentPath|traversing a Program\/File/i;
1127
+ function isEvalPath(path) {
1128
+ if (path.isCallExpression()) return path.get("callee").isIdentifier({ name: "eval" });
1129
+ return false;
1130
+ }
1131
+ function createEvalReplacementToken(path, updated) {
1132
+ const node = path.node;
1133
+ let offset = 0;
1134
+ let original;
1135
+ if (path.isStringLiteral()) {
1136
+ offset = 1;
1137
+ original = path.node.value;
1138
+ } else if (path.isTemplateElement()) original = path.node.value.raw;
1139
+ else original = "";
1140
+ if (typeof node.start !== "number" || typeof node.end !== "number") return;
1141
+ const start = node.start + offset;
1142
+ const end = node.end - offset;
1143
+ if (start >= end) return;
1144
+ if (original === updated) return;
1145
+ return {
1146
+ start,
1147
+ end,
1148
+ value: path.isStringLiteral() ? (0, _ast_core_escape.jsStringEscape)(updated) : updated,
1149
+ path
1150
+ };
1151
+ }
1152
+ function handleEvalStringLiteral(path, handlerOptions, updater, handler) {
1153
+ const { code } = handler(path.node.value, handlerOptions);
1154
+ if (!code) return;
1155
+ const token = createEvalReplacementToken(path, code);
1156
+ if (token) updater.addToken(token);
1157
+ }
1158
+ function handleEvalTemplateElement(path, handlerOptions, updater, handler) {
1159
+ const { code } = handler(path.node.value.raw, handlerOptions);
1160
+ if (!code) return;
1161
+ const token = createEvalReplacementToken(path, code);
1162
+ if (token) updater.addToken(token);
1163
+ }
1164
+ function getEvalStringHandlerOptions(options) {
1165
+ if (options.needEscaped === false && options.generateMap === false) return options;
1166
+ let cached = evalHandlerOptionsCache.get(options);
1167
+ if (!cached) {
1168
+ cached = {};
1169
+ evalHandlerOptionsCache.set(options, cached);
1170
+ }
1171
+ if (!cached.stringLiteralOptions) cached.stringLiteralOptions = {
1172
+ ...options,
1173
+ needEscaped: false,
1174
+ generateMap: false
1175
+ };
1176
+ return cached.stringLiteralOptions;
1177
+ }
1178
+ function getEvalTemplateHandlerOptions(options) {
1179
+ if (options.generateMap === false) return options;
1180
+ let cached = evalHandlerOptionsCache.get(options);
1181
+ if (!cached) {
1182
+ cached = {};
1183
+ evalHandlerOptionsCache.set(options, cached);
1184
+ }
1185
+ if (!cached.templateLiteralOptions) cached.templateLiteralOptions = {
1186
+ ...options,
1187
+ generateMap: false
1188
+ };
1189
+ return cached.templateLiteralOptions;
1190
+ }
1191
+ function walkEvalExpression(path, options, updater, handler) {
1192
+ const stringHandlerOptions = getEvalStringHandlerOptions(options);
1193
+ const templateHandlerOptions = getEvalTemplateHandlerOptions(options);
1194
+ const maybeTraverse = path?.traverse;
1195
+ if (typeof maybeTraverse === "function") try {
1196
+ return maybeTraverse.call(path, {
1197
+ StringLiteral(innerPath) {
1198
+ handleEvalStringLiteral(innerPath, stringHandlerOptions, updater, handler);
1199
+ },
1200
+ TemplateElement(innerPath) {
1201
+ handleEvalTemplateElement(innerPath, templateHandlerOptions, updater, handler);
1202
+ }
1203
+ });
1204
+ } catch (error) {
1205
+ const msg = error?.message ?? "";
1206
+ if (!EVAL_SCOPE_ERROR_REGEXP.test(msg)) throw error;
1207
+ }
1208
+ const getArgs = path?.get?.("arguments");
1209
+ if (Array.isArray(getArgs)) {
1210
+ for (const arg of getArgs) {
1211
+ if (arg?.isStringLiteral?.()) {
1212
+ handleEvalStringLiteral(arg, stringHandlerOptions, updater, handler);
1213
+ continue;
1214
+ }
1215
+ if (arg?.isTemplateLiteral?.()) for (const quasi of arg.get("quasis")) handleEvalTemplateElement(quasi, templateHandlerOptions, updater, handler);
1216
+ }
1217
+ return;
1218
+ }
1219
+ const nodeArgs = path?.node?.arguments;
1220
+ if (Array.isArray(nodeArgs)) {
1221
+ for (const n of nodeArgs) if (n?.type === "StringLiteral") handleEvalStringLiteral({
1222
+ node: n,
1223
+ isStringLiteral: () => true
1224
+ }, stringHandlerOptions, updater, handler);
1225
+ else if (n?.type === "TemplateLiteral" && Array.isArray(n.quasis)) for (const q of n.quasis) handleEvalTemplateElement({
1226
+ node: q,
1227
+ isStringLiteral: () => false,
1228
+ isTemplateElement: () => true
1229
+ }, templateHandlerOptions, updater, handler);
1230
+ }
1231
+ }
1232
+ //#endregion
1233
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
1234
+ function _typeof(o) {
1235
+ "@babel/helpers - typeof";
1236
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
1237
+ return typeof o;
1238
+ } : function(o) {
1239
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
1240
+ }, _typeof(o);
1241
+ }
1242
+ var init_typeof = require_chunk.__esmMin((() => {}));
1243
+ //#endregion
1244
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
1245
+ function toPrimitive(t, r) {
1246
+ if ("object" != _typeof(t) || !t) return t;
1247
+ var e = t[Symbol.toPrimitive];
1248
+ if (void 0 !== e) {
1249
+ var i = e.call(t, r || "default");
1250
+ if ("object" != _typeof(i)) return i;
1251
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1252
+ }
1253
+ return ("string" === r ? String : Number)(t);
1254
+ }
1255
+ var init_toPrimitive = require_chunk.__esmMin((() => {
1256
+ init_typeof();
1257
+ }));
1258
+ //#endregion
1259
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
1260
+ function toPropertyKey(t) {
1261
+ var i = toPrimitive(t, "string");
1262
+ return "symbol" == _typeof(i) ? i : i + "";
1263
+ }
1264
+ var init_toPropertyKey = require_chunk.__esmMin((() => {
1265
+ init_typeof();
1266
+ init_toPrimitive();
1267
+ }));
1268
+ //#endregion
1269
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
1270
+ function _defineProperty(e, r, t) {
1271
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
1272
+ value: t,
1273
+ enumerable: !0,
1274
+ configurable: !0,
1275
+ writable: !0
1276
+ }) : e[r] = t, e;
1277
+ }
1278
+ var init_defineProperty = require_chunk.__esmMin((() => {
1279
+ init_toPropertyKey();
1280
+ }));
1281
+ //#endregion
1282
+ //#region src/js/JsTokenUpdater.ts
1283
+ init_defineProperty();
1284
+ /**
1285
+ * Lightweight helper that batches updates to {@link MagicString}.
1286
+ * It keeps the transformation logic out of the traversal code and makes
1287
+ * it easier to reason about the order in which tokens are written back.
1288
+ */
1289
+ var JsTokenUpdater = class {
1290
+ constructor({ value } = {}) {
1291
+ _defineProperty(this, "tokens", void 0);
1292
+ this.tokens = value ? [...value] : [];
1293
+ }
1294
+ addToken(token) {
1295
+ if (token) this.tokens.push(token);
1296
+ }
1297
+ push(...args) {
1298
+ this.tokens.push(...args);
1299
+ return this;
1300
+ }
1301
+ /**
1302
+ * 待写入的 token 数量。
1303
+ */
1304
+ get length() {
1305
+ return this.tokens.length;
1306
+ }
1307
+ map(callbackfn) {
1308
+ this.tokens = this.tokens.map(callbackfn);
1309
+ return this;
1310
+ }
1311
+ filter(callbackfn) {
1312
+ this.tokens = this.tokens.filter(callbackfn);
1313
+ return this;
1314
+ }
1315
+ updateMagicString(ms) {
1316
+ for (const { start, end, value } of this.tokens) ms.update(start, end, value);
1317
+ return ms;
1318
+ }
1319
+ };
1320
+ //#endregion
1321
+ //#region src/js/module-graph/ignored-exports.ts
1322
+ init_defineProperty();
1323
+ var IgnoredExportsTracker = class {
1324
+ constructor(options) {
1325
+ this.options = options;
1326
+ _defineProperty(this, "ignoredExportNames", /* @__PURE__ */ new Map());
1327
+ }
1328
+ addIgnoredExport(filename, exportName) {
1329
+ if (!exportName) return;
1330
+ let pending = this.ignoredExportNames.get(filename);
1331
+ if (!pending) {
1332
+ pending = /* @__PURE__ */ new Set();
1333
+ this.ignoredExportNames.set(filename, pending);
1334
+ }
1335
+ if (pending.has(exportName)) return;
1336
+ pending.add(exportName);
1337
+ const existing = this.options.modules.get(filename);
1338
+ if (existing) this.applyIgnoredExportsToAnalysis(filename, existing.analysis);
1339
+ }
1340
+ registerIgnoredExportsFromTokens(resolved, tokens) {
1341
+ for (const token of tokens) if (token.type === "ImportSpecifier") this.addIgnoredExport(resolved, token.imported);
1342
+ else if (token.type === "ImportDefaultSpecifier") this.addIgnoredExport(resolved, "default");
1343
+ }
1344
+ applyIgnoredExportsToAnalysis(filename, analysis) {
1345
+ const pending = this.ignoredExportNames.get(filename);
1346
+ if (!pending || pending.size === 0) return;
1347
+ const names = new Set(pending);
1348
+ pending.clear();
1349
+ const propagate = [];
1350
+ for (const exportPath of analysis.exportDeclarations) {
1351
+ if (names.size === 0) break;
1352
+ if (exportPath.isExportDefaultDeclaration()) {
1353
+ if (names.has("default")) {
1354
+ analysis.walker.walkExportDefaultDeclaration(exportPath);
1355
+ names.delete("default");
1356
+ }
1357
+ continue;
1358
+ }
1359
+ if (exportPath.isExportNamedDeclaration()) {
1360
+ const source = exportPath.node.source?.value;
1361
+ if (typeof source === "string") {
1362
+ for (const spec of exportPath.get("specifiers")) {
1363
+ if (!spec.isExportSpecifier()) continue;
1364
+ const exported = spec.get("exported");
1365
+ let exportedName;
1366
+ if (exported.isIdentifier()) exportedName = exported.node.name;
1367
+ else if (exported.isStringLiteral()) exportedName = exported.node.value;
1368
+ if (!exportedName || !names.has(exportedName)) continue;
1369
+ const local = spec.get("local");
1370
+ if (local.isIdentifier()) {
1371
+ propagate.push({
1372
+ specifier: source,
1373
+ exportName: local.node.name
1374
+ });
1375
+ names.delete(exportedName);
1376
+ } else if (local.isStringLiteral()) {
1377
+ propagate.push({
1378
+ specifier: source,
1379
+ exportName: local.node.value
1380
+ });
1381
+ names.delete(exportedName);
1382
+ }
1383
+ }
1384
+ continue;
1385
+ }
1386
+ const declaration = exportPath.get("declaration");
1387
+ if (declaration.isVariableDeclaration()) for (const decl of declaration.get("declarations")) {
1388
+ const id = decl.get("id");
1389
+ if (id.isIdentifier()) {
1390
+ const exportName = id.node.name;
1391
+ if (names.has(exportName)) {
1392
+ analysis.walker.walkVariableDeclarator(decl);
1393
+ names.delete(exportName);
1394
+ }
1395
+ }
1396
+ }
1397
+ for (const spec of exportPath.get("specifiers")) {
1398
+ if (!spec.isExportSpecifier()) continue;
1399
+ const exported = spec.get("exported");
1400
+ let exportedName;
1401
+ if (exported.isIdentifier()) exportedName = exported.node.name;
1402
+ else if (exported.isStringLiteral()) exportedName = exported.node.value;
1403
+ if (!exportedName || !names.has(exportedName)) continue;
1404
+ const local = spec.get("local");
1405
+ analysis.walker.walkNode(local);
1406
+ names.delete(exportedName);
1407
+ }
1408
+ continue;
1409
+ }
1410
+ if (exportPath.isExportAllDeclaration()) {
1411
+ const source = exportPath.node.source?.value;
1412
+ if (typeof source === "string") {
1413
+ for (const exportName of names) propagate.push({
1414
+ specifier: source,
1415
+ exportName
1416
+ });
1417
+ names.clear();
1418
+ }
1419
+ }
1420
+ }
1421
+ for (const { specifier, exportName } of propagate) {
1422
+ let resolved;
1423
+ try {
1424
+ resolved = this.options.resolve(specifier, filename);
1425
+ } catch {
1426
+ resolved = void 0;
1427
+ }
1428
+ if (!resolved) {
1429
+ pending.add(exportName);
1430
+ continue;
1431
+ }
1432
+ if (this.options.filter && !this.options.filter(resolved, specifier, filename)) {
1433
+ pending.add(exportName);
1434
+ continue;
1435
+ }
1436
+ this.addIgnoredExport(resolved, exportName);
1437
+ }
1438
+ for (const name of names) pending.add(name);
1439
+ }
1440
+ };
1441
+ //#endregion
1442
+ //#region src/js/ModuleGraph.ts
1443
+ init_defineProperty();
1444
+ var JsModuleGraph = class {
1445
+ constructor(entry, graphOptions) {
1446
+ _defineProperty(this, "modules", /* @__PURE__ */ new Map());
1447
+ _defineProperty(this, "queue", []);
1448
+ _defineProperty(this, "resolve", void 0);
1449
+ _defineProperty(this, "load", void 0);
1450
+ _defineProperty(this, "filter", void 0);
1451
+ _defineProperty(this, "maxDepth", void 0);
1452
+ _defineProperty(this, "baseOptions", void 0);
1453
+ _defineProperty(this, "parserOptions", void 0);
1454
+ _defineProperty(this, "rootFilename", void 0);
1455
+ _defineProperty(this, "ignoredExports", void 0);
1456
+ this.resolve = graphOptions.resolve;
1457
+ this.load = graphOptions.load;
1458
+ this.filter = graphOptions.filter;
1459
+ this.maxDepth = graphOptions.maxDepth ?? Number.POSITIVE_INFINITY;
1460
+ const { moduleGraph: _moduleGraph, filename: _ignoredFilename, ...rest } = entry.handlerOptions;
1461
+ this.baseOptions = {
1462
+ ...rest,
1463
+ filename: entry.filename
1464
+ };
1465
+ this.parserOptions = entry.handlerOptions.babelParserOptions;
1466
+ this.rootFilename = entry.filename;
1467
+ this.ignoredExports = new IgnoredExportsTracker({
1468
+ resolve: this.resolve,
1469
+ filter: this.filter,
1470
+ modules: this.modules
1471
+ });
1472
+ this.modules.set(entry.filename, {
1473
+ filename: entry.filename,
1474
+ source: entry.source,
1475
+ analysis: entry.analysis
1476
+ });
1477
+ this.queue.push({
1478
+ filename: entry.filename,
1479
+ depth: 0
1480
+ });
1481
+ }
1482
+ build() {
1483
+ this.collectDependencies();
1484
+ let linked;
1485
+ for (const [filename, state] of this.modules) {
1486
+ if (filename === this.rootFilename) continue;
1487
+ const childOptions = {
1488
+ ...this.baseOptions,
1489
+ filename
1490
+ };
1491
+ const code = processUpdatedSource(state.source, childOptions, state.analysis).toString();
1492
+ if (code !== state.source) {
1493
+ if (!linked) linked = {};
1494
+ linked[filename] = { code };
1495
+ }
1496
+ }
1497
+ return linked;
1498
+ }
1499
+ collectDependencies() {
1500
+ while (this.queue.length > 0) {
1501
+ const { filename, depth } = this.queue.shift();
1502
+ if (depth >= this.maxDepth) continue;
1503
+ const state = this.modules.get(filename);
1504
+ if (!state) continue;
1505
+ const dependencySpecifiers = /* @__PURE__ */ new Map();
1506
+ for (const token of state.analysis.walker.imports) {
1507
+ if (!dependencySpecifiers.has(token.source)) dependencySpecifiers.set(token.source, []);
1508
+ dependencySpecifiers.get(token.source).push(token);
1509
+ }
1510
+ for (const exportPath of state.analysis.exportDeclarations) if (exportPath.isExportAllDeclaration() || exportPath.isExportNamedDeclaration()) {
1511
+ const source = exportPath.node.source?.value;
1512
+ if (typeof source === "string" && !dependencySpecifiers.has(source)) dependencySpecifiers.set(source, []);
1513
+ }
1514
+ for (const [specifier, tokens] of dependencySpecifiers) {
1515
+ let resolved;
1516
+ try {
1517
+ resolved = this.resolve(specifier, filename);
1518
+ } catch {
1519
+ continue;
1520
+ }
1521
+ if (!resolved) continue;
1522
+ if (this.filter && !this.filter(resolved, specifier, filename)) continue;
1523
+ if (tokens.length > 0) this.ignoredExports.registerIgnoredExportsFromTokens(resolved, tokens);
1524
+ if (this.modules.has(resolved)) continue;
1525
+ let source;
1526
+ try {
1527
+ source = this.load(resolved);
1528
+ } catch {
1529
+ continue;
1530
+ }
1531
+ if (typeof source !== "string") continue;
1532
+ let analysis;
1533
+ try {
1534
+ analysis = analyzeSource(babelParse(source, {
1535
+ ...this.parserOptions,
1536
+ sourceFilename: resolved
1537
+ }), {
1538
+ ...this.baseOptions,
1539
+ filename: resolved
1540
+ });
1541
+ this.ignoredExports.applyIgnoredExportsToAnalysis(resolved, analysis);
1542
+ } catch {
1543
+ continue;
1544
+ }
1545
+ this.modules.set(resolved, {
1546
+ filename: resolved,
1547
+ source,
1548
+ analysis
1549
+ });
1550
+ this.queue.push({
1551
+ filename: resolved,
1552
+ depth: depth + 1
1553
+ });
1554
+ }
1555
+ }
1556
+ }
1557
+ };
1558
+ //#endregion
1559
+ //#region src/js/node-path-walker/export-handlers.ts
1560
+ function walkExportDeclaration(ctx, path) {
1561
+ if (path.isExportDeclaration()) {
1562
+ if (path.isExportNamedDeclaration()) walkExportNamedDeclaration(ctx, path);
1563
+ else if (path.isExportDefaultDeclaration()) walkExportDefaultDeclaration(ctx, path);
1564
+ else if (path.isExportAllDeclaration()) walkExportAllDeclaration(ctx, path);
1565
+ }
1566
+ }
1567
+ function walkExportNamedDeclaration(ctx, path) {
1568
+ const declaration = path.get("declaration");
1569
+ if (declaration.isVariableDeclaration()) for (const decl of declaration.get("declarations")) ctx.walkNode(decl);
1570
+ const specifiers = path.get("specifiers");
1571
+ for (const spec of specifiers) if (spec.isExportSpecifier()) {
1572
+ const local = spec.get("local");
1573
+ if (local.isIdentifier()) ctx.walkNode(local);
1574
+ }
1575
+ }
1576
+ function walkExportDefaultDeclaration(ctx, path) {
1577
+ const decl = path.get("declaration");
1578
+ if (decl.isIdentifier()) ctx.walkNode(decl);
1579
+ else ctx.walkNode(decl);
1580
+ }
1581
+ function walkExportAllDeclaration(ctx, path) {
1582
+ const source = path.get("source");
1583
+ if (source.isStringLiteral()) ctx.addImportToken({
1584
+ declaration: path,
1585
+ source: source.node.value,
1586
+ type: "ExportAllDeclaration"
1587
+ });
1588
+ }
1589
+ //#endregion
1590
+ //#region src/js/node-path-walker/import-tokens.ts
1591
+ function maybeAddImportToken(imports, arg) {
1592
+ if (!(arg.isImportSpecifier() && arg.node.importKind !== "type" || arg.isImportDefaultSpecifier())) return false;
1593
+ const importDeclaration = arg.parentPath;
1594
+ if (!importDeclaration.isImportDeclaration() || importDeclaration.node.importKind === "type") return false;
1595
+ if (arg.isImportSpecifier()) {
1596
+ const imported = arg.get("imported");
1597
+ if (imported.isIdentifier()) imports.add({
1598
+ declaration: importDeclaration,
1599
+ specifier: arg,
1600
+ imported: imported.node.name,
1601
+ local: arg.node.local.name,
1602
+ source: importDeclaration.node.source.value,
1603
+ type: "ImportSpecifier"
1604
+ });
1605
+ return true;
1606
+ }
1607
+ imports.add({
1608
+ declaration: importDeclaration,
1609
+ specifier: arg,
1610
+ local: arg.node.local.name,
1611
+ source: importDeclaration.node.source.value,
1612
+ type: "ImportDefaultSpecifier"
1613
+ });
1614
+ return true;
1615
+ }
1616
+ //#endregion
1617
+ //#region src/js/NodePathWalker.ts
1618
+ init_defineProperty();
1619
+ const EMPTY_IGNORE_CALL_EXPRESSION_IDENTIFIERS = [];
1620
+ const EMPTY_IMPORT_TOKENS = /* @__PURE__ */ new Set();
1621
+ function NOOP_STRING_PATH_CALLBACK() {}
1622
+ const NEVER_MATCH_NAME = () => false;
1623
+ /**
1624
+ * 遍历我们关注的调用表达式所关联的绑定,收集后续需要转换的字符串节点。
1625
+ */
1626
+ var NodePathWalker = class {
1627
+ constructor({ ignoreCallExpressionIdentifiers, callback } = {}) {
1628
+ _defineProperty(this, "ignoreCallExpressionIdentifiers", void 0);
1629
+ _defineProperty(this, "callback", void 0);
1630
+ _defineProperty(this, "isIgnoredCallIdentifier", void 0);
1631
+ _defineProperty(this, "hasIgnoredCallIdentifiers", void 0);
1632
+ _defineProperty(this, "importsStore", void 0);
1633
+ _defineProperty(this, "visitedStore", void 0);
1634
+ this.hasIgnoredCallIdentifiers = Boolean(ignoreCallExpressionIdentifiers && ignoreCallExpressionIdentifiers.length > 0);
1635
+ this.ignoreCallExpressionIdentifiers = ignoreCallExpressionIdentifiers ?? EMPTY_IGNORE_CALL_EXPRESSION_IDENTIFIERS;
1636
+ this.callback = callback ?? NOOP_STRING_PATH_CALLBACK;
1637
+ this.isIgnoredCallIdentifier = this.hasIgnoredCallIdentifiers ? createNameMatcher(this.ignoreCallExpressionIdentifiers, { exact: true }) : NEVER_MATCH_NAME;
1638
+ }
1639
+ get imports() {
1640
+ return this.importsStore ?? EMPTY_IMPORT_TOKENS;
1641
+ }
1642
+ getWritableImports() {
1643
+ if (!this.importsStore) this.importsStore = /* @__PURE__ */ new Set();
1644
+ return this.importsStore;
1645
+ }
1646
+ addImportToken(token) {
1647
+ this.getWritableImports().add(token);
1648
+ }
1649
+ getVisited() {
1650
+ if (!this.visitedStore) this.visitedStore = /* @__PURE__ */ new WeakSet();
1651
+ return this.visitedStore;
1652
+ }
1653
+ walkVariableDeclarator(path) {
1654
+ const init = path.get("init");
1655
+ this.walkNode(init);
1656
+ }
1657
+ walkTemplateLiteral(path) {
1658
+ for (const exp of path.get("expressions")) this.walkNode(exp);
1659
+ for (const quasis of path.get("quasis")) this.callback(quasis);
1660
+ }
1661
+ walkStringLiteral(path) {
1662
+ this.callback(path);
1663
+ }
1664
+ walkBinaryExpression(path) {
1665
+ const left = path.get("left");
1666
+ this.walkNode(left);
1667
+ const right = path.get("right");
1668
+ this.walkNode(right);
1669
+ }
1670
+ walkLogicalExpression(path) {
1671
+ const left = path.get("left");
1672
+ this.walkNode(left);
1673
+ const right = path.get("right");
1674
+ this.walkNode(right);
1675
+ }
1676
+ walkObjectExpression(path) {
1677
+ const props = path.get("properties");
1678
+ for (const prop of props) if (prop.isObjectProperty()) {
1679
+ const key = prop.get("key");
1680
+ this.walkNode(key);
1681
+ const value = prop.get("value");
1682
+ this.walkNode(value);
1683
+ }
1684
+ }
1685
+ walkArrayExpression(path) {
1686
+ const elements = path.get("elements");
1687
+ for (const element of elements) this.walkNode(element);
1688
+ }
1689
+ walkNode(arg) {
1690
+ const visited = this.getVisited();
1691
+ if (visited.has(arg)) return;
1692
+ visited.add(arg);
1693
+ if (arg.isIdentifier()) {
1694
+ const binding = arg?.scope?.getBinding?.(arg.node.name);
1695
+ if (binding) this.walkNode(binding.path);
1696
+ } else if (arg.isMemberExpression()) {
1697
+ const objectPath = arg.get("object");
1698
+ if (objectPath.isIdentifier()) {
1699
+ const binding = arg?.scope?.getBinding?.(objectPath.node.name);
1700
+ if (binding) {
1701
+ if (binding.path.isVariableDeclarator()) this.walkVariableDeclarator(binding.path);
1702
+ }
1703
+ }
1704
+ } else if (arg.isTemplateLiteral()) this.walkTemplateLiteral(arg);
1705
+ else if (arg.isStringLiteral()) this.walkStringLiteral(arg);
1706
+ else if (arg.isBinaryExpression()) this.walkBinaryExpression(arg);
1707
+ else if (arg.isLogicalExpression()) this.walkLogicalExpression(arg);
1708
+ else if (arg.isObjectExpression()) this.walkObjectExpression(arg);
1709
+ else if (arg.isArrayExpression()) this.walkArrayExpression(arg);
1710
+ else if (arg.isVariableDeclarator()) this.walkVariableDeclarator(arg);
1711
+ else if (maybeAddImportToken(this.getWritableImports(), arg)) {}
1712
+ }
1713
+ /**
1714
+ * Walk the arguments of a desired call expression so their bindings can be analysed.
1715
+ */
1716
+ walkCallExpression(path) {
1717
+ if (!this.hasIgnoredCallIdentifiers) return;
1718
+ const calleePath = path.get("callee");
1719
+ if (calleePath.isIdentifier() && this.isIgnoredCallIdentifier(calleePath.node.name)) for (const arg of path.get("arguments")) this.walkNode(arg);
1720
+ }
1721
+ walkExportDeclaration(path) {
1722
+ walkExportDeclaration(this, path);
1723
+ }
1724
+ walkExportNamedDeclaration(path) {
1725
+ walkExportNamedDeclaration(this, path);
1726
+ }
1727
+ walkExportDefaultDeclaration(path) {
1728
+ walkExportDefaultDeclaration(this, path);
1729
+ }
1730
+ walkExportAllDeclaration(path) {
1731
+ walkExportAllDeclaration(this, path);
1732
+ }
1733
+ };
1734
+ //#endregion
1735
+ //#region src/js/taggedTemplateIgnore.ts
1736
+ function createTaggedTemplateIgnore({ matcher, names }) {
1737
+ const bindingIgnoreCache = /* @__PURE__ */ new Map();
1738
+ const taggedTemplateIgnoreCache = /* @__PURE__ */ new WeakMap();
1739
+ const seenBindings = /* @__PURE__ */ new Set();
1740
+ let singleCanonicalIgnoreName;
1741
+ let canonicalIgnoreNames;
1742
+ for (const item of names ?? []) {
1743
+ if (typeof item !== "string") continue;
1744
+ if (singleCanonicalIgnoreName === void 0) {
1745
+ singleCanonicalIgnoreName = item;
1746
+ continue;
1747
+ }
1748
+ if (item === singleCanonicalIgnoreName) continue;
1749
+ if (!canonicalIgnoreNames) {
1750
+ canonicalIgnoreNames = new Set([singleCanonicalIgnoreName, item]);
1751
+ continue;
1752
+ }
1753
+ canonicalIgnoreNames.add(item);
1754
+ }
1755
+ const hasCanonicalIgnoreNames = singleCanonicalIgnoreName !== void 0;
1756
+ const matchesIgnoreName = (value) => {
1757
+ if (hasCanonicalIgnoreNames) {
1758
+ if (canonicalIgnoreNames) {
1759
+ if (canonicalIgnoreNames.has(value)) return true;
1760
+ } else if (value === singleCanonicalIgnoreName) return true;
1761
+ }
1762
+ return matcher(value);
1763
+ };
1764
+ const propertyMatches = (propertyPath) => {
1765
+ if (!propertyPath) return false;
1766
+ if (propertyPath.isIdentifier()) return matchesIgnoreName(propertyPath.node.name);
1767
+ if (propertyPath.isStringLiteral()) return matchesIgnoreName(propertyPath.node.value);
1768
+ return false;
1769
+ };
1770
+ const resolvesMemberExpressionToIgnore = (path, seen) => {
1771
+ if (propertyMatches(path.get("property"))) return true;
1772
+ const objectPath = path.get("object");
1773
+ if (objectPath.isIdentifier()) {
1774
+ const binding = (objectPath?.scope)?.getBinding?.(objectPath.node.name);
1775
+ if (binding) return resolvesToWeappTwIgnore(binding, seen);
1776
+ }
1777
+ return false;
1778
+ };
1779
+ const resolvesToWeappTwIgnore = (binding, seen) => {
1780
+ const cached = bindingIgnoreCache.get(binding);
1781
+ if (cached !== void 0) return cached;
1782
+ if (seen.has(binding)) return false;
1783
+ seen.add(binding);
1784
+ let result = false;
1785
+ const bindingPath = binding.path;
1786
+ if (bindingPath.isImportSpecifier()) {
1787
+ const imported = bindingPath.node.imported;
1788
+ if (imported.type === "Identifier" && matchesIgnoreName(imported.name)) result = true;
1789
+ else if (imported.type === "StringLiteral" && matchesIgnoreName(imported.value)) result = true;
1790
+ } else if (bindingPath.isVariableDeclarator()) {
1791
+ const init = bindingPath.get("init");
1792
+ if (init && init.node) {
1793
+ if (init.isIdentifier()) {
1794
+ const target = binding?.scope?.getBinding?.(init.node.name);
1795
+ if (target) result = resolvesToWeappTwIgnore(target, seen);
1796
+ } else if (init.isMemberExpression()) result = resolvesMemberExpressionToIgnore(init, seen);
1797
+ }
1798
+ }
1799
+ bindingIgnoreCache.set(binding, result);
1800
+ seen.delete(binding);
1801
+ return result;
1802
+ };
1803
+ const getEffectiveTagPath = (tagPath) => {
1804
+ let current = tagPath;
1805
+ while (true) {
1806
+ if (current.isParenthesizedExpression?.() || current.node.type === "ParenthesizedExpression") {
1807
+ current = current.get("expression");
1808
+ continue;
1809
+ }
1810
+ if (current.isTSAsExpression() || current.isTSTypeAssertion()) {
1811
+ current = current.get("expression");
1812
+ continue;
1813
+ }
1814
+ if (current.isTSNonNullExpression()) {
1815
+ current = current.get("expression");
1816
+ continue;
1817
+ }
1818
+ if (current.isTypeCastExpression?.()) {
1819
+ current = current.get("expression");
1820
+ continue;
1821
+ }
1822
+ if (current.isSequenceExpression()) {
1823
+ const last = current.get("expressions").at(-1);
1824
+ if (last) {
1825
+ current = last;
1826
+ continue;
1827
+ }
1828
+ }
1829
+ if (current.isCallExpression?.() || current.node.type === "CallExpression") {
1830
+ current = current.get("callee");
1831
+ continue;
1832
+ }
1833
+ break;
1834
+ }
1835
+ return current;
1836
+ };
1837
+ const evaluateTagPath = (tagPath, seen) => {
1838
+ if (tagPath.isCallExpression?.() || tagPath.node.type === "CallExpression") return evaluateTagPath(tagPath.get("callee"), seen);
1839
+ if (tagPath.isIdentifier()) {
1840
+ if (matchesIgnoreName(tagPath.node.name)) return true;
1841
+ const binding = tagPath?.scope?.getBinding?.(tagPath.node.name);
1842
+ if (binding) return resolvesToWeappTwIgnore(binding, seen);
1843
+ return false;
1844
+ }
1845
+ if (tagPath.isMemberExpression()) return resolvesMemberExpressionToIgnore(tagPath, seen);
1846
+ return false;
1847
+ };
1848
+ const computeIgnore = (tagPath) => {
1849
+ const cached = taggedTemplateIgnoreCache.get(tagPath.node);
1850
+ if (cached !== void 0) return cached;
1851
+ const effectiveTagPath = getEffectiveTagPath(tagPath);
1852
+ const effectiveCached = taggedTemplateIgnoreCache.get(effectiveTagPath.node);
1853
+ if (effectiveCached !== void 0) {
1854
+ taggedTemplateIgnoreCache.set(tagPath.node, effectiveCached);
1855
+ return effectiveCached;
1856
+ }
1857
+ seenBindings.clear();
1858
+ const result = evaluateTagPath(effectiveTagPath, seenBindings);
1859
+ taggedTemplateIgnoreCache.set(effectiveTagPath.node, result);
1860
+ taggedTemplateIgnoreCache.set(tagPath.node, result);
1861
+ return result;
1862
+ };
1863
+ return {
1864
+ shouldIgnore(tagPath) {
1865
+ return computeIgnore(tagPath);
1866
+ },
1867
+ getEffectiveTagPath
1868
+ };
1869
+ }
1870
+ //#endregion
1871
+ //#region src/js/babel.ts
1872
+ const EXPRESSION_WRAPPER_PREFIX = "(\n";
1873
+ const EXPRESSION_WRAPPER_SUFFIX = "\n)";
1874
+ const EMPTY_IGNORED_PATHS = /* @__PURE__ */ new WeakSet();
1875
+ const EMPTY_IMPORT_DECLARATIONS = /* @__PURE__ */ new Set();
1876
+ const EMPTY_EXPORT_DECLARATIONS = /* @__PURE__ */ new Set();
1877
+ const EMPTY_REQUIRE_CALL_PATHS = [];
1878
+ const ignoredTaggedTemplateMatcherCache = /* @__PURE__ */ new WeakMap();
1879
+ let defaultEvalHandler;
1880
+ function getIgnoredTaggedTemplateMatcher(options) {
1881
+ const cached = ignoredTaggedTemplateMatcherCache.get(options);
1882
+ if (cached) return cached;
1883
+ const created = createNameMatcher(options.ignoreTaggedTemplateExpressionIdentifiers, { exact: true });
1884
+ ignoredTaggedTemplateMatcherCache.set(options, created);
1885
+ return created;
1886
+ }
1887
+ function getDefaultEvalHandler() {
1888
+ if (!defaultEvalHandler) throw new Error("Default JS eval handler is not initialized.");
1889
+ return defaultEvalHandler;
1890
+ }
1891
+ function analyzeSource(ast, options, handler, collectModuleMetadata = true) {
1892
+ const jsTokenUpdater = new JsTokenUpdater();
1893
+ const needScope = Boolean(options.ignoreCallExpressionIdentifiers && options.ignoreCallExpressionIdentifiers.length > 0);
1894
+ const ignoredPaths = needScope ? /* @__PURE__ */ new WeakSet() : EMPTY_IGNORED_PATHS;
1895
+ const walker = needScope ? new NodePathWalker({
1896
+ ...options.ignoreCallExpressionIdentifiers === void 0 ? {} : { ignoreCallExpressionIdentifiers: options.ignoreCallExpressionIdentifiers },
1897
+ callback(path) {
1898
+ ignoredPaths.add(path);
1899
+ }
1900
+ }) : new NodePathWalker();
1901
+ let taggedTemplateIgnore;
1902
+ const hasTaggedTemplateIgnoreIdentifiers = Boolean(options.ignoreTaggedTemplateExpressionIdentifiers && options.ignoreTaggedTemplateExpressionIdentifiers.length > 0);
1903
+ function getTaggedTemplateIgnore() {
1904
+ if (!taggedTemplateIgnore) taggedTemplateIgnore = createTaggedTemplateIgnore({
1905
+ matcher: getIgnoredTaggedTemplateMatcher(options),
1906
+ ...options.ignoreTaggedTemplateExpressionIdentifiers === void 0 ? {} : { names: options.ignoreTaggedTemplateExpressionIdentifiers }
1907
+ });
1908
+ return taggedTemplateIgnore;
1909
+ }
1910
+ const targetPaths = [];
1911
+ const importDeclarations = collectModuleMetadata ? /* @__PURE__ */ new Set() : EMPTY_IMPORT_DECLARATIONS;
1912
+ const exportDeclarations = collectModuleMetadata ? /* @__PURE__ */ new Set() : EMPTY_EXPORT_DECLARATIONS;
1913
+ const requireCallPaths = collectModuleMetadata ? [] : EMPTY_REQUIRE_CALL_PATHS;
1914
+ const evalHandler = handler ?? getDefaultEvalHandler();
1915
+ traverse(ast, {
1916
+ StringLiteral: { enter(p) {
1917
+ if (isEvalPath(p.parentPath)) return;
1918
+ targetPaths.push(p);
1919
+ } },
1920
+ TemplateElement: { enter: hasTaggedTemplateIgnoreIdentifiers ? (p) => {
1921
+ const pp = p.parentPath;
1922
+ if (pp.isTemplateLiteral()) {
1923
+ const ppp = pp.parentPath;
1924
+ if (isEvalPath(ppp)) return;
1925
+ if (ppp.isTaggedTemplateExpression()) {
1926
+ const tagPath = ppp.get("tag");
1927
+ if (getTaggedTemplateIgnore().shouldIgnore(tagPath)) return;
1928
+ }
1929
+ }
1930
+ targetPaths.push(p);
1931
+ } : (p) => {
1932
+ const pp = p.parentPath;
1933
+ if (pp.isTemplateLiteral()) {
1934
+ const ppp = pp.parentPath;
1935
+ if (isEvalPath(ppp)) return;
1936
+ }
1937
+ targetPaths.push(p);
1938
+ } },
1939
+ CallExpression: { enter: !collectModuleMetadata && !needScope ? (p) => {
1940
+ if (isEvalPath(p)) walkEvalExpression(p, options, jsTokenUpdater, evalHandler);
1941
+ } : (p) => {
1942
+ if (isEvalPath(p)) {
1943
+ walkEvalExpression(p, options, jsTokenUpdater, evalHandler);
1944
+ return;
1945
+ }
1946
+ const calleePath = p.get("callee");
1947
+ if (collectModuleMetadata && calleePath.isIdentifier({ name: "require" }) && !p?.scope?.hasBinding?.("require")) {
1948
+ const args = p.get("arguments");
1949
+ if (Array.isArray(args) && args.length > 0) {
1950
+ const first = args[0];
1951
+ if (first?.isStringLiteral()) requireCallPaths.push(first);
1952
+ }
1953
+ }
1954
+ if (needScope) walker.walkCallExpression(p);
1955
+ } },
1956
+ ...collectModuleMetadata ? {
1957
+ ImportDeclaration: { enter(p) {
1958
+ importDeclarations.add(p);
1959
+ } },
1960
+ ExportDeclaration: { enter(p) {
1961
+ exportDeclarations.add(p);
1962
+ } }
1963
+ } : {},
1964
+ noScope: !needScope
1965
+ });
1966
+ return {
1967
+ walker,
1968
+ jsTokenUpdater,
1969
+ ast,
1970
+ targetPaths,
1971
+ importDeclarations,
1972
+ exportDeclarations,
1973
+ requireCallPaths,
1974
+ ignoredPaths
1975
+ };
1976
+ }
1977
+ function jsHandler(rawSource, options) {
1978
+ const shouldWrapExpression = Boolean(options.wrapExpression);
1979
+ const source = shouldWrapExpression ? `${EXPRESSION_WRAPPER_PREFIX}${rawSource}${EXPRESSION_WRAPPER_SUFFIX}` : rawSource;
1980
+ let ast;
1981
+ try {
1982
+ ast = babelParse(source, options.babelParserOptions);
1983
+ } catch (error) {
1984
+ return {
1985
+ code: rawSource,
1986
+ error
1987
+ };
1988
+ }
1989
+ const needsModuleMetadata = Boolean(options.moduleSpecifierReplacements || options.moduleGraph && options.filename);
1990
+ const analysis = analyzeSource(ast, options, jsHandler, needsModuleMetadata);
1991
+ const ms = processUpdatedSource(source, options, analysis);
1992
+ if (shouldWrapExpression) {
1993
+ const start = 0;
1994
+ const end = source.length;
1995
+ const suffixLength = 2;
1996
+ ms.remove(start, 2);
1997
+ ms.remove(end - suffixLength, end);
1998
+ }
1999
+ const result = { code: ms.toString() };
2000
+ if (options.generateMap) Object.defineProperty(result, "map", {
2001
+ configurable: true,
2002
+ enumerable: true,
2003
+ get() {
2004
+ return ms.generateMap();
2005
+ }
2006
+ });
2007
+ if (options.moduleGraph && options.filename) {
2008
+ const linked = new JsModuleGraph({
2009
+ filename: options.filename,
2010
+ source: rawSource,
2011
+ analysis,
2012
+ handlerOptions: options
2013
+ }, options.moduleGraph).build();
2014
+ if (linked) result.linked = linked;
2015
+ }
2016
+ return result;
2017
+ }
2018
+ defaultEvalHandler = jsHandler;
2019
+ //#endregion
2020
+ //#region src/js/index.ts
2021
+ /** 默认 LRU 缓存最大条目数 */
2022
+ const RESULT_CACHE_MAX = 512;
2023
+ /** 仅对短片段做内层结果缓存,避免 bundler 热路径重复 hash 大块 JS。 */
2024
+ const CACHEABLE_SOURCE_MAX_LENGTH = 512;
2025
+ /** 为每个 ClassNameSet 实例分配递增 ID */
2026
+ const classNameSetIds = /* @__PURE__ */ new WeakMap();
2027
+ let nextClassNameSetId = 0;
2028
+ /**
2029
+ * 获取 ClassNameSet 的唯一身份 ID。
2030
+ * 每个 Set 引用分配一个递增整数,用于指纹计算。
2031
+ */
2032
+ function getClassNameSetId(set) {
2033
+ if (!set) return "none";
2034
+ const existing = classNameSetIds.get(set);
2035
+ if (existing !== void 0) return String(existing);
2036
+ const id = nextClassNameSetId++;
2037
+ classNameSetIds.set(set, id);
2038
+ return String(id);
2039
+ }
2040
+ /** 缓存 IJsHandlerOptions -> fingerprint 的映射 */
2041
+ const fingerprintCache = /* @__PURE__ */ new WeakMap();
2042
+ /**
2043
+ * 计算选项指纹,包含所有影响转译结果的字段。
2044
+ * 不包含 filename、moduleGraph、jsPreserveClass。
2045
+ */
2046
+ function getOptionsFingerprint(options) {
2047
+ const cached = fingerprintCache.get(options);
2048
+ if (cached) return cached;
2049
+ const fingerprint = [
2050
+ getClassNameSetId(options.classNameSet),
2051
+ JSON.stringify(options.escapeMap ?? null),
2052
+ options.needEscaped ? "1" : "0",
2053
+ options.alwaysEscape ? "1" : "0",
2054
+ options.unescapeUnicode ? "1" : "0",
2055
+ options.generateMap ? "1" : "0",
2056
+ options.uniAppX ? "1" : "0",
2057
+ options.wrapExpression ? "1" : "0",
2058
+ String(options.tailwindcssMajorVersion ?? ""),
2059
+ String(options.jsArbitraryValueFallback ?? ""),
2060
+ JSON.stringify(options.arbitraryValues ?? null),
2061
+ JSON.stringify(options.ignoreCallExpressionIdentifiers ?? null),
2062
+ JSON.stringify(options.ignoreTaggedTemplateExpressionIdentifiers?.map((v) => v instanceof RegExp ? v.source : v) ?? null),
2063
+ JSON.stringify(options.moduleSpecifierReplacements ?? null),
2064
+ JSON.stringify(options.babelParserOptions ?? null)
2065
+ ].join("|");
2066
+ fingerprintCache.set(options, fingerprint);
2067
+ return fingerprint;
2068
+ }
2069
+ function hasDefinedOverrides(options) {
2070
+ if (!options) return false;
2071
+ for (const key in options) if (options[key] !== void 0) return true;
2072
+ return false;
2073
+ }
2074
+ function shouldCacheJsResult(rawSource, options) {
2075
+ if (rawSource.length === 0 || rawSource.length > CACHEABLE_SOURCE_MAX_LENGTH) return false;
2076
+ if (options.moduleGraph || options.filename) return false;
2077
+ return true;
2078
+ }
2079
+ function createJsHandler(options) {
2080
+ const defaults = {
2081
+ escapeMap: options.escapeMap,
2082
+ jsArbitraryValueFallback: options.jsArbitraryValueFallback,
2083
+ tailwindcssMajorVersion: options.tailwindcssMajorVersion,
2084
+ arbitraryValues: options.arbitraryValues,
2085
+ jsPreserveClass: options.jsPreserveClass,
2086
+ generateMap: options.generateMap,
2087
+ needEscaped: options.needEscaped,
2088
+ alwaysEscape: options.alwaysEscape,
2089
+ unescapeUnicode: options.unescapeUnicode,
2090
+ babelParserOptions: options.babelParserOptions,
2091
+ ignoreCallExpressionIdentifiers: options.ignoreCallExpressionIdentifiers,
2092
+ ignoreTaggedTemplateExpressionIdentifiers: options.ignoreTaggedTemplateExpressionIdentifiers,
2093
+ uniAppX: options.uniAppX,
2094
+ moduleSpecifierReplacements: options.moduleSpecifierReplacements
2095
+ };
2096
+ /** 层1: 无 override 时,classNameSet -> resolvedOptions */
2097
+ const defaultOptionsCache = /* @__PURE__ */ new WeakMap();
2098
+ let resolvedOptionsWithoutClassNameSet;
2099
+ /** 层2: 有 override 时,overrideOptions -> { bySet, noSet } */
2100
+ const overrideOptionsCache = /* @__PURE__ */ new WeakMap();
2101
+ const resultCache = new lru_cache.LRUCache({ max: RESULT_CACHE_MAX });
2102
+ function resolveDefaultOptions(classNameSet) {
2103
+ if (!classNameSet) {
2104
+ if (!resolvedOptionsWithoutClassNameSet) resolvedOptionsWithoutClassNameSet = {
2105
+ ...defaults,
2106
+ classNameSet
2107
+ };
2108
+ return resolvedOptionsWithoutClassNameSet;
2109
+ }
2110
+ const cached = defaultOptionsCache.get(classNameSet);
2111
+ if (cached) return cached;
2112
+ const created = {
2113
+ ...defaults,
2114
+ classNameSet
2115
+ };
2116
+ defaultOptionsCache.set(classNameSet, created);
2117
+ return created;
2118
+ }
2119
+ function getCachedJsResult(rawSource, resolvedOptions) {
2120
+ if (!shouldCacheJsResult(rawSource, resolvedOptions)) return;
2121
+ const key = `${getOptionsFingerprint(resolvedOptions)}:${(0, _weapp_tailwindcss_shared_node.md5)(rawSource)}`;
2122
+ return resultCache.get(key);
2123
+ }
2124
+ function setCachedJsResult(rawSource, resolvedOptions, result) {
2125
+ if (!shouldCacheJsResult(rawSource, resolvedOptions) || result.error || result.linked) return result;
2126
+ const key = `${getOptionsFingerprint(resolvedOptions)}:${(0, _weapp_tailwindcss_shared_node.md5)(rawSource)}`;
2127
+ resultCache.set(key, result);
2128
+ return result;
2129
+ }
2130
+ function resolveOptions(classNameSet, overrideOptions) {
2131
+ if (!hasDefinedOverrides(overrideOptions)) return resolveDefaultOptions(classNameSet);
2132
+ let entry = overrideOptionsCache.get(overrideOptions);
2133
+ if (!entry) {
2134
+ entry = { bySet: /* @__PURE__ */ new WeakMap() };
2135
+ overrideOptionsCache.set(overrideOptions, entry);
2136
+ }
2137
+ if (!classNameSet) {
2138
+ if (entry.noSet) return entry.noSet;
2139
+ const created = (0, _weapp_tailwindcss_shared.defuOverrideArray)({
2140
+ ...overrideOptions,
2141
+ classNameSet
2142
+ }, defaults);
2143
+ entry.noSet = created;
2144
+ return created;
2145
+ }
2146
+ const cached = entry.bySet.get(classNameSet);
2147
+ if (cached) return cached;
2148
+ const created = (0, _weapp_tailwindcss_shared.defuOverrideArray)({
2149
+ ...overrideOptions,
2150
+ classNameSet
2151
+ }, defaults);
2152
+ entry.bySet.set(classNameSet, created);
2153
+ return created;
2154
+ }
2155
+ function handler(rawSource, classNameSet, options) {
2156
+ const resolvedOptions = resolveOptions(classNameSet, options);
2157
+ const cached = getCachedJsResult(rawSource, resolvedOptions);
2158
+ if (cached) return cached;
2159
+ return setCachedJsResult(rawSource, resolvedOptions, jsHandler(rawSource, resolvedOptions));
2160
+ }
2161
+ return handler;
2162
+ }
2163
+ //#endregion
2164
+ //#region src/wxml/custom-attributes.ts
2165
+ function regTest(reg, str) {
2166
+ reg.lastIndex = 0;
2167
+ return reg.test(str);
2168
+ }
2169
+ function isPropsMatch(props, attr) {
2170
+ if (Array.isArray(props)) {
2171
+ let lowerAttr;
2172
+ for (const prop of props) if (typeof prop === "string") {
2173
+ lowerAttr ?? (lowerAttr = attr.toLowerCase());
2174
+ if (prop.toLowerCase() === lowerAttr) return true;
2175
+ } else if (regTest(prop, attr)) return true;
2176
+ return false;
2177
+ } else if (typeof props === "string") return props === attr;
2178
+ else return regTest(props, attr);
2179
+ }
2180
+ function createAttributeMatcher(entities) {
2181
+ if (!entities || entities.length === 0) return;
2182
+ const wildcardAttributeRules = [];
2183
+ const tagAttributeRuleMap = /* @__PURE__ */ new Map();
2184
+ const regexpAttributeRules = [];
2185
+ for (const [selector, props] of entities) if (selector === "*") wildcardAttributeRules.push(props);
2186
+ else if (typeof selector === "string") {
2187
+ const list = tagAttributeRuleMap.get(selector);
2188
+ if (list) list.push(props);
2189
+ else tagAttributeRuleMap.set(selector, [props]);
2190
+ } else regexpAttributeRules.push([selector, props]);
2191
+ return (tag, attr) => {
2192
+ for (const props of wildcardAttributeRules) if (isPropsMatch(props, attr)) return true;
2193
+ const tagRules = tagAttributeRuleMap.get(tag);
2194
+ if (tagRules) {
2195
+ for (const props of tagRules) if (isPropsMatch(props, attr)) return true;
2196
+ }
2197
+ for (const [selector, props] of regexpAttributeRules) if (regTest(selector, tag) && isPropsMatch(props, attr)) return true;
2198
+ return false;
2199
+ };
2200
+ }
2201
+ //#endregion
2202
+ //#region src/wxml/utils/codegen/legacy-visitor.ts
2203
+ function shouldSkipLegacyStringLiteral(path) {
2204
+ if (_babel_types.isMemberExpression(path.parent)) return true;
2205
+ return Boolean(_babel_types.isBinaryExpression(path.parent) && (_babel_types.isConditionalExpression(path.parentPath?.parent) || _babel_types.isLogicalExpression(path.parentPath?.parent)));
2206
+ }
2207
+ function createLegacyTraverseOptions(options, jsTokenUpdater) {
2208
+ const legacyReplaceOptions = {
2209
+ escapeMap: options.escapeMap,
2210
+ classNameSet: options.runtimeSet,
2211
+ needEscaped: true,
2212
+ alwaysEscape: true
2213
+ };
2214
+ return {
2215
+ StringLiteral(path) {
2216
+ if (shouldSkipLegacyStringLiteral(path)) return;
2217
+ jsTokenUpdater.addToken(replaceHandleValue(path, legacyReplaceOptions));
2218
+ },
2219
+ noScope: true
2220
+ };
2221
+ }
2222
+ //#endregion
2223
+ //#region src/wxml/utils/codegen/legacy-rewriter.ts
2224
+ function rewriteLegacyExpression(match, options) {
2225
+ const ast = (0, _babel_parser.parseExpression)(match);
2226
+ const jsTokenUpdater = new JsTokenUpdater();
2227
+ traverse(ast, createLegacyTraverseOptions(options, jsTokenUpdater));
2228
+ if (jsTokenUpdater.length === 0) return match;
2229
+ const ms = new magic_string.default(match);
2230
+ jsTokenUpdater.updateMagicString(ms);
2231
+ return ms.toString();
2232
+ }
2233
+ //#endregion
2234
+ //#region src/wxml/utils/codegen.ts
2235
+ const WRAP_EXPRESSION_HANDLER_OPTIONS = Object.freeze({ wrapExpression: true });
2236
+ function generateCode(match, options = {}) {
2237
+ try {
2238
+ const { jsHandler, runtimeSet, wrapExpression } = options;
2239
+ if (jsHandler && runtimeSet) {
2240
+ const initial = jsHandler(match, runtimeSet, wrapExpression ? WRAP_EXPRESSION_HANDLER_OPTIONS : void 0);
2241
+ if (!initial.error || wrapExpression) return initial.code;
2242
+ return jsHandler(match, runtimeSet, WRAP_EXPRESSION_HANDLER_OPTIONS).code;
2243
+ } else return rewriteLegacyExpression(match, options);
2244
+ } catch {
2245
+ return match;
2246
+ }
2247
+ }
2248
+ //#endregion
2249
+ //#region ../../node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/decode-codepoint.js
2250
+ const decodeMap = new Map([
2251
+ [0, 65533],
2252
+ [128, 8364],
2253
+ [130, 8218],
2254
+ [131, 402],
2255
+ [132, 8222],
2256
+ [133, 8230],
2257
+ [134, 8224],
2258
+ [135, 8225],
2259
+ [136, 710],
2260
+ [137, 8240],
2261
+ [138, 352],
2262
+ [139, 8249],
2263
+ [140, 338],
2264
+ [142, 381],
2265
+ [145, 8216],
2266
+ [146, 8217],
2267
+ [147, 8220],
2268
+ [148, 8221],
2269
+ [149, 8226],
2270
+ [150, 8211],
2271
+ [151, 8212],
2272
+ [152, 732],
2273
+ [153, 8482],
2274
+ [154, 353],
2275
+ [155, 8250],
2276
+ [156, 339],
2277
+ [158, 382],
2278
+ [159, 376]
2279
+ ]);
2280
+ /**
2281
+ * Replace the given code point with a replacement character if it is a
2282
+ * surrogate or is outside the valid range. Otherwise return the code
2283
+ * point unchanged.
2284
+ * @param codePoint Unicode code point to convert.
2285
+ */
2286
+ function replaceCodePoint(codePoint) {
2287
+ if (codePoint >= 55296 && codePoint <= 57343 || codePoint > 1114111) return 65533;
2288
+ return decodeMap.get(codePoint) ?? codePoint;
2289
+ }
2290
+ //#endregion
2291
+ //#region ../../node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/internal/decode-shared.js
2292
+ /**
2293
+ * Shared base64 decode helper for generated decode data.
2294
+ * Assumes global atob is available.
2295
+ * @param input Input string to encode or decode.
2296
+ */
2297
+ function decodeBase64(input) {
2298
+ const binary = atob(input);
2299
+ const evenLength = binary.length & -2;
2300
+ const out = new Uint16Array(evenLength / 2);
2301
+ for (let index = 0, outIndex = 0; index < evenLength; index += 2) {
2302
+ const lo = binary.charCodeAt(index);
2303
+ const hi = binary.charCodeAt(index + 1);
2304
+ out[outIndex++] = lo | hi << 8;
2305
+ }
2306
+ return out;
2307
+ }
2308
+ //#endregion
2309
+ //#region ../../node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/generated/decode-data-html.js
2310
+ /** Packed HTML decode trie data. */
2311
+ const htmlDecodeTree = /* #__PURE__ */ decodeBase64("QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNdg43fAlbHlGdW5jdGlvbgCgYSBpAG4AZwA7gMUAxUAAAWNzpACoAHIAAOA12Jzc6SFnbgCgVCJpAGwAZABlADuAwwDDQG0AbAA7gMQAxEAABGFjZWZvcnN1xQDYANoA7QDxAPYA+QD8AAABY3LJAM8AayNzbGFzaAAAoBYidgHTANUAAKDnKmUAZAAAoAYjeQARZIABY3J0AOAA5QDrAGEidXNlAACgNSLuI291bGxpcwCgLCFhAJJjcgAA4DXYBd1wAGYAAOA12Dnd5SF2ZdhiYwDyAOoAbSJwZXEAAKBOIgAHSE9hY2RlZmhpbG9yc3UXARoBHwE6AVIBVQFiAWQBZgGCAakB6QHtAfIBYwB5ACdkUABZADuAqQCpQIABY3B5ACUBKAE1AfUhdGUGYWmg0iJ0KGFsRGlmZmVyZW50aWFsRAAAoEUhbCJleXMAAKAtIQACYWVpb0EBRAFKAU0B8iFvbgxhZABpAGwAO4DHAMdAcgBjAAhhbiJpbnQAAKAwIm8AdAAKYQABZG5ZAV0BaSJsbGEAuGB0I2VyRG90ALdg8gA5AWkAp2NyImNsZQAAAkRNUFRwAXQBeQF9AW8A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t0AHIA6QCaLQABY3XkLegtcgAA4DXYy9wAAWJw7C30LW4AAAFFZXUt8S0A4IoiAP5uAAABRWV/LfktAOCLIgD+6SJnemFnAKCaKYADY2Vmb3BycwANLhAuJS4pLiMuLi40LukhcmN1YQABZGkULiEuAAFiZxguHC5hAHIAAKBfKmUAcaAnIgCgWSLlIXJwAKAYIXIAAOA12DTdcABmAADgNdho3WWgQCJhAHQA6ABqD2MAcgAA4DXYzNzjCuQRUC4AAFQuAABYLmIuAAAAAGMubS5wLnQuAAAAAIguki4AAJouJxIqEnQAcgDpAB0ScgAA4DXYNd0AAUFhWy5eLnIA8gDnAnIA8gCTB75jAAFBYWYuaS5yAPIA4AJyAPIAjAdhAPAAeh5pAHMAAKD7IoABZHB0APgReS6DLgABZmx9LoAuAOA12GnddQDzAP8RaQBtAOUABBIAAUFhiy6OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg");
2312
+ //#endregion
2313
+ //#region ../../node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/generated/decode-data-xml.js
2314
+ /** Packed XML decode trie data. */
2315
+ const xmlDecodeTree = /* #__PURE__ */ decodeBase64("AAJhZ2xxBwARABMAFQBtAg0AAAAAAA8AcAAmYG8AcwAnYHQAPmB0ADxg9SFvdCJg");
2316
+ //#endregion
2317
+ //#region ../../node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/internal/bin-trie-flags.js
2318
+ /**
2319
+ * Bit flags & masks for the binary trie encoding used for entity decoding.
2320
+ *
2321
+ * Bit layout (16 bits total):
2322
+ * 15..14 VALUE_LENGTH (+1 encoding; 0 => no value)
2323
+ * 13 FLAG13. If valueLength>0: semicolon required flag (implicit ';').
2324
+ * If valueLength==0: compact run flag.
2325
+ * 12..7 BRANCH_LENGTH Branch length (0 => single branch in 6..0 if jumpOffset==char) OR run length (when compact run)
2326
+ * 6..0 JUMP_TABLE Jump offset (jump table) OR single-branch char code OR first run char
2327
+ */
2328
+ var BinTrieFlags;
2329
+ (function(BinTrieFlags) {
2330
+ BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
2331
+ BinTrieFlags[BinTrieFlags["FLAG13"] = 8192] = "FLAG13";
2332
+ BinTrieFlags[BinTrieFlags["BRANCH_LENGTH"] = 8064] = "BRANCH_LENGTH";
2333
+ BinTrieFlags[BinTrieFlags["JUMP_TABLE"] = 127] = "JUMP_TABLE";
2334
+ })(BinTrieFlags || (BinTrieFlags = {}));
2335
+ //#endregion
2336
+ //#region ../../node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/decode.js
2337
+ init_defineProperty();
2338
+ var CharCodes$1;
2339
+ (function(CharCodes) {
2340
+ CharCodes[CharCodes["NUM"] = 35] = "NUM";
2341
+ CharCodes[CharCodes["SEMI"] = 59] = "SEMI";
2342
+ CharCodes[CharCodes["EQUALS"] = 61] = "EQUALS";
2343
+ CharCodes[CharCodes["ZERO"] = 48] = "ZERO";
2344
+ CharCodes[CharCodes["NINE"] = 57] = "NINE";
2345
+ CharCodes[CharCodes["LOWER_A"] = 97] = "LOWER_A";
2346
+ CharCodes[CharCodes["LOWER_F"] = 102] = "LOWER_F";
2347
+ CharCodes[CharCodes["LOWER_X"] = 120] = "LOWER_X";
2348
+ CharCodes[CharCodes["LOWER_Z"] = 122] = "LOWER_Z";
2349
+ CharCodes[CharCodes["UPPER_A"] = 65] = "UPPER_A";
2350
+ CharCodes[CharCodes["UPPER_F"] = 70] = "UPPER_F";
2351
+ CharCodes[CharCodes["UPPER_Z"] = 90] = "UPPER_Z";
2352
+ })(CharCodes$1 || (CharCodes$1 = {}));
2353
+ /** Bit that needs to be set to convert an upper case ASCII character to lower case */
2354
+ const TO_LOWER_BIT = 32;
2355
+ function isNumber(code) {
2356
+ return code >= CharCodes$1.ZERO && code <= CharCodes$1.NINE;
2357
+ }
2358
+ function isHexadecimalCharacter(code) {
2359
+ return code >= CharCodes$1.UPPER_A && code <= CharCodes$1.UPPER_F || code >= CharCodes$1.LOWER_A && code <= CharCodes$1.LOWER_F;
2360
+ }
2361
+ function isAsciiAlphaNumeric(code) {
2362
+ return code >= CharCodes$1.UPPER_A && code <= CharCodes$1.UPPER_Z || code >= CharCodes$1.LOWER_A && code <= CharCodes$1.LOWER_Z || isNumber(code);
2363
+ }
2364
+ /**
2365
+ * Checks if the given character is a valid end character for an entity in an attribute.
2366
+ *
2367
+ * Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.
2368
+ * See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state
2369
+ * @param code Code point to decode.
2370
+ */
2371
+ function isEntityInAttributeInvalidEnd(code) {
2372
+ return code === CharCodes$1.EQUALS || isAsciiAlphaNumeric(code);
2373
+ }
2374
+ var EntityDecoderState;
2375
+ (function(EntityDecoderState) {
2376
+ EntityDecoderState[EntityDecoderState["EntityStart"] = 0] = "EntityStart";
2377
+ EntityDecoderState[EntityDecoderState["NumericStart"] = 1] = "NumericStart";
2378
+ EntityDecoderState[EntityDecoderState["NumericDecimal"] = 2] = "NumericDecimal";
2379
+ EntityDecoderState[EntityDecoderState["NumericHex"] = 3] = "NumericHex";
2380
+ EntityDecoderState[EntityDecoderState["NamedEntity"] = 4] = "NamedEntity";
2381
+ })(EntityDecoderState || (EntityDecoderState = {}));
2382
+ /**
2383
+ * Decoding mode for named entities.
2384
+ */
2385
+ var DecodingMode;
2386
+ (function(DecodingMode) {
2387
+ /** Entities in text nodes that can end with any character. */
2388
+ DecodingMode[DecodingMode["Legacy"] = 0] = "Legacy";
2389
+ /** Only allow entities terminated with a semicolon. */
2390
+ DecodingMode[DecodingMode["Strict"] = 1] = "Strict";
2391
+ /** Entities in attributes have limitations on ending characters. */
2392
+ DecodingMode[DecodingMode["Attribute"] = 2] = "Attribute";
2393
+ })(DecodingMode || (DecodingMode = {}));
2394
+ /**
2395
+ * Token decoder with support of writing partial entities.
2396
+ */
2397
+ var EntityDecoder = class {
2398
+ constructor(decodeTree, emitCodePoint, errors) {
2399
+ _defineProperty(this, "decodeTree", void 0);
2400
+ _defineProperty(this, "emitCodePoint", void 0);
2401
+ _defineProperty(this, "errors", void 0);
2402
+ _defineProperty(
2403
+ this,
2404
+ /** The current state of the decoder. */
2405
+ "state",
2406
+ EntityDecoderState.EntityStart
2407
+ );
2408
+ _defineProperty(
2409
+ this,
2410
+ /** Characters that were consumed while parsing an entity. */
2411
+ "consumed",
2412
+ 1
2413
+ );
2414
+ _defineProperty(
2415
+ this,
2416
+ /**
2417
+ * The result of the entity.
2418
+ *
2419
+ * Either the result index of a numeric entity, or the codepoint of a
2420
+ * numeric entity.
2421
+ */
2422
+ "result",
2423
+ 0
2424
+ );
2425
+ _defineProperty(
2426
+ this,
2427
+ /** The current index in the decode tree. */
2428
+ "treeIndex",
2429
+ 0
2430
+ );
2431
+ _defineProperty(
2432
+ this,
2433
+ /** The number of characters that were consumed in excess. */
2434
+ "excess",
2435
+ 1
2436
+ );
2437
+ _defineProperty(
2438
+ this,
2439
+ /** The mode in which the decoder is operating. */
2440
+ "decodeMode",
2441
+ DecodingMode.Strict
2442
+ );
2443
+ _defineProperty(
2444
+ this,
2445
+ /** The number of characters that have been consumed in the current run. */
2446
+ "runConsumed",
2447
+ 0
2448
+ );
2449
+ this.decodeTree = decodeTree;
2450
+ this.emitCodePoint = emitCodePoint;
2451
+ this.errors = errors;
2452
+ }
2453
+ /**
2454
+ * Resets the instance to make it reusable.
2455
+ * @param decodeMode Entity decoding mode to use.
2456
+ */
2457
+ startEntity(decodeMode) {
2458
+ this.decodeMode = decodeMode;
2459
+ this.state = EntityDecoderState.EntityStart;
2460
+ this.result = 0;
2461
+ this.treeIndex = 0;
2462
+ this.excess = 1;
2463
+ this.consumed = 1;
2464
+ this.runConsumed = 0;
2465
+ }
2466
+ /**
2467
+ * Write an entity to the decoder. This can be called multiple times with partial entities.
2468
+ * If the entity is incomplete, the decoder will return -1.
2469
+ *
2470
+ * Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
2471
+ * entity is incomplete, and resume when the next string is written.
2472
+ * @param input The string containing the entity (or a continuation of the entity).
2473
+ * @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
2474
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
2475
+ */
2476
+ write(input, offset) {
2477
+ switch (this.state) {
2478
+ case EntityDecoderState.EntityStart:
2479
+ if (input.charCodeAt(offset) === CharCodes$1.NUM) {
2480
+ this.state = EntityDecoderState.NumericStart;
2481
+ this.consumed += 1;
2482
+ return this.stateNumericStart(input, offset + 1);
2483
+ }
2484
+ this.state = EntityDecoderState.NamedEntity;
2485
+ return this.stateNamedEntity(input, offset);
2486
+ case EntityDecoderState.NumericStart: return this.stateNumericStart(input, offset);
2487
+ case EntityDecoderState.NumericDecimal: return this.stateNumericDecimal(input, offset);
2488
+ case EntityDecoderState.NumericHex: return this.stateNumericHex(input, offset);
2489
+ case EntityDecoderState.NamedEntity: return this.stateNamedEntity(input, offset);
2490
+ }
2491
+ }
2492
+ /**
2493
+ * Switches between the numeric decimal and hexadecimal states.
2494
+ *
2495
+ * Equivalent to the `Numeric character reference state` in the HTML spec.
2496
+ * @param input The string containing the entity (or a continuation of the entity).
2497
+ * @param offset The current offset.
2498
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
2499
+ */
2500
+ stateNumericStart(input, offset) {
2501
+ if (offset >= input.length) return -1;
2502
+ if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes$1.LOWER_X) {
2503
+ this.state = EntityDecoderState.NumericHex;
2504
+ this.consumed += 1;
2505
+ return this.stateNumericHex(input, offset + 1);
2506
+ }
2507
+ this.state = EntityDecoderState.NumericDecimal;
2508
+ return this.stateNumericDecimal(input, offset);
2509
+ }
2510
+ /**
2511
+ * Parses a hexadecimal numeric entity.
2512
+ *
2513
+ * Equivalent to the `Hexademical character reference state` in the HTML spec.
2514
+ * @param input The string containing the entity (or a continuation of the entity).
2515
+ * @param offset The current offset.
2516
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
2517
+ */
2518
+ stateNumericHex(input, offset) {
2519
+ while (offset < input.length) {
2520
+ const char = input.charCodeAt(offset);
2521
+ if (isNumber(char) || isHexadecimalCharacter(char)) {
2522
+ const digit = char <= CharCodes$1.NINE ? char - CharCodes$1.ZERO : (char | TO_LOWER_BIT) - CharCodes$1.LOWER_A + 10;
2523
+ this.result = this.result * 16 + digit;
2524
+ this.consumed++;
2525
+ offset++;
2526
+ } else return this.emitNumericEntity(char, 3);
2527
+ }
2528
+ return -1;
2529
+ }
2530
+ /**
2531
+ * Parses a decimal numeric entity.
2532
+ *
2533
+ * Equivalent to the `Decimal character reference state` in the HTML spec.
2534
+ * @param input The string containing the entity (or a continuation of the entity).
2535
+ * @param offset The current offset.
2536
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
2537
+ */
2538
+ stateNumericDecimal(input, offset) {
2539
+ while (offset < input.length) {
2540
+ const char = input.charCodeAt(offset);
2541
+ if (isNumber(char)) {
2542
+ this.result = this.result * 10 + (char - CharCodes$1.ZERO);
2543
+ this.consumed++;
2544
+ offset++;
2545
+ } else return this.emitNumericEntity(char, 2);
2546
+ }
2547
+ return -1;
2548
+ }
2549
+ /**
2550
+ * Validate and emit a numeric entity.
2551
+ *
2552
+ * Implements the logic from the `Hexademical character reference start
2553
+ * state` and `Numeric character reference end state` in the HTML spec.
2554
+ * @param lastCp The last code point of the entity. Used to see if the
2555
+ * entity was terminated with a semicolon.
2556
+ * @param expectedLength The minimum number of characters that should be
2557
+ * consumed. Used to validate that at least one digit
2558
+ * was consumed.
2559
+ * @returns The number of characters that were consumed.
2560
+ */
2561
+ emitNumericEntity(lastCp, expectedLength) {
2562
+ if (this.consumed <= expectedLength) {
2563
+ this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed);
2564
+ return 0;
2565
+ }
2566
+ if (lastCp === CharCodes$1.SEMI) this.consumed += 1;
2567
+ else if (this.decodeMode === DecodingMode.Strict) return 0;
2568
+ this.emitCodePoint(replaceCodePoint(this.result), this.consumed);
2569
+ if (this.errors) {
2570
+ if (lastCp !== CharCodes$1.SEMI) this.errors.missingSemicolonAfterCharacterReference();
2571
+ this.errors.validateNumericCharacterReference(this.result);
2572
+ }
2573
+ return this.consumed;
2574
+ }
2575
+ /**
2576
+ * Parses a named entity.
2577
+ *
2578
+ * Equivalent to the `Named character reference state` in the HTML spec.
2579
+ * @param input The string containing the entity (or a continuation of the entity).
2580
+ * @param offset The current offset.
2581
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
2582
+ */
2583
+ stateNamedEntity(input, offset) {
2584
+ const { decodeTree } = this;
2585
+ let current = decodeTree[this.treeIndex];
2586
+ let valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
2587
+ while (offset < input.length) {
2588
+ if (valueLength === 0 && (current & BinTrieFlags.FLAG13) !== 0) {
2589
+ const runLength = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
2590
+ if (this.runConsumed === 0) {
2591
+ const firstChar = current & BinTrieFlags.JUMP_TABLE;
2592
+ if (input.charCodeAt(offset) !== firstChar) return this.result === 0 ? 0 : this.emitNotTerminatedNamedEntity();
2593
+ offset++;
2594
+ this.excess++;
2595
+ this.runConsumed++;
2596
+ }
2597
+ while (this.runConsumed < runLength) {
2598
+ if (offset >= input.length) return -1;
2599
+ const charIndexInPacked = this.runConsumed - 1;
2600
+ const packedWord = decodeTree[this.treeIndex + 1 + (charIndexInPacked >> 1)];
2601
+ const expectedChar = charIndexInPacked % 2 === 0 ? packedWord & 255 : packedWord >> 8 & 255;
2602
+ if (input.charCodeAt(offset) !== expectedChar) {
2603
+ this.runConsumed = 0;
2604
+ return this.result === 0 ? 0 : this.emitNotTerminatedNamedEntity();
2605
+ }
2606
+ offset++;
2607
+ this.excess++;
2608
+ this.runConsumed++;
2609
+ }
2610
+ this.runConsumed = 0;
2611
+ this.treeIndex += 1 + (runLength >> 1);
2612
+ current = decodeTree[this.treeIndex];
2613
+ valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
2614
+ }
2615
+ if (offset >= input.length) break;
2616
+ const char = input.charCodeAt(offset);
2617
+ if (char === CharCodes$1.SEMI && valueLength !== 0 && (current & BinTrieFlags.FLAG13) !== 0) return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
2618
+ this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
2619
+ if (this.treeIndex < 0) return this.result === 0 || this.decodeMode === DecodingMode.Attribute && (valueLength === 0 || isEntityInAttributeInvalidEnd(char)) ? 0 : this.emitNotTerminatedNamedEntity();
2620
+ current = decodeTree[this.treeIndex];
2621
+ valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
2622
+ if (valueLength !== 0) {
2623
+ if (char === CharCodes$1.SEMI) return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
2624
+ if (this.decodeMode !== DecodingMode.Strict && (current & BinTrieFlags.FLAG13) === 0) {
2625
+ this.result = this.treeIndex;
2626
+ this.consumed += this.excess;
2627
+ this.excess = 0;
2628
+ }
2629
+ }
2630
+ offset++;
2631
+ this.excess++;
2632
+ }
2633
+ return -1;
2634
+ }
2635
+ /**
2636
+ * Emit a named entity that was not terminated with a semicolon.
2637
+ * @returns The number of characters consumed.
2638
+ */
2639
+ emitNotTerminatedNamedEntity() {
2640
+ const { result, decodeTree } = this;
2641
+ const valueLength = (decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14;
2642
+ this.emitNamedEntityData(result, valueLength, this.consumed);
2643
+ this.errors?.missingSemicolonAfterCharacterReference();
2644
+ return this.consumed;
2645
+ }
2646
+ /**
2647
+ * Emit a named entity.
2648
+ * @param result The index of the entity in the decode tree.
2649
+ * @param valueLength The number of bytes in the entity.
2650
+ * @param consumed The number of characters consumed.
2651
+ * @returns The number of characters consumed.
2652
+ */
2653
+ emitNamedEntityData(result, valueLength, consumed) {
2654
+ const { decodeTree } = this;
2655
+ this.emitCodePoint(valueLength === 1 ? decodeTree[result] & ~(BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13) : decodeTree[result + 1], consumed);
2656
+ if (valueLength === 3) this.emitCodePoint(decodeTree[result + 2], consumed);
2657
+ return consumed;
2658
+ }
2659
+ /**
2660
+ * Signal to the parser that the end of the input was reached.
2661
+ *
2662
+ * Remaining data will be emitted and relevant errors will be produced.
2663
+ * @returns The number of characters consumed.
2664
+ */
2665
+ end() {
2666
+ switch (this.state) {
2667
+ case EntityDecoderState.NamedEntity: return this.result !== 0 && (this.decodeMode !== DecodingMode.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0;
2668
+ case EntityDecoderState.NumericDecimal: return this.emitNumericEntity(0, 2);
2669
+ case EntityDecoderState.NumericHex: return this.emitNumericEntity(0, 3);
2670
+ case EntityDecoderState.NumericStart:
2671
+ this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed);
2672
+ return 0;
2673
+ case EntityDecoderState.EntityStart: return 0;
2674
+ }
2675
+ }
2676
+ };
2677
+ /**
2678
+ * Determines the branch of the current node that is taken given the current
2679
+ * character. This function is used to traverse the trie.
2680
+ * @param decodeTree The trie.
2681
+ * @param current The current node.
2682
+ * @param nodeIndex Index immediately after the current node header.
2683
+ * @param char The current character.
2684
+ * @returns The index of the next node, or -1 if no branch is taken.
2685
+ */
2686
+ function determineBranch(decodeTree, current, nodeIndex, char) {
2687
+ const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
2688
+ const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
2689
+ if (branchCount === 0) return jumpOffset !== 0 && char === jumpOffset ? nodeIndex : -1;
2690
+ if (jumpOffset) {
2691
+ const value = char - jumpOffset;
2692
+ return value < 0 || value >= branchCount ? -1 : decodeTree[nodeIndex + value] - 1;
2693
+ }
2694
+ const packedKeySlots = branchCount + 1 >> 1;
2695
+ let lo = 0;
2696
+ let hi = branchCount - 1;
2697
+ while (lo <= hi) {
2698
+ const mid = lo + hi >>> 1;
2699
+ const midKey = decodeTree[nodeIndex + (mid >> 1)] >> (mid & 1) * 8 & 255;
2700
+ if (midKey < char) lo = mid + 1;
2701
+ else if (midKey > char) hi = mid - 1;
2702
+ else return decodeTree[nodeIndex + packedKeySlots + mid];
2703
+ }
2704
+ return -1;
2705
+ }
2706
+ //#endregion
2707
+ //#region ../../node_modules/.pnpm/htmlparser2@12.0.0/node_modules/htmlparser2/dist/Tokenizer.js
2708
+ init_defineProperty();
2709
+ var CharCodes;
2710
+ (function(CharCodes) {
2711
+ CharCodes[CharCodes["Tab"] = 9] = "Tab";
2712
+ CharCodes[CharCodes["NewLine"] = 10] = "NewLine";
2713
+ CharCodes[CharCodes["FormFeed"] = 12] = "FormFeed";
2714
+ CharCodes[CharCodes["CarriageReturn"] = 13] = "CarriageReturn";
2715
+ CharCodes[CharCodes["Space"] = 32] = "Space";
2716
+ CharCodes[CharCodes["ExclamationMark"] = 33] = "ExclamationMark";
2717
+ CharCodes[CharCodes["Number"] = 35] = "Number";
2718
+ CharCodes[CharCodes["Amp"] = 38] = "Amp";
2719
+ CharCodes[CharCodes["SingleQuote"] = 39] = "SingleQuote";
2720
+ CharCodes[CharCodes["DoubleQuote"] = 34] = "DoubleQuote";
2721
+ CharCodes[CharCodes["Dash"] = 45] = "Dash";
2722
+ CharCodes[CharCodes["Slash"] = 47] = "Slash";
2723
+ CharCodes[CharCodes["Zero"] = 48] = "Zero";
2724
+ CharCodes[CharCodes["Nine"] = 57] = "Nine";
2725
+ CharCodes[CharCodes["Semi"] = 59] = "Semi";
2726
+ CharCodes[CharCodes["Lt"] = 60] = "Lt";
2727
+ CharCodes[CharCodes["Eq"] = 61] = "Eq";
2728
+ CharCodes[CharCodes["Gt"] = 62] = "Gt";
2729
+ CharCodes[CharCodes["Questionmark"] = 63] = "Questionmark";
2730
+ CharCodes[CharCodes["UpperA"] = 65] = "UpperA";
2731
+ CharCodes[CharCodes["LowerA"] = 97] = "LowerA";
2732
+ CharCodes[CharCodes["UpperF"] = 70] = "UpperF";
2733
+ CharCodes[CharCodes["LowerF"] = 102] = "LowerF";
2734
+ CharCodes[CharCodes["UpperZ"] = 90] = "UpperZ";
2735
+ CharCodes[CharCodes["LowerZ"] = 122] = "LowerZ";
2736
+ CharCodes[CharCodes["LowerX"] = 120] = "LowerX";
2737
+ CharCodes[CharCodes["OpeningSquareBracket"] = 91] = "OpeningSquareBracket";
2738
+ })(CharCodes || (CharCodes = {}));
2739
+ /** All the states the tokenizer can be in. */
2740
+ var State;
2741
+ (function(State) {
2742
+ State[State["Text"] = 1] = "Text";
2743
+ State[State["BeforeTagName"] = 2] = "BeforeTagName";
2744
+ State[State["InTagName"] = 3] = "InTagName";
2745
+ State[State["InSelfClosingTag"] = 4] = "InSelfClosingTag";
2746
+ State[State["BeforeClosingTagName"] = 5] = "BeforeClosingTagName";
2747
+ State[State["InClosingTagName"] = 6] = "InClosingTagName";
2748
+ State[State["AfterClosingTagName"] = 7] = "AfterClosingTagName";
2749
+ State[State["BeforeAttributeName"] = 8] = "BeforeAttributeName";
2750
+ State[State["InAttributeName"] = 9] = "InAttributeName";
2751
+ State[State["AfterAttributeName"] = 10] = "AfterAttributeName";
2752
+ State[State["BeforeAttributeValue"] = 11] = "BeforeAttributeValue";
2753
+ State[State["InAttributeValueDq"] = 12] = "InAttributeValueDq";
2754
+ State[State["InAttributeValueSq"] = 13] = "InAttributeValueSq";
2755
+ State[State["InAttributeValueNq"] = 14] = "InAttributeValueNq";
2756
+ State[State["BeforeDeclaration"] = 15] = "BeforeDeclaration";
2757
+ State[State["InDeclaration"] = 16] = "InDeclaration";
2758
+ State[State["InProcessingInstruction"] = 17] = "InProcessingInstruction";
2759
+ State[State["BeforeComment"] = 18] = "BeforeComment";
2760
+ State[State["CDATASequence"] = 19] = "CDATASequence";
2761
+ State[State["DeclarationSequence"] = 20] = "DeclarationSequence";
2762
+ State[State["InSpecialComment"] = 21] = "InSpecialComment";
2763
+ State[State["InCommentLike"] = 22] = "InCommentLike";
2764
+ State[State["SpecialStartSequence"] = 23] = "SpecialStartSequence";
2765
+ State[State["InSpecialTag"] = 24] = "InSpecialTag";
2766
+ State[State["InPlainText"] = 25] = "InPlainText";
2767
+ State[State["InEntity"] = 26] = "InEntity";
2768
+ })(State || (State = {}));
2769
+ function isWhitespace$1(c) {
2770
+ return c === CharCodes.Space || c === CharCodes.NewLine || c === CharCodes.Tab || c === CharCodes.FormFeed || c === CharCodes.CarriageReturn;
2771
+ }
2772
+ function isEndOfTagSection(c) {
2773
+ return c === CharCodes.Slash || c === CharCodes.Gt || isWhitespace$1(c);
2774
+ }
2775
+ function isASCIIAlpha(c) {
2776
+ return c >= CharCodes.LowerA && c <= CharCodes.LowerZ || c >= CharCodes.UpperA && c <= CharCodes.UpperZ;
2777
+ }
2778
+ /**
2779
+ * Quote style used for parsed attributes.
2780
+ */
2781
+ var QuoteType;
2782
+ (function(QuoteType) {
2783
+ QuoteType[QuoteType["NoValue"] = 0] = "NoValue";
2784
+ QuoteType[QuoteType["Unquoted"] = 1] = "Unquoted";
2785
+ QuoteType[QuoteType["Single"] = 2] = "Single";
2786
+ QuoteType[QuoteType["Double"] = 3] = "Double";
2787
+ })(QuoteType || (QuoteType = {}));
2788
+ /**
2789
+ * Sequences used to match longer strings.
2790
+ *
2791
+ * We don't have `Script`, `Style`, or `Title` here. Instead, we re-use the *End
2792
+ * sequences with an increased offset.
2793
+ */
2794
+ const Sequences = {
2795
+ Empty: new Uint8Array(0),
2796
+ Cdata: new Uint8Array([
2797
+ 67,
2798
+ 68,
2799
+ 65,
2800
+ 84,
2801
+ 65,
2802
+ 91
2803
+ ]),
2804
+ CdataEnd: new Uint8Array([
2805
+ 93,
2806
+ 93,
2807
+ 62
2808
+ ]),
2809
+ CommentEnd: new Uint8Array([
2810
+ 45,
2811
+ 45,
2812
+ 33,
2813
+ 62
2814
+ ]),
2815
+ Doctype: new Uint8Array([
2816
+ 100,
2817
+ 111,
2818
+ 99,
2819
+ 116,
2820
+ 121,
2821
+ 112,
2822
+ 101
2823
+ ]),
2824
+ IframeEnd: new Uint8Array([
2825
+ 60,
2826
+ 47,
2827
+ 105,
2828
+ 102,
2829
+ 114,
2830
+ 97,
2831
+ 109,
2832
+ 101
2833
+ ]),
2834
+ NoembedEnd: new Uint8Array([
2835
+ 60,
2836
+ 47,
2837
+ 110,
2838
+ 111,
2839
+ 101,
2840
+ 109,
2841
+ 98,
2842
+ 101,
2843
+ 100
2844
+ ]),
2845
+ NoframesEnd: new Uint8Array([
2846
+ 60,
2847
+ 47,
2848
+ 110,
2849
+ 111,
2850
+ 102,
2851
+ 114,
2852
+ 97,
2853
+ 109,
2854
+ 101,
2855
+ 115
2856
+ ]),
2857
+ Plaintext: new Uint8Array([
2858
+ 60,
2859
+ 47,
2860
+ 112,
2861
+ 108,
2862
+ 97,
2863
+ 105,
2864
+ 110,
2865
+ 116,
2866
+ 101,
2867
+ 120,
2868
+ 116
2869
+ ]),
2870
+ ScriptEnd: new Uint8Array([
2871
+ 60,
2872
+ 47,
2873
+ 115,
2874
+ 99,
2875
+ 114,
2876
+ 105,
2877
+ 112,
2878
+ 116
2879
+ ]),
2880
+ StyleEnd: new Uint8Array([
2881
+ 60,
2882
+ 47,
2883
+ 115,
2884
+ 116,
2885
+ 121,
2886
+ 108,
2887
+ 101
2888
+ ]),
2889
+ TitleEnd: new Uint8Array([
2890
+ 60,
2891
+ 47,
2892
+ 116,
2893
+ 105,
2894
+ 116,
2895
+ 108,
2896
+ 101
2897
+ ]),
2898
+ TextareaEnd: new Uint8Array([
2899
+ 60,
2900
+ 47,
2901
+ 116,
2902
+ 101,
2903
+ 120,
2904
+ 116,
2905
+ 97,
2906
+ 114,
2907
+ 101,
2908
+ 97
2909
+ ]),
2910
+ XmpEnd: new Uint8Array([
2911
+ 60,
2912
+ 47,
2913
+ 120,
2914
+ 109,
2915
+ 112
2916
+ ])
2917
+ };
2918
+ /**
2919
+ * Maps the first lowercase character of an HTML tag name to the sequence
2920
+ * used for special-tag detection. All sequences share a common layout
2921
+ * where index 2 is the first tag-name character, so matching always
2922
+ * continues from offset 3.
2923
+ */
2924
+ const specialStartSequences = new Map([
2925
+ [Sequences.IframeEnd[2], Sequences.IframeEnd],
2926
+ [Sequences.NoembedEnd[2], Sequences.NoembedEnd],
2927
+ [Sequences.Plaintext[2], Sequences.Plaintext],
2928
+ [Sequences.ScriptEnd[2], Sequences.ScriptEnd],
2929
+ [Sequences.TitleEnd[2], Sequences.TitleEnd],
2930
+ [Sequences.XmpEnd[2], Sequences.XmpEnd]
2931
+ ]);
2932
+ /**
2933
+ * Tokenizer implementation used by `Parser`.
2934
+ */
2935
+ var Tokenizer$1 = class {
2936
+ constructor({ xmlMode = false, decodeEntities = true, recognizeSelfClosing = xmlMode }, cbs) {
2937
+ _defineProperty(this, "cbs", void 0);
2938
+ _defineProperty(
2939
+ this,
2940
+ /** The current state the tokenizer is in. */
2941
+ "state",
2942
+ State.Text
2943
+ );
2944
+ _defineProperty(
2945
+ this,
2946
+ /** The read buffer. */
2947
+ "buffer",
2948
+ ""
2949
+ );
2950
+ _defineProperty(
2951
+ this,
2952
+ /** The beginning of the section that is currently being read. */
2953
+ "sectionStart",
2954
+ 0
2955
+ );
2956
+ _defineProperty(
2957
+ this,
2958
+ /** The index within the buffer that we are currently looking at. */
2959
+ "index",
2960
+ 0
2961
+ );
2962
+ _defineProperty(
2963
+ this,
2964
+ /** The start of the last entity. */
2965
+ "entityStart",
2966
+ 0
2967
+ );
2968
+ _defineProperty(
2969
+ this,
2970
+ /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
2971
+ "baseState",
2972
+ State.Text
2973
+ );
2974
+ _defineProperty(
2975
+ this,
2976
+ /** For special parsing behavior inside of script and style tags. */
2977
+ "isSpecial",
2978
+ false
2979
+ );
2980
+ _defineProperty(
2981
+ this,
2982
+ /** Indicates whether the tokenizer has been paused. */
2983
+ "running",
2984
+ true
2985
+ );
2986
+ _defineProperty(
2987
+ this,
2988
+ /** The offset of the current buffer. */
2989
+ "offset",
2990
+ 0
2991
+ );
2992
+ _defineProperty(this, "xmlMode", void 0);
2993
+ _defineProperty(this, "decodeEntities", void 0);
2994
+ _defineProperty(this, "recognizeSelfClosing", void 0);
2995
+ _defineProperty(this, "entityDecoder", void 0);
2996
+ _defineProperty(this, "currentSequence", Sequences.Empty);
2997
+ _defineProperty(this, "sequenceIndex", 0);
2998
+ this.cbs = cbs;
2999
+ this.xmlMode = xmlMode;
3000
+ this.decodeEntities = decodeEntities;
3001
+ this.recognizeSelfClosing = recognizeSelfClosing;
3002
+ this.entityDecoder = new EntityDecoder(xmlMode ? xmlDecodeTree : htmlDecodeTree, (cp, consumed) => this.emitCodePoint(cp, consumed));
3003
+ }
3004
+ reset() {
3005
+ this.state = State.Text;
3006
+ this.buffer = "";
3007
+ this.sectionStart = 0;
3008
+ this.index = 0;
3009
+ this.baseState = State.Text;
3010
+ this.isSpecial = false;
3011
+ this.currentSequence = Sequences.Empty;
3012
+ this.sequenceIndex = 0;
3013
+ this.running = true;
3014
+ this.offset = 0;
3015
+ }
3016
+ write(chunk) {
3017
+ this.offset += this.buffer.length;
3018
+ this.buffer = chunk;
3019
+ this.parse();
3020
+ }
3021
+ end() {
3022
+ if (this.running) this.finish();
3023
+ }
3024
+ pause() {
3025
+ this.running = false;
3026
+ }
3027
+ resume() {
3028
+ this.running = true;
3029
+ if (this.index < this.buffer.length + this.offset) this.parse();
3030
+ }
3031
+ stateText(c) {
3032
+ if (c === CharCodes.Lt || !this.decodeEntities && this.fastForwardTo(CharCodes.Lt)) {
3033
+ if (this.index > this.sectionStart) this.cbs.ontext(this.sectionStart, this.index);
3034
+ this.state = State.BeforeTagName;
3035
+ this.sectionStart = this.index;
3036
+ } else if (this.decodeEntities && c === CharCodes.Amp) this.startEntity();
3037
+ }
3038
+ enterTagBody() {
3039
+ if (this.currentSequence === Sequences.Plaintext) {
3040
+ this.currentSequence = Sequences.Empty;
3041
+ this.state = State.InPlainText;
3042
+ } else if (this.isSpecial) {
3043
+ this.state = State.InSpecialTag;
3044
+ this.sequenceIndex = 0;
3045
+ } else this.state = State.Text;
3046
+ }
3047
+ /**
3048
+ * Match the opening tag name against an HTML text-only tag sequence.
3049
+ *
3050
+ * Some tags share an initial prefix (`script`/`style`, `title`/`textarea`,
3051
+ * `noembed`/`noframes`), so we may switch to an alternate sequence at the
3052
+ * first distinguishing byte. On a successful full match we fall back to
3053
+ * the normal tag-name state; a later `>` will enter raw-text, RCDATA, or
3054
+ * plaintext mode based on `currentSequence` / `isSpecial`.
3055
+ * @param c Current character code point.
3056
+ */
3057
+ stateSpecialStartSequence(c) {
3058
+ const lower = c | 32;
3059
+ if (this.sequenceIndex < this.currentSequence.length) {
3060
+ if (lower === this.currentSequence[this.sequenceIndex]) {
3061
+ this.sequenceIndex++;
3062
+ return;
3063
+ }
3064
+ if (this.sequenceIndex === 3) {
3065
+ if (this.currentSequence === Sequences.ScriptEnd && lower === Sequences.StyleEnd[3]) {
3066
+ this.currentSequence = Sequences.StyleEnd;
3067
+ this.sequenceIndex = 4;
3068
+ return;
3069
+ }
3070
+ if (this.currentSequence === Sequences.TitleEnd && lower === Sequences.TextareaEnd[3]) {
3071
+ this.currentSequence = Sequences.TextareaEnd;
3072
+ this.sequenceIndex = 4;
3073
+ return;
3074
+ }
3075
+ } else if (this.sequenceIndex === 4 && this.currentSequence === Sequences.NoembedEnd && lower === Sequences.NoframesEnd[4]) {
3076
+ this.currentSequence = Sequences.NoframesEnd;
3077
+ this.sequenceIndex = 5;
3078
+ return;
3079
+ }
3080
+ } else if (isEndOfTagSection(c)) {
3081
+ this.sequenceIndex = 0;
3082
+ this.state = State.InTagName;
3083
+ this.stateInTagName(c);
3084
+ return;
3085
+ }
3086
+ this.isSpecial = false;
3087
+ this.currentSequence = Sequences.Empty;
3088
+ this.sequenceIndex = 0;
3089
+ this.state = State.InTagName;
3090
+ this.stateInTagName(c);
3091
+ }
3092
+ stateCDATASequence(c) {
3093
+ if (c === Sequences.Cdata[this.sequenceIndex]) {
3094
+ if (++this.sequenceIndex === Sequences.Cdata.length) {
3095
+ this.state = State.InCommentLike;
3096
+ this.currentSequence = Sequences.CdataEnd;
3097
+ this.sequenceIndex = 0;
3098
+ this.sectionStart = this.index + 1;
3099
+ }
3100
+ } else {
3101
+ this.sequenceIndex = 0;
3102
+ if (this.xmlMode) {
3103
+ this.state = State.InDeclaration;
3104
+ this.stateInDeclaration(c);
3105
+ } else {
3106
+ this.state = State.InSpecialComment;
3107
+ this.stateInSpecialComment(c);
3108
+ }
3109
+ }
3110
+ }
3111
+ /**
3112
+ * When we wait for one specific character, we can speed things up
3113
+ * by skipping through the buffer until we find it.
3114
+ * @param c Current character code point.
3115
+ * @returns Whether the character was found.
3116
+ */
3117
+ fastForwardTo(c) {
3118
+ while (++this.index < this.buffer.length + this.offset) if (this.buffer.charCodeAt(this.index - this.offset) === c) return true;
3119
+ this.index = this.buffer.length + this.offset - 1;
3120
+ return false;
3121
+ }
3122
+ /**
3123
+ * Emit a comment token and return to the text state.
3124
+ * @param offset Number of characters in the end sequence that have already been matched.
3125
+ */
3126
+ emitComment(offset) {
3127
+ this.cbs.oncomment(this.sectionStart, this.index, offset);
3128
+ this.sequenceIndex = 0;
3129
+ this.sectionStart = this.index + 1;
3130
+ this.state = State.Text;
3131
+ }
3132
+ /**
3133
+ * Comments and CDATA end with `-->` and `]]>`.
3134
+ *
3135
+ * Their common qualities are:
3136
+ * - Their end sequences have a distinct character they start with.
3137
+ * - That character is then repeated, so we have to check multiple repeats.
3138
+ * - All characters but the start character of the sequence can be skipped.
3139
+ * @param c Current character code point.
3140
+ */
3141
+ stateInCommentLike(c) {
3142
+ if (!this.xmlMode && this.currentSequence === Sequences.CommentEnd && this.sequenceIndex <= 1 && this.index === this.sectionStart + this.sequenceIndex && c === CharCodes.Gt) this.emitComment(this.sequenceIndex);
3143
+ else if (this.currentSequence === Sequences.CommentEnd && this.sequenceIndex === 2 && c === CharCodes.Gt) this.emitComment(2);
3144
+ else if (this.currentSequence === Sequences.CommentEnd && this.sequenceIndex === this.currentSequence.length - 1 && c !== CharCodes.Gt) this.sequenceIndex = Number(c === CharCodes.Dash);
3145
+ else if (c === this.currentSequence[this.sequenceIndex]) {
3146
+ if (++this.sequenceIndex === this.currentSequence.length) {
3147
+ if (this.currentSequence === Sequences.CdataEnd) this.cbs.oncdata(this.sectionStart, this.index, 2);
3148
+ else this.cbs.oncomment(this.sectionStart, this.index, 3);
3149
+ this.sequenceIndex = 0;
3150
+ this.sectionStart = this.index + 1;
3151
+ this.state = State.Text;
3152
+ }
3153
+ } else if (this.sequenceIndex === 0) {
3154
+ if (this.fastForwardTo(this.currentSequence[0])) this.sequenceIndex = 1;
3155
+ } else if (c !== this.currentSequence[this.sequenceIndex - 1]) this.sequenceIndex = 0;
3156
+ }
3157
+ /**
3158
+ * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.
3159
+ *
3160
+ * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).
3161
+ * We allow anything that wouldn't end the tag.
3162
+ * @param c Current character code point.
3163
+ */
3164
+ isTagStartChar(c) {
3165
+ return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c);
3166
+ }
3167
+ /**
3168
+ * Scan raw-text / RCDATA content for the matching end tag.
3169
+ *
3170
+ * For RCDATA tags (`<title>`, `<textarea>`) entities are decoded inline.
3171
+ * For raw-text tags (`<script>`, `<style>`, etc.) we fast-forward to `<`.
3172
+ * @param c Current character code point.
3173
+ */
3174
+ stateInSpecialTag(c) {
3175
+ if (this.sequenceIndex === this.currentSequence.length) {
3176
+ if (isEndOfTagSection(c)) {
3177
+ const endOfText = this.index - this.currentSequence.length;
3178
+ if (this.sectionStart < endOfText) {
3179
+ const actualIndex = this.index;
3180
+ this.index = endOfText;
3181
+ this.cbs.ontext(this.sectionStart, endOfText);
3182
+ this.index = actualIndex;
3183
+ }
3184
+ this.isSpecial = false;
3185
+ this.sectionStart = endOfText + 2;
3186
+ this.stateInClosingTagName(c);
3187
+ return;
3188
+ }
3189
+ this.sequenceIndex = 0;
3190
+ }
3191
+ if ((c | 32) === this.currentSequence[this.sequenceIndex]) this.sequenceIndex += 1;
3192
+ else if (this.sequenceIndex === 0) {
3193
+ if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd) {
3194
+ if (this.decodeEntities && c === CharCodes.Amp) this.startEntity();
3195
+ } else if (this.fastForwardTo(CharCodes.Lt)) this.sequenceIndex = 1;
3196
+ } else this.sequenceIndex = Number(c === CharCodes.Lt);
3197
+ }
3198
+ stateBeforeTagName(c) {
3199
+ if (c === CharCodes.ExclamationMark) {
3200
+ this.state = State.BeforeDeclaration;
3201
+ this.sectionStart = this.index + 1;
3202
+ } else if (c === CharCodes.Questionmark) if (this.xmlMode) {
3203
+ this.state = State.InProcessingInstruction;
3204
+ this.sequenceIndex = 0;
3205
+ this.sectionStart = this.index + 1;
3206
+ } else {
3207
+ this.state = State.InSpecialComment;
3208
+ this.sectionStart = this.index;
3209
+ }
3210
+ else if (this.isTagStartChar(c)) {
3211
+ this.sectionStart = this.index;
3212
+ const special = this.xmlMode || this.cbs.isInForeignContext?.() ? void 0 : specialStartSequences.get(c | 32);
3213
+ if (special === void 0) this.state = State.InTagName;
3214
+ else {
3215
+ this.isSpecial = true;
3216
+ this.currentSequence = special;
3217
+ this.sequenceIndex = 3;
3218
+ this.state = State.SpecialStartSequence;
3219
+ }
3220
+ } else if (c === CharCodes.Slash) this.state = State.BeforeClosingTagName;
3221
+ else {
3222
+ this.state = State.Text;
3223
+ this.stateText(c);
3224
+ }
3225
+ }
3226
+ stateInTagName(c) {
3227
+ if (isEndOfTagSection(c)) {
3228
+ this.cbs.onopentagname(this.sectionStart, this.index);
3229
+ this.sectionStart = -1;
3230
+ this.state = State.BeforeAttributeName;
3231
+ this.stateBeforeAttributeName(c);
3232
+ }
3233
+ }
3234
+ stateBeforeClosingTagName(c) {
3235
+ if (isWhitespace$1(c)) if (this.xmlMode) {} else {
3236
+ this.state = State.InSpecialComment;
3237
+ this.sectionStart = this.index;
3238
+ }
3239
+ else if (c === CharCodes.Gt) {
3240
+ this.state = State.Text;
3241
+ if (!this.xmlMode) this.sectionStart = this.index + 1;
3242
+ } else {
3243
+ this.state = this.isTagStartChar(c) ? State.InClosingTagName : State.InSpecialComment;
3244
+ this.sectionStart = this.index;
3245
+ }
3246
+ }
3247
+ stateInClosingTagName(c) {
3248
+ if (isEndOfTagSection(c)) {
3249
+ this.cbs.onclosetag(this.sectionStart, this.index);
3250
+ this.sectionStart = -1;
3251
+ this.state = State.AfterClosingTagName;
3252
+ this.stateAfterClosingTagName(c);
3253
+ }
3254
+ }
3255
+ stateAfterClosingTagName(c) {
3256
+ if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
3257
+ this.state = State.Text;
3258
+ this.sectionStart = this.index + 1;
3259
+ }
3260
+ }
3261
+ stateBeforeAttributeName(c) {
3262
+ if (c === CharCodes.Gt) {
3263
+ this.cbs.onopentagend(this.index);
3264
+ this.enterTagBody();
3265
+ this.sectionStart = this.index + 1;
3266
+ } else if (c === CharCodes.Slash) this.state = State.InSelfClosingTag;
3267
+ else if (!isWhitespace$1(c)) {
3268
+ this.state = State.InAttributeName;
3269
+ this.sectionStart = this.index;
3270
+ }
3271
+ }
3272
+ /**
3273
+ * Handle `/` before `>` in an opening tag.
3274
+ *
3275
+ * In HTML mode, text-only tags ignore the self-closing flag and still enter
3276
+ * their raw-text/RCDATA/plaintext state unless self-closing tags are being
3277
+ * recognized. In XML mode, or for ordinary tags, the tokenizer returns to
3278
+ * regular text parsing after emitting the self-closing callback.
3279
+ * @param c Current character code point.
3280
+ */
3281
+ stateInSelfClosingTag(c) {
3282
+ if (c === CharCodes.Gt) {
3283
+ this.cbs.onselfclosingtag(this.index);
3284
+ this.sectionStart = this.index + 1;
3285
+ if (!this.recognizeSelfClosing) {
3286
+ this.enterTagBody();
3287
+ return;
3288
+ }
3289
+ this.state = State.Text;
3290
+ this.isSpecial = false;
3291
+ this.currentSequence = Sequences.Empty;
3292
+ } else if (!isWhitespace$1(c)) {
3293
+ this.state = State.BeforeAttributeName;
3294
+ this.stateBeforeAttributeName(c);
3295
+ }
3296
+ }
3297
+ stateInAttributeName(c) {
3298
+ if (c === CharCodes.Eq || isEndOfTagSection(c)) {
3299
+ this.cbs.onattribname(this.sectionStart, this.index);
3300
+ this.sectionStart = this.index;
3301
+ this.state = State.AfterAttributeName;
3302
+ this.stateAfterAttributeName(c);
3303
+ }
3304
+ }
3305
+ stateAfterAttributeName(c) {
3306
+ if (c === CharCodes.Eq) this.state = State.BeforeAttributeValue;
3307
+ else if (c === CharCodes.Slash || c === CharCodes.Gt) {
3308
+ this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);
3309
+ this.sectionStart = -1;
3310
+ this.state = State.BeforeAttributeName;
3311
+ this.stateBeforeAttributeName(c);
3312
+ } else if (!isWhitespace$1(c)) {
3313
+ this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);
3314
+ this.state = State.InAttributeName;
3315
+ this.sectionStart = this.index;
3316
+ }
3317
+ }
3318
+ stateBeforeAttributeValue(c) {
3319
+ if (c === CharCodes.DoubleQuote) {
3320
+ this.state = State.InAttributeValueDq;
3321
+ this.sectionStart = this.index + 1;
3322
+ } else if (c === CharCodes.SingleQuote) {
3323
+ this.state = State.InAttributeValueSq;
3324
+ this.sectionStart = this.index + 1;
3325
+ } else if (!isWhitespace$1(c)) {
3326
+ this.sectionStart = this.index;
3327
+ this.state = State.InAttributeValueNq;
3328
+ this.stateInAttributeValueNoQuotes(c);
3329
+ }
3330
+ }
3331
+ handleInAttributeValue(c, quote) {
3332
+ if (c === quote || !this.decodeEntities && this.fastForwardTo(quote)) {
3333
+ this.cbs.onattribdata(this.sectionStart, this.index);
3334
+ this.sectionStart = -1;
3335
+ this.cbs.onattribend(quote === CharCodes.DoubleQuote ? QuoteType.Double : QuoteType.Single, this.index + 1);
3336
+ this.state = State.BeforeAttributeName;
3337
+ } else if (this.decodeEntities && c === CharCodes.Amp) this.startEntity();
3338
+ }
3339
+ stateInAttributeValueDoubleQuotes(c) {
3340
+ this.handleInAttributeValue(c, CharCodes.DoubleQuote);
3341
+ }
3342
+ stateInAttributeValueSingleQuotes(c) {
3343
+ this.handleInAttributeValue(c, CharCodes.SingleQuote);
3344
+ }
3345
+ stateInAttributeValueNoQuotes(c) {
3346
+ if (isWhitespace$1(c) || c === CharCodes.Gt) {
3347
+ this.cbs.onattribdata(this.sectionStart, this.index);
3348
+ this.sectionStart = -1;
3349
+ this.cbs.onattribend(QuoteType.Unquoted, this.index);
3350
+ this.state = State.BeforeAttributeName;
3351
+ this.stateBeforeAttributeName(c);
3352
+ } else if (this.decodeEntities && c === CharCodes.Amp) this.startEntity();
3353
+ }
3354
+ /**
3355
+ * Distinguish between CDATA, declarations, HTML comments, and HTML bogus
3356
+ * comments after `<!`.
3357
+ *
3358
+ * In HTML mode, only real comments and doctypes stay on declaration paths;
3359
+ * everything else becomes a bogus comment terminated by the next `>`.
3360
+ * @param c Current character code point.
3361
+ */
3362
+ stateBeforeDeclaration(c) {
3363
+ if (c === CharCodes.OpeningSquareBracket) {
3364
+ this.state = State.CDATASequence;
3365
+ this.sequenceIndex = 0;
3366
+ } else if (this.xmlMode) this.state = c === CharCodes.Dash ? State.BeforeComment : State.InDeclaration;
3367
+ else if ((c | 32) === Sequences.Doctype[0]) {
3368
+ this.state = State.DeclarationSequence;
3369
+ this.currentSequence = Sequences.Doctype;
3370
+ this.sequenceIndex = 1;
3371
+ } else if (c === CharCodes.Gt) {
3372
+ this.cbs.oncomment(this.sectionStart, this.index, 0);
3373
+ this.state = State.Text;
3374
+ this.sectionStart = this.index + 1;
3375
+ } else if (c === CharCodes.Dash) this.state = State.BeforeComment;
3376
+ else this.state = State.InSpecialComment;
3377
+ }
3378
+ /**
3379
+ * Continue matching `doctype` after `<!d`.
3380
+ *
3381
+ * A full `doctype` match stays on the declaration path; any other name falls
3382
+ * back to an HTML bogus comment, which matches browser behavior for
3383
+ * non-doctype `<!...>` constructs.
3384
+ * @param c Current character code point.
3385
+ */
3386
+ stateDeclarationSequence(c) {
3387
+ if (this.sequenceIndex === this.currentSequence.length) {
3388
+ this.state = State.InDeclaration;
3389
+ this.stateInDeclaration(c);
3390
+ } else if ((c | 32) === this.currentSequence[this.sequenceIndex]) this.sequenceIndex += 1;
3391
+ else if (c === CharCodes.Gt) {
3392
+ this.cbs.oncomment(this.sectionStart, this.index, 0);
3393
+ this.state = State.Text;
3394
+ this.sectionStart = this.index + 1;
3395
+ } else this.state = State.InSpecialComment;
3396
+ }
3397
+ stateInDeclaration(c) {
3398
+ if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
3399
+ this.cbs.ondeclaration(this.sectionStart, this.index);
3400
+ this.state = State.Text;
3401
+ this.sectionStart = this.index + 1;
3402
+ }
3403
+ }
3404
+ /**
3405
+ * XML processing instructions (`<?...?>`).
3406
+ *
3407
+ * In HTML mode `<?` is routed to `InSpecialComment` instead, so this
3408
+ * state is only reachable in XML mode.
3409
+ * @param c Current character code point.
3410
+ */
3411
+ stateInProcessingInstruction(c) {
3412
+ if (c === CharCodes.Questionmark) this.sequenceIndex = 1;
3413
+ else if (c === CharCodes.Gt && this.sequenceIndex === 1) {
3414
+ this.cbs.onprocessinginstruction(this.sectionStart, this.index - 1);
3415
+ this.sequenceIndex = 0;
3416
+ this.state = State.Text;
3417
+ this.sectionStart = this.index + 1;
3418
+ } else this.sequenceIndex = Number(this.fastForwardTo(CharCodes.Questionmark));
3419
+ }
3420
+ stateBeforeComment(c) {
3421
+ if (c === CharCodes.Dash) {
3422
+ this.state = State.InCommentLike;
3423
+ this.currentSequence = Sequences.CommentEnd;
3424
+ this.sequenceIndex = 0;
3425
+ this.sectionStart = this.index + 1;
3426
+ } else if (this.xmlMode) this.state = State.InDeclaration;
3427
+ else if (c === CharCodes.Gt) {
3428
+ this.cbs.oncomment(this.sectionStart, this.index, 0);
3429
+ this.state = State.Text;
3430
+ this.sectionStart = this.index + 1;
3431
+ } else this.state = State.InSpecialComment;
3432
+ }
3433
+ stateInSpecialComment(c) {
3434
+ if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
3435
+ this.cbs.oncomment(this.sectionStart, this.index, 0);
3436
+ this.state = State.Text;
3437
+ this.sectionStart = this.index + 1;
3438
+ }
3439
+ }
3440
+ startEntity() {
3441
+ this.baseState = this.state;
3442
+ this.state = State.InEntity;
3443
+ this.entityStart = this.index;
3444
+ this.entityDecoder.startEntity(this.xmlMode ? DecodingMode.Strict : this.baseState === State.Text || this.baseState === State.InSpecialTag ? DecodingMode.Legacy : DecodingMode.Attribute);
3445
+ }
3446
+ stateInEntity() {
3447
+ const indexInBuffer = this.index - this.offset;
3448
+ const length = this.entityDecoder.write(this.buffer, indexInBuffer);
3449
+ if (length >= 0) {
3450
+ this.state = this.baseState;
3451
+ if (length === 0) this.index -= 1;
3452
+ } else {
3453
+ if (indexInBuffer < this.buffer.length && this.buffer.charCodeAt(indexInBuffer) === CharCodes.Amp) {
3454
+ this.state = this.baseState;
3455
+ this.index -= 1;
3456
+ return;
3457
+ }
3458
+ this.index = this.offset + this.buffer.length - 1;
3459
+ }
3460
+ }
3461
+ /**
3462
+ * Remove data that has already been consumed from the buffer.
3463
+ */
3464
+ cleanup() {
3465
+ if (this.running && this.sectionStart !== this.index) {
3466
+ if (this.state === State.Text || this.state === State.InPlainText || this.state === State.InSpecialTag && this.sequenceIndex === 0) {
3467
+ this.cbs.ontext(this.sectionStart, this.index);
3468
+ this.sectionStart = this.index;
3469
+ } else if (this.state === State.InAttributeValueDq || this.state === State.InAttributeValueSq || this.state === State.InAttributeValueNq) {
3470
+ this.cbs.onattribdata(this.sectionStart, this.index);
3471
+ this.sectionStart = this.index;
3472
+ }
3473
+ }
3474
+ }
3475
+ shouldContinue() {
3476
+ return this.index < this.buffer.length + this.offset && this.running;
3477
+ }
3478
+ /**
3479
+ * Iterates through the buffer, calling the function corresponding to the current state.
3480
+ *
3481
+ * States that are more likely to be hit are higher up, as a performance improvement.
3482
+ */
3483
+ parse() {
3484
+ while (this.shouldContinue()) {
3485
+ const c = this.buffer.charCodeAt(this.index - this.offset);
3486
+ switch (this.state) {
3487
+ case State.Text:
3488
+ this.stateText(c);
3489
+ break;
3490
+ case State.InPlainText:
3491
+ this.index = this.buffer.length + this.offset - 1;
3492
+ break;
3493
+ case State.SpecialStartSequence:
3494
+ this.stateSpecialStartSequence(c);
3495
+ break;
3496
+ case State.InSpecialTag:
3497
+ this.stateInSpecialTag(c);
3498
+ break;
3499
+ case State.CDATASequence:
3500
+ this.stateCDATASequence(c);
3501
+ break;
3502
+ case State.DeclarationSequence:
3503
+ this.stateDeclarationSequence(c);
3504
+ break;
3505
+ case State.InAttributeValueDq:
3506
+ this.stateInAttributeValueDoubleQuotes(c);
3507
+ break;
3508
+ case State.InAttributeName:
3509
+ this.stateInAttributeName(c);
3510
+ break;
3511
+ case State.InCommentLike:
3512
+ this.stateInCommentLike(c);
3513
+ break;
3514
+ case State.InSpecialComment:
3515
+ this.stateInSpecialComment(c);
3516
+ break;
3517
+ case State.BeforeAttributeName:
3518
+ this.stateBeforeAttributeName(c);
3519
+ break;
3520
+ case State.InTagName:
3521
+ this.stateInTagName(c);
3522
+ break;
3523
+ case State.InClosingTagName:
3524
+ this.stateInClosingTagName(c);
3525
+ break;
3526
+ case State.BeforeTagName:
3527
+ this.stateBeforeTagName(c);
3528
+ break;
3529
+ case State.AfterAttributeName:
3530
+ this.stateAfterAttributeName(c);
3531
+ break;
3532
+ case State.InAttributeValueSq:
3533
+ this.stateInAttributeValueSingleQuotes(c);
3534
+ break;
3535
+ case State.BeforeAttributeValue:
3536
+ this.stateBeforeAttributeValue(c);
3537
+ break;
3538
+ case State.BeforeClosingTagName:
3539
+ this.stateBeforeClosingTagName(c);
3540
+ break;
3541
+ case State.AfterClosingTagName:
3542
+ this.stateAfterClosingTagName(c);
3543
+ break;
3544
+ case State.InAttributeValueNq:
3545
+ this.stateInAttributeValueNoQuotes(c);
3546
+ break;
3547
+ case State.InSelfClosingTag:
3548
+ this.stateInSelfClosingTag(c);
3549
+ break;
3550
+ case State.InDeclaration:
3551
+ this.stateInDeclaration(c);
3552
+ break;
3553
+ case State.BeforeDeclaration:
3554
+ this.stateBeforeDeclaration(c);
3555
+ break;
3556
+ case State.BeforeComment:
3557
+ this.stateBeforeComment(c);
3558
+ break;
3559
+ case State.InProcessingInstruction:
3560
+ this.stateInProcessingInstruction(c);
3561
+ break;
3562
+ case State.InEntity:
3563
+ this.stateInEntity();
3564
+ break;
3565
+ }
3566
+ this.index++;
3567
+ }
3568
+ this.cleanup();
3569
+ }
3570
+ finish() {
3571
+ if (this.state === State.InEntity) {
3572
+ this.entityDecoder.end();
3573
+ this.state = this.baseState;
3574
+ }
3575
+ this.handleTrailingData();
3576
+ this.cbs.onend();
3577
+ }
3578
+ handleTrailingCommentLikeData(endIndex) {
3579
+ if (this.state !== State.InCommentLike) return false;
3580
+ if (this.currentSequence === Sequences.CdataEnd) if (this.xmlMode) {
3581
+ if (this.sectionStart < endIndex) this.cbs.oncdata(this.sectionStart, endIndex, 0);
3582
+ } else {
3583
+ const cdataStart = this.sectionStart - Sequences.Cdata.length - 1;
3584
+ this.cbs.oncomment(cdataStart, endIndex, 0);
3585
+ }
3586
+ else {
3587
+ const offset = this.xmlMode ? 0 : Math.min(this.sequenceIndex, Sequences.CommentEnd.length - 1);
3588
+ this.cbs.oncomment(this.sectionStart, endIndex, offset);
3589
+ }
3590
+ return true;
3591
+ }
3592
+ handleTrailingMarkupDeclaration(endIndex) {
3593
+ if (this.xmlMode) switch (this.state) {
3594
+ case State.InSpecialComment:
3595
+ case State.BeforeComment:
3596
+ case State.CDATASequence:
3597
+ case State.DeclarationSequence:
3598
+ case State.InDeclaration:
3599
+ this.cbs.ontext(this.sectionStart, endIndex);
3600
+ return true;
3601
+ default: return false;
3602
+ }
3603
+ switch (this.state) {
3604
+ case State.BeforeDeclaration:
3605
+ case State.InSpecialComment:
3606
+ case State.BeforeComment:
3607
+ case State.CDATASequence:
3608
+ this.cbs.oncomment(this.sectionStart, endIndex, 0);
3609
+ return true;
3610
+ case State.DeclarationSequence:
3611
+ if (this.sequenceIndex !== Sequences.Doctype.length) this.cbs.oncomment(this.sectionStart, endIndex, 0);
3612
+ return true;
3613
+ case State.InDeclaration: return true;
3614
+ default: return false;
3615
+ }
3616
+ }
3617
+ /** Handle any trailing data. */
3618
+ handleTrailingData() {
3619
+ const endIndex = this.buffer.length + this.offset;
3620
+ if (this.handleTrailingCommentLikeData(endIndex) || this.handleTrailingMarkupDeclaration(endIndex)) return;
3621
+ if (this.sectionStart >= endIndex) return;
3622
+ switch (this.state) {
3623
+ case State.InTagName:
3624
+ case State.BeforeAttributeName:
3625
+ case State.BeforeAttributeValue:
3626
+ case State.AfterAttributeName:
3627
+ case State.InAttributeName:
3628
+ case State.InAttributeValueSq:
3629
+ case State.InAttributeValueDq:
3630
+ case State.InAttributeValueNq:
3631
+ case State.InClosingTagName: break;
3632
+ default: this.cbs.ontext(this.sectionStart, endIndex);
3633
+ }
3634
+ }
3635
+ emitCodePoint(cp, consumed) {
3636
+ if (this.baseState !== State.Text && this.baseState !== State.InSpecialTag) {
3637
+ if (this.sectionStart < this.entityStart) this.cbs.onattribdata(this.sectionStart, this.entityStart);
3638
+ this.sectionStart = this.entityStart + consumed;
3639
+ this.index = this.sectionStart - 1;
3640
+ this.cbs.onattribentity(cp);
3641
+ } else {
3642
+ if (this.sectionStart < this.entityStart) this.cbs.ontext(this.sectionStart, this.entityStart);
3643
+ this.sectionStart = this.entityStart + consumed;
3644
+ this.index = this.sectionStart - 1;
3645
+ this.cbs.ontextentity(cp, this.sectionStart);
3646
+ }
3647
+ }
3648
+ };
3649
+ //#endregion
3650
+ //#region ../../node_modules/.pnpm/htmlparser2@12.0.0/node_modules/htmlparser2/dist/Parser.js
3651
+ init_defineProperty();
3652
+ const { fromCodePoint } = String;
3653
+ const formTags = new Set([
3654
+ "input",
3655
+ "option",
3656
+ "optgroup",
3657
+ "select",
3658
+ "button",
3659
+ "datalist",
3660
+ "textarea"
3661
+ ]);
3662
+ const pTag = new Set(["p"]);
3663
+ const headingTags = new Set([
3664
+ "h1",
3665
+ "h2",
3666
+ "h3",
3667
+ "h4",
3668
+ "h5",
3669
+ "h6",
3670
+ "p"
3671
+ ]);
3672
+ const tableSectionTags = new Set(["thead", "tbody"]);
3673
+ const ddtTags = new Set(["dd", "dt"]);
3674
+ const rtpTags = new Set(["rt", "rp"]);
3675
+ const openImpliesClose = new Map([
3676
+ ["tr", new Set([
3677
+ "tr",
3678
+ "th",
3679
+ "td"
3680
+ ])],
3681
+ ["th", new Set(["th"])],
3682
+ ["td", new Set([
3683
+ "thead",
3684
+ "th",
3685
+ "td"
3686
+ ])],
3687
+ ["body", new Set([
3688
+ "head",
3689
+ "link",
3690
+ "script"
3691
+ ])],
3692
+ ["a", new Set(["a"])],
3693
+ ["li", new Set(["li"])],
3694
+ ["p", pTag],
3695
+ ["h1", headingTags],
3696
+ ["h2", headingTags],
3697
+ ["h3", headingTags],
3698
+ ["h4", headingTags],
3699
+ ["h5", headingTags],
3700
+ ["h6", headingTags],
3701
+ ["select", formTags],
3702
+ ["input", formTags],
3703
+ ["output", formTags],
3704
+ ["button", formTags],
3705
+ ["datalist", formTags],
3706
+ ["textarea", formTags],
3707
+ ["option", new Set(["option"])],
3708
+ ["optgroup", new Set(["optgroup", "option"])],
3709
+ ["dd", ddtTags],
3710
+ ["dt", ddtTags],
3711
+ ["address", pTag],
3712
+ ["article", pTag],
3713
+ ["aside", pTag],
3714
+ ["blockquote", pTag],
3715
+ ["details", pTag],
3716
+ ["div", pTag],
3717
+ ["dl", pTag],
3718
+ ["fieldset", pTag],
3719
+ ["figcaption", pTag],
3720
+ ["figure", pTag],
3721
+ ["footer", pTag],
3722
+ ["form", pTag],
3723
+ ["header", pTag],
3724
+ ["hr", pTag],
3725
+ ["main", pTag],
3726
+ ["nav", pTag],
3727
+ ["ol", pTag],
3728
+ ["pre", pTag],
3729
+ ["section", pTag],
3730
+ ["table", pTag],
3731
+ ["ul", pTag],
3732
+ ["rt", rtpTags],
3733
+ ["rp", rtpTags],
3734
+ ["tbody", tableSectionTags],
3735
+ ["tfoot", tableSectionTags]
3736
+ ]);
3737
+ const DOCUMENT_TYPE = "doctype";
3738
+ const voidElements = new Set([
3739
+ "area",
3740
+ "base",
3741
+ "basefont",
3742
+ "br",
3743
+ "col",
3744
+ "command",
3745
+ "embed",
3746
+ "frame",
3747
+ "hr",
3748
+ "img",
3749
+ "input",
3750
+ "isindex",
3751
+ "keygen",
3752
+ "link",
3753
+ "meta",
3754
+ "param",
3755
+ "source",
3756
+ "track",
3757
+ "wbr"
3758
+ ]);
3759
+ const foreignContextElements = new Set(["math", "svg"]);
3760
+ /**
3761
+ * Elements that can be used to integrate HTML content within foreign namespaces (e.g., SVG or MathML).
3762
+ *
3763
+ * Entries must use the SVG-adjusted casing (e.g. "foreignObject" not
3764
+ * "foreignobject") since they are compared against adjusted tag names.
3765
+ */
3766
+ const htmlIntegrationElements = new Set([
3767
+ "mi",
3768
+ "mo",
3769
+ "mn",
3770
+ "ms",
3771
+ "mtext",
3772
+ "annotation-xml",
3773
+ "foreignObject",
3774
+ "desc",
3775
+ "title"
3776
+ ]);
3777
+ const svgTagNameAdjustments = new Map([
3778
+ ["altglyph", "altGlyph"],
3779
+ ["altglyphdef", "altGlyphDef"],
3780
+ ["altglyphitem", "altGlyphItem"],
3781
+ ["animatecolor", "animateColor"],
3782
+ ["animatemotion", "animateMotion"],
3783
+ ["animatetransform", "animateTransform"],
3784
+ ["clippath", "clipPath"],
3785
+ ["feblend", "feBlend"],
3786
+ ["fecolormatrix", "feColorMatrix"],
3787
+ ["fecomponenttransfer", "feComponentTransfer"],
3788
+ ["fecomposite", "feComposite"],
3789
+ ["feconvolvematrix", "feConvolveMatrix"],
3790
+ ["fediffuselighting", "feDiffuseLighting"],
3791
+ ["fedisplacementmap", "feDisplacementMap"],
3792
+ ["fedistantlight", "feDistantLight"],
3793
+ ["fedropshadow", "feDropShadow"],
3794
+ ["feflood", "feFlood"],
3795
+ ["fefunca", "feFuncA"],
3796
+ ["fefuncb", "feFuncB"],
3797
+ ["fefuncg", "feFuncG"],
3798
+ ["fefuncr", "feFuncR"],
3799
+ ["fegaussianblur", "feGaussianBlur"],
3800
+ ["feimage", "feImage"],
3801
+ ["femerge", "feMerge"],
3802
+ ["femergenode", "feMergeNode"],
3803
+ ["femorphology", "feMorphology"],
3804
+ ["feoffset", "feOffset"],
3805
+ ["fepointlight", "fePointLight"],
3806
+ ["fespecularlighting", "feSpecularLighting"],
3807
+ ["fespotlight", "feSpotLight"],
3808
+ ["fetile", "feTile"],
3809
+ ["feturbulence", "feTurbulence"],
3810
+ ["foreignobject", "foreignObject"],
3811
+ ["glyphref", "glyphRef"],
3812
+ ["lineargradient", "linearGradient"],
3813
+ ["radialgradient", "radialGradient"],
3814
+ ["textpath", "textPath"]
3815
+ ]);
3816
+ var ForeignContext;
3817
+ (function(ForeignContext) {
3818
+ ForeignContext[ForeignContext["None"] = 0] = "None";
3819
+ ForeignContext[ForeignContext["Svg"] = 1] = "Svg";
3820
+ ForeignContext[ForeignContext["MathML"] = 2] = "MathML";
3821
+ })(ForeignContext || (ForeignContext = {}));
3822
+ const reNameEnd = /\s|\//;
3823
+ /**
3824
+ * Incremental parser implementation.
3825
+ */
3826
+ var Parser = class {
3827
+ constructor(cbs, options = {}) {
3828
+ _defineProperty(this, "options", void 0);
3829
+ _defineProperty(
3830
+ this,
3831
+ /** The start index of the last event. */
3832
+ "startIndex",
3833
+ 0
3834
+ );
3835
+ _defineProperty(
3836
+ this,
3837
+ /** The end index of the last event. */
3838
+ "endIndex",
3839
+ 0
3840
+ );
3841
+ _defineProperty(
3842
+ this,
3843
+ /**
3844
+ * Store the start index of the current open tag,
3845
+ * so we can update the start index for attributes.
3846
+ */
3847
+ "openTagStart",
3848
+ 0
3849
+ );
3850
+ _defineProperty(this, "tagname", "");
3851
+ _defineProperty(this, "attribname", "");
3852
+ _defineProperty(this, "attribvalue", "");
3853
+ _defineProperty(this, "attribs", null);
3854
+ _defineProperty(this, "stack", []);
3855
+ _defineProperty(this, "foreignContext", void 0);
3856
+ _defineProperty(this, "cbs", void 0);
3857
+ _defineProperty(this, "lowerCaseTagNames", void 0);
3858
+ _defineProperty(this, "lowerCaseAttributeNames", void 0);
3859
+ _defineProperty(this, "recognizeSelfClosing", void 0);
3860
+ _defineProperty(
3861
+ this,
3862
+ /** We are parsing HTML. Inverse of the `xmlMode` option. */
3863
+ "htmlMode",
3864
+ void 0
3865
+ );
3866
+ _defineProperty(this, "tokenizer", void 0);
3867
+ _defineProperty(this, "buffers", []);
3868
+ _defineProperty(this, "bufferOffset", 0);
3869
+ _defineProperty(
3870
+ this,
3871
+ /** The index of the last written buffer. Used when resuming after a `pause()`. */
3872
+ "writeIndex",
3873
+ 0
3874
+ );
3875
+ _defineProperty(
3876
+ this,
3877
+ /** Indicates whether the parser has finished running / `.end` has been called. */
3878
+ "ended",
3879
+ false
3880
+ );
3881
+ this.options = options;
3882
+ this.cbs = cbs ?? {};
3883
+ this.htmlMode = !this.options.xmlMode;
3884
+ this.lowerCaseTagNames = options.lowerCaseTags ?? this.htmlMode;
3885
+ this.lowerCaseAttributeNames = options.lowerCaseAttributeNames ?? this.htmlMode;
3886
+ this.recognizeSelfClosing = options.recognizeSelfClosing ?? !this.htmlMode;
3887
+ this.tokenizer = new (options.Tokenizer ?? Tokenizer$1)(this.options, this);
3888
+ this.foreignContext = [ForeignContext.None];
3889
+ this.cbs.onparserinit?.(this);
3890
+ }
3891
+ /**
3892
+ * @param start Start index for the current parser event.
3893
+ * @param endIndex End index for the current parser event.
3894
+ * @internal
3895
+ */
3896
+ ontext(start, endIndex) {
3897
+ const data = this.getSlice(start, endIndex);
3898
+ this.endIndex = endIndex - 1;
3899
+ this.cbs.ontext?.(data);
3900
+ this.startIndex = endIndex;
3901
+ }
3902
+ /**
3903
+ * @param cp Current Unicode code point.
3904
+ * @param endIndex End index for the current parser event.
3905
+ * @internal
3906
+ */
3907
+ ontextentity(cp, endIndex) {
3908
+ this.endIndex = endIndex - 1;
3909
+ this.cbs.ontext?.(fromCodePoint(cp));
3910
+ this.startIndex = endIndex;
3911
+ }
3912
+ /** @internal */
3913
+ isInForeignContext() {
3914
+ return this.foreignContext[0] !== ForeignContext.None;
3915
+ }
3916
+ /**
3917
+ * Checks if the current tag is a void element. Override this if you want
3918
+ * to specify your own additional void elements.
3919
+ * @param name Name of the pseudo selector.
3920
+ */
3921
+ isVoidElement(name) {
3922
+ return this.htmlMode && voidElements.has(name);
3923
+ }
3924
+ /**
3925
+ * Read a tag name from the buffer.
3926
+ *
3927
+ * When `lowerCaseTagNames` is enabled (the default in HTML mode), the name
3928
+ * is lowercased and may be adjusted for SVG casing or the `image` → `img`
3929
+ * alias.
3930
+ * @param start Start index of the tag name in the buffer.
3931
+ * @param endIndex End index of the tag name in the buffer.
3932
+ */
3933
+ readTagName(start, endIndex) {
3934
+ const name = this.lowerCaseTagNames ? this.getSlice(start, endIndex).toLowerCase() : this.getSlice(start, endIndex);
3935
+ if (!(this.lowerCaseTagNames && this.htmlMode)) return name;
3936
+ if (this.foreignContext[0] === ForeignContext.Svg) return svgTagNameAdjustments.get(name) ?? name;
3937
+ if (this.foreignContext.length > 1) {
3938
+ const adjusted = svgTagNameAdjustments.get(name);
3939
+ if (adjusted !== void 0 && this.stack.includes(adjusted)) return adjusted;
3940
+ }
3941
+ if (!this.isInForeignContext()) return name === "image" ? "img" : name;
3942
+ return name;
3943
+ }
3944
+ /**
3945
+ * @param start Start index for the current parser event.
3946
+ * @param endIndex End index for the current parser event.
3947
+ * @internal
3948
+ */
3949
+ onopentagname(start, endIndex) {
3950
+ this.endIndex = endIndex;
3951
+ this.emitOpenTag(this.readTagName(start, endIndex));
3952
+ }
3953
+ emitOpenTag(name) {
3954
+ this.openTagStart = this.startIndex;
3955
+ this.tagname = name;
3956
+ if (this.htmlMode && name === "form" && this.stack.includes("form")) {
3957
+ this.tagname = "";
3958
+ return;
3959
+ }
3960
+ const impliesClose = this.htmlMode && openImpliesClose.get(name);
3961
+ if (impliesClose) while (this.stack.length > 0 && impliesClose.has(this.stack[0])) this.popElement(true);
3962
+ if (!this.isVoidElement(name)) {
3963
+ this.stack.unshift(name);
3964
+ if (this.htmlMode) {
3965
+ if (name === "svg") this.foreignContext.unshift(ForeignContext.Svg);
3966
+ else if (name === "math") this.foreignContext.unshift(ForeignContext.MathML);
3967
+ else if (htmlIntegrationElements.has(name)) this.foreignContext.unshift(ForeignContext.None);
3968
+ }
3969
+ }
3970
+ this.cbs.onopentagname?.(name);
3971
+ if (this.cbs.onopentag) this.attribs = {};
3972
+ }
3973
+ endOpenTag(isImplied) {
3974
+ this.startIndex = this.openTagStart;
3975
+ if (this.attribs) {
3976
+ this.cbs.onopentag?.(this.tagname, this.attribs, isImplied);
3977
+ this.attribs = null;
3978
+ }
3979
+ if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) this.cbs.onclosetag(this.tagname, true);
3980
+ this.tagname = "";
3981
+ }
3982
+ /**
3983
+ * @param endIndex End index for the current parser event.
3984
+ * @internal
3985
+ */
3986
+ onopentagend(endIndex) {
3987
+ this.endIndex = endIndex;
3988
+ this.endOpenTag(false);
3989
+ this.startIndex = endIndex + 1;
3990
+ }
3991
+ /**
3992
+ * @param start Start index for the current parser event.
3993
+ * @param endIndex End index for the current parser event.
3994
+ * @internal
3995
+ */
3996
+ onclosetag(start, endIndex) {
3997
+ this.endIndex = endIndex;
3998
+ const name = this.readTagName(start, endIndex);
3999
+ if (!this.isVoidElement(name)) {
4000
+ const pos = this.stack.indexOf(name);
4001
+ if (pos !== -1) {
4002
+ for (let index = 0; index < pos; index++) this.popElement(true);
4003
+ this.popElement(false);
4004
+ } else if (this.htmlMode && name === "p") {
4005
+ this.emitOpenTag("p");
4006
+ this.closeCurrentTag(true);
4007
+ }
4008
+ } else if (this.htmlMode && name === "br") {
4009
+ this.cbs.onopentagname?.("br");
4010
+ this.cbs.onopentag?.("br", {}, true);
4011
+ this.cbs.onclosetag?.("br", false);
4012
+ }
4013
+ this.startIndex = endIndex + 1;
4014
+ }
4015
+ /**
4016
+ * @param endIndex End index for the current parser event.
4017
+ * @internal
4018
+ */
4019
+ onselfclosingtag(endIndex) {
4020
+ this.endIndex = endIndex;
4021
+ if (this.recognizeSelfClosing || this.isInForeignContext()) {
4022
+ this.closeCurrentTag(false);
4023
+ this.startIndex = endIndex + 1;
4024
+ } else this.onopentagend(endIndex);
4025
+ }
4026
+ /**
4027
+ * Pop the top element off the stack, emit a close event, and maintain
4028
+ * the foreign context stack.
4029
+ * @param implied Whether this close is implied (not from an explicit end tag).
4030
+ */
4031
+ popElement(implied) {
4032
+ const element = this.stack.shift();
4033
+ if (this.htmlMode && (foreignContextElements.has(element) || htmlIntegrationElements.has(element))) this.foreignContext.shift();
4034
+ this.cbs.onclosetag?.(element, implied);
4035
+ }
4036
+ closeCurrentTag(isOpenImplied) {
4037
+ const name = this.tagname;
4038
+ this.endOpenTag(isOpenImplied);
4039
+ if (this.stack[0] === name) this.popElement(!isOpenImplied);
4040
+ }
4041
+ /**
4042
+ * @param start Start index for the current parser event.
4043
+ * @param endIndex End index for the current parser event.
4044
+ * @internal
4045
+ */
4046
+ onattribname(start, endIndex) {
4047
+ this.startIndex = start;
4048
+ const name = this.getSlice(start, endIndex);
4049
+ this.attribname = this.lowerCaseAttributeNames ? name.toLowerCase() : name;
4050
+ }
4051
+ /**
4052
+ * @param start Start index for the current parser event.
4053
+ * @param endIndex End index for the current parser event.
4054
+ * @internal
4055
+ */
4056
+ onattribdata(start, endIndex) {
4057
+ this.attribvalue += this.getSlice(start, endIndex);
4058
+ }
4059
+ /**
4060
+ * @param cp Current Unicode code point.
4061
+ * @internal
4062
+ */
4063
+ onattribentity(cp) {
4064
+ this.attribvalue += fromCodePoint(cp);
4065
+ }
4066
+ /**
4067
+ * @param quote Quote type used for the current attribute.
4068
+ * @param endIndex End index for the current parser event.
4069
+ * @internal
4070
+ */
4071
+ onattribend(quote, endIndex) {
4072
+ this.endIndex = endIndex;
4073
+ this.cbs.onattribute?.(this.attribname, this.attribvalue, quote === QuoteType.Double ? "\"" : quote === QuoteType.Single ? "'" : quote === QuoteType.NoValue ? void 0 : null);
4074
+ if (this.attribs && !Object.hasOwn(this.attribs, this.attribname)) this.attribs[this.attribname] = this.attribvalue;
4075
+ this.attribvalue = "";
4076
+ }
4077
+ getInstructionName(value) {
4078
+ const index = value.search(reNameEnd);
4079
+ let name = index < 0 ? value : value.substr(0, index);
4080
+ if (this.lowerCaseTagNames) name = name.toLowerCase();
4081
+ return name;
4082
+ }
4083
+ /**
4084
+ * @param start Start index for the current parser event.
4085
+ * @param endIndex End index for the current parser event.
4086
+ * @internal
4087
+ */
4088
+ ondeclaration(start, endIndex) {
4089
+ this.endIndex = endIndex;
4090
+ const value = this.getSlice(start, endIndex);
4091
+ if (this.cbs.onprocessinginstruction) {
4092
+ const name = this.htmlMode ? this.lowerCaseTagNames ? DOCUMENT_TYPE : value.slice(0, 7) : this.getInstructionName(value);
4093
+ this.cbs.onprocessinginstruction(`!${name}`, `!${value}`);
4094
+ }
4095
+ this.startIndex = endIndex + 1;
4096
+ }
4097
+ /**
4098
+ * @param start Start index for the current parser event.
4099
+ * @param endIndex End index for the current parser event.
4100
+ * @internal
4101
+ */
4102
+ onprocessinginstruction(start, endIndex) {
4103
+ this.endIndex = endIndex;
4104
+ const value = this.getSlice(start, endIndex);
4105
+ if (this.cbs.onprocessinginstruction) {
4106
+ const name = this.getInstructionName(value);
4107
+ this.cbs.onprocessinginstruction(`?${name}`, `?${value}`);
4108
+ }
4109
+ this.startIndex = endIndex + 1;
4110
+ }
4111
+ /**
4112
+ * @param start Start index for the current parser event.
4113
+ * @param endIndex End index for the current parser event.
4114
+ * @param offset Offset applied when computing parser indices.
4115
+ * @internal
4116
+ */
4117
+ oncomment(start, endIndex, offset) {
4118
+ this.endIndex = endIndex;
4119
+ this.cbs.oncomment?.(this.getSlice(start, endIndex - offset));
4120
+ this.cbs.oncommentend?.();
4121
+ this.startIndex = endIndex + 1;
4122
+ }
4123
+ /**
4124
+ * @param start Start index for the current parser event.
4125
+ * @param endIndex End index for the current parser event.
4126
+ * @param offset Offset applied when computing parser indices.
4127
+ * @internal
4128
+ */
4129
+ oncdata(start, endIndex, offset) {
4130
+ this.endIndex = endIndex;
4131
+ const value = this.getSlice(start, endIndex - offset);
4132
+ if (!this.htmlMode || this.options.recognizeCDATA) {
4133
+ this.cbs.oncdatastart?.();
4134
+ this.cbs.ontext?.(value);
4135
+ this.cbs.oncdataend?.();
4136
+ } else if (this.isInForeignContext()) this.cbs.ontext?.(value);
4137
+ else {
4138
+ this.cbs.oncomment?.(`[CDATA[${value}]]`);
4139
+ this.cbs.oncommentend?.();
4140
+ }
4141
+ this.startIndex = endIndex + 1;
4142
+ }
4143
+ /** @internal */
4144
+ onend() {
4145
+ if (this.cbs.onclosetag) {
4146
+ this.endIndex = this.startIndex;
4147
+ for (let index = 0; index < this.stack.length; index++) this.cbs.onclosetag(this.stack[index], true);
4148
+ }
4149
+ this.cbs.onend?.();
4150
+ }
4151
+ /**
4152
+ * Resets the parser to a blank state, ready to parse a new HTML document
4153
+ */
4154
+ reset() {
4155
+ this.cbs.onreset?.();
4156
+ this.tokenizer.reset();
4157
+ this.tagname = "";
4158
+ this.attribname = "";
4159
+ this.attribvalue = "";
4160
+ this.attribs = null;
4161
+ this.stack.length = 0;
4162
+ this.startIndex = 0;
4163
+ this.endIndex = 0;
4164
+ this.cbs.onparserinit?.(this);
4165
+ this.buffers.length = 0;
4166
+ this.foreignContext.length = 0;
4167
+ this.foreignContext.unshift(ForeignContext.None);
4168
+ this.bufferOffset = 0;
4169
+ this.writeIndex = 0;
4170
+ this.ended = false;
4171
+ }
4172
+ /**
4173
+ * Resets the parser, then parses a complete document and
4174
+ * pushes it to the handler.
4175
+ * @param data Document to parse.
4176
+ */
4177
+ parseComplete(data) {
4178
+ this.reset();
4179
+ this.end(data);
4180
+ }
4181
+ getSlice(start, end) {
4182
+ if (start === end) return "";
4183
+ while (start - this.bufferOffset >= this.buffers[0].length) this.shiftBuffer();
4184
+ let slice = this.buffers[0].slice(start - this.bufferOffset, end - this.bufferOffset);
4185
+ while (end - this.bufferOffset > this.buffers[0].length) {
4186
+ this.shiftBuffer();
4187
+ slice += this.buffers[0].slice(0, end - this.bufferOffset);
4188
+ }
4189
+ return slice;
4190
+ }
4191
+ shiftBuffer() {
4192
+ this.bufferOffset += this.buffers[0].length;
4193
+ this.writeIndex--;
4194
+ this.buffers.shift();
4195
+ }
4196
+ /**
4197
+ * Parses a chunk of data and calls the corresponding callbacks.
4198
+ * @param chunk Chunk to parse.
4199
+ */
4200
+ write(chunk) {
4201
+ if (this.ended) {
4202
+ this.cbs.onerror?.(/* @__PURE__ */ new Error(".write() after done!"));
4203
+ return;
4204
+ }
4205
+ this.buffers.push(chunk);
4206
+ if (this.tokenizer.running) {
4207
+ this.tokenizer.write(chunk);
4208
+ this.writeIndex++;
4209
+ }
4210
+ }
4211
+ /**
4212
+ * Parses the end of the buffer and clears the stack, calls onend.
4213
+ * @param chunk Optional final chunk to parse.
4214
+ */
4215
+ end(chunk) {
4216
+ if (this.ended) {
4217
+ this.cbs.onerror?.(/* @__PURE__ */ new Error(".end() after done!"));
4218
+ return;
4219
+ }
4220
+ if (chunk) this.write(chunk);
4221
+ this.ended = true;
4222
+ this.tokenizer.end();
4223
+ }
4224
+ /**
4225
+ * Pauses parsing. The parser won't emit events until `resume` is called.
4226
+ */
4227
+ pause() {
4228
+ this.tokenizer.pause();
4229
+ }
4230
+ /**
4231
+ * Resumes parsing after `pause` was called.
4232
+ */
4233
+ resume() {
4234
+ this.tokenizer.resume();
4235
+ while (this.tokenizer.running && this.writeIndex < this.buffers.length) this.tokenizer.write(this.buffers[this.writeIndex++]);
4236
+ if (this.ended) this.tokenizer.end();
4237
+ }
4238
+ };
4239
+ //#endregion
4240
+ //#region src/wxml/whitespace.ts
4241
+ const WHITESPACE_CODES = new Set([
4242
+ 9,
4243
+ 10,
4244
+ 11,
4245
+ 12,
4246
+ 13,
4247
+ 32,
4248
+ 160,
4249
+ 65279
4250
+ ]);
4251
+ function isWhitespace(char) {
4252
+ if (char.length === 0) return false;
4253
+ return WHITESPACE_CODES.has(char.charCodeAt(0));
4254
+ }
4255
+ function isAllWhitespace(value) {
4256
+ for (let i = 0; i < value.length; i++) if (!WHITESPACE_CODES.has(value.charCodeAt(i))) return false;
4257
+ return true;
4258
+ }
4259
+ //#endregion
4260
+ //#region src/wxml/Tokenizer.ts
4261
+ init_defineProperty();
4262
+ var Tokenizer = class {
4263
+ constructor() {
4264
+ _defineProperty(this, "state", void 0);
4265
+ _defineProperty(this, "buffer", void 0);
4266
+ _defineProperty(this, "tokens", void 0);
4267
+ _defineProperty(this, "bufferStartIndex", void 0);
4268
+ _defineProperty(this, "expressionStartIndex", void 0);
4269
+ _defineProperty(this, "expressionBuffer", void 0);
4270
+ _defineProperty(this, "expressions", void 0);
4271
+ this.reset();
4272
+ }
4273
+ processChar(char, index) {
4274
+ switch (this.state) {
4275
+ case 0:
4276
+ if (isWhitespace(char)) {} else if (char === "{") {
4277
+ this.state = 2;
4278
+ this.bufferStartIndex = index;
4279
+ this.buffer += char;
4280
+ this.expressionBuffer = char;
4281
+ this.expressionStartIndex = index;
4282
+ } else {
4283
+ this.state = 1;
4284
+ this.bufferStartIndex = index;
4285
+ this.buffer += char;
4286
+ }
4287
+ break;
4288
+ case 1:
4289
+ if (isWhitespace(char)) {
4290
+ this.tokens.push({
4291
+ start: this.bufferStartIndex,
4292
+ end: index,
4293
+ value: this.buffer,
4294
+ expressions: this.expressions
4295
+ });
4296
+ this.buffer = "";
4297
+ this.expressions = [];
4298
+ this.state = 0;
4299
+ } else if (char === "{") {
4300
+ this.buffer += char;
4301
+ this.expressionBuffer = char;
4302
+ this.expressionStartIndex = index;
4303
+ this.state = 2;
4304
+ } else this.buffer += char;
4305
+ break;
4306
+ case 2:
4307
+ if (char === "}") {
4308
+ this.buffer += char;
4309
+ this.expressionBuffer += char;
4310
+ this.state = 3;
4311
+ } else {
4312
+ this.buffer += char;
4313
+ this.expressionBuffer += char;
4314
+ }
4315
+ break;
4316
+ case 3:
4317
+ if (char === "}") {
4318
+ this.buffer += char;
4319
+ this.expressionBuffer += char;
4320
+ this.expressions.push({
4321
+ start: this.expressionStartIndex,
4322
+ end: index + 1,
4323
+ value: this.expressionBuffer
4324
+ });
4325
+ this.expressionBuffer = "";
4326
+ this.state = 4;
4327
+ } else {
4328
+ this.buffer += char;
4329
+ this.expressionBuffer += char;
4330
+ this.state = 2;
4331
+ }
4332
+ break;
4333
+ case 4:
4334
+ if (isWhitespace(char)) {
4335
+ this.tokens.push({
4336
+ start: this.bufferStartIndex,
4337
+ end: index,
4338
+ value: this.buffer,
4339
+ expressions: this.expressions
4340
+ });
4341
+ this.buffer = "";
4342
+ this.expressions = [];
4343
+ this.state = 0;
4344
+ } else if (char === "{") {
4345
+ this.expressionStartIndex = index;
4346
+ this.expressionBuffer = char;
4347
+ this.buffer += char;
4348
+ this.state = 2;
4349
+ } else {
4350
+ this.buffer += char;
4351
+ this.state = 1;
4352
+ }
4353
+ break;
4354
+ default: throw new Error("Unexpected state");
4355
+ }
4356
+ }
4357
+ run(input) {
4358
+ this.reset();
4359
+ for (let i = 0; i < input.length; i++) {
4360
+ const char = input[i];
4361
+ if (char === void 0) continue;
4362
+ this.processChar(char, i);
4363
+ }
4364
+ if (this.buffer.length > 0) this.tokens.push({
4365
+ start: this.bufferStartIndex,
4366
+ end: input.length,
4367
+ value: this.buffer,
4368
+ expressions: this.expressions
4369
+ });
4370
+ const tokens = this.tokens;
4371
+ this.reset();
4372
+ return tokens;
4373
+ }
4374
+ reset() {
4375
+ this.state = 0;
4376
+ this.buffer = "";
4377
+ this.tokens = [];
4378
+ this.bufferStartIndex = 0;
4379
+ this.expressionBuffer = "";
4380
+ this.expressionStartIndex = 0;
4381
+ this.expressions = [];
4382
+ }
4383
+ };
4384
+ //#endregion
4385
+ //#region src/wxml/utils/fragment-helpers.ts
4386
+ function updateWhitespaceGap(ms, start, end, options) {
4387
+ const gap = ms.slice(start, end);
4388
+ if (isAllWhitespace(gap)) ms.update(start, end, replaceWxml(gap, {
4389
+ keepEOL: false,
4390
+ escapeMap: options.escapeMap,
4391
+ ignoreHead: true
4392
+ }));
4393
+ }
4394
+ function updateWxmlSegment(ms, start, end, options, keepEOL, ignoreHead) {
4395
+ ms.update(start, end, replaceWxml(ms.slice(start, end), {
4396
+ keepEOL,
4397
+ escapeMap: options.escapeMap,
4398
+ ignoreHead
4399
+ }));
4400
+ }
4401
+ function updateExpressionSegment(ms, exp, options) {
4402
+ const code = `{{${generateCode(exp.value.slice(2, -2), options)}}}`;
4403
+ ms.update(exp.start, exp.end, code);
4404
+ }
4405
+ //#endregion
4406
+ //#region src/wxml/utils/fragment-updater.ts
4407
+ function handleEachClassFragment(ms, tokens, options = {}) {
4408
+ let previousEnd = 0;
4409
+ for (const token of tokens) {
4410
+ if (token.start > previousEnd) updateWhitespaceGap(ms, previousEnd, token.start, options);
4411
+ let p = token.start;
4412
+ if (token.expressions.length > 0) {
4413
+ for (const exp of token.expressions) {
4414
+ if (exp.start > token.start && p < exp.start) updateWxmlSegment(ms, p, exp.start, options, true, p > 0);
4415
+ updateExpressionSegment(ms, exp, options);
4416
+ p = exp.end;
4417
+ }
4418
+ if (token.end > p) updateWxmlSegment(ms, p, token.end, options, false, true);
4419
+ } else updateWxmlSegment(ms, token.start, token.end, options, false, false);
4420
+ previousEnd = token.end;
4421
+ }
4422
+ if (tokens.length > 0) {
4423
+ const lastToken = tokens[tokens.length - 1];
4424
+ if (!lastToken) return;
4425
+ if (lastToken.end < ms.original.length) updateWhitespaceGap(ms, lastToken.end, ms.original.length, options);
4426
+ }
4427
+ }
4428
+ //#endregion
4429
+ //#region src/wxml/utils/template-fragments.ts
4430
+ /**
4431
+ * 模块级共享 Tokenizer 实例,避免每次调用都重新创建。
4432
+ * Tokenizer.run() 末尾已调用 reset(),天然支持复用。
4433
+ */
4434
+ const sharedTokenizer = new Tokenizer();
4435
+ function templateReplacer(original, options = {}, tokenizer) {
4436
+ const ms = new magic_string.default(original);
4437
+ handleEachClassFragment(ms, (tokenizer ?? sharedTokenizer).run(ms.original), options);
4438
+ return ms.toString();
4439
+ }
4440
+ //#endregion
4441
+ //#region src/wxml/utils/custom-template.ts
4442
+ async function customTemplateHandler(rawSource, options, cachedMatcher) {
4443
+ const { customAttributesEntities = [], disabledDefaultTemplateHandler, inlineWxs, runtimeSet, jsHandler } = options ?? {};
4444
+ const matchCustomAttribute = cachedMatcher ?? createAttributeMatcher(customAttributesEntities);
4445
+ const defaultTemplateHandlerEnabled = !disabledDefaultTemplateHandler;
4446
+ let replaceOptions;
4447
+ let cachedQuote;
4448
+ let s;
4449
+ let tag = "";
4450
+ let wxsArray;
4451
+ function getMagicString() {
4452
+ if (!s) s = new magic_string.default(rawSource);
4453
+ return s;
4454
+ }
4455
+ function getReplaceOptions(quote) {
4456
+ if (!replaceOptions) {
4457
+ replaceOptions = {
4458
+ ...options,
4459
+ quote
4460
+ };
4461
+ cachedQuote = quote;
4462
+ return replaceOptions;
4463
+ }
4464
+ if (cachedQuote !== quote) {
4465
+ replaceOptions.quote = quote;
4466
+ cachedQuote = quote;
4467
+ }
4468
+ return replaceOptions;
4469
+ }
4470
+ function isDefaultTemplateAttribute(name) {
4471
+ if (name === "class" || name === "hover-class" || name === "virtualhostclass") return true;
4472
+ const lowerName = name.toLowerCase();
4473
+ return lowerName === "class" || lowerName === "hover-class" || lowerName === "virtualhostclass";
4474
+ }
4475
+ const parser = new Parser({
4476
+ onopentagname(name) {
4477
+ tag = name;
4478
+ },
4479
+ onattribute(name, value, quote) {
4480
+ if (!value) return;
4481
+ const shouldHandleDefault = defaultTemplateHandlerEnabled && isDefaultTemplateAttribute(name);
4482
+ const shouldHandleCustom = matchCustomAttribute?.(tag, name) ?? false;
4483
+ if (!shouldHandleDefault && !shouldHandleCustom) return;
4484
+ getMagicString().update(parser.startIndex + name.length + 2, parser.endIndex - 1, templateReplacer(value, getReplaceOptions(quote)));
4485
+ },
4486
+ ontext(data) {
4487
+ if (inlineWxs && tag === "wxs") (wxsArray ?? (wxsArray = [])).push({
4488
+ data,
4489
+ endIndex: parser.endIndex + 1,
4490
+ startIndex: parser.startIndex
4491
+ });
4492
+ },
4493
+ onclosetag() {
4494
+ tag = "";
4495
+ }
4496
+ }, { xmlMode: true });
4497
+ parser.write(rawSource);
4498
+ parser.end();
4499
+ if (jsHandler) for (const { data, endIndex, startIndex } of wxsArray ?? []) {
4500
+ const { code } = await jsHandler(data, runtimeSet);
4501
+ if (code !== data) getMagicString().update(startIndex, endIndex, code);
4502
+ }
4503
+ return s?.toString() ?? rawSource;
4504
+ }
4505
+ //#endregion
4506
+ //#region src/wxml/utils.ts
4507
+ function createTemplateHandler(options = {}) {
4508
+ const cachedMatcher = createAttributeMatcher(options.customAttributesEntities);
4509
+ const defaultOptions = options;
4510
+ let cachedRuntimeSet;
4511
+ let cachedOptionsWithRuntimeSet;
4512
+ return (rawSource, opt) => {
4513
+ const runtimeSet = opt?.runtimeSet;
4514
+ if (runtimeSet === void 0) return customTemplateHandler(rawSource, defaultOptions, cachedMatcher);
4515
+ if (cachedRuntimeSet !== runtimeSet || !cachedOptionsWithRuntimeSet) {
4516
+ cachedRuntimeSet = runtimeSet;
4517
+ cachedOptionsWithRuntimeSet = {
4518
+ ...defaultOptions,
4519
+ runtimeSet
4520
+ };
4521
+ }
4522
+ return customTemplateHandler(rawSource, cachedOptionsWithRuntimeSet, cachedMatcher);
4523
+ };
4524
+ }
4525
+ //#endregion
4526
+ //#region src/constants.ts
4527
+ const pluginName = "weapp-tailwindcss";
4528
+ const vitePluginName = "weapp-tailwindcss:adaptor";
4529
+ const DEFAULT_RUNTIME_PACKAGE_REPLACEMENTS = {
4530
+ "tailwind-merge": "@weapp-tailwindcss/merge",
4531
+ "class-variance-authority": "@weapp-tailwindcss/cva",
4532
+ "tailwind-variants": "@weapp-tailwindcss/variants"
4533
+ };
4534
+ //#endregion
4535
+ //#region src/context/runtime-package-replacements.ts
4536
+ function resolveRuntimePackageReplacements(option) {
4537
+ const mapping = require_v3_engine.resolveBooleanObjectOption(option, DEFAULT_RUNTIME_PACKAGE_REPLACEMENTS);
4538
+ if (!mapping) return;
4539
+ const normalized = {};
4540
+ for (const [from, to] of Object.entries(mapping)) {
4541
+ if (!from || typeof to !== "string" || to.length === 0) continue;
4542
+ normalized[from] = to;
4543
+ }
4544
+ return Object.keys(normalized).length > 0 ? normalized : void 0;
4545
+ }
4546
+ //#endregion
4547
+ //#region src/context/style-options.ts
4548
+ function resolveStyleOptionsFromContext(ctx) {
4549
+ const resolvedUniAppXOptions = require_tailwindcss.resolveUniAppXOptions(ctx.uniAppX);
4550
+ return {
4551
+ cssPreflight: ctx.cssPreflight,
4552
+ cssPreflightRange: ctx.cssPreflightRange,
4553
+ cssChildCombinatorReplaceValue: ctx.cssChildCombinatorReplaceValue,
4554
+ cssSelectorReplacement: ctx.cssSelectorReplacement,
4555
+ rem2rpx: ctx.rem2rpx,
4556
+ cssRemoveProperty: ctx.cssRemoveProperty,
4557
+ cssRemoveHoverPseudoClass: ctx.cssRemoveHoverPseudoClass,
4558
+ cssPresetEnv: ctx.cssPresetEnv,
4559
+ autoprefixer: ctx.autoprefixer,
4560
+ cssCalc: ctx.cssCalc,
4561
+ uniAppX: resolvedUniAppXOptions.enabled,
4562
+ platform: ctx.platform,
4563
+ px2rpx: ctx.px2rpx,
4564
+ unitsToPx: ctx.unitsToPx,
4565
+ unitConversion: ctx.unitConversion
4566
+ };
4567
+ }
4568
+ //#endregion
4569
+ //#region src/context/handlers.ts
4570
+ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions, tailwindcssMajorVersion) {
4571
+ const { escapeMap, injectAdditionalCssVarScope, postcssOptions, uniAppX, arbitraryValues, jsPreserveClass, jsArbitraryValueFallback, babelParserOptions, ignoreCallExpressionIdentifiers, ignoreTaggedTemplateExpressionIdentifiers, inlineWxs, disabledDefaultTemplateHandler, replaceRuntimePackages } = ctx;
4572
+ const resolvedUniAppXOptions = require_tailwindcss.resolveUniAppXOptions(uniAppX);
4573
+ const styleOptions = resolveStyleOptionsFromContext(ctx);
4574
+ const uniAppXEnabled = styleOptions.uniAppX === true;
4575
+ const moduleSpecifierReplacements = resolveRuntimePackageReplacements(replaceRuntimePackages);
4576
+ const styleHandler = (0, _weapp_tailwindcss_postcss.createStyleHandler)({
4577
+ ...styleOptions,
4578
+ escapeMap,
4579
+ injectAdditionalCssVarScope,
4580
+ postcssOptions,
4581
+ uniAppXUnsupported: resolvedUniAppXOptions.uvueUnsupported,
4582
+ cssCalc: cssCalcOptions,
4583
+ majorVersion: tailwindcssMajorVersion
4584
+ });
4585
+ const jsHandler = createJsHandler({
4586
+ escapeMap,
4587
+ arbitraryValues,
4588
+ jsPreserveClass,
4589
+ jsArbitraryValueFallback: jsArbitraryValueFallback ?? "auto",
4590
+ tailwindcssMajorVersion,
4591
+ generateMap: true,
4592
+ babelParserOptions,
4593
+ ignoreCallExpressionIdentifiers,
4594
+ ignoreTaggedTemplateExpressionIdentifiers,
4595
+ uniAppX: uniAppXEnabled,
4596
+ moduleSpecifierReplacements
4597
+ });
4598
+ return {
4599
+ styleHandler,
4600
+ jsHandler,
4601
+ templateHandler: createTemplateHandler({
4602
+ customAttributesEntities,
4603
+ escapeMap,
4604
+ inlineWxs,
4605
+ jsHandler,
4606
+ disabledDefaultTemplateHandler
4607
+ })
4608
+ };
4609
+ }
4610
+ //#endregion
4611
+ //#region src/context/logger.ts
4612
+ const loggerLevelMap = {
4613
+ error: 0,
4614
+ warn: 1,
4615
+ info: 3,
4616
+ silent: -999
4617
+ };
4618
+ function applyLoggerLevel(logLevel) {
4619
+ _weapp_tailwindcss_logger.logger.level = loggerLevelMap[logLevel ?? "info"] ?? loggerLevelMap.info;
4620
+ }
4621
+ //#endregion
4622
+ //#region src/context/index.ts
4623
+ async function clearTailwindcssPatcherCache(patcher, options) {
4624
+ if (!patcher) return;
4625
+ const cacheOptions = patcher.options?.cache;
4626
+ if (cacheOptions == null || typeof cacheOptions === "object" && cacheOptions.enabled === false) return;
4627
+ if (typeof patcher.clearCache === "function") try {
4628
+ await patcher.clearCache({ scope: "all" });
4629
+ } catch (error) {
4630
+ _weapp_tailwindcss_logger.logger.debug("failed to clear tailwindcss patcher cache via clearCache(): %O", error);
4631
+ }
4632
+ if (!options?.removeDirectory) return;
4633
+ const cachePaths = /* @__PURE__ */ new Map();
4634
+ const normalizedCacheOptions = typeof cacheOptions === "object" ? cacheOptions : void 0;
4635
+ if (normalizedCacheOptions?.path) cachePaths.set(normalizedCacheOptions.path, false);
4636
+ const privateCachePath = patcher?.cacheStore?.options?.path;
4637
+ if (privateCachePath) cachePaths.set(privateCachePath, false);
4638
+ if (options?.removeDirectory && normalizedCacheOptions?.dir) cachePaths.set(normalizedCacheOptions.dir, true);
4639
+ if (!cachePaths.size) return;
4640
+ for (const [cachePath, recursive] of cachePaths.entries()) try {
4641
+ await (0, node_fs_promises.rm)(cachePath, {
4642
+ force: true,
4643
+ recursive
4644
+ });
4645
+ } catch (error) {
4646
+ const err = error;
4647
+ if (err?.code === "ENOENT") continue;
4648
+ _weapp_tailwindcss_logger.logger.debug("failed to clear tailwindcss patcher cache: %s %O", cachePath, err);
4649
+ }
4650
+ }
4651
+ function createInternalCompilerContext(opts) {
4652
+ const ctx = (0, _weapp_tailwindcss_shared.defuOverrideArray)(opts, require_defaults.getDefaultOptions(), {});
4653
+ ctx.arbitraryValues = resolveUnocssBareArbitraryValues(ctx.arbitraryValues, ctx.unocss);
4654
+ ctx.escapeMap = ctx.customReplaceDictionary;
4655
+ applyLoggerLevel(ctx.logLevel);
4656
+ const twPatcher = require_tailwindcss.createTailwindcssPatcherFromContext(ctx);
4657
+ logTailwindcssTarget(twPatcher, ctx.tailwindcssBasedir);
4658
+ logRuntimeTailwindcssVersion(ctx.tailwindcssBasedir, twPatcher.packageInfo?.rootPath, twPatcher.packageInfo?.version);
4659
+ if (opts?.__internalDeferMissingCssEntriesWarning !== true) require_tailwindcss.warnMissingCssEntries(ctx, twPatcher);
4660
+ ctx.cssPreflight = require_defaults.resolveDefaultCssPreflight(opts?.cssPreflight, twPatcher.majorVersion);
4661
+ const cssCalcOptions = require_tailwindcss.applyV4CssCalcDefaults(ctx.cssCalc, twPatcher);
4662
+ ctx.cssCalc = cssCalcOptions;
4663
+ const { styleHandler, jsHandler, templateHandler } = createHandlersFromContext(ctx, toCustomAttributesEntities(ctx.customAttributes), cssCalcOptions, twPatcher.majorVersion);
4664
+ ctx.styleHandler = styleHandler;
4665
+ ctx.jsHandler = jsHandler;
4666
+ ctx.templateHandler = templateHandler;
4667
+ ctx.cache = initializeCache(ctx.cache);
4668
+ ctx.twPatcher = twPatcher;
4669
+ const refreshTailwindcssPatcher = async (options) => {
4670
+ const previousPatcher = ctx.twPatcher;
4671
+ if (options?.clearCache !== false) await clearTailwindcssPatcherCache(previousPatcher);
4672
+ require_v3_engine.invalidateRuntimeClassSet(previousPatcher);
4673
+ const nextPatcher = require_tailwindcss.createTailwindcssPatcherFromContext(ctx);
4674
+ Object.assign(previousPatcher, nextPatcher);
4675
+ ctx.twPatcher = previousPatcher;
4676
+ return previousPatcher;
4677
+ };
4678
+ ctx.refreshTailwindcssPatcher = refreshTailwindcssPatcher;
4679
+ Object.defineProperty(ctx.twPatcher, refreshTailwindcssPatcherSymbol, {
4680
+ value: refreshTailwindcssPatcher,
4681
+ configurable: true
4682
+ });
4683
+ return ctx;
4684
+ }
4685
+ /**
4686
+ * 获取用户定义选项的内部表示,并初始化相关的处理程序和 Tailwind 运行时。
4687
+ * @param opts - 用户定义的选项,可选。
4688
+ * @returns 返回一个包含内部用户定义选项的对象,包括样式、JS 和模板处理程序,以及 Tailwind CSS 运行时。
4689
+ */
4690
+ function getCompilerContext(opts) {
4691
+ return withCompilerContextCache(opts, () => createInternalCompilerContext(opts));
4692
+ }
4693
+ //#endregion
4694
+ //#region src/js/precheck.ts
4695
+ /** 用于检测源码中是否包含类名相关模式的正则表达式 */
4696
+ const FAST_JS_TRANSFORM_HINT_RE = /className\b|class\s*=|classList\.|\b(?:twMerge|clsx|classnames|cn|cva)\b|\[["'`]class["'`]\]|text-\[|bg-\[|\b(?:[whpm]|px|py|mx|my|rounded|flex|grid|gap)-/;
4697
+ /** 用于检测源码中是否包含 import/export/require 语句的正则表达式 */
4698
+ const DEPENDENCY_HINT_RE = /\bimport\s*[("'`{*]|\brequire\s*\(|\bexport\s+\*\s+from\s+["'`]|\bexport\s*\{[^}]*\}\s*from\s+["'`]/;
4699
+ /**
4700
+ * 判断是否可以跳过 JS 转换。
4701
+ * 通过正则快速检测源码内容,避免不必要的 Babel AST 解析。
4702
+ *
4703
+ * @param rawSource - 原始 JS 源码字符串
4704
+ * @param options - 可选的 JS 处理器配置选项
4705
+ * @returns 如果可以跳过转换返回 `true`,否则返回 `false`
4706
+ */
4707
+ function shouldSkipJsTransform(rawSource, options) {
4708
+ if (node_process.default.env["WEAPP_TW_DISABLE_JS_PRECHECK"] === "1") return false;
4709
+ if (!rawSource) return true;
4710
+ if (options?.alwaysEscape) return false;
4711
+ if (options?.moduleSpecifierReplacements && Object.keys(options.moduleSpecifierReplacements).length > 0) return false;
4712
+ if (options?.wrapExpression) return false;
4713
+ if (DEPENDENCY_HINT_RE.test(rawSource)) return false;
4714
+ return !FAST_JS_TRANSFORM_HINT_RE.test(rawSource);
4715
+ }
4716
+ //#endregion
4717
+ Object.defineProperty(exports, "JsTokenUpdater", {
4718
+ enumerable: true,
4719
+ get: function() {
4720
+ return JsTokenUpdater;
4721
+ }
4722
+ });
4723
+ Object.defineProperty(exports, "Parser", {
4724
+ enumerable: true,
4725
+ get: function() {
4726
+ return Parser;
4727
+ }
4728
+ });
4729
+ Object.defineProperty(exports, "_defineProperty", {
4730
+ enumerable: true,
4731
+ get: function() {
4732
+ return _defineProperty;
4733
+ }
4734
+ });
4735
+ Object.defineProperty(exports, "analyzeSource", {
4736
+ enumerable: true,
4737
+ get: function() {
4738
+ return analyzeSource;
4739
+ }
4740
+ });
4741
+ Object.defineProperty(exports, "babelParse", {
4742
+ enumerable: true,
4743
+ get: function() {
4744
+ return babelParse;
4745
+ }
4746
+ });
4747
+ Object.defineProperty(exports, "collectRuntimeClassSet", {
4748
+ enumerable: true,
4749
+ get: function() {
4750
+ return collectRuntimeClassSet;
4751
+ }
4752
+ });
4753
+ Object.defineProperty(exports, "createAttributeMatcher", {
4754
+ enumerable: true,
4755
+ get: function() {
4756
+ return createAttributeMatcher;
4757
+ }
4758
+ });
4759
+ Object.defineProperty(exports, "createTailwindRuntimeReadyPromise", {
4760
+ enumerable: true,
4761
+ get: function() {
4762
+ return createTailwindRuntimeReadyPromise;
4763
+ }
4764
+ });
4765
+ Object.defineProperty(exports, "ensureRuntimeClassSet", {
4766
+ enumerable: true,
4767
+ get: function() {
4768
+ return ensureRuntimeClassSet;
4769
+ }
4770
+ });
4771
+ Object.defineProperty(exports, "generateCode", {
4772
+ enumerable: true,
4773
+ get: function() {
4774
+ return generateCode;
4775
+ }
4776
+ });
4777
+ Object.defineProperty(exports, "getCompilerContext", {
4778
+ enumerable: true,
4779
+ get: function() {
4780
+ return getCompilerContext;
4781
+ }
4782
+ });
4783
+ Object.defineProperty(exports, "init_defineProperty", {
4784
+ enumerable: true,
4785
+ get: function() {
4786
+ return init_defineProperty;
4787
+ }
4788
+ });
4789
+ Object.defineProperty(exports, "isClassContextLiteralPath", {
4790
+ enumerable: true,
4791
+ get: function() {
4792
+ return isClassContextLiteralPath;
4793
+ }
4794
+ });
4795
+ Object.defineProperty(exports, "pluginName", {
4796
+ enumerable: true,
4797
+ get: function() {
4798
+ return pluginName;
4799
+ }
4800
+ });
4801
+ Object.defineProperty(exports, "refreshTailwindRuntimeState", {
4802
+ enumerable: true,
4803
+ get: function() {
4804
+ return refreshTailwindRuntimeState;
4805
+ }
4806
+ });
4807
+ Object.defineProperty(exports, "replaceWxml", {
4808
+ enumerable: true,
4809
+ get: function() {
4810
+ return replaceWxml;
4811
+ }
4812
+ });
4813
+ Object.defineProperty(exports, "resolveStyleOptionsFromContext", {
4814
+ enumerable: true,
4815
+ get: function() {
4816
+ return resolveStyleOptionsFromContext;
4817
+ }
4818
+ });
4819
+ Object.defineProperty(exports, "shouldSkipJsTransform", {
4820
+ enumerable: true,
4821
+ get: function() {
4822
+ return shouldSkipJsTransform;
4823
+ }
4824
+ });
4825
+ Object.defineProperty(exports, "toCustomAttributesEntities", {
4826
+ enumerable: true,
4827
+ get: function() {
4828
+ return toCustomAttributesEntities;
4829
+ }
4830
+ });
4831
+ Object.defineProperty(exports, "traverse", {
4832
+ enumerable: true,
4833
+ get: function() {
4834
+ return traverse;
4835
+ }
4836
+ });
4837
+ Object.defineProperty(exports, "vitePluginName", {
4838
+ enumerable: true,
4839
+ get: function() {
4840
+ return vitePluginName;
4841
+ }
4842
+ });