@qwik.dev/core 2.0.0-beta.1 → 2.0.0-beta.11

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 (100) hide show
  1. package/bindings/qwik.darwin-arm64.node +0 -0
  2. package/bindings/qwik.darwin-x64.node +0 -0
  3. package/bindings/qwik.linux-x64-gnu.node +0 -0
  4. package/bindings/qwik.win32-x64-msvc.node +0 -0
  5. package/bindings/qwik_wasm_bg.wasm +0 -0
  6. package/dist/backpatch/index.cjs +6 -0
  7. package/dist/backpatch/index.d.ts +2 -0
  8. package/dist/backpatch/index.mjs +5 -0
  9. package/dist/backpatch/package.json +8 -0
  10. package/dist/backpatch-executor.debug.js +34 -0
  11. package/dist/backpatch-executor.js +1 -0
  12. package/dist/build/package.json +1 -1
  13. package/dist/cli.cjs +3031 -763
  14. package/dist/core-internal.d.ts +285 -156
  15. package/dist/core.cjs +7546 -6628
  16. package/dist/core.cjs.map +1 -1
  17. package/dist/core.min.mjs +1 -1
  18. package/dist/core.mjs +7524 -6625
  19. package/dist/core.mjs.map +1 -1
  20. package/dist/core.prod.cjs +3088 -2624
  21. package/dist/core.prod.mjs +4453 -3916
  22. package/dist/insights/vite/index.cjs +1 -1
  23. package/dist/insights/vite/index.mjs +10 -10
  24. package/dist/loader/index.cjs +2 -2
  25. package/dist/loader/index.mjs +2 -2
  26. package/dist/loader/package.json +1 -1
  27. package/dist/optimizer.cjs +208 -4016
  28. package/dist/optimizer.d.ts +13 -38
  29. package/dist/optimizer.mjs +2592 -3715
  30. package/dist/preloader.cjs +8 -11
  31. package/dist/preloader.mjs +8 -11
  32. package/dist/qwikloader.debug.js +1 -15
  33. package/dist/qwikloader.js +1 -1
  34. package/dist/server.cjs +315 -122
  35. package/dist/server.d.ts +18 -3
  36. package/dist/server.mjs +294 -110
  37. package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/vite.config.mts +1 -1
  38. package/dist/starters/adapters/aws-lambda/package.json +1 -1
  39. package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +2 -6
  40. package/dist/starters/adapters/azure-swa/adapters/azure-swa/vite.config.mts +1 -1
  41. package/dist/starters/adapters/azure-swa/package.json +1 -1
  42. package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +2 -3
  43. package/dist/starters/adapters/bun/adapters/bun/vite.config.mts +2 -2
  44. package/dist/starters/adapters/bun/package.json +1 -1
  45. package/dist/starters/adapters/bun/src/entry.bun.ts +0 -2
  46. package/dist/starters/adapters/cloud-run/adapters/cloud-run/vite.config.mts +1 -1
  47. package/dist/starters/adapters/cloud-run/package.json +1 -1
  48. package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +1 -3
  49. package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/vite.config.mts +1 -1
  50. package/dist/starters/adapters/cloudflare-pages/package.json +1 -1
  51. package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +2 -3
  52. package/dist/starters/adapters/deno/adapters/deno/vite.config.mts +1 -1
  53. package/dist/starters/adapters/deno/package.json +1 -1
  54. package/dist/starters/adapters/deno/src/entry.deno.ts +0 -2
  55. package/dist/starters/adapters/express/adapters/express/vite.config.mts +1 -1
  56. package/dist/starters/adapters/express/package.json +1 -1
  57. package/dist/starters/adapters/express/src/entry.express.tsx +1 -3
  58. package/dist/starters/adapters/fastify/adapters/fastify/vite.config.mts +1 -1
  59. package/dist/starters/adapters/fastify/package.json +1 -1
  60. package/dist/starters/adapters/fastify/src/entry.fastify.tsx +1 -1
  61. package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +1 -2
  62. package/dist/starters/adapters/firebase/adapters/firebase/vite.config.mts +1 -1
  63. package/dist/starters/adapters/firebase/package.json +1 -1
  64. package/dist/starters/adapters/firebase/src/entry-firebase.tsx +2 -3
  65. package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/vite.config.mts +1 -1
  66. package/dist/starters/adapters/netlify-edge/package.json +1 -1
  67. package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +2 -3
  68. package/dist/starters/adapters/node-server/adapters/node-server/vite.config.mts +1 -1
  69. package/dist/starters/adapters/node-server/package.json +1 -1
  70. package/dist/starters/adapters/node-server/src/entry.node-server.tsx +0 -2
  71. package/dist/starters/adapters/{static/adapters/static → ssg/adapters/ssg}/vite.config.mts +2 -2
  72. package/dist/starters/adapters/ssg/package.json +19 -0
  73. package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/vite.config.mts +1 -1
  74. package/dist/starters/adapters/vercel-edge/package.json +1 -1
  75. package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +2 -3
  76. package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
  77. package/dist/starters/features/auth/package.json +1 -1
  78. package/dist/starters/features/csr/index.html +23 -0
  79. package/dist/starters/features/csr/package.json +29 -0
  80. package/dist/starters/features/csr/src/root.tsx +15 -0
  81. package/dist/starters/features/csr/vite.config.mts +13 -0
  82. package/dist/starters/features/localize/package.json +3 -3
  83. package/dist/starters/features/localize/src/entry.ssr.tsx +17 -21
  84. package/dist/starters/features/pandacss/package.json +1 -1
  85. package/dist/starters/features/playwright/playwright-report/index.html +953 -911
  86. package/dist/starters/features/postcss/postcss.config.js +1 -1
  87. package/dist/starters/features/tailwind/package.json +2 -2
  88. package/dist/starters/features/tailwind/prettier.config.js +10 -0
  89. package/dist/starters/features/tailwind-v3/package.json +1 -1
  90. package/dist/starters/features/tailwind-v3/prettier.config.js +10 -0
  91. package/dist/testing/index.cjs +9898 -7478
  92. package/dist/testing/index.d.ts +953 -5
  93. package/dist/testing/index.mjs +10085 -7683
  94. package/dist/testing/package.json +1 -1
  95. package/package.json +16 -10
  96. package/public.d.ts +1 -0
  97. package/server.d.ts +2 -0
  98. package/dist/starters/adapters/static/package.json +0 -19
  99. package/dist/starters/features/tailwind/.prettierrc.js +0 -3
  100. /package/dist/starters/adapters/{static → ssg}/README.md +0 -0
@@ -1,4020 +1,212 @@
1
- /**
1
+ var Jr=Object.create;var Rt=Object.defineProperty;var Yr=Object.getOwnPropertyDescriptor;var Xr=Object.getOwnPropertyNames;var Vr=Object.getPrototypeOf,Zr=Object.prototype.hasOwnProperty;var eo=(J,V,ae,pe)=>{if(V&&typeof V=="object"||typeof V=="function")for(let le of Xr(V))!Zr.call(J,le)&&le!==ae&&Rt(J,le,{get:()=>V[le],enumerable:!(pe=Yr(V,le))||pe.enumerable});return J};var nt=(J,V,ae)=>(ae=J!=null?Jr(Vr(J)):{},eo(V||!J||!J.__esModule?Rt(ae,"default",{value:J,enumerable:!0}):ae,J));globalThis.qwikOptimizer=(function(J){/**
2
2
  * @license
3
- * @qwik.dev/core/optimizer 2.0.0-beta.1-dev+495e8d9
3
+ * @qwik.dev/core/optimizer 2.0.0-beta.11-dev+d7daca3
4
4
  * Copyright QwikDev. All Rights Reserved.
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
7
- */
8
- globalThis.qwikOptimizer = function(module) {
9
- "use strict";
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __commonJS = (cb, mod) => function() {
17
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = {
18
- exports: {}
19
- }).exports, mod), mod.exports;
20
- };
21
- var __export = (target, all) => {
22
- for (var name in all) {
23
- __defProp(target, name, {
24
- get: all[name],
25
- enumerable: true
26
- });
27
- }
28
- };
29
- var __copyProps = (to, from, except, desc) => {
30
- if (from && "object" === typeof from || "function" === typeof from) {
31
- for (let key of __getOwnPropNames(from)) {
32
- __hasOwnProp.call(to, key) || key === except || __defProp(to, key, {
33
- get: () => from[key],
34
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
35
- });
36
- }
37
- }
38
- return to;
39
- };
40
- var __toESM = (mod, isNodeMode, target) => (target = null != mod ? __create(__getProtoOf(mod)) : {},
41
- __copyProps(!isNodeMode && mod && mod.__esModule ? target : __defProp(target, "default", {
42
- value: mod,
43
- enumerable: true
44
- }), mod));
45
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
46
- value: true
47
- }), mod);
48
- var require_utils = __commonJS({
49
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/utils.js"(exports2) {
50
- Object.defineProperty(exports2, "__esModule", {
51
- value: true
52
- });
53
- exports2.findBox = exports2.readUInt = exports2.readUInt32LE = exports2.readUInt32BE = exports2.readInt32LE = exports2.readUInt24LE = exports2.readUInt16LE = exports2.readUInt16BE = exports2.readInt16LE = exports2.toHexString = exports2.toUTF8String = void 0;
54
- var decoder = new TextDecoder;
55
- var toUTF8String = (input, start = 0, end = input.length) => decoder.decode(input.slice(start, end));
56
- exports2.toUTF8String = toUTF8String;
57
- var toHexString = (input, start = 0, end = input.length) => input.slice(start, end).reduce(((memo, i) => memo + ("0" + i.toString(16)).slice(-2)), "");
58
- exports2.toHexString = toHexString;
59
- var readInt16LE = (input, offset = 0) => {
60
- const val = input[offset] + 256 * input[offset + 1];
61
- return val | 131070 * (32768 & val);
62
- };
63
- exports2.readInt16LE = readInt16LE;
64
- var readUInt16BE = (input, offset = 0) => 256 * input[offset] + input[offset + 1];
65
- exports2.readUInt16BE = readUInt16BE;
66
- var readUInt16LE = (input, offset = 0) => input[offset] + 256 * input[offset + 1];
67
- exports2.readUInt16LE = readUInt16LE;
68
- var readUInt24LE = (input, offset = 0) => input[offset] + 256 * input[offset + 1] + 65536 * input[offset + 2];
69
- exports2.readUInt24LE = readUInt24LE;
70
- var readInt32LE = (input, offset = 0) => input[offset] + 256 * input[offset + 1] + 65536 * input[offset + 2] + (input[offset + 3] << 24);
71
- exports2.readInt32LE = readInt32LE;
72
- var readUInt32BE = (input, offset = 0) => input[offset] * 2 ** 24 + 65536 * input[offset + 1] + 256 * input[offset + 2] + input[offset + 3];
73
- exports2.readUInt32BE = readUInt32BE;
74
- var readUInt32LE = (input, offset = 0) => input[offset] + 256 * input[offset + 1] + 65536 * input[offset + 2] + input[offset + 3] * 2 ** 24;
75
- exports2.readUInt32LE = readUInt32LE;
76
- var methods = {
77
- readUInt16BE: exports2.readUInt16BE,
78
- readUInt16LE: exports2.readUInt16LE,
79
- readUInt32BE: exports2.readUInt32BE,
80
- readUInt32LE: exports2.readUInt32LE
81
- };
82
- function readUInt(input, bits, offset, isBigEndian) {
83
- offset = offset || 0;
84
- const endian = isBigEndian ? "BE" : "LE";
85
- const methodName = "readUInt" + bits + endian;
86
- return methods[methodName](input, offset);
87
- }
88
- exports2.readUInt = readUInt;
89
- function readBox(buffer, offset) {
90
- if (buffer.length - offset < 4) {
91
- return;
92
- }
93
- const boxSize = (0, exports2.readUInt32BE)(buffer, offset);
94
- if (buffer.length - offset < boxSize) {
95
- return;
96
- }
97
- return {
98
- name: (0, exports2.toUTF8String)(buffer, 4 + offset, 8 + offset),
99
- offset: offset,
100
- size: boxSize
101
- };
102
- }
103
- function findBox(buffer, boxName, offset) {
104
- while (offset < buffer.length) {
105
- const box = readBox(buffer, offset);
106
- if (!box) {
107
- break;
108
- }
109
- if (box.name === boxName) {
110
- return box;
111
- }
112
- offset += box.size;
113
- }
114
- }
115
- exports2.findBox = findBox;
116
- }
117
- });
118
- var require_bmp = __commonJS({
119
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/bmp.js"(exports2) {
120
- Object.defineProperty(exports2, "__esModule", {
121
- value: true
122
- });
123
- exports2.BMP = void 0;
124
- var utils_1 = require_utils();
125
- exports2.BMP = {
126
- validate: input => "BM" === (0, utils_1.toUTF8String)(input, 0, 2),
127
- calculate: input => ({
128
- height: Math.abs((0, utils_1.readInt32LE)(input, 22)),
129
- width: (0, utils_1.readUInt32LE)(input, 18)
130
- })
131
- };
132
- }
133
- });
134
- var require_ico = __commonJS({
135
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/ico.js"(exports2) {
136
- Object.defineProperty(exports2, "__esModule", {
137
- value: true
138
- });
139
- exports2.ICO = void 0;
140
- var utils_1 = require_utils();
141
- var TYPE_ICON = 1;
142
- var SIZE_HEADER = 6;
143
- var SIZE_IMAGE_ENTRY = 16;
144
- function getSizeFromOffset(input, offset) {
145
- const value = input[offset];
146
- return 0 === value ? 256 : value;
147
- }
148
- function getImageSize(input, imageIndex) {
149
- const offset = SIZE_HEADER + imageIndex * SIZE_IMAGE_ENTRY;
150
- return {
151
- height: getSizeFromOffset(input, offset + 1),
152
- width: getSizeFromOffset(input, offset)
153
- };
154
- }
155
- exports2.ICO = {
156
- validate(input) {
157
- const reserved = (0, utils_1.readUInt16LE)(input, 0);
158
- const imageCount = (0, utils_1.readUInt16LE)(input, 4);
159
- if (0 !== reserved || 0 === imageCount) {
160
- return false;
161
- }
162
- const imageType = (0, utils_1.readUInt16LE)(input, 2);
163
- return imageType === TYPE_ICON;
164
- },
165
- calculate(input) {
166
- const nbImages = (0, utils_1.readUInt16LE)(input, 4);
167
- const imageSize = getImageSize(input, 0);
168
- if (1 === nbImages) {
169
- return imageSize;
170
- }
171
- const imgs = [ imageSize ];
172
- for (let imageIndex = 1; imageIndex < nbImages; imageIndex += 1) {
173
- imgs.push(getImageSize(input, imageIndex));
174
- }
175
- return {
176
- height: imageSize.height,
177
- images: imgs,
178
- width: imageSize.width
179
- };
180
- }
181
- };
182
- }
183
- });
184
- var require_cur = __commonJS({
185
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/cur.js"(exports2) {
186
- Object.defineProperty(exports2, "__esModule", {
187
- value: true
188
- });
189
- exports2.CUR = void 0;
190
- var ico_12 = require_ico();
191
- var utils_1 = require_utils();
192
- var TYPE_CURSOR = 2;
193
- exports2.CUR = {
194
- validate(input) {
195
- const reserved = (0, utils_1.readUInt16LE)(input, 0);
196
- const imageCount = (0, utils_1.readUInt16LE)(input, 4);
197
- if (0 !== reserved || 0 === imageCount) {
198
- return false;
199
- }
200
- const imageType = (0, utils_1.readUInt16LE)(input, 2);
201
- return imageType === TYPE_CURSOR;
202
- },
203
- calculate: input => ico_12.ICO.calculate(input)
204
- };
205
- }
206
- });
207
- var require_dds = __commonJS({
208
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/dds.js"(exports2) {
209
- Object.defineProperty(exports2, "__esModule", {
210
- value: true
211
- });
212
- exports2.DDS = void 0;
213
- var utils_1 = require_utils();
214
- exports2.DDS = {
215
- validate: input => 542327876 === (0, utils_1.readUInt32LE)(input, 0),
216
- calculate: input => ({
217
- height: (0, utils_1.readUInt32LE)(input, 12),
218
- width: (0, utils_1.readUInt32LE)(input, 16)
219
- })
220
- };
221
- }
222
- });
223
- var require_gif = __commonJS({
224
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/gif.js"(exports2) {
225
- Object.defineProperty(exports2, "__esModule", {
226
- value: true
227
- });
228
- exports2.GIF = void 0;
229
- var utils_1 = require_utils();
230
- var gifRegexp = /^GIF8[79]a/;
231
- exports2.GIF = {
232
- validate: input => gifRegexp.test((0, utils_1.toUTF8String)(input, 0, 6)),
233
- calculate: input => ({
234
- height: (0, utils_1.readUInt16LE)(input, 8),
235
- width: (0, utils_1.readUInt16LE)(input, 6)
236
- })
237
- };
238
- }
239
- });
240
- var require_icns = __commonJS({
241
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/icns.js"(exports2) {
242
- Object.defineProperty(exports2, "__esModule", {
243
- value: true
244
- });
245
- exports2.ICNS = void 0;
246
- var utils_1 = require_utils();
247
- var SIZE_HEADER = 8;
248
- var FILE_LENGTH_OFFSET = 4;
249
- var ENTRY_LENGTH_OFFSET = 4;
250
- var ICON_TYPE_SIZE = {
251
- ICON: 32,
252
- "ICN#": 32,
253
- "icm#": 16,
254
- icm4: 16,
255
- icm8: 16,
256
- "ics#": 16,
257
- ics4: 16,
258
- ics8: 16,
259
- is32: 16,
260
- s8mk: 16,
261
- icp4: 16,
262
- icl4: 32,
263
- icl8: 32,
264
- il32: 32,
265
- l8mk: 32,
266
- icp5: 32,
267
- ic11: 32,
268
- ich4: 48,
269
- ich8: 48,
270
- ih32: 48,
271
- h8mk: 48,
272
- icp6: 64,
273
- ic12: 32,
274
- it32: 128,
275
- t8mk: 128,
276
- ic07: 128,
277
- ic08: 256,
278
- ic13: 256,
279
- ic09: 512,
280
- ic14: 512,
281
- ic10: 1024
282
- };
283
- function readImageHeader(input, imageOffset) {
284
- const imageLengthOffset = imageOffset + ENTRY_LENGTH_OFFSET;
285
- return [ (0, utils_1.toUTF8String)(input, imageOffset, imageLengthOffset), (0, utils_1.readUInt32BE)(input, imageLengthOffset) ];
286
- }
287
- function getImageSize(type) {
288
- const size = ICON_TYPE_SIZE[type];
289
- return {
290
- width: size,
291
- height: size,
292
- type: type
293
- };
294
- }
295
- exports2.ICNS = {
296
- validate: input => "icns" === (0, utils_1.toUTF8String)(input, 0, 4),
297
- calculate(input) {
298
- const inputLength = input.length;
299
- const fileLength = (0, utils_1.readUInt32BE)(input, FILE_LENGTH_OFFSET);
300
- let imageOffset = SIZE_HEADER;
301
- let imageHeader = readImageHeader(input, imageOffset);
302
- let imageSize = getImageSize(imageHeader[0]);
303
- imageOffset += imageHeader[1];
304
- if (imageOffset === fileLength) {
305
- return imageSize;
306
- }
307
- const result = {
308
- height: imageSize.height,
309
- images: [ imageSize ],
310
- width: imageSize.width
311
- };
312
- while (imageOffset < fileLength && imageOffset < inputLength) {
313
- imageHeader = readImageHeader(input, imageOffset);
314
- imageSize = getImageSize(imageHeader[0]);
315
- imageOffset += imageHeader[1];
316
- result.images.push(imageSize);
317
- }
318
- return result;
319
- }
320
- };
321
- }
322
- });
323
- var require_j2c = __commonJS({
324
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/j2c.js"(exports2) {
325
- Object.defineProperty(exports2, "__esModule", {
326
- value: true
327
- });
328
- exports2.J2C = void 0;
329
- var utils_1 = require_utils();
330
- exports2.J2C = {
331
- validate: input => "ff4fff51" === (0, utils_1.toHexString)(input, 0, 4),
332
- calculate: input => ({
333
- height: (0, utils_1.readUInt32BE)(input, 12),
334
- width: (0, utils_1.readUInt32BE)(input, 8)
335
- })
336
- };
337
- }
338
- });
339
- var require_jp2 = __commonJS({
340
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/jp2.js"(exports2) {
341
- Object.defineProperty(exports2, "__esModule", {
342
- value: true
343
- });
344
- exports2.JP2 = void 0;
345
- var utils_1 = require_utils();
346
- exports2.JP2 = {
347
- validate(input) {
348
- if (1783636e3 !== (0, utils_1.readUInt32BE)(input, 4) || (0, utils_1.readUInt32BE)(input, 0) < 1) {
349
- return false;
350
- }
351
- const ftypBox = (0, utils_1.findBox)(input, "ftyp", 0);
352
- if (!ftypBox) {
353
- return false;
354
- }
355
- return 1718909296 === (0, utils_1.readUInt32BE)(input, ftypBox.offset + 4);
356
- },
357
- calculate(input) {
358
- const jp2hBox = (0, utils_1.findBox)(input, "jp2h", 0);
359
- const ihdrBox = jp2hBox && (0, utils_1.findBox)(input, "ihdr", jp2hBox.offset + 8);
360
- if (ihdrBox) {
361
- return {
362
- height: (0, utils_1.readUInt32BE)(input, ihdrBox.offset + 8),
363
- width: (0, utils_1.readUInt32BE)(input, ihdrBox.offset + 12)
364
- };
365
- }
366
- throw new TypeError("Unsupported JPEG 2000 format");
367
- }
368
- };
369
- }
370
- });
371
- var require_jpg = __commonJS({
372
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/jpg.js"(exports2) {
373
- Object.defineProperty(exports2, "__esModule", {
374
- value: true
375
- });
376
- exports2.JPG = void 0;
377
- var utils_1 = require_utils();
378
- var EXIF_MARKER = "45786966";
379
- var APP1_DATA_SIZE_BYTES = 2;
380
- var EXIF_HEADER_BYTES = 6;
381
- var TIFF_BYTE_ALIGN_BYTES = 2;
382
- var BIG_ENDIAN_BYTE_ALIGN = "4d4d";
383
- var LITTLE_ENDIAN_BYTE_ALIGN = "4949";
384
- var IDF_ENTRY_BYTES = 12;
385
- var NUM_DIRECTORY_ENTRIES_BYTES = 2;
386
- function isEXIF(input) {
387
- return (0, utils_1.toHexString)(input, 2, 6) === EXIF_MARKER;
388
- }
389
- function extractSize(input, index) {
390
- return {
391
- height: (0, utils_1.readUInt16BE)(input, index),
392
- width: (0, utils_1.readUInt16BE)(input, index + 2)
393
- };
394
- }
395
- function extractOrientation(exifBlock, isBigEndian) {
396
- const idfOffset = 8;
397
- const offset = EXIF_HEADER_BYTES + idfOffset;
398
- const idfDirectoryEntries = (0, utils_1.readUInt)(exifBlock, 16, offset, isBigEndian);
399
- for (let directoryEntryNumber = 0; directoryEntryNumber < idfDirectoryEntries; directoryEntryNumber++) {
400
- const start = offset + NUM_DIRECTORY_ENTRIES_BYTES + directoryEntryNumber * IDF_ENTRY_BYTES;
401
- const end = start + IDF_ENTRY_BYTES;
402
- if (start > exifBlock.length) {
403
- return;
404
- }
405
- const block = exifBlock.slice(start, end);
406
- const tagNumber = (0, utils_1.readUInt)(block, 16, 0, isBigEndian);
407
- if (274 === tagNumber) {
408
- const dataFormat = (0, utils_1.readUInt)(block, 16, 2, isBigEndian);
409
- if (3 !== dataFormat) {
410
- return;
411
- }
412
- const numberOfComponents = (0, utils_1.readUInt)(block, 32, 4, isBigEndian);
413
- if (1 !== numberOfComponents) {
414
- return;
415
- }
416
- return (0, utils_1.readUInt)(block, 16, 8, isBigEndian);
417
- }
418
- }
419
- }
420
- function validateExifBlock(input, index) {
421
- const exifBlock = input.slice(APP1_DATA_SIZE_BYTES, index);
422
- const byteAlign = (0, utils_1.toHexString)(exifBlock, EXIF_HEADER_BYTES, EXIF_HEADER_BYTES + TIFF_BYTE_ALIGN_BYTES);
423
- const isBigEndian = byteAlign === BIG_ENDIAN_BYTE_ALIGN;
424
- const isLittleEndian = byteAlign === LITTLE_ENDIAN_BYTE_ALIGN;
425
- if (isBigEndian || isLittleEndian) {
426
- return extractOrientation(exifBlock, isBigEndian);
427
- }
428
- }
429
- function validateInput(input, index) {
430
- if (index > input.length) {
431
- throw new TypeError("Corrupt JPG, exceeded buffer limits");
432
- }
433
- }
434
- exports2.JPG = {
435
- validate: input => "ffd8" === (0, utils_1.toHexString)(input, 0, 2),
436
- calculate(input) {
437
- input = input.slice(4);
438
- let orientation;
439
- let next;
440
- while (input.length) {
441
- const i = (0, utils_1.readUInt16BE)(input, 0);
442
- if (255 !== input[i]) {
443
- input = input.slice(1);
444
- continue;
445
- }
446
- isEXIF(input) && (orientation = validateExifBlock(input, i));
447
- validateInput(input, i);
448
- next = input[i + 1];
449
- if (192 === next || 193 === next || 194 === next) {
450
- const size = extractSize(input, i + 5);
451
- if (!orientation) {
452
- return size;
453
- }
454
- return {
455
- height: size.height,
456
- orientation: orientation,
457
- width: size.width
458
- };
459
- }
460
- input = input.slice(i + 2);
461
- }
462
- throw new TypeError("Invalid JPG, no size found");
463
- }
464
- };
465
- }
466
- });
467
- var require_ktx = __commonJS({
468
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/ktx.js"(exports2) {
469
- Object.defineProperty(exports2, "__esModule", {
470
- value: true
471
- });
472
- exports2.KTX = void 0;
473
- var utils_1 = require_utils();
474
- exports2.KTX = {
475
- validate: input => {
476
- const signature = (0, utils_1.toUTF8String)(input, 1, 7);
477
- return [ "KTX 11", "KTX 20" ].includes(signature);
478
- },
479
- calculate: input => {
480
- const type = 49 === input[5] ? "ktx" : "ktx2";
481
- const offset = "ktx" === type ? 36 : 20;
482
- return {
483
- height: (0, utils_1.readUInt32LE)(input, offset + 4),
484
- width: (0, utils_1.readUInt32LE)(input, offset),
485
- type: type
486
- };
487
- }
488
- };
489
- }
490
- });
491
- var require_png = __commonJS({
492
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/png.js"(exports2) {
493
- Object.defineProperty(exports2, "__esModule", {
494
- value: true
495
- });
496
- exports2.PNG = void 0;
497
- var utils_1 = require_utils();
498
- var pngSignature = "PNG\r\n\n";
499
- var pngImageHeaderChunkName = "IHDR";
500
- var pngFriedChunkName = "CgBI";
501
- exports2.PNG = {
502
- validate(input) {
503
- if (pngSignature === (0, utils_1.toUTF8String)(input, 1, 8)) {
504
- let chunkName = (0, utils_1.toUTF8String)(input, 12, 16);
505
- chunkName === pngFriedChunkName && (chunkName = (0, utils_1.toUTF8String)(input, 28, 32));
506
- if (chunkName !== pngImageHeaderChunkName) {
507
- throw new TypeError("Invalid PNG");
508
- }
509
- return true;
510
- }
511
- return false;
512
- },
513
- calculate(input) {
514
- if ((0, utils_1.toUTF8String)(input, 12, 16) === pngFriedChunkName) {
515
- return {
516
- height: (0, utils_1.readUInt32BE)(input, 36),
517
- width: (0, utils_1.readUInt32BE)(input, 32)
518
- };
519
- }
520
- return {
521
- height: (0, utils_1.readUInt32BE)(input, 20),
522
- width: (0, utils_1.readUInt32BE)(input, 16)
523
- };
524
- }
525
- };
526
- }
527
- });
528
- var require_pnm = __commonJS({
529
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/pnm.js"(exports2) {
530
- Object.defineProperty(exports2, "__esModule", {
531
- value: true
532
- });
533
- exports2.PNM = void 0;
534
- var utils_1 = require_utils();
535
- var PNMTypes = {
536
- P1: "pbm/ascii",
537
- P2: "pgm/ascii",
538
- P3: "ppm/ascii",
539
- P4: "pbm",
540
- P5: "pgm",
541
- P6: "ppm",
542
- P7: "pam",
543
- PF: "pfm"
544
- };
545
- var handlers = {
546
- default: lines => {
547
- let dimensions = [];
548
- while (lines.length > 0) {
549
- const line = lines.shift();
550
- if ("#" === line[0]) {
551
- continue;
552
- }
553
- dimensions = line.split(" ");
554
- break;
555
- }
556
- if (2 === dimensions.length) {
557
- return {
558
- height: parseInt(dimensions[1], 10),
559
- width: parseInt(dimensions[0], 10)
560
- };
561
- }
562
- throw new TypeError("Invalid PNM");
563
- },
564
- pam: lines => {
565
- const size = {};
566
- while (lines.length > 0) {
567
- const line = lines.shift();
568
- if (line.length > 16 || line.charCodeAt(0) > 128) {
569
- continue;
570
- }
571
- const [key, value] = line.split(" ");
572
- key && value && (size[key.toLowerCase()] = parseInt(value, 10));
573
- if (size.height && size.width) {
574
- break;
575
- }
576
- }
577
- if (size.height && size.width) {
578
- return {
579
- height: size.height,
580
- width: size.width
581
- };
582
- }
583
- throw new TypeError("Invalid PAM");
584
- }
585
- };
586
- exports2.PNM = {
587
- validate: input => (0, utils_1.toUTF8String)(input, 0, 2) in PNMTypes,
588
- calculate(input) {
589
- const signature = (0, utils_1.toUTF8String)(input, 0, 2);
590
- const type = PNMTypes[signature];
591
- const lines = (0, utils_1.toUTF8String)(input, 3).split(/[\r\n]+/);
592
- const handler = handlers[type] || handlers.default;
593
- return handler(lines);
594
- }
595
- };
596
- }
597
- });
598
- var require_psd = __commonJS({
599
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/psd.js"(exports2) {
600
- Object.defineProperty(exports2, "__esModule", {
601
- value: true
602
- });
603
- exports2.PSD = void 0;
604
- var utils_1 = require_utils();
605
- exports2.PSD = {
606
- validate: input => "8BPS" === (0, utils_1.toUTF8String)(input, 0, 4),
607
- calculate: input => ({
608
- height: (0, utils_1.readUInt32BE)(input, 14),
609
- width: (0, utils_1.readUInt32BE)(input, 18)
610
- })
611
- };
612
- }
613
- });
614
- var require_svg = __commonJS({
615
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/svg.js"(exports2) {
616
- Object.defineProperty(exports2, "__esModule", {
617
- value: true
618
- });
619
- exports2.SVG = void 0;
620
- var utils_1 = require_utils();
621
- var svgReg = /<svg\s([^>"']|"[^"]*"|'[^']*')*>/;
622
- var extractorRegExps = {
623
- height: /\sheight=(['"])([^%]+?)\1/,
624
- root: svgReg,
625
- viewbox: /\sviewBox=(['"])(.+?)\1/i,
626
- width: /\swidth=(['"])([^%]+?)\1/
627
- };
628
- var INCH_CM = 2.54;
629
- var units = {
630
- in: 96,
631
- cm: 96 / INCH_CM,
632
- em: 16,
633
- ex: 8,
634
- m: 96 / INCH_CM * 100,
635
- mm: 96 / INCH_CM / 10,
636
- pc: 96 / 72 / 12,
637
- pt: 96 / 72,
638
- px: 1
639
- };
640
- var unitsReg = new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$`);
641
- function parseLength(len) {
642
- const m = unitsReg.exec(len);
643
- if (!m) {
644
- return;
645
- }
646
- return Math.round(Number(m[1]) * (units[m[2]] || 1));
647
- }
648
- function parseViewbox(viewbox) {
649
- const bounds = viewbox.split(" ");
650
- return {
651
- height: parseLength(bounds[3]),
652
- width: parseLength(bounds[2])
653
- };
654
- }
655
- function parseAttributes(root) {
656
- const width = root.match(extractorRegExps.width);
657
- const height = root.match(extractorRegExps.height);
658
- const viewbox = root.match(extractorRegExps.viewbox);
659
- return {
660
- height: height && parseLength(height[2]),
661
- viewbox: viewbox && parseViewbox(viewbox[2]),
662
- width: width && parseLength(width[2])
663
- };
664
- }
665
- function calculateByDimensions(attrs) {
666
- return {
667
- height: attrs.height,
668
- width: attrs.width
669
- };
670
- }
671
- function calculateByViewbox(attrs, viewbox) {
672
- const ratio = viewbox.width / viewbox.height;
673
- if (attrs.width) {
674
- return {
675
- height: Math.floor(attrs.width / ratio),
676
- width: attrs.width
677
- };
678
- }
679
- if (attrs.height) {
680
- return {
681
- height: attrs.height,
682
- width: Math.floor(attrs.height * ratio)
683
- };
684
- }
685
- return {
686
- height: viewbox.height,
687
- width: viewbox.width
688
- };
689
- }
690
- exports2.SVG = {
691
- validate: input => svgReg.test((0, utils_1.toUTF8String)(input, 0, 1e3)),
692
- calculate(input) {
693
- const root = (0, utils_1.toUTF8String)(input).match(extractorRegExps.root);
694
- if (root) {
695
- const attrs = parseAttributes(root[0]);
696
- if (attrs.width && attrs.height) {
697
- return calculateByDimensions(attrs);
698
- }
699
- if (attrs.viewbox) {
700
- return calculateByViewbox(attrs, attrs.viewbox);
701
- }
702
- }
703
- throw new TypeError("Invalid SVG");
704
- }
705
- };
706
- }
707
- });
708
- var require_tga = __commonJS({
709
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/tga.js"(exports2) {
710
- Object.defineProperty(exports2, "__esModule", {
711
- value: true
712
- });
713
- exports2.TGA = void 0;
714
- var utils_1 = require_utils();
715
- exports2.TGA = {
716
- validate: input => 0 === (0, utils_1.readUInt16LE)(input, 0) && 0 === (0, utils_1.readUInt16LE)(input, 4),
717
- calculate: input => ({
718
- height: (0, utils_1.readUInt16LE)(input, 14),
719
- width: (0, utils_1.readUInt16LE)(input, 12)
720
- })
721
- };
722
- }
723
- });
724
- var require_webp = __commonJS({
725
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/webp.js"(exports2) {
726
- Object.defineProperty(exports2, "__esModule", {
727
- value: true
728
- });
729
- exports2.WEBP = void 0;
730
- var utils_1 = require_utils();
731
- function calculateExtended(input) {
732
- return {
733
- height: 1 + (0, utils_1.readUInt24LE)(input, 7),
734
- width: 1 + (0, utils_1.readUInt24LE)(input, 4)
735
- };
736
- }
737
- function calculateLossless(input) {
738
- return {
739
- height: 1 + ((15 & input[4]) << 10 | input[3] << 2 | (192 & input[2]) >> 6),
740
- width: 1 + ((63 & input[2]) << 8 | input[1])
741
- };
742
- }
743
- function calculateLossy(input) {
744
- return {
745
- height: 16383 & (0, utils_1.readInt16LE)(input, 8),
746
- width: 16383 & (0, utils_1.readInt16LE)(input, 6)
747
- };
748
- }
749
- exports2.WEBP = {
750
- validate(input) {
751
- const riffHeader = "RIFF" === (0, utils_1.toUTF8String)(input, 0, 4);
752
- const webpHeader = "WEBP" === (0, utils_1.toUTF8String)(input, 8, 12);
753
- const vp8Header = "VP8" === (0, utils_1.toUTF8String)(input, 12, 15);
754
- return riffHeader && webpHeader && vp8Header;
755
- },
756
- calculate(input) {
757
- const chunkHeader = (0, utils_1.toUTF8String)(input, 12, 16);
758
- input = input.slice(20, 30);
759
- if ("VP8X" === chunkHeader) {
760
- const extendedHeader = input[0];
761
- const validStart = 0 === (192 & extendedHeader);
762
- const validEnd = 0 === (1 & extendedHeader);
763
- if (validStart && validEnd) {
764
- return calculateExtended(input);
765
- }
766
- throw new TypeError("Invalid WebP");
767
- }
768
- if ("VP8 " === chunkHeader && 47 !== input[0]) {
769
- return calculateLossy(input);
770
- }
771
- const signature = (0, utils_1.toHexString)(input, 3, 6);
772
- if ("VP8L" === chunkHeader && "9d012a" !== signature) {
773
- return calculateLossless(input);
774
- }
775
- throw new TypeError("Invalid WebP");
776
- }
777
- };
778
- }
779
- });
780
- var require_heif = __commonJS({
781
- "node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/heif.js"(exports2) {
782
- Object.defineProperty(exports2, "__esModule", {
783
- value: true
784
- });
785
- exports2.HEIF = void 0;
786
- var utils_1 = require_utils();
787
- var brandMap = {
788
- avif: "avif",
789
- mif1: "heif",
790
- msf1: "heif",
791
- heic: "heic",
792
- heix: "heic",
793
- hevc: "heic",
794
- hevx: "heic"
795
- };
796
- exports2.HEIF = {
797
- validate(buffer) {
798
- const ftype = (0, utils_1.toUTF8String)(buffer, 4, 8);
799
- const brand = (0, utils_1.toUTF8String)(buffer, 8, 12);
800
- return "ftyp" === ftype && brand in brandMap;
801
- },
802
- calculate(buffer) {
803
- const metaBox = (0, utils_1.findBox)(buffer, "meta", 0);
804
- const iprpBox = metaBox && (0, utils_1.findBox)(buffer, "iprp", metaBox.offset + 12);
805
- const ipcoBox = iprpBox && (0, utils_1.findBox)(buffer, "ipco", iprpBox.offset + 8);
806
- const ispeBox = ipcoBox && (0, utils_1.findBox)(buffer, "ispe", ipcoBox.offset + 8);
807
- if (ispeBox) {
808
- return {
809
- height: (0, utils_1.readUInt32BE)(buffer, ispeBox.offset + 16),
810
- width: (0, utils_1.readUInt32BE)(buffer, ispeBox.offset + 12),
811
- type: (0, utils_1.toUTF8String)(buffer, 8, 12)
812
- };
813
- }
814
- throw new TypeError("Invalid HEIF, no size found");
815
- }
816
- };
817
- }
818
- });
819
- var index_exports = {};
820
- __export(index_exports, {
821
- createOptimizer: () => createOptimizer,
822
- qwikRollup: () => qwikRollup,
823
- qwikVite: () => qwikVite,
824
- symbolMapper: () => symbolMapper,
825
- versions: () => versions
826
- });
827
- module.exports = __toCommonJS(index_exports);
828
- function createPath(opts = {}) {
829
- function assertPath(path) {
830
- if ("string" !== typeof path) {
831
- throw new TypeError("Path must be a string. Received " + JSON.stringify(path));
832
- }
833
- }
834
- function normalizeStringPosix(path, allowAboveRoot) {
835
- let res = "";
836
- let lastSegmentLength = 0;
837
- let lastSlash = -1;
838
- let dots = 0;
839
- let code;
840
- for (let i = 0; i <= path.length; ++i) {
841
- if (i < path.length) {
842
- code = path.charCodeAt(i);
843
- } else {
844
- if (47 === code) {
845
- break;
846
- }
847
- code = 47;
848
- }
849
- if (47 === code) {
850
- if (lastSlash === i - 1 || 1 === dots) {} else if (lastSlash !== i - 1 && 2 === dots) {
851
- if (res.length < 2 || 2 !== lastSegmentLength || 46 !== res.charCodeAt(res.length - 1) || 46 !== res.charCodeAt(res.length - 2)) {
852
- if (res.length > 2) {
853
- const lastSlashIndex = res.lastIndexOf("/");
854
- if (lastSlashIndex !== res.length - 1) {
855
- if (-1 === lastSlashIndex) {
856
- res = "";
857
- lastSegmentLength = 0;
858
- } else {
859
- res = res.slice(0, lastSlashIndex);
860
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
861
- }
862
- lastSlash = i;
863
- dots = 0;
864
- continue;
865
- }
866
- } else if (2 === res.length || 1 === res.length) {
867
- res = "";
868
- lastSegmentLength = 0;
869
- lastSlash = i;
870
- dots = 0;
871
- continue;
872
- }
873
- }
874
- if (allowAboveRoot) {
875
- res.length > 0 ? res += "/.." : res = "..";
876
- lastSegmentLength = 2;
877
- }
878
- } else {
879
- res.length > 0 ? res += "/" + path.slice(lastSlash + 1, i) : res = path.slice(lastSlash + 1, i);
880
- lastSegmentLength = i - lastSlash - 1;
881
- }
882
- lastSlash = i;
883
- dots = 0;
884
- } else {
885
- 46 === code && -1 !== dots ? ++dots : dots = -1;
886
- }
887
- }
888
- return res;
889
- }
890
- function _format(sep2, pathObject) {
891
- const dir = pathObject.dir || pathObject.root;
892
- const base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
893
- if (!dir) {
894
- return base;
895
- }
896
- if (dir === pathObject.root) {
897
- return dir + base;
898
- }
899
- return dir + sep2 + base;
900
- }
901
- const resolve = function(...paths) {
902
- let resolvedPath = "";
903
- let resolvedAbsolute = false;
904
- let cwd;
905
- for (let i = paths.length - 1; i >= -1 && !resolvedAbsolute; i--) {
906
- let path;
907
- if (i >= 0) {
908
- path = paths[i];
909
- } else {
910
- void 0 === cwd && (cwd = opts && "function" === typeof opts.cwd ? opts.cwd() : "undefined" !== typeof process && "function" === typeof process.cwd ? process.cwd() : "/");
911
- path = cwd;
912
- }
913
- assertPath(path);
914
- if (0 === path.length) {
915
- continue;
916
- }
917
- resolvedPath = path + "/" + resolvedPath;
918
- resolvedAbsolute = 47 === path.charCodeAt(0);
919
- }
920
- resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
921
- return resolvedAbsolute ? resolvedPath.length > 0 ? "/" + resolvedPath : "/" : resolvedPath.length > 0 ? resolvedPath : ".";
922
- };
923
- const normalize = function(path) {
924
- assertPath(path);
925
- if (0 === path.length) {
926
- return ".";
927
- }
928
- const isAbsolute2 = 47 === path.charCodeAt(0);
929
- const trailingSeparator = 47 === path.charCodeAt(path.length - 1);
930
- path = normalizeStringPosix(path, !isAbsolute2);
931
- 0 !== path.length || isAbsolute2 || (path = ".");
932
- path.length > 0 && trailingSeparator && (path += "/");
933
- if (isAbsolute2) {
934
- return "/" + path;
935
- }
936
- return path;
937
- };
938
- const isAbsolute = function(path) {
939
- assertPath(path);
940
- return path.length > 0 && 47 === path.charCodeAt(0);
941
- };
942
- const join = function(...paths) {
943
- if (0 === paths.length) {
944
- return ".";
945
- }
946
- let joined;
947
- for (let i = 0; i < paths.length; ++i) {
948
- const arg = paths[i];
949
- assertPath(arg);
950
- arg.length > 0 && (void 0 === joined ? joined = arg : joined += "/" + arg);
951
- }
952
- if (void 0 === joined) {
953
- return ".";
954
- }
955
- return normalize(joined);
956
- };
957
- const relative = function(from, to) {
958
- assertPath(from);
959
- assertPath(to);
960
- if (from === to) {
961
- return "";
962
- }
963
- from = resolve(from);
964
- to = resolve(to);
965
- if (from === to) {
966
- return "";
967
- }
968
- let fromStart = 1;
969
- for (;fromStart < from.length; ++fromStart) {
970
- if (47 !== from.charCodeAt(fromStart)) {
971
- break;
972
- }
973
- }
974
- const fromEnd = from.length;
975
- const fromLen = fromEnd - fromStart;
976
- let toStart = 1;
977
- for (;toStart < to.length; ++toStart) {
978
- if (47 !== to.charCodeAt(toStart)) {
979
- break;
980
- }
981
- }
982
- const toEnd = to.length;
983
- const toLen = toEnd - toStart;
984
- const length = fromLen < toLen ? fromLen : toLen;
985
- let lastCommonSep = -1;
986
- let i = 0;
987
- for (;i <= length; ++i) {
988
- if (i === length) {
989
- if (toLen > length) {
990
- if (47 === to.charCodeAt(toStart + i)) {
991
- return to.slice(toStart + i + 1);
992
- }
993
- if (0 === i) {
994
- return to.slice(toStart + i);
995
- }
996
- } else {
997
- fromLen > length && (47 === from.charCodeAt(fromStart + i) ? lastCommonSep = i : 0 === i && (lastCommonSep = 0));
998
- }
999
- break;
1000
- }
1001
- const fromCode = from.charCodeAt(fromStart + i);
1002
- const toCode = to.charCodeAt(toStart + i);
1003
- if (fromCode !== toCode) {
1004
- break;
1005
- }
1006
- 47 === fromCode && (lastCommonSep = i);
1007
- }
1008
- let out = "";
1009
- for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
1010
- i !== fromEnd && 47 !== from.charCodeAt(i) || (0 === out.length ? out += ".." : out += "/..");
1011
- }
1012
- if (out.length > 0) {
1013
- return out + to.slice(toStart + lastCommonSep);
1014
- }
1015
- toStart += lastCommonSep;
1016
- 47 === to.charCodeAt(toStart) && ++toStart;
1017
- return to.slice(toStart);
1018
- };
1019
- const dirname = function(path) {
1020
- assertPath(path);
1021
- if (0 === path.length) {
1022
- return ".";
1023
- }
1024
- let code = path.charCodeAt(0);
1025
- const hasRoot = 47 === code;
1026
- let end = -1;
1027
- let matchedSlash = true;
1028
- for (let i = path.length - 1; i >= 1; --i) {
1029
- code = path.charCodeAt(i);
1030
- if (47 === code) {
1031
- if (!matchedSlash) {
1032
- end = i;
1033
- break;
1034
- }
1035
- } else {
1036
- matchedSlash = false;
1037
- }
1038
- }
1039
- if (-1 === end) {
1040
- return hasRoot ? "/" : ".";
1041
- }
1042
- if (hasRoot && 1 === end) {
1043
- return "//";
1044
- }
1045
- return path.slice(0, end);
1046
- };
1047
- const basename = function(path, ext) {
1048
- if (void 0 !== ext && "string" !== typeof ext) {
1049
- throw new TypeError('"ext" argument must be a string');
1050
- }
1051
- assertPath(path);
1052
- let start = 0;
1053
- let end = -1;
1054
- let matchedSlash = true;
1055
- let i;
1056
- if (void 0 !== ext && ext.length > 0 && ext.length <= path.length) {
1057
- if (ext.length === path.length && ext === path) {
1058
- return "";
1059
- }
1060
- let extIdx = ext.length - 1;
1061
- let firstNonSlashEnd = -1;
1062
- for (i = path.length - 1; i >= 0; --i) {
1063
- const code = path.charCodeAt(i);
1064
- if (47 === code) {
1065
- if (!matchedSlash) {
1066
- start = i + 1;
1067
- break;
1068
- }
1069
- } else {
1070
- if (-1 === firstNonSlashEnd) {
1071
- matchedSlash = false;
1072
- firstNonSlashEnd = i + 1;
1073
- }
1074
- if (extIdx >= 0) {
1075
- if (code === ext.charCodeAt(extIdx)) {
1076
- -1 === --extIdx && (end = i);
1077
- } else {
1078
- extIdx = -1;
1079
- end = firstNonSlashEnd;
1080
- }
1081
- }
1082
- }
1083
- }
1084
- start === end ? end = firstNonSlashEnd : -1 === end && (end = path.length);
1085
- return path.slice(start, end);
1086
- }
1087
- for (i = path.length - 1; i >= 0; --i) {
1088
- if (47 === path.charCodeAt(i)) {
1089
- if (!matchedSlash) {
1090
- start = i + 1;
1091
- break;
1092
- }
1093
- } else if (-1 === end) {
1094
- matchedSlash = false;
1095
- end = i + 1;
1096
- }
1097
- }
1098
- if (-1 === end) {
1099
- return "";
1100
- }
1101
- return path.slice(start, end);
1102
- };
1103
- const extname = function(path) {
1104
- assertPath(path);
1105
- let startDot = -1;
1106
- let startPart = 0;
1107
- let end = -1;
1108
- let matchedSlash = true;
1109
- let preDotState = 0;
1110
- for (let i = path.length - 1; i >= 0; --i) {
1111
- const code = path.charCodeAt(i);
1112
- if (47 === code) {
1113
- if (!matchedSlash) {
1114
- startPart = i + 1;
1115
- break;
1116
- }
1117
- continue;
1118
- }
1119
- if (-1 === end) {
1120
- matchedSlash = false;
1121
- end = i + 1;
1122
- }
1123
- 46 === code ? -1 === startDot ? startDot = i : 1 !== preDotState && (preDotState = 1) : -1 !== startDot && (preDotState = -1);
1124
- }
1125
- if (-1 === startDot || -1 === end || 0 === preDotState || 1 === preDotState && startDot === end - 1 && startDot === startPart + 1) {
1126
- return "";
1127
- }
1128
- return path.slice(startDot, end);
1129
- };
1130
- const format = function(pathObject) {
1131
- if (null === pathObject || "object" !== typeof pathObject) {
1132
- throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
1133
- }
1134
- return _format("/", pathObject);
1135
- };
1136
- const parse = function(path) {
1137
- assertPath(path);
1138
- const ret = {
1139
- root: "",
1140
- dir: "",
1141
- base: "",
1142
- ext: "",
1143
- name: ""
1144
- };
1145
- if (0 === path.length) {
1146
- return ret;
1147
- }
1148
- let code = path.charCodeAt(0);
1149
- let start;
1150
- const isAbsolute2 = 47 === code;
1151
- if (isAbsolute2) {
1152
- ret.root = "/";
1153
- start = 1;
1154
- } else {
1155
- start = 0;
1156
- }
1157
- let startDot = -1;
1158
- let startPart = 0;
1159
- let end = -1;
1160
- let matchedSlash = true;
1161
- let i = path.length - 1;
1162
- let preDotState = 0;
1163
- for (;i >= start; --i) {
1164
- code = path.charCodeAt(i);
1165
- if (47 === code) {
1166
- if (!matchedSlash) {
1167
- startPart = i + 1;
1168
- break;
1169
- }
1170
- continue;
1171
- }
1172
- if (-1 === end) {
1173
- matchedSlash = false;
1174
- end = i + 1;
1175
- }
1176
- 46 === code ? -1 === startDot ? startDot = i : 1 !== preDotState && (preDotState = 1) : -1 !== startDot && (preDotState = -1);
1177
- }
1178
- if (-1 === startDot || -1 === end || 0 === preDotState || 1 === preDotState && startDot === end - 1 && startDot === startPart + 1) {
1179
- -1 !== end && (ret.base = ret.name = 0 === startPart && isAbsolute2 ? path.slice(1, end) : path.slice(startPart, end));
1180
- } else {
1181
- if (0 === startPart && isAbsolute2) {
1182
- ret.name = path.slice(1, startDot);
1183
- ret.base = path.slice(1, end);
1184
- } else {
1185
- ret.name = path.slice(startPart, startDot);
1186
- ret.base = path.slice(startPart, end);
1187
- }
1188
- ret.ext = path.slice(startDot, end);
1189
- }
1190
- startPart > 0 ? ret.dir = path.slice(0, startPart - 1) : isAbsolute2 && (ret.dir = "/");
1191
- return ret;
1192
- };
1193
- const sep = "/";
1194
- const delimiter = ":";
1195
- return {
1196
- relative: relative,
1197
- resolve: resolve,
1198
- parse: parse,
1199
- format: format,
1200
- join: join,
1201
- isAbsolute: isAbsolute,
1202
- basename: basename,
1203
- normalize: normalize,
1204
- dirname: dirname,
1205
- extname: extname,
1206
- delimiter: delimiter,
1207
- sep: sep,
1208
- win32: null,
1209
- posix: {
1210
- relative: relative,
1211
- resolve: resolve,
1212
- parse: parse,
1213
- format: format,
1214
- join: join,
1215
- isAbsolute: isAbsolute,
1216
- basename: basename,
1217
- normalize: normalize,
1218
- dirname: dirname,
1219
- extname: extname,
1220
- delimiter: delimiter,
1221
- sep: sep,
1222
- win32: null,
1223
- posix: null
1224
- }
1225
- };
1226
- }
1227
- var QWIK_BINDING_MAP = {
1228
- darwin: {
1229
- arm64: [ {
1230
- platform: "darwin",
1231
- arch: "arm64",
1232
- abi: null,
1233
- platformArchABI: "qwik.darwin-arm64.node"
1234
- } ],
1235
- x64: [ {
1236
- platform: "darwin",
1237
- arch: "x64",
1238
- abi: null,
1239
- platformArchABI: "qwik.darwin-x64.node"
1240
- } ]
1241
- },
1242
- win32: {
1243
- x64: [ {
1244
- platform: "win32",
1245
- arch: "x64",
1246
- abi: "msvc",
1247
- platformArchABI: "qwik.win32-x64-msvc.node"
1248
- } ]
1249
- },
1250
- linux: {
1251
- x64: [ {
1252
- platform: "linux",
1253
- arch: "x64",
1254
- abi: "gnu",
1255
- platformArchABI: "qwik.linux-x64-gnu.node"
1256
- } ]
1257
- }
1258
- };
1259
- var versions = {
1260
- qwik: "2.0.0-beta.1-dev+495e8d9"
1261
- };
1262
- async function getSystem() {
1263
- const sysEnv = getEnv();
1264
- const sys = {
1265
- dynamicImport: path => {
1266
- throw new Error(`Qwik Optimizer sys.dynamicImport() not implemented, trying to import: "${path}"`);
1267
- },
1268
- strictDynamicImport: path => {
1269
- throw new Error(`Qwik Optimizer sys.strictDynamicImport() not implemented, trying to import: "${path}"`);
1270
- },
1271
- path: null,
1272
- cwd: () => "/",
1273
- os: "unknown",
1274
- env: sysEnv
1275
- };
1276
- sys.path = createPath(sys);
1277
- false;
1278
- if ("node" === sysEnv || "bun" === sysEnv) {
1279
- sys.dynamicImport = path => require(path);
1280
- sys.strictDynamicImport = path => import(path);
1281
- if ("undefined" === typeof TextEncoder) {
1282
- const nodeUtil = await sys.dynamicImport("node:util");
1283
- globalThis.TextEncoder = nodeUtil.TextEncoder;
1284
- globalThis.TextDecoder = nodeUtil.TextDecoder;
1285
- }
1286
- } else if ("webworker" === sysEnv || "browsermain" === sysEnv) {
1287
- sys.strictDynamicImport = path => import(path);
1288
- sys.dynamicImport = async path => {
1289
- const cjsRsp = await fetch(path);
1290
- const cjsCode = await cjsRsp.text();
1291
- const cjsModule = {
1292
- exports: {}
1293
- };
1294
- const cjsRun = new Function("module", "exports", cjsCode);
1295
- cjsRun(cjsModule, cjsModule.exports);
1296
- return cjsModule.exports;
1297
- };
1298
- }
1299
- if ("node" === sysEnv || "bun" === sysEnv) {
1300
- sys.path = await sys.dynamicImport("node:path");
1301
- sys.cwd = () => process.cwd();
1302
- sys.os = process.platform;
1303
- }
1304
- return sys;
1305
- }
1306
- async function loadPlatformBinding(sys) {
1307
- const sysEnv = getEnv();
1308
- if ("node" === sysEnv || "bun" === sysEnv) {
1309
- const platform = QWIK_BINDING_MAP[process.platform];
1310
- if (platform) {
1311
- const triples = platform[process.arch];
1312
- if (triples) {
1313
- for (const triple of triples) {
1314
- try {
1315
- false;
1316
- const mod = await sys.dynamicImport(`../bindings/${triple.platformArchABI}`);
1317
- return mod;
1318
- } catch (e) {
1319
- console.warn(`Unable to load native binding ${triple.platformArchABI}. Falling back to wasm build.`, null == e ? void 0 : e.message);
1320
- }
1321
- }
1322
- }
1323
- }
1324
- }
1325
- if ("node" === sysEnv || "bun" === sysEnv) {
1326
- const wasmPath = sys.path.join(__dirname, "..", "bindings", "qwik_wasm_bg.wasm");
1327
- const mod = await sys.dynamicImport("../bindings/qwik.wasm.cjs");
1328
- const fs = await sys.dynamicImport("node:fs");
1329
- return new Promise(((resolve, reject) => {
1330
- fs.readFile(wasmPath, ((err, buf) => {
1331
- null != err ? reject(err) : resolve(buf);
1332
- }));
1333
- })).then((buf => WebAssembly.compile(buf))).then((wasm => mod.default(wasm))).then((() => mod));
1334
- }
1335
- if ("webworker" === sysEnv || "browsermain" === sysEnv) {
1336
- let version = versions.qwik;
1337
- const cachedCjsCode = `qwikWasmCjs${version}`;
1338
- const cachedWasmRsp = `qwikWasmRsp${version}`;
1339
- let cjsCode = globalThis[cachedCjsCode];
1340
- let wasmRsp = globalThis[cachedWasmRsp];
1341
- if (!cjsCode || !wasmRsp) {
1342
- version = versions.qwik.split("-dev")[0];
1343
- const cdnUrl = `https://cdn.jsdelivr.net/npm/@qwik.dev/core@${version}/bindings/`;
1344
- const cjsModuleUrl = new URL("./qwik.wasm.cjs", cdnUrl).href;
1345
- const wasmUrl = new URL("./qwik_wasm_bg.wasm", cdnUrl).href;
1346
- const rsps = await Promise.all([ fetch(cjsModuleUrl), fetch(wasmUrl) ]);
1347
- for (const rsp of rsps) {
1348
- if (!rsp.ok) {
1349
- throw new Error(`Unable to fetch Qwik WASM binding from ${rsp.url}`);
1350
- }
1351
- }
1352
- const cjsRsp = rsps[0];
1353
- globalThis[cachedCjsCode] = cjsCode = await cjsRsp.text();
1354
- globalThis[cachedWasmRsp] = wasmRsp = rsps[1];
1355
- }
1356
- const cjsModule = {
1357
- exports: {}
1358
- };
1359
- const cjsRun = new Function("module", "exports", cjsCode);
1360
- cjsRun(cjsModule, cjsModule.exports);
1361
- const mod = cjsModule.exports;
1362
- await mod.default(wasmRsp.clone());
1363
- return mod;
1364
- }
1365
- false;
1366
- throw new Error("Platform not supported");
1367
- }
1368
- var getEnv = () => {
1369
- if ("undefined" !== typeof Deno) {
1370
- return "deno";
1371
- }
1372
- if ("undefined" !== typeof Bun) {
1373
- return "bun";
1374
- }
1375
- if ("undefined" !== typeof process && "undefined" !== typeof global && process.versions && process.versions.node) {
1376
- return "node";
1377
- }
1378
- if ("undefined" !== typeof self && "undefined" !== typeof location && "undefined" !== typeof navigator && "function" === typeof fetch && "function" === typeof WorkerGlobalScope && "function" === typeof self.importScripts) {
1379
- return "webworker";
1380
- }
1381
- if ("undefined" !== typeof window && "undefined" !== typeof document && "undefined" !== typeof location && "undefined" !== typeof navigator && "function" === typeof Window && "function" === typeof fetch) {
1382
- return "browsermain";
1383
- }
1384
- return "unknown";
1385
- };
1386
- var createOptimizer = async (optimizerOptions = {}) => {
1387
- const sys = (null == optimizerOptions ? void 0 : optimizerOptions.sys) || await getSystem();
1388
- const binding = (null == optimizerOptions ? void 0 : optimizerOptions.binding) || await loadPlatformBinding(sys);
1389
- const optimizer = {
1390
- transformModules: async opts => transformModules(binding, opts),
1391
- sys: sys
1392
- };
1393
- return optimizer;
1394
- };
1395
- var transformModules = (binding, opts) => binding.transform_modules(convertOptions(opts));
1396
- var convertOptions = opts => {
1397
- var _a, _b;
1398
- const output = {
1399
- minify: "simplify",
1400
- sourceMaps: false,
1401
- transpileTs: false,
1402
- transpileJsx: false,
1403
- preserveFilenames: false,
1404
- explicitExtensions: false,
1405
- mode: "lib",
1406
- manualChunks: void 0,
1407
- scope: void 0,
1408
- regCtxName: void 0,
1409
- stripEventHandlers: false,
1410
- rootDir: void 0,
1411
- stripExports: void 0,
1412
- stripCtxName: void 0,
1413
- isServer: void 0
1414
- };
1415
- Object.entries(opts).forEach((([key, value]) => {
1416
- null != value && (output[key] = value);
1417
- }));
1418
- output.entryStrategy = (null == (_a = opts.entryStrategy) ? void 0 : _a.type) ?? "smart";
1419
- output.manualChunks = (null == (_b = opts.entryStrategy) ? void 0 : _b.manual) ?? void 0;
1420
- return output;
1421
- };
1422
- var hashCode = (text, hash = 0) => {
1423
- for (let i = 0; i < text.length; i++) {
1424
- const chr = text.charCodeAt(i);
1425
- hash = (hash << 5) - hash + chr;
1426
- hash |= 0;
1427
- }
1428
- return Number(Math.abs(hash)).toString(36);
1429
- };
1430
- var extraSymbols = new Set([ "_run", "_task" ]);
1431
- function prioritizeSymbolNames(manifest) {
1432
- const symbols = manifest.symbols;
1433
- return Object.keys(symbols).sort(((symbolNameA, symbolNameB) => {
1434
- const a = symbols[symbolNameA];
1435
- const b = symbols[symbolNameB];
1436
- if ("eventHandler" === a.ctxKind && "eventHandler" !== b.ctxKind) {
1437
- return -1;
1438
- }
1439
- if ("eventHandler" !== a.ctxKind && "eventHandler" === b.ctxKind) {
1440
- return 1;
1441
- }
1442
- if ("eventHandler" === a.ctxKind && "eventHandler" === b.ctxKind) {
1443
- const aIndex = EVENT_PRIORITY.indexOf(a.ctxName.toLowerCase());
1444
- const bIndex = EVENT_PRIORITY.indexOf(b.ctxName.toLowerCase());
1445
- if (aIndex > -1 && bIndex > -1) {
1446
- if (aIndex < bIndex) {
1447
- return -1;
1448
- }
1449
- if (aIndex > bIndex) {
1450
- return 1;
1451
- }
1452
- } else {
1453
- if (aIndex > -1) {
1454
- return -1;
1455
- }
1456
- if (bIndex > -1) {
1457
- return 1;
1458
- }
1459
- }
1460
- } else if ("function" === a.ctxKind && "function" === b.ctxKind) {
1461
- const aIndex = FUNCTION_PRIORITY.indexOf(a.ctxName.toLowerCase());
1462
- const bIndex = FUNCTION_PRIORITY.indexOf(b.ctxName.toLowerCase());
1463
- if (aIndex > -1 && bIndex > -1) {
1464
- if (aIndex < bIndex) {
1465
- return -1;
1466
- }
1467
- if (aIndex > bIndex) {
1468
- return 1;
1469
- }
1470
- } else {
1471
- if (aIndex > -1) {
1472
- return -1;
1473
- }
1474
- if (bIndex > -1) {
1475
- return 1;
1476
- }
1477
- }
1478
- }
1479
- if (!a.parent && b.parent) {
1480
- return -1;
1481
- }
1482
- if (a.parent && !b.parent) {
1483
- return 1;
1484
- }
1485
- if (a.hash < b.hash) {
1486
- return -1;
1487
- }
1488
- if (a.hash > b.hash) {
1489
- return 1;
1490
- }
1491
- return 0;
1492
- }));
1493
- }
1494
- var EVENT_PRIORITY = (() => [ "click", "dblclick", "contextmenu", "auxclick", "pointerdown", "pointerup", "pointermove", "pointerover", "pointerenter", "pointerleave", "pointerout", "pointercancel", "gotpointercapture", "lostpointercapture", "touchstart", "touchend", "touchmove", "touchcancel", "mousedown", "mouseup", "mousemove", "mouseenter", "mouseleave", "mouseover", "mouseout", "wheel", "gesturestart", "gesturechange", "gestureend", "keydown", "keyup", "keypress", "input", "change", "search", "invalid", "beforeinput", "select", "focusin", "focusout", "focus", "blur", "submit", "reset", "scroll" ].map((n => `on${n.toLowerCase()}$`)))();
1495
- var FUNCTION_PRIORITY = (() => [ "useTask$", "useVisibleTask$", "component$", "useStyles$", "useStylesScoped$" ].map((n => n.toLowerCase())))();
1496
- function sortBundleNames(manifest) {
1497
- return Object.keys(manifest.bundles).sort(sortAlphabetical);
1498
- }
1499
- function updateSortAndPriorities(manifest) {
1500
- const prioritizedSymbolNames = prioritizeSymbolNames(manifest);
1501
- const prioritizedSymbols = {};
1502
- const prioritizedMapping = {};
1503
- for (const symbolName of prioritizedSymbolNames) {
1504
- prioritizedSymbols[symbolName] = manifest.symbols[symbolName];
1505
- prioritizedMapping[symbolName] = manifest.mapping[symbolName];
1506
- }
1507
- const sortedBundleNames = sortBundleNames(manifest);
1508
- const sortedBundles = {};
1509
- for (const bundleName of sortedBundleNames) {
1510
- sortedBundles[bundleName] = manifest.bundles[bundleName];
1511
- const bundle = manifest.bundles[bundleName];
1512
- Array.isArray(bundle.imports) && bundle.imports.sort(sortAlphabetical);
1513
- Array.isArray(bundle.dynamicImports) && bundle.dynamicImports.sort(sortAlphabetical);
1514
- const symbols = [];
1515
- for (const symbolName of prioritizedSymbolNames) {
1516
- bundleName === prioritizedMapping[symbolName] && symbols.push(symbolName);
1517
- }
1518
- if (symbols.length > 0) {
1519
- symbols.sort(sortAlphabetical);
1520
- bundle.symbols = symbols;
1521
- }
1522
- }
1523
- manifest.symbols = prioritizedSymbols;
1524
- manifest.mapping = prioritizedMapping;
1525
- manifest.bundles = sortedBundles;
1526
- return manifest;
1527
- }
1528
- function sortAlphabetical(a, b) {
1529
- a = a.toLocaleLowerCase();
1530
- b = b.toLocaleLowerCase();
1531
- if (a < b) {
1532
- return -1;
1533
- }
1534
- if (a > b) {
1535
- return 1;
1536
- }
1537
- return 0;
1538
- }
1539
- function getValidManifest(manifest) {
1540
- if (null != manifest && null != manifest.mapping && "object" === typeof manifest.mapping && null != manifest.symbols && "object" === typeof manifest.symbols && null != manifest.bundles && "object" === typeof manifest.bundles) {
1541
- return manifest;
1542
- }
1543
- return;
1544
- }
1545
- var getBundleInteractivity = (bundle, manifest) => {
1546
- let maxScore = 0;
1547
- if (bundle.symbols) {
1548
- for (const symbolName of bundle.symbols) {
1549
- let score = 1;
1550
- const symbol = manifest.symbols[symbolName];
1551
- if (symbol) {
1552
- if ("function" === symbol.ctxKind) {
1553
- /(component|useStyles|useStylesScoped)/i.test(symbol.ctxName) ? score += 1 : /(useComputed|useTask|useVisibleTask|useOn)/i.test(symbol.ctxName) && (score += 2);
1554
- } else {
1555
- score += 1;
1556
- /(click|mouse|pointer|touch|key|scroll|gesture|wheel)/i.test(symbol.ctxName) && (score += 3);
1557
- }
1558
- }
1559
- maxScore = Math.max(maxScore, score);
1560
- }
1561
- }
1562
- return maxScore;
1563
- };
1564
- function computeTotals(graph) {
1565
- let index = 0;
1566
- const stack = [];
1567
- const sccList = [];
1568
- const idx = new Map;
1569
- const low = new Map;
1570
- const onStack = new Set;
1571
- function strongConnect(v) {
1572
- idx.set(v, index);
1573
- low.set(v, index);
1574
- index++;
1575
- stack.push(v);
1576
- onStack.add(v);
1577
- const children = graph[v].imports || [];
1578
- for (const w of children) {
1579
- if (idx.has(w)) {
1580
- onStack.has(w) && low.set(v, Math.min(low.get(v), idx.get(w)));
1581
- } else {
1582
- strongConnect(w);
1583
- low.set(v, Math.min(low.get(v), low.get(w)));
1584
- }
1585
- }
1586
- if (low.get(v) === idx.get(v)) {
1587
- const comp = [];
1588
- let x;
1589
- do {
1590
- x = stack.pop();
1591
- onStack.delete(x);
1592
- comp.push(x);
1593
- } while (x !== v);
1594
- sccList.push(comp);
1595
- }
1596
- }
1597
- for (const v of Object.keys(graph)) {
1598
- idx.has(v) || strongConnect(v);
1599
- }
1600
- const sccIndex = new Map;
1601
- sccList.forEach(((comp, i) => {
1602
- for (const v of comp) {
1603
- sccIndex.set(v, i);
1604
- }
1605
- }));
1606
- const sccDAG = Array.from({
1607
- length: sccList.length
1608
- }, (() => new Set));
1609
- for (const v of Object.keys(graph)) {
1610
- const i = sccIndex.get(v);
1611
- for (const w of graph[v].imports || []) {
1612
- const j = sccIndex.get(w);
1613
- i !== j && sccDAG[i].add(j);
1614
- }
1615
- }
1616
- const visited = new Set;
1617
- const order = [];
1618
- function dfsSCC(u) {
1619
- visited.add(u);
1620
- for (const v of sccDAG[u]) {
1621
- visited.has(v) || dfsSCC(v);
1622
- }
1623
- order.push(u);
1624
- }
1625
- for (let i = 0; i < sccList.length; i++) {
1626
- visited.has(i) || dfsSCC(i);
1627
- }
1628
- order.reverse();
1629
- const sccTotals = new Array(sccList.length).fill(0);
1630
- for (let i = 0; i < sccList.length; i++) {
1631
- let sumSize = 0;
1632
- for (const nodeId of sccList[i]) {
1633
- sumSize += graph[nodeId].size;
1634
- }
1635
- sccTotals[i] = sumSize;
1636
- }
1637
- for (let k = order.length - 1; k >= 0; k--) {
1638
- const sccId = order[k];
1639
- let total = sccTotals[sccId];
1640
- for (const child of sccDAG[sccId]) {
1641
- total += sccTotals[child];
1642
- }
1643
- sccTotals[sccId] = total;
1644
- }
1645
- for (let i = 0; i < sccList.length; i++) {
1646
- const total = sccTotals[i];
1647
- for (const nodeId of sccList[i]) {
1648
- graph[nodeId].total = total;
1649
- }
1650
- }
1651
- }
1652
- function generateManifestFromBundles(path, segments, injections, outputBundles, opts, debug, canonPath) {
1653
- const manifest = {
1654
- version: "1",
1655
- manifestHash: "",
1656
- options: {
1657
- target: opts.target,
1658
- buildMode: opts.buildMode,
1659
- entryStrategy: opts.entryStrategy && {
1660
- type: opts.entryStrategy.type
1661
- }
1662
- },
1663
- core: void 0,
1664
- preloader: void 0,
1665
- qwikLoader: void 0,
1666
- bundleGraphAsset: void 0,
1667
- injections: injections,
1668
- mapping: {},
1669
- bundles: {},
1670
- assets: {},
1671
- symbols: {},
1672
- bundleGraph: void 0
1673
- };
1674
- const getBundleName = name => {
1675
- const bundle = outputBundles[name];
1676
- if (!bundle) {
1677
- console.warn(`Client manifest generation: skipping external import "${name}"`);
1678
- return;
1679
- }
1680
- return canonPath(bundle.fileName);
1681
- };
1682
- let qwikHandlersName;
1683
- const qrlNames = new Set(segments.map((h => h.name)));
1684
- for (const outputBundle of Object.values(outputBundles)) {
1685
- if ("asset" === outputBundle.type) {
1686
- outputBundle.fileName.endsWith("js.map") || (manifest.assets[outputBundle.fileName] = {
1687
- name: outputBundle.names[0],
1688
- size: outputBundle.source.length
1689
- });
1690
- continue;
1691
- }
1692
- const bundleFileName = canonPath(outputBundle.fileName);
1693
- const size = outputBundle.code.length;
1694
- const bundle = {
1695
- size: size,
1696
- total: -1
1697
- };
1698
- for (const symbol of outputBundle.exports) {
1699
- qrlNames.has(symbol) && (manifest.mapping[symbol] && 1 === outputBundle.exports.length || (manifest.mapping[symbol] = bundleFileName));
1700
- }
1701
- const bundleImports = outputBundle.imports.filter((i => outputBundle.code.includes(path.basename(i)))).map((i => getBundleName(i))).filter(Boolean);
1702
- bundleImports.length > 0 && (bundle.imports = bundleImports);
1703
- const bundleDynamicImports = outputBundle.dynamicImports.filter((i => outputBundle.code.includes(path.basename(i)))).map((i => getBundleName(i))).filter(Boolean);
1704
- bundleDynamicImports.length > 0 && (bundle.dynamicImports = bundleDynamicImports);
1705
- const ids = outputBundle.moduleIds || Object.keys(outputBundle.modules);
1706
- const modulePaths = ids.filter((m => !m.startsWith("\0"))).map((m => path.relative(opts.rootDir, m)));
1707
- if (modulePaths.length > 0) {
1708
- bundle.origins = modulePaths;
1709
- modulePaths.some((m => /[/\\](core|qwik)[/\\]dist[/\\]preloader\.[cm]js$/.test(m))) && (manifest.preloader = bundleFileName);
1710
- modulePaths.some((m => /[/\\](core|qwik)[/\\]dist[/\\]core(.min|.prod)?\.[cm]js$/.test(m))) && (manifest.core = bundleFileName);
1711
- modulePaths.some((m => /[/\\](core|qwik)[/\\](dist[/\\])?qwikloader(\.debug)?\.[^/]*js$/.test(m))) && (manifest.qwikLoader = bundleFileName);
1712
- modulePaths.some((m => /[/\\](core|qwik)[/\\]handlers\.[cm]js$/.test(m))) && (qwikHandlersName = bundleFileName);
1713
- }
1714
- manifest.bundles[bundleFileName] = bundle;
1715
- }
1716
- for (const segment of segments) {
1717
- const symbol = segment.name;
1718
- const bundle = manifest.mapping[symbol];
1719
- if (!bundle) {
1720
- debug(`Note: qrl ${segment.name} is not in the bundle, likely tree shaken`, manifest);
1721
- continue;
1722
- }
1723
- (manifest.bundles[bundle].symbols ||= []).push(symbol);
1724
- manifest.symbols[symbol] = {
1725
- displayName: segment.displayName,
1726
- hash: segment.hash,
1727
- ctxKind: segment.ctxKind,
1728
- ctxName: segment.ctxName,
1729
- captures: segment.captures,
1730
- canonicalFilename: segment.canonicalFilename,
1731
- parent: segment.parent,
1732
- origin: segment.origin,
1733
- loc: segment.loc,
1734
- paramNames: segment.paramNames,
1735
- captureNames: segment.captureNames
1736
- };
1737
- }
1738
- if (qwikHandlersName) {
1739
- for (const symbol of extraSymbols) {
1740
- manifest.symbols[symbol] = {
1741
- origin: "Qwik core",
1742
- displayName: symbol,
1743
- canonicalFilename: "",
1744
- hash: symbol,
1745
- ctxKind: "function",
1746
- ctxName: symbol,
1747
- captures: false,
1748
- parent: null,
1749
- loc: [ 0, 0 ]
1750
- };
1751
- manifest.mapping[symbol] = qwikHandlersName;
1752
- }
1753
- } else {
1754
- console.error("Qwik core bundle not found, is Qwik actually used in this project?");
1755
- }
1756
- for (const bundle of Object.values(manifest.bundles)) {
1757
- const interactivityScore = getBundleInteractivity(bundle, manifest);
1758
- bundle.interactivity = interactivityScore;
1759
- }
1760
- computeTotals(manifest.bundles);
1761
- return updateSortAndPriorities(manifest);
1762
- }
1763
- var minimumSpeed = 300;
1764
- var slowSize = .5 / (1024 * minimumSpeed / 8);
1765
- var getSymbolHash = symbolName => {
1766
- const index = symbolName.lastIndexOf("_");
1767
- if (index > -1) {
1768
- return symbolName.slice(index + 1);
1769
- }
1770
- return symbolName;
1771
- };
1772
- function convertManifestToBundleGraph(manifest, bundleGraphAdders) {
1773
- var _a, _b, _c, _d;
1774
- const bundleGraph = [];
1775
- if (!manifest.bundles) {
1776
- return [];
1777
- }
1778
- const graph = {
1779
- ...manifest.bundles
1780
- };
1781
- for (const [symbol, bundleName] of Object.entries(manifest.mapping)) {
1782
- if (symbol.startsWith("_") && symbol.length < 10) {
1783
- continue;
1784
- }
1785
- const hash = getSymbolHash(symbol);
1786
- hash && (graph[hash] = {
1787
- dynamicImports: [ bundleName ]
1788
- });
1789
- }
1790
- if (bundleGraphAdders) {
1791
- const combined = {
1792
- ...manifest,
1793
- bundles: graph
1794
- };
1795
- for (const adder of bundleGraphAdders) {
1796
- const result = adder(combined);
1797
- result && Object.assign(graph, result);
1798
- }
1799
- }
1800
- for (const bundleName of Object.keys(graph)) {
1801
- const bundle = graph[bundleName];
1802
- const imports = (null == (_a = bundle.imports) ? void 0 : _a.filter((dep => graph[dep]))) || [];
1803
- const dynamicImports = (null == (_b = bundle.dynamicImports) ? void 0 : _b.filter((dep => {
1804
- var _a2;
1805
- return graph[dep] && (graph[dep].symbols || (null == (_a2 = graph[dep].origins) ? void 0 : _a2.some((o => !o.includes("node_modules")))));
1806
- }))) || [];
1807
- graph[bundleName] = {
1808
- ...bundle,
1809
- imports: imports,
1810
- dynamicImports: dynamicImports
1811
- };
1812
- }
1813
- const notUsed = new Set(Object.keys(graph));
1814
- for (const bundleName of Object.keys(graph)) {
1815
- for (const dep of graph[bundleName].imports) {
1816
- notUsed.delete(dep);
1817
- }
1818
- for (const dep of graph[bundleName].dynamicImports) {
1819
- notUsed.delete(dep);
1820
- }
1821
- }
1822
- for (const bundleName of notUsed) {
1823
- const bundle = graph[bundleName];
1824
- (null == (_c = bundle.imports) ? void 0 : _c.length) || (null == (_d = bundle.dynamicImports) ? void 0 : _d.length) || delete graph[bundleName];
1825
- }
1826
- const names = Object.keys(graph);
1827
- const map = new Map;
1828
- const clearTransitiveDeps = (parentDeps, bundleName, seen = new Set) => {
1829
- const bundle = graph[bundleName];
1830
- for (const dep of bundle.imports) {
1831
- parentDeps.has(dep) && parentDeps.delete(dep);
1832
- if (!seen.has(dep)) {
1833
- seen.add(dep);
1834
- clearTransitiveDeps(parentDeps, dep, seen);
1835
- }
1836
- }
1837
- };
1838
- for (const bundleName of names) {
1839
- const bundle = graph[bundleName];
1840
- const deps = new Set(bundle.imports);
1841
- for (const depName of deps) {
1842
- clearTransitiveDeps(deps, depName);
1843
- }
1844
- const dynDeps = new Set(bundle.dynamicImports);
1845
- const depProbability = new Map;
1846
- for (const depName of dynDeps) {
1847
- clearTransitiveDeps(dynDeps, depName);
1848
- const dep = graph[depName];
1849
- let probability = .5;
1850
- probability += .08 * (dep.interactivity || 0);
1851
- if (bundle.origins && dep.origins) {
1852
- for (const origin of bundle.origins) {
1853
- if (dep.origins.some((o => o.startsWith(origin)))) {
1854
- probability += .25;
1855
- break;
1856
- }
1857
- }
1858
- }
1859
- dep.total > slowSize && (probability += probability > .5 ? .02 : -.02);
1860
- dep.total < 1e3 && (probability += .15);
1861
- depProbability.set(depName, Math.min(probability, .99));
1862
- }
1863
- if (dynDeps.size > 0) {
1864
- const sorted = Array.from(dynDeps).sort(((a, b) => depProbability.get(b) - depProbability.get(a)));
1865
- let lastProbability = -1;
1866
- for (const depName of sorted) {
1867
- if (depProbability.get(depName) !== lastProbability) {
1868
- lastProbability = depProbability.get(depName);
1869
- deps.add(-Math.round(10 * lastProbability));
1870
- }
1871
- deps.add(depName);
1872
- }
1873
- }
1874
- const index = bundleGraph.length;
1875
- bundleGraph.push(bundleName);
1876
- for (let i = 0; i < deps.size; i++) {
1877
- bundleGraph.push(null);
1878
- }
1879
- map.set(bundleName, {
1880
- index: index,
1881
- deps: deps
1882
- });
1883
- }
1884
- for (const bundleName of names) {
1885
- const bundle = map.get(bundleName);
1886
- let {index: index, deps: deps} = bundle;
1887
- index++;
1888
- for (const depName of deps) {
1889
- if ("number" === typeof depName) {
1890
- bundleGraph[index++] = depName;
1891
- continue;
1892
- }
1893
- const dep = map.get(depName);
1894
- const depIndex = dep.index;
1895
- bundleGraph[index++] = depIndex;
1896
- }
1897
- }
1898
- return bundleGraph;
1899
- }
1900
- async function createLinter(sys, rootDir, tsconfigFileNames) {
1901
- const module2 = await sys.dynamicImport("eslint");
1902
- let eslint = new module2.ESLint({
1903
- cache: true
1904
- });
1905
- const eslintConfig = await eslint.calculateConfigForFile("no-real-file.tsx");
1906
- const invalidEslintConfig = null === eslintConfig.parser;
1907
- if (invalidEslintConfig) {
1908
- const options = {
1909
- cache: true,
1910
- overrideConfig: {
1911
- languageOptions: {
1912
- parserOptions: {
1913
- tsconfigRootDir: rootDir,
1914
- project: tsconfigFileNames,
1915
- ecmaVersion: 2021,
1916
- sourceType: "module",
1917
- ecmaFeatures: {
1918
- jsx: true
1919
- }
1920
- }
1921
- }
1922
- }
1923
- };
1924
- eslint = new module2.ESLint(options);
1925
- }
1926
- return {
1927
- async lint(ctx, code, id) {
1928
- try {
1929
- const filePath = parseRequest(id);
1930
- if (await eslint.isPathIgnored(filePath)) {
1931
- return null;
1932
- }
1933
- const report = await eslint.lintText(code, {
1934
- filePath: filePath
1935
- });
1936
- report.forEach((file => {
1937
- for (const message of file.messages) {
1938
- if (null != message.ruleId && !message.ruleId.startsWith("qwik/")) {
1939
- continue;
1940
- }
1941
- const err = createRollupError(file.filePath, message);
1942
- ctx.warn(err);
1943
- }
1944
- }));
1945
- } catch (err) {
1946
- console.warn(err);
1947
- }
1948
- }
1949
- };
1950
- }
1951
- function parseRequest(id) {
1952
- return id.split("?", 2)[0];
1953
- }
1954
- function createRollupError(id, reportMessage) {
1955
- const err = Object.assign(new Error(reportMessage.message), {
1956
- id: id,
1957
- plugin: "vite-plugin-eslint",
1958
- loc: {
1959
- file: id,
1960
- column: reportMessage.column,
1961
- line: reportMessage.line
1962
- },
1963
- stack: ""
1964
- });
1965
- return err;
1966
- }
1967
- async function formatError(sys, e) {
1968
- const err = e;
1969
- let loc = err.loc;
1970
- if (!err.frame && !err.plugin) {
1971
- loc || (loc = findLocation(err));
1972
- if (loc) {
1973
- err.loc = loc;
1974
- if (loc.file) {
1975
- const fs = await sys.dynamicImport("node:fs");
1976
- const {normalizePath: normalizePath} = await sys.dynamicImport("vite");
1977
- err.id = normalizePath(err.loc.file);
1978
- try {
1979
- const code = fs.readFileSync(err.loc.file, "utf-8");
1980
- err.frame = generateCodeFrame(code, err.loc);
1981
- } catch {}
1982
- }
1983
- }
1984
- }
1985
- return e;
1986
- }
1987
- var findLocation = e => {
1988
- const stack = e.stack;
1989
- if ("string" === typeof stack) {
1990
- const lines = stack.split("\n").filter((l => !l.includes("/node_modules/") && !l.includes("(node:")));
1991
- for (let i = 1; i < lines.length; i++) {
1992
- const line = lines[i].replace("file:///", "/");
1993
- if (/^\s+at/.test(line)) {
1994
- const start = line.indexOf("/");
1995
- const end = line.lastIndexOf(")", start);
1996
- if (start > 0) {
1997
- const path = line.slice(start, end);
1998
- const parts = path.split(":");
1999
- const nu0 = safeParseInt(parts[parts.length - 1]);
2000
- const nu1 = safeParseInt(parts[parts.length - 2]);
2001
- if ("number" === typeof nu0 && "number" === typeof nu1) {
2002
- parts.length -= 2;
2003
- return {
2004
- file: parts.join(":"),
2005
- line: nu1,
2006
- column: nu0
2007
- };
2008
- }
2009
- if ("number" === typeof nu0) {
2010
- parts.length -= 1;
2011
- return {
2012
- file: parts.join(":"),
2013
- line: nu0,
2014
- column: void 0
2015
- };
2016
- }
2017
- return {
2018
- file: parts.join(":"),
2019
- line: void 0,
2020
- column: void 0
2021
- };
2022
- }
2023
- }
2024
- }
2025
- }
2026
- return;
2027
- };
2028
- var safeParseInt = nu => {
2029
- try {
2030
- return parseInt(nu, 10);
2031
- } catch {
2032
- return;
2033
- }
2034
- };
2035
- var splitRE = /\r?\n/;
2036
- var range = 2;
2037
- function posToNumber(source, pos) {
2038
- if ("number" === typeof pos) {
2039
- return pos;
2040
- }
2041
- if (null != pos.lo) {
2042
- return pos.lo;
2043
- }
2044
- const lines = source.split(splitRE);
2045
- const {line: line, column: column} = pos;
2046
- let start = 0;
2047
- for (let i = 0; i < line - 1 && i < lines.length; i++) {
2048
- start += lines[i].length + 1;
2049
- }
2050
- return start + column;
2051
- }
2052
- function generateCodeFrame(source, start = 0, end) {
2053
- start = posToNumber(source, start);
2054
- end = end || start;
2055
- const lines = source.split(splitRE);
2056
- let count = 0;
2057
- const res = [];
2058
- for (let i = 0; i < lines.length; i++) {
2059
- count += lines[i].length + 1;
2060
- if (count >= start) {
2061
- for (let j = i - range; j <= i + range || end > count; j++) {
2062
- if (j < 0 || j >= lines.length) {
2063
- continue;
2064
- }
2065
- const line = j + 1;
2066
- res.push(`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
2067
- const lineLength = lines[j].length;
2068
- if (j === i) {
2069
- const pad = Math.max(start - (count - lineLength) + 1, 0);
2070
- const length = Math.max(1, end > count ? lineLength - pad : end - start);
2071
- res.push(" | " + " ".repeat(pad) + "^".repeat(length));
2072
- } else if (j > i) {
2073
- if (end > count) {
2074
- const length = Math.max(Math.min(end - count, lineLength), 1);
2075
- res.push(" | " + "^".repeat(length));
2076
- }
2077
- count += lineLength + 1;
2078
- }
2079
- }
2080
- break;
2081
- }
2082
- }
2083
- return res.join("\n");
2084
- }
2085
- function isWin(os) {
2086
- return "win32" === os;
2087
- }
2088
- function parseId(originalId) {
2089
- const [pathId, query] = originalId.split("?");
2090
- const queryStr = query || "";
2091
- return {
2092
- originalId: originalId,
2093
- pathId: pathId,
2094
- query: queryStr ? `?${query}` : "",
2095
- params: new URLSearchParams(queryStr)
2096
- };
2097
- }
2098
- var REG_CTX_NAME = [ "server" ];
2099
- var SERVER_STRIP_EXPORTS = [ "onGet", "onPost", "onPut", "onRequest", "onDelete", "onHead", "onOptions", "onPatch", "onStaticGenerate" ];
2100
- var SERVER_STRIP_CTX_NAME = [ "useServer", "route", "server", "action$", "loader$", "zod$", "validator$", "globalAction$" ];
2101
- var CLIENT_STRIP_CTX_NAME = [ "useClient", "useBrowser", "useVisibleTask", "client", "browser", "event$" ];
2102
- var ExperimentalFeatures = (ExperimentalFeatures2 => {
2103
- ExperimentalFeatures2.preventNavigate = "preventNavigate";
2104
- ExperimentalFeatures2.valibot = "valibot";
2105
- ExperimentalFeatures2.noSPA = "noSPA";
2106
- ExperimentalFeatures2.enableRequestRewrite = "enableRequestRewrite";
2107
- ExperimentalFeatures2.webWorker = "webWorker";
2108
- ExperimentalFeatures2.insights = "insights";
2109
- return ExperimentalFeatures2;
2110
- })(ExperimentalFeatures || {});
2111
- function createQwikPlugin(optimizerOptions = {}) {
2112
- const id = `${Math.round(899 * Math.random()) + 100}`;
2113
- const clientResults = new Map;
2114
- const clientTransformedOutputs = new Map;
2115
- const serverTransformedOutputs = new Map;
2116
- const parentIds = new Map;
2117
- let internalOptimizer = null;
2118
- let linter;
2119
- let diagnosticsCallback = () => {};
2120
- const opts = {
2121
- csr: false,
2122
- target: "client",
2123
- buildMode: "development",
2124
- debug: false,
2125
- rootDir: null,
2126
- tsconfigFileNames: [ "./tsconfig.json" ],
2127
- input: null,
2128
- outDir: "",
2129
- assetsDir: null,
2130
- resolveQwikBuild: true,
2131
- entryStrategy: null,
2132
- srcDir: null,
2133
- srcInputs: null,
2134
- sourcemap: !!optimizerOptions.sourcemap,
2135
- manifestInput: null,
2136
- manifestOutput: null,
2137
- transformedModuleOutput: null,
2138
- scope: null,
2139
- devTools: {
2140
- imageDevTools: true,
2141
- clickToSource: [ "Alt" ]
2142
- },
2143
- inlineStylesUpToBytes: 2e4,
2144
- lint: false,
2145
- experimental: void 0
2146
- };
2147
- let lazyNormalizePath;
2148
- const init2 = async () => {
2149
- if (!internalOptimizer) {
2150
- internalOptimizer = await createOptimizer(optimizerOptions);
2151
- lazyNormalizePath = makeNormalizePath(internalOptimizer.sys);
2152
- }
2153
- };
2154
- const getOptimizer = () => {
2155
- if (!internalOptimizer) {
2156
- throw new Error("Qwik plugin has not been initialized");
2157
- }
2158
- return internalOptimizer;
2159
- };
2160
- const getSys = () => {
2161
- const optimizer2 = getOptimizer();
2162
- return optimizer2.sys;
2163
- };
2164
- const getPath = () => {
2165
- const optimizer2 = getOptimizer();
2166
- return optimizer2.sys.path;
2167
- };
2168
- let devServer;
2169
- const configureServer = server => {
2170
- devServer = server;
2171
- };
2172
- const normalizeOptions = inputOpts => {
2173
- const updatedOpts = Object.assign({}, inputOpts);
2174
- const optimizer2 = getOptimizer();
2175
- const path = optimizer2.sys.path;
2176
- opts.debug = !!updatedOpts.debug;
2177
- updatedOpts.assetsDir && (opts.assetsDir = updatedOpts.assetsDir);
2178
- "ssr" === updatedOpts.target || "client" === updatedOpts.target || "lib" === updatedOpts.target || "test" === updatedOpts.target ? opts.target = updatedOpts.target : opts.target ||= "client";
2179
- "lib" === opts.target ? opts.buildMode = "development" : "production" === updatedOpts.buildMode || "development" === updatedOpts.buildMode ? opts.buildMode = updatedOpts.buildMode : opts.buildMode ||= "development";
2180
- updatedOpts.entryStrategy && "object" === typeof updatedOpts.entryStrategy && (opts.entryStrategy = {
2181
- ...updatedOpts.entryStrategy
2182
- });
2183
- opts.entryStrategy || ("ssr" === opts.target || "test" === opts.target ? opts.entryStrategy = {
2184
- type: "hoist"
2185
- } : "lib" === opts.target ? opts.entryStrategy = {
2186
- type: "inline"
2187
- } : "production" === opts.buildMode ? opts.entryStrategy = {
2188
- type: "smart"
2189
- } : opts.entryStrategy = {
2190
- type: "segment"
2191
- });
2192
- "string" === typeof updatedOpts.rootDir && (opts.rootDir = updatedOpts.rootDir);
2193
- "string" !== typeof opts.rootDir && (opts.rootDir ||= optimizer2.sys.cwd());
2194
- opts.rootDir = normalizePath(path.resolve(optimizer2.sys.cwd(), opts.rootDir));
2195
- let srcDir = normalizePath(path.resolve(opts.rootDir, SRC_DIR_DEFAULT));
2196
- if ("string" === typeof updatedOpts.srcDir) {
2197
- opts.srcDir = normalizePath(path.resolve(opts.rootDir, updatedOpts.srcDir));
2198
- srcDir = opts.srcDir;
2199
- opts.srcInputs = null;
2200
- } else if (Array.isArray(updatedOpts.srcInputs)) {
2201
- opts.srcInputs = [ ...updatedOpts.srcInputs ];
2202
- opts.srcDir = null;
2203
- } else {
2204
- opts.srcDir ||= srcDir;
2205
- }
2206
- Array.isArray(updatedOpts.tsconfigFileNames) && updatedOpts.tsconfigFileNames.length > 0 && (opts.tsconfigFileNames = updatedOpts.tsconfigFileNames);
2207
- Array.isArray(opts.srcInputs) ? opts.srcInputs.forEach((i => {
2208
- i.path = normalizePath(path.resolve(opts.rootDir, i.path));
2209
- })) : "string" === typeof opts.srcDir && (opts.srcDir = normalizePath(path.resolve(opts.rootDir, normalizePath(opts.srcDir))));
2210
- if (!updatedOpts.csr) {
2211
- if (Array.isArray(updatedOpts.input)) {
2212
- opts.input = [ ...updatedOpts.input ];
2213
- } else if ("string" === typeof updatedOpts.input) {
2214
- opts.input = [ updatedOpts.input ];
2215
- } else if ("ssr" === opts.target) {
2216
- opts.input ||= [ path.resolve(srcDir, "entry.ssr") ];
2217
- } else if ("client" === opts.target) {
2218
- opts.input ||= [ path.resolve(srcDir, "root") ];
2219
- } else if ("lib" === opts.target) {
2220
- if ("object" === typeof updatedOpts.input) {
2221
- for (const key in updatedOpts.input) {
2222
- const resolvedPaths = {};
2223
- if (Object.hasOwnProperty.call(updatedOpts.input, key)) {
2224
- const relativePath = updatedOpts.input[key];
2225
- const absolutePath = path.resolve(opts.rootDir, relativePath);
2226
- resolvedPaths[key] = absolutePath;
2227
- }
2228
- opts.input = {
2229
- ...opts.input,
2230
- ...resolvedPaths
2231
- };
2232
- }
2233
- } else {
2234
- opts.input ||= [ path.resolve(srcDir, "index.ts") ];
2235
- }
2236
- } else {
2237
- opts.input ||= [];
2238
- }
2239
- Array.isArray(opts.input) && (opts.input = opts.input.reduce(((inputs, i) => {
2240
- let input = i;
2241
- i.startsWith("@") || i.startsWith("~") || i.startsWith("#") || (input = normalizePath(path.resolve(opts.rootDir, i)));
2242
- inputs.includes(input) || inputs.push(input);
2243
- return inputs;
2244
- }), []));
2245
- "string" === typeof updatedOpts.outDir ? opts.outDir = normalizePath(path.resolve(opts.rootDir, normalizePath(updatedOpts.outDir))) : opts.outDir || ("ssr" === opts.target ? opts.outDir = normalizePath(path.resolve(opts.rootDir, SSR_OUT_DIR)) : "lib" === opts.target ? opts.outDir = normalizePath(path.resolve(opts.rootDir, LIB_OUT_DIR)) : opts.outDir = normalizePath(path.resolve(opts.rootDir, CLIENT_OUT_DIR)));
2246
- }
2247
- "function" === typeof updatedOpts.manifestOutput && (opts.manifestOutput = updatedOpts.manifestOutput);
2248
- const clientManifest = getValidManifest(updatedOpts.manifestInput);
2249
- clientManifest && (opts.manifestInput = clientManifest);
2250
- "function" === typeof updatedOpts.transformedModuleOutput && (opts.transformedModuleOutput = updatedOpts.transformedModuleOutput);
2251
- void 0 !== updatedOpts.scope && (opts.scope = updatedOpts.scope);
2252
- "boolean" === typeof updatedOpts.resolveQwikBuild && (opts.resolveQwikBuild = updatedOpts.resolveQwikBuild);
2253
- if ("object" === typeof updatedOpts.devTools) {
2254
- "imageDevTools" in updatedOpts.devTools && (opts.devTools.imageDevTools = updatedOpts.devTools.imageDevTools);
2255
- "clickToSource" in updatedOpts.devTools && (opts.devTools.clickToSource = updatedOpts.devTools.clickToSource);
2256
- }
2257
- opts.csr = !!updatedOpts.csr;
2258
- "inlineStylesUpToBytes" in optimizerOptions && ("number" === typeof optimizerOptions.inlineStylesUpToBytes ? opts.inlineStylesUpToBytes = optimizerOptions.inlineStylesUpToBytes : ("number" !== typeof opts.inlineStylesUpToBytes || opts.inlineStylesUpToBytes < 0) && (opts.inlineStylesUpToBytes = 0));
2259
- "boolean" === typeof updatedOpts.lint && (opts.lint = updatedOpts.lint);
2260
- if ("experimental" in updatedOpts) {
2261
- opts.experimental = void 0;
2262
- for (const feature of updatedOpts.experimental ?? []) {
2263
- ExperimentalFeatures[feature] ? (opts.experimental ||= {})[feature] = true : console.error(`Qwik plugin: Unknown experimental feature: ${feature}`);
2264
- }
2265
- }
2266
- return {
2267
- ...opts
2268
- };
2269
- };
2270
- let hasValidatedSource = false;
2271
- const validateSource = async resolver => {
2272
- if (!hasValidatedSource) {
2273
- hasValidatedSource = true;
2274
- const sys = getSys();
2275
- if ("node" === sys.env) {
2276
- const fs = await sys.dynamicImport("node:fs");
2277
- if (!fs.existsSync(opts.rootDir)) {
2278
- throw new Error(`Qwik rootDir "${opts.rootDir}" not found.`);
2279
- }
2280
- if ("string" === typeof opts.srcDir && !fs.existsSync(opts.srcDir)) {
2281
- throw new Error(`Qwik srcDir "${opts.srcDir}" not found.`);
2282
- }
2283
- for (const [_, input] of Object.entries(opts.input || {})) {
2284
- const resolved = await resolver(input);
2285
- if (!resolved) {
2286
- throw new Error(`Qwik input "${input}" not found.`);
2287
- }
2288
- }
2289
- }
2290
- }
2291
- };
2292
- let optimizer;
2293
- let shouldAddHandlers = false;
2294
- const buildStart = async _ctx => {
2295
- debug("buildStart()", opts.buildMode, opts.scope, opts.target, opts.rootDir, opts.srcDir);
2296
- optimizer = getOptimizer();
2297
- shouldAddHandlers = !devServer;
2298
- if ("node" === optimizer.sys.env && "ssr" === opts.target && opts.lint) {
2299
- try {
2300
- linter = await createLinter(optimizer.sys, opts.rootDir, opts.tsconfigFileNames);
2301
- } catch {}
2302
- }
2303
- const path = getPath();
2304
- if (Array.isArray(opts.srcInputs)) {
2305
- optimizer.sys.getInputFiles = async rootDir => opts.srcInputs.map((i => {
2306
- const relInput = {
2307
- path: normalizePath(path.relative(rootDir, i.path)),
2308
- code: i.code
2309
- };
2310
- return relInput;
2311
- }));
2312
- debug(`buildStart() opts.srcInputs (${opts.srcInputs.length} files)`);
2313
- }
2314
- debug("transformedOutputs.clear()");
2315
- clientTransformedOutputs.clear();
2316
- serverTransformedOutputs.clear();
2317
- if ("client" === opts.target) {
2318
- const ql = await _ctx.resolve("@qwik.dev/core/qwikloader.js", void 0, {
2319
- skipSelf: true
2320
- });
2321
- ql && _ctx.emitFile({
2322
- id: ql.id,
2323
- type: "chunk",
2324
- preserveSignature: "allow-extension"
2325
- });
2326
- }
2327
- };
2328
- const getIsServer = viteOpts => devServer ? !!(null == viteOpts ? void 0 : viteOpts.ssr) : "ssr" === opts.target || "test" === opts.target;
2329
- let resolveIdCount = 0;
2330
- const resolveId = async (ctx, id2, importerId, resolveOpts) => {
2331
- var _a;
2332
- if (id2.startsWith("\0")) {
2333
- return;
2334
- }
2335
- const count = resolveIdCount++;
2336
- const isServer = getIsServer(resolveOpts);
2337
- debug(`resolveId(${count})`, `begin ${id2} | ${isServer ? "server" : "client"} | ${importerId}`);
2338
- const parsedImporterId = importerId && parseId(importerId);
2339
- importerId = parsedImporterId && normalizePath(parsedImporterId.pathId);
2340
- if (id2.startsWith(".") && parsedImporterId) {
2341
- const path = getPath();
2342
- const importerDir = path.dirname(parsedImporterId.pathId);
2343
- importerDir && (id2 = path.resolve(importerDir, id2));
2344
- }
2345
- const parsedId = parseId(id2);
2346
- const pathId = normalizePath(parsedId.pathId);
2347
- let result;
2348
- if (parentIds.get(pathId)) {
2349
- debug(`resolveId(${count}) Resolved already known ${pathId}`);
2350
- result = {
2351
- id: pathId + parsedId.query,
2352
- moduleSideEffects: false
2353
- };
2354
- } else if (pathId.endsWith(QWIK_BUILD_ID)) {
2355
- if (opts.resolveQwikBuild) {
2356
- debug(`resolveId(${count})`, "Resolved", QWIK_BUILD_ID);
2357
- result = {
2358
- id: QWIK_BUILD_ID,
2359
- moduleSideEffects: false
2360
- };
2361
- }
2362
- } else if (pathId.endsWith(QWIK_CLIENT_MANIFEST_ID)) {
2363
- debug(`resolveId(${count})`, "Resolved", QWIK_CLIENT_MANIFEST_ID);
2364
- result = {
2365
- id: QWIK_CLIENT_MANIFEST_ID,
2366
- moduleSideEffects: false
2367
- };
2368
- } else if (devServer || isServer || !pathId.endsWith(QWIK_PRELOADER_ID)) {
2369
- if (pathId.endsWith(QWIK_HANDLERS_ID)) {
2370
- debug(`resolveId(${count})`, "Resolved", QWIK_HANDLERS_ID);
2371
- result = {
2372
- id: QWIK_HANDLERS_ID,
2373
- moduleSideEffects: false
2374
- };
2375
- } else {
2376
- if (!isServer && shouldAddHandlers && id2.endsWith("@qwik.dev/core")) {
2377
- shouldAddHandlers = false;
2378
- const key = await ctx.resolve("@qwik.dev/core/handlers.mjs", importerId, {
2379
- skipSelf: true
2380
- });
2381
- if (!key) {
2382
- throw new Error("Failed to resolve @qwik.dev/core/handlers.mjs");
2383
- }
2384
- ctx.emitFile({
2385
- id: key.id,
2386
- type: "chunk",
2387
- preserveSignature: "allow-extension"
2388
- });
2389
- }
2390
- const qrlMatch = null == (_a = /^(?<parent>.*\.[mc]?[jt]sx?)_(?<name>[^/]+)\.js(?<query>$|\?.*$)/.exec(id2)) ? void 0 : _a.groups;
2391
- if (qrlMatch) {
2392
- const {parent: parent, name: name, query: query} = qrlMatch;
2393
- const resolvedParent = await ctx.resolve(parent, importerId, {
2394
- skipSelf: true
2395
- });
2396
- if (resolvedParent) {
2397
- const parentId = resolvedParent.id.split("?")[0];
2398
- const isDevUrl = devServer && (null == importerId ? void 0 : importerId.endsWith(".html"));
2399
- const resolvedId = isDevUrl ? `${parentId}_${name}.js` : pathId;
2400
- debug(`resolveId(${count})`, `resolved to QRL ${name} of ${parentId}`);
2401
- parentIds.set(resolvedId, parentId);
2402
- result = {
2403
- id: resolvedId + query,
2404
- moduleSideEffects: false
2405
- };
2406
- } else {
2407
- console.error(`resolveId(${count})`, `QRL parent ${parent} does not exist!`);
2408
- }
2409
- } else if (importerId) {
2410
- const importerParentId = parentIds.get(importerId);
2411
- if (importerParentId) {
2412
- debug(`resolveId(${count}) end`, `resolving via ${importerParentId}`);
2413
- return ctx.resolve(id2, importerParentId, {
2414
- skipSelf: true
2415
- });
2416
- }
2417
- }
2418
- }
2419
- } else {
2420
- debug(`resolveId(${count})`, "Resolved", QWIK_PRELOADER_ID);
2421
- const preloader = await ctx.resolve(QWIK_PRELOADER_ID, importerId, {
2422
- skipSelf: true
2423
- });
2424
- if (preloader) {
2425
- ctx.emitFile({
2426
- id: preloader.id,
2427
- type: "chunk",
2428
- preserveSignature: "allow-extension"
2429
- });
2430
- return preloader;
2431
- }
2432
- }
2433
- debug(`resolveId(${count}) end`, (null == result ? void 0 : result.id) || result);
2434
- return result;
2435
- };
2436
- let loadCount = 0;
2437
- const load = async (ctx, id2, loadOpts) => {
2438
- if (id2.startsWith("\0") || id2.startsWith("/@fs/")) {
2439
- return;
2440
- }
2441
- const count = loadCount++;
2442
- const isServer = getIsServer(loadOpts);
2443
- if (opts.resolveQwikBuild && id2 === QWIK_BUILD_ID) {
2444
- debug(`load(${count})`, QWIK_BUILD_ID, opts.buildMode);
2445
- return {
2446
- moduleSideEffects: false,
2447
- code: getQwikBuildModule(isServer, opts.target)
2448
- };
2449
- }
2450
- if (id2 === QWIK_CLIENT_MANIFEST_ID) {
2451
- debug(`load(${count})`, QWIK_CLIENT_MANIFEST_ID, opts.buildMode);
2452
- return {
2453
- moduleSideEffects: false,
2454
- code: await getQwikServerManifestModule(isServer)
2455
- };
2456
- }
2457
- if (id2 === QWIK_HANDLERS_ID) {
2458
- debug(`load(${count})`, QWIK_HANDLERS_ID, opts.buildMode);
2459
- return {
2460
- moduleSideEffects: false,
2461
- code: "export * from '@qwik.dev/core';"
2462
- };
2463
- }
2464
- const parsedId = parseId(id2);
2465
- id2 = normalizePath(parsedId.pathId);
2466
- const outputs = isServer ? serverTransformedOutputs : clientTransformedOutputs;
2467
- if (devServer && !outputs.has(id2)) {
2468
- const parentId = parentIds.get(id2);
2469
- if (parentId) {
2470
- const parentModule = devServer.moduleGraph.getModuleById(parentId);
2471
- if (parentModule) {
2472
- debug(`load(${count})`, "transforming QRL parent", parentId);
2473
- await devServer.transformRequest(parentModule.url);
2474
- if (!outputs.has(id2)) {
2475
- debug(`load(${count})`, `QRL segment ${id2} not found in ${parentId}`);
2476
- return null;
2477
- }
2478
- } else {
2479
- console.error(`load(${count})`, `${parentModule} does not exist!`);
2480
- }
2481
- }
2482
- }
2483
- const transformedModule = outputs.get(id2);
2484
- if (transformedModule) {
2485
- debug(`load(${count})`, "Found", id2);
2486
- const {code: code, map: map, segment: segment} = transformedModule[0];
2487
- return {
2488
- code: code,
2489
- map: map,
2490
- meta: {
2491
- segment: segment
2492
- }
2493
- };
2494
- }
2495
- debug(`load(${count})`, "Not a QRL or virtual module", id2);
2496
- return null;
2497
- };
2498
- let transformCount = 0;
2499
- const transform = async function(ctx, code, id2, transformOpts = {}) {
2500
- var _a;
2501
- if (id2.startsWith("\0")) {
2502
- return;
2503
- }
2504
- const count = transformCount++;
2505
- const isServer = getIsServer(transformOpts);
2506
- const currentOutputs = isServer ? serverTransformedOutputs : clientTransformedOutputs;
2507
- if (currentOutputs.has(id2)) {
2508
- return;
2509
- }
2510
- const optimizer2 = getOptimizer();
2511
- const path = getPath();
2512
- const {pathId: pathId} = parseId(id2);
2513
- const parsedPathId = path.parse(pathId);
2514
- const dir = parsedPathId.dir;
2515
- const base = parsedPathId.base;
2516
- const ext = parsedPathId.ext.toLowerCase();
2517
- if (ext in TRANSFORM_EXTS || TRANSFORM_REGEX.test(pathId)) {
2518
- const strip = "client" === opts.target || "ssr" === opts.target;
2519
- debug(`transform(${count})`, `Transforming ${id2} (for: ${isServer ? "server" : "client"}${strip ? ", strip" : ""})`);
2520
- const mode = "lib" === opts.target ? "lib" : "development" === opts.buildMode ? "dev" : "prod";
2521
- "lib" !== mode && (code = code.replaceAll(/__EXPERIMENTAL__\.(\w+)/g, ((_, feature) => {
2522
- var _a2;
2523
- if (null == (_a2 = opts.experimental) ? void 0 : _a2[feature]) {
2524
- return "true";
2525
- }
2526
- return "false";
2527
- })));
2528
- let filePath = base;
2529
- opts.srcDir && (filePath = path.relative(opts.srcDir, pathId));
2530
- filePath = normalizePath(filePath);
2531
- const srcDir = opts.srcDir ? opts.srcDir : normalizePath(dir);
2532
- const entryStrategy = opts.entryStrategy;
2533
- let devPath;
2534
- devServer && (devPath = null == (_a = devServer.moduleGraph.getModuleById(pathId)) ? void 0 : _a.url);
2535
- const transformOpts2 = {
2536
- input: [ {
2537
- code: code,
2538
- path: filePath,
2539
- devPath: devPath
2540
- } ],
2541
- entryStrategy: isServer ? {
2542
- type: "hoist"
2543
- } : entryStrategy,
2544
- minify: "simplify",
2545
- sourceMaps: opts.sourcemap || "development" === opts.buildMode,
2546
- transpileTs: true,
2547
- transpileJsx: true,
2548
- explicitExtensions: true,
2549
- preserveFilenames: true,
2550
- srcDir: srcDir,
2551
- rootDir: opts.rootDir,
2552
- mode: mode,
2553
- scope: opts.scope || void 0,
2554
- isServer: isServer
2555
- };
2556
- if (strip) {
2557
- if (isServer) {
2558
- transformOpts2.stripCtxName = CLIENT_STRIP_CTX_NAME;
2559
- transformOpts2.stripEventHandlers = true;
2560
- transformOpts2.regCtxName = REG_CTX_NAME;
2561
- } else {
2562
- transformOpts2.stripCtxName = SERVER_STRIP_CTX_NAME;
2563
- transformOpts2.stripExports = SERVER_STRIP_EXPORTS;
2564
- }
2565
- }
2566
- const now = Date.now();
2567
- const newOutput = await optimizer2.transformModules(transformOpts2);
2568
- debug(`transform(${count})`, `done in ${Date.now() - now}ms`);
2569
- const module2 = newOutput.modules.find((mod => !isAdditionalFile(mod)));
2570
- diagnosticsCallback(newOutput.diagnostics, optimizer2, srcDir);
2571
- isServer ? 0 === newOutput.diagnostics.length && linter && linter.lint(ctx, code, id2) : clientResults.set(id2, newOutput);
2572
- const deps = new Set;
2573
- for (const mod of newOutput.modules) {
2574
- if (mod !== module2) {
2575
- const key = normalizePath(path.join(srcDir, mod.path));
2576
- debug(`transform(${count})`, `segment ${key}`, mod.segment.displayName);
2577
- parentIds.set(key, id2);
2578
- currentOutputs.set(key, [ mod, id2 ]);
2579
- deps.add(key);
2580
- if ("client" === opts.target) {
2581
- if (devServer) {
2582
- const rollupModule = devServer.moduleGraph.getModuleById(key);
2583
- rollupModule && devServer.moduleGraph.invalidateModule(rollupModule);
2584
- } else {
2585
- ctx.emitFile({
2586
- id: key,
2587
- type: "chunk",
2588
- preserveSignature: "allow-extension"
2589
- });
2590
- }
2591
- }
2592
- }
2593
- }
2594
- for (const id3 of deps.values()) {
2595
- await ctx.load({
2596
- id: id3
2597
- });
2598
- }
2599
- ctx.addWatchFile(id2);
2600
- return {
2601
- code: module2.code,
2602
- map: module2.map,
2603
- meta: {
2604
- segment: module2.segment,
2605
- qwikdeps: Array.from(deps)
2606
- }
2607
- };
2608
- }
2609
- debug(`transform(${count})`, "Not transforming", id2);
2610
- return null;
2611
- };
2612
- const createOutputAnalyzer = rollupBundle => {
2613
- const injections = [];
2614
- const outputAnalyzer = {
2615
- addInjection: b => injections.push(b)
2616
- };
2617
- outputAnalyzer.generateManifest = async extra => {
2618
- const optimizer2 = getOptimizer();
2619
- const path = optimizer2.sys.path;
2620
- const buildPath = path.resolve(opts.rootDir, opts.outDir, "build");
2621
- const canonPath = p => path.relative(buildPath, path.resolve(opts.rootDir, opts.outDir, p));
2622
- outputAnalyzer.canonPath = canonPath;
2623
- const segments = Array.from(clientResults.values()).flatMap((r => r.modules)).map((mod => mod.segment)).filter((h => !!h));
2624
- const manifest = generateManifestFromBundles(path, segments, injections, rollupBundle, opts, debug, canonPath);
2625
- extra && Object.assign(manifest, extra);
2626
- for (const symbol of Object.values(manifest.symbols)) {
2627
- symbol.origin && (symbol.origin = normalizePath(symbol.origin));
2628
- }
2629
- for (const bundle of Object.values(manifest.bundles)) {
2630
- bundle.origins && (bundle.origins = bundle.origins.map((abs => {
2631
- const relPath = path.relative(opts.rootDir, abs);
2632
- return normalizePath(relPath);
2633
- })).sort());
2634
- }
2635
- manifest.manifestHash = hashCode(JSON.stringify(manifest));
2636
- return manifest;
2637
- };
2638
- return outputAnalyzer;
2639
- };
2640
- const getOptions = () => opts;
2641
- const getTransformedOutputs = () => Array.from(clientTransformedOutputs.values()).map((t => t[0]));
2642
- const debug = (...str) => {
2643
- opts.debug && console.debug(`[QWIK PLUGIN: ${id}]`, ...str);
2644
- };
2645
- const log = (...str) => {
2646
- console.log(`[QWIK PLUGIN: ${id}]`, ...str);
2647
- };
2648
- const onDiagnostics = cb => {
2649
- diagnosticsCallback = cb;
2650
- };
2651
- const normalizePath = id2 => lazyNormalizePath(id2);
2652
- function getQwikBuildModule(isServer, _target) {
2653
- const isDev2 = "development" === opts.buildMode;
2654
- return `// @qwik.dev/core/build\nexport const isServer = ${JSON.stringify(isServer)};\nexport const isBrowser = ${JSON.stringify(!isServer)};\nexport const isDev = ${JSON.stringify(isDev2)};\n`;
2655
- }
2656
- async function getQwikServerManifestModule(isServer) {
2657
- const manifest = isServer ? opts.manifestInput : null;
2658
- let serverManifest = null;
2659
- (null == manifest ? void 0 : manifest.manifestHash) && (serverManifest = {
2660
- manifestHash: manifest.manifestHash,
2661
- core: manifest.core,
2662
- preloader: manifest.preloader,
2663
- qwikLoader: manifest.qwikLoader,
2664
- bundleGraphAsset: manifest.bundleGraphAsset,
2665
- injections: manifest.injections,
2666
- mapping: manifest.mapping,
2667
- bundleGraph: manifest.bundleGraph
2668
- });
2669
- return `// @qwik-client-manifest\nexport const manifest = ${JSON.stringify(serverManifest)};\n`;
2670
- }
2671
- function setSourceMapSupport(sourcemap) {
2672
- opts.sourcemap = sourcemap;
2673
- }
2674
- function handleHotUpdate(ctx) {
2675
- debug("handleHotUpdate()", ctx.file);
2676
- for (const mod of ctx.modules) {
2677
- const {id: id2} = mod;
2678
- if (id2) {
2679
- debug("handleHotUpdate()", `invalidate ${id2}`);
2680
- clientResults.delete(id2);
2681
- for (const outputs of [ clientTransformedOutputs, serverTransformedOutputs ]) {
2682
- for (const [key, [_, parentId]] of outputs) {
2683
- if (parentId === id2) {
2684
- debug("handleHotUpdate()", `invalidate ${id2} segment ${key}`);
2685
- outputs.delete(key);
2686
- const mod2 = ctx.server.moduleGraph.getModuleById(key);
2687
- mod2 && ctx.server.moduleGraph.invalidateModule(mod2);
2688
- }
2689
- }
2690
- }
2691
- }
2692
- }
2693
- }
2694
- function manualChunks(id2, {getModuleInfo: getModuleInfo}) {
2695
- var _a;
2696
- if ("client" === opts.target) {
2697
- if (id2.endsWith("@qwik.dev/core/build") || /[/\\](core|qwik)[/\\]dist[/\\]preloader\.[cm]js$/.test(id2) || "\0vite/preload-helper.js" === id2) {
2698
- return "qwik-preloader";
2699
- }
2700
- if (/[/\\](core|qwik)[/\\](handlers|dist[/\\]core(\.prod|\.min)?)\.[cm]js$/.test(id2)) {
2701
- return "qwik-core";
2702
- }
2703
- if (/[/\\](core|qwik)[/\\]dist[/\\]qwikloader\.js$/.test(id2)) {
2704
- return "qwik-loader";
2705
- }
2706
- }
2707
- const module2 = getModuleInfo(id2);
2708
- const segment = module2.meta.segment;
2709
- if (segment) {
2710
- const {hash: hash} = segment;
2711
- const chunkName = (null == (_a = opts.entryStrategy.manual) ? void 0 : _a[hash]) || segment.entry;
2712
- if (chunkName) {
2713
- return chunkName;
2714
- }
2715
- }
2716
- return null;
2717
- }
2718
- async function generateManifest(ctx, rollupBundle, bundleGraphAdders, manifestExtra) {
2719
- var _a;
2720
- const outputAnalyzer = createOutputAnalyzer(rollupBundle);
2721
- const manifest = await outputAnalyzer.generateManifest(manifestExtra);
2722
- manifest.platform = {
2723
- ...null == manifestExtra ? void 0 : manifestExtra.platform,
2724
- rollup: (null == (_a = ctx.meta) ? void 0 : _a.rollupVersion) || "",
2725
- env: optimizer.sys.env,
2726
- os: optimizer.sys.os
2727
- };
2728
- "node" === optimizer.sys.env && (manifest.platform.node = process.versions.node);
2729
- const bundleGraph = convertManifestToBundleGraph(manifest, bundleGraphAdders);
2730
- const bgAsset = ctx.emitFile({
2731
- type: "asset",
2732
- name: "bundle-graph.json",
2733
- source: JSON.stringify(bundleGraph)
2734
- });
2735
- const bgPath = ctx.getFileName(bgAsset);
2736
- manifest.bundleGraphAsset = bgPath;
2737
- manifest.assets[bgPath] = {
2738
- name: "bundle-graph.json",
2739
- size: bundleGraph.length
2740
- };
2741
- const manifestStr = JSON.stringify(manifest, null, "\t");
2742
- ctx.emitFile({
2743
- fileName: Q_MANIFEST_FILENAME,
2744
- type: "asset",
2745
- source: manifestStr
2746
- });
2747
- "function" === typeof opts.manifestOutput && await opts.manifestOutput(manifest);
2748
- "function" === typeof opts.transformedModuleOutput && await opts.transformedModuleOutput(getTransformedOutputs());
2749
- return manifestStr;
2750
- }
2751
- return {
2752
- buildStart: buildStart,
2753
- createOutputAnalyzer: createOutputAnalyzer,
2754
- getQwikBuildModule: getQwikBuildModule,
2755
- getOptimizer: getOptimizer,
2756
- getOptions: getOptions,
2757
- getPath: getPath,
2758
- getSys: getSys,
2759
- getTransformedOutputs: getTransformedOutputs,
2760
- init: init2,
2761
- load: load,
2762
- debug: debug,
2763
- log: log,
2764
- normalizeOptions: normalizeOptions,
2765
- normalizePath: normalizePath,
2766
- onDiagnostics: onDiagnostics,
2767
- resolveId: resolveId,
2768
- transform: transform,
2769
- validateSource: validateSource,
2770
- setSourceMapSupport: setSourceMapSupport,
2771
- configureServer: configureServer,
2772
- handleHotUpdate: handleHotUpdate,
2773
- manualChunks: manualChunks,
2774
- generateManifest: generateManifest
2775
- };
2776
- }
2777
- var makeNormalizePath = sys => id => {
2778
- if ("string" === typeof id) {
2779
- if (isWin(sys.os)) {
2780
- const isExtendedLengthPath = id.startsWith("\\\\?\\");
2781
- if (!isExtendedLengthPath) {
2782
- const hasNonAscii = /[^\u0000-\u0080]+/.test(id);
2783
- hasNonAscii || (id = id.replace(/\\/g, "/"));
2784
- }
2785
- return sys.path.posix.normalize(id);
2786
- }
2787
- return sys.path.normalize(id);
2788
- }
2789
- return id;
2790
- };
2791
- function isAdditionalFile(mod) {
2792
- return mod.isEntry || mod.segment;
2793
- }
2794
- var TRANSFORM_EXTS = {
2795
- ".jsx": true,
2796
- ".ts": true,
2797
- ".tsx": true
2798
- };
2799
- var TRANSFORM_REGEX = /\.qwik\.[mc]?js$/;
2800
- var QWIK_CORE_ID = "@qwik.dev/core";
2801
- var QWIK_CORE_INTERNAL_ID = "@qwik.dev/core/internal";
2802
- var QWIK_BUILD_ID = "@qwik.dev/core/build";
2803
- var QWIK_JSX_RUNTIME_ID = "@qwik.dev/core/jsx-runtime";
2804
- var QWIK_JSX_DEV_RUNTIME_ID = "@qwik.dev/core/jsx-dev-runtime";
2805
- var QWIK_CORE_SERVER = "@qwik.dev/core/server";
2806
- var QWIK_CLIENT_MANIFEST_ID = "@qwik-client-manifest";
2807
- var QWIK_PRELOADER_ID = "@qwik.dev/core/preloader";
2808
- var QWIK_HANDLERS_ID = "@qwik-handlers";
2809
- var SRC_DIR_DEFAULT = "src";
2810
- var CLIENT_OUT_DIR = "dist";
2811
- var SSR_OUT_DIR = "server";
2812
- var LIB_OUT_DIR = "lib";
2813
- var Q_MANIFEST_FILENAME = "q-manifest.json";
2814
- function qwikRollup(qwikRollupOpts = {}) {
2815
- const qwikPlugin = createQwikPlugin(qwikRollupOpts.optimizerOptions);
2816
- const rollupPlugin = {
2817
- name: "rollup-plugin-qwik",
2818
- api: {
2819
- getOptimizer: () => qwikPlugin.getOptimizer(),
2820
- getOptions: () => qwikPlugin.getOptions()
2821
- },
2822
- async options(inputOpts) {
2823
- var _a;
2824
- await qwikPlugin.init();
2825
- const origOnwarn = inputOpts.onwarn;
2826
- inputOpts.onwarn = (warning, warn) => {
2827
- if ("typescript" === warning.plugin && warning.message.includes("outputToFilesystem")) {
2828
- return;
2829
- }
2830
- origOnwarn ? origOnwarn(warning, warn) : warn(warning);
2831
- };
2832
- const pluginOpts = {
2833
- csr: qwikRollupOpts.csr,
2834
- target: qwikRollupOpts.target,
2835
- buildMode: qwikRollupOpts.buildMode,
2836
- debug: qwikRollupOpts.debug,
2837
- entryStrategy: qwikRollupOpts.entryStrategy,
2838
- rootDir: qwikRollupOpts.rootDir,
2839
- srcDir: qwikRollupOpts.srcDir,
2840
- srcInputs: qwikRollupOpts.srcInputs,
2841
- input: inputOpts.input,
2842
- resolveQwikBuild: true,
2843
- manifestOutput: qwikRollupOpts.manifestOutput,
2844
- manifestInput: qwikRollupOpts.manifestInput,
2845
- transformedModuleOutput: qwikRollupOpts.transformedModuleOutput,
2846
- inlineStylesUpToBytes: null == (_a = qwikRollupOpts.optimizerOptions) ? void 0 : _a.inlineStylesUpToBytes,
2847
- lint: qwikRollupOpts.lint,
2848
- experimental: qwikRollupOpts.experimental
2849
- };
2850
- const opts = qwikPlugin.normalizeOptions(pluginOpts);
2851
- inputOpts.input || (inputOpts.input = opts.input);
2852
- return inputOpts;
2853
- },
2854
- outputOptions: rollupOutputOpts => normalizeRollupOutputOptionsObject(qwikPlugin, rollupOutputOpts, false),
2855
- async buildStart() {
2856
- qwikPlugin.onDiagnostics(((diagnostics, optimizer, srcDir) => {
2857
- diagnostics.forEach((d => {
2858
- const id = qwikPlugin.normalizePath(optimizer.sys.path.join(srcDir, d.file));
2859
- "error" === d.category ? this.error(createRollupError2(id, d)) : this.warn(createRollupError2(id, d));
2860
- }));
2861
- }));
2862
- await qwikPlugin.buildStart(this);
2863
- },
2864
- resolveId(id, importer) {
2865
- if (id.startsWith("\0")) {
2866
- return null;
2867
- }
2868
- return qwikPlugin.resolveId(this, id, importer);
2869
- },
2870
- load(id) {
2871
- if (id.startsWith("\0")) {
2872
- return null;
2873
- }
2874
- return qwikPlugin.load(this, id);
2875
- },
2876
- transform(code, id) {
2877
- if (id.startsWith("\0")) {
2878
- return null;
2879
- }
2880
- return qwikPlugin.transform(this, code, id);
2881
- },
2882
- async generateBundle(_, rollupBundle) {
2883
- const opts = qwikPlugin.getOptions();
2884
- "client" === opts.target && await qwikPlugin.generateManifest(this, rollupBundle);
2885
- }
2886
- };
2887
- return rollupPlugin;
2888
- }
2889
- function normalizeRollupOutputOptions(qwikPlugin, rollupOutputOpts, useAssetsDir, outDir) {
2890
- if (Array.isArray(rollupOutputOpts)) {
2891
- rollupOutputOpts.length || rollupOutputOpts.push({});
2892
- return rollupOutputOpts.map((outputOptsObj => ({
2893
- ...normalizeRollupOutputOptionsObject(qwikPlugin, outputOptsObj, useAssetsDir),
2894
- dir: outDir || outputOptsObj.dir
2895
- })));
2896
- }
2897
- return {
2898
- ...normalizeRollupOutputOptionsObject(qwikPlugin, rollupOutputOpts, useAssetsDir),
2899
- dir: outDir || (null == rollupOutputOpts ? void 0 : rollupOutputOpts.dir)
2900
- };
2901
- }
2902
- function normalizeRollupOutputOptionsObject(qwikPlugin, rollupOutputOptsObj, useAssetsDir) {
2903
- const outputOpts = {
2904
- ...rollupOutputOptsObj
2905
- };
2906
- const opts = qwikPlugin.getOptions();
2907
- const optimizer = qwikPlugin.getOptimizer();
2908
- const manualChunks = qwikPlugin.manualChunks;
2909
- if ("client" === opts.target) {
2910
- if (!outputOpts.assetFileNames) {
2911
- const assetFileNames = "assets/[hash]-[name].[ext]";
2912
- outputOpts.assetFileNames = useAssetsDir ? `${opts.assetsDir}/${assetFileNames}` : assetFileNames;
2913
- }
2914
- let fileName;
2915
- fileName = "production" !== opts.buildMode || opts.debug ? chunkInfo => {
2916
- var _a, _b;
2917
- if (null == (_a = chunkInfo.moduleIds) ? void 0 : _a.some((id => id.endsWith("core.prod.mjs")))) {
2918
- return "build/core.js";
2919
- }
2920
- if (null == (_b = chunkInfo.moduleIds) ? void 0 : _b.some((id => id.endsWith("qwik-router/lib/index.qwik.mjs")))) {
2921
- return "build/qwik-router.js";
2922
- }
2923
- const path = optimizer.sys.path;
2924
- const relativePath = path.relative(optimizer.sys.cwd(), chunkInfo.name);
2925
- const sanitized = relativePath.replace(/^(\.\.\/)+/, "").replace(/^\/+/, "").replace(/\//g, "-");
2926
- return `build/${sanitized}.js`;
2927
- } : "build/q-[hash].js";
2928
- const getFilePath = fileNamePattern => "string" === typeof fileNamePattern ? useAssetsDir ? `${opts.assetsDir}/${fileNamePattern}` : fileNamePattern : useAssetsDir ? chunkInfo => `${opts.assetsDir}/${fileNamePattern(chunkInfo)}` : chunkInfo => fileNamePattern(chunkInfo);
2929
- outputOpts.entryFileNames || (outputOpts.entryFileNames = getFilePath(fileName));
2930
- outputOpts.chunkFileNames || (outputOpts.chunkFileNames = getFilePath(fileName));
2931
- } else {
2932
- "production" === opts.buildMode && (outputOpts.chunkFileNames || (outputOpts.chunkFileNames = "q-[hash].js"));
2933
- }
2934
- outputOpts.assetFileNames || (outputOpts.assetFileNames = "assets/[hash]-[name].[ext]");
2935
- if ("client" === opts.target) {
2936
- outputOpts.format = "es";
2937
- const prevManualChunks = outputOpts.manualChunks;
2938
- if (prevManualChunks && "function" !== typeof prevManualChunks) {
2939
- throw new Error("manualChunks must be a function");
2940
- }
2941
- outputOpts.manualChunks = prevManualChunks ? (id, meta) => prevManualChunks(id, meta) || manualChunks(id, meta) : manualChunks;
2942
- }
2943
- outputOpts.dir || (outputOpts.dir = opts.outDir);
2944
- "cjs" === outputOpts.format && "string" !== typeof outputOpts.exports && (outputOpts.exports = "auto");
2945
- return outputOpts;
2946
- }
2947
- function createRollupError2(id, diagnostic) {
2948
- var _a;
2949
- const loc = null == (_a = diagnostic.highlights) ? void 0 : _a[0];
2950
- const err = Object.assign(new Error(diagnostic.message), {
2951
- id: id,
2952
- plugin: "qwik",
2953
- loc: loc && {
2954
- column: loc.startCol,
2955
- line: loc.startLine
2956
- },
2957
- stack: ""
2958
- });
2959
- return err;
2960
- }
2961
- var QWIK_LOADER_DEFAULT_MINIFIED = 'const t=document,e=window,n=new Set,o=new Set([t]);let r;const s=(t,e)=>Array.from(t.querySelectorAll(e)),i=t=>{const e=[];return o.forEach((n=>e.push(...s(n,t)))),e},a=t=>{v(t),s(t,"[q\\\\:shadowroot]").forEach((t=>{const e=t.shadowRoot;e&&a(e)}))},c=t=>t&&"function"==typeof t.then;let l=!0;const f=(t,e,n=e.type)=>{let o=l;i("[on"+t+"\\\\:"+n+"]").forEach((r=>{o=!0,b(r,t,e,n)})),o||window[t.slice(1)].removeEventListener(n,"-window"===t?d:_)},p=e=>{if(void 0===e._qwikjson_){let n=(e===t.documentElement?t.body:e).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n.getAttribute("type")){e._qwikjson_=JSON.parse(n.textContent.replace(/\\\\x3C(\\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},u=(t,e)=>new CustomEvent(t,{detail:e}),b=async(e,n,o,r=o.type)=>{const s="on"+n+":"+r;e.hasAttribute("preventdefault:"+r)&&o.preventDefault(),e.hasAttribute("stoppropagation:"+r)&&o.stopPropagation();const i=e._qc_,a=i&&i.li.filter((t=>t[0]===s));if(a&&a.length>0){for(const t of a){const n=t[1].getFn([e,o],(()=>e.isConnected))(o,e),r=o.cancelBubble;c(n)&&await n,r&&o.stopPropagation()}return}const l=e.getAttribute(s),f=e.qDispatchEvent;if(f)return f(o,n);if(l){const n=e.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),r=n.getAttribute("q:base"),s=n.getAttribute("q:version")||"unknown",i=n.getAttribute("q:manifest-hash")||"dev",a=new URL(r,t.baseURI);for(const f of l.split("\\n")){const l=new URL(f,a),u=l.href,b=l.hash.replace(/^#?([^?[|]*).*$/,"$1")||"default",h=performance.now();let _,d,w;const m=f.startsWith("#"),y={qBase:r,qManifest:i,qVersion:s,href:u,symbol:b,element:e,reqTime:h};if(m){const e=n.getAttribute("q:instance");_=(t["qFuncs_"+e]||[])[Number.parseInt(b)],_||(d="sync",w=Error("sym:"+b))}else{q("qsymbol",y);const t=l.href.split("#")[0];try{const e=import(t);p(n),_=(await e)[b],_||(d="no-symbol",w=Error(`${b} not in ${t}`))}catch(t){d||(d="async"),w=t}}if(!_){q("qerror",{importError:d,error:w,...y}),console.error(w);break}const v=t.__q_context__;if(e.isConnected)try{t.__q_context__=[e,o,l];const n=_(o,e);c(n)&&await n}catch(t){q("qerror",{error:t,...y})}finally{t.__q_context__=v}}}},q=(e,n)=>{t.dispatchEvent(u(e,n))},h=t=>t.replace(/([A-Z])/g,(t=>"-"+t.toLowerCase())),_=async t=>{let e=h(t.type),n=t.target;for(f("-document",t,e);n&&n.getAttribute;){const o=b(n,"",t,e);let r=t.cancelBubble;c(o)&&await o,r||(r=r||t.cancelBubble||n.hasAttribute("stoppropagation:"+t.type)),n=t.bubbles&&!0!==r?n.parentElement:null}},d=t=>{f("-window",t,h(t.type))},w=()=>{var s;const c=t.readyState;if(!r&&("interactive"==c||"complete"==c)&&(o.forEach(a),r=1,q("qinit"),(null!=(s=e.requestIdleCallback)?s:e.setTimeout).bind(e)((()=>q("qidle"))),n.has("qvisible"))){const t=i("[on\\\\:qvisible]"),e=new IntersectionObserver((t=>{for(const n of t)n.isIntersecting&&(e.unobserve(n.target),b(n.target,"",u("qvisible",n)))}));t.forEach((t=>e.observe(t)))}},m=(t,e,n,o=!1)=>{t.addEventListener(e,n,{capture:o,passive:!1})};let y;const v=(...t)=>{l=!0,clearTimeout(y),y=setTimeout((()=>l=!1),2e4);for(const r of t)"string"==typeof r?n.has(r)||(o.forEach((t=>m(t,r,_,!0))),m(e,r,d,!0),n.add(r)):o.has(r)||(n.forEach((t=>m(r,t,_,!0))),o.add(r))};if(!("__q_context__"in t)){t.__q_context__=0;const r=e.qwikevents;r&&(Array.isArray(r)?v(...r):v("click","input")),e.qwikevents={events:n,roots:o,push:v},m(t,"readystatechange",w),w()}';
2962
- var QWIK_LOADER_DEFAULT_DEBUG = 'const doc = document;\nconst win = window;\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nlet hasInitialized;\nconst nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nconst querySelectorAll = (query) => {\n const elements = [];\n roots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n return elements;\n};\nconst findShadowRoots = (fragment) => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent) => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n });\n};\nconst isPromise = (promise) => promise && typeof promise.then === "function";\nlet doNotClean = true;\nconst broadcast = (infix, ev, type = ev.type) => {\n let found = doNotClean;\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el) => {\n found = true;\n dispatch(el, infix, ev, type);\n });\n if (!found) {\n window[infix.slice(1)].removeEventListener(\n type,\n infix === "-window" ? processWindowEvent : processDocumentEvent\n );\n }\n};\nconst resolveContainer = (containerEl) => {\n if (containerEl._qwikjson_ === void 0) {\n const parentJSON = containerEl === doc.documentElement ? doc.body : containerEl;\n let script = parentJSON.lastElementChild;\n while (script) {\n if (script.tagName === "SCRIPT" && script.getAttribute("type") === "qwik/json") {\n containerEl._qwikjson_ = JSON.parse(\n script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1")\n );\n break;\n }\n script = script.previousElementSibling;\n }\n }\n};\nconst createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail\n});\nconst dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n if (element.hasAttribute("preventdefault:" + eventName)) {\n ev.preventDefault();\n }\n if (element.hasAttribute("stoppropagation:" + eventName)) {\n ev.stopPropagation();\n }\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li) => li[0] === attrName);\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([element, ev], () => element.isConnected)(ev, element);\n const cancelBubble = ev.cancelBubble;\n if (isPromise(results)) {\n await results;\n }\n if (cancelBubble) {\n ev.stopPropagation();\n }\n }\n return;\n }\n const attrValue = element.getAttribute(attrName);\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n if (attrValue) {\n const container = element.closest(\n "[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"\n );\n const qBase = container.getAttribute("q:base");\n const qVersion = container.getAttribute("q:version") || "unknown";\n const qManifest = container.getAttribute("q:manifest-hash") || "dev";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split("\\n")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, "$1") || "default";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith("#");\n const eventData = {\n qBase,\n qManifest,\n qVersion,\n href,\n symbol,\n element,\n reqTime\n };\n if (isSync) {\n const hash = container.getAttribute("q:instance");\n handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = "sync";\n error = new Error("sym:" + symbol);\n }\n } else {\n emitEvent("qsymbol", eventData);\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri\n );\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = "no-symbol";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = "async");\n error = err;\n }\n }\n if (!handler) {\n emitEvent("qerror", {\n importError,\n error,\n ...eventData\n });\n console.error(error);\n break;\n }\n const previousCtx = doc.__q_context__;\n if (element.isConnected) {\n try {\n doc.__q_context__ = [element, ev, url];\n const results = handler(ev, element);\n if (isPromise(results)) {\n await results;\n }\n } catch (error2) {\n emitEvent("qerror", { error: error2, ...eventData });\n } finally {\n doc.__q_context__ = previousCtx;\n }\n }\n }\n }\n};\nconst emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n};\nconst camelToKebab = (str) => str.replace(/([A-Z])/g, (a) => "-" + a.toLowerCase());\nconst processDocumentEvent = async (ev) => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast("-document", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, "", ev, type);\n let cancelBubble = ev.cancelBubble;\n if (isPromise(results)) {\n await results;\n }\n cancelBubble || (cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type));\n element = ev.bubbles && cancelBubble !== true ? element.parentElement : null;\n }\n};\nconst processWindowEvent = (ev) => {\n broadcast("-window", ev, camelToKebab(ev.type));\n};\nconst processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && (readyState == "interactive" || readyState == "complete")) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n const riC = (_a = win.requestIdleCallback) != null ? _a : win.setTimeout;\n riC.bind(win)(() => emitEvent("qidle"));\n if (events.has("qvisible")) {\n const results = querySelectorAll("[on\\\\:qvisible]");\n const observer = new IntersectionObserver((entries) => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, "", createEvent("qvisible", entry));\n }\n }\n });\n results.forEach((el) => observer.observe(el));\n }\n }\n};\nconst addEventListener = (el, eventName, handler, capture = false) => {\n el.addEventListener(eventName, handler, { capture, passive: false });\n};\nlet cleanTimer;\nconst processEventOrNode = (...eventNames) => {\n doNotClean = true;\n clearTimeout(cleanTimer);\n cleanTimer = setTimeout(() => doNotClean = false, 2e4);\n for (const eventNameOrNode of eventNames) {\n if (typeof eventNameOrNode === "string") {\n if (!events.has(eventNameOrNode)) {\n roots.forEach(\n (root) => addEventListener(root, eventNameOrNode, processDocumentEvent, true)\n );\n addEventListener(win, eventNameOrNode, processWindowEvent, true);\n events.add(eventNameOrNode);\n }\n } else {\n if (!roots.has(eventNameOrNode)) {\n events.forEach(\n (eventName) => addEventListener(eventNameOrNode, eventName, processDocumentEvent, true)\n );\n roots.add(eventNameOrNode);\n }\n }\n }\n};\nif (!("__q_context__" in doc)) {\n doc.__q_context__ = 0;\n const qwikevents = win.qwikevents;\n if (qwikevents) {\n if (Array.isArray(qwikevents)) {\n processEventOrNode(...qwikevents);\n } else {\n processEventOrNode("click", "input");\n }\n }\n win.qwikevents = {\n events,\n roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n}';
2963
- var import_bmp = __toESM(require_bmp(), 1);
2964
- var import_cur = __toESM(require_cur(), 1);
2965
- var import_dds = __toESM(require_dds(), 1);
2966
- var import_gif = __toESM(require_gif(), 1);
2967
- var import_icns = __toESM(require_icns(), 1);
2968
- var import_ico = __toESM(require_ico(), 1);
2969
- var import_j2c = __toESM(require_j2c(), 1);
2970
- var import_jp2 = __toESM(require_jp2(), 1);
2971
- var import_jpg = __toESM(require_jpg(), 1);
2972
- var import_ktx = __toESM(require_ktx(), 1);
2973
- var import_png = __toESM(require_png(), 1);
2974
- var import_pnm = __toESM(require_pnm(), 1);
2975
- var import_psd = __toESM(require_psd(), 1);
2976
- var import_svg = __toESM(require_svg(), 1);
2977
- var import_tga = __toESM(require_tga(), 1);
2978
- var import_webp = __toESM(require_webp(), 1);
2979
- var import_heif = __toESM(require_heif(), 1);
2980
- var firstBytes = {
2981
- 56: "psd",
2982
- 66: "bmp",
2983
- 68: "dds",
2984
- 71: "gif",
2985
- 82: "webp",
2986
- 105: "icns",
2987
- 137: "png",
2988
- 255: "jpg"
2989
- };
2990
- var types = {
2991
- webp: import_webp.default.WEBP,
2992
- jpg: import_jpg.default.JPG,
2993
- png: import_png.default.PNG,
2994
- svg: import_svg.default.SVG,
2995
- gif: import_gif.default.GIF,
2996
- avif: import_heif.default.HEIF,
2997
- bmp: import_bmp.default.BMP,
2998
- cur: import_cur.default.CUR,
2999
- dds: import_dds.default.DDS,
3000
- icns: import_icns.default.ICNS,
3001
- ico: import_ico.default.ICO,
3002
- j2c: import_j2c.default.J2C,
3003
- jp2: import_jp2.default.JP2,
3004
- ktx: import_ktx.default.KTX,
3005
- pnm: import_pnm.default.PNM,
3006
- psd: import_psd.default.PSD,
3007
- tga: import_tga.default.TGA
3008
- };
3009
- var keys = Object.keys(types);
3010
- function detector(buffer) {
3011
- const byte = buffer[0];
3012
- const type = firstBytes[byte];
3013
- if (type && types[type].validate(buffer)) {
3014
- return type;
3015
- }
3016
- return keys.find((key => types[key].validate(buffer)));
3017
- }
3018
- function lookup(buffer) {
3019
- const type = detector(buffer);
3020
- if ("undefined" !== typeof type) {
3021
- const size = types[type].calculate(buffer);
3022
- if (void 0 !== size) {
3023
- size.type = type;
3024
- return size;
3025
- }
3026
- }
3027
- }
3028
- async function getInfoForSrc(src) {
3029
- if (!/^(https?|file|capacitor):/.test(src)) {
3030
- return;
3031
- }
3032
- try {
3033
- const res = await fetch(src, {
3034
- headers: {
3035
- Accept: "image/*,*/*"
3036
- }
3037
- });
3038
- if (!res.ok) {
3039
- console.error("can not fetch", src);
3040
- return;
3041
- }
3042
- const buffer = await res.arrayBuffer();
3043
- const size = lookup(Buffer.from(buffer));
3044
- if (size) {
3045
- return {
3046
- width: size.width,
3047
- height: size.height,
3048
- type: size.type,
3049
- size: buffer.byteLength
3050
- };
3051
- }
3052
- } catch (err) {
3053
- console.error(err);
3054
- return;
3055
- }
3056
- }
3057
- var getImageSizeServer = (sys, rootDir, srcDir) => async (req, res, next) => {
3058
- try {
3059
- const fs = await sys.dynamicImport("node:fs");
3060
- const path = await sys.dynamicImport("node:path");
3061
- const url = new URL(req.url, "http://localhost:3000/");
3062
- if ("GET" === req.method && "/__image_info" === url.pathname) {
3063
- const imageURL = url.searchParams.get("url");
3064
- res.setHeader("content-type", "application/json");
3065
- if (imageURL) {
3066
- const info = await getInfoForSrc(imageURL);
3067
- res.setHeader("cache-control", "public, max-age=31536000, immutable");
3068
- info ? res.write(JSON.stringify(info)) : res.statusCode = 404;
3069
- } else {
3070
- res.statusCode = 500;
3071
- const info = {
3072
- message: "error"
3073
- };
3074
- res.write(JSON.stringify(info));
3075
- }
3076
- res.end();
3077
- return;
3078
- }
3079
- if ("POST" === req.method && "/__image_fix" === url.pathname) {
3080
- const loc = url.searchParams.get("loc");
3081
- const width = url.searchParams.get("width");
3082
- const height = url.searchParams.get("height");
3083
- const src = url.searchParams.get("src");
3084
- const currentHref = url.searchParams.get("currentHref");
3085
- const locParts = loc.split(":");
3086
- const column = parseInt(locParts[locParts.length - 1], 10) - 1;
3087
- let line = parseInt(locParts[locParts.length - 2], 10) - 1;
3088
- const filePath = path.resolve(srcDir, locParts.slice(0, locParts.length - 2).join(":"));
3089
- const extension = path.extname(filePath).toLowerCase();
3090
- const buffer = fs.readFileSync(filePath);
3091
- let text = buffer.toString("utf-8");
3092
- let offset = 0;
3093
- for (;offset < text.length; offset++) {
3094
- if (0 === line) {
3095
- offset += column;
3096
- break;
3097
- }
3098
- if ("\n" === text[offset]) {
3099
- line--;
3100
- continue;
3101
- }
3102
- }
3103
- if ("<img" !== text.slice(offset, offset + 4)) {
3104
- console.error("Could not apply auto fix, because it was not possible to find the original <img> tag");
3105
- res.statusCode = 500;
3106
- return;
3107
- }
3108
- const end = text.indexOf(">", offset) + 1;
3109
- if (end < offset) {
3110
- console.error("Could not apply auto fix, because it was not possible to find the original <img> tag");
3111
- res.statusCode = 500;
3112
- return;
3113
- }
3114
- const extensionSupportsImport = [ ".ts", ".tsx", ".js", ".jsx", ".mdx" ].includes(extension);
3115
- let imgTag = text.slice(offset, end);
3116
- if (src && currentHref && extensionSupportsImport) {
3117
- const urlSrc = new URL(src);
3118
- const urlCurrent = new URL(currentHref);
3119
- if (urlSrc.origin === urlCurrent.origin) {
3120
- const publicImagePath = path.join(rootDir, "public", urlSrc.pathname);
3121
- const rootImagePath = path.join(rootDir, urlSrc.pathname);
3122
- let relativeLocation;
3123
- if (fs.existsSync(publicImagePath)) {
3124
- const mediaSrc = path.join(srcDir, "media", path.dirname(urlSrc.pathname));
3125
- await fs.promises.mkdir(mediaSrc, {
3126
- recursive: true
3127
- });
3128
- await fs.promises.copyFile(publicImagePath, path.join(srcDir, "media", urlSrc.pathname));
3129
- relativeLocation = "~/media" + urlSrc.pathname;
3130
- } else {
3131
- if (!fs.existsSync(rootImagePath)) {
3132
- return;
3133
- }
3134
- relativeLocation = urlSrc.pathname.replace("/src/", "~/");
3135
- }
3136
- const importIdent = imgImportName(urlSrc.pathname);
3137
- const importSrc = `${relativeLocation}?jsx`;
3138
- imgTag = imgTag.replace(/^<img/, `<${importIdent}`);
3139
- imgTag = imgTag.replace(/\bwidth=(({[^}]*})|('[^']*')|("[^"]*"))\s*/, "");
3140
- imgTag = imgTag.replace(/\bheight=(({[^}]*})|('[^']*')|("[^"]*"))\s*/, "");
3141
- imgTag = imgTag.replace(/\bsrc=(({[^}]*})|('[^']*')|("[^"]*"))\s*/, "");
3142
- let insertImport = 0;
3143
- if (".mdx" === extension && text.startsWith("---")) {
3144
- insertImport = text.indexOf("---", 4) + 3;
3145
- if (-1 === insertImport) {
3146
- return;
3147
- }
3148
- }
3149
- const newImport = `\nimport ${importIdent} from '${importSrc}';`;
3150
- text = `${text.slice(0, insertImport)}${newImport}${text.slice(insertImport, offset)}${imgTag}${text.slice(end)}`;
3151
- fs.writeFileSync(filePath, text);
3152
- return;
3153
- }
3154
- }
3155
- imgTag = imgTag.replace(/\bwidth=(({[^}]*})|('[^']*')|("[^"]*"))/, `width="${width}"`);
3156
- imgTag = imgTag.replace(/\bheight=(({[^}]*})|('[^']*')|("[^"]*"))/, `height="${height}"`);
3157
- imgTag.includes("height=") || (imgTag = imgTag.replace(/<img/, `<img height="${height}"`));
3158
- imgTag.includes("width=") || (imgTag = imgTag.replace(/<img/, `<img width="${width}"`));
3159
- text = text.slice(0, offset) + imgTag + text.slice(end);
3160
- fs.writeFileSync(filePath, text);
3161
- } else {
3162
- next();
3163
- }
3164
- } catch (e) {
3165
- e instanceof Error && await formatError(sys, e);
3166
- next(e);
3167
- }
3168
- };
3169
- function imgImportName(value) {
3170
- const dot = value.lastIndexOf(".");
3171
- const slash = value.lastIndexOf("/");
3172
- value = value.substring(slash + 1, dot);
3173
- return `Img${toPascalCase(value)}`;
3174
- }
3175
- function toPascalCase(string) {
3176
- return `${string}`.toLowerCase().replace(new RegExp(/[-_]+/, "g"), " ").replace(new RegExp(/[^\w\s]/, "g"), "").replace(new RegExp(/\s+(.)(\w*)/, "g"), (($1, $2, $3) => `${$2.toUpperCase() + $3}`)).replace(new RegExp(/\w/), (s => s.toUpperCase()));
3177
- }
3178
- var FORCE_COLOR;
3179
- var NODE_DISABLE_COLORS;
3180
- var NO_COLOR;
3181
- var TERM;
3182
- var isTTY = true;
3183
- if ("undefined" !== typeof process) {
3184
- ({FORCE_COLOR: FORCE_COLOR, NODE_DISABLE_COLORS: NODE_DISABLE_COLORS, NO_COLOR: NO_COLOR, TERM: TERM} = process.env || {});
3185
- isTTY = process.stdout && process.stdout.isTTY;
3186
- }
3187
- var $ = {
3188
- enabled: !NODE_DISABLE_COLORS && null == NO_COLOR && "dumb" !== TERM && (null != FORCE_COLOR && "0" !== FORCE_COLOR || isTTY)
3189
- };
3190
- function init(x, y) {
3191
- let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
3192
- let open = `[${x}m`, close = `[${y}m`;
3193
- return function(txt) {
3194
- if (!$.enabled || null == txt) {
3195
- return txt;
3196
- }
3197
- return open + (!~("" + txt).indexOf(close) ? txt : txt.replace(rgx, close + open)) + close;
3198
- };
3199
- }
3200
- init(0, 0);
3201
- init(1, 22);
3202
- init(2, 22);
3203
- init(3, 23);
3204
- init(4, 24);
3205
- init(7, 27);
3206
- init(8, 28);
3207
- init(9, 29);
3208
- init(30, 39);
3209
- init(31, 39);
3210
- init(32, 39);
3211
- init(33, 39);
3212
- init(34, 39);
3213
- var magenta = init(35, 39);
3214
- init(36, 39);
3215
- init(37, 39);
3216
- init(90, 39);
3217
- init(90, 39);
3218
- init(40, 49);
3219
- init(41, 49);
3220
- init(42, 49);
3221
- init(43, 49);
3222
- init(44, 49);
3223
- init(45, 49);
3224
- init(46, 49);
3225
- init(47, 49);
3226
- var click_to_component_default = "<style>\n #qwik-inspector-overlay {\n position: fixed;\n background: rgba(24, 182, 246, 0.27);\n pointer-events: none;\n box-sizing: border-box;\n border: 2px solid rgba(172, 126, 244, 0.46);\n border-radius: 4px;\n contain: strict;\n cursor: pointer;\n z-index: 999999;\n }\n #qwik-inspector-info-popup {\n position: fixed;\n bottom: 10px;\n right: 10px;\n font-family: monospace;\n background: #000000c2;\n color: white;\n padding: 10px 20px;\n border-radius: 8px;\n box-shadow:\n 0 20px 25px -5px rgb(0 0 0 / 34%),\n 0 8px 10px -6px rgb(0 0 0 / 24%);\n backdrop-filter: blur(4px);\n -webkit-animation: fadeOut 0.3s 3s ease-in-out forwards;\n animation: fadeOut 0.3s 3s ease-in-out forwards;\n z-index: 999999;\n contain: layout;\n }\n #qwik-inspector-info-popup p {\n margin: 0px;\n }\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n visibility: hidden;\n }\n }\n</style>\n<div id=\"qwik-inspector-info-popup\" aria-hidden=\"true\">Click-to-Source</div>\n<script>\n (function () {\n const inspectAttribute = 'data-qwik-inspector';\n const hotKeys = globalThis.qwikdevtools.hotKeys;\n const srcDir = globalThis.qwikdevtools.srcDir;\n document.querySelector('#qwik-inspector-info-popup').textContent =\n `Click-to-Source: ${hotKeys.join(' + ')}`;\n console.debug(\n '%c🔍 Qwik Click-To-Source',\n 'background: #564CE0; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;',\n `Hold-press the '${hotKeys.join(' + ')}' key${\n (hotKeys.length > 1 && 's') || ''\n } and click a component to jump directly to the source code in your IDE!`\n );\n window.__qwik_inspector_state = {\n pressedKeys: new Set(),\n };\n const origin = 'http://local.local';\n const body = document.body;\n const overlay = document.createElement('div');\n overlay.id = 'qwik-inspector-overlay';\n overlay.setAttribute('aria-hidden', 'true');\n body.appendChild(overlay);\n\n function findContainer(el) {\n if (el && el instanceof Element) {\n return el.closest(`[${inspectAttribute}]`);\n }\n return null;\n }\n\n document.addEventListener(\n 'keydown',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.add(event.code);\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'keyup',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.delete(event.code);\n updateOverlay();\n },\n { capture: true }\n );\n\n window.addEventListener(\n 'blur',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.clear();\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'mouseover',\n (event) => {\n const target = findContainer(event.target);\n if (target) {\n window.__qwik_inspector_state.hoveredElement = target;\n } else {\n window.__qwik_inspector_state.hoveredElement = undefined;\n }\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'click',\n (event) => {\n if (isActive()) {\n window.__qwik_inspector_state.pressedKeys.clear();\n const target = findContainer(event.target);\n if (target) {\n event.preventDefault();\n const inspectUrl = target.getAttribute(inspectAttribute);\n if (inspectUrl !== 'false') {\n body.style.setProperty('cursor', 'progress');\n qwikOpenInEditor(inspectUrl);\n }\n }\n }\n },\n { capture: true }\n );\n\n globalThis.qwikOpenInEditor = function (path) {\n const isWindows = navigator.platform.includes('Win');\n const resolvedURL = new URL(path, isWindows ? origin : srcDir);\n if (resolvedURL.origin === origin) {\n const params = new URLSearchParams();\n const prefix = isWindows ? srcDir : '';\n params.set('file', prefix + resolvedURL.pathname);\n fetch('/__open-in-editor?' + params.toString());\n } else {\n location.href = resolvedURL.href;\n }\n };\n document.addEventListener(\n 'contextmenu',\n (event) => {\n if (isActive()) {\n window.__qwik_inspector_state.pressedKeys.clear();\n const target = findContainer(event.target);\n if (target) {\n event.preventDefault();\n }\n }\n },\n { capture: true }\n );\n\n function updateOverlay() {\n const hoverElement = window.__qwik_inspector_state.hoveredElement;\n if (hoverElement && isActive()) {\n const rect = hoverElement.getBoundingClientRect();\n overlay.style.setProperty('height', rect.height + 'px');\n overlay.style.setProperty('width', rect.width + 'px');\n overlay.style.setProperty('top', rect.top + 'px');\n overlay.style.setProperty('left', rect.left + 'px');\n overlay.style.setProperty('visibility', 'visible');\n body.style.setProperty('cursor', 'pointer');\n } else {\n overlay.style.setProperty('height', '0px');\n overlay.style.setProperty('width', '0px');\n overlay.style.setProperty('visibility', 'hidden');\n body.style.removeProperty('cursor');\n }\n }\n\n function checkKeysArePressed() {\n const activeKeys = Array.from(window.__qwik_inspector_state.pressedKeys).map((key) =>\n key ? key.replace(/(Left|Right)$/g, '') : undefined\n );\n return hotKeys.every((key) => activeKeys.includes(key));\n }\n\n function isActive() {\n return checkKeysArePressed();\n }\n window.addEventListener('resize', updateOverlay);\n document.addEventListener('scroll', updateOverlay);\n })();\n<\/script>\n";
3227
- var error_host_default = "<script>\n document.addEventListener('qerror', (ev) => {\n const ErrorOverlay = customElements.get('vite-error-overlay');\n if (!ErrorOverlay) {\n return;\n }\n const err = ev.detail.error;\n const overlay = new ErrorOverlay(err);\n document.body.appendChild(overlay);\n });\n<\/script>\n<script>\n /**\n * Usage:\n *\n * <errored-host></errored-host>\n */\n class ErroredHost extends HTMLElement {\n get _root() {\n return this.shadowRoot || this;\n }\n\n constructor() {\n super();\n const self = this;\n\n this.state = {};\n if (!this.props) {\n this.props = {};\n }\n\n this.componentProps = ['children', 'error'];\n\n // used to keep track of all nodes created by show/for\n this.nodesToDestroy = [];\n // batch updates\n this.pendingUpdate = false;\n\n this.attachShadow({ mode: 'open' });\n }\n\n destroyAnyNodes() {\n // destroy current view template refs before rendering again\n this.nodesToDestroy.forEach((el) => el.remove());\n this.nodesToDestroy = [];\n }\n\n connectedCallback() {\n this.getAttributeNames().forEach((attr) => {\n const jsVar = attr.replace(/-/g, '');\n const regexp = new RegExp(jsVar, 'i');\n this.componentProps.forEach((prop) => {\n if (regexp.test(prop)) {\n const attrValue = this.getAttribute(attr);\n if (this.props[prop] !== attrValue) {\n this.props[prop] = attrValue;\n }\n }\n });\n });\n\n this._root.innerHTML = `\n\n <template data-el=\"show-errored-host\">\n <div class=\"error\">\n <template data-el=\"div-errored-host-2\">\n \x3c!-- String(props.error) --\x3e\n </template>\n </div>\n </template>\n\n <div class=\"arrow\">👇 Uncaught error happened here 👇\n <span class=\"dev-tools\">DevTools: Cmd+Alt+I</span>\n </div>\n <div class=\"div\">\n <slot></slot>\n </div>\n\n <style>\n .error {\n border-radius: 5px 5px 0px 0;\n background: black;\n color: white;\n font-family: monospace;\n font-size: 12px;\n margin: 0;\n padding: 10px;\n }\n .arrow {\n background: #f47e81;\n color: black;\n font-size: 14px;\n padding: 10px;\n text-align: center;\n font-family: sans-serif;\n }\n .dev-tools {\n background: red;\n padding: 2px 5px;\n border-radius: 3px;\n font-weight: 800;\n }\n .div {\n outline: 5px solid red;\n border-radius: 10px;\n }\n </style>`;\n this.pendingUpdate = true;\n\n this.render();\n this.onMount();\n this.pendingUpdate = false;\n this.update();\n }\n\n showContent(el) {\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement/content\n // grabs the content of a node that is between <template> tags\n // iterates through child nodes to register all content including text elements\n // attaches the content after the template\n\n const elementFragment = el.content.cloneNode(true);\n const children = Array.from(elementFragment.childNodes);\n children.forEach((child) => {\n if (el?.scope) {\n child.scope = el.scope;\n }\n if (el?.context) {\n child.context = el.context;\n }\n this.nodesToDestroy.push(child);\n });\n el.after(elementFragment);\n }\n\n onMount() {}\n\n onUpdate() {}\n\n update() {\n if (this.pendingUpdate === true) {\n return;\n }\n this.pendingUpdate = true;\n this.render();\n this.onUpdate();\n this.pendingUpdate = false;\n }\n\n render() {\n // re-rendering needs to ensure that all nodes generated by for/show are refreshed\n this.destroyAnyNodes();\n this.updateBindings();\n }\n\n updateBindings() {\n this._root.querySelectorAll(\"[data-el='show-errored-host']\").forEach((el) => {\n const whenCondition = this.props.error;\n if (whenCondition) {\n this.showContent(el);\n }\n });\n\n this._root.querySelectorAll(\"[data-el='div-errored-host-2']\").forEach((el) => {\n this.renderTextNode(el, String(this.props.error));\n });\n }\n\n // Helper to render content\n renderTextNode(el, text) {\n const textNode = document.createTextNode(text);\n if (el?.scope) {\n textNode.scope = el.scope;\n }\n if (el?.context) {\n textNode.context = el.context;\n }\n el.after(textNode);\n this.nodesToDestroy.push(el.nextSibling);\n }\n }\n\n customElements.define('errored-host', ErroredHost);\n<\/script>\n";
3228
- var image_size_runtime_default = "<style>\n [data-qwik-cls] {\n outline: 2px solid red;\n }\n [data-qwik-cls]::after {\n position: absolute;\n font-size: 12px;\n content: 'CLS ' attr(data-qwik-cls);\n font-family: monospace;\n font-weight: bold;\n background: red;\n color: white;\n margin: -2px;\n padding: 1px;\n line-height: 1;\n pointer-events: none;\n }\n #qwik-image-warning-container {\n position: absolute !important;\n top: 0 !important;\n left: 0 !important;\n width: 0 !important;\n overflow: visible !important;\n height: 0 !important;\n pointer-events: none !important;\n contain: size layout style content;\n z-index: 1;\n }\n</style>\n<template id=\"qwik-image-warning-template\">\n <style>\n :host {\n position: absolute;\n border: 1px solid red;\n pointer-events: none;\n z-index: 1;\n contain: layout size;\n }\n\n #icon {\n border: 0;\n margin: 5px;\n color: black;\n max-width: 100%;\n width: 20px;\n background: yellow;\n border-radius: 100%;\n height: 20px;\n padding: 3px;\n pointer-events: all;\n cursor: pointer;\n }\n\n #icon svg {\n width: 100%;\n height: auto;\n pointer-events: none;\n }\n\n dialog {\n padding: 0;\n border: 0;\n margin: 0 5px;\n background: #ffffe8;\n color: black;\n width: 250px;\n font-size: 11px;\n position: absolute;\n inset-inline-start: unset;\n inset-inline-end: unset;\n border-radius: 5px;\n pointer-events: all;\n overflow: hidden;\n box-shadow: 0px -2px 20px 0px #0000002e;\n z-index: 10000;\n }\n\n .top {\n bottom: calc(100% + 5px);\n }\n .bottom {\n top: 40px;\n }\n .right {\n inset-inline-start: 0;\n inset-inline-end: unset;\n }\n .left {\n inset-inline-start: unset;\n inset-inline-end: calc(100% - 40px);\n }\n\n .content {\n padding: 5px;\n }\n\n #loc {\n background: #2e3801;\n color: #d2d2d2;\n font-family: monospace;\n padding: 3px 5px;\n pointer-events: all;\n margin: 0;\n border: 0;\n cursor: pointer;\n font-size: 11px;\n width: calc(100% - 24px);\n text-overflow: ellipsis;\n overflow: hidden;\n display: block;\n direction: rtl;\n text-align: right;\n }\n #loc:hover {\n background: #3a4a01;\n }\n\n pre {\n background: #f1fb8e;\n padding: 5px;\n margin: 5px 0;\n border-radius: 3px;\n user-select: none;\n }\n\n pre span {\n user-select: all;\n }\n\n a {\n text-decoration: underline;\n }\n\n #close {\n border: 0;\n width: 25px;\n height: 25px;\n position: absolute;\n right: 0;\n top: 0;\n background: #ffe14f;\n color: black;\n font-weight: 900;\n padding: 0;\n margin: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n line-height: 1;\n cursor: pointer;\n }\n #close:hover {\n background: #ffeb6f;\n }\n\n #action-btn {\n border: 2px solid #18ae00;\n padding: 2px 4px;\n background: #50ff50;\n border-radius: 5px;\n color: #0c5500;\n font-weight: 800;\n font-size: 10px;\n cursor: pointer;\n }\n\n p {\n margin: 5px 0;\n }\n\n h2 {\n font-weight: 900;\n margin: 10px 0;\n }\n </style>\n <button id=\"icon\" type=\"button\" aria-label=\"Open image dev dialog\">\n <svg width=\"32\" height=\"32\" viewBox=\"0 0 24 24\">\n <path\n fill=\"currentColor\"\n d=\"M2.725 21q-.275 0-.5-.138t-.35-.362q-.125-.225-.138-.488t.138-.512l9.25-16q.15-.25.388-.375T12 3q.25 0 .488.125t.387.375l9.25 16q.15.25.138.513t-.138.487q-.125.225-.35.363t-.5.137H2.725ZM12 18q.425 0 .713-.288T13 17q0-.425-.288-.713T12 16q-.425 0-.713.288T11 17q0 .425.288.713T12 18Zm0-3q.425 0 .713-.288T13 14v-3q0-.425-.288-.713T12 10q-.425 0-.713.288T11 11v3q0 .425.288.713T12 15Z\"\n />\n </svg>\n </button>\n <dialog>\n <form method=\"dialog\">\n <button id=\"close\" type=\"submit\" aria-label=\"Close\">X</button>\n </form>\n <button id=\"loc\"></button>\n <div class=\"content\">\n <h2 id=\"title\"></h2>\n <p id=\"message\"></p>\n <p class=\"action-container\"></p>\n </div>\n </dialog>\n</template>\n<div id=\"qwik-image-warning-container\"></div>\n<script>\n (function () {\n function getPositionClasses(target) {\n const { x, y } = target.getBoundingClientRect();\n const windowWidth = window.innerWidth;\n let horizontal = 'right';\n let vertical = 'bottom';\n if (x > windowWidth - 260) {\n horizontal = 'left';\n }\n return `${vertical} ${horizontal}`;\n }\n class ImageWarning extends HTMLElement {\n #actionFn = null;\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(\n document.importNode(document.getElementById('qwik-image-warning-template').content, true)\n );\n const dialog = this.shadowRoot.querySelector('dialog');\n\n this.shadowRoot.addEventListener('click', async (ev) => {\n const target = ev.target;\n if (target.nodeName === 'BUTTON') {\n if (target.id === 'action-btn') {\n if (this.#actionFn) {\n this.#actionFn();\n dialog.close();\n }\n } else if (target.id === 'icon') {\n if (dialog.open) {\n dialog.close();\n } else {\n dialog.className = getPositionClasses(target);\n dialog.show();\n }\n } else if (target.id === 'loc' && target.dataset.url) {\n globalThis.qwikOpenInEditor(target.dataset.url);\n }\n }\n });\n }\n\n set loc(value) {\n const anchor = this.shadowRoot.querySelector('#loc');\n anchor.textContent = value;\n if (globalThis.qwikOpenInEditor) {\n anchor.dataset.url = value;\n }\n }\n\n set header(value) {\n this.shadowRoot.querySelector('#title').textContent = value;\n }\n\n set message(value) {\n this.shadowRoot.querySelector('#message').innerHTML = value;\n }\n\n set actionFn(value) {\n this.#actionFn = value;\n }\n set actionName(value) {\n if (value) {\n this.shadowRoot.querySelector('.action-container').innerHTML =\n `<button id=\"action-btn\" type=\"button\">${value}</button>`;\n }\n }\n }\n customElements.define('image-warning', ImageWarning);\n\n const shiftsMap = new Map();\n const visibleNodes = new Map();\n const imageContainer = document.querySelector('#qwik-image-warning-container');\n let skip = false;\n\n async function _getInfo(originalSrc) {\n // Put all supported protocols here, see also packages/qwik/src/optimizer/src/plugins/image-size-server.ts\n if (!/^(https?|file|capacitor):/.test(originalSrc)) {\n return undefined;\n }\n const url = new URL('/__image_info', location.href);\n url.searchParams.set('url', originalSrc);\n const res = await fetch(url);\n if (res.ok) {\n return await res.json();\n } else {\n return null;\n }\n }\n\n const map = new Map();\n function getInfo(originalSrc) {\n let p = map.get(originalSrc);\n if (typeof p === 'undefined') {\n p = _getInfo(originalSrc);\n map.set(originalSrc, p);\n }\n return p;\n }\n function isDefinedUnit(value) {\n return value.endsWith('px');\n }\n async function doImg(node) {\n const scrollX = window.scrollX;\n const scrollY = window.scrollY;\n const rect = node.getBoundingClientRect();\n const originalSrc = node.currentSrc;\n const info = await getInfo(originalSrc);\n let overlay = visibleNodes.get(node);\n const wideScreen = window.innerWidth > 500;\n if (info && wideScreen) {\n let layoutInvalidation = false;\n const loc = node.getAttribute('data-qwik-inspector');\n const browserArea = rect.width * rect.height;\n if (!node.hasAttribute('width') || !node.hasAttribute('height')) {\n skip = true;\n const computedStyles = getComputedStyle(node);\n const hasAspect = computedStyles.getPropertyValue('aspect-ratio').toString() !== 'auto';\n const hasWidth = isDefinedUnit(computedStyles.getPropertyValue('width').toString());\n const hasHeight = isDefinedUnit(computedStyles.getPropertyValue('height').toString());\n const isAbsolute = computedStyles.getPropertyValue('position').toString() === 'absolute';\n layoutInvalidation =\n browserArea > 1000 && !isAbsolute && !hasAspect && (!hasWidth || !hasHeight);\n }\n const realArea = info.width && info.height;\n const threshholdArea = realArea * 0.5;\n const tooBig = browserArea < threshholdArea && info.type !== 'svg';\n skip = false;\n if (layoutInvalidation || tooBig) {\n if (!overlay) {\n overlay = document.createElement('image-warning');\n imageContainer.appendChild(overlay);\n visibleNodes.set(node, overlay);\n }\n overlay.style.top = rect.top + scrollY + 'px';\n overlay.style.left = rect.left + scrollX + 'px';\n overlay.style.width = rect.width + 'px';\n overlay.style.height = rect.height + 'px';\n overlay.info = info;\n overlay.loc = loc;\n if (layoutInvalidation) {\n const clipBoard = `width=\"${info.width}\" height=\"${info.height}\"`;\n overlay.header = 'Perf: layout shift';\n overlay.message = `Image\\'s size is unknown until it\\'s loaded, <a href=\"https://web.dev/cls/\" target=\"_blank\" rel=\"noopener noreferrer\">causing layout shift</a>.</p><p>To solve this problem set the width/height in the img tag:</p><pre>&lt;img <span>${clipBoard}</span></pre>`;\n const uniqueLoc =\n document.querySelectorAll('[data-qwik-inspector=\"' + loc + '\"]').length === 1;\n if (loc) {\n if (uniqueLoc) {\n overlay.actionName = 'Auto fix';\n overlay.actionFn = async () => {\n const url = new URL('/__image_fix', location.href);\n url.searchParams.set('loc', loc);\n url.searchParams.set('width', info.width);\n url.searchParams.set('height', info.height);\n if (!node.srcset) {\n url.searchParams.set('src', node.currentSrc);\n url.searchParams.set('currentHref', location.href);\n }\n await fetch(url, {\n method: 'POST',\n });\n };\n } else {\n overlay.actionName = 'Open in editor';\n overlay.actionFn = async () => {\n await navigator.clipboard.writeText(clipBoard);\n globalThis.qwikOpenInEditor(loc);\n };\n }\n }\n } else if (tooBig) {\n overlay.header = 'Perf: properly size image';\n overlay.message = `The image is too big, <a href=\"https://developer.chrome.com/en/docs/lighthouse/performance/uses-responsive-images/\" target=\"_blank\" rel=\"noopener noreferrer\">hurting performance</a>, it should be resized to the size it\\'s displayed at. The image dimensions are ${info.width} x ${info.height} but it\\'s displayed at ${rect.width}x${rect.height}.</p>`;\n }\n return;\n }\n }\n\n if (overlay) {\n overlay.remove();\n visibleNodes.delete(node);\n }\n }\n\n async function updateImg(node) {\n const overlay = visibleNodes.get(node);\n if (!node.isConnected) {\n if (overlay) {\n overlay.remove();\n visibleNodes.delete(node);\n }\n } else if (node.complete) {\n doImg(node);\n }\n }\n\n const resizeObserver = new ResizeObserver((entries) => {\n if (!skip) {\n for (const entry of entries) {\n updateImg(entry.target);\n }\n }\n });\n\n const observer = new MutationObserver((entry) => {\n for (const mutation of entry) {\n for (const node of mutation.addedNodes) {\n if (node.nodeName === 'IMG') {\n resizeObserver.observe(node);\n } else if (node.nodeType === 1) {\n node.querySelectorAll('img').forEach((img) => {\n resizeObserver.observe(img);\n });\n }\n }\n for (const node of mutation.removedNodes) {\n if (node.nodeName === 'IMG') {\n updateImg(node);\n resizeObserver.unobserve(node);\n } else if (node.nodeType === 1) {\n node.querySelectorAll('img').forEach((img) => {\n updateImg(img);\n resizeObserver.unobserve(img);\n });\n }\n }\n }\n });\n let perfObserver;\n let DCLS = 0;\n const activate = () => {\n setTimeout(() => {\n if (perfObserver) {\n perfObserver.disconnect();\n if (DCLS > 0.005) {\n console.error('Detected Layout Shift during page load', DCLS);\n }\n }\n observer.observe(document.body, {\n childList: true,\n subtree: true,\n });\n document.body.querySelectorAll('img').forEach((node) => {\n resizeObserver.observe(node);\n });\n }, 100);\n };\n if (document.readyState === 'complete') {\n activate();\n } else {\n window.addEventListener('load', activate);\n }\n const pageAccessedByReload =\n performance?.navigation.type === 1 ||\n performance\n .getEntriesByType('navigation')\n .map((nav) => nav.type)\n .includes('reload');\n if (typeof PerformanceObserver !== 'undefined' && !pageAccessedByReload) {\n const shiftsMap = new Map();\n perfObserver = new PerformanceObserver((list) => {\n list.getEntries().forEach((entry) => {\n if (entry.hadRecentInput) {\n return; // Ignore shifts after recent input.\n }\n if (entry.value > 0.006) {\n for (const source of entry.sources) {\n if (\n source.node &&\n source.node.nodeType === 1 &&\n source.node.nodeName !== 'IMAGE-WARNING'\n ) {\n source.node.setAttribute('data-qwik-cls', Number(entry.value).toFixed(3));\n }\n }\n }\n DCLS += entry.value;\n });\n });\n perfObserver.observe({ type: 'layout-shift', buffered: true });\n }\n })();\n<\/script>\n";
3229
- var perf_warning_default = "<script>\n if (!window.__qwikViteLog) {\n window.__qwikViteLog = true;\n console.debug(\n '%c⭐️ Qwik Dev SSR Mode',\n 'background: #0c75d2; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;',\n \"App is running in SSR development mode!\\n - Additional JS is loaded by Vite for debugging and live reloading\\n - Rendering performance might not be optimal\\n - Delayed interactivity because prefetching is disabled\\n - Vite dev bundles do not represent production output\\n\\nProduction build can be tested running 'npm run preview'\"\n );\n }\n<\/script>\n";
3230
- var VITE_ERROR_OVERLAY_STYLES = "\nvite-error-overlay {\n --color-bright: rgba(255, 255, 255, 0.8);\n --color-yellow: rgba(255,246,85,0.8);\n --qwik-dark-blue: #006ce9;\n --qwik-light-blue: #3ec2f7;\n --qwik-light-purple: #ac7ff4;\n --qwik-dark-purple: #713fc2;\n --yellow: #fff; /* override vite yellow */\n --purple: var(--color-bright); /* override vite purple */\n --red: var(--qwik-light-blue); /* override vite red */\n\n --vertical-box-spacing: 15px;\n --box-padding: 20px;\n --box-margin: 0 0 var(--vertical-box-spacing) 0;\n --box-background: rgba(0, 0, 0, 0.5);\n --box-border-radius: 8px;\n}\n\nvite-error-overlay::part(backdrop) {\n background: rgb(2 11 17 / 60%);\n backdrop-filter: blur(20px) brightness(0.4) saturate(3);\n}\n\nvite-error-overlay::part(window) {\n background: transparent;\n border: none;\n box-shadow: none;\n box-sizing: border-box;\n margin: 50px auto;\n max-width: 1200px;\n padding: var(--box-padding);\n width: 90%;\n}\n\nvite-error-overlay::part(message) {\n display: flex;\n flex-direction: column;\n font-size: 1.6rem;\n line-height: 1.7;\n margin-bottom: 30px;\n}\n\nvite-error-overlay::part(plugin) {\n font-size: 0.8rem;\n font-weight: 100;\n}\n\nvite-error-overlay::part(file),\nvite-error-overlay::part(frame),\nvite-error-overlay::part(stack),\nvite-error-overlay::part(tip) {\n background: var(--box-background);\n border-left: 5px solid transparent;\n border-radius: var(--box-border-radius);\n margin: var(--box-margin);\n min-height: 50px;\n padding: var(--box-padding);\n position: relative;\n}\n\nvite-error-overlay::part(file) {\n border-left-color: rgb(25 182 246);\n color: var(--color-bright);\n}\n\nvite-error-overlay::part(frame) {\n border-left-color: var(--color-yellow);\n color: var(--color-yellow);\n}\n\nvite-error-overlay::part(stack) {\n border-left-color: #FF5722;\n}\n\n\nvite-error-overlay::part(tip) {\n border-top: none;\n border-left-color: rgb(172, 127, 244);\n}\n\nvite-error-overlay::part(file):before,\nvite-error-overlay::part(frame):before,\nvite-error-overlay::part(stack):before {\n border-bottom: 1px solid #222;\n color: var(--color-bright);\n display: block;\n margin-bottom: 15px;\n padding-bottom: 5px;\n padding-left: 30px; /* space for icon */\n font-size: .8rem;\n}\n\nvite-error-overlay::part(file):before {\n content: 'File';\n}\n\nvite-error-overlay::part(frame):before {\n content: 'Frame';\n}\n\nvite-error-overlay::part(stack):before {\n content: 'Stack Trace';\n}\n\nvite-error-overlay::part(file):after,\nvite-error-overlay::part(frame):after,\nvite-error-overlay::part(stack):after {\n content: '';\n display: block;\n height: 20px;\n position: absolute;\n left: var(--box-padding);\n top: var(--box-padding);\n width: 20px;\n}\n\nvite-error-overlay::part(file):after {\n background-image: url(\"data:image/svg+xml,%3Csvg width='20px' height='20px' viewBox='0 0 24 24' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Ctitle%3EFile-Generic%3C/title%3E%3Cg id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cg id='File-Generic'%3E%3Crect id='Rectangle' fill-rule='nonzero' x='0' y='0' width='24' height='24'%3E%3C/rect%3E%3Cpath d='M4 5 C4 3.89543 4.89543 3 6 3 L15.1716 3 C15.702 3 16.2107 3.21071 16.5858 3.58579 L19.4142 6.41421 C19.7893 6.78929 20 7.29799 20 7.82843 L20 19 C20 20.1046 19.1046 21 18 21 L6 21 C4.89543 21 4 20.1046 4 19 L4 5 Z' id='Path' stroke='rgba(255,255,255,0.7)' stroke-width='1' stroke-linecap='round'%3E%3C/path%3E%3Cpath d='M15 4 L15 6 C15 7.10457 15.8954 8 17 8 L19 8' id='Path' stroke='rgba(255,255,255,0.7)' stroke-width='1' stroke-linecap='round'%3E%3C/path%3E%3C/g%3E%3C/g%3E%3C/svg%3E\");\n}\n\nvite-error-overlay::part(frame):after {\n background-image: url(\"data:image/svg+xml,%3Csvg width='20px' height='20px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M15.6602 2.84952H19.1516C20.2555 2.84952 21.1504 3.74444 21.1504 4.84839V8.3398' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3Cpath d='M2.84949 8.33981L2.84949 4.8484C2.84949 3.74446 3.74441 2.84953 4.84836 2.84953L8.33977 2.84953' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3Cpath d='M21.1505 15.6602L21.1505 19.1516C21.1505 20.2555 20.2556 21.1505 19.1516 21.1505L15.6602 21.1505' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3Cpath d='M8.33984 21.1505L4.84843 21.1505C3.74449 21.1505 2.84956 20.2555 2.84956 19.1516L2.84956 15.6602' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3C/svg%3E\");\n}\n\nvite-error-overlay::part(stack):after {\n background-image: url(\"data:image/svg+xml,%3Csvg width='20px' height='20px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.78 20H9.78C7.98 20 4.58 19.09 4.58 15.64C4.58 12.19 7.98 11.28 9.78 11.28H14.22C14.37 11.28 17.92 11.23 17.92 8.42C17.92 5.61 14.37 5.56 14.22 5.56H9.22C9.02109 5.56 8.83032 5.48098 8.68967 5.34033C8.54902 5.19968 8.47 5.00891 8.47 4.81C8.47 4.61109 8.54902 4.42032 8.68967 4.27967C8.83032 4.13902 9.02109 4.06 9.22 4.06H14.22C16.02 4.06 19.42 4.97 19.42 8.42C19.42 11.87 16.02 12.78 14.22 12.78H9.78C9.63 12.78 6.08 12.83 6.08 15.64C6.08 18.45 9.63 18.5 9.78 18.5H14.78C14.9789 18.5 15.1697 18.579 15.3103 18.7197C15.451 18.8603 15.53 19.0511 15.53 19.25C15.53 19.4489 15.451 19.6397 15.3103 19.7803C15.1697 19.921 14.9789 20 14.78 20Z' fill='rgba(255,255,255,0.7)'/%3E%3Cpath d='M6.44 8.31C5.74314 8.30407 5.06363 8.09202 4.48708 7.70056C3.91054 7.30909 3.46276 6.75573 3.20018 6.11021C2.93759 5.46469 2.87195 4.75589 3.01153 4.07312C3.1511 3.39036 3.48965 2.76418 3.9845 2.2735C4.47935 1.78281 5.10837 1.44958 5.79229 1.31579C6.47622 1.182 7.18444 1.25363 7.82771 1.52167C8.47099 1.78971 9.02054 2.24215 9.40711 2.82199C9.79368 3.40182 9.99998 4.08311 10 4.78C10 5.2461 9.90773 5.70759 9.72846 6.13783C9.54919 6.56808 9.28648 6.95856 8.95551 7.28675C8.62453 7.61494 8.23184 7.87433 7.80009 8.04995C7.36834 8.22558 6.90609 8.31396 6.44 8.31ZM6.44 2.75C6.04444 2.75 5.65776 2.86729 5.32886 3.08706C4.99996 3.30682 4.74362 3.61918 4.59224 3.98463C4.44087 4.35008 4.40126 4.75221 4.47843 5.14018C4.5556 5.52814 4.74609 5.8845 5.02579 6.16421C5.3055 6.44391 5.66186 6.6344 6.04982 6.71157C6.43779 6.78874 6.83992 6.74913 7.20537 6.59776C7.57082 6.44638 7.88318 6.19003 8.10294 5.86114C8.32271 5.53224 8.44 5.14556 8.44 4.75C8.44 4.48735 8.38827 4.22728 8.28776 3.98463C8.18725 3.74198 8.03993 3.5215 7.85422 3.33578C7.6685 3.15007 7.44802 3.00275 7.20537 2.90224C6.96272 2.80173 6.70265 2.75 6.44 2.75Z' fill='rgba(255,255,255,0.7)'/%3E%3Cpath d='M17.56 22.75C16.8614 22.752 16.1779 22.5466 15.5961 22.1599C15.0143 21.7733 14.5603 21.2227 14.2916 20.5778C14.0229 19.933 13.9515 19.2229 14.0866 18.5375C14.2217 17.8521 14.5571 17.2221 15.0504 16.7275C15.5437 16.2328 16.1726 15.8956 16.8577 15.7586C17.5427 15.6215 18.253 15.6909 18.8986 15.9577C19.5442 16.2246 20.0961 16.6771 20.4844 17.2578C20.8727 17.8385 21.08 18.5214 21.08 19.22C21.08 20.1545 20.7095 21.0508 20.0496 21.7125C19.3898 22.3743 18.4945 22.7473 17.56 22.75ZM17.56 17.19C17.1644 17.19 16.7778 17.3073 16.4489 17.5271C16.12 17.7468 15.8636 18.0592 15.7122 18.4246C15.5609 18.7901 15.5213 19.1922 15.5984 19.5802C15.6756 19.9681 15.8661 20.3245 16.1458 20.6042C16.4255 20.8839 16.7819 21.0744 17.1698 21.1516C17.5578 21.2287 17.9599 21.1891 18.3254 21.0377C18.6908 20.8864 19.0032 20.63 19.2229 20.3011C19.4427 19.9722 19.56 19.5856 19.56 19.19C19.56 18.6596 19.3493 18.1508 18.9742 17.7758C18.5991 17.4007 18.0904 17.19 17.56 17.19Z' fill='rgba(255,255,255,0.7)'/%3E%3C/svg%3E\");\n}\n\nvite-error-overlay::part(tip):before {\n content: \"Not sure how to solve this? Visit https://qwik.dev or connect with the community on Discord.\";\n display: block;\n margin-bottom: 1em;\n}\n";
3231
- var SYNC_QRL = "<sync>";
3232
- function getOrigin(req) {
3233
- const {PROTOCOL_HEADER: PROTOCOL_HEADER, HOST_HEADER: HOST_HEADER} = process.env;
3234
- const headers = req.headers;
3235
- const protocol = PROTOCOL_HEADER && headers[PROTOCOL_HEADER.toLowerCase()] || (req.socket.encrypted || req.connection.encrypted ? "https" : "http");
3236
- const host = HOST_HEADER && headers[HOST_HEADER.toLowerCase()] || headers[":authority"] || headers.host;
3237
- return `${protocol}://${host}`;
3238
- }
3239
- function createSymbolMapper(base) {
3240
- return (symbolName, _mapper, parent) => {
3241
- if (symbolName === SYNC_QRL) {
3242
- return [ symbolName, "" ];
3243
- }
3244
- if (!parent) {
3245
- if (symbolName.startsWith("_")) {
3246
- return [ symbolName, `${base}${QWIK_HANDLERS_ID}` ];
3247
- }
3248
- console.error("qwik vite-dev-server symbolMapper: unknown qrl requested without parent:", symbolName);
3249
- return [ symbolName, `${base}${symbolName}.js` ];
3250
- }
3251
- const qrlFile = `${base}${parent.startsWith("/") ? parent.slice(1) : parent}_${symbolName}.js`;
3252
- return [ symbolName, qrlFile ];
3253
- };
3254
- }
3255
- var lazySymbolMapper = null;
3256
- var symbolMapper = (symbolName, mapper, parent) => {
3257
- if (lazySymbolMapper) {
3258
- return lazySymbolMapper(symbolName, mapper, parent);
3259
- }
3260
- throw new Error("symbolMapper not initialized");
3261
- };
3262
- async function configureDevServer(base, server, opts, sys, path, isClientDevOnly, clientDevInput, devSsrServer) {
3263
- var _a;
3264
- symbolMapper = lazySymbolMapper = createSymbolMapper(base);
3265
- if (!devSsrServer) {
3266
- return;
3267
- }
3268
- const hasQwikRouter = null == (_a = server.config.plugins) ? void 0 : _a.some((plugin => "vite-plugin-qwik-router" === plugin.name));
3269
- const cssImportedByCSS = new Set;
3270
- server.middlewares.use((async (req, res, next) => {
3271
- try {
3272
- const {ORIGIN: ORIGIN} = process.env;
3273
- const domain = ORIGIN ?? getOrigin(req);
3274
- const url = new URL(req.originalUrl, domain);
3275
- if (shouldSsrRender(req, url)) {
3276
- const {_qwikEnvData: _qwikEnvData} = res;
3277
- if (!_qwikEnvData && hasQwikRouter) {
3278
- console.error(`not SSR rendering ${url} because Qwik Router Env data did not populate`);
3279
- res.statusCode ||= 404;
3280
- res.setHeader("Content-Type", "text/plain");
3281
- res.writeHead(res.statusCode);
3282
- res.end("Not a SSR URL according to Qwik Router");
3283
- return;
3284
- }
3285
- const serverData = {
3286
- ..._qwikEnvData,
3287
- url: url.href
3288
- };
3289
- const status = "number" === typeof res.statusCode ? res.statusCode : 200;
3290
- if (isClientDevOnly) {
3291
- const relPath = path.relative(opts.rootDir, clientDevInput);
3292
- const entryUrl = "/" + relPath.replace(/\\/g, "/");
3293
- let html = getViteDevIndexHtml(entryUrl, serverData);
3294
- html = await server.transformIndexHtml(url.pathname, html);
3295
- res.setHeader("Content-Type", "text/html; charset=utf-8");
3296
- res.setHeader("Cache-Control", "no-cache, no-store, max-age=0");
3297
- res.setHeader("Access-Control-Allow-Origin", "*");
3298
- res.setHeader("X-Powered-By", "Qwik Vite Dev Server");
3299
- res.writeHead(status);
3300
- res.end(html);
3301
- return;
3302
- }
3303
- const firstInput = opts.input && Object.values(opts.input)[0];
3304
- const ssrModule = await server.ssrLoadModule(firstInput);
3305
- const render = ssrModule.default ?? ssrModule.render;
3306
- if ("function" === typeof render) {
3307
- const manifest = {
3308
- manifestHash: "",
3309
- mapping: {},
3310
- injections: []
3311
- };
3312
- const added = new Set;
3313
- const CSS_EXTENSIONS = [ ".css", ".scss", ".sass", ".less", ".styl", ".stylus" ];
3314
- const JS_EXTENSIONS = /\.[mc]?[tj]sx?$/;
3315
- Array.from(server.moduleGraph.fileToModulesMap.entries()).forEach((entry => {
3316
- entry[1].forEach((v => {
3317
- var _a2, _b;
3318
- const segment = null == (_b = null == (_a2 = v.info) ? void 0 : _a2.meta) ? void 0 : _b.segment;
3319
- let url2 = v.url;
3320
- v.lastHMRTimestamp && (url2 += `?t=${v.lastHMRTimestamp}`);
3321
- segment && (manifest.mapping[segment.name] = relativeURL(url2, opts.rootDir));
3322
- const {pathId: pathId, query: query} = parseId(v.url);
3323
- if ("" === query && CSS_EXTENSIONS.some((ext => pathId.endsWith(ext)))) {
3324
- const isEntryCSS = 0 === v.importers.size;
3325
- const hasCSSImporter = Array.from(v.importers).some((importer => {
3326
- const importerPath = importer.url || importer.file;
3327
- const isCSS = importerPath && CSS_EXTENSIONS.some((ext => importerPath.endsWith(ext)));
3328
- isCSS && v.url && cssImportedByCSS.add(v.url);
3329
- return isCSS;
3330
- }));
3331
- const hasJSImporter = Array.from(v.importers).some((importer => {
3332
- const importerPath = importer.url || importer.file;
3333
- return importerPath && JS_EXTENSIONS.test(importerPath);
3334
- }));
3335
- if ((isEntryCSS || hasJSImporter) && !hasCSSImporter && !cssImportedByCSS.has(v.url) && !added.has(v.url)) {
3336
- added.add(v.url);
3337
- manifest.injections.push({
3338
- tag: "link",
3339
- location: "head",
3340
- attributes: {
3341
- rel: "stylesheet",
3342
- href: `${base}${url2.slice(1)}`
3343
- }
3344
- });
3345
- }
3346
- }
3347
- }));
3348
- }));
3349
- const renderOpts = {
3350
- debug: true,
3351
- locale: serverData.locale,
3352
- stream: res,
3353
- snapshot: !isClientDevOnly,
3354
- manifest: isClientDevOnly ? void 0 : manifest,
3355
- symbolMapper: isClientDevOnly ? void 0 : symbolMapper,
3356
- serverData: serverData,
3357
- containerAttributes: {
3358
- ...serverData.containerAttributes
3359
- }
3360
- };
3361
- res.setHeader("Content-Type", "text/html; charset=utf-8");
3362
- res.setHeader("Cache-Control", "no-cache, no-store, max-age=0");
3363
- res.setHeader("Access-Control-Allow-Origin", "*");
3364
- res.setHeader("X-Powered-By", "Qwik Vite Dev Server");
3365
- res.writeHead(status);
3366
- const result = await render(renderOpts);
3367
- "html" in result && res.write(result.html);
3368
- Array.from(server.moduleGraph.fileToModulesMap.entries()).forEach((entry => {
3369
- entry[1].forEach((v => {
3370
- const {pathId: pathId, query: query} = parseId(v.url);
3371
- if (!added.has(v.url) && "" === query && CSS_EXTENSIONS.some((ext => pathId.endsWith(ext)))) {
3372
- const isEntryCSS = 0 === v.importers.size;
3373
- const hasCSSImporter = Array.from(v.importers).some((importer => {
3374
- const importerPath = importer.url || importer.file;
3375
- const isCSS = importerPath && CSS_EXTENSIONS.some((ext => importerPath.endsWith(ext)));
3376
- isCSS && v.url && cssImportedByCSS.add(v.url);
3377
- return isCSS;
3378
- }));
3379
- const hasJSImporter = Array.from(v.importers).some((importer => {
3380
- const importerPath = importer.url || importer.file;
3381
- return importerPath && JS_EXTENSIONS.test(importerPath);
3382
- }));
3383
- if ((isEntryCSS || hasJSImporter) && !hasCSSImporter && !cssImportedByCSS.has(v.url)) {
3384
- res.write(`<link rel="stylesheet" href="${base}${v.url.slice(1)}">`);
3385
- added.add(v.url);
3386
- }
3387
- }
3388
- }));
3389
- }));
3390
- res.write(END_SSR_SCRIPT(opts, opts.srcDir ? opts.srcDir : path.join(opts.rootDir, "src")));
3391
- res.end();
3392
- } else {
3393
- next();
3394
- }
3395
- } else {
3396
- next();
3397
- }
3398
- } catch (e) {
3399
- if (e instanceof Error) {
3400
- server.ssrFixStacktrace(e);
3401
- await formatError(sys, e);
3402
- }
3403
- next(e);
3404
- } finally {
3405
- "function" === typeof res._qwikRenderResolve && res._qwikRenderResolve();
3406
- }
3407
- }));
3408
- server.middlewares.use((function(err, _req, res, next) {
3409
- res.writableEnded || res.write(`<style>${VITE_ERROR_OVERLAY_STYLES}</style>`);
3410
- return next(err);
3411
- }));
3412
- setTimeout((() => {
3413
- console.log(`\n 🚧 ${magenta("Please note that development mode is slower than production.")}`);
3414
- }), 1e3);
3415
- }
3416
- async function configurePreviewServer(middlewares, ssrOutDir, sys, path) {
3417
- const fs = await sys.dynamicImport("node:fs");
3418
- const url = await sys.dynamicImport("node:url");
3419
- const entryPreviewPaths = [ "mjs", "cjs", "js" ].map((ext => path.join(ssrOutDir, `entry.preview.${ext}`)));
3420
- const entryPreviewModulePath = entryPreviewPaths.find((p => fs.existsSync(p)));
3421
- if (!entryPreviewModulePath) {
3422
- return invalidPreviewMessage(middlewares, `Unable to find output "${ssrOutDir}/entry.preview" module.\n\nPlease ensure "src/entry.preview.tsx" has been built before the "preview" command.`);
3423
- }
3424
- try {
3425
- const entryPreviewImportPath = url.pathToFileURL(entryPreviewModulePath).href;
3426
- const previewModuleImport = await sys.strictDynamicImport(entryPreviewImportPath);
3427
- let previewMiddleware = null;
3428
- let preview404Middleware = null;
3429
- if (previewModuleImport.default) {
3430
- if ("function" === typeof previewModuleImport.default) {
3431
- previewMiddleware = previewModuleImport.default;
3432
- } else if ("object" === typeof previewModuleImport.default) {
3433
- previewMiddleware = previewModuleImport.default.router;
3434
- preview404Middleware = previewModuleImport.default.notFound;
3435
- }
3436
- }
3437
- if ("function" !== typeof previewMiddleware) {
3438
- return invalidPreviewMessage(middlewares, `Entry preview module "${entryPreviewModulePath}" does not export a default middleware function`);
3439
- }
3440
- middlewares.use(previewMiddleware);
3441
- "function" === typeof preview404Middleware && middlewares.use(preview404Middleware);
3442
- } catch (e) {
3443
- return invalidPreviewMessage(middlewares, String(e));
3444
- }
3445
- }
3446
- function invalidPreviewMessage(middlewares, msg) {
3447
- console.log(`\n❌ ${msg}\n`);
3448
- middlewares.use(((_, res) => {
3449
- res.writeHead(400, {
3450
- "Content-Type": "text/plain"
3451
- });
3452
- res.end(msg);
3453
- }));
3454
- }
3455
- var CYPRESS_DEV_SERVER_PATH = "/__cypress/src";
3456
- var FS_PREFIX = "/@fs/";
3457
- var VALID_ID_PREFIX = "/@id/";
3458
- var VITE_PUBLIC_PATH = "/@vite/";
3459
- var internalPrefixes = [ FS_PREFIX, VALID_ID_PREFIX, VITE_PUBLIC_PATH ];
3460
- var InternalPrefixRE = new RegExp(`^(${CYPRESS_DEV_SERVER_PATH})?(?:${internalPrefixes.join("|")})`);
3461
- var shouldSsrRender = (req, url) => {
3462
- const pathname = url.pathname;
3463
- if (/\.[\w?=&]+$/.test(pathname) && !pathname.endsWith(".html")) {
3464
- return false;
3465
- }
3466
- if (pathname.includes("_-vite-ping")) {
3467
- return false;
3468
- }
3469
- if (pathname.includes("__open-in-editor")) {
3470
- return false;
3471
- }
3472
- if (url.searchParams.has("html-proxy")) {
3473
- return false;
3474
- }
3475
- if ("false" === url.searchParams.get("ssr")) {
3476
- return false;
3477
- }
3478
- if (InternalPrefixRE.test(url.pathname)) {
3479
- return false;
3480
- }
3481
- if (pathname.includes("@qwik.dev/core/build")) {
3482
- return false;
3483
- }
3484
- const acceptHeader = req.headers.accept || "";
3485
- const accepts = acceptHeader.split(",").map((accept => accept.split(";")[0]));
3486
- if (1 == accepts.length && accepts.includes("*/*")) {
3487
- return true;
3488
- }
3489
- if (!accepts.includes("text/html")) {
3490
- return false;
3491
- }
3492
- return true;
3493
- };
3494
- function relativeURL(url, base) {
3495
- if (url.startsWith(base)) {
3496
- url = url.slice(base.length);
3497
- url.startsWith("/") || (url = "/" + url);
3498
- }
3499
- return url;
3500
- }
3501
- var DEV_QWIK_INSPECTOR = (opts, srcDir) => {
3502
- const qwikdevtools = {
3503
- hotKeys: opts.clickToSource ?? [],
3504
- srcDir: new URL(srcDir + "/", "http://local.local").href
3505
- };
3506
- return `<script>\n globalThis.qwikdevtools = ${JSON.stringify(qwikdevtools)};\n <\/script>` + (opts.imageDevTools ? image_size_runtime_default : "") + (opts.clickToSource ? click_to_component_default : "");
3507
- };
3508
- var END_SSR_SCRIPT = (opts, srcDir) => `\n<style>${VITE_ERROR_OVERLAY_STYLES}</style>\n<script type="module" src="/@vite/client"><\/script>\n${error_host_default}\n${perf_warning_default}\n${DEV_QWIK_INSPECTOR(opts.devTools, srcDir)}\n`;
3509
- function getViteDevIndexHtml(entryUrl, serverData) {
3510
- return `<!DOCTYPE html>\n<html lang="en">\n <head>\n </head>\n <body>\n <script type="module">\n async function main() {\n const mod = await import("${entryUrl}?${VITE_DEV_CLIENT_QS}=");\n if (mod.default) {\n const serverData = JSON.parse(${JSON.stringify(JSON.stringify(serverData))})\n mod.default({\n serverData,\n });\n }\n }\n main();\n <\/script>\n ${error_host_default}\n </body>\n</html>`;
3511
- }
3512
- var VITE_DEV_CLIENT_QS = "qwik-vite-dev-client";
3513
- var DEDUPE = [ QWIK_CORE_ID, QWIK_JSX_RUNTIME_ID, QWIK_JSX_DEV_RUNTIME_ID ];
3514
- var STYLING = [ ".css", ".scss", ".sass", ".less", ".styl", ".stylus" ];
3515
- var FONTS = [ ".woff", ".woff2", ".ttf" ];
3516
- function qwikVite(qwikViteOpts = {}) {
3517
- let isClientDevOnly = false;
3518
- let clientDevInput;
3519
- let tmpClientManifestPath;
3520
- let viteCommand = "serve";
3521
- let manifestInput = null;
3522
- let clientOutDir = null;
3523
- let basePathname = "/";
3524
- let clientPublicOutDir = null;
3525
- let viteAssetsDir;
3526
- let srcDir = null;
3527
- let rootDir = null;
3528
- let ssrOutDir = null;
3529
- const fileFilter = qwikViteOpts.fileFilter ? (id, type) => TRANSFORM_REGEX.test(id) || qwikViteOpts.fileFilter(id, type) : () => true;
3530
- const disableFontPreload = qwikViteOpts.disableFontPreload ?? false;
3531
- const injections = [];
3532
- const qwikPlugin = createQwikPlugin(qwikViteOpts.optimizerOptions);
3533
- const bundleGraphAdders = new Set;
3534
- const api = {
3535
- getOptimizer: () => qwikPlugin.getOptimizer(),
3536
- getOptions: () => qwikPlugin.getOptions(),
3537
- getManifest: () => manifestInput,
3538
- getRootDir: () => qwikPlugin.getOptions().rootDir,
3539
- getClientOutDir: () => clientOutDir,
3540
- getClientPublicOutDir: () => clientPublicOutDir,
3541
- getAssetsDir: () => viteAssetsDir,
3542
- registerBundleGraphAdder: adder => bundleGraphAdders.add(adder)
3543
- };
3544
- const vitePluginPre = {
3545
- name: "vite-plugin-qwik",
3546
- enforce: "pre",
3547
- api: api,
3548
- async config(viteConfig, viteEnv) {
3549
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
3550
- await qwikPlugin.init();
3551
- const sys = qwikPlugin.getSys();
3552
- const path = qwikPlugin.getPath();
3553
- let target;
3554
- target = (null == (_a = viteConfig.build) ? void 0 : _a.ssr) || "ssr" === viteEnv.mode ? "ssr" : "lib" === viteEnv.mode ? "lib" : "test" === viteEnv.mode ? "test" : "client";
3555
- let buildMode;
3556
- buildMode = "production" === viteEnv.mode ? "production" : "development" === viteEnv.mode ? "development" : "build" === viteCommand && "client" === target ? "production" : "development";
3557
- viteCommand = viteEnv.command;
3558
- isClientDevOnly = "serve" === viteCommand && "ssr" !== viteEnv.mode;
3559
- qwikPlugin.debug(`vite config(), command: ${viteCommand}, env.mode: ${viteEnv.mode}`);
3560
- "serve" === viteCommand ? qwikViteOpts.entryStrategy = {
3561
- type: "segment"
3562
- } : "ssr" === target ? qwikViteOpts.entryStrategy = {
3563
- type: "hoist"
3564
- } : "lib" === target && (qwikViteOpts.entryStrategy = {
3565
- type: "inline"
3566
- });
3567
- const shouldFindVendors = !qwikViteOpts.disableVendorScan && ("lib" !== target || "serve" === viteCommand);
3568
- viteAssetsDir = null == (_b = viteConfig.build) ? void 0 : _b.assetsDir;
3569
- const useAssetsDir = "client" === target && !!viteAssetsDir && "_astro" !== viteAssetsDir;
3570
- const pluginOpts = {
3571
- target: target,
3572
- buildMode: buildMode,
3573
- csr: qwikViteOpts.csr,
3574
- debug: qwikViteOpts.debug,
3575
- entryStrategy: qwikViteOpts.entryStrategy,
3576
- srcDir: qwikViteOpts.srcDir,
3577
- rootDir: viteConfig.root,
3578
- tsconfigFileNames: qwikViteOpts.tsconfigFileNames,
3579
- resolveQwikBuild: true,
3580
- transformedModuleOutput: qwikViteOpts.transformedModuleOutput,
3581
- outDir: null == (_c = viteConfig.build) ? void 0 : _c.outDir,
3582
- assetsDir: useAssetsDir ? viteAssetsDir : void 0,
3583
- devTools: qwikViteOpts.devTools,
3584
- sourcemap: !!(null == (_d = viteConfig.build) ? void 0 : _d.sourcemap),
3585
- lint: qwikViteOpts.lint,
3586
- experimental: qwikViteOpts.experimental
3587
- };
3588
- if (!qwikViteOpts.csr) {
3589
- if ("ssr" === target) {
3590
- "string" === typeof (null == (_e = viteConfig.build) ? void 0 : _e.ssr) ? pluginOpts.input = viteConfig.build.ssr : "string" === typeof (null == (_f = qwikViteOpts.ssr) ? void 0 : _f.input) && (pluginOpts.input = qwikViteOpts.ssr.input);
3591
- (null == (_g = qwikViteOpts.ssr) ? void 0 : _g.outDir) && (pluginOpts.outDir = qwikViteOpts.ssr.outDir);
3592
- pluginOpts.manifestInput = null == (_h = qwikViteOpts.ssr) ? void 0 : _h.manifestInput;
3593
- } else if ("client" === target) {
3594
- pluginOpts.input = null == (_i = qwikViteOpts.client) ? void 0 : _i.input;
3595
- (null == (_j = qwikViteOpts.client) ? void 0 : _j.outDir) && (pluginOpts.outDir = qwikViteOpts.client.outDir);
3596
- pluginOpts.manifestOutput = null == (_k = qwikViteOpts.client) ? void 0 : _k.manifestOutput;
3597
- } else {
3598
- "object" === typeof (null == (_l = viteConfig.build) ? void 0 : _l.lib) && (pluginOpts.input = null == (_m = viteConfig.build) ? void 0 : _m.lib.entry);
3599
- }
3600
- if ("node" === sys.env) {
3601
- const fs = await sys.dynamicImport("node:fs");
3602
- try {
3603
- const rootDir2 = pluginOpts.rootDir ?? sys.cwd();
3604
- const packageJsonPath = sys.path.join(rootDir2, "package.json");
3605
- const pkgString = await fs.promises.readFile(packageJsonPath, "utf-8");
3606
- try {
3607
- const data = JSON.parse(pkgString);
3608
- "string" === typeof data.name && (pluginOpts.scope = data.name);
3609
- } catch (e) {
3610
- console.error(e);
3611
- }
3612
- } catch {}
3613
- const nodeOs = await sys.dynamicImport("node:os");
3614
- const scopeSuffix = pluginOpts.scope ? `-${pluginOpts.scope.replace(/\//g, "--")}` : "";
3615
- tmpClientManifestPath = path.join(nodeOs.tmpdir(), `vite-plugin-qwik-q-manifest${scopeSuffix}.json`);
3616
- if ("ssr" === target && !pluginOpts.manifestInput) {
3617
- try {
3618
- const clientManifestStr = await fs.promises.readFile(tmpClientManifestPath, "utf-8");
3619
- pluginOpts.manifestInput = JSON.parse(clientManifestStr);
3620
- } catch {}
3621
- }
3622
- }
3623
- }
3624
- const opts = qwikPlugin.normalizeOptions(pluginOpts);
3625
- manifestInput = pluginOpts.manifestInput || null;
3626
- srcDir = opts.srcDir;
3627
- rootDir = opts.rootDir;
3628
- if (!qwikViteOpts.csr) {
3629
- clientOutDir = qwikPlugin.normalizePath(sys.path.resolve(opts.rootDir, (null == (_n = qwikViteOpts.client) ? void 0 : _n.outDir) || CLIENT_OUT_DIR));
3630
- clientPublicOutDir = viteConfig.base ? path.join(clientOutDir, viteConfig.base) : clientOutDir;
3631
- ssrOutDir = qwikPlugin.normalizePath(sys.path.resolve(opts.rootDir, (null == (_o = qwikViteOpts.ssr) ? void 0 : _o.outDir) || SSR_OUT_DIR));
3632
- clientDevInput = "string" === typeof (null == (_p = qwikViteOpts.client) ? void 0 : _p.devInput) ? path.resolve(opts.rootDir, qwikViteOpts.client.devInput) : opts.srcDir ? path.resolve(opts.srcDir, CLIENT_DEV_INPUT) : path.resolve(opts.rootDir, "src", CLIENT_DEV_INPUT);
3633
- clientDevInput = qwikPlugin.normalizePath(clientDevInput);
3634
- }
3635
- const vendorRoots = shouldFindVendors ? await findQwikRoots(sys, sys.cwd()) : [];
3636
- const vendorIds = vendorRoots.map((v => v.id));
3637
- const isDevelopment = "development" === buildMode;
3638
- const qDevKey = "globalThis.qDev";
3639
- const qTestKey = "globalThis.qTest";
3640
- const qInspectorKey = "globalThis.qInspector";
3641
- const qSerializeKey = "globalThis.qSerialize";
3642
- const qDev = (null == (_q = null == viteConfig ? void 0 : viteConfig.define) ? void 0 : _q[qDevKey]) ?? isDevelopment;
3643
- const qInspector = (null == (_r = null == viteConfig ? void 0 : viteConfig.define) ? void 0 : _r[qInspectorKey]) ?? isDevelopment;
3644
- const qSerialize = (null == (_s = null == viteConfig ? void 0 : viteConfig.define) ? void 0 : _s[qSerializeKey]) ?? isDevelopment;
3645
- const updatedViteConfig = {
3646
- ssr: {
3647
- noExternal: [ QWIK_CORE_ID, QWIK_CORE_INTERNAL_ID, QWIK_CORE_SERVER, QWIK_BUILD_ID, ...vendorIds ]
3648
- },
3649
- envPrefix: [ "VITE_", "PUBLIC_" ],
3650
- resolve: {
3651
- dedupe: [ ...DEDUPE, ...vendorIds ],
3652
- conditions: "production" === buildMode && "client" === target ? [ "min" ] : [],
3653
- alias: {
3654
- "@builder.io/qwik": "@qwik.dev/core",
3655
- "@builder.io/qwik/build": "@qwik.dev/core/build",
3656
- "@builder.io/qwik/server": "@qwik.dev/core/server",
3657
- "@builder.io/qwik/preloader": "@qwik.dev/core/preloader",
3658
- "@builder.io/qwik/jsx-runtime": "@qwik.dev/core/jsx-runtime",
3659
- "@builder.io/qwik/jsx-dev-runtime": "@qwik.dev/core/jsx-dev-runtime",
3660
- "@builder.io/qwik/optimizer": "@qwik.dev/core/optimizer",
3661
- "@builder.io/qwik/loader": "@qwik.dev/core/loader",
3662
- "@builder.io/qwik/cli": "@qwik.dev/core/cli",
3663
- "@builder.io/qwik/testing": "@qwik.dev/core/testing"
3664
- }
3665
- },
3666
- esbuild: "serve" !== viteCommand && {
3667
- logLevel: "error",
3668
- jsx: "automatic"
3669
- },
3670
- optimizeDeps: {
3671
- exclude: [ QWIK_CORE_ID, QWIK_CORE_INTERNAL_ID, QWIK_CORE_SERVER, QWIK_JSX_RUNTIME_ID, QWIK_JSX_DEV_RUNTIME_ID, QWIK_BUILD_ID, QWIK_CLIENT_MANIFEST_ID, ...vendorIds, "@builder.io/qwik", "@builder.io/qwik-city" ]
3672
- },
3673
- build: {
3674
- modulePreload: false,
3675
- dynamicImportVarsOptions: {
3676
- exclude: [ /./ ]
3677
- },
3678
- rollupOptions: {
3679
- maxParallelFileOps: 1,
3680
- output: {
3681
- manualChunks: qwikPlugin.manualChunks
3682
- }
3683
- }
3684
- },
3685
- define: {
3686
- [qDevKey]: qDev,
3687
- [qInspectorKey]: qInspector,
3688
- [qSerializeKey]: qSerialize,
3689
- [qTestKey]: JSON.stringify("test" === process.env.NODE_ENV)
3690
- }
3691
- };
3692
- if (!qwikViteOpts.csr) {
3693
- const buildOutputDir = "client" === target && viteConfig.base ? path.join(opts.outDir, viteConfig.base) : opts.outDir;
3694
- updatedViteConfig.build.cssCodeSplit = false;
3695
- updatedViteConfig.build.outDir = buildOutputDir;
3696
- const origOnwarn = null == (_t = updatedViteConfig.build.rollupOptions) ? void 0 : _t.onwarn;
3697
- updatedViteConfig.build.rollupOptions = {
3698
- input: opts.input,
3699
- output: normalizeRollupOutputOptions(qwikPlugin, null == (_v = null == (_u = viteConfig.build) ? void 0 : _u.rollupOptions) ? void 0 : _v.output, useAssetsDir, buildOutputDir),
3700
- preserveEntrySignatures: "exports-only",
3701
- onwarn: (warning, warn) => {
3702
- if ("typescript" === warning.plugin && warning.message.includes("outputToFilesystem")) {
3703
- return;
3704
- }
3705
- origOnwarn ? origOnwarn(warning, warn) : warn(warning);
3706
- }
3707
- };
3708
- if ("ssr" === opts.target) {
3709
- if ("build" === viteCommand) {
3710
- updatedViteConfig.publicDir = false;
3711
- updatedViteConfig.build.ssr = true;
3712
- null == (null == (_w = viteConfig.build) ? void 0 : _w.minify) && "production" === buildMode && (updatedViteConfig.build.minify = "esbuild");
3713
- }
3714
- } else if ("client" === opts.target) {
3715
- isClientDevOnly && !opts.csr && (updatedViteConfig.build.rollupOptions.input = clientDevInput);
3716
- } else if ("lib" === opts.target) {
3717
- updatedViteConfig.build.minify = false;
3718
- updatedViteConfig.build.rollupOptions.external = [ QWIK_CORE_ID, QWIK_CORE_INTERNAL_ID, QWIK_CORE_SERVER, QWIK_JSX_RUNTIME_ID, QWIK_JSX_DEV_RUNTIME_ID, QWIK_BUILD_ID, QWIK_CLIENT_MANIFEST_ID ];
3719
- } else {
3720
- updatedViteConfig.define = {
3721
- [qDevKey]: true,
3722
- [qTestKey]: true,
3723
- [qInspectorKey]: false
3724
- };
3725
- }
3726
- globalThis.qDev = qDev;
3727
- globalThis.qTest = true;
3728
- globalThis.qInspector = qInspector;
3729
- }
3730
- return updatedViteConfig;
3731
- },
3732
- async configResolved(config) {
3733
- var _a;
3734
- basePathname = config.base;
3735
- if (!(basePathname.startsWith("/") && basePathname.endsWith("/"))) {
3736
- console.error("warning: vite's config.base must begin and end with /. This will be an error in v2. If you have a valid use case, please open an issue.");
3737
- basePathname.endsWith("/") || (basePathname += "/");
3738
- }
3739
- const useSourcemap = !!config.build.sourcemap;
3740
- useSourcemap && void 0 === (null == (_a = qwikViteOpts.optimizerOptions) ? void 0 : _a.sourcemap) && qwikPlugin.setSourceMapSupport(true);
3741
- qwikPlugin.normalizeOptions(qwikViteOpts);
3742
- },
3743
- async buildStart() {
3744
- const resolver = this.resolve.bind(this);
3745
- await qwikPlugin.validateSource(resolver);
3746
- qwikPlugin.onDiagnostics(((diagnostics, optimizer, srcDir2) => {
3747
- diagnostics.forEach((d => {
3748
- const id = qwikPlugin.normalizePath(optimizer.sys.path.join(srcDir2, d.file));
3749
- "error" === d.category ? this.error(createRollupError2(id, d)) : this.warn(createRollupError2(id, d));
3750
- }));
3751
- }));
3752
- await qwikPlugin.buildStart(this);
3753
- },
3754
- resolveId(id, importer, resolveIdOpts) {
3755
- if (id.startsWith("\0") || !fileFilter(id, "resolveId")) {
3756
- return null;
3757
- }
3758
- if (isClientDevOnly && id === VITE_CLIENT_MODULE) {
3759
- return id;
3760
- }
3761
- return qwikPlugin.resolveId(this, id, importer, resolveIdOpts);
3762
- },
3763
- load(id, loadOpts) {
3764
- if (id.startsWith("\0") || !fileFilter(id, "load")) {
3765
- return null;
3766
- }
3767
- id = qwikPlugin.normalizePath(id);
3768
- const opts = qwikPlugin.getOptions();
3769
- if (isClientDevOnly && id === VITE_CLIENT_MODULE) {
3770
- return getViteDevModule(opts);
3771
- }
3772
- if ("serve" === viteCommand && id.endsWith(QWIK_CLIENT_MANIFEST_ID)) {
3773
- return {
3774
- code: "export const manifest = undefined;"
3775
- };
3776
- }
3777
- return qwikPlugin.load(this, id, loadOpts);
3778
- },
3779
- transform(code, id, transformOpts) {
3780
- if (id.startsWith("\0") || !fileFilter(id, "transform") || id.includes("?raw")) {
3781
- return null;
3782
- }
3783
- if (isClientDevOnly) {
3784
- const parsedId = parseId(id);
3785
- parsedId.params.has(VITE_DEV_CLIENT_QS) && (code = updateEntryDev(code));
3786
- }
3787
- return qwikPlugin.transform(this, code, id, transformOpts);
3788
- }
3789
- };
3790
- const vitePluginPost = {
3791
- name: "vite-plugin-qwik-post",
3792
- enforce: "post",
3793
- generateBundle: {
3794
- order: "post",
3795
- async handler(_, rollupBundle) {
3796
- const opts = qwikPlugin.getOptions();
3797
- if ("client" === opts.target) {
3798
- for (const [fileName, b] of Object.entries(rollupBundle)) {
3799
- if ("asset" === b.type) {
3800
- const baseFilename = basePathname + fileName;
3801
- if (STYLING.some((ext => fileName.endsWith(ext)))) {
3802
- "string" === typeof b.source && b.source.length < opts.inlineStylesUpToBytes ? injections.push({
3803
- tag: "style",
3804
- location: "head",
3805
- attributes: {
3806
- "data-src": baseFilename,
3807
- dangerouslySetInnerHTML: b.source
3808
- }
3809
- }) : injections.push({
3810
- tag: "link",
3811
- location: "head",
3812
- attributes: {
3813
- rel: "stylesheet",
3814
- href: baseFilename
3815
- }
3816
- });
3817
- } else {
3818
- const selectedFont = FONTS.find((ext => fileName.endsWith(ext)));
3819
- selectedFont && !disableFontPreload && injections.unshift({
3820
- tag: "link",
3821
- location: "head",
3822
- attributes: {
3823
- rel: "preload",
3824
- href: baseFilename,
3825
- as: "font",
3826
- type: `font/${selectedFont.slice(1)}`,
3827
- crossorigin: ""
3828
- }
3829
- });
3830
- }
3831
- }
3832
- }
3833
- const clientManifestStr = await qwikPlugin.generateManifest(this, rollupBundle, bundleGraphAdders, {
3834
- injections: injections,
3835
- platform: {
3836
- vite: ""
3837
- }
3838
- });
3839
- const sys = qwikPlugin.getSys();
3840
- if (tmpClientManifestPath && "node" === sys.env) {
3841
- const fs = await sys.dynamicImport("node:fs");
3842
- await fs.promises.writeFile(tmpClientManifestPath, clientManifestStr);
3843
- }
3844
- }
3845
- }
3846
- },
3847
- async writeBundle(_, rollupBundle) {
3848
- const opts = qwikPlugin.getOptions();
3849
- if ("ssr" === opts.target) {
3850
- const sys = qwikPlugin.getSys();
3851
- if ("node" === sys.env) {
3852
- const outputs = Object.keys(rollupBundle);
3853
- const patchModuleFormat = async bundeName => {
3854
- try {
3855
- const bundleFileName = sys.path.basename(bundeName);
3856
- const ext = sys.path.extname(bundleFileName);
3857
- const isEntryFile = bundleFileName.startsWith("entry.") || bundleFileName.startsWith("entry_");
3858
- if (isEntryFile && !bundleFileName.includes("preview") && (".mjs" === ext || ".cjs" === ext)) {
3859
- const extlessName = sys.path.basename(bundleFileName, ext);
3860
- const js = `${extlessName}.js`;
3861
- const moduleName = extlessName + ext;
3862
- const hasJsScript = outputs.some((f => sys.path.basename(f) === js));
3863
- if (!hasJsScript) {
3864
- const bundleOutDir = sys.path.dirname(bundeName);
3865
- const fs = await sys.dynamicImport("node:fs");
3866
- const folder = sys.path.join(opts.outDir, bundleOutDir);
3867
- await fs.promises.mkdir(folder, {
3868
- recursive: true
3869
- });
3870
- await fs.promises.writeFile(sys.path.join(folder, js), `export * from "./${moduleName}";`);
3871
- }
3872
- }
3873
- } catch (e) {
3874
- console.error("patchModuleFormat", e);
3875
- }
3876
- };
3877
- await Promise.all(outputs.map(patchModuleFormat));
3878
- }
3879
- }
3880
- },
3881
- configureServer(server) {
3882
- qwikPlugin.configureServer(server);
3883
- const devSsrServer = !("devSsrServer" in qwikViteOpts) || !!qwikViteOpts.devSsrServer;
3884
- const imageDevTools = !qwikViteOpts.devTools || !("imageDevTools" in qwikViteOpts.devTools) || qwikViteOpts.devTools.imageDevTools;
3885
- imageDevTools && server.middlewares.use(getImageSizeServer(qwikPlugin.getSys(), rootDir, srcDir));
3886
- if (!qwikViteOpts.csr) {
3887
- const plugin = async () => {
3888
- const opts = qwikPlugin.getOptions();
3889
- const sys = qwikPlugin.getSys();
3890
- const path = qwikPlugin.getPath();
3891
- await configureDevServer(basePathname, server, opts, sys, path, isClientDevOnly, clientDevInput, devSsrServer);
3892
- };
3893
- const isNEW = true === globalThis.__qwikRouterNew || true === globalThis.__qwikCityNew;
3894
- return isNEW ? plugin : plugin();
3895
- }
3896
- },
3897
- configurePreviewServer: server => async () => {
3898
- const sys = qwikPlugin.getSys();
3899
- const path = qwikPlugin.getPath();
3900
- await configurePreviewServer(server.middlewares, ssrOutDir, sys, path);
3901
- },
3902
- handleHotUpdate(ctx) {
3903
- qwikPlugin.handleHotUpdate(ctx);
3904
- ctx.modules.length && ctx.server.hot.send({
3905
- type: "full-reload"
3906
- });
3907
- },
3908
- onLog(level, log) {
3909
- var _a, _b, _c;
3910
- if ("vite-plugin-qwik" == log.plugin) {
3911
- const color = LOG_COLOR[level] || ANSI_COLOR.White;
3912
- const frames = (log.frame || "").split("\n").map((line => (line.match(/^\s*\^\s*$/) ? ANSI_COLOR.BrightWhite : ANSI_COLOR.BrightBlack) + line));
3913
- console[level](`${color}%s\n${ANSI_COLOR.BrightWhite}%s\n%s${ANSI_COLOR.RESET}`, `[${log.plugin}](${level}): ${log.message}\n`, ` ${null == (_a = null == log ? void 0 : log.loc) ? void 0 : _a.file}:${null == (_b = null == log ? void 0 : log.loc) ? void 0 : _b.line}:${null == (_c = null == log ? void 0 : log.loc) ? void 0 : _c.column}\n`, ` ${frames.join("\n ")}\n`);
3914
- return false;
3915
- }
3916
- }
3917
- };
3918
- return [ vitePluginPre, vitePluginPost ];
3919
- }
3920
- var ANSI_COLOR = {
3921
- Black: "",
3922
- Red: "",
3923
- Green: "",
3924
- Yellow: "",
3925
- Blue: "",
3926
- Magenta: "",
3927
- Cyan: "",
3928
- White: "",
3929
- BrightBlack: "",
3930
- BrightRed: "",
3931
- BrightGreen: "",
3932
- BrightYellow: "",
3933
- BrightBlue: "",
3934
- BrightMagenta: "",
3935
- BrightCyan: "",
3936
- BrightWhite: "",
3937
- RESET: ""
3938
- };
3939
- var LOG_COLOR = {
3940
- warn: ANSI_COLOR.Yellow,
3941
- info: ANSI_COLOR.Cyan,
3942
- debug: ANSI_COLOR.BrightBlack
3943
- };
3944
- function updateEntryDev(code) {
3945
- code = code.replace(/["']@builder.io\/qwik["']/g, `'${VITE_CLIENT_MODULE}'`);
3946
- return code;
3947
- }
3948
- function getViteDevModule(opts) {
3949
- const qwikLoader = JSON.stringify(opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED);
3950
- return `// Qwik Vite Dev Module\nimport { render as qwikRender } from '@qwik.dev/core';\n\nexport async function render(document, rootNode, opts) {\n\n await qwikRender(document, rootNode, opts);\n\n let qwikLoader = document.getElementById('qwikloader');\n if (!qwikLoader) {\n qwikLoader = document.createElement('script');\n qwikLoader.id = 'qwikloader';\n qwikLoader.innerHTML = ${qwikLoader};\n const parent = document.head ?? document.body ?? document.documentElement;\n parent.appendChild(qwikLoader);\n }\n\n if (!window.__qwikViteLog) {\n window.__qwikViteLog = true;\n console.debug("%c⭐️ Qwik Client Mode","background: #0c75d2; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;","Do not use this mode in production!\\n - No portion of the application is pre-rendered on the server\\n - All of the application is running eagerly in the browser\\n - Optimizer/Serialization/Deserialization code is not exercised!");\n }\n}`;
3951
- }
3952
- async function findDepPkgJsonPath(sys, dep, parent) {
3953
- const fs = await sys.dynamicImport("node:fs");
3954
- let root = parent;
3955
- while (root) {
3956
- const pkg = sys.path.join(root, "node_modules", dep, "package.json");
3957
- try {
3958
- await fs.promises.access(pkg);
3959
- return fs.promises.realpath(pkg);
3960
- } catch {}
3961
- const nextRoot = sys.path.dirname(root);
3962
- if (nextRoot === root) {
3963
- break;
3964
- }
3965
- root = nextRoot;
3966
- }
3967
- return;
3968
- }
3969
- var findQwikRoots = async (sys, packageJsonDir) => {
3970
- const paths = new Map;
3971
- if ("node" === sys.env) {
3972
- const fs = await sys.dynamicImport("node:fs");
3973
- let prevPackageJsonDir;
3974
- do {
3975
- try {
3976
- const data = await fs.promises.readFile(sys.path.join(packageJsonDir, "package.json"), {
3977
- encoding: "utf-8"
3978
- });
3979
- try {
3980
- const packageJson = JSON.parse(data);
3981
- const dependencies = packageJson.dependencies;
3982
- const devDependencies = packageJson.devDependencies;
3983
- const packages = [];
3984
- "object" === typeof dependencies && packages.push(...Object.keys(dependencies));
3985
- "object" === typeof devDependencies && packages.push(...Object.keys(devDependencies));
3986
- const basedir = sys.cwd();
3987
- await Promise.all(packages.map((async id => {
3988
- const pkgJsonPath = await findDepPkgJsonPath(sys, id, basedir);
3989
- if (pkgJsonPath) {
3990
- const pkgJsonContent = await fs.promises.readFile(pkgJsonPath, "utf-8");
3991
- const pkgJson = JSON.parse(pkgJsonContent);
3992
- const qwikPath = pkgJson.qwik;
3993
- if (!qwikPath) {
3994
- return;
3995
- }
3996
- const allPaths = Array.isArray(qwikPath) ? qwikPath : [ qwikPath ];
3997
- for (const p of allPaths) {
3998
- paths.set(await fs.promises.realpath(sys.path.resolve(sys.path.dirname(pkgJsonPath), p)), id);
3999
- }
4000
- }
4001
- })));
4002
- } catch (e) {
4003
- console.error(e);
4004
- }
4005
- } catch {}
4006
- prevPackageJsonDir = packageJsonDir;
4007
- packageJsonDir = sys.path.dirname(packageJsonDir);
4008
- } while (packageJsonDir !== prevPackageJsonDir);
4009
- }
4010
- return Array.from(paths).map((([path, id]) => ({
4011
- path: path,
4012
- id: id
4013
- })));
4014
- };
4015
- var VITE_CLIENT_MODULE = "@qwik.dev/core/vite-client";
4016
- var CLIENT_DEV_INPUT = "entry.dev";
4017
- return module.exports;
4018
- }("object" === typeof module && module.exports ? module : {
4019
- exports: {}
4020
- });
7
+ */"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function V(e={}){function n(f){if(typeof f!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(f))}function i(f,l){let s="",y=0,h=-1,I=0,v;for(let T=0;T<=f.length;++T){if(T<f.length)v=f.charCodeAt(T);else{if(v===47)break;v=47}if(v===47){if(!(h===T-1||I===1))if(h!==T-1&&I===2){if(s.length<2||y!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){const E=s.lastIndexOf("/");if(E!==s.length-1){E===-1?(s="",y=0):(s=s.slice(0,E),y=s.length-1-s.lastIndexOf("/")),h=T,I=0;continue}}else if(s.length===2||s.length===1){s="",y=0,h=T,I=0;continue}}l&&(s.length>0?s+="/..":s="..",y=2)}else s.length>0?s+="/"+f.slice(h+1,T):s=f.slice(h+1,T),y=T-h-1;h=T,I=0}else v===46&&I!==-1?++I:I=-1}return s}function r(f,l){const s=l.dir||l.root,y=l.base||(l.name||"")+(l.ext||"");return s?s===l.root?s+y:s+f+y:y}const o=function(...l){let s="",y=!1,h;for(let I=l.length-1;I>=-1&&!y;I--){let v;I>=0?v=l[I]:(h===void 0&&(e&&typeof e.cwd=="function"?h=e.cwd():typeof process<"u"&&typeof process.cwd=="function"?h=process.cwd():h="/"),v=h),n(v),v.length!==0&&(s=v+"/"+s,y=v.charCodeAt(0)===47)}return s=i(s,!y),y?s.length>0?"/"+s:"/":s.length>0?s:"."},d=function(l){if(n(l),l.length===0)return".";const s=l.charCodeAt(0)===47,y=l.charCodeAt(l.length-1)===47;return l=i(l,!s),l.length===0&&!s&&(l="."),l.length>0&&y&&(l+="/"),s?"/"+l:l},c=function(l){return n(l),l.length>0&&l.charCodeAt(0)===47},a=function(...l){if(l.length===0)return".";let s;for(let y=0;y<l.length;++y){const h=l[y];n(h),h.length>0&&(s===void 0?s=h:s+="/"+h)}return s===void 0?".":d(s)},p=function(l,s){if(n(l),n(s),l===s||(l=o(l),s=o(s),l===s))return"";let y=1;for(;y<l.length&&l.charCodeAt(y)===47;++y);const h=l.length,I=h-y;let v=1;for(;v<s.length&&s.charCodeAt(v)===47;++v);const E=s.length-v,P=I<E?I:E;let U=-1,j=0;for(;j<=P;++j){if(j===P){if(E>P){if(s.charCodeAt(v+j)===47)return s.slice(v+j+1);if(j===0)return s.slice(v+j)}else I>P&&(l.charCodeAt(y+j)===47?U=j:j===0&&(U=0));break}const H=l.charCodeAt(y+j),Y=s.charCodeAt(v+j);if(H!==Y)break;H===47&&(U=j)}let R="";for(j=y+U+1;j<=h;++j)(j===h||l.charCodeAt(j)===47)&&(R.length===0?R+="..":R+="/..");return R.length>0?R+s.slice(v+U):(v+=U,s.charCodeAt(v)===47&&++v,s.slice(v))},t=function(l){if(n(l),l.length===0)return".";let s=l.charCodeAt(0);const y=s===47;let h=-1,I=!0;for(let v=l.length-1;v>=1;--v)if(s=l.charCodeAt(v),s===47){if(!I){h=v;break}}else I=!1;return h===-1?y?"/":".":y&&h===1?"//":l.slice(0,h)},x=function(l,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');n(l);let y=0,h=-1,I=!0,v;if(s!==void 0&&s.length>0&&s.length<=l.length){if(s.length===l.length&&s===l)return"";let T=s.length-1,E=-1;for(v=l.length-1;v>=0;--v){const P=l.charCodeAt(v);if(P===47){if(!I){y=v+1;break}}else E===-1&&(I=!1,E=v+1),T>=0&&(P===s.charCodeAt(T)?--T===-1&&(h=v):(T=-1,h=E))}return y===h?h=E:h===-1&&(h=l.length),l.slice(y,h)}else{for(v=l.length-1;v>=0;--v)if(l.charCodeAt(v)===47){if(!I){y=v+1;break}}else h===-1&&(I=!1,h=v+1);return h===-1?"":l.slice(y,h)}},k=function(l){n(l);let s=-1,y=0,h=-1,I=!0,v=0;for(let T=l.length-1;T>=0;--T){const E=l.charCodeAt(T);if(E===47){if(!I){y=T+1;break}continue}h===-1&&(I=!1,h=T+1),E===46?s===-1?s=T:v!==1&&(v=1):s!==-1&&(v=-1)}return s===-1||h===-1||v===0||v===1&&s===h-1&&s===y+1?"":l.slice(s,h)},u=function(l){if(l===null||typeof l!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof l);return r("/",l)},w=function(l){n(l);const s={root:"",dir:"",base:"",ext:"",name:""};if(l.length===0)return s;let y=l.charCodeAt(0),h;const I=y===47;I?(s.root="/",h=1):h=0;let v=-1,T=0,E=-1,P=!0,U=l.length-1,j=0;for(;U>=h;--U){if(y=l.charCodeAt(U),y===47){if(!P){T=U+1;break}continue}E===-1&&(P=!1,E=U+1),y===46?v===-1?v=U:j!==1&&(j=1):v!==-1&&(j=-1)}return v===-1||E===-1||j===0||j===1&&v===E-1&&v===T+1?E!==-1&&(T===0&&I?s.base=s.name=l.slice(1,E):s.base=s.name=l.slice(T,E)):(T===0&&I?(s.name=l.slice(1,v),s.base=l.slice(1,E)):(s.name=l.slice(T,v),s.base=l.slice(T,E)),s.ext=l.slice(v,E)),T>0?s.dir=l.slice(0,T-1):I&&(s.dir="/"),s},m="/",g=":";return{relative:p,resolve:o,parse:w,format:u,join:a,isAbsolute:c,basename:x,normalize:d,dirname:t,extname:k,delimiter:g,sep:m,win32:null,posix:{relative:p,resolve:o,parse:w,format:u,join:a,isAbsolute:c,basename:x,normalize:d,dirname:t,extname:k,delimiter:g,sep:m,win32:null,posix:null}}}const ae={darwin:{arm64:[{platform:"darwin",arch:"arm64",abi:null,platformArchABI:"qwik.darwin-arm64.node"}],x64:[{platform:"darwin",arch:"x64",abi:null,platformArchABI:"qwik.darwin-x64.node"}]},win32:{x64:[{platform:"win32",arch:"x64",abi:"msvc",platformArchABI:"qwik.win32-x64-msvc.node"}]},linux:{x64:[{platform:"linux",arch:"x64",abi:"gnu",platformArchABI:"qwik.linux-x64-gnu.node"}]}},pe={qwik:"2.0.0-beta.11-dev+d7daca3"};async function le(){const e=rt(),n={dynamicImport:i=>{throw new Error(`Qwik Optimizer sys.dynamicImport() not implemented, trying to import: "${i}"`)},strictDynamicImport:i=>{throw new Error(`Qwik Optimizer sys.strictDynamicImport() not implemented, trying to import: "${i}"`)},path:null,cwd:()=>"/",os:"unknown",env:e};if(n.path=V(n),e==="node"||e==="bun"){if(n.dynamicImport=i=>require(i),n.strictDynamicImport=i=>import(i),typeof TextEncoder>"u"){const i=await n.dynamicImport("node:util");globalThis.TextEncoder=i.TextEncoder,globalThis.TextDecoder=i.TextDecoder}}else(e==="webworker"||e==="browsermain")&&(n.strictDynamicImport=i=>import(i),n.dynamicImport=async i=>{const o=await(await fetch(i)).text(),d={exports:{}};return new Function("module","exports",o)(d,d.exports),d.exports});if(e!=="webworker"&&e!=="browsermain")try{n.path=await n.dynamicImport("node:path"),n.cwd=()=>process.cwd(),n.os=process.platform}catch{}return n}async function Bt(e){const n=rt();if(n==="node"||n==="bun"){const i=ae[process.platform];if(i){const r=i[process.arch];if(r)for(const o of r)try{return await e.dynamicImport(`../bindings/${o.platformArchABI}`)}catch(d){console.warn(`Unable to load native binding ${o.platformArchABI}. Falling back to wasm build.`,d?.message)}}}{if(n==="node"||n==="bun"){const i=e.path.join(__dirname,"..","bindings","qwik_wasm_bg.wasm"),r=await e.dynamicImport("../bindings/qwik.wasm.cjs"),d=await(await e.dynamicImport("node:fs")).promises.readFile(i),c=await WebAssembly.compile(d);return await r.default(c),r}if(n==="webworker"||n==="browsermain"){let i=pe.qwik;const r=`qwikWasmCjs${i}`,o=`qwikWasmRsp${i}`;let d=globalThis[r],c=globalThis[o];if(!d||!c){i=pe.qwik.split("-dev")[0];const x=`https://cdn.jsdelivr.net/npm/@qwik.dev/core@${i}/bindings/`,k=new URL("./qwik.wasm.cjs",x).href,u=new URL("./qwik_wasm_bg.wasm",x).href,w=await Promise.all([fetch(k),fetch(u)]);for(const g of w)if(!g.ok)throw new Error(`Unable to fetch Qwik WASM binding from ${g.url}`);const m=w[0];globalThis[r]=d=await m.text(),globalThis[o]=c=w[1]}const a={exports:{}};new Function("module","exports",d)(a,a.exports);const t=a.exports;return await t.default(c.clone()),t}}throw new Error("Platform not supported")}const rt=()=>typeof Deno<"u"?"deno":typeof Bun<"u"?"bun":typeof process<"u"&&typeof global<"u"&&process.versions&&process.versions.node?"node":typeof self<"u"&&typeof location<"u"&&typeof navigator<"u"&&typeof fetch=="function"&&typeof WorkerGlobalScope=="function"&&typeof self.importScripts=="function"?"webworker":typeof window<"u"&&typeof document<"u"&&typeof location<"u"&&typeof navigator<"u"&&typeof Window=="function"&&typeof fetch=="function"?"browsermain":"unknown",ot=async(e={})=>{const n=e?.sys||await le(),i=e?.binding||await Bt(n);return{async transformModules(o){return Ft(i,o)},sys:n}},Ft=(e,n)=>e.transform_modules(At(n)),At=e=>{const n={minify:"simplify",sourceMaps:!1,transpileTs:!1,transpileJsx:!1,preserveFilenames:!1,explicitExtensions:!1,mode:"lib",manualChunks:void 0,scope:void 0,regCtxName:void 0,stripEventHandlers:!1,rootDir:void 0,stripExports:void 0,stripCtxName:void 0,isServer:void 0};return Object.entries(e).forEach(([i,r])=>{r!=null&&(n[i]=r)}),n.entryStrategy=e.entryStrategy?.type??"smart",n.manualChunks=e.entryStrategy?.manual??void 0,n},zt=(e,n=0)=>{for(let i=0;i<e.length;i++){const r=e.charCodeAt(i);n=(n<<5)-n+r,n|=0}return Number(Math.abs(n)).toString(36)},Ht=new Set(["_run","_task"]);function Wt(e){const n=e.symbols;return Object.keys(n).sort((i,r)=>{const o=n[i],d=n[r];if(o.ctxKind==="eventHandler"&&d.ctxKind!=="eventHandler")return-1;if(o.ctxKind!=="eventHandler"&&d.ctxKind==="eventHandler")return 1;if(o.ctxKind==="eventHandler"&&d.ctxKind==="eventHandler"){const c=it.indexOf(o.ctxName.toLowerCase()),a=it.indexOf(d.ctxName.toLowerCase());if(c>-1&&a>-1){if(c<a)return-1;if(c>a)return 1}else{if(c>-1)return-1;if(a>-1)return 1}}else if(o.ctxKind==="function"&&d.ctxKind==="function"){const c=st.indexOf(o.ctxName.toLowerCase()),a=st.indexOf(d.ctxName.toLowerCase());if(c>-1&&a>-1){if(c<a)return-1;if(c>a)return 1}else{if(c>-1)return-1;if(a>-1)return 1}}return!o.parent&&d.parent?-1:o.parent&&!d.parent?1:o.hash<d.hash?-1:o.hash>d.hash?1:0})}const it=["click","dblclick","contextmenu","auxclick","pointerdown","pointerup","pointermove","pointerover","pointerenter","pointerleave","pointerout","pointercancel","gotpointercapture","lostpointercapture","touchstart","touchend","touchmove","touchcancel","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","wheel","gesturestart","gesturechange","gestureend","keydown","keyup","keypress","input","change","search","invalid","beforeinput","select","focusin","focusout","focus","blur","submit","reset","scroll"].map(e=>`on${e.toLowerCase()}$`),st=["useTask$","useVisibleTask$","component$","useStyles$","useStylesScoped$"].map(e=>e.toLowerCase());function Gt(e){return Object.keys(e.bundles).sort(Le)}function Qt(e){const n=Wt(e),i={},r={};for(const c of n)i[c]=e.symbols[c],r[c]=e.mapping[c];const o=Gt(e),d={};for(const c of o){d[c]=e.bundles[c];const a=e.bundles[c];Array.isArray(a.imports)&&a.imports.sort(Le),Array.isArray(a.dynamicImports)&&a.dynamicImports.sort(Le);const p=[];for(const t of n)c===r[t]&&p.push(t);p.length>0&&(p.sort(Le),a.symbols=p)}return e.symbols=i,e.mapping=r,e.bundles=d,e}function Le(e,n){return e=e.toLocaleLowerCase(),n=n.toLocaleLowerCase(),e<n?-1:e>n?1:0}function at(e){if(e!=null&&e.mapping!=null&&typeof e.mapping=="object"&&e.symbols!=null&&typeof e.symbols=="object"&&e.bundles!=null&&typeof e.bundles=="object")return e}const Kt=(e,n)=>{let i=0;if(e.symbols)for(const r of e.symbols){let o=1;const d=n.symbols[r];d&&(d.ctxKind==="function"?/(component|useStyles|useStylesScoped)/i.test(d.ctxName)?o+=1:/(useComputed|useTask|useVisibleTask|useOn)/i.test(d.ctxName)&&(o+=2):(o+=1,/(click|mouse|pointer|touch|key|scroll|gesture|wheel)/i.test(d.ctxName)&&(o+=3))),i=Math.max(i,o)}return i};function Jt(e){let n=0;const i=[],r=[],o=new Map,d=new Map,c=new Set;function a(m){o.set(m,n),d.set(m,n),n++,i.push(m),c.add(m);const g=e[m].imports||[];for(const f of g)o.has(f)?c.has(f)&&d.set(m,Math.min(d.get(m),o.get(f))):(a(f),d.set(m,Math.min(d.get(m),d.get(f))));if(d.get(m)===o.get(m)){const f=[];let l;do l=i.pop(),c.delete(l),f.push(l);while(l!==m);r.push(f)}}for(const m of Object.keys(e))o.has(m)||a(m);const p=new Map;r.forEach((m,g)=>{for(const f of m)p.set(f,g)});const t=Array.from({length:r.length},()=>new Set);for(const m of Object.keys(e)){const g=p.get(m);for(const f of e[m].imports||[]){const l=p.get(f);g!==l&&t[g].add(l)}}const x=new Set,k=[];function u(m){x.add(m);for(const g of t[m])x.has(g)||u(g);k.push(m)}for(let m=0;m<r.length;m++)x.has(m)||u(m);k.reverse();const w=new Array(r.length).fill(0);for(let m=0;m<r.length;m++){let g=0;for(const f of r[m])g+=e[f].size;w[m]=g}for(let m=k.length-1;m>=0;m--){const g=k[m];let f=w[g];for(const l of t[g])f+=w[l];w[g]=f}for(let m=0;m<r.length;m++){const g=w[m];for(const f of r[m])e[f].total=g}}const lt=/[/\\](core|qwik)[/\\]dist[/\\]preloader\.(|c|m)js$/,ct=/[/\\](core|qwik)[/\\]dist[/\\]core(\.min|\.prod)?\.(|c|m)js$/,dt=/[/\\](core|qwik)[/\\](dist[/\\])?qwikloader(\.debug)?\.[^/]*js$/,ut=/[/\\](core|qwik)[/\\]handlers\.(|c|m)js$/;function Yt(e,n,i,r,o,d,c){var k;const a={version:"1",manifestHash:"",options:{target:o.target,buildMode:o.buildMode,entryStrategy:o.entryStrategy&&{type:o.entryStrategy.type}},core:void 0,preloader:void 0,qwikLoader:void 0,bundleGraphAsset:void 0,injections:i,mapping:{},bundles:{},assets:{},symbols:{},bundleGraph:void 0},p=u=>{const w=r[u];if(!w){console.warn(`Client manifest generation: skipping external import "${u}"`);return}return c(w.fileName)};let t;const x=new Set(n.map(u=>u.name));for(const u of Object.values(r)){if(u.type==="asset"){u.fileName.endsWith("js.map")||(a.assets[u.fileName]={name:u.names[0],size:u.source.length});continue}const w=c(u.fileName),g={size:u.code.length,total:-1};for(const h of u.exports)x.has(h)&&(!a.mapping[h]||u.exports.length!==1)&&(a.mapping[h]=w);const f=u.imports.filter(h=>u.code.includes(e.basename(h))).map(h=>p(h)).filter(Boolean);f.length>0&&(g.imports=f);const l=u.dynamicImports.filter(h=>u.code.includes(e.basename(h))).map(h=>p(h)).filter(Boolean);l.length>0&&(g.dynamicImports=l),u.facadeModuleId&&(lt.test(u.facadeModuleId)?a.preloader=w:ct.test(u.facadeModuleId)?a.core=w:dt.test(u.facadeModuleId)?a.qwikLoader=w:ut.test(u.facadeModuleId)&&(t=w));const y=(u.moduleIds||Object.keys(u.modules)).filter(h=>!h.startsWith("\0")).map(h=>e.relative(o.rootDir,h));y.length>0&&(g.origins=y,!a.preloader&&y.some(h=>lt.test(h))&&(a.preloader=w),!a.core&&y.some(h=>ct.test(h))&&(a.core=w),!a.qwikLoader&&y.some(h=>dt.test(h))&&(a.qwikLoader=w),!t&&y.some(h=>ut.test(h))&&(t=w)),a.bundles[w]=g}for(const u of n){const w=u.name,m=a.mapping[w];if(!m){d(`Note: qrl ${u.name} is not in the bundle, likely tree shaken`,a);continue}((k=a.bundles[m]).symbols||(k.symbols=[])).push(w),a.symbols[w]={displayName:u.displayName,hash:u.hash,ctxKind:u.ctxKind,ctxName:u.ctxName,captures:u.captures,canonicalFilename:u.canonicalFilename,parent:u.parent,origin:u.origin,loc:u.loc,paramNames:u.paramNames,captureNames:u.captureNames}}if(t)for(const u of Ht)a.symbols[u]={origin:"Qwik core",displayName:u,canonicalFilename:"",hash:u,ctxKind:"function",ctxName:u,captures:!1,parent:null,loc:[0,0]},a.mapping[u]=t;else console.error("Qwik core bundle not found, is Qwik actually used in this project?");for(const u of Object.values(a.bundles)){const w=Kt(u,a);u.interactivity=w}return Jt(a.bundles),Qt(a)}const Xt=.5/(300*1024/8),Vt=e=>{const n=e.lastIndexOf("_");return n>-1?e.slice(n+1):e};function Zt(e,n){const i=[];if(!e.bundles)return[];const r={...e.bundles};for(const[p,t]of Object.entries(e.mapping)){if(p.startsWith("_")&&p.length<10)continue;const x=Vt(p);x&&(r[x]={dynamicImports:[t]})}if(n){const p={...e,bundles:r};for(const t of n){const x=t(p);x&&Object.assign(r,x)}}for(const p of Object.keys(r)){const t=r[p],x=t.imports?.filter(u=>r[u])||[],k=t.dynamicImports?.filter(u=>r[u]&&(r[u].symbols||r[u].origins?.some(w=>!w.includes("node_modules"))))||[];r[p]={...t,imports:x,dynamicImports:k}}const o=new Set(Object.keys(r));for(const p of Object.keys(r)){for(const t of r[p].imports)o.delete(t);for(const t of r[p].dynamicImports)o.delete(t)}for(const p of o){const t=r[p];!t.imports?.length&&!t.dynamicImports?.length&&delete r[p]}const d=Object.keys(r),c=new Map,a=(p,t,x=new Set)=>{const k=r[t];for(const u of k.imports)p.has(u)&&p.delete(u),x.has(u)||(x.add(u),a(p,u,x))};for(const p of d){const t=r[p],x=new Set(t.imports);for(const m of x)a(x,m);const k=new Set(t.dynamicImports),u=new Map;for(const m of k){a(k,m);const g=r[m];let f=.5;if(f+=(g.interactivity||0)*.08,t.origins&&g.origins){for(const l of t.origins)if(g.origins.some(s=>s.startsWith(l))){f+=.25;break}}g.total>Xt&&(f+=f>.5?.02:-.02),g.total<1e3&&(f+=.15),u.set(m,Math.min(f,.99))}if(k.size>0){const m=Array.from(k).sort((f,l)=>u.get(l)-u.get(f));let g=-1;for(const f of m)u.get(f)!==g&&(g=u.get(f),x.add(-Math.round(g*10))),x.add(f)}const w=i.length;i.push(p);for(let m=0;m<x.size;m++)i.push(null);c.set(p,{index:w,deps:x})}for(const p of d){const t=c.get(p);let{index:x,deps:k}=t;x++;for(const u of k){if(typeof u=="number"){i[x++]=u;continue}const m=c.get(u).index;i[x++]=m}}return i}async function en(e,n,i){const r=await e.dynamicImport("eslint");let o=new r.ESLint({cache:!0});if((await o.calculateConfigForFile("no-real-file.tsx")).parser===null){const a={cache:!0,overrideConfig:{languageOptions:{parserOptions:{tsconfigRootDir:n,project:i,ecmaVersion:2021,sourceType:"module",ecmaFeatures:{jsx:!0}}}}};o=new r.ESLint(a)}return{async lint(a,p,t){try{const x=tn(t);if(await o.isPathIgnored(x))return null;(await o.lintText(p,{filePath:x})).forEach(u=>{for(const w of u.messages){if(w.ruleId!=null&&!w.ruleId.startsWith("qwik/"))continue;const m=nn(u.filePath,w);a.warn(m)}})}catch(x){console.warn(x)}}}}function tn(e){return e.split("?",2)[0]}function nn(e,n){return Object.assign(new Error(n.message),{id:e,plugin:"vite-plugin-eslint",loc:{file:e,column:n.column,line:n.line},stack:""})}async function rn(e,n){const i=n;let r=i.loc;if(!i.frame&&!i.plugin&&(r||(r=on(i)),r&&(i.loc=r,r.file))){const o=await e.dynamicImport("node:fs"),{normalizePath:d}=await e.dynamicImport("vite");i.id=d(i.loc.file);try{const c=o.readFileSync(i.loc.file,"utf-8");i.frame=an(c,i.loc)}catch{}}return n}const on=e=>{const n=e.stack;if(typeof n=="string"){const i=n.split(`
8
+ `).filter(r=>!r.includes("/node_modules/")&&!r.includes("(node:"));for(let r=1;r<i.length;r++){const o=i[r].replace("file:///","/");if(/^\s+at/.test(o)){const d=o.indexOf("/"),c=o.lastIndexOf(")",d);if(d>0){const p=o.slice(d,c).split(":"),t=ft(p[p.length-1]),x=ft(p[p.length-2]);return typeof t=="number"&&typeof x=="number"?(p.length-=2,{file:p.join(":"),line:x,column:t}):typeof t=="number"?(p.length-=1,{file:p.join(":"),line:t,column:void 0}):{file:p.join(":"),line:void 0,column:void 0}}}}}},ee=e=>e.startsWith("\0"),ft=e=>{try{return parseInt(e,10)}catch{return}},pt=/\r?\n/,ht=2;function sn(e,n){if(typeof n=="number")return n;if(n.lo!=null)return n.lo;const i=e.split(pt),{line:r,column:o}=n;let d=0;for(let c=0;c<r-1&&c<i.length;c++)d+=i[c].length+1;return d+o}function an(e,n=0,i){n=sn(e,n),i=i||n;const r=e.split(pt);let o=0;const d=[];for(let c=0;c<r.length;c++)if(o+=r[c].length+1,o>=n){for(let a=c-ht;a<=c+ht||i>o;a++){if(a<0||a>=r.length)continue;const p=a+1;d.push(`${p}${" ".repeat(Math.max(3-String(p).length,0))}| ${r[a]}`);const t=r[a].length;if(a===c){const x=Math.max(n-(o-t)+1,0),k=Math.max(1,i>o?t-x:i-n);d.push(" | "+" ".repeat(x)+"^".repeat(k))}else if(a>c){if(i>o){const x=Math.max(Math.min(i-o,t),1);d.push(" | "+"^".repeat(x))}o+=t+1}}break}return d.join(`
9
+ `)}function ln(e){return e==="win32"}function Ue(e){const[n,i]=e.split("?"),r=i||"";return{originalId:e,pathId:n,query:r?`?${i}`:"",params:new URLSearchParams(r)}}const cn=["server"],dn=["onGet","onPost","onPut","onRequest","onDelete","onHead","onOptions","onPatch","onStaticGenerate"],un=["useServer","route","server","action$","loader$","zod$","validator$","globalAction$"],fn=["useClient","useBrowser","useVisibleTask","client","browser","event$"];var mt=(e=>(e.preventNavigate="preventNavigate",e.valibot="valibot",e.noSPA="noSPA",e.enableRequestRewrite="enableRequestRewrite",e.webWorker="webWorker",e.insights="insights",e))(mt||{});function gt(e={}){const n=`${Math.round(Math.random()*899)+100}`,i=new Map,r=new Map,o=new Map,d=new Map;let c=null,a,p=()=>{};const t={csr:!1,target:"client",buildMode:"development",debug:!1,rootDir:void 0,tsconfigFileNames:["./tsconfig.json"],input:void 0,outDir:void 0,assetsDir:void 0,resolveQwikBuild:!0,entryStrategy:void 0,srcDir:void 0,ssrOutDir:void 0,clientOutDir:void 0,sourcemap:!!e.sourcemap,manifestInput:null,manifestOutput:null,transformedModuleOutput:null,scope:null,devTools:{imageDevTools:!0,clickToSource:["Alt"]},inlineStylesUpToBytes:2e4,lint:!1,experimental:void 0};let x,k;const u=async()=>{if(!c){c=await ot(e),x=pn(c.sys);try{k===void 0&&(k=await c.sys.dynamicImport("node:fs"))}catch{console.log("node:fs not available, disabling automatic manifest reading"),k=null}}},w=()=>{if(!c)throw new Error("Qwik plugin has not been initialized");return c},m=()=>w().sys,g=()=>w().sys.path;let f;const l=S=>{f=S},s=async S=>{const b=Object.assign({},S),_=w(),N=_.sys.path,D=(...O)=>Q(N.resolve(...O));t.debug=!!b.debug,b.assetsDir&&(t.assetsDir=b.assetsDir),b.target==="ssr"||b.target==="client"||b.target==="lib"||b.target==="test"?t.target=b.target:t.target||(t.target="client"),t.target==="lib"?t.buildMode="development":b.buildMode==="production"||b.buildMode==="development"?t.buildMode=b.buildMode:t.buildMode||(t.buildMode="development"),t.csr=!!b.csr,b.entryStrategy&&typeof b.entryStrategy=="object"&&(t.entryStrategy={...b.entryStrategy}),t.entryStrategy||(t.target==="ssr"||t.target==="test"?t.entryStrategy={type:"hoist"}:t.target==="lib"?t.entryStrategy={type:"inline"}:t.buildMode==="production"?t.entryStrategy={type:"smart"}:t.entryStrategy={type:"segment"}),typeof b.rootDir=="string"&&(t.rootDir=b.rootDir),typeof t.rootDir!="string"&&(t.rootDir||(t.rootDir=_.sys.cwd())),t.rootDir=D(_.sys.cwd(),t.rootDir);let C=D(t.rootDir,gn);if(typeof b.srcDir=="string"?(t.srcDir=D(t.rootDir,b.srcDir),C=t.srcDir):t.srcDir||(t.srcDir=C),t.srcDir=D(t.rootDir,t.srcDir),Array.isArray(b.tsconfigFileNames)&&b.tsconfigFileNames.length>0&&(t.tsconfigFileNames=b.tsconfigFileNames),!t.csr&&!b.input&&!t.input&&(t.target==="ssr"?t.input=[D(C,"entry.ssr")]:t.target==="client"?t.input=[D(C,"root")]:t.input=void 0),b.outDir&&(t.outDir=D(t.rootDir,b.outDir)),t.clientOutDir=D(t.rootDir,b.clientOutDir||bt),t.ssrOutDir=D(t.rootDir,b.ssrOutDir||yn),t.target==="ssr"?t.outDir||(t.outDir=t.ssrOutDir):t.target==="lib"?t.outDir||(t.outDir=D(t.rootDir,bn)):t.outDir||(t.outDir=t.clientOutDir),typeof b.manifestOutput=="function"&&(t.manifestOutput=b.manifestOutput),b.manifestInput&&(t.manifestInput=at(b.manifestInput)||null),typeof b.transformedModuleOutput=="function"&&(t.transformedModuleOutput=b.transformedModuleOutput),b.scope!==void 0)t.scope=b.scope;else if(!t.scope&&k){let O="";try{let $=t.rootDir;for(;O=N.resolve($,"package.json"),!await k.promises.stat(O).catch(()=>!1);){const M=N.resolve($,"..");if(M===$)break;$=M,O=""}if(O){const M=await k.promises.readFile(O,"utf-8"),q=JSON.parse(M);typeof q.name=="string"&&(t.scope=q.name)}}catch($){console.warn(`could not read ${O||"package.json"} to determine package name, ignoring. (${$})`)}}if(typeof b.resolveQwikBuild=="boolean"&&(t.resolveQwikBuild=b.resolveQwikBuild),typeof b.devTools=="object"&&("imageDevTools"in b.devTools&&(t.devTools.imageDevTools=b.devTools.imageDevTools),"clickToSource"in b.devTools&&(t.devTools.clickToSource=b.devTools.clickToSource)),"inlineStylesUpToBytes"in e&&(typeof e.inlineStylesUpToBytes=="number"?t.inlineStylesUpToBytes=e.inlineStylesUpToBytes:(typeof t.inlineStylesUpToBytes!="number"||t.inlineStylesUpToBytes<0)&&(t.inlineStylesUpToBytes=0)),typeof b.lint=="boolean"&&(t.lint=b.lint),"experimental"in b){t.experimental=void 0;for(const O of b.experimental??[])mt[O]?(t.experimental||(t.experimental={}))[O]=!0:console.error(`Qwik plugin: Unknown experimental feature: ${O}`)}const B={...t};return t.input||(t.input=b.input),t.input&&typeof t.input=="string"&&(t.input=[t.input]),B};let y=!1;const h=async S=>{if(!y){y=!0;const b=m();if(b.env==="node"){const _=await b.dynamicImport("node:fs");if(!_.existsSync(t.rootDir))throw new Error(`Qwik rootDir "${t.rootDir}" not found.`);if(typeof t.srcDir=="string"&&!_.existsSync(t.srcDir))throw new Error(`Qwik srcDir "${t.srcDir}" not found.`);for(const[N,D]of Object.entries(t.input||{}))if(!await S(D))throw new Error(`Qwik input "${D}" not found.`)}}};let I,v=!1;const T=async S=>{if(L("buildStart()",t.buildMode,t.scope,t.target,t.rootDir,t.srcDir),I=w(),v=!f,I.sys.env==="node"&&t.target==="ssr"&&t.lint)try{a=await en(I.sys,t.rootDir,t.tsconfigFileNames)}catch{}if(L("transformedOutputs.clear()"),r.clear(),o.clear(),t.target==="client"){const b=await S.resolve("@qwik.dev/core/qwikloader.js",void 0,{skipSelf:!0});b&&S.emitFile({id:b.id,type:"chunk",preserveSignature:"allow-extension"})}},E=S=>f?!!S?.ssr:t.target==="ssr"||t.target==="test";let P=0,U=!1;const j=async(S,b,_,N)=>{if(ee(b))return;const D=f&&/^(.*)\?editor(:(\d+)(:\d+)?)?$/.exec(b);if(D){if(!U){U=!0,setTimeout(()=>U=!1,500);const[,K,z]=D,he=await S.resolve(K,_);if(he){const ue=f.moduleGraph.getModuleById(he.id)?.file;if(ue){const se=`${ue}${z}`;try{console.warn(`Opening in editor: ${se}`);const X=(await import("launch-editor")).default;X(se)}catch(X){console.error(`Failed to open editor: ${X.message}`)}}}}return{id:"\0editor"}}const C=P++,B=E(N);L(`resolveId(${C})`,`begin ${b} | ${B?"server":"client"} | ${_}`);const O=_&&Ue(_);if(_=O&&Q(O.pathId),b.startsWith(".")&&O){const K=g(),z=K.dirname(O.pathId);z&&(b=K.resolve(z,b))}const $=Ue(b),M=Q($.pathId);let q;if(d.get(M))L(`resolveId(${C}) Resolved already known ${M}`),q={id:M+$.query,moduleSideEffects:!1};else if(M.endsWith(re))t.resolveQwikBuild&&(L(`resolveId(${C})`,"Resolved",re),q={id:re,moduleSideEffects:!1});else if(M.endsWith(oe))L(`resolveId(${C})`,"Resolved",oe),q={id:oe,moduleSideEffects:!1};else if(!f&&!B&&M.endsWith(Ye)){L(`resolveId(${C})`,"Resolved",Ye);const K=await S.resolve(Ye,_,{skipSelf:!0});if(K)return S.emitFile({id:K.id,type:"chunk",preserveSignature:"allow-extension"}),K}else if(M.endsWith(ge))L(`resolveId(${C})`,"Resolved",ge),q={id:ge,moduleSideEffects:!1};else{if(!B&&v&&b.endsWith("@qwik.dev/core")){v=!1;const z=await S.resolve("@qwik.dev/core/handlers.mjs",_,{skipSelf:!0});if(!z)throw new Error("Failed to resolve @qwik.dev/core/handlers.mjs");S.emitFile({id:z.id,type:"chunk",preserveSignature:"allow-extension"})}const K=/^(?<parent>.*\.[mc]?[jt]sx?)_(?<name>[^/]+)\.js(?<query>$|\?.*$)/.exec(b)?.groups;if(K){const{parent:z,name:he,query:ue}=K,se=await S.resolve(z,_,{skipSelf:!0});if(se){const X=se.id.split("?")[0],We=f&&_?.endsWith(".html")?`${X}_${he}.js`:M;L(`resolveId(${C})`,`resolved to QRL ${he} of ${X}`),d.set(We,X),q={id:We+ue,moduleSideEffects:!1}}else console.error(`resolveId(${C})`,`QRL parent ${z} does not exist!`)}else if(_){const z=d.get(_);if(z)return L(`resolveId(${C}) end`,`resolving via ${z}`),S.resolve(b,z,{skipSelf:!0})}}return L(`resolveId(${C}) end`,q?.id||q),q};let R=0;const H=async(S,b,_)=>{if(b==="\0editor")return'"opening in editor"';if(ee(b)||b.startsWith("/@fs/"))return;const N=R++,D=E(_);if(t.resolveQwikBuild&&b===re)return L(`load(${N})`,re,t.buildMode),{moduleSideEffects:!1,code:de(D,t.target)};if(b===oe)return L(`load(${N})`,oe,t.buildMode),{moduleSideEffects:!1,code:await ze(D)};if(b===ge)return L(`load(${N})`,ge,t.buildMode),{moduleSideEffects:!1,code:"export * from '@qwik.dev/core';"};const C=Ue(b);b=Q(C.pathId);const B=D?o:r;if(f&&!B.has(b)){const $=d.get(b);if($){const M=f.moduleGraph.getModuleById($);if(M){if(L(`load(${N})`,"transforming QRL parent",$),await f.transformRequest(M.url),!B.has(b))return L(`load(${N})`,`QRL segment ${b} not found in ${$}`),null}else console.error(`load(${N})`,`${M} does not exist!`)}}const O=B.get(b);if(O){L(`load(${N})`,"Found",b);const{code:$,map:M,segment:q}=O[0];return{code:$,map:M,meta:{segment:q}}}return L(`load(${N})`,"Not a QRL or virtual module",b),null},Y=(S,b)=>!!(f&&S.includes(".vite/deps/")&&b.slice(0,1e4).includes("qwik"));let ce=0;const W=async function(S,b,_,N={}){if(ee(_))return;const D=ce++,C=E(N),B=C?o:r;if(B.has(_))return;const O=w(),$=g(),{pathId:M}=Ue(_),q=$.parse(M),K=q.dir,z=q.base;if(q.ext.toLowerCase()in mn||yt.test(M)||Y(_,b)){const ue=t.target==="client"||t.target==="ssr";L(`transform(${D})`,`Transforming ${_} (for: ${C?"server":"client"}${ue?", strip":""})`);const se=t.target==="lib"?"lib":t.buildMode==="development"?"dev":"prod";se!=="lib"&&(b=b.replaceAll(/__EXPERIMENTAL__\.(\w+)/g,(ne,fe)=>t.experimental?.[fe]?"true":"false"));let X=z;t.srcDir&&(X=$.relative(t.srcDir,M)),X=Q(X);const He=t.srcDir?t.srcDir:Q(K),We=t.entryStrategy;let $t;f&&($t=f.moduleGraph.getModuleById(M)?.url);const me={input:[{code:b,path:X,devPath:$t}],entryStrategy:C?{type:"hoist"}:We,minify:"simplify",sourceMaps:t.sourcemap||t.buildMode==="development",transpileTs:!0,transpileJsx:!0,explicitExtensions:!0,preserveFilenames:!0,srcDir:He,rootDir:t.rootDir,mode:se,scope:t.scope||void 0,isServer:C};ue&&(C?(me.stripCtxName=fn,me.stripEventHandlers=!0,me.regCtxName=cn):(me.stripCtxName=un,me.stripExports=dn));const Kr=Date.now(),Oe=await O.transformModules(me);L(`transform(${D})`,`done in ${Date.now()-Kr}ms`);const Ge=Oe.modules.find(ne=>!hn(ne));p(Oe.diagnostics,O,He),C?Oe.diagnostics.length===0&&a&&a.lint(S,b,_):i.set(_,Oe);const tt=new Set;for(const ne of Oe.modules)if(ne!==Ge){const fe=Q($.join(He,ne.path));L(`transform(${D})`,`segment ${fe}`,ne.segment.displayName),d.set(fe,_),B.set(fe,[ne,_]),tt.add(fe),t.target==="client"&&!f&&S.emitFile({id:fe,type:"chunk",preserveSignature:"allow-extension"})}return await Promise.all([...tt.values()].map(ne=>S.load({id:ne}))),S.addWatchFile(_),{code:Ge.code,map:Ge.map,meta:{segment:Ge.segment,qwikdeps:Array.from(tt)}}}return L(`transform(${D})`,"Not transforming",_),null},Z=S=>{const b=[],_={addInjection:N=>b.push(N)};return _.generateManifest=async N=>{const C=w().sys.path,B=C.resolve(t.rootDir,t.outDir,"build"),O=q=>C.relative(B,C.resolve(t.rootDir,t.outDir,q));_.canonPath=O;const $=Array.from(i.values()).flatMap(q=>q.modules).map(q=>q.segment).filter(q=>!!q),M=Yt(C,$,b,S,t,L,O);N&&Object.assign(M,N);for(const q of Object.values(M.symbols))q.origin&&(q.origin=Q(q.origin));for(const q of Object.values(M.bundles))q.origins&&(q.origins=q.origins.sort());return M.manifestHash=zt(JSON.stringify(M)),M},_},te=()=>t,je=()=>Array.from(r.values()).map(S=>S[0]),L=(...S)=>{t.debug&&console.debug(`[QWIK PLUGIN: ${n}]`,...S)},G=(...S)=>{console.log(`[QWIK PLUGIN: ${n}]`,...S)},Ae=S=>{p=S},Q=S=>x(S);function de(S,b){const _=t.buildMode==="development";return`// @qwik.dev/core/build
10
+ export const isServer = ${JSON.stringify(S)};
11
+ export const isBrowser = ${JSON.stringify(!S)};
12
+ export const isDev = ${JSON.stringify(_)};
13
+ `}async function ze(S){if(!t.manifestInput&&t.target==="ssr"&&t.buildMode==="production"&&k){const N=g();let D=N.resolve(t.clientOutDir,Xe);await k.promises.stat(D).catch(()=>!1)||(D=N.resolve(t.rootDir,bt,Xe));try{const C=await k.promises.readFile(D,"utf-8");t.manifestInput=at(JSON.parse(C))||null,console.info("Read client manifest from",D)}catch(C){console.warn(`
14
+ ==========
15
+ Could not read Qwik client manifest ${D}.
16
+ Make sure you provide it to the SSR renderer via the \`manifest\` argument, or define it in \`globalThis.__QWIK_MANIFEST__\` before the server bundle is loaded, or embed it in the server bundle by replacing \`globalThis.__QWIK_MANIFEST__\`.
17
+ Without the manifest, the SSR renderer will not be able to generate event handlers.
18
+ (${C})
19
+ ==========
20
+ `)}}const b=S?t.manifestInput:null;let _=null;return b?.manifestHash&&(_={manifestHash:b.manifestHash,core:b.core,preloader:b.preloader,qwikLoader:b.qwikLoader,bundleGraphAsset:b.bundleGraphAsset,injections:b.injections,mapping:b.mapping,bundleGraph:b.bundleGraph}),`// @qwik-client-manifest
21
+ export const manifest = ${_?JSON.stringify(_):"globalThis.__QWIK_MANIFEST__"};
22
+ `}function Hr(S){t.sourcemap=S}function Wr(S){L("handleHotUpdate()",S.file);for(const b of S.modules){const{id:_}=b;if(_){L("handleHotUpdate()",`invalidate ${_}`),i.delete(_);for(const N of[r,o])for(const[D,[C,B]]of N)if(B===_){L("handleHotUpdate()",`invalidate ${_} segment ${D}`),N.delete(D);const O=S.server.moduleGraph.getModuleById(D);O&&S.server.moduleGraph.invalidateModule(O)}}}}const Gr=(S,{getModuleInfo:b})=>{if(t.target==="client"){if(S.endsWith("@qwik.dev/core/build")||/[/\\](core|qwik)[/\\]dist[/\\]preloader\.[cm]js$/.test(S)||S==="\0vite/preload-helper.js")return"qwik-preloader";if(/[/\\](core|qwik)[/\\](handlers|dist[/\\]core(\.prod|\.min)?)\.[cm]js$/.test(S))return"qwik-core";if(/[/\\](core|qwik)[/\\]dist[/\\]qwikloader\.js$/.test(S))return"qwik-loader"}const _=b(S);if(_){const N=_.meta.segment;if(N){const{hash:D}=N,C=t.entryStrategy.manual?.[D]||N.entry;if(C)return C}if(_.meta.qwikdeps?.length===0){if(S.includes("node_modules")){const D=S.lastIndexOf("node_modules");if(D>=0)return S.slice(D+13)}else if(t.srcDir&&S.includes(t.srcDir)){const D=g();return Q(D.relative(t.srcDir,S))}}}return null};async function Qr(S,b,_,N){const C=await Z(b).generateManifest(N);C.platform={...N?.platform,rollup:S.meta?.rollupVersion||"",env:I.sys.env,os:I.sys.os},I.sys.env==="node"&&(C.platform.node=process.versions.node);const B=Zt(C,_),O=S.emitFile({type:"asset",name:"bundle-graph.json",source:JSON.stringify(B)}),$=S.getFileName(O);C.bundleGraphAsset=$,C.assets[$]={name:"bundle-graph.json",size:B.length};const M=JSON.stringify(C,null," ");S.emitFile({fileName:Xe,type:"asset",source:M}),typeof t.manifestOutput=="function"&&await t.manifestOutput(C),typeof t.transformedModuleOutput=="function"&&await t.transformedModuleOutput(je())}return{buildStart:T,createOutputAnalyzer:Z,getQwikBuildModule:de,getOptimizer:w,getOptions:te,getPath:g,getSys:m,getTransformedOutputs:je,init:u,load:H,debug:L,log:G,normalizeOptions:s,normalizePath:Q,onDiagnostics:Ae,resolveId:j,transform:W,validateSource:h,setSourceMapSupport:Hr,configureServer:l,handleHotUpdate:Wr,manualChunks:Gr,generateManifest:Qr}}const pn=e=>n=>typeof n=="string"?ln(e.os)?(n.startsWith("\\\\?\\")||/[^\u0000-\u0080]+/.test(n)||(n=n.replace(/\\/g,"/")),e.path.posix.normalize(n)):e.path.normalize(n):n;function hn(e){return e.isEntry||e.segment}const mn={".jsx":!0,".ts":!0,".tsx":!0},yt=/\.qwik\.[mc]?js$/,$e="@qwik.dev/core",Re="@qwik.dev/core/internal",re="@qwik.dev/core/build",Qe="@qwik.dev/core/jsx-runtime",Ke="@qwik.dev/core/jsx-dev-runtime",Je="@qwik.dev/core/server",oe="@qwik-client-manifest",Ye="@qwik.dev/core/preloader",ge="@qwik-handlers",gn="src",bt="dist",yn="server",bn="lib",Xe="q-manifest.json";async function wn(e,n,i){const r=await e.dynamicImport("node:fs");let o=i;for(;o;){const d=e.path.join(o,"node_modules",n,"package.json");try{return await r.promises.access(d),r.promises.realpath(d)}catch{}const c=e.path.dirname(o);if(c===o)break;o=c}}function vn(e={}){const n=gt(e.optimizerOptions);return{name:"rollup-plugin-qwik",api:{getOptimizer:()=>n.getOptimizer(),getOptions:()=>n.getOptions()},async options(r){await n.init();const o=r.onwarn;r.onwarn=(a,p)=>{a.plugin==="typescript"&&a.message.includes("outputToFilesystem")||(o?o(a,p):p(a))};const d={csr:e.csr,target:e.target,buildMode:e.buildMode,debug:e.debug,entryStrategy:e.entryStrategy,rootDir:e.rootDir,srcDir:e.srcDir,srcInputs:e.srcInputs,input:r.input,resolveQwikBuild:!0,manifestOutput:e.manifestOutput,manifestInput:e.manifestInput,transformedModuleOutput:e.transformedModuleOutput,inlineStylesUpToBytes:e.optimizerOptions?.inlineStylesUpToBytes,lint:e.lint,experimental:e.experimental};await n.normalizeOptions(d);const{input:c}=n.getOptions();return r.input=c,r},outputOptions(r){return Ve(n,r,!1)},async buildStart(){n.onDiagnostics((r,o,d)=>{r.forEach(c=>{const a=n.normalizePath(o.sys.path.join(d,c.file));c.category==="error"?this.error(Be(a,c)):this.warn(Be(a,c))})}),await n.buildStart(this)},resolveId(r,o){return ee(r)?null:n.resolveId(this,r,o)},load(r){return ee(r)?null:n.load(this,r)},transform(r,o){return ee(o)?null:n.transform(this,r,o)},async generateBundle(r,o){n.getOptions().target==="client"&&await n.generateManifest(this,o)}}}async function xn(e,n,i,r){return Array.isArray(n)?(n.length||n.push({}),await Promise.all(n.map(async o=>({...await Ve(e,o,i),dir:r||o.dir})))):{...await Ve(e,n,i),dir:r||n?.dir}}const In=(e,n,i)=>n.buildMode==="production"&&!n.debug?`${e}build/q-[hash].js`:r=>{if(r.moduleIds?.some(c=>/core\.(prod|min)\.mjs$/.test(c)))return`${e}build/core.js`;if(r.moduleIds?.some(c=>/qwik-router\/lib\/index\.qwik\.mjs$/.test(c)))return`${e}build/qwik-router.js`;const d=i.sys.path.relative(i.sys.cwd(),r.name).replace(/^(\.\.\/)+/,"").replace(/^\/+/,"").replace(/\//g,"-");return`${e}build/${d}.js`};async function Ve(e,n,i){const r={...n},o=e.getOptions(),d=e.getOptimizer(),c=e.manualChunks;r.assetFileNames||(r.assetFileNames=`${i?`${o.assetsDir}/`:""}assets/[hash]-[name].[ext]`);const a=In(i?`${o.assetsDir}`:"",o,d);if(o.target==="client"){r.entryFileNames||(r.entryFileNames=a),r.chunkFileNames||(r.chunkFileNames=a),r.format="es";const t=r.manualChunks;if(t&&typeof t!="function")throw new Error("manualChunks must be a function");r.manualChunks=t?(x,k)=>t(x,k)||c(x,k):c}else r.chunkFileNames||(r.chunkFileNames=a);r.dir||(r.dir=o.outDir),r.format==="cjs"&&typeof r.exports!="string"&&(r.exports="auto"),r.hoistTransitiveImports=!1;const p=await wn(d.sys,"rollup",d.sys.cwd());if(p)try{const x=await(await d.sys.dynamicImport("node:fs")).promises.readFile(p,"utf-8"),k=JSON.parse(x),u=String(k?.version||""),[w,m,g]=u.split(".").map(l=>parseInt(l,10));Number.isFinite(w)&&(w>4||w===4&&(m>52||m===52&&(g||0)>=0))?r.onlyExplicitManualChunks=!0:console.warn(`⚠️ We detected that you're using a Rollup version prior to 4.52.0 (${u}). For the latest and greatest, we recommend to let Vite install the latest version for you, or manually install the latest version of Rollup in your project if that doesn't work. It will enable the new Rollup \`outputOpts.onlyExplicitManualChunks\` feature flag, which improves preloading performance and reduces cache invalidation for a snappier user experience.`)}catch{}return r}function Be(e,n){const i=n.highlights?.[0];return Object.assign(new Error(n.message),{id:e,plugin:"qwik",loc:i&&{column:i.startCol,line:i.startLine},stack:""})}function F(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ye={},Ze={},wt;function A(){return wt||(wt=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.findBox=e.readUInt=e.readUInt32LE=e.readUInt32BE=e.readInt32LE=e.readUInt24LE=e.readUInt16LE=e.readUInt16BE=e.readInt16LE=e.toHexString=e.toUTF8String=void 0;const n=new TextDecoder,i=(g,f=0,l=g.length)=>n.decode(g.slice(f,l));e.toUTF8String=i;const r=(g,f=0,l=g.length)=>g.slice(f,l).reduce((s,y)=>s+("0"+y.toString(16)).slice(-2),"");e.toHexString=r;const o=(g,f=0)=>{const l=g[f]+g[f+1]*256;return l|(l&2**15)*131070};e.readInt16LE=o;const d=(g,f=0)=>g[f]*2**8+g[f+1];e.readUInt16BE=d;const c=(g,f=0)=>g[f]+g[f+1]*2**8;e.readUInt16LE=c;const a=(g,f=0)=>g[f]+g[f+1]*2**8+g[f+2]*2**16;e.readUInt24LE=a;const p=(g,f=0)=>g[f]+g[f+1]*2**8+g[f+2]*2**16+(g[f+3]<<24);e.readInt32LE=p;const t=(g,f=0)=>g[f]*2**24+g[f+1]*2**16+g[f+2]*2**8+g[f+3];e.readUInt32BE=t;const x=(g,f=0)=>g[f]+g[f+1]*2**8+g[f+2]*2**16+g[f+3]*2**24;e.readUInt32LE=x;const k={readUInt16BE:e.readUInt16BE,readUInt16LE:e.readUInt16LE,readUInt32BE:e.readUInt32BE,readUInt32LE:e.readUInt32LE};function u(g,f,l,s){l=l||0;const y=s?"BE":"LE",h="readUInt"+f+y;return k[h](g,l)}e.readUInt=u;function w(g,f){if(g.length-f<4)return;const l=(0,e.readUInt32BE)(g,f);if(!(g.length-f<l))return{name:(0,e.toUTF8String)(g,4+f,8+f),offset:f,size:l}}function m(g,f,l){for(;l<g.length;){const s=w(g,l);if(!s)break;if(s.name===f)return s;l+=s.size>0?s.size:8}}e.findBox=m})(Ze)),Ze}var vt;function kn(){if(vt)return ye;vt=1,Object.defineProperty(ye,"__esModule",{value:!0}),ye.BMP=void 0;const e=A();return ye.BMP={validate:n=>(0,e.toUTF8String)(n,0,2)==="BM",calculate:n=>({height:Math.abs((0,e.readInt32LE)(n,22)),width:(0,e.readUInt32LE)(n,18)})},ye}var Sn=kn();const En=F(Sn);var be={},we={},xt;function It(){if(xt)return we;xt=1,Object.defineProperty(we,"__esModule",{value:!0}),we.ICO=void 0;const e=A(),n=1,i=6,r=16;function o(c,a){const p=c[a];return p===0?256:p}function d(c,a){const p=i+a*r;return{height:o(c,p+1),width:o(c,p)}}return we.ICO={validate(c){const a=(0,e.readUInt16LE)(c,0),p=(0,e.readUInt16LE)(c,4);return a!==0||p===0?!1:(0,e.readUInt16LE)(c,2)===n},calculate(c){const a=(0,e.readUInt16LE)(c,4),p=d(c,0);if(a===1)return p;const t=[p];for(let x=1;x<a;x+=1)t.push(d(c,x));return{height:p.height,images:t,width:p.width}}},we}var kt;function _n(){if(kt)return be;kt=1,Object.defineProperty(be,"__esModule",{value:!0}),be.CUR=void 0;const e=It(),n=A(),i=2;return be.CUR={validate(r){const o=(0,n.readUInt16LE)(r,0),d=(0,n.readUInt16LE)(r,4);return o!==0||d===0?!1:(0,n.readUInt16LE)(r,2)===i},calculate:r=>e.ICO.calculate(r)},be}var Tn=_n();const Cn=F(Tn);var ve={},St;function Pn(){if(St)return ve;St=1,Object.defineProperty(ve,"__esModule",{value:!0}),ve.DDS=void 0;const e=A();return ve.DDS={validate:n=>(0,e.readUInt32LE)(n,0)===542327876,calculate:n=>({height:(0,e.readUInt32LE)(n,12),width:(0,e.readUInt32LE)(n,16)})},ve}var Dn=Pn();const Nn=F(Dn);var xe={},Et;function Mn(){if(Et)return xe;Et=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.GIF=void 0;const e=A(),n=/^GIF8[79]a/;return xe.GIF={validate:i=>n.test((0,e.toUTF8String)(i,0,6)),calculate:i=>({height:(0,e.readUInt16LE)(i,8),width:(0,e.readUInt16LE)(i,6)})},xe}var qn=Mn();const jn=F(qn);var Ie={},_t;function On(){if(_t)return Ie;_t=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.ICNS=void 0;const e=A(),n=8,i=4,r=4,o={ICON:32,"ICN#":32,"icm#":16,icm4:16,icm8:16,"ics#":16,ics4:16,ics8:16,is32:16,s8mk:16,icp4:16,icl4:32,icl8:32,il32:32,l8mk:32,icp5:32,ic11:32,ich4:48,ich8:48,ih32:48,h8mk:48,icp6:64,ic12:32,it32:128,t8mk:128,ic07:128,ic08:256,ic13:256,ic09:512,ic14:512,ic10:1024};function d(a,p){const t=p+r;return[(0,e.toUTF8String)(a,p,t),(0,e.readUInt32BE)(a,t)]}function c(a){const p=o[a];return{width:p,height:p,type:a}}return Ie.ICNS={validate:a=>(0,e.toUTF8String)(a,0,4)==="icns",calculate(a){const p=a.length,t=(0,e.readUInt32BE)(a,i);let x=n,k=d(a,x),u=c(k[0]);if(x+=k[1],x===t)return u;const w={height:u.height,images:[u],width:u.width};for(;x<t&&x<p;)k=d(a,x),u=c(k[0]),x+=k[1],w.images.push(u);return w}},Ie}var Ln=On();const Un=F(Ln);var $n=It();const Rn=F($n);var ke={},Tt;function Bn(){if(Tt)return ke;Tt=1,Object.defineProperty(ke,"__esModule",{value:!0}),ke.J2C=void 0;const e=A();return ke.J2C={validate:n=>(0,e.readUInt32BE)(n,0)===4283432785,calculate:n=>({height:(0,e.readUInt32BE)(n,12),width:(0,e.readUInt32BE)(n,8)})},ke}var Fn=Bn();const An=F(Fn);var Se={},Ct;function zn(){if(Ct)return Se;Ct=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.JP2=void 0;const e=A();return Se.JP2={validate(n){if((0,e.toUTF8String)(n,4,8)!=="jP ")return!1;const r=(0,e.findBox)(n,"ftyp",0);return r?(0,e.toUTF8String)(n,r.offset+8,r.offset+12)==="jp2 ":!1},calculate(n){const i=(0,e.findBox)(n,"jp2h",0),r=i&&(0,e.findBox)(n,"ihdr",i.offset+8);if(r)return{height:(0,e.readUInt32BE)(n,r.offset+8),width:(0,e.readUInt32BE)(n,r.offset+12)};throw new TypeError("Unsupported JPEG 2000 format")}},Se}var Hn=zn();const Wn=F(Hn);var Ee={},Pt;function Gn(){if(Pt)return Ee;Pt=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.JPG=void 0;const e=A(),n="45786966",i=2,r=6,o=2,d="4d4d",c="4949",a=12,p=2;function t(m){return(0,e.toHexString)(m,2,6)===n}function x(m,g){return{height:(0,e.readUInt16BE)(m,g),width:(0,e.readUInt16BE)(m,g+2)}}function k(m,g){const l=r+8,s=(0,e.readUInt)(m,16,l,g);for(let y=0;y<s;y++){const h=l+p+y*a,I=h+a;if(h>m.length)return;const v=m.slice(h,I);if((0,e.readUInt)(v,16,0,g)===274)return(0,e.readUInt)(v,16,2,g)!==3||(0,e.readUInt)(v,32,4,g)!==1?void 0:(0,e.readUInt)(v,16,8,g)}}function u(m,g){const f=m.slice(i,g),l=(0,e.toHexString)(f,r,r+o),s=l===d;if(s||l===c)return k(f,s)}function w(m,g){if(g>m.length)throw new TypeError("Corrupt JPG, exceeded buffer limits")}return Ee.JPG={validate:m=>(0,e.toHexString)(m,0,2)==="ffd8",calculate(m){m=m.slice(4);let g,f;for(;m.length;){const l=(0,e.readUInt16BE)(m,0);if(m[l]!==255){m=m.slice(1);continue}if(t(m)&&(g=u(m,l)),w(m,l),f=m[l+1],f===192||f===193||f===194){const s=x(m,l+5);return g?{height:s.height,orientation:g,width:s.width}:s}m=m.slice(l+2)}throw new TypeError("Invalid JPG, no size found")}},Ee}var Qn=Gn();const Kn=F(Qn);var _e={},Dt;function Jn(){if(Dt)return _e;Dt=1,Object.defineProperty(_e,"__esModule",{value:!0}),_e.KTX=void 0;const e=A();return _e.KTX={validate:n=>{const i=(0,e.toUTF8String)(n,1,7);return["KTX 11","KTX 20"].includes(i)},calculate:n=>{const i=n[5]===49?"ktx":"ktx2",r=i==="ktx"?36:20;return{height:(0,e.readUInt32LE)(n,r+4),width:(0,e.readUInt32LE)(n,r),type:i}}},_e}var Yn=Jn();const Xn=F(Yn);var Te={},Nt;function Vn(){if(Nt)return Te;Nt=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.PNG=void 0;const e=A(),n=`PNG\r
23
+ 
24
+ `,i="IHDR",r="CgBI";return Te.PNG={validate(o){if(n===(0,e.toUTF8String)(o,1,8)){let d=(0,e.toUTF8String)(o,12,16);if(d===r&&(d=(0,e.toUTF8String)(o,28,32)),d!==i)throw new TypeError("Invalid PNG");return!0}return!1},calculate(o){return(0,e.toUTF8String)(o,12,16)===r?{height:(0,e.readUInt32BE)(o,36),width:(0,e.readUInt32BE)(o,32)}:{height:(0,e.readUInt32BE)(o,20),width:(0,e.readUInt32BE)(o,16)}}},Te}var Zn=Vn();const er=F(Zn);var Ce={},Mt;function tr(){if(Mt)return Ce;Mt=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.PNM=void 0;const e=A(),n={P1:"pbm/ascii",P2:"pgm/ascii",P3:"ppm/ascii",P4:"pbm",P5:"pgm",P6:"ppm",P7:"pam",PF:"pfm"},i={default:r=>{let o=[];for(;r.length>0;){const d=r.shift();if(d[0]!=="#"){o=d.split(" ");break}}if(o.length===2)return{height:parseInt(o[1],10),width:parseInt(o[0],10)};throw new TypeError("Invalid PNM")},pam:r=>{const o={};for(;r.length>0;){const d=r.shift();if(d.length>16||d.charCodeAt(0)>128)continue;const[c,a]=d.split(" ");if(c&&a&&(o[c.toLowerCase()]=parseInt(a,10)),o.height&&o.width)break}if(o.height&&o.width)return{height:o.height,width:o.width};throw new TypeError("Invalid PAM")}};return Ce.PNM={validate:r=>(0,e.toUTF8String)(r,0,2)in n,calculate(r){const o=(0,e.toUTF8String)(r,0,2),d=n[o],c=(0,e.toUTF8String)(r,3).split(/[\r\n]+/);return(i[d]||i.default)(c)}},Ce}var nr=tr();const rr=F(nr);var Pe={},qt;function or(){if(qt)return Pe;qt=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.PSD=void 0;const e=A();return Pe.PSD={validate:n=>(0,e.toUTF8String)(n,0,4)==="8BPS",calculate:n=>({height:(0,e.readUInt32BE)(n,14),width:(0,e.readUInt32BE)(n,18)})},Pe}var ir=or();const sr=F(ir);var De={},jt;function ar(){if(jt)return De;jt=1,Object.defineProperty(De,"__esModule",{value:!0}),De.SVG=void 0;const e=A(),n=/<svg\s([^>"']|"[^"]*"|'[^']*')*>/,i={height:/\sheight=(['"])([^%]+?)\1/,root:n,viewbox:/\sviewBox=(['"])(.+?)\1/i,width:/\swidth=(['"])([^%]+?)\1/},r=2.54,o={in:96,cm:96/r,em:16,ex:8,m:96/r*100,mm:96/r/10,pc:96/72/12,pt:96/72,px:1},d=new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(o).join("|")})?$`);function c(k){const u=d.exec(k);if(u)return Math.round(Number(u[1])*(o[u[2]]||1))}function a(k){const u=k.split(" ");return{height:c(u[3]),width:c(u[2])}}function p(k){const u=k.match(i.width),w=k.match(i.height),m=k.match(i.viewbox);return{height:w&&c(w[2]),viewbox:m&&a(m[2]),width:u&&c(u[2])}}function t(k){return{height:k.height,width:k.width}}function x(k,u){const w=u.width/u.height;return k.width?{height:Math.floor(k.width/w),width:k.width}:k.height?{height:k.height,width:Math.floor(k.height*w)}:{height:u.height,width:u.width}}return De.SVG={validate:k=>n.test((0,e.toUTF8String)(k,0,1e3)),calculate(k){const u=(0,e.toUTF8String)(k).match(i.root);if(u){const w=p(u[0]);if(w.width&&w.height)return t(w);if(w.viewbox)return x(w,w.viewbox)}throw new TypeError("Invalid SVG")}},De}var lr=ar();const cr=F(lr);var Ne={},Ot;function dr(){if(Ot)return Ne;Ot=1,Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.TGA=void 0;const e=A();return Ne.TGA={validate(n){return(0,e.readUInt16LE)(n,0)===0&&(0,e.readUInt16LE)(n,4)===0},calculate(n){return{height:(0,e.readUInt16LE)(n,14),width:(0,e.readUInt16LE)(n,12)}}},Ne}var ur=dr();const fr=F(ur);var Me={},Lt;function pr(){if(Lt)return Me;Lt=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.WEBP=void 0;const e=A();function n(o){return{height:1+(0,e.readUInt24LE)(o,7),width:1+(0,e.readUInt24LE)(o,4)}}function i(o){return{height:1+((o[4]&15)<<10|o[3]<<2|(o[2]&192)>>6),width:1+((o[2]&63)<<8|o[1])}}function r(o){return{height:(0,e.readInt16LE)(o,8)&16383,width:(0,e.readInt16LE)(o,6)&16383}}return Me.WEBP={validate(o){const d=(0,e.toUTF8String)(o,0,4)==="RIFF",c=(0,e.toUTF8String)(o,8,12)==="WEBP",a=(0,e.toUTF8String)(o,12,15)==="VP8";return d&&c&&a},calculate(o){const d=(0,e.toUTF8String)(o,12,16);if(o=o.slice(20,30),d==="VP8X"){const a=o[0],p=(a&192)===0,t=(a&1)===0;if(p&&t)return n(o);throw new TypeError("Invalid WebP")}if(d==="VP8 "&&o[0]!==47)return r(o);const c=(0,e.toHexString)(o,3,6);if(d==="VP8L"&&c!=="9d012a")return i(o);throw new TypeError("Invalid WebP")}},Me}var hr=pr();const mr=F(hr);var qe={},Ut;function gr(){if(Ut)return qe;Ut=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.HEIF=void 0;const e=A(),n={avif:"avif",mif1:"heif",msf1:"heif",heic:"heic",heix:"heic",hevc:"heic",hevx:"heic"};return qe.HEIF={validate(i){if((0,e.toUTF8String)(i,4,8)!=="ftyp")return!1;const o=(0,e.findBox)(i,"ftyp",0);return o?(0,e.toUTF8String)(i,o.offset+8,o.offset+12)in n:!1},calculate(i){const r=(0,e.findBox)(i,"meta",0),o=r&&(0,e.findBox)(i,"iprp",r.offset+12),d=o&&(0,e.findBox)(i,"ipco",o.offset+8),c=d&&(0,e.findBox)(i,"ispe",d.offset+8);if(c)return{height:(0,e.readUInt32BE)(i,c.offset+16),width:(0,e.readUInt32BE)(i,c.offset+12),type:(0,e.toUTF8String)(i,8,12)};throw new TypeError("Invalid HEIF, no size found")}},qe}var yr=gr();const br=F(yr),wr={56:"psd",66:"bmp",68:"dds",71:"gif",82:"webp",105:"icns",137:"png",255:"jpg"},Fe={webp:mr.WEBP,jpg:Kn.JPG,png:er.PNG,svg:cr.SVG,gif:jn.GIF,avif:br.HEIF,bmp:En.BMP,cur:Cn.CUR,dds:Nn.DDS,icns:Un.ICNS,ico:Rn.ICO,j2c:An.J2C,jp2:Wn.JP2,ktx:Xn.KTX,pnm:rr.PNM,psd:sr.PSD,tga:fr.TGA},vr=Object.keys(Fe);function xr(e){const n=e[0],i=wr[n];return i&&Fe[i].validate(e)?i:vr.find(r=>Fe[r].validate(e))}function Ir(e){const n=xr(e);if(typeof n<"u"){const i=Fe[n].calculate(e);if(i!==void 0)return i.type=n,i}}async function kr(e){if(/^(https?|file|capacitor):/.test(e))try{const n=await fetch(e,{headers:{Accept:"image/*,*/*"}});if(!n.ok){console.error("can not fetch",e);return}const i=await n.arrayBuffer(),r=Ir(Buffer.from(i));if(r)return{width:r.width,height:r.height,type:r.type,size:i.byteLength}}catch(n){console.error(n);return}}const Sr=(e,n,i)=>async(r,o,d)=>{try{const c=await e.dynamicImport("node:fs"),a=await e.dynamicImport("node:path");let p;try{p=new URL(r.url,"http://localhost:3000/")}catch{o.statusCode=404,o.end();return}if(r.method==="GET"&&p.pathname==="/__image_info"){const t=p.searchParams.get("url");if(o.setHeader("content-type","application/json"),t){const x=await kr(t);o.setHeader("cache-control","public, max-age=31536000, immutable"),x?o.write(JSON.stringify(x)):o.statusCode=404}else{o.statusCode=500;const x={message:"error"};o.write(JSON.stringify(x))}o.end();return}else if(r.method==="POST"&&p.pathname==="/__image_fix"){const t=p.searchParams.get("loc"),x=p.searchParams.get("width"),k=p.searchParams.get("height"),u=p.searchParams.get("src"),w=p.searchParams.get("currentHref"),m=t.split(":"),g=parseInt(m[m.length-1],10)-1;let f=parseInt(m[m.length-2],10)-1;const l=a.resolve(i,m.slice(0,m.length-2).join(":")),s=a.extname(l).toLowerCase();let h=c.readFileSync(l).toString("utf-8"),I=0;for(;I<h.length;I++)if(f===0){I+=g;break}else if(h[I]===`
25
+ `){f--;continue}if(h.slice(I,I+4)!=="<img"){console.error("Could not apply auto fix, because it was not possible to find the original <img> tag"),o.statusCode=500;return}const v=h.indexOf(">",I)+1;if(v<I){console.error("Could not apply auto fix, because it was not possible to find the original <img> tag"),o.statusCode=500;return}const T=[".ts",".tsx",".js",".jsx",".mdx"].includes(s);let E=h.slice(I,v);if(u&&w&&T){const P=new URL(u),U=new URL(w);if(P.origin===U.origin){const j=a.join(n,"public",P.pathname),R=a.join(n,P.pathname);let H;if(c.existsSync(j)){const te=a.join(i,"media",a.dirname(P.pathname));await c.promises.mkdir(te,{recursive:!0}),await c.promises.copyFile(j,a.join(i,"media",P.pathname)),H="~/media"+P.pathname}else if(c.existsSync(R))H=P.pathname.replace("/src/","~/");else return;const Y=Er(P.pathname),ce=`${H}?jsx`;E=E.replace(/^<img/,`<${Y}`),E=E.replace(/\bwidth=(({[^}]*})|('[^']*')|("[^"]*"))\s*/,""),E=E.replace(/\bheight=(({[^}]*})|('[^']*')|("[^"]*"))\s*/,""),E=E.replace(/\bsrc=(({[^}]*})|('[^']*')|("[^"]*"))\s*/,"");let W=0;if(s===".mdx"&&h.startsWith("---")&&(W=h.indexOf("---",4)+3,W===-1))return;const Z=`
26
+ import ${Y} from '${ce}';`;h=`${h.slice(0,W)}${Z}${h.slice(W,I)}${E}${h.slice(v)}`,c.writeFileSync(l,h);return}}E=E.replace(/\bwidth=(({[^}]*})|('[^']*')|("[^"]*"))/,`width="${x}"`),E=E.replace(/\bheight=(({[^}]*})|('[^']*')|("[^"]*"))/,`height="${k}"`),E.includes("height=")||(E=E.replace(/<img/,`<img height="${k}"`)),E.includes("width=")||(E=E.replace(/<img/,`<img width="${x}"`)),h=h.slice(0,I)+E+h.slice(v),c.writeFileSync(l,h)}else d()}catch(c){c instanceof Error&&await rn(e,c),d(c)}};function Er(e){const n=e.lastIndexOf("."),i=e.lastIndexOf("/");return e=e.substring(i+1,n),`Img${_r(e)}`}function _r(e){return`${e}`.toLowerCase().replace(new RegExp(/[-_]+/,"g")," ").replace(new RegExp(/[^\w\s]/,"g"),"").replace(new RegExp(/\s+(.)(\w*)/,"g"),(n,i,r)=>`${i.toUpperCase()+r}`).replace(new RegExp(/\w/),n=>n.toUpperCase())}const Tr=`"undefined"==typeof window||window.__qwikViteLog||(window.__qwikViteLog=!0,console.debug("%c⭐️ Qwik Dev SSR Mode","background: #0c75d2; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;","App is running in SSR development mode!\\n - Additional JS is loaded by Vite for debugging and live reloading\\n - Rendering performance might not be optimal\\n - Delayed interactivity because prefetching is disabled\\n - Vite dev bundles do not represent production output\\n\\nProduction build can be tested running 'npm run preview'"))`,Cr='if("undefined"!=typeof document){const e=()=>{const e="data-qwik-inspector",t=globalThis.__HOTKEYS__;globalThis.__SRC_DIR__;let o=document.querySelector("#qwik-inspector-info-popup");o||(o=document.createElement("div"),o.id="qwik-inspector-info-popup",o["aria-hidden"]="true",document.body.appendChild(o)),o.textContent=`Click-to-Source: ${t.join(" + ")}`,console.debug("%c🔍 Qwik Click-To-Source","background: #564CE0; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;",`Hold-press the \'${t.join(" + ")}\' key${t.length>1?"s":""} and click a component to jump directly to the source code in your IDE!`),window.__qwik_inspector_state={pressedKeys:new Set};const n=document.body,r=document.createElement("div");function i(t){return t&&t instanceof Element?t.closest(`[${e}]`):null}function s(){const e=window.__qwik_inspector_state.hoveredElement;if(e&&d()){const t=e.getBoundingClientRect();r.style.setProperty("height",t.height+"px"),r.style.setProperty("width",t.width+"px"),r.style.setProperty("top",t.top+"px"),r.style.setProperty("left",t.left+"px"),r.style.setProperty("visibility","visible"),n.style.setProperty("cursor","pointer")}else r.style.setProperty("height","0px"),r.style.setProperty("width","0px"),r.style.setProperty("visibility","hidden"),n.style.removeProperty("cursor")}function d(){return function(){const e=Array.from(window.__qwik_inspector_state.pressedKeys).map(e=>e?e.replace(/(Left|Right)$/g,""):void 0);return t.every(t=>e.includes(t))}()}r.id="qwik-inspector-overlay",r.setAttribute("aria-hidden","true"),n.appendChild(r),document.addEventListener("keydown",e=>{window.__qwik_inspector_state.pressedKeys.add(e.code),s()},{capture:!0}),document.addEventListener("keyup",e=>{window.__qwik_inspector_state.pressedKeys.delete(e.code),s()},{capture:!0}),window.addEventListener("blur",()=>{window.__qwik_inspector_state.pressedKeys.clear(),s()},{capture:!0}),document.addEventListener("mouseover",e=>{const t=i(e.target);window.__qwik_inspector_state.hoveredElement=t||void 0,s()},{capture:!0}),document.addEventListener("click",t=>{if(d()){window.__qwik_inspector_state.pressedKeys.clear();const o=i(t.target);if(o){t.preventDefault(),t.stopPropagation();const r=o.getAttribute(e);if("false"!==r){n.style.setProperty("cursor","progress");const e=r.match(/^(.*?)(:\\d+(:\\d+)?)?$/);if(e){const[,t,o]=e;fetch(`${t}?editor${o}`).then(()=>{n.style.removeProperty("cursor")})}}}}},{capture:!0}),document.addEventListener("contextmenu",e=>{if(d()){window.__qwik_inspector_state.pressedKeys.clear();i(e.target)&&e.preventDefault()}},{capture:!0}),window.addEventListener("resize",s),document.addEventListener("scroll",s)};document.addEventListener("DOMContentLoaded",e)}',Pr=`if("undefined"!=typeof HTMLElement){class e extends HTMLElement{get _root(){return this.shadowRoot||this}constructor(){super(),this.state={},this.props||(this.props={}),this.componentProps=["children","error"],this.nodesToDestroy=[],this.pendingUpdate=!1,this.attachShadow({mode:"open"})}destroyAnyNodes(){this.nodesToDestroy.forEach(e=>e.remove()),this.nodesToDestroy=[]}connectedCallback(){this.getAttributeNames().forEach(e=>{const t=e.replace(/-/g,""),o=new RegExp(t,"i");this.componentProps.forEach(t=>{if(o.test(t)){const o=this.getAttribute(e);this.props[t]!==o&&(this.props[t]=o)}})}),this._root.innerHTML='\\n\\n <template data-el="show-errored-host">\\n <div class="error">\\n <template data-el="div-errored-host-2">\\n \\x3c!-- String(props.error) --\\x3e\\n </template>\\n </div>\\n </template>\\n\\n <div class="arrow">👇 Uncaught error happened here 👇\\n <span class="dev-tools">DevTools: Cmd+Alt+I</span>\\n </div>\\n <div class="div">\\n <slot></slot>\\n </div>\\n\\n <style>\\n .error {\\n border-radius: 5px 5px 0px 0;\\n background: black;\\n color: white;\\n font-family: monospace;\\n font-size: 12px;\\n margin: 0;\\n padding: 10px;\\n }\\n .arrow {\\n background: #f47e81;\\n color: black;\\n font-size: 14px;\\n padding: 10px;\\n text-align: center;\\n font-family: sans-serif;\\n }\\n .dev-tools {\\n background: red;\\n padding: 2px 5px;\\n border-radius: 3px;\\n font-weight: 800;\\n }\\n .div {\\n outline: 5px solid red;\\n border-radius: 10px;\\n }\\n </style>',this.pendingUpdate=!0,this.render(),this.onMount(),this.pendingUpdate=!1,this.update()}showContent(e){const t=e.content.cloneNode(!0);Array.from(t.childNodes).forEach(t=>{e?.scope&&(t.scope=e.scope),e?.context&&(t.context=e.context),this.nodesToDestroy.push(t)}),e.after(t)}onMount(){}onUpdate(){}update(){!0!==this.pendingUpdate&&(this.pendingUpdate=!0,this.render(),this.onUpdate(),this.pendingUpdate=!1)}render(){this.destroyAnyNodes(),this.updateBindings()}updateBindings(){this._root.querySelectorAll("[data-el='show-errored-host']").forEach(e=>{this.props.error&&this.showContent(e)}),this._root.querySelectorAll("[data-el='div-errored-host-2']").forEach(e=>{this.renderTextNode(e,String(this.props.error))})}renderTextNode(e,t){const o=document.createTextNode(t);e?.scope&&(o.scope=e.scope),e?.context&&(o.context=e.context),e.after(o),this.nodesToDestroy.push(e.nextSibling)}}customElements.define("errored-host",e),document.addEventListener("qerror",e=>{const t=customElements.get("vite-error-overlay");if(!t)return;const o=new t(e.detail.error);document.body.appendChild(o)})}`,Dr='[data-qwik-cls]{outline:2px solid red}[data-qwik-cls]:after{position:absolute;font-size:12px;content:"CLS " attr(data-qwik-cls);font-family:monospace;font-weight:700;background:red;color:#fff;margin:-2px;padding:1px;line-height:1;pointer-events:none}#qwik-image-warning-container{position:absolute!important;top:0!important;left:0!important;width:0!important;overflow:visible!important;height:0!important;pointer-events:none!important;contain:size layout style content;z-index:1}',Nr='if("undefined"!=typeof document){const e=()=>{class e extends HTMLElement{#e=null;constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(document.createElement("template").innerHTML=globalThis.__TEMPLATE__);const e=this.shadowRoot.querySelector("dialog");this.shadowRoot.addEventListener("click",async t=>{const o=t.target;"BUTTON"===o.nodeName&&("action-btn"===o.id?this.#e&&(this.#e(),e.close()):"icon"===o.id?e.open?e.close():(e.className=function(e){const{x:t}=e.getBoundingClientRect();let o="right";return t>window.innerWidth-260&&(o="left"),`bottom ${o}`}(o),e.show()):"loc"===o.id&&o.dataset.url&&globalThis.qwikOpenInEditor(o.dataset.url))})}set loc(e){const t=this.shadowRoot.querySelector("#loc");t.textContent=e,globalThis.qwikOpenInEditor&&(t.dataset.url=e)}set header(e){this.shadowRoot.querySelector("#title").textContent=e}set message(e){this.shadowRoot.querySelector("#message").innerHTML=e}set actionFn(e){this.#e=e}set actionName(e){e&&(this.shadowRoot.querySelector(".action-container").innerHTML=`<button id="action-btn" type="button">${e}</button>`)}}customElements.define("image-warning",e);const t=new Map;let o=document.querySelector("#qwik-image-warning-container");o||(o=document.createElement("div"),o.id="qwik-image-warning-container",document.body.appendChild(o));let n=!1;const i=new Map;function r(e){let t=i.get(e);return void 0===t&&(t=async function(e){if(!/^(https?|file|capacitor):/.test(e))return;const t=new URL("/__image_info",location.href);return t.searchParams.set("url",e),fetch(t).then(e=>e.json()).catch(()=>null)}(e),i.set(e,t)),t}function a(e){return e.endsWith("px")}async function s(e){const i=t.get(e);e.isConnected?e.complete&&async function(e){const i=window.scrollX,s=window.scrollY,c=e.getBoundingClientRect(),d=e.currentSrc,l=await r(d);let h=t.get(e);const u=window.innerWidth>500;if(l&&u){let r=!1;const d=e.getAttribute("data-qwik-inspector"),u=c.width*c.height;if(!e.hasAttribute("width")||!e.hasAttribute("height")){n=!0;const t=getComputedStyle(e),o="auto"!==t.getPropertyValue("aspect-ratio").toString(),i=a(t.getPropertyValue("width").toString()),s=a(t.getPropertyValue("height").toString()),c="absolute"===t.getPropertyValue("position").toString();r=u>1e3&&!c&&!o&&(!i||!s)}const g=u<.5*(l.width&&l.height)&&"svg"!==l.type;if(n=!1,r||g){if(h||(h=document.createElement("image-warning"),o.appendChild(h),t.set(e,h)),h.style.top=c.top+s+"px",h.style.left=c.left+i+"px",h.style.width=c.width+"px",h.style.height=c.height+"px",h.info=l,h.loc=d,r){const t=`width="${l.width}" height="${l.height}"`;h.header="Perf: layout shift",h.message=`Image\'s size is unknown until it\'s loaded, <a href="https://web.dev/cls/" target="_blank" rel="noopener noreferrer">causing layout shift</a>.</p><p>To solve this problem set the width/height in the img tag:</p><pre>&lt;img <span>${t}</span></pre>`;const o=1===document.querySelectorAll(\'[data-qwik-inspector="\'+d+\'"]\').length;d&&(o?(h.actionName="Auto fix",h.actionFn=async()=>{const t=new URL("/__image_fix",location.href);t.searchParams.set("loc",d),t.searchParams.set("width",l.width),t.searchParams.set("height",l.height),e.srcset||(t.searchParams.set("src",e.currentSrc),t.searchParams.set("currentHref",location.href)),await fetch(t,{method:"POST"})}):(h.actionName="Open in editor",h.actionFn=async()=>{await navigator.clipboard.writeText(t),globalThis.qwikOpenInEditor(d)}))}else g&&(h.header="Perf: properly size image",h.message=`The image is too big, <a href="https://developer.chrome.com/en/docs/lighthouse/performance/uses-responsive-images/" target="_blank" rel="noopener noreferrer">hurting performance</a>, it should be resized to the size it\'s displayed at. The image dimensions are ${l.width} x ${l.height} but it\'s displayed at ${c.width}x${c.height}.</p>`);return}}h&&(h.remove(),t.delete(e))}(e):i&&(i.remove(),t.delete(e))}const c=new ResizeObserver(e=>{if(!n)for(const t of e)s(t.target)}),d=new MutationObserver(e=>{for(const t of e){for(const e of t.addedNodes)"IMG"===e.nodeName?c.observe(e):1===e.nodeType&&e.querySelectorAll("img").forEach(e=>{c.observe(e)});for(const e of t.removedNodes)"IMG"===e.nodeName?(s(e),c.unobserve(e)):1===e.nodeType&&e.querySelectorAll("img").forEach(e=>{s(e),c.unobserve(e)})}});let l,h=0;const u=()=>{setTimeout(()=>{l&&(l.disconnect(),h>.005&&console.error("Detected Layout Shift during page load",h)),d.observe(document.body,{childList:!0,subtree:!0}),document.body.querySelectorAll("img").forEach(e=>{c.observe(e)})},100)};"complete"===document.readyState?u():window.addEventListener("load",u);const g=1===performance?.navigation.type||performance.getEntriesByType("navigation").map(e=>e.type).includes("reload");"undefined"==typeof PerformanceObserver||g||(l=new PerformanceObserver(e=>{e.getEntries().forEach(e=>{if(!e.hadRecentInput){if(e.value>.006)for(const t of e.sources)t.node&&1===t.node.nodeType&&"IMAGE-WARNING"!==t.node.nodeName&&t.node.setAttribute("data-qwik-cls",Number(e.value).toFixed(3));h+=e.value}})}),l.observe({type:"layout-shift",buffered:!0}))};document.addEventListener("load",e)}',Mr=`<style>
27
+ :host {
28
+ position: absolute;
29
+ border: 1px solid red;
30
+ pointer-events: none;
31
+ z-index: 1;
32
+ contain: layout size;
33
+ }
34
+
35
+ #icon {
36
+ border: 0;
37
+ margin: 5px;
38
+ color: black;
39
+ max-width: 100%;
40
+ width: 20px;
41
+ background: yellow;
42
+ border-radius: 100%;
43
+ height: 20px;
44
+ padding: 3px;
45
+ pointer-events: all;
46
+ cursor: pointer;
47
+ }
48
+
49
+ #icon svg {
50
+ width: 100%;
51
+ height: auto;
52
+ pointer-events: none;
53
+ }
54
+
55
+ dialog {
56
+ padding: 0;
57
+ border: 0;
58
+ margin: 0 5px;
59
+ background: #ffffe8;
60
+ color: black;
61
+ width: 250px;
62
+ font-size: 11px;
63
+ position: absolute;
64
+ inset-inline-start: unset;
65
+ inset-inline-end: unset;
66
+ border-radius: 5px;
67
+ pointer-events: all;
68
+ overflow: hidden;
69
+ box-shadow: 0px -2px 20px 0px #0000002e;
70
+ z-index: 10000;
71
+ }
72
+
73
+ .top {
74
+ bottom: calc(100% + 5px);
75
+ }
76
+ .bottom {
77
+ top: 40px;
78
+ }
79
+ .right {
80
+ inset-inline-start: 0;
81
+ inset-inline-end: unset;
82
+ }
83
+ .left {
84
+ inset-inline-start: unset;
85
+ inset-inline-end: calc(100% - 40px);
86
+ }
87
+
88
+ .content {
89
+ padding: 5px;
90
+ }
91
+
92
+ #loc {
93
+ background: #2e3801;
94
+ color: #d2d2d2;
95
+ font-family: monospace;
96
+ padding: 3px 5px;
97
+ pointer-events: all;
98
+ margin: 0;
99
+ border: 0;
100
+ cursor: pointer;
101
+ font-size: 11px;
102
+ width: calc(100% - 24px);
103
+ text-overflow: ellipsis;
104
+ overflow: hidden;
105
+ display: block;
106
+ direction: rtl;
107
+ text-align: right;
108
+ }
109
+ #loc:hover {
110
+ background: #3a4a01;
111
+ }
112
+
113
+ pre {
114
+ background: #f1fb8e;
115
+ padding: 5px;
116
+ margin: 5px 0;
117
+ border-radius: 3px;
118
+ user-select: none;
119
+ }
120
+
121
+ pre span {
122
+ user-select: all;
123
+ }
124
+
125
+ a {
126
+ text-decoration: underline;
127
+ }
128
+
129
+ #close {
130
+ border: 0;
131
+ width: 25px;
132
+ height: 25px;
133
+ position: absolute;
134
+ right: 0;
135
+ top: 0;
136
+ background: #ffe14f;
137
+ color: black;
138
+ font-weight: 900;
139
+ padding: 0;
140
+ margin: 0;
141
+ display: flex;
142
+ align-items: center;
143
+ justify-content: center;
144
+ line-height: 1;
145
+ cursor: pointer;
146
+ }
147
+ #close:hover {
148
+ background: #ffeb6f;
149
+ }
150
+
151
+ #action-btn {
152
+ border: 2px solid #18ae00;
153
+ padding: 2px 4px;
154
+ background: #50ff50;
155
+ border-radius: 5px;
156
+ color: #0c5500;
157
+ font-weight: 800;
158
+ font-size: 10px;
159
+ cursor: pointer;
160
+ }
161
+
162
+ p {
163
+ margin: 5px 0;
164
+ }
165
+
166
+ h2 {
167
+ font-weight: 900;
168
+ margin: 10px 0;
169
+ }
170
+ </style>
171
+ <button id="icon" type="button" aria-label="Open image dev dialog">
172
+ <svg width="32" height="32" viewBox="0 0 24 24">
173
+ <path
174
+ fill="currentColor"
175
+ d="M2.725 21q-.275 0-.5-.138t-.35-.362q-.125-.225-.138-.488t.138-.512l9.25-16q.15-.25.388-.375T12 3q.25 0 .488.125t.387.375l9.25 16q.15.25.138.513t-.138.487q-.125.225-.35.363t-.5.137H2.725ZM12 18q.425 0 .713-.288T13 17q0-.425-.288-.713T12 16q-.425 0-.713.288T11 17q0 .425.288.713T12 18Zm0-3q.425 0 .713-.288T13 14v-3q0-.425-.288-.713T12 10q-.425 0-.713.288T11 11v3q0 .425.288.713T12 15Z"
176
+ />
177
+ </svg>
178
+ </button>
179
+ <dialog>
180
+ <form method="dialog">
181
+ <button id="close" type="submit" aria-label="Close">X</button>
182
+ </form>
183
+ <button id="loc"></button>
184
+ <div class="content">
185
+ <h2 id="title"></h2>
186
+ <p id="message"></p>
187
+ <p class="action-container"></p>
188
+ </div>
189
+ </dialog>
190
+ `,qr=`vite-error-overlay{--color-bright: rgba(255, 255, 255, .8);--color-yellow: rgba(255, 246, 85, .8);--qwik-dark-blue: #006ce9;--qwik-light-blue: #3ec2f7;--qwik-light-purple: #ac7ff4;--qwik-dark-purple: #713fc2;--yellow: #fff;--purple: var(--color-bright);--red: var(--qwik-light-blue);--vertical-box-spacing: 15px;--box-padding: 20px;--box-margin: 0 0 var(--vertical-box-spacing) 0;--box-background: rgba(0, 0, 0, .5);--box-border-radius: 8px}vite-error-overlay::part(backdrop){background:#020b1199}vite-error-overlay::part(window){background:transparent;border:none;box-shadow:none;box-sizing:border-box;margin:50px auto;max-width:1200px;padding:var(--box-padding);width:90%}vite-error-overlay::part(message){display:flex;flex-direction:column;font-size:1.6rem;line-height:1.7;margin-bottom:30px}vite-error-overlay::part(plugin){font-size:.8rem;font-weight:100}vite-error-overlay::part(file),vite-error-overlay::part(frame),vite-error-overlay::part(stack),vite-error-overlay::part(tip){background:var(--box-background);border-left:5px solid transparent;border-radius:var(--box-border-radius);margin:var(--box-margin);min-height:50px;padding:var(--box-padding);position:relative}vite-error-overlay::part(file){border-left-color:#19b6f6;color:var(--color-bright)}vite-error-overlay::part(frame){border-left-color:var(--color-yellow);color:var(--color-yellow)}vite-error-overlay::part(stack){border-left-color:#ff5722}vite-error-overlay::part(tip){border-top:none;border-left-color:#ac7ff4}vite-error-overlay::part(file):before,vite-error-overlay::part(frame):before,vite-error-overlay::part(stack):before{border-bottom:1px solid #222;color:var(--color-bright);display:block;margin-bottom:15px;padding-bottom:5px;padding-left:30px;font-size:.8rem}vite-error-overlay::part(file):before{content:"File"}vite-error-overlay::part(frame):before{content:"Frame"}vite-error-overlay::part(stack):before{content:"Stack Trace"}vite-error-overlay::part(file):after,vite-error-overlay::part(frame):after,vite-error-overlay::part(stack):after{content:"";display:block;height:20px;position:absolute;left:var(--box-padding);top:var(--box-padding);width:20px}vite-error-overlay::part(file):after{background-image:url("data:image/svg+xml,%3Csvg width='20px' height='20px' viewBox='0 0 24 24' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Ctitle%3EFile-Generic%3C/title%3E%3Cg id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cg id='File-Generic'%3E%3Crect id='Rectangle' fill-rule='nonzero' x='0' y='0' width='24' height='24'%3E%3C/rect%3E%3Cpath d='M4 5 C4 3.89543 4.89543 3 6 3 L15.1716 3 C15.702 3 16.2107 3.21071 16.5858 3.58579 L19.4142 6.41421 C19.7893 6.78929 20 7.29799 20 7.82843 L20 19 C20 20.1046 19.1046 21 18 21 L6 21 C4.89543 21 4 20.1046 4 19 L4 5 Z' id='Path' stroke='rgba(255,255,255,0.7)' stroke-width='1' stroke-linecap='round'%3E%3C/path%3E%3Cpath d='M15 4 L15 6 C15 7.10457 15.8954 8 17 8 L19 8' id='Path' stroke='rgba(255,255,255,0.7)' stroke-width='1' stroke-linecap='round'%3E%3C/path%3E%3C/g%3E%3C/g%3E%3C/svg%3E")}vite-error-overlay::part(frame):after{background-image:url("data:image/svg+xml,%3Csvg width='20px' height='20px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M15.6602 2.84952H19.1516C20.2555 2.84952 21.1504 3.74444 21.1504 4.84839V8.3398' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3Cpath d='M2.84949 8.33981L2.84949 4.8484C2.84949 3.74446 3.74441 2.84953 4.84836 2.84953L8.33977 2.84953' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3Cpath d='M21.1505 15.6602L21.1505 19.1516C21.1505 20.2555 20.2556 21.1505 19.1516 21.1505L15.6602 21.1505' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3Cpath d='M8.33984 21.1505L4.84843 21.1505C3.74449 21.1505 2.84956 20.2555 2.84956 19.1516L2.84956 15.6602' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3C/svg%3E")}vite-error-overlay::part(stack):after{background-image:url("data:image/svg+xml,%3Csvg width='20px' height='20px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.78 20H9.78C7.98 20 4.58 19.09 4.58 15.64C4.58 12.19 7.98 11.28 9.78 11.28H14.22C14.37 11.28 17.92 11.23 17.92 8.42C17.92 5.61 14.37 5.56 14.22 5.56H9.22C9.02109 5.56 8.83032 5.48098 8.68967 5.34033C8.54902 5.19968 8.47 5.00891 8.47 4.81C8.47 4.61109 8.54902 4.42032 8.68967 4.27967C8.83032 4.13902 9.02109 4.06 9.22 4.06H14.22C16.02 4.06 19.42 4.97 19.42 8.42C19.42 11.87 16.02 12.78 14.22 12.78H9.78C9.63 12.78 6.08 12.83 6.08 15.64C6.08 18.45 9.63 18.5 9.78 18.5H14.78C14.9789 18.5 15.1697 18.579 15.3103 18.7197C15.451 18.8603 15.53 19.0511 15.53 19.25C15.53 19.4489 15.451 19.6397 15.3103 19.7803C15.1697 19.921 14.9789 20 14.78 20Z' fill='rgba(255,255,255,0.7)'/%3E%3Cpath d='M6.44 8.31C5.74314 8.30407 5.06363 8.09202 4.48708 7.70056C3.91054 7.30909 3.46276 6.75573 3.20018 6.11021C2.93759 5.46469 2.87195 4.75589 3.01153 4.07312C3.1511 3.39036 3.48965 2.76418 3.9845 2.2735C4.47935 1.78281 5.10837 1.44958 5.79229 1.31579C6.47622 1.182 7.18444 1.25363 7.82771 1.52167C8.47099 1.78971 9.02054 2.24215 9.40711 2.82199C9.79368 3.40182 9.99998 4.08311 10 4.78C10 5.2461 9.90773 5.70759 9.72846 6.13783C9.54919 6.56808 9.28648 6.95856 8.95551 7.28675C8.62453 7.61494 8.23184 7.87433 7.80009 8.04995C7.36834 8.22558 6.90609 8.31396 6.44 8.31ZM6.44 2.75C6.04444 2.75 5.65776 2.86729 5.32886 3.08706C4.99996 3.30682 4.74362 3.61918 4.59224 3.98463C4.44087 4.35008 4.40126 4.75221 4.47843 5.14018C4.5556 5.52814 4.74609 5.8845 5.02579 6.16421C5.3055 6.44391 5.66186 6.6344 6.04982 6.71157C6.43779 6.78874 6.83992 6.74913 7.20537 6.59776C7.57082 6.44638 7.88318 6.19003 8.10294 5.86114C8.32271 5.53224 8.44 5.14556 8.44 4.75C8.44 4.48735 8.38827 4.22728 8.28776 3.98463C8.18725 3.74198 8.03993 3.5215 7.85422 3.33578C7.6685 3.15007 7.44802 3.00275 7.20537 2.90224C6.96272 2.80173 6.70265 2.75 6.44 2.75Z' fill='rgba(255,255,255,0.7)'/%3E%3Cpath d='M17.56 22.75C16.8614 22.752 16.1779 22.5466 15.5961 22.1599C15.0143 21.7733 14.5603 21.2227 14.2916 20.5778C14.0229 19.933 13.9515 19.2229 14.0866 18.5375C14.2217 17.8521 14.5571 17.2221 15.0504 16.7275C15.5437 16.2328 16.1726 15.8956 16.8577 15.7586C17.5427 15.6215 18.253 15.6909 18.8986 15.9577C19.5442 16.2246 20.0961 16.6771 20.4844 17.2578C20.8727 17.8385 21.08 18.5214 21.08 19.22C21.08 20.1545 20.7095 21.0508 20.0496 21.7125C19.3898 22.3743 18.4945 22.7473 17.56 22.75ZM17.56 17.19C17.1644 17.19 16.7778 17.3073 16.4489 17.5271C16.12 17.7468 15.8636 18.0592 15.7122 18.4246C15.5609 18.7901 15.5213 19.1922 15.5984 19.5802C15.6756 19.9681 15.8661 20.3245 16.1458 20.6042C16.4255 20.8839 16.7819 21.0744 17.1698 21.1516C17.5578 21.2287 17.9599 21.1891 18.3254 21.0377C18.6908 20.8864 19.0032 20.63 19.2229 20.3011C19.4427 19.9722 19.56 19.5856 19.56 19.19C19.56 18.6596 19.3493 18.1508 18.9742 17.7758C18.5991 17.4007 18.0904 17.19 17.56 17.19Z' fill='rgba(255,255,255,0.7)'/%3E%3C/svg%3E")}vite-error-overlay::part(tip):before{content:"Not sure how to solve this? Visit https://qwik.dev or connect with the community on Discord.";display:block;margin-bottom:1em}`,jr="#qwik-inspector-overlay{position:fixed;background:#18b6f645;pointer-events:none;box-sizing:border-box;border:2px solid rgba(172,126,244,.46);border-radius:4px;contain:strict;cursor:pointer;z-index:999999}#qwik-inspector-info-popup{position:fixed;bottom:10px;right:10px;font-family:monospace;background:#000000c2;color:#fff;padding:10px 20px;border-radius:8px;box-shadow:0 20px 25px -5px #00000057,0 8px 10px -6px #0000003d;backdrop-filter:blur(4px);-webkit-animation:fadeOut .3s 3s ease-in-out forwards;animation:fadeOut .3s 3s ease-in-out forwards;z-index:999999;contain:layout}#qwik-inspector-info-popup p{margin:0}@-webkit-keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes fadeOut{0%{opacity:1}to{opacity:0;visibility:hidden}}";async function Or(e,n,i,r){const o=await i.dynamicImport("node:fs"),d=await i.dynamicImport("node:url"),a=["mjs","cjs","js"].map(p=>r.join(n,`entry.preview.${p}`)).find(p=>o.existsSync(p));if(!a)return et(e,`Unable to find output "${n}/entry.preview" module.
191
+
192
+ Please ensure "src/entry.preview.tsx" has been built before the "preview" command.`);try{const p=d.pathToFileURL(a).href,t=await i.strictDynamicImport(p);let x=null,k=null;if(t.default&&(typeof t.default=="function"?x=t.default:typeof t.default=="object"&&(x=t.default.router,k=t.default.notFound)),typeof x!="function")return et(e,`Entry preview module "${a}" does not export a default middleware function`);e.use(x),typeof k=="function"&&e.use(k)}catch(p){return et(e,String(p))}}function et(e,n){console.log(`
193
+ ${n}
194
+ `),e.use((i,r)=>{r.writeHead(400,{"Content-Type":"text/plain"}),r.end(n)})}const Lr=(e,n)=>{const i=[{tag:"style",children:qr,injectTo:"body"},{tag:"style",children:jr,injectTo:"body"},{tag:"script",attrs:{type:"module"},children:Pr,injectTo:"body"},{tag:"script",attrs:{type:"module"},children:Tr,injectTo:"body"}];if((e.devTools?.imageDevTools??!0)&&i.push({tag:"style",children:Dr,injectTo:"body"},{tag:"script",attrs:{type:"module"},children:Nr.replace("globalThis.__TEMPLATE__",JSON.stringify(Mr)),injectTo:"body"}),e.devTools?.clickToSource??!0){const r=e.devTools.clickToSource??[],o=new URL(n+"/","http://local.local").href;i.push({tag:"script",attrs:{type:"module"},children:Cr.replace("globalThis.__HOTKEYS__",JSON.stringify(r)).replace("globalThis.__SRC_DIR__",JSON.stringify(o)),injectTo:"body"})}return i},Ur=[$e,Qe,Ke,Re,"@builder.io/qwik","@builder.io/qwik/jsx-runtime","@builder.io/qwik/jsx-dev-runtime"],$r=[".css",".scss",".sass",".less",".styl",".stylus"],Rr=[".woff",".woff2",".ttf"];function Br(e={}){let n="serve",i=null,r=null,o="/",d=null,c,a=null,p=null,t=null;const x=e.fileFilter?(s,y)=>yt.test(s)||e.fileFilter(s,y):()=>!0,k=e.disableFontPreload??!1,u=[],w=gt(e.optimizerOptions),m=new Set;return[{name:"vite-plugin-qwik",enforce:"pre",api:{getOptimizer:()=>w.getOptimizer(),getOptions:()=>w.getOptions(),getManifest:()=>i,getRootDir:()=>w.getOptions().rootDir,getClientOutDir:()=>r,getClientPublicOutDir:()=>d,getAssetsDir:()=>c,registerBundleGraphAdder:s=>m.add(s),_oldDevSsrServer:()=>e.devSsrServer},async config(s,y){await w.init();const h=w.getPath();let I;s.build?.ssr||y.mode==="ssr"?I="ssr":y.mode==="lib"?I="lib":y.mode==="test"?I="test":I="client",n=y.command;let v;y.mode==="production"?v="production":y.mode==="development"?v="development":n==="build"&&I==="client"?v="production":v="development",w.debug(`vite config(), command: ${n}, env.mode: ${y.mode}`),n==="serve"?e.entryStrategy={type:"segment"}:I==="ssr"?e.entryStrategy={type:"hoist"}:I==="lib"&&(e.entryStrategy={type:"inline"});const T=I==="ssr"?typeof s.build?.ssr=="string"?s.build.ssr:e.ssr?.input:void 0,E=I==="client"?e.client?.input:void 0;let P=s.build?.rollupOptions?.input||E||T;P&&typeof P=="string"&&(P=[P]),c=s.build?.assetsDir;const U=I==="client"&&!!c&&c!=="_astro",j={target:I,buildMode:v,csr:e.csr,debug:e.debug,entryStrategy:e.entryStrategy,srcDir:e.srcDir,rootDir:s.root,tsconfigFileNames:e.tsconfigFileNames,resolveQwikBuild:!0,transformedModuleOutput:e.transformedModuleOutput,outDir:s.build?.outDir,ssrOutDir:e.ssr?.outDir||s.build?.outDir,clientOutDir:e.client?.outDir||(s.build?.ssr?void 0:s.build?.outDir),assetsDir:U?c:void 0,devTools:e.devTools,sourcemap:!!s.build?.sourcemap,lint:e.lint,experimental:e.experimental,input:P,manifestInput:e.ssr?.manifestInput,manifestOutput:e.client?.manifestOutput},R=await w.normalizeOptions(j);P||(P=R.input),i=R.manifestInput,a=R.srcDir,p=R.rootDir,e.csr||(r=R.clientOutDir,d=s.base?h.join(r,s.base):r,t=R.ssrOutDir);const H=v==="development",Y="globalThis.qDev",ce="globalThis.qTest",W="globalThis.qInspector",Z="globalThis.qSerialize",te=s?.define?.[Y]??H,je=s?.define?.[W]??H,L=s?.define?.[Z]??H,G={ssr:{noExternal:[$e,Re,Je,re]},envPrefix:["VITE_","PUBLIC_"],resolve:{dedupe:[...Ur],conditions:v==="production"&&I==="client"?["min"]:[],alias:{"@builder.io/qwik":"@qwik.dev/core","@builder.io/qwik/build":"@qwik.dev/core/build","@builder.io/qwik/server":"@qwik.dev/core/server","@builder.io/qwik/preloader":"@qwik.dev/core/preloader","@builder.io/qwik/jsx-runtime":"@qwik.dev/core/jsx-runtime","@builder.io/qwik/jsx-dev-runtime":"@qwik.dev/core/jsx-dev-runtime","@builder.io/qwik/optimizer":"@qwik.dev/core/optimizer","@builder.io/qwik/loader":"@qwik.dev/core/loader","@builder.io/qwik/backpatch":"@qwik.dev/core/backpatch","@builder.io/qwik/cli":"@qwik.dev/core/cli","@builder.io/qwik/testing":"@qwik.dev/core/testing"}},esbuild:n==="serve"?!1:{logLevel:"error",jsx:"automatic"},optimizeDeps:{exclude:[$e,Re,Je,Qe,Ke,re,oe,"@builder.io/qwik"],entries:P&&(typeof P=="string"?[P]:typeof P=="object"?Object.values(P):P)},build:{modulePreload:!1,dynamicImportVarsOptions:{exclude:[/./]},rollupOptions:{maxParallelFileOps:1,input:P}},define:{[Y]:te,[W]:je,[Z]:L,[ce]:JSON.stringify(process.env.NODE_ENV==="test")}};if(!e.csr){const Ae=I==="client"&&s.base?h.join(R.outDir,s.base):R.outDir;G.build.cssCodeSplit=!1,G.build.outDir=Ae;const Q=G.build.rollupOptions?.onwarn;G.build.rollupOptions={...G.build.rollupOptions,output:await xn(w,s.build?.rollupOptions?.output,U,Ae),preserveEntrySignatures:"exports-only",onwarn:(de,ze)=>{de.plugin==="typescript"&&de.message.includes("outputToFilesystem")||(Q?Q(de,ze):ze(de))}},R.target==="ssr"?n==="build"&&(G.publicDir=!1,G.build.ssr=!0,s.build?.minify==null&&v==="production"&&(G.build.minify=!0)):R.target==="client"||(R.target==="lib"?(G.build.minify=!1,G.build.rollupOptions.external=[$e,Re,Je,Qe,Ke,re,oe]):G.define={[Y]:!0,[ce]:!0,[W]:!1}),globalThis.qDev=te,globalThis.qTest=!0,globalThis.qInspector=je}return G},async configResolved(s){if(o=s.base,!(o.startsWith("/")&&o.endsWith("/")))throw new Error("vite's config.base must begin and end with /");!!s.build.sourcemap&&e.optimizerOptions?.sourcemap===void 0&&w.setSourceMapSupport(!0),w.normalizeOptions(e)},async buildStart(){u.length=0;const s=this.resolve.bind(this);await w.validateSource(s),w.onDiagnostics((y,h,I)=>{y.forEach(v=>{const T=w.normalizePath(h.sys.path.join(I,v.file));v.category==="error"?this.error(Be(T,v)):this.warn(Be(T,v))})}),await w.buildStart(this)},resolveId(s,y,h){const I=x(s,"resolveId");return ee(s)||!I?null:w.resolveId(this,s,y,h)},load(s,y){const h=x(s,"load");return ee(s)||!h?null:(s=w.normalizePath(s),n==="serve"&&s.endsWith(oe)?{code:"export const manifest = undefined;"}:w.load(this,s,y))},transform(s,y,h){const I=x(y,"transform"),v=y.includes("?raw");if(ee(y)||!I||v)return null;if(y.includes(".vite/deps/")&&s.slice(0,5e3).includes("qwik")&&/import[^\n]*qwik[^\n]*\n/.test(s)){const T=p&&y.startsWith(p)?y.slice(p.length):y;throw new Error(`
195
+ ==============
196
+ This dependency was pre-bundled by Vite, but it seems to use Qwik, which needs processing by the optimizer.
197
+ Please add the original modulename to the "optimizeDeps.exclude" array in your Vite config:
198
+ ${T}
199
+ ==============
200
+ `)}return w.transform(this,s,y,h)}},{name:"vite-plugin-qwik-post",enforce:"post",generateBundle:{order:"post",async handler(s,y){const h=w.getOptions();if(h.target==="client"){for(const[I,v]of Object.entries(y))if(v.type==="asset"){const T=o+I;if($r.some(E=>I.endsWith(E)))typeof v.source=="string"&&v.source.length<h.inlineStylesUpToBytes?u.push({tag:"style",location:"head",attributes:{"data-src":T,dangerouslySetInnerHTML:v.source}}):u.push({tag:"link",location:"head",attributes:{rel:"stylesheet",href:T}});else{const E=Rr.find(P=>I.endsWith(P));E&&!k&&u.unshift({tag:"link",location:"head",attributes:{rel:"preload",href:T,as:"font",type:`font/${E.slice(1)}`,crossorigin:""}})}}await w.generateManifest(this,y,m,{injections:u,platform:{vite:""}})}}},async writeBundle(s,y){const h=w.getOptions();if(h.target==="ssr"){const I=w.getSys();if(I.env==="node"||I.env==="bun"){const v=Object.keys(y),T=async E=>{try{const P=I.path.basename(E),U=I.path.extname(P);if((P.startsWith("entry.")||P.startsWith("entry_"))&&!P.includes("preview")&&(U===".mjs"||U===".cjs")){const R=I.path.basename(P,U),H=`${R}.js`,Y=R+U;if(!v.some(W=>I.path.basename(W)===H)){const W=I.path.dirname(E),Z=await I.dynamicImport("node:fs"),te=I.path.join(h.outDir,W);await Z.promises.mkdir(te,{recursive:!0}),await Z.promises.writeFile(I.path.join(te,H),`export * from "./${Y}";`)}}}catch(P){console.error("patchModuleFormat",P)}};await Promise.all(v.map(T))}}},transformIndexHtml(){if(n==="serve")return Lr(w.getOptions(),a)},configureServer(s){w.configureServer(s),(e?.devTools?.imageDevTools??!0)&&s.middlewares.use(Sr(w.getSys(),p,a))},configurePreviewServer(s){return async()=>{const y=w.getSys(),h=w.getPath();await Or(s.middlewares,t,y,h)}},handleHotUpdate(s){w.handleHotUpdate(s),s.modules.length&&s.server.hot.send({type:"full-reload"})},onLog(s,y){if(y.plugin=="vite-plugin-qwik"){const h=Ar[s]||ie.White,I=(y.frame||"").split(`
201
+ `).map(v=>(v.match(/^\s*\^\s*$/)?ie.BrightWhite:ie.BrightBlack)+v);return console[s](`${h}%s
202
+ ${ie.BrightWhite}%s
203
+ %s${ie.RESET}`,`[${y.plugin}](${s}): ${y.message}
204
+ `,` ${y?.loc?.file}:${y?.loc?.line}:${y?.loc?.column}
205
+ `,` ${I.join(`
206
+ `)}
207
+ `),!1}}},Fr()]}async function Fr(){let e,n;try{e=await import("node:fs").then(a=>a.promises),n=await import("node:path")}catch{return}const i=new Set;let r;const o="@qwik-dev/core",d="@builder.io/qwik";async function c(a,p){for(;p;){const t=n.join(p,"node_modules",a,"package.json");try{await e.access(t);const k=await e.readFile(t,{encoding:"utf-8"}),u=JSON.parse(k);return!!(u.qwik||u.dependencies?.[o]||u.peerDependencies?.[o]||u.dependencies?.[d]||u.peerDependencies?.[d])}catch{}const x=n.dirname(p);if(x===p)break;p=x}return!1}return{name:"checkQwikExternals",enforce:"pre",configResolved:a=>{r=a.root},resolveId:{order:"pre",async handler(a,p,t){if(!t.ssr||/^([./]|node:|[^a-z])/.test(a)||i.has(a))return;const x=(a.startsWith("@")?a.split("/").slice(0,2).join("/"):a.split("/")[0]).split("?")[0];if(i.has(x))return;i.add(a),i.add(x);const k=await this.resolve(x,p,{...t,skipSelf:!0});if(k?.external&&await c(x,p?n.dirname(p):r))throw new Error(`
208
+ ==============
209
+ ${x} is being treated as an external dependency, but it should be included in the server bundle, because it uses Qwik and it needs to be processed by the optimizer.
210
+ Please add the package to "ssr.noExternal[]" as well as "optimizeDeps.exclude[]" in the Vite config.
211
+ ==============
212
+ `);if(x===a)return k}}}}const ie={Yellow:"\x1B[33m",Cyan:"\x1B[36m",White:"\x1B[37m",BrightBlack:"\x1B[90m",BrightWhite:"\x1B[97m",RESET:"\x1B[0m"},Ar={warn:ie.Yellow,info:ie.Cyan,debug:ie.BrightBlack},zr=void 0;return exports.createOptimizer=ot,exports.qwikRollup=vn,exports.qwikVite=Br,exports.symbolMapper=zr,exports.versions=pe,J.exports})(typeof module=="object"&&module.exports?module:{exports:{}});