@qwik.dev/core
Version:
An open source framework for building instant loading web apps at any scale, without the extra effort.
1,700 lines (1,671 loc) • 101 kB
JavaScript
/**
* @license
* @qwik.dev/core/server 2.0.0-alpha.9-dev+56ed5bd
* Copyright QwikDev. All Rights Reserved.
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
*/
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
// packages/qwik/src/server/index.ts
import { setPlatform as setPlatform2 } from "@qwik.dev/core";
// packages/qwik/src/server/platform.ts
import { setPlatform } from "@qwik.dev/core";
// packages/qwik/src/core/shared/utils/qdev.ts
var qDev = globalThis.qDev !== false;
var qInspector = globalThis.qInspector === true;
var qSerialize = globalThis.qSerialize !== false;
var qDynamicPlatform = globalThis.qDynamicPlatform !== false;
var qTest = globalThis.qTest === true;
var qRuntimeQrl = globalThis.qRuntimeQrl === true;
// packages/qwik/src/core/shared/utils/log.ts
var STYLE = qDev ? `background: #564CE0; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;` : "";
var throwErrorAndStop = (message, ...optionalParams) => {
const error = createAndLogError(false, message, ...optionalParams);
debugger;
throw error;
};
var logErrorAndStop = (message, ...optionalParams) => {
const err = createAndLogError(true, message, ...optionalParams);
debugger;
return err;
};
var createAndLogError = (asyncThrow, message, ...optionalParams) => {
const err = message instanceof Error ? message : new Error(message);
!qTest && console.error("%cQWIK ERROR", STYLE, err.message, ...optionalParams, err.stack);
asyncThrow && !qTest && setTimeout(() => {
throw err;
}, 0);
return err;
};
// packages/qwik/src/core/shared/error/assert.ts
var ASSERT_DISCLAIMER = "Internal assert, this is likely caused by a bug in Qwik: ";
function assertTrue(value1, text, ...parts) {
if (qDev) {
if (value1 === true) {
return;
}
throwErrorAndStop(ASSERT_DISCLAIMER + text, ...parts);
}
}
// packages/qwik/src/core/client/util-mapArray.ts
var mapApp_findIndx = (array, key, start) => {
assertTrue(start % 2 === 0, "Expecting even number.");
let bottom = start >> 1;
let top = array.length - 2 >> 1;
while (bottom <= top) {
const mid = bottom + (top - bottom >> 1);
const midKey = array[mid << 1];
if (midKey === key) {
return mid << 1;
}
if (midKey < key) {
bottom = mid + 1;
} else {
top = mid - 1;
}
}
return bottom << 1 ^ -1;
};
var mapArray_set = (array, key, value, start) => {
const indx = mapApp_findIndx(array, key, start);
if (indx >= 0) {
if (value == null) {
array.splice(indx, 2);
} else {
array[indx + 1] = value;
}
} else if (value != null) {
array.splice(indx ^ -1, 0, key, value);
}
};
var mapApp_remove = (array, key, start) => {
const indx = mapApp_findIndx(array, key, start);
let value = null;
if (indx >= 0) {
value = array[indx + 1];
array.splice(indx, 2);
return value;
}
return value;
};
var mapArray_get = (array, key, start) => {
const indx = mapApp_findIndx(array, key, start);
if (indx >= 0) {
return array[indx + 1];
} else {
return null;
}
};
var mapArray_has = (array, key, start) => {
return mapApp_findIndx(array, key, start) >= 0;
};
// packages/qwik/src/core/shared/error/error.ts
var codeToText = (code, ...parts) => {
if (qDev) {
const MAP = [
"Error while serializing class or style attributes",
// 0
"Scheduler not found",
// 1
"track() received object, without prop to track",
// 2
"Only primitive and object literals can be serialized. {{0}}",
// 3
"",
// 4 unused
"You can render over a existing q:container. Skipping render().",
// 5
"",
// 6 unused
"",
// 7 unused
"",
// 8 unused
"",
// 9 unused
"QRL is not a function",
// 10
"Dynamic import not found",
// 11
"Unknown type argument",
// 12
`Actual value for useContext({{0}}) can not be found, make sure some ancestor component has set a value using useContextProvider(). In the browser make sure that the context was used during SSR so its state was serialized.`,
// 13
"Invoking 'use*()' method outside of invocation context.",
// 14
"",
// 15 unused
"",
// 16 unused
"",
// 17 unused
"",
// 18 unused
"",
// 19 unused
`Calling a 'use*()' method outside 'component$(() => { HERE })' is not allowed. 'use*()' methods provide hooks to the 'component$' state and lifecycle, ie 'use' hooks can only be called synchronously within the 'component$' function or another 'use' method.
See https://qwik.dev/docs/components/tasks/#use-method-rules`,
// 20
"",
// 21 unused
"",
// 22 unused
"",
// 23 unused
"",
// 24 unused
"",
// 25 unused
"",
// 26 unused
"",
// 27 unused
'The provided Context reference "{{0}}" is not a valid context created by createContextId()',
// 28
"SsrError(tag): {{0}}",
// 29
"QRLs can not be resolved because it does not have an attached container. This means that the QRL does not know where it belongs inside the DOM, so it cant dynamically import() from a relative path.",
// 30
"QRLs can not be dynamically resolved, because it does not have a chunk path",
// 31
"{{0}}\nThe JSX ref attribute must be a Signal",
// 32
"Serialization Error: Deserialization of data type {{0}} is not implemented",
// 33
"Serialization Error: Expected vnode for ref prop, but got {{0}}",
// 34
"Serialization Error: Cannot allocate data type {{0}}",
// 35
"Serialization Error: Missing root id for {{0}}",
// 36
"Serialization Error: Serialization of data type {{0}} is not implemented",
// 37
"Serialization Error: Unvisited {{0}}",
// 38
"Serialization Error: Missing QRL chunk for {{0}}",
// 39
"{{0}}\nThe value of the textarea must be a string found {{1}}",
// 40
"Unable to find q:container",
// 41
"Element must have 'q:container' attribute.",
// 42
"Unknown vnode type {{0}}.",
// 43
"Materialize error: missing element: {{0}} {{1}} {{2}}",
// 44
"Cannot coerce a Signal, use `.value` instead",
// 45
"useComputedSignal$ QRL {{0}} {{1}} returned a Promise",
// 46
"ComputedSignal is read-only",
// 47
"WrappedSignal is read-only",
// 48
"Attribute value is unsafe for SSR",
// 49
"SerializerSymbol function returned rejected promise"
// 50
];
let text = MAP[code] ?? "";
if (parts.length) {
text = text.replaceAll(/{{(\d+)}}/g, (_, index) => {
let v = parts[index];
if (v && typeof v === "object" && v.constructor === Object) {
v = JSON.stringify(v).slice(0, 50);
}
return v;
});
}
return `Code(Q${code}): ${text}`;
} else {
return `Code(Q${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`;
}
};
var qError = (code, errorMessageArgs = []) => {
const text = codeToText(code, ...errorMessageArgs);
return logErrorAndStop(text, ...errorMessageArgs);
};
// packages/qwik/src/core/shared/qrl/qrl-utils.ts
import { isDev } from "@qwik.dev/core/build";
var SYNC_QRL = "<sync>";
// packages/qwik/src/core/shared/types.ts
var DEBUG_TYPE = "q:type";
var START = "\x1B[34m";
var END = "\x1B[0m";
var VirtualTypeName = {
["V" /* Virtual */]: (
/* ********* */
START + "Virtual" + END
),
//
["F" /* Fragment */]: (
/* ******** */
START + "Fragment" + END
),
//
["S" /* WrappedSignal */]: (
/* *** */
START + "Signal" + END
),
//
["A" /* Awaited */]: (
/* ********* */
START + "Awaited" + END
),
//
["C" /* Component */]: (
/* ******* */
START + "Component" + END
),
//
["I" /* InlineComponent */]: (
/* * */
START + "InlineComponent" + END
),
//
["P" /* Projection */]: (
/* ****** */
START + "Projection" + END
)
//
};
// packages/qwik/src/core/shared/utils/character-escaping.ts
function escapeHTML(html) {
let escapedHTML = "";
const length = html.length;
let idx = 0;
let lastIdx = idx;
for (; idx < length; idx++) {
const ch = html.charCodeAt(idx);
if (ch === 60) {
escapedHTML += html.substring(lastIdx, idx) + "<";
} else if (ch === 62) {
escapedHTML += html.substring(lastIdx, idx) + ">";
} else if (ch === 38) {
escapedHTML += html.substring(lastIdx, idx) + "&";
} else if (ch === 34) {
escapedHTML += html.substring(lastIdx, idx) + """;
} else if (ch === 39) {
escapedHTML += html.substring(lastIdx, idx) + "'";
} else {
continue;
}
lastIdx = idx + 1;
}
if (lastIdx === 0) {
return html;
} else {
return escapedHTML + html.substring(lastIdx);
}
}
// packages/qwik/src/core/shared/utils/markers.ts
var OnRenderProp = "q:renderFn";
var QSlot = "q:slot";
var QSlotParent = "q:sparent";
var QStyle = "q:style";
var QStyleSelector = "style[q\\:style]";
var QStyleSSelector = "style[q\\:sstyle]";
var QStylesAllSelector = QStyleSelector + "," + QStyleSSelector;
var QScopedStyle = "q:sstyle";
var QCtxAttr = "q:ctx";
var QBackRefs = "q:brefs";
var QRenderAttr = "q:render";
var QRuntimeAttr = "q:runtime";
var QVersionAttr = "q:version";
var QBaseAttr = "q:base";
var QLocaleAttr = "q:locale";
var QManifestHashAttr = "q:manifest-hash";
var QInstanceAttr = "q:instance";
var QContainerIsland = "q:container-island";
var QContainerIslandEnd = "/" + QContainerIsland;
var QIgnore = "q:ignore";
var QIgnoreEnd = "/" + QIgnore;
var QContainerAttr = "q:container";
var QContainerAttrEnd = "/" + QContainerAttr;
var QTemplate = "q:template";
var QContainerSelector = "[q\\:container]:not([q\\:container=" + "html" /* HTML */ + "]):not([q\\:container=" + "text" /* TEXT */ + "])";
var QDefaultSlot = "";
var ELEMENT_ID = "q:id";
var ELEMENT_KEY = "q:key";
var ELEMENT_PROPS = "q:props";
var ELEMENT_SEQ = "q:seq";
var ELEMENT_SEQ_IDX = "q:seqIdx";
var NON_SERIALIZABLE_MARKER_PREFIX = ":";
var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
var USE_ON_LOCAL_SEQ_IDX = NON_SERIALIZABLE_MARKER_PREFIX + "onIdx";
var USE_ON_LOCAL_FLAGS = NON_SERIALIZABLE_MARKER_PREFIX + "onFlags";
var FLUSH_COMMENT = "qkssr-f";
var STREAM_BLOCK_START_COMMENT = "qkssr-pu";
var STREAM_BLOCK_END_COMMENT = "qkssr-po";
var Q_PROPS_SEPARATOR = ":";
var dangerouslySetInnerHTML = "dangerouslySetInnerHTML";
// packages/qwik/src/core/shared/utils/promises.ts
var isPromise = (value) => {
return !!value && typeof value == "object" && typeof value.then === "function";
};
var maybeThen = (valueOrPromise, thenFn) => {
return isPromise(valueOrPromise) ? valueOrPromise.then(thenFn, shouldNotError) : thenFn(valueOrPromise);
};
var shouldNotError = (reason) => {
throwErrorAndStop(reason);
};
// packages/qwik/src/core/shared/utils/scoped-styles.ts
function isClassAttr(key) {
return key === "class" || key === "className";
}
function convertStyleIdsToString(scopedStyleIds) {
return Array.from(scopedStyleIds).join(" ");
}
// packages/qwik/src/core/shared/utils/event-names.ts
function isPreventDefault(key) {
return key.startsWith("preventdefault:");
}
// packages/qwik/src/core/shared/utils/types.ts
var isArray = (v) => {
return Array.isArray(v);
};
var isString = (v) => {
return typeof v === "string";
};
// packages/qwik/src/core/shared/utils/unitless_number.ts
var unitlessNumbers = /* @__PURE__ */ new Set([
"animationIterationCount",
"aspectRatio",
"borderImageOutset",
"borderImageSlice",
"borderImageWidth",
"boxFlex",
"boxFlexGroup",
"boxOrdinalGroup",
"columnCount",
"columns",
"flex",
"flexGrow",
"flexShrink",
"gridArea",
"gridRow",
"gridRowEnd",
"gridRowStart",
"gridColumn",
"gridColumnEnd",
"gridColumnStart",
"fontWeight",
"lineClamp",
"lineHeight",
"opacity",
"order",
"orphans",
"scale",
"tabSize",
"widows",
"zIndex",
"zoom",
"MozAnimationIterationCount",
// Known Prefixed Properties
"MozBoxFlex",
// TODO: Remove these since they shouldn't be used in modern code
"msFlex",
"msFlexPositive",
"WebkitAnimationIterationCount",
"WebkitBoxFlex",
"WebkitBoxOrdinalGroup",
"WebkitColumnCount",
"WebkitColumns",
"WebkitFlex",
"WebkitFlexGrow",
"WebkitFlexShrink",
"WebkitLineClamp"
]);
var isUnitlessNumber = (name) => {
return unitlessNumbers.has(name);
};
// packages/qwik/src/core/shared/utils/styles.ts
var serializeClass = (obj) => {
if (!obj) {
return "";
}
if (isString(obj)) {
return obj.trim();
}
const classes = [];
if (isArray(obj)) {
for (const o of obj) {
const classList = serializeClass(o);
if (classList) {
classes.push(classList);
}
}
} else {
for (const [key, value] of Object.entries(obj)) {
if (value) {
classes.push(key.trim());
}
}
}
return classes.join(" ");
};
var fromCamelToKebabCaseWithDash = (text) => {
return text.replace(/([A-Z])/g, "-$1").toLowerCase();
};
var stringifyStyle = (obj) => {
if (obj == null) {
return "";
}
if (typeof obj == "object") {
if (isArray(obj)) {
throw qError(0 /* stringifyClassOrStyle */, [obj, "style"]);
} else {
const chunks = [];
for (const key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
const value = obj[key];
if (value != null && typeof value !== "function") {
if (key.startsWith("--")) {
chunks.push(key + ":" + value);
} else {
chunks.push(fromCamelToKebabCaseWithDash(key) + ":" + setValueForStyle(key, value));
}
}
}
}
return chunks.join(";");
}
}
return String(obj);
};
var serializeBooleanOrNumberAttribute = (value) => {
return value != null ? String(value) : null;
};
function serializeAttribute(key, value, styleScopedId) {
if (isClassAttr(key)) {
const serializedClass = serializeClass(value);
value = styleScopedId ? styleScopedId + (serializedClass.length ? " " + serializedClass : serializedClass) : serializedClass;
} else if (key === "style") {
value = stringifyStyle(value);
} else if (isEnumeratedBooleanAttribute(key) || typeof value === "number") {
value = serializeBooleanOrNumberAttribute(value);
} else if (value === false || value == null) {
value = null;
} else if (value === true && isPreventDefault(key)) {
value = "";
}
return value;
}
function isEnumeratedBooleanAttribute(key) {
return isAriaAttribute(key) || ["spellcheck", "draggable", "contenteditable"].includes(key);
}
var setValueForStyle = (styleName, value) => {
if (typeof value === "number" && value !== 0 && !isUnitlessNumber(styleName)) {
return value + "px";
}
return value;
};
function isAriaAttribute(prop) {
return prop.startsWith("aria-");
}
// packages/qwik/src/core/shared/vnode-data-types.ts
var VNodeDataSeparator = {
REFERENCE_CH: (
/* ***** */
`~`
),
// `~` is a reference to the node. Save it.
REFERENCE: (
/* ******** */
126
),
// `~` is a reference to the node. Save it.
ADVANCE_1_CH: (
/* ***** */
`!`
),
// `!` is vNodeData separator skipping 0. (ie next vNode)
ADVANCE_1: (
/* ********* */
33
),
// `!` is vNodeData separator skipping 0. (ie next vNode)
ADVANCE_2_CH: (
/* ***** */
`"`
),
// `"` is vNodeData separator skipping 1.
ADVANCE_2: (
/* ********* */
34
),
// `"` is vNodeData separator skipping 1.
ADVANCE_4_CH: (
/* ***** */
`#`
),
// `#` is vNodeData separator skipping 2.
ADVANCE_4: (
/* ********* */
35
),
// `#` is vNodeData separator skipping 2.
ADVANCE_8_CH: (
/* ***** */
`$`
),
// `$` is vNodeData separator skipping 4.
ADVANCE_8: (
/* ********* */
36
),
// `$` is vNodeData separator skipping 4.
ADVANCE_16_CH: (
/* **** */
`%`
),
// `%` is vNodeData separator skipping 8.
ADVANCE_16: (
/* ******** */
37
),
// `%` is vNodeData separator skipping 8.
ADVANCE_32_CH: (
/* **** */
`&`
),
// `&` is vNodeData separator skipping 16.
ADVANCE_32: (
/* ******** */
38
),
// `&` is vNodeData separator skipping 16.
ADVANCE_64_CH: (
/* **** */
`'`
),
// `'` is vNodeData separator skipping 32.
ADVANCE_64: (
/* ******** */
39
),
// `'` is vNodeData separator skipping 32.
ADVANCE_128_CH: (
/* *** */
`(`
),
// `(` is vNodeData separator skipping 64.
ADVANCE_128: (
/* ******* */
40
),
// `(` is vNodeData separator skipping 64.
ADVANCE_256_CH: (
/* *** */
`)`
),
// `)` is vNodeData separator skipping 128.
ADVANCE_256: (
/* ******* */
41
),
// `)` is vNodeData separator skipping 128.
ADVANCE_512_CH: (
/* *** */
`*`
),
// `*` is vNodeData separator skipping 256.
ADVANCE_512: (
/* ******* */
42
),
// `*` is vNodeData separator skipping 256.
ADVANCE_1024_CH: (
/* ** */
`+`
),
// `+` is vNodeData separator skipping 512.
ADVANCE_1024: (
/* ****** */
43
),
// `+` is vNodeData separator skipping 512.
ADVANCE_2048_CH: (
/* * */
","
),
// ',' is vNodeData separator skipping 1024.
ADVANCE_2048: (
/* ****** */
44
),
// ',' is vNodeData separator skipping 1024.
ADVANCE_4096_CH: (
/* * */
`-`
),
// `-` is vNodeData separator skipping 2048.
ADVANCE_4096: (
/* ****** */
45
),
// `-` is vNodeData separator skipping 2048.
ADVANCE_8192_CH: (
/* * */
`.`
),
// `.` is vNodeData separator skipping 4096.
ADVANCE_8192: (
/* ****** */
46
)
// `.` is vNodeData separator skipping 4096.
};
var VNodeDataChar = {
OPEN: (
/* ************** */
123
),
// `{` is the start of the VNodeData for a virtual element.
OPEN_CHAR: (
/* ****** */
"{"
),
CLOSE: (
/* ************* */
125
),
// `}` is the end of the VNodeData for a virtual element.
CLOSE_CHAR: (
/* ***** */
"}"
),
SCOPED_STYLE: (
/* ******* */
59
),
// `;` - `q:sstyle` - Style attribute.
SCOPED_STYLE_CHAR: (
/* */
";"
),
RENDER_FN: (
/* ********** */
60
),
// `<` - `q:renderFn' - Component QRL render function (body)
RENDER_FN_CHAR: (
/* ** */
"<"
),
ID: (
/* ***************** */
61
),
// `=` - `q:id` - ID of the element.
ID_CHAR: (
/* ********* */
"="
),
PROPS: (
/* ************** */
62
),
// `>` - `q:props' - Component Props
PROPS_CHAR: (
/* ****** */
">"
),
SLOT_PARENT: (
/* ******** */
63
),
// `?` - `q:sparent` - Slot parent.
SLOT_PARENT_CHAR: (
/* */
"?"
),
KEY: (
/* **************** */
64
),
// `@` - `q:key` - Element key.
KEY_CHAR: (
/* ******** */
"@"
),
SEQ: (
/* **************** */
91
),
// `[` - `q:seq' - Seq value from `useSequentialScope()`
SEQ_CHAR: (
/* ******** */
"["
),
DON_T_USE: (
/* ********** */
92
),
// `\` - SKIP because `\` is used as escaping
DON_T_USE_CHAR: "\\",
CONTEXT: (
/* ************ */
93
),
// `]` - `q:ctx' - Component context/props
CONTEXT_CHAR: (
/* **** */
"]"
),
SEQ_IDX: (
/* ************ */
94
),
// `^` - `q:seqIdx' - Sequential scope id
SEQ_IDX_CHAR: (
/* **** */
"^"
),
BACK_REFS: (
/* ********** */
96
),
// '`' - `q:brefs' - Effect dependencies/subscriptions
BACK_REFS_CHAR: (
/* ** */
"`"
),
SEPARATOR: (
/* ********* */
124
),
// `|` - Separator char to encode any key/value pairs.
SEPARATOR_CHAR: (
/* ** */
"|"
),
SLOT: (
/* ************** */
126
),
// `~` - `q:slot' - Slot name
SLOT_CHAR: (
/* ******* */
"~"
)
};
// packages/qwik/src/optimizer/src/manifest.ts
function getValidManifest(manifest) {
if (manifest != null && manifest.mapping != null && typeof manifest.mapping === "object" && manifest.symbols != null && typeof manifest.symbols === "object" && manifest.bundles != null && typeof manifest.bundles === "object") {
return manifest;
}
return void 0;
}
// packages/qwik/src/server/platform.ts
function createPlatform(opts, resolvedManifest) {
const mapper = resolvedManifest?.mapper;
const mapperFn = opts.symbolMapper ? opts.symbolMapper : (symbolName, _chunk, parent) => {
if (mapper) {
const hash2 = getSymbolHash(symbolName);
const result = mapper[hash2];
if (!result) {
if (hash2 === SYNC_QRL) {
return [hash2, ""];
}
const isRegistered = globalThis.__qwik_reg_symbols?.has(hash2);
if (isRegistered) {
return [symbolName, "_"];
}
if (parent) {
return [symbolName, `${parent}?qrl=${symbolName}`];
}
console.error("Cannot resolve symbol", symbolName, "in", mapper, parent);
}
return result;
}
};
const serverPlatform = {
isServer: true,
async importSymbol(_containerEl, url, symbolName) {
const hash2 = getSymbolHash(symbolName);
const regSym = globalThis.__qwik_reg_symbols?.get(hash2);
if (regSym) {
return regSym;
}
let modulePath = String(url);
if (!modulePath.endsWith(".js")) {
modulePath += ".js";
}
const module = __require(modulePath);
if (!(symbolName in module)) {
throw new Error(`Q-ERROR: missing symbol '${symbolName}' in module '${modulePath}'.`);
}
return module[symbolName];
},
raf: () => {
console.error("server can not rerender");
return Promise.resolve();
},
nextTick: (fn) => {
return new Promise((resolve) => {
setTimeout(() => {
resolve(fn());
});
});
},
chunkForSymbol(symbolName, _chunk, parent) {
return mapperFn(symbolName, mapper, parent);
}
};
return serverPlatform;
}
async function setServerPlatform(opts, manifest) {
const platform = createPlatform(opts, manifest);
setPlatform(platform);
}
var getSymbolHash = (symbolName) => {
const index = symbolName.lastIndexOf("_");
if (index > -1) {
return symbolName.slice(index + 1);
}
return symbolName;
};
// packages/qwik/src/server/utils.ts
function createTimer() {
if (typeof performance === "undefined") {
return () => 0;
}
const start = performance.now();
return () => {
const end = performance.now();
const delta = end - start;
return delta / 1e6;
};
}
function getBuildBase(opts) {
let base = opts.base;
if (typeof opts.base === "function") {
base = opts.base(opts);
}
if (typeof base === "string") {
if (!base.endsWith("/")) {
base += "/";
}
return base;
}
return `${import.meta.env.BASE_URL}build/`;
}
var versions = {
qwik: "2.0.0-alpha.9-dev+56ed5bd",
qwikDom: "2.1.19"
};
// packages/qwik/src/server/ssr-container.ts
import {
_EffectData as EffectData,
_SharedContainer,
_jsxSorted,
_jsxSplit,
_walkJSX,
isSignal
} from "@qwik.dev/core";
import { isDev as isDev4 } from "@qwik.dev/core/build";
// packages/qwik/src/server/prefetch-utils.ts
function workerFetchScript() {
const fetch = `Promise.all(e.data.map(u=>fetch(u))).finally(()=>{setTimeout(postMessage({}),9999)})`;
const workerBody = `onmessage=(e)=>{${fetch}}`;
const blob = `new Blob(['${workerBody}'],{type:"text/javascript"})`;
const url = `URL.createObjectURL(${blob})`;
let s = `const w=new Worker(${url});`;
s += `w.postMessage(u.map(u=>new URL(u,origin)+''));`;
s += `w.onmessage=()=>{w.terminate()};`;
return s;
}
function prefetchUrlsEventScript(base, prefetchResources) {
const data = {
bundles: flattenPrefetchResources(prefetchResources).map((u) => u.split("/").pop())
};
const args = JSON.stringify(["prefetch", base, ...data.bundles]);
return `document.dispatchEvent(new CustomEvent("qprefetch",{detail:${JSON.stringify(data)}}));
(window.qwikPrefetchSW||(window.qwikPrefetchSW=[])).push(${args});`;
}
function flattenPrefetchResources(prefetchResources) {
const urls = [];
const addPrefetchResource = (prefetchResources2) => {
if (Array.isArray(prefetchResources2)) {
for (const prefetchResource of prefetchResources2) {
if (!urls.includes(prefetchResource.url)) {
urls.push(prefetchResource.url);
addPrefetchResource(prefetchResource.imports);
}
}
}
};
addPrefetchResource(prefetchResources);
return urls;
}
function getMostReferenced(prefetchResources) {
const common = /* @__PURE__ */ new Map();
let total = 0;
const addPrefetchResource = (prefetchResources2, visited2) => {
if (Array.isArray(prefetchResources2)) {
for (const prefetchResource of prefetchResources2) {
const count = common.get(prefetchResource.url) || 0;
common.set(prefetchResource.url, count + 1);
total++;
if (!visited2.has(prefetchResource.url)) {
visited2.add(prefetchResource.url);
addPrefetchResource(prefetchResource.imports, visited2);
}
}
}
};
const visited = /* @__PURE__ */ new Set();
for (const resource of prefetchResources) {
visited.clear();
addPrefetchResource(resource.imports, visited);
}
const threshold = total / common.size * 2;
const urls = Array.from(common.entries());
urls.sort((a, b) => b[1] - a[1]);
return urls.slice(0, 5).filter((e) => e[1] > threshold).map((e) => e[0]);
}
// packages/qwik/src/server/prefetch-implementation.ts
function applyPrefetchImplementation2(container, prefetchStrategy, prefetchResources, nonce) {
const prefetchImpl = normalizePrefetchImplementation(prefetchStrategy?.implementation);
if (prefetchImpl.prefetchEvent === "always") {
prefetchUrlsEvent2(container, prefetchResources, nonce);
}
if (prefetchImpl.linkInsert === "html-append") {
linkHtmlImplementation2(container, prefetchResources, prefetchImpl);
}
if (prefetchImpl.linkInsert === "js-append") {
linkJsImplementation2(container, prefetchResources, prefetchImpl, nonce);
} else if (prefetchImpl.workerFetchInsert === "always") {
workerFetchImplementation2(container, prefetchResources, nonce);
}
}
function prefetchUrlsEvent2(container, prefetchResources, nonce) {
const mostReferenced = getMostReferenced(prefetchResources);
for (const url of mostReferenced) {
const attrs = ["rel", "modulepreload", "href", url];
if (nonce) {
attrs.push("nonce", nonce);
}
container.openElement("link", null, attrs);
container.closeElement();
}
const scriptAttrs = ["q:type", "prefetch-bundles"];
if (nonce) {
scriptAttrs.push("nonce", nonce);
}
container.openElement("script", null, scriptAttrs);
container.writer.write(prefetchUrlsEventScript(container.$buildBase$ || "", prefetchResources));
container.writer.write(
`;document.dispatchEvent(new CustomEvent('qprefetch', {detail:{links: [location.pathname]}}))`
);
container.closeElement();
}
function linkHtmlImplementation2(container, prefetchResources, prefetchImpl) {
const urls = flattenPrefetchResources(prefetchResources);
const rel = prefetchImpl.linkRel || "prefetch";
const priority = prefetchImpl.linkFetchPriority;
for (const url of urls) {
const attributes = ["href", url, "rel", rel];
if (priority) {
attributes.push("fetchpriority", priority);
}
if (rel === "prefetch" || rel === "preload") {
if (url.endsWith(".js")) {
attributes.push("as", "script");
}
}
container.openElement("link", null, attributes);
container.closeElement();
}
}
function linkJsImplementation2(container, prefetchResources, prefetchImpl, nonce) {
const scriptAttrs = ["type", "module", "q:type", "link-js"];
if (nonce) {
scriptAttrs.push("nonce", nonce);
}
container.openElement("script", null, scriptAttrs);
const rel = prefetchImpl.linkRel || "prefetch";
const priority = prefetchImpl.linkFetchPriority;
if (prefetchImpl.workerFetchInsert === "no-link-support") {
container.writer.write(`let supportsLinkRel = true;`);
}
container.writer.write(`const u=${JSON.stringify(flattenPrefetchResources(prefetchResources))};`);
container.writer.write(`u.map((u,i)=>{`);
container.writer.write(`const l=document.createElement('link');`);
container.writer.write(`l.setAttribute("href",u);`);
container.writer.write(`l.setAttribute("rel","${rel}");`);
if (priority) {
container.writer.write(`l.setAttribute("fetchpriority","${priority}");`);
}
if (prefetchImpl.workerFetchInsert === "no-link-support") {
container.writer.write(`if(i===0){`);
container.writer.write(`try{`);
container.writer.write(`supportsLinkRel=l.relList.supports("${rel}");`);
container.writer.write(`}catch(e){}`);
container.writer.write(`}`);
}
container.writer.write(`document.body.appendChild(l);`);
container.writer.write(`});`);
if (prefetchImpl.workerFetchInsert === "no-link-support") {
container.writer.write(`if(!supportsLinkRel){`);
container.writer.write(workerFetchScript());
container.writer.write(`}`);
}
if (prefetchImpl.workerFetchInsert === "always") {
container.writer.write(workerFetchScript());
}
container.closeElement();
}
function workerFetchImplementation2(container, prefetchResources, nonce) {
const scriptAttrs = ["type", "module", "q:type", "prefetch-worker"];
if (nonce) {
scriptAttrs.push(nonce, "nonce");
}
container.openElement("script", null, scriptAttrs);
container.writer.write(`const u=${JSON.stringify(flattenPrefetchResources(prefetchResources))};`);
container.writer.write(workerFetchScript());
container.closeElement();
}
function normalizePrefetchImplementation(input) {
return { ...PrefetchImplementationDefault, ...input };
}
var PrefetchImplementationDefault = {
linkInsert: null,
linkRel: null,
linkFetchPriority: null,
workerFetchInsert: null,
prefetchEvent: "always"
};
// packages/qwik/src/server/prefetch-strategy.ts
import { isDev as isDev2 } from "@qwik.dev/core/build";
function getPrefetchResources(qrls, opts, resolvedManifest) {
if (!resolvedManifest) {
return [];
}
const prefetchStrategy = opts.prefetchStrategy;
const buildBase = getBuildBase(opts);
if (prefetchStrategy !== null) {
if (!prefetchStrategy || !prefetchStrategy.symbolsToPrefetch || prefetchStrategy.symbolsToPrefetch === "auto") {
return getAutoPrefetch(qrls, resolvedManifest, buildBase);
}
if (typeof prefetchStrategy.symbolsToPrefetch === "function") {
try {
return prefetchStrategy.symbolsToPrefetch({ manifest: resolvedManifest.manifest });
} catch (e) {
console.error("getPrefetchUrls, symbolsToPrefetch()", e);
}
}
}
return [];
}
function getAutoPrefetch(qrls, resolvedManifest, buildBase) {
const prefetchResources = [];
const { mapper, manifest } = resolvedManifest;
const urls = /* @__PURE__ */ new Map();
if (mapper && manifest) {
for (const qrl of qrls) {
const qrlSymbolName = qrl.getHash();
const resolvedSymbol = mapper[qrlSymbolName];
if (resolvedSymbol) {
const bundleFileName = resolvedSymbol[1];
addBundle(manifest, urls, prefetchResources, buildBase, bundleFileName);
}
}
}
return prefetchResources;
}
function addBundle(manifest, urls, prefetchResources, buildBase, bundleFileName) {
const url = isDev2 ? bundleFileName : buildBase + bundleFileName;
let prefetchResource = urls.get(url);
if (!prefetchResource) {
prefetchResource = {
url,
imports: []
};
urls.set(url, prefetchResource);
const bundle = manifest.bundles[bundleFileName];
if (bundle) {
if (Array.isArray(bundle.imports)) {
for (const importedFilename of bundle.imports) {
addBundle(manifest, urls, prefetchResource.imports, buildBase, importedFilename);
}
}
}
}
prefetchResources.push(prefetchResource);
}
// packages/qwik/src/server/ssr-node.ts
import {
_isJSXNode as isJSXNode,
_EMPTY_ARRAY,
_EFFECT_BACK_REF
} from "@qwik.dev/core";
import { isDev as isDev3 } from "@qwik.dev/core/build";
var SsrNode = class {
constructor(currentComponentNode, nodeType, id, attrs, cleanupQueue, vnodeData) {
this.attrs = attrs;
this.cleanupQueue = cleanupQueue;
this.vnodeData = vnodeData;
__publicField(this, "__brand__");
/** @param nodeType - Node type: ELEMENT_NODE, TEXT_NODE, DOCUMENT_NODE */
__publicField(this, "nodeType");
/**
* ID which the deserialize will use to retrieve the node.
*
* @param refId - Unique id for the node.
*/
__publicField(this, "id");
/** Local props which don't serialize; */
__publicField(this, "locals", null);
__publicField(this, "currentComponentNode");
__publicField(this, "childrenVNodeData", null);
this.currentComponentNode = currentComponentNode;
this.currentComponentNode?.addChildVNodeData(this.vnodeData);
this.nodeType = nodeType;
this.id = id;
if (isDev3 && id.indexOf("undefined") != -1) {
throw new Error(`Invalid SSR node id: ${id}`);
}
}
get [_EFFECT_BACK_REF]() {
return this.getProp(QBackRefs);
}
setProp(name, value) {
if (this.attrs === _EMPTY_ARRAY) {
this.attrs = [];
}
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
mapArray_set(this.locals || (this.locals = []), name, value, 0);
} else {
mapArray_set(this.attrs, name, value, 0);
}
if (name == ELEMENT_SEQ && value) {
this.cleanupQueue.push(value);
}
}
getProp(name) {
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
return this.locals ? mapArray_get(this.locals, name, 0) : null;
} else {
return mapArray_get(this.attrs, name, 0);
}
}
removeProp(name) {
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
if (this.locals) {
mapApp_remove(this.locals, name, 0);
}
} else {
mapApp_remove(this.attrs, name, 0);
}
}
addChildVNodeData(child) {
if (!this.childrenVNodeData) {
this.childrenVNodeData = [];
}
this.childrenVNodeData.push(child);
}
toString() {
let stringifiedAttrs = "";
for (let i = 0; i < this.attrs.length; i += 2) {
const key = this.attrs[i];
const value = this.attrs[i + 1];
stringifiedAttrs += `${key}=`;
stringifiedAttrs += `${typeof value === "string" || typeof value === "number" ? JSON.stringify(value) : "*"}`;
if (i < this.attrs.length - 2) {
stringifiedAttrs += ", ";
}
}
return `SSRNode [<${this.id}> ${stringifiedAttrs}]`;
}
};
__publicField(SsrNode, "ELEMENT_NODE", 1);
__publicField(SsrNode, "TEXT_NODE", 3);
__publicField(SsrNode, "DOCUMENT_NODE", 9);
__publicField(SsrNode, "DOCUMENT_FRAGMENT_NODE", 11);
var DomRef = class {
constructor($ssrNode$) {
this.$ssrNode$ = $ssrNode$;
}
};
var SsrComponentFrame = class {
constructor(componentNode) {
this.componentNode = componentNode;
__publicField(this, "slots", []);
__publicField(this, "projectionDepth", 0);
__publicField(this, "scopedStyleIds", /* @__PURE__ */ new Set());
__publicField(this, "projectionScopedStyle", null);
__publicField(this, "projectionComponentFrame", null);
}
distributeChildrenIntoSlots(children, projectionScopedStyle, projectionComponentFrame) {
this.projectionScopedStyle = projectionScopedStyle;
this.projectionComponentFrame = projectionComponentFrame;
if (isJSXNode(children)) {
const slotName = this.getSlotName(children);
mapArray_set(this.slots, slotName, children, 0);
} else if (Array.isArray(children) && children.length > 0) {
const defaultSlot = [];
for (let i = 0; i < children.length; i++) {
const child = children[i];
if (isJSXNode(child)) {
const slotName = this.getSlotName(child);
if (slotName === QDefaultSlot) {
defaultSlot.push(child);
} else {
this.updateSlot(slotName, child);
}
} else {
defaultSlot.push(child);
}
}
defaultSlot.length > 0 && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
} else {
mapArray_set(this.slots, QDefaultSlot, children, 0);
}
}
updateSlot(slotName, child) {
let existingSlots = mapArray_get(this.slots, slotName, 0);
if (existingSlots === null) {
existingSlots = child;
} else if (Array.isArray(existingSlots)) {
existingSlots.push(child);
} else {
existingSlots = [existingSlots, child];
}
mapArray_set(this.slots, slotName, existingSlots, 0);
}
getSlotName(jsx) {
if (jsx.props[QSlot]) {
return jsx.props[QSlot];
}
return QDefaultSlot;
}
hasSlot(slotName) {
return mapArray_has(this.slots, slotName, 0);
}
consumeChildrenForSlot(projectionNode, slotName) {
const children = mapApp_remove(this.slots, slotName, 0);
this.componentNode.setProp(slotName, projectionNode.id);
projectionNode.setProp(QSlotParent, this.componentNode.id);
return children;
}
releaseUnclaimedProjections(unclaimedProjections) {
if (this.slots.length) {
unclaimedProjections.push(this);
unclaimedProjections.push(this.projectionScopedStyle);
unclaimedProjections.push.apply(unclaimedProjections, this.slots);
}
}
};
// packages/qwik/src/server/tag-nesting.ts
var allowedContent = (state) => {
switch (state) {
case 2 /* TEXT */:
return ["text content", null];
case 0 /* NOT_ALLOWED */:
return ["no content", null];
case 32 /* HTML */:
return ["html content", "<head>, <body>"];
case 64 /* HEAD */:
return [
"head content",
"<title>, <script>, <noscript>, <style>, <meta>, <link>, <base>, <template>"
];
case 130 /* BODY */:
return ["body content", "all tags allowed here"];
case 4 /* EMPTY */:
return ["no-content element", null];
case 10 /* ANYTHING */:
return ["any content", null];
case 4096 /* TABLE */:
return ["table", "<caption>, <colgroup>, <tbody>, <thead>, <tfoot>"];
case 8192 /* TABLE_BODY */:
return ["table body", "<tr>"];
case 16384 /* TABLE_ROW */:
return ["table row", "<td>, <th>"];
case 32768 /* TABLE_COLGROUP */:
return ["table column group", "<col>"];
case 258 /* PHRASING_ANY */:
case 514 /* PHRASING_INSIDE_INPUT */:
case 1026 /* PHRASING_CONTAINER */:
return ["phrasing content", "<a>, <b>, <img>, <input> ... (no <div>, <p> ...)"];
case 1 /* DOCUMENT */:
return ["document", "<html>"];
}
};
var initialTag = (tag) => {
switch (tag) {
case "html":
return 32 /* HTML */;
case "head":
return 64 /* HEAD */;
case "body":
return 130 /* BODY */;
default:
return isTagAllowed(10 /* ANYTHING */, tag);
}
};
function isTagAllowed(state, tag) {
switch (state) {
case 2 /* TEXT */:
case 0 /* NOT_ALLOWED */:
return 0 /* NOT_ALLOWED */;
case 32 /* HTML */:
return isInHtml(tag);
case 64 /* HEAD */:
return isInHead(tag);
case 130 /* BODY */:
case 10 /* ANYTHING */:
case 1026 /* PHRASING_CONTAINER */:
return isInAnything(tag);
case 4096 /* TABLE */:
return isInTable(tag);
case 8192 /* TABLE_BODY */:
return isInTableBody(tag);
case 16384 /* TABLE_ROW */:
return isInTableRow(tag);
case 32768 /* TABLE_COLGROUP */:
return isInTableColGroup(tag);
case 258 /* PHRASING_ANY */:
return isInPhrasing(tag, true);
case 514 /* PHRASING_INSIDE_INPUT */:
return isInPhrasing(tag, false);
case 1 /* DOCUMENT */:
if (tag === "html") {
return 32 /* HTML */;
}
}
return 0 /* NOT_ALLOWED */;
}
function isInHtml(text) {
switch (text) {
case "head":
return 64 /* HEAD */;
case "body":
return 130 /* BODY */;
default:
return 0 /* NOT_ALLOWED */;
}
}
function isInHead(text) {
switch (text) {
case "title":
case "script":
case "noscript":
case "style":
return 2 /* TEXT */;
case "meta":
case "link":
case "base":
return 4 /* EMPTY */;
case "template":
return 10 /* ANYTHING */;
default:
return 0 /* NOT_ALLOWED */;
}
}
function isSelfClosingTag(text) {
switch (text) {
case "area":
case "base":
case "basefont":
case "bgsound":
case "br":
case "col":
case "embed":
case "frame":
case "hr":
case "img":
case "input":
case "keygen":
case "link":
case "meta":
case "param":
case "source":
case "track":
case "wbr":
return true;
default:
return false;
}
}
function isInAnything(text) {
if (isSelfClosingTag(text)) {
return 4 /* EMPTY */;
}
switch (text) {
case "script":
case "style":
case "noscript":
case "noframes":
return 2 /* TEXT */;
case "p":
case "pre":
return 258 /* PHRASING_ANY */;
case "table":
return 4096 /* TABLE */;
case "html":
case "head":
case "body":
return 0 /* NOT_ALLOWED */;
case "button":
case "input":
case "textarea":
return 514 /* PHRASING_INSIDE_INPUT */;
default:
return 10 /* ANYTHING */;
}
}
function isInTable(text) {
switch (text) {
case "caption":
return 10 /* ANYTHING */;
case "colgroup":
return 32768 /* TABLE_COLGROUP */;
case "thead":
case "tbody":
case "tfoot":
return 8192 /* TABLE_BODY */;
default:
return 0 /* NOT_ALLOWED */;
}
}
function isInTableBody(text) {
switch (text) {
case "tr":
return 16384 /* TABLE_ROW */;
default:
return 0 /* NOT_ALLOWED */;
}
}
function isInTableRow(text) {
switch (text) {
case "td":
case "th":
return 10 /* ANYTHING */;
default:
return 0 /* NOT_ALLOWED */;
}
}
function isInTableColGroup(text) {
switch (text) {
case "col":
return 4 /* EMPTY */;
default:
return 0 /* NOT_ALLOWED */;
}
}
function isInPhrasing(text, allowInput) {
switch (text) {
case "svg":
case "math":
return 1026 /* PHRASING_CONTAINER */;
case "button":
case "input":
case "textarea":
return allowInput ? 514 /* PHRASING_INSIDE_INPUT */ : 0 /* NOT_ALLOWED */;
case "a":
case "abbr":
case "area":
case "audio":
case "b":
case "bdi":
case "bdo":
case "br":
case "canvas":
case "cite":
case "code":
case "command":
case "data":
case "datalist":
case "del":
case "dfn":
case "em":
case "embed":
case "i":
case "iframe":
case "img":
case "ins":
case "itemprop":
case "kbd":
case "keygen":
case "label":
case "link":
case "map":
case "mark":
case "meta":
case "meter":
case "noscript":
case "object":
case "option":
case "output":
case "picture":
case "progress":
case "q":
case "ruby":
case "s":
case "samp":
case "script":
case "select":
case "slot":
case "small":
case "span":
case "strong":
case "sub":
case "sup":
case "template":
case "time":
case "u":
case "var":
case "video":
case "wbr":
return allowInput ? 258 /* PHRASING_ANY */ : 514 /* PHRASING_INSIDE_INPUT */;
case "style":
return 2 /* TEXT */;
default:
return 0 /* NOT_ALLOWED */;
}
}
// packages/qwik/src/server/vnode-data.ts
import { _EMPTY_ARRAY as _EMPTY_ARRAY2 } from "@qwik.dev/core";
var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
var WRITE_ELEMENT_ATTRS = Number.MAX_SAFE_INTEGER - 2;
function vNodeData_incrementElementCount(vNodeData) {
const length = vNodeData.length;
const lastValue = length > 1 ? vNodeData[length - 1] : 0;
if (lastValue >= 0) {
vNodeData.push(-1);
} else {
vNodeData[length - 1] = lastValue - 1;
}
}
function vNodeData_addTextSize(vNodeData, size) {
const length = vNodeData.length;
const lastValue = length > 1 ? vNodeData[length - 1] : 0;
if (length > 1 && lastValue >= 0) {
vNodeData[0] |= 1 /* TEXT_DATA */;
}
vNodeData.push(size);
if (size == 0) {
vNodeData[0] |= 1 /* TEXT_DATA */;
}
}
function vNodeData_openFragment(vNodeData, attrs) {
vNodeData.push(attrs, OPEN_FRAGMENT);
vNodeData[0] |= 2 /* VIRTUAL_NODE */;
}
function vNodeData_closeFragment(vNodeData) {
vNodeData.push(CLOSE_FRAGMENT);
}
function vNodeData_openElement(vNodeData) {
vNodeData.push([], WRITE_ELEMENT_ATTRS);
vNodeData[0] |= 4 /* ELEMENT_NODE */;
}
function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue) {
vNodeData[0] |= 8 /* REFERENCE */;
let fragmentAttrs = _EMPTY_ARRAY2;
const stack = [SsrNode.ELEMENT_NODE, -1];
for (let i = 1; i < vNodeData.length; i++) {
const value = vNodeData[i];
if (Array.isArray(value)) {
fragmentAttrs = value;
i++;
if (vNodeData[i] !== WRITE_ELEMENT_ATTRS) {
stack[stack.length - 1]++;
stack.push(SsrNode.DOCUMENT_FRAGMENT_NODE, -1);
}
} else if (value === CLOSE_FRAGMENT) {
stack.pop();
stack.pop();
fragmentAttrs = _EMPTY_ARRAY2;
} else if (value < 0) {
const numberOfElements = 0 - value;
stack[stack.length - 1] += numberOfElements;
} else {
stack[stack.length - 1]++;
}
}
let refId = String(depthFirstElementIdx);
if (vNodeData[0] & (2 /* VIRTUAL_NODE */ | 1 /* TEXT_DATA */)) {
for (let i = 1; i < stack.length; i += 2) {
const childCount = stack[i];
if (childCount >= 0) {
refId += encodeAsAlphanumeric(childCount);
}
}
}
const type = stack[stack.length - 2];
return new SsrNode(currentComponentNode, type, refId, fragmentAttrs, cleanupQueue, vNodeData);
}
var ALPHANUMERIC = [];
function encodeAsAlphanumeric(value) {
while (ALPHANUMERIC.length <= value) {
let value2 = ALPHANUMERIC.length;
let text = "";
do {
text = String.fromCharCode(
(text.length === 0 ? 65 : 97) + value2 % 26
/* A-Z */
) + text;
value2 = Math.floor(
value2 / 26
/* A-Z */
);
} while (value2 !== 0);
ALPHANUMERIC.push(text);
}
return ALPHANUMERIC[value];
}
// packages/qwik/src/server/scripts.ts
var QWIK_LOADER_DEFAULT_MINIFIED = '(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,r=(t,o,n)=>o in t?e(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,s=(e,s)=>{for(var a in s||(s={}))o.call(s,a)&&r(e,a,s[a]);if(t)for(var a of t(s))n.call(s,a)&&r(e,a,s[a]);return e};((e,t)=>{const o="__q_context__",n=window,r=new Set,a=new Set([e]),i="replace",c="forEach",l="target",f="getAttribute",p="isConnected",b="qvisible",u="_qwikjson_",h=(e,t)=>Array.from(e.querySelectorAll(t)),y=e=>{const t=[];return a.forEach((o=>t.push(...h(o,e)))),t},d=e=>{S(e),h(e,"[q\\\\:shadowroot]").forEach((e=>{const t=e.shadowRoot;t&&d(t)}))},q=e=>e&&"function"==typeof e.then,m=(e,t,o=t.type)=>{y("[on"+e+"\\\\:"+o+"]")[c]((n=>g(n,e,t,o)))},w=t=>{if(void 0===t[u]){let o=(t===e.documentElement?e.body:t).lastElementChild;for(;o;){if("SCRIPT"===o.tagName&&"qwik/json"===o[f]("type")){t[u]=JSON.parse(o.textContent[i](/\\\\x3C(\\/?script)/gi,"<$1"));break}o=o.previousElementSibling}}},v=(e,t)=>new CustomEvent(e,{detail:t}),g=async(t,n,r,a=r.type)=>{const c="on"+n+":"+a;t.hasAttribute("preventdefault:"+a)&&r.preventDefault(),t.hasAttribute("stoppropagation:"+a)&&r.stopPropagation();const l=t._qc_,b=l&&l.li.filter((e=>e[0]===c));if(b&&b.length>0){for(const e of b){const o=e[1].getFn([t,r],(()=>t[p]))(r,t),n=r.cancelBubble;q(o)&&await o,n&&r.stopPropagation()}return}const u=t.qDispatchEvent;if(u)return u(r,n);const h=t[f](c);if(h){const n=t.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),a=n[f]("q:base"),c=n[f]("q:version")||"unknown",l=n[f]("q:manifest-hash")||"dev",b=new URL(a,e.baseURI);for(const f of h.split("\\n")){const u=new URL(f,b),h=u.href,y=u.hash[i](/^#?([^?[|]*).*$/,"$1")||"default",d=performance.now();let m,v,g;const A=f.startsWith("#"),_={qBase:a,qManifest:l,qVersion:c,href:h,symbol:y,element:t,reqTime:d};if(A){const t=n.getAttribute("q:instance");m=(e["qFuncs_"+t]||[])[Number.parseInt(y)],m||(v="sync",g=Error("sync handler error for symbol: "+y))}else{const e=u.href.split("#")[0];try{const t=import(e);w(n),m=(await t)[y],m||(v="no-symbol",g=Error(`${y} not in ${e}`))}catch(e){v||(v="async"),g=e}}if(!m){E("qerror",s({importError:v,error:g},_)),console.error(g);break}const k=e[o];if(t[p])try{e[o]=[t,r,u],A||E("qsymbol",s({},_));const n=m(r,t);q(n)&&await n}catch(e){E("qerror",s({error:e},_))}finally{e[o]=k}}}},E=(t