@qwik.dev/core 2.0.0-alpha.0 → 2.0.0-alpha.10

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 (105) 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.wasm.cjs +259 -272
  5. package/bindings/qwik.wasm.mjs +259 -272
  6. package/bindings/qwik.win32-x64-msvc.node +0 -0
  7. package/bindings/qwik_wasm_bg.wasm +0 -0
  8. package/dist/build/index.cjs +3 -3
  9. package/dist/build/index.d.ts +22 -22
  10. package/dist/build/package.json +1 -1
  11. package/dist/cli.cjs +1453 -798
  12. package/dist/core-internal.d.ts +4368 -3895
  13. package/dist/core.cjs +6792 -6121
  14. package/dist/core.cjs.map +1 -1
  15. package/dist/core.min.mjs +1 -1
  16. package/dist/core.mjs +6765 -6117
  17. package/dist/core.mjs.map +1 -1
  18. package/dist/core.prod.cjs +3571 -3206
  19. package/dist/core.prod.mjs +3919 -3586
  20. package/dist/insights/index.qwik.cjs +1 -751
  21. package/dist/insights/index.qwik.mjs +62 -741
  22. package/dist/insights/vite/index.cjs +1 -82
  23. package/dist/insights/vite/index.mjs +65 -37
  24. package/dist/insights/vite.d.ts +22 -0
  25. package/dist/{insights/insights.d.ts → insights.d.ts} +33 -22
  26. package/dist/loader/index.cjs +2 -2
  27. package/dist/loader/index.mjs +2 -2
  28. package/dist/loader/package.json +1 -1
  29. package/dist/optimizer.cjs +693 -5851
  30. package/dist/optimizer.d.ts +741 -707
  31. package/dist/optimizer.mjs +679 -6276
  32. package/dist/preloader.cjs +243 -0
  33. package/dist/preloader.mjs +183 -0
  34. package/dist/qwikloader.debug.js +211 -220
  35. package/dist/qwikloader.js +1 -3
  36. package/dist/server.cjs +1371 -7273
  37. package/dist/server.d.ts +467 -402
  38. package/dist/server.mjs +1339 -7224
  39. package/dist/starters/adapters/aws-lambda/serverless.yml +15 -0
  40. package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +0 -2
  41. package/dist/starters/adapters/azure-swa/public/staticwebapp.config.json +7 -0
  42. package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +1 -2
  43. package/dist/starters/adapters/bun/src/entry.bun.ts +3 -2
  44. package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +1 -3
  45. package/dist/starters/adapters/cloudflare-pages/public/_headers +2 -0
  46. package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +1 -2
  47. package/dist/starters/adapters/deno/src/entry.deno.ts +3 -2
  48. package/dist/starters/adapters/express/src/entry.express.tsx +5 -2
  49. package/dist/starters/adapters/fastify/src/entry.fastify.tsx +2 -1
  50. package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +11 -1
  51. package/dist/starters/adapters/firebase/firebase.json +12 -1
  52. package/dist/starters/adapters/firebase/functions/index.js +2 -3
  53. package/dist/starters/adapters/firebase/src/entry-firebase.tsx +1 -2
  54. package/dist/starters/adapters/netlify-edge/public/_headers +2 -0
  55. package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +1 -2
  56. package/dist/starters/adapters/node-server/src/entry.node-server.tsx +3 -2
  57. package/dist/starters/adapters/static/README.md +4 -0
  58. package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +1 -2
  59. package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
  60. package/dist/starters/features/auth/package.json +3 -1
  61. package/dist/starters/features/bootstrap/src/routes/bootstrap/layout.tsx +0 -11
  62. package/dist/starters/features/cypress/package.json +1 -1
  63. package/dist/starters/features/drizzle/drizzle/schema.ts +6 -18
  64. package/dist/starters/features/drizzle/drizzle.config.ts +5 -4
  65. package/dist/starters/features/drizzle/package.json +16 -12
  66. package/dist/starters/features/localize/src/entry.ssr.tsx +0 -2
  67. package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +1 -1
  68. package/dist/starters/features/pandacss/package.json +1 -1
  69. package/dist/starters/features/partytown/package.json +1 -1
  70. package/dist/starters/features/postcss/package.json +4 -1
  71. package/dist/starters/features/postcss/postcss.config.js +1 -1
  72. package/dist/starters/features/prisma/package.json +3 -2
  73. package/dist/starters/features/react/package.json +1 -1
  74. package/dist/starters/features/service-worker/package.json +13 -0
  75. package/dist/starters/features/service-worker/src/routes/service-worker.ts +14 -0
  76. package/dist/starters/features/storybook/package.json +1 -1
  77. package/dist/starters/features/styled-vanilla-extract/package.json +4 -2
  78. package/dist/starters/features/tailwind/package.json +19 -9
  79. package/dist/starters/features/tailwind/src/global.css +1 -7
  80. package/dist/starters/features/tailwind-v3/package.json +21 -0
  81. package/dist/starters/features/{tailwind → tailwind-v3}/postcss.config.cjs +1 -1
  82. package/dist/starters/features/tailwind-v3/src/global.css +7 -0
  83. package/dist/starters/features/{tailwind → tailwind-v3}/tailwind.config.js +1 -1
  84. package/dist/starters/features/turso/package.json +5 -2
  85. package/dist/starters/features/turso/src/utils/turso.ts +1 -1
  86. package/dist/starters/features/vitest/package.json +1 -1
  87. package/dist/testing/index.cjs +7568 -6858
  88. package/dist/testing/index.d.ts +141 -140
  89. package/dist/testing/index.mjs +7501 -6790
  90. package/dist/testing/package.json +1 -1
  91. package/handlers.mjs +9 -0
  92. package/package.json +32 -20
  93. package/public.d.ts +15 -0
  94. package/server.d.ts +1 -0
  95. package/dist/index.d.ts +0 -2
  96. package/dist/insights/index.d.ts +0 -1
  97. package/dist/insights/vite/index.d.ts +0 -1
  98. package/dist/insights/vite/insights-plugin.d.ts +0 -10
  99. package/dist/prefetch/index.cjs +0 -4
  100. package/dist/prefetch/index.d.ts +0 -2
  101. package/dist/prefetch/index.mjs +0 -3
  102. package/dist/prefetch/package.json +0 -8
  103. package/dist/qwik-prefetch.debug.js +0 -244
  104. package/dist/qwik-prefetch.js +0 -1
  105. /package/dist/starters/features/{tailwind → tailwind-v3}/.vscode/settings.json +0 -0
@@ -1,751 +1 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
- const core = require("@qwik.dev/core");
7
- /**
8
- * @license
9
- * @qwik.dev/core 2.0.0-alpha.0-dev+dd93926
10
- * Copyright QwikDev. All Rights Reserved.
11
- * Use of this source code is governed by an MIT-style license that can be
12
- * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
13
- */
14
- const logError = (message, ...optionalParams) => createAndLogError(false, message, ...optionalParams);
15
- const throwErrorAndStop = (message, ...optionalParams) => {
16
- throw createAndLogError(false, message, ...optionalParams);
17
- };
18
- const createAndLogError = (asyncThrow, message, ...optionalParams) => {
19
- const err = message instanceof Error ? message : new Error(message);
20
- return console.error("%cQWIK ERROR", "", err.message, ...optionalParams, err.stack), asyncThrow && setTimeout(() => {
21
- throw err;
22
- }, 0), err;
23
- };
24
- function assertTrue() {
25
- }
26
- function assertFalse() {
27
- }
28
- const isPromise = (value) => !!value && "object" == typeof value && "function" == typeof value.then;
29
- function retryOnPromise(fn, retryCount = 0) {
30
- try {
31
- return fn();
32
- } catch (e) {
33
- if (isPromise(e) && retryCount < 100) {
34
- return e.then(retryOnPromise.bind(null, fn, retryCount++));
35
- }
36
- throw e;
37
- }
38
- }
39
- const isArray = (v) => Array.isArray(v);
40
- var VirtualType;
41
- !function(VirtualType2) {
42
- VirtualType2.Virtual = "V", VirtualType2.Fragment = "F", VirtualType2.WrappedSignal = "S", VirtualType2.Awaited = "A", VirtualType2.Component = "C", VirtualType2.InlineComponent = "I", VirtualType2.Projection = "P";
43
- }(VirtualType || (VirtualType = {}));
44
- ({
45
- [VirtualType.Virtual]: "\x1B[34mVirtual\x1B[0m",
46
- [VirtualType.Fragment]: "\x1B[34mFragment\x1B[0m",
47
- [VirtualType.WrappedSignal]: "\x1B[34mSignal\x1B[0m",
48
- [VirtualType.Awaited]: "\x1B[34mAwaited\x1B[0m",
49
- [VirtualType.Component]: "\x1B[34mComponent\x1B[0m",
50
- [VirtualType.InlineComponent]: "\x1B[34mInlineComponent\x1B[0m",
51
- [VirtualType.Projection]: "\x1B[34mProjection\x1B[0m"
52
- });
53
- var QContainerValue;
54
- !function(QContainerValue2) {
55
- QContainerValue2.PAUSED = "paused", QContainerValue2.RESUMED = "resumed", QContainerValue2.HTML = "html", QContainerValue2.TEXT = "text";
56
- }(QContainerValue || (QContainerValue = {}));
57
- const QContainerSelector = "[q\\:container]:not([q\\:container=" + QContainerValue.HTML + "]):not([q\\:container=" + QContainerValue.TEXT + "])";
58
- const dangerouslySetInnerHTML = "dangerouslySetInnerHTML";
59
- const isQrl$1 = (value) => "function" == typeof value && "function" == typeof value.getSymbol;
60
- const EMPTY_OBJ = {};
61
- Object.freeze(EMPTY_OBJ);
62
- class Subscriber {
63
- constructor() {
64
- __publicField(this, "$effectDependencies$", null);
65
- }
66
- }
67
- function isSubscriber(value) {
68
- return value instanceof Subscriber || value instanceof WrappedSignal;
69
- }
70
- const NEEDS_COMPUTATION = Symbol("invalid");
71
- const throwIfQRLNotResolved = (qrl2) => {
72
- if (!qrl2.resolved) {
73
- throw qrl2.resolve();
74
- }
75
- };
76
- const isSignal = (value) => value instanceof Signal;
77
- class EffectData {
78
- constructor(data) {
79
- __publicField(this, "data");
80
- this.data = data;
81
- }
82
- }
83
- var EffectSubscriptionsProp;
84
- var EffectProperty;
85
- !function(EffectSubscriptionsProp2) {
86
- EffectSubscriptionsProp2[EffectSubscriptionsProp2.EFFECT = 0] = "EFFECT", EffectSubscriptionsProp2[EffectSubscriptionsProp2.PROPERTY = 1] = "PROPERTY", EffectSubscriptionsProp2[EffectSubscriptionsProp2.FIRST_BACK_REF_OR_DATA = 2] = "FIRST_BACK_REF_OR_DATA";
87
- }(EffectSubscriptionsProp || (EffectSubscriptionsProp = {})), function(EffectProperty2) {
88
- EffectProperty2.COMPONENT = ":", EffectProperty2.VNODE = ".";
89
- }(EffectProperty || (EffectProperty = {}));
90
- class Signal {
91
- constructor(container, value) {
92
- __publicField(this, "$untrackedValue$");
93
- __publicField(this, "$effects$", null);
94
- __publicField(this, "$container$", null);
95
- this.$container$ = container, this.$untrackedValue$ = value;
96
- }
97
- get untrackedValue() {
98
- return this.$untrackedValue$;
99
- }
100
- set untrackedValue(value) {
101
- this.$untrackedValue$ = value;
102
- }
103
- get value() {
104
- const ctx = tryGetInvokeContext();
105
- if (ctx) {
106
- if (null === this.$container$) {
107
- if (!ctx.$container$) {
108
- return this.untrackedValue;
109
- }
110
- this.$container$ = ctx.$container$;
111
- } else {
112
- assertTrue(!ctx.$container$ || ctx.$container$ === this.$container$);
113
- }
114
- const effectSubscriber = ctx.$effectSubscriber$;
115
- if (effectSubscriber) {
116
- const effects = this.$effects$ || (this.$effects$ = []);
117
- ensureContainsEffect(effects, effectSubscriber), ensureContains(effectSubscriber, this), isSubscriber(this) && ensureEffectContainsSubscriber(effectSubscriber[EffectSubscriptionsProp.EFFECT], this, this.$container$);
118
- }
119
- }
120
- return this.untrackedValue;
121
- }
122
- set value(value) {
123
- value !== this.$untrackedValue$ && (this.$untrackedValue$ = value, triggerEffects(this.$container$, this, this.$effects$));
124
- }
125
- valueOf() {
126
- }
127
- toString() {
128
- return `[${this.constructor.name}${this.$invalid$ ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (this.$effects$?.map((e) => "\n -> " + pad(qwikDebugToString(e[0]), " ")).join("\n") || "");
129
- }
130
- toJSON() {
131
- return {
132
- value: this.$untrackedValue$
133
- };
134
- }
135
- }
136
- const ensureContains = (array, value) => {
137
- -1 === array.indexOf(value) && array.push(value);
138
- };
139
- const ensureContainsEffect = (array, effectSubscriptions) => {
140
- for (let i = 0; i < array.length; i++) {
141
- const existingEffect = array[i];
142
- if (existingEffect[0] === effectSubscriptions[0] && existingEffect[1] === effectSubscriptions[1]) {
143
- return;
144
- }
145
- }
146
- array.push(effectSubscriptions);
147
- };
148
- const ensureEffectContainsSubscriber = (effect, subscriber, container) => {
149
- if (isSubscriber(effect)) {
150
- if (effect.$effectDependencies$ || (effect.$effectDependencies$ = []), subscriberExistInSubscribers(effect.$effectDependencies$, subscriber)) {
151
- return;
152
- }
153
- effect.$effectDependencies$.push(subscriber);
154
- } else if (vnode_isVNode(effect) && vnode_isVirtualVNode(effect)) {
155
- let subscribers = vnode_getProp(effect, "q:subs", container ? container.$getObjectById$ : null);
156
- if (subscribers || (subscribers = []), subscriberExistInSubscribers(subscribers, subscriber)) {
157
- return;
158
- }
159
- subscribers.push(subscriber), vnode_setProp(effect, "q:subs", subscribers);
160
- } else if (isSSRNode(effect)) {
161
- let subscribers = effect.getProp("q:subs");
162
- if (subscribers || (subscribers = []), subscriberExistInSubscribers(subscribers, subscriber)) {
163
- return;
164
- }
165
- subscribers.push(subscriber), effect.setProp("q:subs", subscribers);
166
- }
167
- };
168
- const isSSRNode = (effect) => "setProp" in effect && "getProp" in effect && "removeProp" in effect && "id" in effect;
169
- const subscriberExistInSubscribers = (subscribers, subscriber) => {
170
- for (let i = 0; i < subscribers.length; i++) {
171
- if (subscribers[i] === subscriber) {
172
- return true;
173
- }
174
- }
175
- return false;
176
- };
177
- const triggerEffects = (container, signal, effects) => {
178
- if (effects) {
179
- const scheduleEffect = (effectSubscriptions) => {
180
- const effect = effectSubscriptions[EffectSubscriptionsProp.EFFECT];
181
- const property = effectSubscriptions[EffectSubscriptionsProp.PROPERTY];
182
- if (isTask(effect)) {
183
- effect.$flags$ |= TaskFlags.DIRTY;
184
- let choreType = ChoreType.TASK;
185
- effect.$flags$ & TaskFlags.VISIBLE_TASK ? choreType = ChoreType.VISIBLE : effect.$flags$ & TaskFlags.RESOURCE && (choreType = ChoreType.RESOURCE), container.$scheduler$(choreType, effect);
186
- } else if (effect instanceof Signal) {
187
- effect instanceof ComputedSignal && (effect.$computeQrl$.resolved || container.$scheduler$(ChoreType.QRL_RESOLVE, null, effect.$computeQrl$));
188
- try {
189
- retryOnPromise(() => effect.$invalidate$());
190
- } catch (e) {
191
- logError(e);
192
- }
193
- } else if (property === EffectProperty.COMPONENT) {
194
- const host = effect;
195
- const qrl2 = container.getHostProp(host, "q:renderFn");
196
- const props = container.getHostProp(host, "q:props");
197
- container.$scheduler$(ChoreType.COMPONENT, host, qrl2, props);
198
- } else if (property === EffectProperty.VNODE) {
199
- container.$scheduler$(ChoreType.NODE_DIFF, effect, effect, signal);
200
- } else {
201
- let effectData = effectSubscriptions[EffectSubscriptionsProp.FIRST_BACK_REF_OR_DATA];
202
- if (effectData instanceof EffectData) {
203
- const payload = {
204
- ...effectData.data,
205
- $value$: signal
206
- };
207
- container.$scheduler$(ChoreType.NODE_PROP, effect, property, payload);
208
- }
209
- }
210
- };
211
- effects.forEach(scheduleEffect);
212
- }
213
- };
214
- class ComputedSignal extends Signal {
215
- constructor(container, fn) {
216
- super(container, NEEDS_COMPUTATION);
217
- __publicField(this, "$computeQrl$");
218
- __publicField(this, "$invalid$", true);
219
- this.$computeQrl$ = fn;
220
- }
221
- $invalidate$() {
222
- this.$invalid$ = true, this.$effects$?.length && this.$computeIfNeeded$() && triggerEffects(this.$container$, this, this.$effects$);
223
- }
224
- force() {
225
- this.$invalid$ = true, triggerEffects(this.$container$, this, this.$effects$);
226
- }
227
- get untrackedValue() {
228
- return this.$computeIfNeeded$(), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
229
- }
230
- $computeIfNeeded$() {
231
- if (!this.$invalid$) {
232
- return false;
233
- }
234
- const computeQrl = this.$computeQrl$;
235
- throwIfQRLNotResolved(computeQrl);
236
- const ctx = tryGetInvokeContext();
237
- const previousEffectSubscription = ctx?.$effectSubscriber$;
238
- ctx && (ctx.$effectSubscriber$ = [this, EffectProperty.VNODE]);
239
- try {
240
- const untrackedValue = computeQrl.getFn(ctx)();
241
- isPromise(untrackedValue) && throwErrorAndStop(`useComputedSignal$ QRL ${computeQrl.dev ? `${computeQrl.dev.file} ` : ""}${computeQrl.$hash$} returned a Promise`), this.$invalid$ = false;
242
- const didChange = untrackedValue !== this.$untrackedValue$;
243
- return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
244
- } finally {
245
- ctx && (ctx.$effectSubscriber$ = previousEffectSubscription);
246
- }
247
- }
248
- get value() {
249
- return super.value;
250
- }
251
- set value(_) {
252
- throwErrorAndStop("ComputedSignal is read-only");
253
- }
254
- }
255
- class WrappedSignal extends Signal {
256
- constructor(container, fn, args, fnStr) {
257
- super(container, NEEDS_COMPUTATION);
258
- __publicField(this, "$args$");
259
- __publicField(this, "$func$");
260
- __publicField(this, "$funcStr$");
261
- __publicField(this, "$invalid$", true);
262
- __publicField(this, "$effectDependencies$", null);
263
- this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr;
264
- }
265
- $invalidate$() {
266
- this.$invalid$ = true, this.$effects$?.length && this.$computeIfNeeded$() && triggerEffects(this.$container$, this, this.$effects$);
267
- }
268
- force() {
269
- this.$invalid$ = true, triggerEffects(this.$container$, this, this.$effects$);
270
- }
271
- get untrackedValue() {
272
- return this.$computeIfNeeded$(), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
273
- }
274
- $computeIfNeeded$() {
275
- if (!this.$invalid$) {
276
- return false;
277
- }
278
- const untrackedValue = trackSignal(() => this.$func$(...this.$args$), this, EffectProperty.VNODE, this.$container$);
279
- const didChange = untrackedValue !== this.$untrackedValue$;
280
- return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
281
- }
282
- get value() {
283
- return super.value;
284
- }
285
- set value(_) {
286
- throwErrorAndStop("WrappedSignal is read-only");
287
- }
288
- }
289
- var TaskFlags;
290
- !function(TaskFlags2) {
291
- TaskFlags2[TaskFlags2.VISIBLE_TASK = 1] = "VISIBLE_TASK", TaskFlags2[TaskFlags2.TASK = 2] = "TASK", TaskFlags2[TaskFlags2.RESOURCE = 4] = "RESOURCE", TaskFlags2[TaskFlags2.DIRTY = 8] = "DIRTY";
292
- }(TaskFlags || (TaskFlags = {}));
293
- class Task extends Subscriber {
294
- constructor($flags$, $index$, $el$, $qrl$, $state$, $destroy$) {
295
- super();
296
- __publicField(this, "$flags$");
297
- __publicField(this, "$index$");
298
- __publicField(this, "$el$");
299
- __publicField(this, "$qrl$");
300
- __publicField(this, "$state$");
301
- __publicField(this, "$destroy$");
302
- this.$flags$ = $flags$, this.$index$ = $index$, this.$el$ = $el$, this.$qrl$ = $qrl$, this.$state$ = $state$, this.$destroy$ = $destroy$;
303
- }
304
- }
305
- const isTask = (value) => value instanceof Task;
306
- const STORE_TARGET = Symbol("store.target");
307
- var StoreFlags;
308
- !function(StoreFlags2) {
309
- StoreFlags2[StoreFlags2.NONE = 0] = "NONE", StoreFlags2[StoreFlags2.RECURSIVE = 1] = "RECURSIVE", StoreFlags2[StoreFlags2.IMMUTABLE = 2] = "IMMUTABLE";
310
- }(StoreFlags || (StoreFlags = {}));
311
- const isStore = (value) => STORE_TARGET in value;
312
- var VNodeFlags;
313
- var VNodeFlagsIndex;
314
- var VNodeProps;
315
- var ElementVNodeProps;
316
- var TextVNodeProps;
317
- var VirtualVNodeProps;
318
- !function(VNodeFlags2) {
319
- VNodeFlags2[VNodeFlags2.Element = 1] = "Element", VNodeFlags2[VNodeFlags2.Virtual = 2] = "Virtual", VNodeFlags2[VNodeFlags2.ELEMENT_OR_VIRTUAL_MASK = 3] = "ELEMENT_OR_VIRTUAL_MASK", VNodeFlags2[VNodeFlags2.ELEMENT_OR_TEXT_MASK = 5] = "ELEMENT_OR_TEXT_MASK", VNodeFlags2[VNodeFlags2.TYPE_MASK = 7] = "TYPE_MASK", VNodeFlags2[VNodeFlags2.INFLATED_TYPE_MASK = 15] = "INFLATED_TYPE_MASK", VNodeFlags2[VNodeFlags2.Text = 4] = "Text", VNodeFlags2[VNodeFlags2.Inflated = 8] = "Inflated", VNodeFlags2[VNodeFlags2.Resolved = 16] = "Resolved", VNodeFlags2[VNodeFlags2.Deleted = 32] = "Deleted", VNodeFlags2[VNodeFlags2.NAMESPACE_MASK = 192] = "NAMESPACE_MASK", VNodeFlags2[VNodeFlags2.NEGATED_NAMESPACE_MASK = -193] = "NEGATED_NAMESPACE_MASK", VNodeFlags2[VNodeFlags2.NS_html = 0] = "NS_html", VNodeFlags2[VNodeFlags2.NS_svg = 64] = "NS_svg", VNodeFlags2[VNodeFlags2.NS_math = 128] = "NS_math";
320
- }(VNodeFlags || (VNodeFlags = {})), function(VNodeFlagsIndex2) {
321
- VNodeFlagsIndex2[VNodeFlagsIndex2.mask = -256] = "mask", VNodeFlagsIndex2[VNodeFlagsIndex2.negated_mask = 255] = "negated_mask", VNodeFlagsIndex2[VNodeFlagsIndex2.shift = 8] = "shift";
322
- }(VNodeFlagsIndex || (VNodeFlagsIndex = {})), function(VNodeProps2) {
323
- VNodeProps2[VNodeProps2.flags = 0] = "flags", VNodeProps2[VNodeProps2.parent = 1] = "parent", VNodeProps2[VNodeProps2.previousSibling = 2] = "previousSibling", VNodeProps2[VNodeProps2.nextSibling = 3] = "nextSibling";
324
- }(VNodeProps || (VNodeProps = {})), function(ElementVNodeProps2) {
325
- ElementVNodeProps2[ElementVNodeProps2.firstChild = 4] = "firstChild", ElementVNodeProps2[ElementVNodeProps2.lastChild = 5] = "lastChild", ElementVNodeProps2[ElementVNodeProps2.element = 6] = "element", ElementVNodeProps2[ElementVNodeProps2.elementName = 7] = "elementName", ElementVNodeProps2[ElementVNodeProps2.PROPS_OFFSET = 8] = "PROPS_OFFSET";
326
- }(ElementVNodeProps || (ElementVNodeProps = {})), function(TextVNodeProps2) {
327
- TextVNodeProps2[TextVNodeProps2.node = 4] = "node", TextVNodeProps2[TextVNodeProps2.text = 5] = "text";
328
- }(TextVNodeProps || (TextVNodeProps = {})), function(VirtualVNodeProps2) {
329
- VirtualVNodeProps2[VirtualVNodeProps2.firstChild = 4] = "firstChild", VirtualVNodeProps2[VirtualVNodeProps2.lastChild = 5] = "lastChild", VirtualVNodeProps2[VirtualVNodeProps2.PROPS_OFFSET = 6] = "PROPS_OFFSET";
330
- }(VirtualVNodeProps || (VirtualVNodeProps = {}));
331
- var SiblingsArray;
332
- var ChoreType;
333
- !function(SiblingsArray2) {
334
- SiblingsArray2[SiblingsArray2.Name = 0] = "Name", SiblingsArray2[SiblingsArray2.Key = 1] = "Key", SiblingsArray2[SiblingsArray2.VNode = 2] = "VNode", SiblingsArray2[SiblingsArray2.Size = 3] = "Size", SiblingsArray2[SiblingsArray2.NextVNode = 5] = "NextVNode";
335
- }(SiblingsArray || (SiblingsArray = {})), function(ChoreType2) {
336
- ChoreType2[ChoreType2.MACRO = 112] = "MACRO", ChoreType2[ChoreType2.MICRO = 15] = "MICRO", ChoreType2[ChoreType2.QRL_RESOLVE = 1] = "QRL_RESOLVE", ChoreType2[ChoreType2.RESOURCE = 2] = "RESOURCE", ChoreType2[ChoreType2.TASK = 3] = "TASK", ChoreType2[ChoreType2.NODE_DIFF = 4] = "NODE_DIFF", ChoreType2[ChoreType2.NODE_PROP = 5] = "NODE_PROP", ChoreType2[ChoreType2.COMPONENT_SSR = 6] = "COMPONENT_SSR", ChoreType2[ChoreType2.COMPONENT = 7] = "COMPONENT", ChoreType2[ChoreType2.WAIT_FOR_COMPONENTS = 16] = "WAIT_FOR_COMPONENTS", ChoreType2[ChoreType2.JOURNAL_FLUSH = 48] = "JOURNAL_FLUSH", ChoreType2[ChoreType2.VISIBLE = 64] = "VISIBLE", ChoreType2[ChoreType2.CLEANUP_VISIBLE = 80] = "CLEANUP_VISIBLE", ChoreType2[ChoreType2.WAIT_FOR_ALL = 127] = "WAIT_FOR_ALL";
337
- }(ChoreType || (ChoreType = {}));
338
- let _context;
339
- const tryGetInvokeContext = () => {
340
- if (!_context) {
341
- const context = "undefined" != typeof document && document && document.__q_context__;
342
- if (!context) {
343
- return;
344
- }
345
- return isArray(context) ? document.__q_context__ = newInvokeContextFromTuple(context) : context;
346
- }
347
- return _context;
348
- };
349
- function invoke(context, fn, ...args) {
350
- return invokeApply.call(this, context, fn, args);
351
- }
352
- function invokeApply(context, fn, args) {
353
- const previousContext = _context;
354
- let returnValue;
355
- try {
356
- _context = context, returnValue = fn.apply(this, args);
357
- } finally {
358
- _context = previousContext;
359
- }
360
- return returnValue;
361
- }
362
- const newInvokeContextFromTuple = ([element, event, url]) => {
363
- const container = element.closest(QContainerSelector);
364
- const locale = container?.getAttribute("q:locale") || void 0;
365
- return newInvokeContext(locale, void 0, element, event, url);
366
- };
367
- const newInvokeContext = (locale, hostElement, element, event, url) => {
368
- const ctx = {
369
- $url$: url,
370
- $i$: 0,
371
- $hostElement$: hostElement,
372
- $element$: element,
373
- $event$: event,
374
- $qrl$: void 0,
375
- $effectSubscriber$: void 0,
376
- $locale$: locale || ("object" == typeof event && event && "locale" in event ? event.locale : void 0),
377
- $container$: void 0
378
- };
379
- return ctx;
380
- };
381
- const untrack = (fn) => invoke(void 0, fn);
382
- const trackInvocation = /* @__PURE__ */ newInvokeContext(void 0, void 0, void 0, "qRender");
383
- const trackSignal = (fn, subscriber, property, container, data) => {
384
- const previousSubscriber = trackInvocation.$effectSubscriber$;
385
- const previousContainer = trackInvocation.$container$;
386
- try {
387
- return trackInvocation.$effectSubscriber$ = [subscriber, property], data && trackInvocation.$effectSubscriber$.push(data), trackInvocation.$container$ = container, invoke(trackInvocation, fn);
388
- } finally {
389
- trackInvocation.$effectSubscriber$ = previousSubscriber, trackInvocation.$container$ = previousContainer;
390
- }
391
- };
392
- const _CONST_PROPS = Symbol("CONST");
393
- const _VAR_PROPS = Symbol("VAR");
394
- const _jsxSorted = (type, varProps, constProps, children, flags, key) => {
395
- const processed = null == key ? null : String(key);
396
- const node = new JSXNodeImpl(type, varProps || {}, null, children, flags, processed);
397
- return node;
398
- };
399
- const _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
400
- let sortedProps;
401
- return sortedProps = varProps ? Object.fromEntries(untrack(() => Object.entries(varProps)).filter((entry) => {
402
- const attr = entry[0];
403
- return "children" === attr ? (children ?? (children = entry[1]), false) : "key" === attr ? (key = entry[1], false) : !constProps;
404
- }).sort(([a2], [b]) => a2 < b ? -1 : 1)) : EMPTY_OBJ, _jsxSorted(type, sortedProps, constProps, children, flags, key);
405
- };
406
- const jsx = (type, props, key) => _jsxSplit(type, props, null, null, 0, null);
407
- class JSXNodeImpl {
408
- constructor(type, varProps, constProps, children, flags, key = null) {
409
- __publicField(this, "type");
410
- __publicField(this, "varProps");
411
- __publicField(this, "constProps");
412
- __publicField(this, "children");
413
- __publicField(this, "flags");
414
- __publicField(this, "key");
415
- __publicField(this, "dev");
416
- __publicField(this, "_proxy", null);
417
- this.type = type, this.varProps = varProps, this.constProps = constProps, this.children = children, this.flags = flags, this.key = key;
418
- }
419
- get props() {
420
- return this._proxy || (this._proxy = createPropsProxy(this.varProps, this.constProps, this.children)), this._proxy;
421
- }
422
- }
423
- const isJSXNode = (n) => n instanceof JSXNodeImpl;
424
- function createPropsProxy(varProps, constProps, children) {
425
- return new Proxy({}, new PropsProxyHandler(varProps, constProps, children));
426
- }
427
- class PropsProxyHandler {
428
- constructor($varProps$, $constProps$, $children$) {
429
- __publicField(this, "$varProps$");
430
- __publicField(this, "$constProps$");
431
- __publicField(this, "$children$");
432
- this.$varProps$ = $varProps$, this.$constProps$ = $constProps$, this.$children$ = $children$;
433
- }
434
- get(_, prop) {
435
- if (prop === _CONST_PROPS) {
436
- return this.$constProps$;
437
- }
438
- if (prop === _VAR_PROPS) {
439
- return this.$varProps$;
440
- }
441
- if (null != this.$children$ && "children" === prop) {
442
- return this.$children$;
443
- }
444
- const value = this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] : this.$varProps$[prop];
445
- return value instanceof WrappedSignal ? value.value : value;
446
- }
447
- set(_, prop, value) {
448
- return prop === _CONST_PROPS ? (this.$constProps$ = value, true) : prop === _VAR_PROPS ? (this.$varProps$ = value, true) : (this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] = value : this.$varProps$[prop] = value, true);
449
- }
450
- deleteProperty(_, prop) {
451
- if ("string" != typeof prop) {
452
- return false;
453
- }
454
- let didDelete = delete this.$varProps$[prop];
455
- return this.$constProps$ && (didDelete = delete this.$constProps$[prop] || didDelete), null != this.$children$ && "children" === prop && (this.$children$ = null), didDelete;
456
- }
457
- has(_, prop) {
458
- return "children" === prop && null != this.$children$ || prop === _CONST_PROPS || prop === _VAR_PROPS || prop in this.$varProps$ || !!this.$constProps$ && prop in this.$constProps$;
459
- }
460
- getOwnPropertyDescriptor(target, p) {
461
- return {
462
- configurable: true,
463
- enumerable: true,
464
- value: "children" === p && null != this.$children$ ? this.$children$ : this.$constProps$ && p in this.$constProps$ ? this.$constProps$[p] : this.$varProps$[p]
465
- };
466
- }
467
- ownKeys() {
468
- const out = Object.keys(this.$varProps$);
469
- if (null != this.$children$ && -1 === out.indexOf("children") && out.push("children"), this.$constProps$) {
470
- for (const key in this.$constProps$) {
471
- -1 === out.indexOf(key) && out.push(key);
472
- }
473
- }
474
- return out;
475
- }
476
- }
477
- const stringifyPath = [];
478
- function qwikDebugToString(value) {
479
- if (null === value) {
480
- return "null";
481
- }
482
- if (void 0 === value) {
483
- return "undefined";
484
- }
485
- if ("string" == typeof value) {
486
- return '"' + value + '"';
487
- }
488
- if ("number" == typeof value || "boolean" == typeof value) {
489
- return String(value);
490
- }
491
- if (isTask(value)) {
492
- return `Task(${qwikDebugToString(value.$qrl$)})`;
493
- }
494
- if (isQrl$1(value)) {
495
- return `Qrl(${value.$symbol$})`;
496
- }
497
- if ("object" == typeof value || "function" == typeof value) {
498
- if (stringifyPath.includes(value)) {
499
- return "*";
500
- }
501
- try {
502
- if (stringifyPath.push(value), Array.isArray(value)) {
503
- return vnode_isVNode(value) ? "(" + vnode_getProp(value, "q:type", null) + ")" : value.map(qwikDebugToString);
504
- }
505
- if (isSignal(value)) {
506
- return value instanceof WrappedSignal ? "WrappedSignal" : value instanceof ComputedSignal ? "ComputedSignal" : "Signal";
507
- }
508
- if (isStore(value)) {
509
- return "Store";
510
- }
511
- if (isJSXNode(value)) {
512
- return jsxToString(value);
513
- }
514
- } finally {
515
- stringifyPath.pop();
516
- }
517
- }
518
- return value;
519
- }
520
- const pad = (text, prefix) => String(text).split("\n").map((line, idx) => (idx ? prefix : "") + line).join("\n");
521
- const jsxToString = (value) => {
522
- if (isJSXNode(value)) {
523
- let type = value.type;
524
- "function" == typeof type && (type = type.name || "Component");
525
- let str = "<" + value.type;
526
- if (value.props) {
527
- for (const [key, val] of Object.entries(value.props)) {
528
- str += " " + key + "=" + qwikDebugToString(val);
529
- }
530
- const children = value.children;
531
- null != children ? (str += ">", Array.isArray(children) ? children.forEach((child) => {
532
- str += jsxToString(child);
533
- }) : str += jsxToString(children), str += "</" + value.type + ">") : str += "/>";
534
- }
535
- return str;
536
- }
537
- return String(value);
538
- };
539
- var VNodeJournalOpCode;
540
- !function(VNodeJournalOpCode2) {
541
- VNodeJournalOpCode2[VNodeJournalOpCode2.SetText = 1] = "SetText", VNodeJournalOpCode2[VNodeJournalOpCode2.SetAttribute = 2] = "SetAttribute", VNodeJournalOpCode2[VNodeJournalOpCode2.HoistStyles = 3] = "HoistStyles", VNodeJournalOpCode2[VNodeJournalOpCode2.Remove = 4] = "Remove", VNodeJournalOpCode2[VNodeJournalOpCode2.Insert = 5] = "Insert";
542
- }(VNodeJournalOpCode || (VNodeJournalOpCode = {}));
543
- const vnode_isVNode = (vNode) => vNode instanceof VNodeArray;
544
- const vnode_isVirtualVNode = (vNode) => {
545
- return (vNode[VNodeProps.flags] & VNodeFlags.Virtual) === VNodeFlags.Virtual;
546
- };
547
- const ensureElementOrVirtualVNode = (vNode) => {
548
- assertTrue(!!(vNode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK), "Expecting ElementVNode or VirtualVNode was: " + vnode_getNodeTypeName(vNode));
549
- };
550
- const vnode_getNodeTypeName = (vNode) => {
551
- if (vNode) {
552
- switch (vNode[VNodeProps.flags] & VNodeFlags.TYPE_MASK) {
553
- case VNodeFlags.Element:
554
- return "Element";
555
- case VNodeFlags.Virtual:
556
- return "Virtual";
557
- case VNodeFlags.Text:
558
- return "Text";
559
- }
560
- }
561
- return "<unknown>";
562
- };
563
- const vnode_ensureElementInflated = (vnode) => {
564
- if ((vnode[VNodeProps.flags] & VNodeFlags.INFLATED_TYPE_MASK) === VNodeFlags.Element) {
565
- const elementVNode = vnode;
566
- elementVNode[VNodeProps.flags] ^= VNodeFlags.Inflated;
567
- const element = elementVNode[ElementVNodeProps.element];
568
- const attributes = element.attributes;
569
- for (let idx = 0; idx < attributes.length; idx++) {
570
- const attr = attributes[idx];
571
- const key = attr.name;
572
- if (":" === key || !key) {
573
- break;
574
- }
575
- if (key.startsWith("q:container")) {
576
- attr.value === QContainerValue.HTML ? mapArray_set(elementVNode, dangerouslySetInnerHTML, element.innerHTML, ElementVNodeProps.PROPS_OFFSET) : attr.value === QContainerValue.TEXT && "value" in element && mapArray_set(elementVNode, "value", element.value, ElementVNodeProps.PROPS_OFFSET);
577
- } else if (!key.startsWith("on:")) {
578
- mapArray_set(elementVNode, key, attr.value, ElementVNodeProps.PROPS_OFFSET);
579
- }
580
- }
581
- }
582
- };
583
- const mapApp_findIndx = (elementVNode, key, start) => {
584
- let bottom = start >> 1;
585
- let top = elementVNode.length - 2 >> 1;
586
- for (; bottom <= top; ) {
587
- const mid = bottom + (top - bottom >> 1);
588
- const midKey = elementVNode[mid << 1];
589
- if (midKey === key) {
590
- return mid << 1;
591
- }
592
- midKey < key ? bottom = mid + 1 : top = mid - 1;
593
- }
594
- return ~(bottom << 1);
595
- };
596
- const mapArray_set = (elementVNode, key, value, start) => {
597
- const indx = mapApp_findIndx(elementVNode, key, start);
598
- indx >= 0 ? null == value ? elementVNode.splice(indx, 2) : elementVNode[indx + 1] = value : null != value && elementVNode.splice(~indx, 0, key, value);
599
- };
600
- const vnode_getProp = (vnode, key, getObject) => {
601
- const type = vnode[VNodeProps.flags];
602
- if (type & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
603
- type & VNodeFlags.Element && vnode_ensureElementInflated(vnode);
604
- const idx = mapApp_findIndx(vnode, key, vnode_getPropStartIndex(vnode));
605
- if (idx >= 0) {
606
- let value = vnode[idx + 1];
607
- return "string" == typeof value && getObject && (vnode[idx + 1] = value = getObject(value)), value;
608
- }
609
- }
610
- return null;
611
- };
612
- const vnode_setProp = (vnode, key, value) => {
613
- ensureElementOrVirtualVNode(vnode);
614
- const idx = mapApp_findIndx(vnode, key, vnode_getPropStartIndex(vnode));
615
- idx >= 0 ? vnode[idx + 1] = value : null != value && vnode.splice(~idx, 0, key, value);
616
- };
617
- const vnode_getPropStartIndex = (vnode) => {
618
- const type = vnode[VNodeProps.flags] & VNodeFlags.TYPE_MASK;
619
- if (type === VNodeFlags.Element) {
620
- return ElementVNodeProps.PROPS_OFFSET;
621
- }
622
- if (type === VNodeFlags.Virtual) {
623
- return VirtualVNodeProps.PROPS_OFFSET;
624
- }
625
- throw throwErrorAndStop("Invalid vnode type.");
626
- };
627
- const VNodeArray = class VNode extends Array {
628
- static createElement(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName) {
629
- const vnode = new VNode(flags, parent, previousSibling, nextSibling);
630
- return vnode.push(firstChild, lastChild, element, elementName), vnode;
631
- }
632
- static createText(flags, parent, previousSibling, nextSibling, textNode, text) {
633
- const vnode = new VNode(flags, parent, previousSibling, nextSibling);
634
- return vnode.push(textNode, text), vnode;
635
- }
636
- static createVirtual(flags, parent, previousSibling, nextSibling, firstChild, lastChild) {
637
- const vnode = new VNode(flags, parent, previousSibling, nextSibling);
638
- return vnode.push(firstChild, lastChild), vnode;
639
- }
640
- constructor(flags, parent, previousSibling, nextSibling) {
641
- super(), this.push(flags, parent, previousSibling, nextSibling);
642
- }
643
- };
644
- var ExperimentalFeatures;
645
- var VNodeDataFlag;
646
- !function(ExperimentalFeatures2) {
647
- ExperimentalFeatures2.preventNavigate = "preventNavigate", ExperimentalFeatures2.valibot = "valibot", ExperimentalFeatures2.noSPA = "noSPA", ExperimentalFeatures2.webWorker = "webWorker", ExperimentalFeatures2.insights = "insights";
648
- }(ExperimentalFeatures || (ExperimentalFeatures = {})), function(VNodeDataFlag2) {
649
- VNodeDataFlag2[VNodeDataFlag2.NONE = 0] = "NONE", VNodeDataFlag2[VNodeDataFlag2.TEXT_DATA = 1] = "TEXT_DATA", VNodeDataFlag2[VNodeDataFlag2.VIRTUAL_NODE = 2] = "VIRTUAL_NODE", VNodeDataFlag2[VNodeDataFlag2.REFERENCE = 4] = "REFERENCE", VNodeDataFlag2[VNodeDataFlag2.SERIALIZE = 8] = "SERIALIZE";
650
- }(VNodeDataFlag || (VNodeDataFlag = {}));
651
- var TypeIds;
652
- var Constants;
653
- !function(TypeIds2) {
654
- TypeIds2[TypeIds2.RootRef = 0] = "RootRef", TypeIds2[TypeIds2.Constant = 1] = "Constant", TypeIds2[TypeIds2.Number = 2] = "Number", TypeIds2[TypeIds2.String = 3] = "String", TypeIds2[TypeIds2.Array = 4] = "Array", TypeIds2[TypeIds2.URL = 5] = "URL", TypeIds2[TypeIds2.Date = 6] = "Date", TypeIds2[TypeIds2.Regex = 7] = "Regex", TypeIds2[TypeIds2.VNode = 8] = "VNode", TypeIds2[TypeIds2.RefVNode = 9] = "RefVNode", TypeIds2[TypeIds2.BigInt = 10] = "BigInt", TypeIds2[TypeIds2.URLSearchParams = 11] = "URLSearchParams", TypeIds2[TypeIds2.Error = 12] = "Error", TypeIds2[TypeIds2.Object = 13] = "Object", TypeIds2[TypeIds2.Promise = 14] = "Promise", TypeIds2[TypeIds2.Set = 15] = "Set", TypeIds2[TypeIds2.Map = 16] = "Map", TypeIds2[TypeIds2.Uint8Array = 17] = "Uint8Array", TypeIds2[TypeIds2.QRL = 18] = "QRL", TypeIds2[TypeIds2.Task = 19] = "Task", TypeIds2[TypeIds2.Resource = 20] = "Resource", TypeIds2[TypeIds2.Component = 21] = "Component", TypeIds2[TypeIds2.Signal = 22] = "Signal", TypeIds2[TypeIds2.WrappedSignal = 23] = "WrappedSignal", TypeIds2[TypeIds2.ComputedSignal = 24] = "ComputedSignal", TypeIds2[TypeIds2.Store = 25] = "Store", TypeIds2[TypeIds2.StoreArray = 26] = "StoreArray", TypeIds2[TypeIds2.FormData = 27] = "FormData", TypeIds2[TypeIds2.JSXNode = 28] = "JSXNode", TypeIds2[TypeIds2.PropsProxy = 29] = "PropsProxy", TypeIds2[TypeIds2.EffectData = 30] = "EffectData";
655
- }(TypeIds || (TypeIds = {})), function(Constants2) {
656
- Constants2[Constants2.Undefined = 0] = "Undefined", Constants2[Constants2.Null = 1] = "Null", Constants2[Constants2.True = 2] = "True", Constants2[Constants2.False = 3] = "False", Constants2[Constants2.EmptyString = 4] = "EmptyString", Constants2[Constants2.EMPTY_ARRAY = 5] = "EMPTY_ARRAY", Constants2[Constants2.EMPTY_OBJ = 6] = "EMPTY_OBJ", Constants2[Constants2.NEEDS_COMPUTATION = 7] = "NEEDS_COMPUTATION", Constants2[Constants2.Slot = 8] = "Slot", Constants2[Constants2.Fragment = 9] = "Fragment", Constants2[Constants2.NaN = 10] = "NaN", Constants2[Constants2.PositiveInfinity = 11] = "PositiveInfinity", Constants2[Constants2.NegativeInfinity = 12] = "NegativeInfinity", Constants2[Constants2.MaxSafeInt = 13] = "MaxSafeInt", Constants2[Constants2.AlmostMaxSafeInt = 14] = "AlmostMaxSafeInt", Constants2[Constants2.MinSafeInt = 15] = "MinSafeInt";
657
- }(Constants || (Constants = {}));
658
- const insightsPing = core.sync$(
659
- () => ((window2, document2, location2, navigator2, performance2, round, JSON_stringify) => {
660
- var publicApiKey = __QI_KEY__, postUrl = __QI_URL__, getAttribute_s = "getAttribute", querySelector_s = "querySelector", manifest_s = "manifest", manifest_hash_s = `${manifest_s}-hash`, manifestHash_s = `${manifest_s}Hash`, version_s = "version", publicApiKey_s = "publicApiKey", sendBeacon_s = "sendBeacon", symbol_s = "symbol", length_s = "length", addEventListener_s = "addEventListener", route_s = "route", error_s = "error", stack_s = "stack", message_s = "message", symbols_s = `${symbol_s}s`, qVersion = document2[querySelector_s](`[q\\:${version_s}]`)?.[getAttribute_s](`q:${version_s}`) || "unknown", manifestHash = document2[querySelector_s](`[q\\:${manifest_hash_s}]`)?.[getAttribute_s](
661
- `q:${manifest_hash_s}`
662
- ) || "dev", qSymbols = [], existingSymbols = /* @__PURE__ */ new Set(), flushSymbolIndex = 0, lastReqTime = 0, timeoutID, qRouteChangeTime = performance2.now(), qRouteEl = document2[querySelector_s](`[q\\:${route_s}]`), flush = () => {
663
- timeoutID = void 0;
664
- if (qSymbols[length_s] > flushSymbolIndex) {
665
- var payload = {
666
- qVersion,
667
- [publicApiKey_s]: publicApiKey,
668
- [manifestHash_s]: manifestHash,
669
- previousSymbol: flushSymbolIndex == 0 ? void 0 : qSymbols[flushSymbolIndex - 1][symbol_s],
670
- [symbols_s]: qSymbols.slice(flushSymbolIndex)
671
- };
672
- navigator2[sendBeacon_s](postUrl, JSON_stringify(payload));
673
- flushSymbolIndex = qSymbols[length_s];
674
- }
675
- }, debounceFlush = () => {
676
- timeoutID != void 0 && clearTimeout(timeoutID);
677
- timeoutID = setTimeout(flush, 1e3);
678
- };
679
- window2.qSymbolTracker = {
680
- [symbols_s]: qSymbols,
681
- [publicApiKey_s]: publicApiKey
682
- };
683
- if (qRouteEl) {
684
- new MutationObserver((mutations) => {
685
- var mutation = mutations.find((m) => m.attributeName === `q:${route_s}`);
686
- if (mutation) {
687
- qRouteChangeTime = performance2.now();
688
- }
689
- }).observe(qRouteEl, { attributes: true });
690
- }
691
- document2[addEventListener_s](
692
- "visibilitychange",
693
- () => document2.visibilityState === "hidden" && flush()
694
- );
695
- document2[addEventListener_s](`q${symbol_s}`, (_event) => {
696
- var event = _event, detail = event.detail, symbolRequestTime = detail.reqTime, symbolDeliveredTime = event.timeStamp, symbol = detail[symbol_s];
697
- if (!existingSymbols.has(symbol)) {
698
- existingSymbols.add(symbol);
699
- var route = qRouteEl?.[getAttribute_s](`q:${route_s}`) || "/";
700
- qSymbols.push({
701
- [symbol_s]: symbol,
702
- [route_s]: route,
703
- delay: round(0 - lastReqTime + symbolRequestTime),
704
- latency: round(symbolDeliveredTime - symbolRequestTime),
705
- timeline: round(0 - qRouteChangeTime + symbolRequestTime),
706
- interaction: !!detail.element
707
- });
708
- lastReqTime = symbolDeliveredTime;
709
- debounceFlush();
710
- }
711
- });
712
- window2[addEventListener_s](error_s, (event) => {
713
- var error = event[error_s];
714
- if (!(error && typeof error === "object")) {
715
- return;
716
- }
717
- var payload = {
718
- url: `${location2}`,
719
- [manifestHash_s]: manifestHash,
720
- timestamp: (/* @__PURE__ */ new Date()).getTime(),
721
- source: event.filename,
722
- line: event.lineno,
723
- column: event.colno,
724
- [message_s]: event[message_s],
725
- [error_s]: message_s in error ? error[message_s] : `${error}`,
726
- [stack_s]: stack_s in error ? error[stack_s] || "" : ""
727
- };
728
- navigator2[sendBeacon_s](`${postUrl}${error_s}/`, JSON_stringify(payload));
729
- });
730
- })(window, document, location, navigator, performance, Math.round, JSON.stringify)
731
- );
732
- const Insights = core.component$(
733
- ({ publicApiKey, postUrl }) => {
734
- if (!__EXPERIMENTAL__.insights) {
735
- throw new Error(
736
- 'Insights is experimental and must be enabled with `experimental: ["insights"]` in the `qwikVite` plugin.'
737
- );
738
- }
739
- if (!publicApiKey) {
740
- return null;
741
- }
742
- return (
743
- // the script will set the variables before the qinit event
744
- /* @__PURE__ */ jsx("script", {
745
- "document:onQInit$": insightsPing,
746
- dangerouslySetInnerHTML: `__QI_KEY__=${JSON.stringify(publicApiKey)};__QI_URL__=${JSON.stringify(postUrl || `https://insights.qwik.dev/api/v1/${publicApiKey}/post/`)}`
747
- })
748
- );
749
- }
750
- );
751
- exports.Insights = Insights;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@qwik.dev/core"),L=require("@qwik.dev/core/jsx-runtime"),T=g.sync$(()=>((r,i,w,_,b,l,y)=>{var h=__QI_KEY__,d=__QI_URL__,E=i.querySelector("[q\\:version]")?.getAttribute("q:version")||"unknown",f=i.querySelector("[q\\:manifest-hash]")?.getAttribute("q:manifest-hash")||"dev",s=[],q=new Set,o=0,v=0,a,p=b.now(),m=i.querySelector("[q\\:route]"),I=()=>{if(a=void 0,s.length>o){var t={qVersion:E,publicApiKey:h,manifestHash:f,previousSymbol:o==0?void 0:s[o-1].symbol,symbols:s.slice(o)};_.sendBeacon(d,y(t)),o=s.length}},k=()=>{a!=null&&clearTimeout(a),a=setTimeout(I,1e3)};r.qSymbolTracker={symbols:s,publicApiKey:h},m&&new MutationObserver(t=>{var e=t.find(n=>n.attributeName==="q:route");e&&(p=b.now())}).observe(m,{attributes:!0}),i.addEventListener("visibilitychange",()=>i.visibilityState==="hidden"&&I()),i.addEventListener("qsymbol",t=>{var e=t,n=e.detail,u=n.reqTime,S=e.timeStamp,c=n.symbol;if(!q.has(c)){q.add(c);var R=m?.getAttribute("q:route")||"/";s.push({symbol:c,route:R,delay:l(0-v+u),latency:l(S-u),timeline:l(0-p+u),interaction:!!n.element}),v=S,k()}}),r.addEventListener("error",t=>{var e=t.error;if(e&&typeof e=="object"){var n={url:`${w}`,manifestHash:f,timestamp:new Date().getTime(),source:t.filename,line:t.lineno,column:t.colno,message:t.message,error:"message"in e?e.message:`${e}`,stack:"stack"in e&&e.stack||""};_.sendBeacon(`${d}error/`,y(n))}})})(window,document,location,navigator,performance,Math.round,JSON.stringify)),$=g.component$(()=>{if(!__EXPERIMENTAL__.insights)throw new Error('Insights is experimental and must be enabled with `experimental: ["insights"]` in the `qwikVite` plugin.');const r=globalThis.__QI_KEY__,i=globalThis.__QI_URL__;return!r||!i?(g.isDev||console.warn("<Insights />: no config from qwikInsights plugin, skipping..."),null):L.jsx("script",{"document:onQInit$":T,dangerouslySetInnerHTML:`__QI_KEY__=${JSON.stringify(r)};__QI_URL__=${JSON.stringify(i)}`})});exports.Insights=$;exports.insightsPing=T;