var __defProp = Object.defineProperty; var __markAsModule = (target) => __defProp(target, "__esModule", {value: true}); var __export = (target, all) => { for (var name in all) __defProp(target, name, {get: all[name], enumerable: true}); }; var __async = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; // bazel-out/darwin-fastbuild/bin/client/index.js __markAsModule(exports); __export(exports, { Component: () => Component, Entity: () => Entity, EventEntity: () => EventEntity, Host: () => Host, QRL: () => QRL, dirname: () => dirname, emitEvent: () => emitEvent, entityStateKey: () => entityStateKey, getInjector: () => getInjector, injectEventHandler: () => injectEventHandler, injectFunction: () => injectFunction, injectMethod: () => injectMethod, jsxDeclareComponent: () => jsxDeclareComponent, jsxFactory: () => jsxFactory, jsxRender: () => jsxRender, markDirty: () => markDirty, provideComponentProp: () => provideComponentProp, provideComponentProps: () => provideComponentProps, provideComponentState: () => provideComponentState, provideElement: () => provideElement, provideEntity: () => provideEntity, provideEntityState: () => provideEntityState, provideEvent: () => provideEvent, provideInjector: () => provideInjector, provideProviderOf: () => provideProviderOf, provideQrlExp: () => provideQrlExp, provideUrlProp: () => provideUrlProp, qImport: () => qImport, serializeState: () => serializeState, setConfig: () => setConfig, toEntityKey: () => toEntityKey }); // bazel-out/darwin-fastbuild/bin/client/util/types.js function isDomElementWithTagName(node, tagName) { return isHtmlElement(node) && node.tagName.toLowerCase() == tagName.toLowerCase(); } function isHtmlElement(node) { return node ? node.nodeType === 1 : false; } function isTextNode(node) { return node ? node.nodeType === 3 : false; } // bazel-out/darwin-fastbuild/bin/client/error/stringify.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function stringifyDebug(value) { if (value == null) return String(value); if (typeof value === "function") return value.name; if (isHtmlElement(value)) return stringifyElement(value); if (value instanceof URL) return String(value); if (typeof value === "object") return JSON.stringify(value, function(key, value2) { if (isHtmlElement(value2)) return stringifyElement(value2); return value2; }); return String(value); } function stringifyElement(element) { let html = "<" + element.tagName.toLowerCase(); const attributes = element.attributes; const names = []; for (let i = 0; i < attributes.length; i++) { names.push(attributes[i].name); } names.sort(); for (let i = 0; i < names.length; i++) { const name = names[i]; let value = element.getAttribute(name); if (value === null || value === void 0 ? void 0 : value.startsWith("file:/")) { value = value.replace(/(file:\/\/).*(\/.*)$/, (all, protocol, file) => protocol + "..." + file); } html += " " + name + (value == null || value == "" ? "" : "='" + value.replace("'", "'") + "'"); } return html + ">"; } // bazel-out/darwin-fastbuild/bin/client/error/error.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function qError(code, ...args) { const text = codeToText(code); const parts = text.split("{}"); const error = parts.map((value, index) => { return value + (index === parts.length - 1 ? "" : stringifyDebug(args[index])); }).join(""); debugger; return new Error(error); } function codeToText(code) { const area = { 0: "ERROR", 1: "QRL-ERROR", 2: "INJECTOR-ERROR", 3: "SERVICE-ERROR", 4: "COMPONENT-ERROR", 5: "PROVIDER-ERROR", 6: "RENDER-ERROR", 7: "EVENT-ERROR" }[Math.floor(code / 100)]; const text = { [1]: "QConfig not found in path '{}'.", [2]: "Unrecognized stack format '{}'", [3]: "Could not find entity state '{}' at '{}' or any of it's parents.", [4]: "Could not find entity state '{}' ( or entity provider '{}') at '{}' or any of it's parents.", [5]: "Missing property '{}' in props '{}'.", [6]: "Missing export '{}' from '{}'. Exported symbols are: {}", [100]: "QRL '${}' should point to function, was '{}'.", [200]: "Can't find host element above '{}'.", [201]: "Provider is expecting '{}' but got '{}'.", [202]: "Expected 'Element' was '{}'.", [203]: "Expected injection 'this' to be of type '{}', but was of type '{}'.", [204]: "Entity key '{}' is found on '{}' but does not contain state. Was 'serializeState()' not run during dehydration?", [206]: "No injector can be found starting at '{}'.", [207]: "EventInjector does not support serialization.", [300]: "Data key '{}' is not a valid key.\n - Data key can only contain characters (preferably lowercase) or number\n - Data key is prefixed with entity name\n - Data key is made up from parts that are separated with ':'.", [301]: "A entity with key '{}' already exists.", [303]: "'{}' is not a valid attribute. Attributes can only contain 'a-z' (lowercase), '0-9', '-' and '_'.", [304]: "Found '{}' but expando did not have entity and attribute did not have state.", [305]: "Element '{}' is missing entity attribute definition '{}'.", [306]: "Unable to create state for entity '{}' with props '{}' because no state found and '$newState()' method was not defined on entity.", [307]: "'{}' is not an instance of 'Entity'.", [308]: "'{}' overrides 'constructor' property preventing 'EntityType' retrieval.", [311]: "Entity '{}' does not define '$keyProps'.", [310]: "Entity '{}' must have static '$type' property defining the name of the entity.", [312]: "Entity '{}' must have static '$qrl' property defining the import location of the entity.", [313]: "Name collision. Already have entity named '{}' with QRL '{}' but expected QRL '{}'.", [309]: "Entity key '{}' is missing values. Expecting '{}:someValue'.", [314]: "Entity '{}' defines '$keyProps' as '{}'. Actual key '{}' has more parts than entity defines.", [315]: "Key '{}' belongs to entity named '{}', but expected entity '{}' with name '{}'.", [316]: "Entity state is missing '$key'. Are you sure you passed in state? Got '{}'.", [400]: `'bind:' must have an key. (Example: 'bind:key="propertyName"').`, [401]: `'bind:id' must have a property name. (Example: 'bind:key="propertyName"').`, [402]: "Can't find state on host element.", [403]: "Components must be instantiated inside an injection context. Use '{}.new(...)' for creation.", [404]: "Property '{}' not found in '{}' on component '{}'.", [405]: "Unable to find '{}' component.", [406]: "Requesting component '{}' does not match existing component '{}'. Verify that the two components have distinct '$templateQRL's.", [407]: "Expecting Component '{}' to have static '$templateQRL' property, but none was found.", [408]: "Unable to create state for component '{}' with props '{}' because no state found and '$newState()' method was not defined on component.", [500]: "Unrecognized expression format '{}'.", [600]: "Unexpected JSXNode<{}> type.", [601]: "Value '{}' can't be written into '{}' attribute.", [602]: "Expecting entity object, got '{}'.", [603]: "Expecting array of entities, got '{}'.", [604]: "Expecting Entity or Component got '{}'.", [605]: "'requestAnimationFrame' not found. If you are running on server design your applications in a way which does not require 'requestAnimationFrame' on first render.", [606]: `Expecting that element with 'bind:{}' should be a component (should have 'decl:template="qrl"' attribute): {}`, [700]: "Missing '$type' attribute in the '{}' url.", [701]: "Re-emitting event '{}' but no listener found at '{}' or any of its parents." }[code]; let textCode = "000" + code; textCode = textCode.substr(textCode.length - 3); return `${area}(Q-${textCode}): ${text}`; } // bazel-out/darwin-fastbuild/bin/client/util/global.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ var _globalThis = typeof globalThis !== "undefined" && globalThis; var _window = typeof window !== "undefined" && window; var _self = typeof self !== "undefined" && typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope && self; var __global = typeof global !== "undefined" && global; var _global = _globalThis || __global || _window || _self; var global_default = _global; // bazel-out/darwin-fastbuild/bin/client/util/qDev.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ if (typeof qDev === "undefined") { global_default.qDev = true; } // bazel-out/darwin-fastbuild/bin/client/util/dirname.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function dirname(path) { const idx = path.lastIndexOf("/", path.length - 2); return idx == -1 ? path : path.substr(0, idx + 1); } // bazel-out/darwin-fastbuild/bin/client/config/qGlobal.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ var configs = []; function setConfig(config) { if (!config.baseURI.endsWith("/")) { config.baseURI = dirname(config.baseURI); } config.baseURI = normalizeBaseUri(config.baseURI); configs.push(config); configs.sort((a, b) => { return b.baseURI.length - a.baseURI.length; }); } function normalizeBaseUri(baseURI) { if (baseURI.startsWith("/")) { baseURI = "file://" + baseURI; } return baseURI; } function getConfig(path) { if (path != null) { path = normalizeBaseUri(path); for (let i = 0; i < configs.length; i++) { const config = configs[i]; if (path.startsWith(config.baseURI)) { return config; } } } if (typeof document === "undefined") { throw qError(1, path + "\n" + configs.map((c) => JSON.stringify(c)).join("\n")); } if (!global_default.Q) { global_default.Q = {}; } if (!Q.baseURI) { Q.baseURI = document.baseURI; } if (!Q.protocol) { Q.protocol = {}; } return Q; } // bazel-out/darwin-fastbuild/bin/client/import/qImport.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ var importCache; function qImport(base, url) { if (!importCache) importCache = new Map(); const normalizedUrl = toUrl(toBaseURI(base), url); const importPath = toImportPath(normalizedUrl); const exportName = qExport(normalizedUrl); const cacheKey = `${importPath}#${exportName}`; const cacheValue = importCache.get(cacheKey); if (cacheValue) return cacheValue; const promise = (typeof __mockImport === "function" ? __mockImport(importPath + ".js") : import(importPath + ".js")).then((module2) => { const handler = module2[exportName]; if (!handler) throw qError(6, exportName, importPath, Object.keys(module2)); qImportSet(cacheKey, handler); return handler; }); qImportSet(cacheKey, promise); return promise; } function qImportSet(url, value) { importCache.set(url, value); } function toBaseURI(base) { if (typeof base === "string") return base; const document2 = base.ownerDocument || base; return document2.baseURI; } function toUrl(baseURI, url) { if (typeof url === "string") { const config = getConfig(baseURI); return new URL(adjustProtocol(config, url), config.baseURI); } else { return url; } } function toImportPath(url) { const tmp = new URL(String(url)); tmp.hash = ""; tmp.search = ""; return String(tmp).replace(/\.(ts|tsx)$/, ".js"); } function adjustProtocol(qConfig, qrl) { return String(qrl).replace(/(^\w+):\/?/, (all, protocol) => { let value = qConfig.protocol[protocol]; if (!value) return all; if (!value.endsWith("/")) { value = value + "/"; } return value; }); } function qExport(url) { return getHash(url).replace(/^#?([^?]*).*$/, "$1") || "default"; } function qParams(url) { return new URLSearchParams(getHash(url).replace(/^[^?]*\??(.*)$/, "$1")); } function getHash(url) { let hash = url.hash; if (hash.startsWith("##")) { hash = hash.substr(1); } return hash; } // bazel-out/darwin-fastbuild/bin/client/error/data.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function assertValidDataKey(key) { if (!key) return; for (let i = 0; i < key.length; i++) { const ch = key.charCodeAt(i); if (!isAlphanumeric(ch)) { throw qError(300, key); } } } function isAlphanumeric(ch) { return 65 <= ch && ch <= 90 || isAlphanumericAttribute(ch) || ch == 46 || ch == 58; } function isAlphanumericAttribute(ch) { return 97 <= ch && ch <= 122 || 48 <= ch && ch <= 57 || ch == 45 || ch == 95; } function isValidAttribute(text) { for (let i = 0; i < text.length; i++) { const ch = text.charCodeAt(i); if (!isAlphanumericAttribute(ch)) return false; } return true; } // bazel-out/darwin-fastbuild/bin/client/util/case.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ var camelToKebabCase = new Map(); function fromCamelToKebabCase(text, includeFirst = false) { if (typeof text != "string") return text; const value = camelToKebabCase.get(text); if (value != null) return value; let converted = ""; for (let x = 0; x < text.length; x++) { const ch = text.charAt(x); if (isUpperCase(ch)) { converted += (x != 0 || includeFirst ? "-" : "") + ch.toLowerCase(); } else { converted += ch; } } camelToKebabCase.set(text, converted); return converted; } var kebabToCamelCase = new Map(); function fromKebabToCamelCase(text, capitalizeFirstCharacter = true) { const value = kebabToCamelCase.get(text); if (value != null) return value; let converted = ""; let wasKebab = capitalizeFirstCharacter; for (let x = 0; x < text.length; x++) { const ch = text.charAt(x); if (isKebab(ch)) { wasKebab = true; } else if (wasKebab) { wasKebab = false; converted += ch.toUpperCase(); } else { converted += ch; } } kebabToCamelCase.set(text, converted); return converted; } function isUpperCase(ch) { return "A" <= ch && ch <= "Z"; } function isKebab(ch) { return ch === "-"; } // bazel-out/darwin-fastbuild/bin/client/util/stringify.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function stringify(value) { return value == null ? null : String(value); } // bazel-out/darwin-fastbuild/bin/client/assert/assert.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function assertDefined(value, text) { if (value != null) return; throw newError(text || "Expected defined value."); } function assertString(value, text) { if (typeof value === "string") return; throw newError(text || `Expected value '${value}' to be 'string' but was '${typeOf(value)}'.`); } function assertEqual(value1, value2, text) { if (value1 === value2) return; throw newError(text || `Expected '${value1}' === '${value2}'.`); } function typeOf(value) { var _a; if (value === null) return "null"; const type = typeof value; if (type === "object") { return ((_a = value === null || value === void 0 ? void 0 : value.constructor) === null || _a === void 0 ? void 0 : _a.name) || ""; } else { return type; } } function newError(text) { debugger; return new Error(text); } // bazel-out/darwin-fastbuild/bin/client/entity/entity_key.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function toEntityKey(key) { qDev && assertString(key); return key; } function propsToKey(entityType, props) { let id = fromCamelToKebabCase(entityType.$type) + ":"; const propNames = entityType.$keyProps; if (!propNames) { throw qError(311, entityType); } for (let i = 0; i < propNames.length; i++) { const name = propNames[i]; if (i != 0) { id += ":"; } const value = fromCamelToKebabCase(stringify(props[name]), true); id += validateKeyPart(value); } return id; } function keyToProps(entityType, key) { const props = {}; const propOrder = entityType.$keyProps; if (!propOrder) { throw qError(311, entityType); } propOrder.forEach((key2) => props[key2] = null); const keyParts = String(key).split(":"); if (keyParts.length <= 1) { throw qError(309, key, key); } const entityName = keyParts.shift(); const expectedName = fromCamelToKebabCase(entityType.$type); if (expectedName !== entityName) { throw qError(315, key, entityName, entityType, expectedName); } if (propOrder.length == 0 && keyParts.length == 1 && keyParts[0] == "") { return props; } for (let i = 0; i < keyParts.length; i++) { const part = keyParts[i]; if (i >= propOrder.length) { throw qError(314, entityType, propOrder, key); } const propName = propOrder[i]; props[propName] = part == "" && i == keyParts.length - 1 ? null : fromKebabToCamelCase(part, false); } return props; } function validateKeyPart(value) { const text = value == null ? "" : String(value); if (isValidAttribute(text)) { return text; } else { throw qError(303, value); } } function entityStateKey(value) { const key = value.$key; if (typeof key !== "string") { throw qError(316, value); } return key; } function keyToEntityAttribute(entityKey) { const key = entityKey; const idx = key.indexOf(":"); if (idx == -1) { throw qError(300, key); } return "::" + key.substr(0, idx); } // bazel-out/darwin-fastbuild/bin/client/util/dom_attrs.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function findAttribute(element, qNotFoundError, attributePrimary, callbackPrimary, attributeSecondary, callbackSecondary) { let cursor = element; while (cursor) { const attrValuePrimary = cursor.getAttribute(attributePrimary); if (attrValuePrimary !== null) { return callbackPrimary(cursor, attributePrimary, attrValuePrimary); } if (attributeSecondary && callbackSecondary) { const attrValueSecondary = cursor.getAttribute(attributeSecondary); if (attrValueSecondary !== null) { return callbackSecondary(cursor, attributeSecondary, attrValueSecondary); } } cursor = cursor.parentElement; } throw attributeSecondary ? qError(qNotFoundError, attributePrimary, attributeSecondary, element) : qError(qNotFoundError, attributePrimary, element); } // bazel-out/darwin-fastbuild/bin/client/util/attributes.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function extractPropsFromElement(element) { const props = {}; const attrs = element.attributes; for (let i = 0; i < attrs.length; i++) { const attr = attrs[i]; const attrName = attr.name; const attrValue = attr.value; if (attrName.startsWith("bind:")) { const id = attrName.substr(5); if (!id) { throw qError(400); } if (!attrValue) { throw qError(401); } attrValue.split(";").forEach((key) => key && (props[key] = id)); } else if (attrName.indexOf(":") !== -1) { } else { props[fromKebabToCamelCase(attrName, false)] = attrValue; } } return props; } // bazel-out/darwin-fastbuild/bin/client/injector/resolve_args.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function resolveArgs(injector, ...args) { const argPromises = []; for (let i = 0; i < args.length; i++) { const valueOrProvider = args[i]; argPromises.push(isProvider(valueOrProvider) ? valueOrProvider(injector) : valueOrProvider); } return Promise.all(argPromises); } function isProvider(value) { return typeof value === "function"; } // bazel-out/darwin-fastbuild/bin/client/injector/base_injector.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ var BaseInjector = class { constructor(element) { this._props = null; this.element = element; } invoke(fn, self2, ...rest) { if (isInjectedFunction(fn)) { try { const selfType = fn.$thisType; if (self2 && selfType && !(self2 instanceof selfType)) { throw qError(203, selfType, self2.constructor); } const hasSelf = selfType && self2 == null; return resolveArgs(this, hasSelf ? this.getComponent(selfType) : self2, ...fn.$inject).then((values) => { return fn.apply(values.shift(), values.concat(rest)); }, (error) => Promise.reject(addDeclaredInfo(fn, error))); } catch (e) { throw addDeclaredInfo(fn, e); } } else { return Promise.resolve(fn.apply(null, rest)); } } set elementProps(props) { this._props = props; } get elementProps() { const existingProps = this._props; if (existingProps != null) { return existingProps; } return extractPropsFromElement(this.element); } }; function addDeclaredInfo(fn, error) { const debugStack = fn.$debugStack; if (!debugStack) return error; if (!(error instanceof Error)) { error = new Error(String(error)); } const declaredFrames = debugStack.stack.split("\n"); const declaredFrame = declaredFrames[2].trim(); const stack = error.stack; const msg = error.message; error.stack = stack.replace(msg, msg + "\n DECLARED " + declaredFrame); return error; } function isInjectedFunction(value) { return !!value.$inject; } // bazel-out/darwin-fastbuild/bin/client/injector/element_injector.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ var ElementInjector = class extends BaseInjector { constructor() { super(...arguments); this.component = null; this.componentPromise = null; this.entities = null; } getParent() { let element = this.element.parentElement; while (element) { if (element.hasAttribute(":") || element.hasAttribute("decl:template")) { return getInjector(element); } element = element.parentElement; } return null; } getComponent(componentType) { const injector = this; const elementQRL = injector.element.getAttribute("decl:template"); const $templateQRL = componentType.$templateQRL; if (!$templateQRL) { throw qError(407, componentType); } if (elementQRL === $templateQRL) { let component = this.component; if (component) { if (component instanceof componentType) { return this.componentPromise; } else { throw qError(406, componentType, component.constructor); } } else { const stateJSON = this.element.getAttribute(":."); const state = stateJSON ? JSON.parse(stateJSON) : null; this.component = component = new componentType(this.element, this.elementProps, state); return this.componentPromise = new Promise((resolve, reject) => { let promise; if (state == null) { promise = Promise.resolve(component.$newState(component.$props)).then((state2) => { component.$state = state2; }); } else { promise = Promise.resolve(component); } promise.then(() => component.$init()).then(() => resolve(component), reject); }); } } else { const parentInjector = this.getParent(); if (!parentInjector) { throw qError(405, componentType); } return parentInjector.getComponent(componentType); } } getEntity(entityKey, forceState, entityType) { var _a, _b; let entityPromise = (_b = (_a = this.entities) === null || _a === void 0 ? void 0 : _a.get(entityKey)) === null || _b === void 0 ? void 0 : _b.promise; if (entityPromise) return entityPromise; const entityAttrName = keyToEntityAttribute(entityKey); const self2 = this; return findAttribute(this.element, 4, String(entityKey), entityFactory, entityAttrName, entityFactory); function entityFactory(element, attrName, attrValue) { var _a2, _b2; const injector = element === self2.element ? self2 : getInjector(element); entityPromise = (_b2 = (_a2 = injector.entities) === null || _a2 === void 0 ? void 0 : _a2.get(entityKey)) === null || _b2 === void 0 ? void 0 : _b2.promise; if (entityPromise) return entityPromise; injector.element.setAttribute(String(entityKey), ""); const entityQRL = element.getAttribute(entityAttrName); if (!entityQRL) { throw qError(305, element, entityAttrName); } const entityTypePromise = Promise.resolve(entityType || qImport(element, entityQRL)); entityPromise = toEntityPromise(entityKey, new Promise((resolve, reject) => { entityTypePromise.then((entityType2) => { if (typeof entityType2 !== "function") { throw qError(100, entityQRL, entityType2); } let state = forceState || null; if (!state && attrName === String(entityKey)) { state = JSON.parse(attrValue); state.$key = entityKey; } const props = entityType2.$keyToProps(entityKey); const entity = new entityType2(element, props, state); let chain; if (state) { entityValue.entity = entity; chain = Promise.resolve(entity); } else { chain = entity.$newState(props).then((state2) => { entityValue.entity = entity; state2.$key = entityKey; entity.$state = state2; return entity; }, (e) => { var _a3; (_a3 = self2.entities) === null || _a3 === void 0 ? void 0 : _a3.delete(entityKey); return Promise.reject(e); }); } chain.then(() => { Promise.resolve(entity.$init()).then(() => resolve(entity)); }, reject); }, reject); })); const entityValue = {promise: entityPromise, entity: null}; const entities = injector.entities || (injector.entities = new Map()); entities.set(entityKey, entityValue); return entityPromise; } } getEntityState(entityKey) { const entityAttrName = keyToEntityAttribute(entityKey); return findAttribute(this.element, 4, entityKey, (element, entityKeyAttr, entityState) => { var _a, _b; const injector = element == this.element ? this : getInjector(element); const existingEntity = (_b = (_a = injector.entities) === null || _a === void 0 ? void 0 : _a.get(entityKey)) === null || _b === void 0 ? void 0 : _b.promise; if (existingEntity) { return existingEntity.then((entity) => entity.$state); } if (!entityState) { throw qError(204, entityKey, element); } const state = JSON.parse(entityState); state.$key = entityKeyAttr; return Promise.resolve(state); }, entityAttrName, (element) => { return getInjector(element).getEntity(entityKey).then((entity) => entity.$state); }); } releaseEntity(key) { var _a; if ((_a = this.entities) === null || _a === void 0 ? void 0 : _a.delete(key)) { this.element.removeAttribute(key); } } serialize() { var _a, _b; const element = this.element; const state = (_a = this.component) === null || _a === void 0 ? void 0 : _a.$state; if (state != null) { element.setAttribute(":.", JSON.stringify(state)); } (_b = this.entities) === null || _b === void 0 ? void 0 : _b.forEach((entity) => { var _a2; const state2 = (_a2 = entity.entity) === null || _a2 === void 0 ? void 0 : _a2.$state; if (state2) { element.setAttribute(state2.$key, JSON.stringify(state2, filterFrameworkKeys)); } }); } }; function filterFrameworkKeys(key, value) { if (key.startsWith("$")) { return void 0; } else { return value; } } function toEntityPromise(entityKey, promise) { const entityPromise = promise; entityPromise.$key = entityKey; return entityPromise; } function getInjector(element, create = true) { if (!isHtmlElement(element)) { throw qError(202, element); } const _element = element; let injector = _element.$injector; if (create && !injector) { _element.$injector = injector = new ElementInjector(element); element.setAttribute(":", ""); } return injector || null; } function getClosestInjector(element, throwIfNotFound = true) { let cursor = element; while (cursor) { if (cursor.hasAttribute(":") || cursor.hasAttribute("decl:template")) { return getInjector(cursor); } cursor = cursor.parentElement; } if (throwIfNotFound) { throw qError(206, element); } return null; } // bazel-out/darwin-fastbuild/bin/client/component/component.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ var Component = class { constructor(hostElement, props, state) { this.$host = hostElement; this.$props = props; this.$state = state; } static $new(hostElement) { const componentConstructor = this; const componentTemplate = hostElement.getAttribute("decl:template"); if (!componentTemplate) { hostElement.setAttribute("decl:template", componentConstructor.$templateQRL); } else if (componentTemplate !== componentConstructor.$templateQRL) { throw new Error("Write proper error"); } const injector = getInjector(hostElement); return injector.getComponent(componentConstructor); } $init() { } $newState(props) { const componentType = this.constructor; throw qError(408, componentType, props); } }; Component.$templateQRL = null; function isComponent(object) { var _a; return typeof ((_a = object === null || object === void 0 ? void 0 : object.constructor) === null || _a === void 0 ? void 0 : _a.$templateQRL) === "string"; } // bazel-out/darwin-fastbuild/bin/client/component/index.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ // bazel-out/darwin-fastbuild/bin/client/config/index.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ // bazel-out/darwin-fastbuild/bin/client/event/emit_event.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function emitEvent(element, event, url) { const params = qParams(url); const $type = params.get("$type"); if ($type == null) { throw qError(700, url); } const returnValue = findAttribute(element, 701, "on:" + fromCamelToKebabCase($type), (element2, attrName, attrValue) => { const qrl = attrValue; return Promise.resolve(qImport(element2, qrl)).then((fn) => { const dstUrl = toUrl(toBaseURI(element2), qrl); const event2 = new CustomEvent($type); params.forEach((value, key) => { event2[key] = value; }); return fn(element2, event2, dstUrl); }); }); return Promise.resolve(returnValue); } // bazel-out/darwin-fastbuild/bin/client/util/base_uri.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function getFilePathFromFrame(frame) { const match = frame.match(/\(?(\S*):\d+:\d+\)?/); if (!match) { throw qError(2, frame); } const path = match[1]; return path.replace(/\.(ts|tsx)$/, ".js"); } // bazel-out/darwin-fastbuild/bin/client/entity/entity.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ var Entity = class { constructor(element, props, state) { const entityType = getEntityType(this); this.$props = props; this.$state = state; this.$element = element; this.$key = propsToKey(entityType, props); props && entityType.$attachEntity(element); props && entityType.$attachEntityState(element, props, null); } static get $type() { return this.$_name; } static set $type(name) { if (!name.startsWith("$")) { const stack = new Error().stack; const frames = stack.split("\n"); const base = getFilePathFromFrame(frames[2]); this.$config = getConfig(base); this.$_name = name; } } static $attachEntity(element) { const entityType = this; if (!entityType.$type) { throw qError(310, entityType); } if (!entityType.$qrl) { throw qError(312, entityType); } const attributeName = "::" + fromCamelToKebabCase(entityType.$type); const currentQRL = element.getAttribute(attributeName); if (!currentQRL) { element.setAttribute(attributeName, String(entityType.$qrl)); } else if (currentQRL != entityType.$qrl) { throw qError(313, entityType.$type, currentQRL, entityType.$qrl); } } static $attachEntityState(host, propsOrKey, state) { const entityType = this; entityType.$attachEntity(host); const key = typeof propsOrKey == "string" ? propsOrKey : propsToKey(entityType, propsOrKey); if (!host.hasAttribute(String(key))) { host.setAttribute(String(key), state == null ? "" : JSON.stringify(state)); } } static $hydrate(element, propsOrKey, state) { const entityType = this; const key = typeof propsOrKey == "string" ? propsOrKey : propsToKey(entityType, propsOrKey); if (state) state.$key = key; const entityProviderKey = keyToEntityAttribute(key); if (!element.hasAttribute(entityProviderKey)) { this.$attachEntity(element); } const injector = getInjector(element); return injector.getEntity(key, state, this); } static $keyToProps(key) { return keyToProps(this, key); } static $propsToKey(props) { return propsToKey(this, props); } $invokeQRL(qrl, ...args) { return __async(this, null, function* () { const entity = getEntityType(this); const delegate = yield qImport(entity.$config, qrl); return getInjector(this.$element).invoke(delegate, this, ...args); }); } $newState(keyProps) { const entityType = this.constructor; throw qError(306, entityType.$type, keyProps); } $init() { return __async(this, null, function* () { }); } $release() { const injector = getInjector(this.$element); const entityType = getEntityType(this); const key = propsToKey(entityType, this.$props); injector.releaseEntity(key); } }; Entity.$config = null; Entity.$_name = null; Entity.$keyProps = []; function getEntityType(entity) { if (!(entity instanceof Entity)) { throw qError(307, entity); } const entityType = entity.constructor; if (entityType.$attachEntityState !== Entity.$attachEntityState) { throw qError(308, entity); } return entityType; } function isEntity(value) { return Object.prototype.hasOwnProperty.call(value, "$key"); } // bazel-out/darwin-fastbuild/bin/client/event/event_entity.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ var EventEntity = class extends Entity { constructor(element, event, url, props) { super(element, null, null); this.$key = EventEntity.KEY; this.event = event; this.url = url; this.props = props; } }; EventEntity.$qrl = ""; EventEntity.$type = "$EventEntity"; EventEntity.$props = ["id"]; EventEntity.KEY = "$event:"; // bazel-out/darwin-fastbuild/bin/client/event/event_injector.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ var EventInjector = class extends BaseInjector { constructor(element, event, url) { super(element); this.parentInjector = null; const props = {}; qParams(url).forEach((value, key) => props[key] = value); this.eventEntity = new EventEntity(element, event, url, props); } getParent() { const parent = this.parentInjector; if (parent) return parent; return this.parentInjector = getClosestInjector(this.element, false); } getComponent(componentType) { return this.getParent().getComponent(componentType); } getEntity(entityKey, state, entityType) { if (entityKey === EventEntity.KEY) return this.eventEntity; return this.getParent().getEntity(entityKey, state, entityType); } getEntityState(propsOrKey) { return this.getParent().getEntityState(propsOrKey); } releaseEntity(key) { var _a; return (_a = this.getParent()) === null || _a === void 0 ? void 0 : _a.releaseEntity(key); } serialize() { throw qError(207); } }; // bazel-out/darwin-fastbuild/bin/client/event/inject_event_handler.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function injectEventHandler(...args) { const injectedFunction = args.pop(); const thisType = injectedFunction.$thisType = args.shift(); injectedFunction.$inject = args; qDev && (injectedFunction.$debugStack = new Error()); const eventHandler = function eventHandler2(element, event, url) { var _a; const eventInjector = new EventInjector(element, event, url); return Promise.resolve(thisType && ((_a = eventInjector.getParent()) === null || _a === void 0 ? void 0 : _a.getComponent(thisType)) || null).then((self2) => eventInjector.invoke(injectedFunction, self2)); }; eventHandler.$delegate = injectedFunction; return eventHandler; } // bazel-out/darwin-fastbuild/bin/client/event/provide_element.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function provideElement() { return function elementProvider(injector) { return injector.element; }; } // bazel-out/darwin-fastbuild/bin/client/event/provide_event.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function provideEvent() { return function eventProvider(injector) { return __async(this, null, function* () { return (yield injector.getEntity(EventEntity.KEY)).event; }); }; } // bazel-out/darwin-fastbuild/bin/client/assert/index.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ // bazel-out/darwin-fastbuild/bin/client/event/provide_qrl_exp.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function provideQrlExp(parameterName) { return function qrlExpProvider(injector) { return __async(this, null, function* () { const eventEntity = yield injector.getEntity(EventEntity.KEY); const value = eventEntity.props[parameterName]; if (value == null) { throw qError(5, parameterName, eventEntity.props); } switch (value.charAt(0)) { case ".": let obj = eventEntity.event; qDev && assertDefined(obj); const parts = value.substr(1).split("."); while (parts.length && obj) { obj = obj[parts.shift()]; } return obj; default: throw qError(500, value); } }); }; } // bazel-out/darwin-fastbuild/bin/client/event/provide_url.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function provideUrlProp(parameterName) { return function eventPropProvider(injector) { return __async(this, null, function* () { return (yield injector.getEntity(EventEntity.KEY)).props[parameterName] || null; }); }; } // bazel-out/darwin-fastbuild/bin/client/event/index.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ // bazel-out/darwin-fastbuild/bin/client/util/array.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function flattenArray(array, dst) { if (!dst) dst = []; for (let i = 0; i < array.length; i++) { const item = array[i]; if (Array.isArray(item)) { flattenArray(item, dst); } else { dst.push(item); } } return dst; } // bazel-out/darwin-fastbuild/bin/client/util/promises.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function flattenPromiseTree(tree) { return Promise.all(tree).then((values) => { const flatArray = flattenArray(values); for (let i = 0; i < flatArray.length; i++) { if (isPromise(flatArray[i])) { return flattenPromiseTree(flatArray); } } return flatArray; }); } function isPromise(value) { return value instanceof Promise; } // bazel-out/darwin-fastbuild/bin/client/import/qrl.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function QRL(messageParts, ...expressions) { let url = ""; for (let i = 0; i < messageParts.length; i++) { const part = messageParts[i]; url += part; if (i < expressions.length) { url += expressions[i]; } } qDev && assertEqual(!!url.match(/^[.|/|\w+:]/), true, "Expecting URL to start with '.', '/', ':'. Was: " + url); if (qDev) { verifyQrl(new Error("Invalid import: " + url), url); } return url; } function verifyQrl(error, url) { return __async(this, null, function* () { const stack = error.stack; if (!stack) return Promise.resolve(null); const frames = stack.split("\n"); let frame = ""; for (let i = 2; i < frames.length; i++) { frame = frames[i]; if (frame.indexOf("/node_modules/vm2/") === -1) { break; } } const base = getFilePathFromFrame(frame); const config = getConfig(base); try { const module2 = qImport(config, url); if (isPromise(module2)) { return module2.catch((e) => { return Promise.reject(makeError(e)); }); } return module2; } catch (e) { throw new Error(makeError(e)); } function makeError(e) { return `QRL-ERROR: '${url}' is not a valid import. Resolved URL: ${toUrl(base, url)} Base URL: ${config.baseURI} CONFIG: ${JSON.stringify(config)} STACK: ${stack} => ${e}`; } }); } // bazel-out/darwin-fastbuild/bin/client/import/index.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ // bazel-out/darwin-fastbuild/bin/client/injector/inject.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function injectFunction(...args) { const fn = args.pop(); fn.$thisType = null; fn.$inject = args; qDev && (fn.$debugStack = new Error()); return fn; } function injectMethod(...args) { const fn = args.pop(); fn.$thisType = args.shift(); fn.$inject = args; qDev && (fn.$debugStack = new Error()); return fn; } // bazel-out/darwin-fastbuild/bin/client/injector/provide_injector.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function provideInjector() { return function resolveInjector(injector) { return __async(this, null, function* () { return injector; }); }; } // bazel-out/darwin-fastbuild/bin/client/injector/provide_provider_of.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function provideProviderOf(provider) { return function resolveInjector(injector) { return __async(this, null, function* () { return () => { return Promise.resolve(provider(injector)); }; }); }; } // bazel-out/darwin-fastbuild/bin/client/injector/index.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ // bazel-out/darwin-fastbuild/bin/client/render/serialize_state.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function serializeState(element) { if (isHtmlElement(element)) { serializeNode(element); } element.querySelectorAll("[\\:]").forEach(serializeNode); } function serializeNode(element) { const injector = getInjector(element, false); if (injector) { injector.serialize(); } } // bazel-out/darwin-fastbuild/bin/client/render/index.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ // bazel-out/darwin-fastbuild/bin/client/render/jsx/html.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ // bazel-out/darwin-fastbuild/bin/client/util/flyweight.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ var EMPTY_ARRAY = []; if (qDev) { Object.freeze(EMPTY_ARRAY); } var EMPTY_OBJ = {}; if (qDev) { Object.freeze(EMPTY_OBJ); } // bazel-out/darwin-fastbuild/bin/client/render/jsx/factory.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ var JSXNode_ = class { constructor(tag, props, children) { this.tag = tag; this.props = props || EMPTY_OBJ; this.children = children; } }; function isJSXNode(node) { return node instanceof JSXNode_; } function jsxFactory(tag, props, ...children) { return new JSXNode_(tag, props, flattenArray(children)); } function jsxDeclareComponent(componentTemplateQrl, tagName = "div", hostProps) { return function(props) { return jsxFactory(tagName, Object.assign(Object.assign({["decl:template"]: componentTemplateQrl}, hostProps), props)); }; } // bazel-out/darwin-fastbuild/bin/client/util/dom.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function removeNode(parentNode, childNode) { const nextSibling = childNode.nextSibling; parentNode.removeChild(childNode); return nextSibling; } function replaceNode(parentNode, existingNode, newNode) { parentNode.insertBefore(newNode, existingNode); existingNode && parentNode.removeChild(existingNode); return newNode; } // bazel-out/darwin-fastbuild/bin/client/render/jsx/attributes.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function applyAttributes(element, props, detectChanges) { let changesDetected = false; if (props) { let bindMap = null; for (const key in props) { if (Object.prototype.hasOwnProperty.call(props, key)) { const kebabKey = fromCamelToKebabCase(key); const value = props[key]; if (key === "decl:entity") { applyEntityProviders(value, element); } else if (key === "decl:template") { setAttribute(element, "decl:template", value); } else if (key.startsWith("on:")) { setAttribute(element, kebabKey, value); } else { if (key.startsWith("$")) { addToBindMap(stringify(value), bindMap || (bindMap = new Map()), key); } else if (detectChanges) { if (element.getAttribute(kebabKey) !== value) { setAttribute(element, key, value, kebabKey); changesDetected = true; } } else { setAttribute(element, key, value, kebabKey); } } } } if (bindMap) { changesDetected = updateBindMap(element, bindMap) || changesDetected; } } return changesDetected; } function applyEntityProviders(value, element) { if (Array.isArray(value)) { value.forEach((entity) => { if (typeof (entity === null || entity === void 0 ? void 0 : entity.$attachEntity) === "function") { entity.$attachEntity(element); } else { throw qError(602, entity); } }); } else { throw qError(603, value); } } function addToBindMap(stringValue, bindMap, key) { qDev && assertValidDataKey(stringValue); const bindKey = "bind:" + (stringValue ? fromCamelToKebabCase(stringValue) : ""); let existingKeys = bindMap.get(bindKey); if (existingKeys) { existingKeys += "|" + key; } else { existingKeys = key; } bindMap.set(bindKey, existingKeys); } function updateBindMap(element, bindMap) { let changesDetected = false; for (let i = 0, attrs = element.attributes; i < attrs.length; i++) { const attr = attrs[i]; const key = attr.name; if (key.startsWith("bind:")) { const expectedValue = bindMap.get(key); if (expectedValue != null) { bindMap.delete(key); if (attr.value === expectedValue) { bindMap.delete(key); } else { changesDetected = true; attr.value = expectedValue; } } else { changesDetected = true; element.removeAttribute(key); i--; } } } bindMap.forEach((v, k) => { changesDetected = true; element.setAttribute(k, v); }); return changesDetected; } function setAttribute(element, key, value, kebabKey) { if (key == "class") { element.setAttribute("class", stringifyClassOrStyle(value, true)); } else if (key == "style") { element.setAttribute("style", stringifyClassOrStyle(value, false)); } else if (value == null || value === false) { element.removeAttribute(key); } else if (key === "innerHTML" || key === "innerText") { element.setAttribute(kebabKey, ""); element[key] = value; } else if (element.tagName === "INPUT" && key.indexOf(":") == -1) { element.setAttribute(key, String(value)); element[key] = value; } else { element.setAttribute(key, String(value)); } } function stringifyClassOrStyle(obj, isClass) { if (obj == null) return ""; if (typeof obj == "object") { let text = ""; let sep = ""; if (Array.isArray(obj)) { if (!isClass) { throw qError(601, obj, "style"); } for (let i = 0; i < obj.length; i++) { text += sep + obj[i]; sep = " "; } } else { for (const key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { const value = obj[key]; text += isClass ? value ? sep + key : "" : sep + key + ":" + value; sep = isClass ? " " : ";"; } } } return text; } return String(obj); } // bazel-out/darwin-fastbuild/bin/client/render/jsx/host.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function Host() { throw newError("Should not execute"); } // bazel-out/darwin-fastbuild/bin/client/render/jsx/render.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function jsxRender(host, jsxNode, overrideDocument) { return __async(this, null, function* () { const waitOn = []; let firstChild = host.firstChild; while (firstChild && firstChild.nodeType > 8) { firstChild = firstChild.nextSibling; } visitJSXNode(overrideDocument || document, waitOn, host, firstChild, jsxNode); return flattenPromiseTree(waitOn); }); } function visitJSXNode(document2, waitOn, parentNode, existingNode, jsxNode) { if (!jsxNode) return null; if (isPromise(jsxNode)) { waitOn.push(jsxNode.then((jsxNode2) => { const waitOn2 = []; const node = visitJSXNode(document2, waitOn2, parentNode, existingNode, jsxNode2); node && waitOn2.push(node); return waitOn2; }, writeErrorToDom(parentNode))); return null; } else if (typeof jsxNode.tag === "string") { return visitJSXDomNode(document2, waitOn, parentNode, existingNode, jsxNode); } else if (jsxNode.tag === Host) { return visitJSXHostNode(document2, waitOn, parentNode, existingNode, jsxNode); } else if (typeof jsxNode.tag === "function") { return visitJSXFactoryNode(document2, waitOn, parentNode, existingNode, jsxNode); } else if (jsxNode.tag === null) { return visitJSXFragmentNode(document2, waitOn, parentNode, existingNode, jsxNode); } throw qError(600, jsxNode.tag); } function visitJSXDomNode(document2, waitOn, parentNode, existingNode, jsxNode) { const jsxTag = jsxNode.tag; let reconcileElement; let inputPropChangesDetected = false; if (isDomElementWithTagName(existingNode, jsxTag)) { reconcileElement = existingNode; } else { reconcileElement = replaceNode(parentNode, existingNode, document2.createElement(jsxTag)); inputPropChangesDetected = true; } const componentUrl = getComponentTemplateUrl(jsxNode); const shouldDetectChanges = !!componentUrl; inputPropChangesDetected = applyAttributes(reconcileElement, jsxNode.props, shouldDetectChanges) || inputPropChangesDetected; if (componentUrl && inputPropChangesDetected) { jsxRenderComponent(reconcileElement, componentUrl, waitOn, jsxNode.props, document2); } if (!componentUrl && !("innerHTML" in jsxNode.props || "innerText" in jsxNode.props)) { visitChildren(document2, waitOn, reconcileElement, reconcileElement.firstChild, jsxNode.children); } return reconcileElement; } function jsxRenderComponent(hostElement, componentUrl, waitOn, props, overrideDocument = document) { const componentOrPromise = qImport(hostElement, componentUrl); if (isPromise(componentOrPromise)) { waitOn.push(componentOrPromise.then((component) => { const waitOn2 = [hostElement]; visitJSXComponentNode(overrideDocument, waitOn2, hostElement, hostElement.firstChild, component, props); return waitOn2; })); } else { visitJSXComponentNode(overrideDocument, waitOn, hostElement, hostElement.firstChild, componentOrPromise, props); } } function visitJSXComponentNode(document2, waitOn, parentNode, existingNode, component, props) { if (!props) props = EMPTY_OBJ; const injector = getInjector(parentNode); injector.elementProps = props; const componentJsxNode = injector.invoke(component, void 0, props); return visitJSXNode(document2, waitOn, parentNode, existingNode, componentJsxNode); } function getComponentTemplateUrl(jsxNode) { const props = jsxNode.props || EMPTY_OBJ; return props["decl:template"] || null; } function visitJSXFactoryNode(document2, waitOn, parentNode, existingNode, jsxNode) { return visitJSXNode(document2, waitOn, parentNode, existingNode, jsxNode.tag(jsxNode.props)); } function visitJSXHostNode(document2, waitOn, parentNode, existingNode, jsxNode) { applyAttributes(parentNode, jsxNode.props, false); visitChildren(document2, waitOn, parentNode, existingNode, jsxNode.children); return parentNode; } function visitJSXFragmentNode(document2, waitOn, parentNode, existingNode, jsxNode) { return visitChildren(document2, waitOn, parentNode, existingNode, jsxNode.children); } function visitChildren(document2, waitOn, parentNode, existingNode, jsxChildren) { if (jsxChildren) { for (let i = 0; i < jsxChildren.length; i++) { const jsxChild = jsxChildren[i]; if (isJSXNode(jsxChild)) { existingNode = visitJSXNode(document2, waitOn, parentNode, existingNode, jsxChild); } else if (jsxChild == null) { if (existingNode) { existingNode = removeNode(parentNode, existingNode); } } else { if (isTextNode(existingNode)) { existingNode.textContent = String(jsxChild); } else { replaceNode(parentNode, existingNode, document2.createTextNode(String(jsxChild))); } } existingNode = (existingNode === null || existingNode === void 0 ? void 0 : existingNode.nextSibling) || null; } } while (existingNode) { existingNode = removeNode(parentNode, existingNode); } return null; } function writeErrorToDom(node) { return function(error) { console.error("ERROR:", error); const element = node; const pre = element.ownerDocument.createElement("pre"); element.appendChild(pre); pre.textContent = String(error); return Promise.reject(error); }; } // bazel-out/darwin-fastbuild/bin/client/util/element.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function isElement(value) { return value && !!value.ownerDocument; } // bazel-out/darwin-fastbuild/bin/client/render/jsx/mark_dirty.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function markDirty(componentEntityOrElement) { if (isEntity(componentEntityOrElement)) { return markEntityDirty(componentEntityOrElement); } else if (isComponent(componentEntityOrElement)) { return markComponentDirty(componentEntityOrElement); } else if (isElement(componentEntityOrElement)) { return markElementDirty(componentEntityOrElement); } else { throw qError(604, componentEntityOrElement); } } function markComponentDirty(component) { return markElementDirty(component.$host); } function markElementDirty(host) { const document2 = host.ownerDocument; host.setAttribute("on:q-render", host.getAttribute("decl:template")); const promise = document2.$qScheduledRender; if (isPromise(promise)) { return promise; } return scheduleRender(document2); } function markEntityDirty(entity) { const key = entity.$key; const document2 = entity.$element.ownerDocument; let foundListener = false; document2.querySelectorAll(toAttrQuery("bind:" + key)).forEach((componentElement) => { const qrl = componentElement.getAttribute("decl:template"); if (!qrl) { throw qError(606, key, componentElement); } foundListener = true; componentElement.setAttribute("on:q-render", qrl); }); return foundListener ? scheduleRender(document2) : Promise.resolve([]); } function toAttrQuery(key) { return "[" + key.replace(/[:.\-_]/g, (v) => "\\" + v) + "]"; } function scheduleRender(document2) { const promise = document2.$qScheduledRender; if (promise) return promise; const requestAnimationFrame = document2.defaultView.requestAnimationFrame; if (!requestAnimationFrame) { throw qError(605); } return document2.$qScheduledRender = new Promise((resolve, reject) => { requestAnimationFrame(() => { const waitOn = []; const componentHosts = document2.querySelectorAll("[on\\:q-render]"); const hosts = []; componentHosts.forEach((host) => { host.removeAttribute("on:q-render"); const qrl = host.getAttribute("decl:template"); qDev && assertString(qrl); const props = extractPropsFromElement(host); jsxRenderComponent(host, qrl, waitOn, props, document2); hosts.push(host); }); flattenPromiseTree(waitOn).then(() => { document2.$qScheduledRender = null; resolve(hosts); }, reject); }); }); } // bazel-out/darwin-fastbuild/bin/client/render/jsx/index.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ // bazel-out/darwin-fastbuild/bin/client/entity/index.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ // bazel-out/darwin-fastbuild/bin/client/provider/provide_component_state.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function provideComponentState(throwIfNotFound = true) { return function componentStateProvider(injector) { const state = injector.element.getAttribute(":."); if (state == null) { if (throwIfNotFound) { throw qError(402); } else { return void 0; } } return JSON.parse(state); }; } // bazel-out/darwin-fastbuild/bin/client/provider/provide_component_props.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function provideComponentProps() { return function propsComponentProvider(injector) { const props = injector.elementProps; qDev && assertDefined(props); return props; }; } // bazel-out/darwin-fastbuild/bin/client/provider/provide_component_prop.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function provideComponentProp(name) { return function componentPropProvider(injector) { const elementInjector = getClosestInjector(injector.element); const props = elementInjector.elementProps; const value = props[name]; if (value == null) { throw qError(404, name, elementInjector.elementProps, elementInjector.element); } return value; }; } // bazel-out/darwin-fastbuild/bin/client/provider/provide_entity.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function provideEntity(id) { return function resolveEntity(injector) { return __async(this, null, function* () { const elementInjector = getClosestInjector(injector.element); const [idResolved] = yield resolveArgs(injector, id); return elementInjector.getEntity(idResolved); }); }; } // bazel-out/darwin-fastbuild/bin/client/provider/provide_entity_state.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ function provideEntityState(id) { return function resolveEntityState(injector) { return __async(this, null, function* () { const elementInjector = getClosestInjector(injector.element); const [idResolved] = yield resolveArgs(injector, id); return elementInjector.getEntityState(idResolved); }); }; } // bazel-out/darwin-fastbuild/bin/client/provider/index.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ // bazel-out/darwin-fastbuild/bin/client/index.js /** * @license * Copyright Builder.io, Inc. 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/BuilderIO/qwik/blob/main/LICENSE */ // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { Component, Entity, EventEntity, Host, QRL, dirname, emitEvent, entityStateKey, getInjector, injectEventHandler, injectFunction, injectMethod, jsxDeclareComponent, jsxFactory, jsxRender, markDirty, provideComponentProp, provideComponentProps, provideComponentState, provideElement, provideEntity, provideEntityState, provideEvent, provideInjector, provideProviderOf, provideQrlExp, provideUrlProp, qImport, serializeState, setConfig, toEntityKey }); //# sourceMappingURL=qwik.cjs.map