UNPKG

@bentoproject/accordion

Version:

Displays content sections that can be collapsed and expanded.

1,594 lines (1,566 loc) 136 kB
// src/core/mode/prod.js function isProd() { return false; } // src/core/mode/test.js function isTest(opt_win) { var _win$AMP_CONFIG; if (isProd()) { return false; } const win = opt_win || self; return !!((_win$AMP_CONFIG = win.AMP_CONFIG) != null && _win$AMP_CONFIG.test || win.__AMP_TEST || win["__karma__"]); } // src/core/mode/local-dev.js function isLocalDev(opt_win) { var _self$AMP_CONFIG; if (isProd()) { return false; } return !!((_self$AMP_CONFIG = self.AMP_CONFIG) != null && _self$AMP_CONFIG.localDev) || isTest(opt_win); } // src/core/mode/minified.js function isMinified() { return false; } // src/core/mode/esm.js function isEsm() { var _self$__AMP_MODE$esm, _self, _self$__AMP_MODE; if (isProd()) { return true; } return (_self$__AMP_MODE$esm = (_self = self) == null ? void 0 : (_self$__AMP_MODE = _self.__AMP_MODE) == null ? void 0 : _self$__AMP_MODE.esm) != null ? _self$__AMP_MODE$esm : true; } // src/core/types/array.js function toArray(arrayLike) { return arrayLike ? Array.prototype.slice.call(arrayLike) : []; } var { isArray } = Array; function arrayOrSingleItemToArray(arrayOrSingleItem) { return isArray(arrayOrSingleItem) ? arrayOrSingleItem : [ arrayOrSingleItem ]; } function remove(array, shouldRemove) { const removed = []; let index = 0; for (let i3 = 0; i3 < array.length; i3++) { const item = array[i3]; if (shouldRemove(item, i3, array)) { removed.push(item); } else { if (index < i3) { array[index] = item; } index++; } } if (index < array.length) { array.length = index; } return removed; } function pushIfNotExist(array, item) { if (array.indexOf(item) < 0) { array.push(item); return true; } return false; } function removeItem(array, item) { const index = array.indexOf(item); if (index == -1) { return false; } array.splice(index, 1); return true; } // src/core/types/object/index.js var { hasOwnProperty: hasOwn_, toString: toString_ } = Object.prototype; function map(opt_initial) { const obj = Object.create(null); if (opt_initial) { Object.assign(obj, opt_initial); } return obj; } function dict(opt_initial) { return opt_initial || {}; } function hasOwn(obj, key) { return hasOwn_.call(obj, key); } function omit(o3, props) { return Object.keys(o3).reduce((acc, key) => { if (!props.includes(key)) { acc[key] = o3[key]; } return acc; }, {}); } function objectsEqualShallow(o1, o22) { if (o1 == null || o22 == null) { return o1 === o22; } for (const k3 in o1) { if (o1[k3] !== o22[k3]) { return false; } } for (const k3 in o22) { if (o22[k3] !== o1[k3]) { return false; } } return true; } function memo(obj, prop, factory) { let result = obj[prop]; if (result === void 0) { result = factory(obj, prop); obj[prop] = result; } return result; } // src/core/types/index.js function isElement(value) { return (value == null ? void 0 : value.nodeType) == 1; } // src/core/error/message-helpers.js function elementStringOrPassThru(val) { if (isElement(val)) { val = val; return val.tagName.toLowerCase() + (val.id ? `#${val.id}` : ""); } return val; } // src/core/assert/base.js function assert(sentinel, shouldBeTruthy, opt_message = "Assertion failed", var_args) { if (shouldBeTruthy) { return shouldBeTruthy; } if (sentinel && opt_message.indexOf(sentinel) == -1) { opt_message += sentinel; } let i3 = 3; const splitMessage = opt_message.split("%s"); let message = splitMessage.shift(); const messageArray = [message]; while (splitMessage.length) { const subValue = arguments[i3++]; const nextConstant = splitMessage.shift(); message += elementStringOrPassThru(subValue) + nextConstant; messageArray.push(subValue, nextConstant.trim()); } const error = new Error(message); error.messageArray = remove(messageArray, (x3) => x3 !== ""); self.__AMP_REPORT_ERROR == null ? void 0 : self.__AMP_REPORT_ERROR(error); throw error; } function assertType_(assertFn, subject, shouldBeTruthy, defaultMessage, opt_message) { if (isArray(opt_message)) { assertFn(shouldBeTruthy, opt_message.concat([subject])); } else { assertFn(shouldBeTruthy, `${opt_message || defaultMessage}: %s`, subject); } return subject; } function assertElement(assertFn, shouldBeElement, opt_message) { return assertType_(assertFn, shouldBeElement, isElement(shouldBeElement), "Element expected", opt_message); } // src/core/assert/dev.js function devAssertDceCheck() { if (self.__AMP_ASSERTION_CHECK) { console.log("__devAssert_sentinel__"); } } function devAssert(shouldBeTruthy, opt_message, opt_1, opt_2, opt_3, opt_4, opt_5, opt_6, opt_7, opt_8, opt_9) { if (isMinified()) { return shouldBeTruthy; } devAssertDceCheck(); return assert("", shouldBeTruthy, opt_message, opt_1, opt_2, opt_3, opt_4, opt_5, opt_6, opt_7, opt_8, opt_9); } function devAssertElement(shouldBeElement, opt_message) { if (isMinified()) { return shouldBeElement; } devAssertDceCheck(); return assertElement(devAssert, shouldBeElement, opt_message); } // src/core/window/index.js function toWin(winOrNull) { return winOrNull; } function getWin(node) { return toWin((node.ownerDocument || node).defaultView); } // src/core/dom/css-selectors.js var scopeSelectorSupported; function isScopeSelectorSupported(el) { if (scopeSelectorSupported !== void 0) { return scopeSelectorSupported; } return scopeSelectorSupported = testScopeSelector(el); } function testScopeSelector(el) { try { const doc = el.ownerDocument; const testElement = doc.createElement("div"); const testChild = doc.createElement("div"); testElement.appendChild(testChild); return testElement.querySelector(":scope div") === testChild; } catch (e3) { return false; } } function prependSelectorsWith(selector, distribute) { return selector.replace(/^|,/g, `$&${distribute} `); } // src/core/dom/query.js function assertIsName(name) { devAssert(/^[\w-]+$/.test(name), `Expected "${name}" to be a CSS name composed of alphanumerics and hyphens.`); } function scopedQuerySelectionFallback(root, selector) { const { classList } = root; const unique = "i-amphtml-scoped"; classList.add(unique); const scopedSelector = prependSelectorsWith(selector, `.${unique}`); const elements = root.querySelectorAll(scopedSelector); classList.remove(unique); return elements; } function scopedQuerySelector(root, selector) { if (isEsm() || isScopeSelectorSupported(root)) { return root.querySelector(prependSelectorsWith(selector, ":scope")); } const fallbackResult = scopedQuerySelectionFallback(root, selector)[0]; return fallbackResult === void 0 ? null : fallbackResult; } function scopedQuerySelectorAll(root, selector) { if (isEsm() || isScopeSelectorSupported(root)) { return root.querySelectorAll(prependSelectorsWith(selector, ":scope")); } return scopedQuerySelectionFallback(root, selector); } function matches(el, selector) { const matcher = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector || el.oMatchesSelector; if (matcher) { return matcher.call(el, selector); } return false; } function childNodes(parent, callback) { const nodes = []; for (let child = parent.firstChild; child; child = child.nextSibling) { if (callback(child)) { nodes.push(child); } } return nodes; } function childElementByAttr(parent, attr) { assertIsName(attr); return scopedQuerySelector(parent, `> [${attr}]`); } function childElementByTag(parent, tagName) { assertIsName(tagName); return scopedQuerySelector(parent, `> ${tagName}`); } function childElementsByTag(parent, tagName) { assertIsName(tagName); return scopedQuerySelectorAll(parent, `> ${tagName}`); } function realChildNodes(element) { return childNodes(element, (node) => !isInternalOrServiceNode(node)); } function isInternalOrServiceNode(node) { if (isInternalElement(node)) { return true; } if (node.nodeType !== Node.ELEMENT_NODE) { return false; } const el = devAssertElement(node); return el.hasAttribute("placeholder") || el.hasAttribute("fallback") || el.hasAttribute("overflow"); } function isInternalElement(nodeOrTagName) { let tagName; if (typeof nodeOrTagName == "string") { tagName = nodeOrTagName; } else if (nodeOrTagName.nodeType === Node.ELEMENT_NODE) { tagName = devAssertElement(nodeOrTagName).tagName; } return !!tagName && tagName.toLowerCase().startsWith("i-"); } // src/core/dom/index.js var DEFAULT_CUSTOM_EVENT_OPTIONS = { bubbles: true, cancelable: true }; function addAttributesToElement(element, attributes) { for (const attr in attributes) { element.setAttribute(attr, attributes[attr]); } return element; } function createElementWithAttributes(doc, tagName, attributes) { const element = doc.createElement(tagName); return addAttributesToElement(element, attributes); } function toggleAttribute(element, name, forced) { const hasAttribute = element.hasAttribute(name); const enabled = forced !== void 0 ? forced : !hasAttribute; if (enabled !== hasAttribute) { if (enabled) { element.setAttribute(name, ""); } else { element.removeAttribute(name); } } return enabled; } function parseBooleanAttribute(s3) { return s3 == null ? void 0 : s3 !== "false"; } function dispatchCustomEvent(node, name, opt_data, opt_options) { const data = opt_data || {}; const event = devAssert(node.ownerDocument).createEvent("Event"); event.data = data; const { bubbles, cancelable } = opt_options || DEFAULT_CUSTOM_EVENT_OPTIONS; event.initEvent(name, bubbles, cancelable); node.dispatchEvent(event); } // src/core/data-structures/promise.js var resolved; function resolvedPromise() { if (resolved) { return resolved; } resolved = Promise.resolve(void 0); return resolved; } var Deferred = function Deferred2() { this.promise = new Promise((res, rej) => { this.resolve = res; this.reject = rej; }); }; // node_modules/preact/dist/preact.module.js var n; var l; var u; var i; var t; var r; var o; var f; var e = {}; var c = []; var s = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i; function a(n2, l3) { for (var u3 in l3) n2[u3] = l3[u3]; return n2; } function h(n2) { var l3 = n2.parentNode; l3 && l3.removeChild(n2); } function v(l3, u3, i3) { var t3, r3, o3, f3 = {}; for (o3 in u3) o3 == "key" ? t3 = u3[o3] : o3 == "ref" ? r3 = u3[o3] : f3[o3] = u3[o3]; if (arguments.length > 2 && (f3.children = arguments.length > 3 ? n.call(arguments, 2) : i3), typeof l3 == "function" && l3.defaultProps != null) for (o3 in l3.defaultProps) f3[o3] === void 0 && (f3[o3] = l3.defaultProps[o3]); return y(l3, f3, t3, r3, null); } function y(n2, i3, t3, r3, o3) { var f3 = { type: n2, props: i3, key: t3, ref: r3, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: o3 == null ? ++u : o3 }; return o3 == null && l.vnode != null && l.vnode(f3), f3; } function d(n2) { return n2.children; } function _(n2, l3) { this.props = n2, this.context = l3; } function k(n2, l3) { if (l3 == null) return n2.__ ? k(n2.__, n2.__.__k.indexOf(n2) + 1) : null; for (var u3; l3 < n2.__k.length; l3++) if ((u3 = n2.__k[l3]) != null && u3.__e != null) return u3.__e; return typeof n2.type == "function" ? k(n2) : null; } function b(n2) { var l3, u3; if ((n2 = n2.__) != null && n2.__c != null) { for (n2.__e = n2.__c.base = null, l3 = 0; l3 < n2.__k.length; l3++) if ((u3 = n2.__k[l3]) != null && u3.__e != null) { n2.__e = n2.__c.base = u3.__e; break; } return b(n2); } } function m(n2) { (!n2.__d && (n2.__d = true) && t.push(n2) && !g.__r++ || o !== l.debounceRendering) && ((o = l.debounceRendering) || r)(g); } function g() { for (var n2; g.__r = t.length; ) n2 = t.sort(function(n3, l3) { return n3.__v.__b - l3.__v.__b; }), t = [], n2.some(function(n3) { var l3, u3, i3, t3, r3, o3; n3.__d && (r3 = (t3 = (l3 = n3).__v).__e, (o3 = l3.__P) && (u3 = [], (i3 = a({}, t3)).__v = t3.__v + 1, j(o3, t3, i3, l3.__n, o3.ownerSVGElement !== void 0, t3.__h != null ? [r3] : null, u3, r3 == null ? k(t3) : r3, t3.__h), z(u3, t3), t3.__e != r3 && b(t3))); }); } function w(n2, l3, u3, i3, t3, r3, o3, f3, s3, a3) { var h3, v3, p3, _3, b3, m3, g3, w3 = i3 && i3.__k || c, A3 = w3.length; for (u3.__k = [], h3 = 0; h3 < l3.length; h3++) if ((_3 = u3.__k[h3] = (_3 = l3[h3]) == null || typeof _3 == "boolean" ? null : typeof _3 == "string" || typeof _3 == "number" || typeof _3 == "bigint" ? y(null, _3, null, null, _3) : Array.isArray(_3) ? y(d, { children: _3 }, null, null, null) : _3.__b > 0 ? y(_3.type, _3.props, _3.key, null, _3.__v) : _3) != null) { if (_3.__ = u3, _3.__b = u3.__b + 1, (p3 = w3[h3]) === null || p3 && _3.key == p3.key && _3.type === p3.type) w3[h3] = void 0; else for (v3 = 0; v3 < A3; v3++) { if ((p3 = w3[v3]) && _3.key == p3.key && _3.type === p3.type) { w3[v3] = void 0; break; } p3 = null; } j(n2, _3, p3 = p3 || e, t3, r3, o3, f3, s3, a3), b3 = _3.__e, (v3 = _3.ref) && p3.ref != v3 && (g3 || (g3 = []), p3.ref && g3.push(p3.ref, null, _3), g3.push(v3, _3.__c || b3, _3)), b3 != null ? (m3 == null && (m3 = b3), typeof _3.type == "function" && _3.__k === p3.__k ? _3.__d = s3 = x(_3, s3, n2) : s3 = P(n2, _3, p3, w3, b3, s3), typeof u3.type == "function" && (u3.__d = s3)) : s3 && p3.__e == s3 && s3.parentNode != n2 && (s3 = k(p3)); } for (u3.__e = m3, h3 = A3; h3--; ) w3[h3] != null && (typeof u3.type == "function" && w3[h3].__e != null && w3[h3].__e == u3.__d && (u3.__d = k(i3, h3 + 1)), N(w3[h3], w3[h3])); if (g3) for (h3 = 0; h3 < g3.length; h3++) M(g3[h3], g3[++h3], g3[++h3]); } function x(n2, l3, u3) { for (var i3, t3 = n2.__k, r3 = 0; t3 && r3 < t3.length; r3++) (i3 = t3[r3]) && (i3.__ = n2, l3 = typeof i3.type == "function" ? x(i3, l3, u3) : P(u3, i3, i3, t3, i3.__e, l3)); return l3; } function P(n2, l3, u3, i3, t3, r3) { var o3, f3, e3; if (l3.__d !== void 0) o3 = l3.__d, l3.__d = void 0; else if (u3 == null || t3 != r3 || t3.parentNode == null) n: if (r3 == null || r3.parentNode !== n2) n2.appendChild(t3), o3 = null; else { for (f3 = r3, e3 = 0; (f3 = f3.nextSibling) && e3 < i3.length; e3 += 2) if (f3 == t3) break n; n2.insertBefore(t3, r3), o3 = r3; } return o3 !== void 0 ? o3 : t3.nextSibling; } function C(n2, l3, u3, i3, t3) { var r3; for (r3 in u3) r3 === "children" || r3 === "key" || r3 in l3 || H(n2, r3, null, u3[r3], i3); for (r3 in l3) t3 && typeof l3[r3] != "function" || r3 === "children" || r3 === "key" || r3 === "value" || r3 === "checked" || u3[r3] === l3[r3] || H(n2, r3, l3[r3], u3[r3], i3); } function $(n2, l3, u3) { l3[0] === "-" ? n2.setProperty(l3, u3) : n2[l3] = u3 == null ? "" : typeof u3 != "number" || s.test(l3) ? u3 : u3 + "px"; } function H(n2, l3, u3, i3, t3) { var r3; n: if (l3 === "style") { if (typeof u3 == "string") n2.style.cssText = u3; else { if (typeof i3 == "string" && (n2.style.cssText = i3 = ""), i3) for (l3 in i3) u3 && l3 in u3 || $(n2.style, l3, ""); if (u3) for (l3 in u3) i3 && u3[l3] === i3[l3] || $(n2.style, l3, u3[l3]); } } else if (l3[0] === "o" && l3[1] === "n") r3 = l3 !== (l3 = l3.replace(/Capture$/, "")), l3 = l3.toLowerCase() in n2 ? l3.toLowerCase().slice(2) : l3.slice(2), n2.l || (n2.l = {}), n2.l[l3 + r3] = u3, u3 ? i3 || n2.addEventListener(l3, r3 ? T : I, r3) : n2.removeEventListener(l3, r3 ? T : I, r3); else if (l3 !== "dangerouslySetInnerHTML") { if (t3) l3 = l3.replace(/xlink[H:h]/, "h").replace(/sName$/, "s"); else if (l3 !== "href" && l3 !== "list" && l3 !== "form" && l3 !== "tabIndex" && l3 !== "download" && l3 in n2) try { n2[l3] = u3 == null ? "" : u3; break n; } catch (n3) { } typeof u3 == "function" || (u3 != null && (u3 !== false || l3[0] === "a" && l3[1] === "r") ? n2.setAttribute(l3, u3) : n2.removeAttribute(l3)); } } function I(n2) { this.l[n2.type + false](l.event ? l.event(n2) : n2); } function T(n2) { this.l[n2.type + true](l.event ? l.event(n2) : n2); } function j(n2, u3, i3, t3, r3, o3, f3, e3, c3) { var s3, h3, v3, y3, p3, k3, b3, m3, g3, x3, A3, P2 = u3.type; if (u3.constructor !== void 0) return null; i3.__h != null && (c3 = i3.__h, e3 = u3.__e = i3.__e, u3.__h = null, o3 = [e3]), (s3 = l.__b) && s3(u3); try { n: if (typeof P2 == "function") { if (m3 = u3.props, g3 = (s3 = P2.contextType) && t3[s3.__c], x3 = s3 ? g3 ? g3.props.value : s3.__ : t3, i3.__c ? b3 = (h3 = u3.__c = i3.__c).__ = h3.__E : ("prototype" in P2 && P2.prototype.render ? u3.__c = h3 = new P2(m3, x3) : (u3.__c = h3 = new _(m3, x3), h3.constructor = P2, h3.render = O), g3 && g3.sub(h3), h3.props = m3, h3.state || (h3.state = {}), h3.context = x3, h3.__n = t3, v3 = h3.__d = true, h3.__h = []), h3.__s == null && (h3.__s = h3.state), P2.getDerivedStateFromProps != null && (h3.__s == h3.state && (h3.__s = a({}, h3.__s)), a(h3.__s, P2.getDerivedStateFromProps(m3, h3.__s))), y3 = h3.props, p3 = h3.state, v3) P2.getDerivedStateFromProps == null && h3.componentWillMount != null && h3.componentWillMount(), h3.componentDidMount != null && h3.__h.push(h3.componentDidMount); else { if (P2.getDerivedStateFromProps == null && m3 !== y3 && h3.componentWillReceiveProps != null && h3.componentWillReceiveProps(m3, x3), !h3.__e && h3.shouldComponentUpdate != null && h3.shouldComponentUpdate(m3, h3.__s, x3) === false || u3.__v === i3.__v) { h3.props = m3, h3.state = h3.__s, u3.__v !== i3.__v && (h3.__d = false), h3.__v = u3, u3.__e = i3.__e, u3.__k = i3.__k, u3.__k.forEach(function(n3) { n3 && (n3.__ = u3); }), h3.__h.length && f3.push(h3); break n; } h3.componentWillUpdate != null && h3.componentWillUpdate(m3, h3.__s, x3), h3.componentDidUpdate != null && h3.__h.push(function() { h3.componentDidUpdate(y3, p3, k3); }); } h3.context = x3, h3.props = m3, h3.state = h3.__s, (s3 = l.__r) && s3(u3), h3.__d = false, h3.__v = u3, h3.__P = n2, s3 = h3.render(h3.props, h3.state, h3.context), h3.state = h3.__s, h3.getChildContext != null && (t3 = a(a({}, t3), h3.getChildContext())), v3 || h3.getSnapshotBeforeUpdate == null || (k3 = h3.getSnapshotBeforeUpdate(y3, p3)), A3 = s3 != null && s3.type === d && s3.key == null ? s3.props.children : s3, w(n2, Array.isArray(A3) ? A3 : [A3], u3, i3, t3, r3, o3, f3, e3, c3), h3.base = u3.__e, u3.__h = null, h3.__h.length && f3.push(h3), b3 && (h3.__E = h3.__ = null), h3.__e = false; } else o3 == null && u3.__v === i3.__v ? (u3.__k = i3.__k, u3.__e = i3.__e) : u3.__e = L(i3.__e, u3, i3, t3, r3, o3, f3, c3); (s3 = l.diffed) && s3(u3); } catch (n3) { u3.__v = null, (c3 || o3 != null) && (u3.__e = e3, u3.__h = !!c3, o3[o3.indexOf(e3)] = null), l.__e(n3, u3, i3); } } function z(n2, u3) { l.__c && l.__c(u3, n2), n2.some(function(u4) { try { n2 = u4.__h, u4.__h = [], n2.some(function(n3) { n3.call(u4); }); } catch (n3) { l.__e(n3, u4.__v); } }); } function L(l3, u3, i3, t3, r3, o3, f3, c3) { var s3, a3, v3, y3 = i3.props, p3 = u3.props, d2 = u3.type, _3 = 0; if (d2 === "svg" && (r3 = true), o3 != null) { for (; _3 < o3.length; _3++) if ((s3 = o3[_3]) && (s3 === l3 || (d2 ? s3.localName == d2 : s3.nodeType == 3))) { l3 = s3, o3[_3] = null; break; } } if (l3 == null) { if (d2 === null) return document.createTextNode(p3); l3 = r3 ? document.createElementNS("http://www.w3.org/2000/svg", d2) : document.createElement(d2, p3.is && p3), o3 = null, c3 = false; } if (d2 === null) y3 === p3 || c3 && l3.data === p3 || (l3.data = p3); else { if (o3 = o3 && n.call(l3.childNodes), a3 = (y3 = i3.props || e).dangerouslySetInnerHTML, v3 = p3.dangerouslySetInnerHTML, !c3) { if (o3 != null) for (y3 = {}, _3 = 0; _3 < l3.attributes.length; _3++) y3[l3.attributes[_3].name] = l3.attributes[_3].value; (v3 || a3) && (v3 && (a3 && v3.__html == a3.__html || v3.__html === l3.innerHTML) || (l3.innerHTML = v3 && v3.__html || "")); } if (C(l3, p3, y3, r3, c3), v3) u3.__k = []; else if (_3 = u3.props.children, w(l3, Array.isArray(_3) ? _3 : [_3], u3, i3, t3, r3 && d2 !== "foreignObject", o3, f3, o3 ? o3[0] : i3.__k && k(i3, 0), c3), o3 != null) for (_3 = o3.length; _3--; ) o3[_3] != null && h(o3[_3]); c3 || ("value" in p3 && (_3 = p3.value) !== void 0 && (_3 !== l3.value || d2 === "progress" && !_3) && H(l3, "value", _3, y3.value, false), "checked" in p3 && (_3 = p3.checked) !== void 0 && _3 !== l3.checked && H(l3, "checked", _3, y3.checked, false)); } return l3; } function M(n2, u3, i3) { try { typeof n2 == "function" ? n2(u3) : n2.current = u3; } catch (n3) { l.__e(n3, i3); } } function N(n2, u3, i3) { var t3, r3; if (l.unmount && l.unmount(n2), (t3 = n2.ref) && (t3.current && t3.current !== n2.__e || M(t3, null, u3)), (t3 = n2.__c) != null) { if (t3.componentWillUnmount) try { t3.componentWillUnmount(); } catch (n3) { l.__e(n3, u3); } t3.base = t3.__P = null; } if (t3 = n2.__k) for (r3 = 0; r3 < t3.length; r3++) t3[r3] && N(t3[r3], u3, typeof n2.type != "function"); i3 || n2.__e == null || h(n2.__e), n2.__e = n2.__d = void 0; } function O(n2, l3, u3) { return this.constructor(n2, u3); } function S(u3, i3, t3) { var r3, o3, f3; l.__ && l.__(u3, i3), o3 = (r3 = typeof t3 == "function") ? null : t3 && t3.__k || i3.__k, f3 = [], j(i3, u3 = (!r3 && t3 || i3).__k = v(d, null, [u3]), o3 || e, e, i3.ownerSVGElement !== void 0, !r3 && t3 ? [t3] : o3 ? null : i3.firstChild ? n.call(i3.childNodes) : null, f3, !r3 && t3 ? t3 : o3 ? o3.__e : i3.firstChild, r3), z(f3, u3); } function q(n2, l3) { S(n2, l3, q); } function D(n2, l3) { var u3 = { __c: l3 = "__cC" + f++, __: n2, Consumer: function(n3, l4) { return n3.children(l4); }, Provider: function(n3) { var u4, i3; return this.getChildContext || (u4 = [], (i3 = {})[l3] = this, this.getChildContext = function() { return i3; }, this.shouldComponentUpdate = function(n4) { this.props.value !== n4.value && u4.some(m); }, this.sub = function(n4) { u4.push(n4); var l4 = n4.componentWillUnmount; n4.componentWillUnmount = function() { u4.splice(u4.indexOf(n4), 1), l4 && l4.call(n4); }; }), n3.children; } }; return u3.Provider.__ = u3.Consumer.contextType = u3; } n = c.slice, l = { __e: function(n2, l3) { for (var u3, i3, t3; l3 = l3.__; ) if ((u3 = l3.__c) && !u3.__) try { if ((i3 = u3.constructor) && i3.getDerivedStateFromError != null && (u3.setState(i3.getDerivedStateFromError(n2)), t3 = u3.__d), u3.componentDidCatch != null && (u3.componentDidCatch(n2), t3 = u3.__d), t3) return u3.__E = u3; } catch (l4) { n2 = l4; } throw n2; } }, u = 0, i = function(n2) { return n2 != null && n2.constructor === void 0; }, _.prototype.setState = function(n2, l3) { var u3; u3 = this.__s != null && this.__s !== this.state ? this.__s : this.__s = a({}, this.state), typeof n2 == "function" && (n2 = n2(a({}, u3), this.props)), n2 && a(u3, n2), n2 != null && this.__v && (l3 && this.__h.push(l3), m(this)); }, _.prototype.forceUpdate = function(n2) { this.__v && (this.__e = true, n2 && this.__h.push(n2), m(this)); }, _.prototype.render = d, t = [], r = typeof Promise == "function" ? Promise.prototype.then.bind(resolvedPromise()) : setTimeout, g.__r = 0, f = 0; // node_modules/preact/hooks/dist/hooks.module.js var t2; var u2; var r2; var o2 = 0; var i2 = []; var c2 = l.__b; var f2 = l.__r; var e2 = l.diffed; var a2 = l.__c; var v2 = l.unmount; function m2(t3, r3) { l.__h && l.__h(u2, t3, o2 || r3), o2 = 0; var i3 = u2.__H || (u2.__H = { __: [], __h: [] }); return t3 >= i3.__.length && i3.__.push({}), i3.__[t3]; } function l2(n2) { return o2 = 1, p(w2, n2); } function p(n2, r3, o3) { var i3 = m2(t2++, 2); return i3.t = n2, i3.__c || (i3.__ = [o3 ? o3(r3) : w2(void 0, r3), function(n3) { var t3 = i3.t(i3.__[0], n3); i3.__[0] !== t3 && (i3.__ = [t3, i3.__[1]], i3.__c.setState({})); }], i3.__c = u2), i3.__; } function y2(r3, o3) { var i3 = m2(t2++, 3); !l.__s && k2(i3.__H, o3) && (i3.__ = r3, i3.__H = o3, u2.__H.__h.push(i3)); } function h2(r3, o3) { var i3 = m2(t2++, 4); !l.__s && k2(i3.__H, o3) && (i3.__ = r3, i3.__H = o3, u2.__h.push(i3)); } function s2(n2) { return o2 = 5, A(function() { return { current: n2 }; }, []); } function _2(n2, t3, u3) { o2 = 6, h2(function() { typeof n2 == "function" ? n2(t3()) : n2 && (n2.current = t3()); }, u3 == null ? u3 : u3.concat(n2)); } function A(n2, u3) { var r3 = m2(t2++, 7); return k2(r3.__H, u3) && (r3.__ = n2(), r3.__H = u3, r3.__h = n2), r3.__; } function F(n2, t3) { return o2 = 8, A(function() { return n2; }, t3); } function T2(n2) { var r3 = u2.context[n2.__c], o3 = m2(t2++, 9); return o3.c = n2, r3 ? (o3.__ == null && (o3.__ = true, r3.sub(u2)), r3.props.value) : n2.__; } function x2() { i2.forEach(function(t3) { if (t3.__P) try { t3.__H.__h.forEach(g2), t3.__H.__h.forEach(j2), t3.__H.__h = []; } catch (u3) { t3.__H.__h = [], l.__e(u3, t3.__v); } }), i2 = []; } l.__b = function(n2) { u2 = null, c2 && c2(n2); }, l.__r = function(n2) { f2 && f2(n2), t2 = 0; var r3 = (u2 = n2.__c).__H; r3 && (r3.__h.forEach(g2), r3.__h.forEach(j2), r3.__h = []); }, l.diffed = function(t3) { e2 && e2(t3); var o3 = t3.__c; o3 && o3.__H && o3.__H.__h.length && (i2.push(o3) !== 1 && r2 === l.requestAnimationFrame || ((r2 = l.requestAnimationFrame) || function(n2) { var t4, u3 = function u4() { clearTimeout(r3), b2 && cancelAnimationFrame(t4), setTimeout(n2); }, r3 = setTimeout(u3, 100); b2 && (t4 = requestAnimationFrame(u3)); })(x2)), u2 = null; }, l.__c = function(t3, u3) { u3.some(function(t4) { try { t4.__h.forEach(g2), t4.__h = t4.__h.filter(function(n2) { return !n2.__ || j2(n2); }); } catch (r3) { u3.some(function(n2) { n2.__h && (n2.__h = []); }), u3 = [], l.__e(r3, t4.__v); } }), a2 && a2(t3, u3); }, l.unmount = function(t3) { v2 && v2(t3); var u3 = t3.__c; if (u3 && u3.__H) try { u3.__H.__.forEach(g2); } catch (t4) { l.__e(t4, u3.__v); } }; var b2 = typeof requestAnimationFrame == "function"; function g2(n2) { var t3 = u2; typeof n2.__c == "function" && n2.__c(), u2 = t3; } function j2(n2) { var t3 = u2; n2.__c = n2.__(), u2 = t3; } function k2(n2, t3) { return !n2 || n2.length !== t3.length || t3.some(function(t4, u3) { return t4 !== n2[u3]; }); } function w2(n2, t3) { return typeof t3 == "function" ? t3(n2) : t3; } // src/preact/index.js function createElement(unusedType, unusedProps, var_args) { return v.apply(void 0, arguments); } function render(vnode, container, opt_replaceNode) { S(vnode, container, opt_replaceNode); } function hydrate(vnode, container) { q(vnode, container); } function createContext(value) { return D(value, void 0); } function useState(initial) { return l2(initial); } function useRef(initial) { return s2(initial); } function useEffect(effect, opt_deps) { y2(effect, opt_deps); } function useLayoutEffect(effect, opt_deps) { h2(effect, opt_deps); } function useContext(context2) { return T2(context2); } function useMemo(cb, opt_deps) { return A(cb, opt_deps); } function useCallback(cb, opt_deps) { return F(cb, opt_deps); } function useImperativeHandle(ref, create, opt_deps) { return _2(ref, create, opt_deps); } // src/core/constants/action-constants.js var ActionTrust_Enum = { LOW: 1, DEFAULT: 2, HIGH: 3 }; // src/core/constants/amp-events.js var AmpEvents_Enum = { DOM_UPDATE: "amp:dom-update", FORM_DIRTINESS_CHANGE: "amp:form-dirtiness-change", FORM_VALUE_CHANGE: "amp:form-value-change", VISIBILITY_CHANGE: "amp:visibilitychange", ATTACHED: "amp:attached", STUBBED: "amp:stubbed", LOAD_START: "amp:load-start", LOAD_END: "amp:load-end", ERROR: "amp:error", SIZE_CHANGED: "amp:size-changed", UNLOAD: "amp:unload" }; // src/core/constants/loading-instructions.js var Loading_Enum = { AUTO: "auto", LAZY: "lazy", EAGER: "eager", UNLOAD: "unload" }; var ORDER = [Loading_Enum.AUTO, Loading_Enum.LAZY, Loading_Enum.EAGER, Loading_Enum.UNLOAD]; var MAP = { [Loading_Enum.AUTO]: 0, [Loading_Enum.LAZY]: 1, [Loading_Enum.EAGER]: 2, [Loading_Enum.UNLOAD]: 3 }; function reducer(v1, v22) { const ordinal1 = MAP[v1] || 0; const ordinal2 = MAP[v22] || 0; const ordinal = Math.max(ordinal1, ordinal2); return ORDER[ordinal]; } // src/core/constants/ready-state.js var ReadyState_Enum = { UPGRADING: "upgrading", BUILDING: "building", MOUNTING: "mounting", LOADING: "loading", COMPLETE: "complete", ERROR: "error" }; // src/core/context/prop.type.js function ContextPropDef() { } ContextPropDef.prototype.key; ContextPropDef.prototype.type; ContextPropDef.prototype.deps; ContextPropDef.prototype.recursive; ContextPropDef.prototype.compute; ContextPropDef.prototype.defaultValue; // src/core/context/scheduler.js function throttleTail(handler, defaultScheduler = null) { let scheduled = false; const handleAndUnschedule = () => { scheduled = false; handler(); }; const scheduleIfNotScheduled = (opt_scheduler) => { if (!scheduled) { scheduled = true; const scheduler = opt_scheduler || defaultScheduler; scheduler(handleAndUnschedule); } }; return scheduleIfNotScheduled; } // src/core/error/index.js function duplicateErrorIfNecessary(error) { const messageProperty = Object.getOwnPropertyDescriptor(error, "message"); if (messageProperty != null && messageProperty.writable) { return error; } const { message, stack } = error; const e3 = new Error(message); for (const prop in error) { e3[prop] = error[prop]; } e3.stack = stack; return e3; } function createError(var_args) { let error = null; let message = ""; for (const arg of arguments) { if (arg instanceof Error && !error) { error = duplicateErrorIfNecessary(arg); } else { if (message) { message += " "; } message += arg; } } if (!error) { error = new Error(message); } else if (message) { error.message = message + ": " + error.message; } return error; } function maybeReportError(error) { self.__AMP_REPORT_ERROR == null ? void 0 : self.__AMP_REPORT_ERROR(error); } function rethrowAsync(var_args) { const error = createError.apply(null, arguments); setTimeout(() => { maybeReportError(error); throw error; }); } function tryCallback(callback, ...args) { try { return callback.apply(null, args); } catch (e3) { rethrowAsync(e3); } } // src/core/context/scan.js function findParent(startNode, predicate, arg = void 0, includeSelf = true) { for (let n2 = includeSelf ? startNode : startNode.parent; n2; n2 = n2.parent) { if (predicate(n2, arg)) { return n2; } } return null; } function deepScan(startNode, callback, arg = void 0, state = true, includeSelf = true) { if (includeSelf) { const newState = callback(startNode, arg, state); if (newState) { deepScan(startNode, callback, arg, newState, false); } } else if (startNode.children) { for (const node of startNode.children) { deepScan(node, callback, arg, state, true); } } } // src/core/context/values.js var EMPTY_ARRAY = []; var EMPTY_FUNC = () => { }; var Pending_Enum = { NOT_PENDING: 0, PENDING: 1, PENDING_REFRESH_PARENT: 2 }; function InputDef() { } InputDef.prototype.values; InputDef.prototype.setters; function UsedDef() { } UsedDef.prototype.prop; UsedDef.prototype.subscribers; UsedDef.prototype.value; UsedDef.prototype.pending; UsedDef.prototype.counter; UsedDef.prototype.depValues; UsedDef.prototype.parentValue; UsedDef.prototype.parentContextNode; UsedDef.prototype.ping; UsedDef.prototype.pingDep; UsedDef.prototype.pingParent; var Values = /* @__PURE__ */ function() { function Values2(contextNode) { this.contextNode_ = contextNode; this.inputsByKey_ = null; this.usedByKey_ = null; this.checkUpdates_ = throttleTail(this.checkUpdates_.bind(this), setTimeout); } var _proto = Values2.prototype; _proto.set = function set(prop, setter, value) { devAssert(setter); devAssert(value !== void 0); const { key } = prop; const inputsByKey = this.inputsByKey_ || (this.inputsByKey_ = new Map()); let inputs = inputsByKey.get(key); if (!inputs) { inputs = { values: [], setters: [] }; inputsByKey.set(key, inputs); } const index = inputs.setters.indexOf(setter); const changed = index == -1 || inputs.values[index] !== value; if (index == -1) { inputs.setters.push(setter); inputs.values.push(value); } else if (changed) { inputs.values[index] = value; } if (changed) { this.ping(prop, false); if (isRecursive(prop)) { deepScan(this.contextNode_, scan, prop, true, false); } } }; _proto.remove = function remove2(prop, setter) { devAssert(setter); const { key } = prop; const inputsByKey = this.inputsByKey_; const inputs = inputsByKey == null ? void 0 : inputsByKey.get(key); if (inputs) { const index = inputs.setters.indexOf(setter); if (index != -1) { inputs.setters.splice(index, 1); inputs.values.splice(index, 1); if (inputs.setters.length == 0) { inputsByKey.delete(key); } deepScan(this.contextNode_, scan, prop); } } }; _proto.has = function has(prop) { var _this$inputsByKey_; return !!((_this$inputsByKey_ = this.inputsByKey_) != null && _this$inputsByKey_.has(prop.key)); }; _proto.subscribe = function subscribe2(prop, handler) { const used = this.startUsed_(prop); if (!pushIfNotExist(used.subscribers, handler)) { return; } const existingValue = used.value; if (isDefined(existingValue) && this.isConnected_()) { handler(existingValue); } }; _proto.unsubscribe = function unsubscribe2(prop, handler) { var _this$usedByKey_; const used = (_this$usedByKey_ = this.usedByKey_) == null ? void 0 : _this$usedByKey_.get(prop.key); if (!used || !removeItem(used.subscribers, handler)) { return; } this.stopUsed_(used); }; _proto.ping = function ping(prop, refreshParent) { var _this$usedByKey_2, _this$usedByKey_2$get; (_this$usedByKey_2 = this.usedByKey_) == null ? void 0 : (_this$usedByKey_2$get = _this$usedByKey_2.get(prop.key)) == null ? void 0 : _this$usedByKey_2$get.ping(refreshParent); }; _proto.parentUpdated = function parentUpdated() { if (this.isConnected_()) { deepScan(this.contextNode_, scanAll, void 0, EMPTY_ARRAY); } }; _proto.rootUpdated = function rootUpdated() { const usedByKey = this.usedByKey_; if (!usedByKey) { return; } if (this.isConnected_()) { usedByKey.forEach((used) => { const { prop } = used; this.ping(prop, true); }); } else { usedByKey.forEach((used) => { const { prop } = used; if (isRecursive(prop)) { this.updateParentContextNode_(used, null); } }); } }; _proto.scan = function scan2(prop) { this.ping(prop, true); if (!isRecursive(prop)) { return false; } if (this.has(prop)) { return false; } return true; }; _proto.scanAll = function scanAll2(scheduled) { let newScheduled = null; const usedByKey = this.usedByKey_; if (usedByKey) { usedByKey.forEach((used) => { const { prop } = used; const { key } = prop; if ((newScheduled || scheduled).indexOf(key) == -1) { this.ping(prop, true); if (this.contextNode_.children && this.has(prop)) { if (!newScheduled) { newScheduled = scheduled.slice(0); } newScheduled.push(key); } } }); } return newScheduled || scheduled; }; _proto.isConnected_ = function isConnected_() { return !!this.contextNode_.root; }; _proto.startUsed_ = function startUsed_(prop) { const { deps, key } = prop; const usedByKey = this.usedByKey_ || (this.usedByKey_ = new Map()); let used = usedByKey.get(key); if (!used) { used = { prop, subscribers: [], value: void 0, pending: Pending_Enum.NOT_PENDING, counter: 0, depValues: deps.length > 0 ? deps.map(EMPTY_FUNC) : EMPTY_ARRAY, parentValue: void 0, parentContextNode: null, ping: (refreshParent) => { if (this.isConnected_()) { const pending = refreshParent ? Pending_Enum.PENDING_REFRESH_PARENT : Pending_Enum.PENDING; used.pending = Math.max(used.pending, pending); this.checkUpdates_(); } }, pingDep: deps.length > 0 ? deps.map((dep, index) => (value) => { used.depValues[index] = value; used.ping(); }) : EMPTY_ARRAY, pingParent: isRecursive(prop) ? (parentValue) => { used.parentValue = parentValue; used.ping(); } : null }; usedByKey.set(key, used); deps.forEach((dep, index) => this.subscribe(dep, used.pingDep[index])); used.ping(false); } return used; }; _proto.stopUsed_ = function stopUsed_(used) { if (used.subscribers.length > 0) { return; } const { pingDep, prop } = used; const { deps, key } = prop; this.usedByKey_.delete(key); this.updateParentContextNode_(used, null); if (deps.length > 0) { deps.forEach((dep, index) => { this.unsubscribe(dep, pingDep[index]); }); } }; _proto.checkUpdates_ = function checkUpdates_() { if (!this.isConnected_()) { return; } const usedByKey = this.usedByKey_; if (!usedByKey) { return; } usedByKey.forEach((used) => { used.counter = 0; }); let updated; do { updated = 0; usedByKey.forEach((used) => { if (used.pending != Pending_Enum.NOT_PENDING) { const { key } = used.prop; used.counter++; if (used.counter > 5) { rethrowAsync(`cyclical prop: ${key}`); used.pending = Pending_Enum.NOT_PENDING; return; } updated++; this.tryUpdate_(used); } }); } while (updated > 0); }; _proto.tryUpdate_ = function tryUpdate_(used) { const refreshParent = used.pending == Pending_Enum.PENDING_REFRESH_PARENT; let newValue; try { newValue = this.calc_(used, refreshParent); } catch (e3) { rethrowAsync(e3); } used.pending = Pending_Enum.NOT_PENDING; this.maybeUpdated_(used, newValue); }; _proto.maybeUpdated_ = function maybeUpdated_(used, value) { const { prop, value: oldValue } = used; const { key } = prop; const usedByKey = this.usedByKey_; if (oldValue === value || used !== (usedByKey == null ? void 0 : usedByKey.get(key)) || !this.isConnected_()) { return; } used.value = value; const { subscribers } = used; for (const handler of subscribers) { handler(value); } }; _proto.calc_ = function calc_(used, refreshParent) { var _this$inputsByKey_2, _this$inputsByKey_2$g; devAssert(this.isConnected_()); const { depValues, prop } = used; const { compute, defaultValue, key } = prop; const inputValues = (_this$inputsByKey_2 = this.inputsByKey_) == null ? void 0 : (_this$inputsByKey_2$g = _this$inputsByKey_2.get(key)) == null ? void 0 : _this$inputsByKey_2$g.values; const recursive = calcRecursive(prop, inputValues); if (refreshParent || recursive != Boolean(used.parentContextNode)) { const newParentContextNode = recursive ? findParent(this.contextNode_, hasInput, prop, false) : null; this.updateParentContextNode_(used, newParentContextNode); } const parentValue = isDefined(used.parentValue) ? used.parentValue : recursive && !used.parentContextNode ? defaultValue : void 0; let newValue = void 0; const ready = depValues.every(isDefined) && (!recursive || isDefined(parentValue)); if (ready) { const { node } = this.contextNode_; if (inputValues && !compute) { newValue = inputValues[0]; } else if (isRecursive(prop)) { if (inputValues || depValues.length > 0) { newValue = callRecursiveCompute(compute, node, inputValues || EMPTY_ARRAY, parentValue, depValues); } else if (isDefined(parentValue)) { newValue = parentValue; } } else if (compute) { newValue = callCompute(compute, node, inputValues || EMPTY_ARRAY, depValues); } } return newValue; }; _proto.updateParentContextNode_ = function updateParentContextNode_(used, newParentContextNode) { const { parentContextNode: oldParentContextNode, pingParent, prop } = used; if (newParentContextNode != oldParentContextNode) { used.parentContextNode = newParentContextNode; used.parentValue = void 0; if (oldParentContextNode) { oldParentContextNode.values.unsubscribe(prop, devAssert(pingParent)); } if (newParentContextNode) { newParentContextNode.values.subscribe(prop, devAssert(pingParent)); } } }; return Values2; }(); function scan(contextNode, prop) { return contextNode.values.scan(prop); } function scanAll(contextNode, unusedArg, state) { return contextNode.values.scanAll(state); } function hasInput(contextNode, prop) { return contextNode.values.has(prop); } function isRecursive(prop) { return !!prop.recursive; } function calcRecursive(prop, inputs) { const { compute, recursive } = prop; if (typeof recursive == "function") { return inputs ? recursive(inputs) : true; } if (recursive && inputs && !compute) { return false; } return recursive; } function callCompute(compute, node, inputValues, deps) { switch (deps.length) { case 0: return compute(node, inputValues); case 1: return compute(node, inputValues, deps[0]); case 2: return compute(node, inputValues, deps[0], deps[1]); case 3: return compute(node, inputValues, deps[0], deps[1], deps[2]); default: return compute.apply(null, [node, inputValues].concat(deps)); } } function callRecursiveCompute(compute, node, inputValues, parentValue, deps) { switch (deps.length) { case 0: return compute(node, inputValues, parentValue); case 1: return compute(node, inputValues, parentValue, deps[0]); case 2: return compute(node, inputValues, parentValue, deps[0], deps[1]); case 3: return compute(node, inputValues, parentValue, deps[0], deps[1], deps[2]); default: return compute.apply(null, [node, inputValues, parentValue].concat(deps)); } } function isDefined(v3) { return v3 !== void 0; } // src/core/context/node.js var NODE_PROP = "__AMP_NODE"; var ASSIGNED_SLOT_PROP = "__AMP_ASSIGNED_SLOT"; var AMP_PREFIX = "AMP-"; var ELEMENT_NODE = 1; var DOCUMENT_NODE = 9; var FRAGMENT_NODE = 11; var ContextNode = /* @__PURE__ */ function() { ContextNode2.get = function get(node) { let contextNode = node[NODE_PROP]; if (!contextNode) { contextNode = new ContextNode2(node, null); if (isLocalDev() || isTest()) { Object.defineProperty(node, NODE_PROP, { value: contextNode, writable: false, enumerable: false, configurable: false }); } else { node[NODE_PROP] = contextNode; } } return contextNode; }; ContextNode2.closest = function closest(node, includeSelf = true) { let n2 = node; while (n2) { if (n2 != node || includeSelf) { if (n2[NODE_PROP]) { return n2[NODE_PROP]; } const { nodeType } = n2; if (nodeType == DOCUMENT_NODE || nodeType == FRAGMENT_NODE || nodeType == ELEMENT_NODE && devAssertElement(n2).tagName.startsWith(AMP_PREFIX)) { return ContextNode2.get(n2); } } const assignedSlot = n2[ASSIGNED_SLOT_PROP] || n2.assignedSlot; if (assignedSlot) { n2 = assignedSlot; } else { n2 = n2.parentNode; } } return null; }; ContextNode2.assignSlot = function assignSlot(node, slot) { if (node[ASSIGNED_SLOT_PROP] == slot) { return; } node[ASSIGNED_SLOT_PROP] = slot; discoverContained(node); }; ContextNode2.unassignSlot = function unassignSlot(node, slot) { if (node[ASSIGNED_SLOT_PROP] != slot) { return; } node[ASSIGNED_SLOT_PROP] = void 0; discoverContained(node); }; ContextNode2.rediscoverChildren = function rediscoverChildren2(node) { var _contextNode$children; const contextNode = node[NODE_PROP]; contextNode == null ? void 0 : (_contextNode$children = contextNode.children) == null ? void 0 : _contextNode$children.forEach(discoverContextNode); }; function ContextNode2(node, name) { this.node = node; this.name = name; this.isRoot = node.nodeType == DOCUMENT_NODE; this.root = this.isRoot ? this : null; this.parent = null; this.children = null; this.groups = null; this.values = new Values(this); this.subscribers_ = null; this.parentOverridden_ = false; this.scheduleDiscover_ = throttleTail(this.discover_.bind(this), setTimeout); if (node.nodeType == FRAGMENT_NODE) { node.addEventListener("slotchange", (e3) => { var _ContextNode$closest, _ContextNode$closest$; const slot = e3.target; slot.assignedNodes().forEach(discoverContained); (_ContextNode$closest = ContextNode2.closest(slot)) == null ? void 0 : (_ContextNode$closest$ = _ContextNode$closest.children) == null ? void 0 : _ContextNode$closest$.forEach(discoverContextNode); }); } this.discover(); } var _proto = ContextNode2.prototype; _proto.discover = function discover2() { if (this.isDiscoverable()) { this.scheduleDiscover_(); } else if (this.name && this.children) { this.children.forEach(discoverContextNode); } }; _proto.isDiscoverable = function isDiscoverable() { return !this.isRoot && !this.parentOverridden_; }; _proto.setParent = function setParent2(parent) { const parentContext = parent != null && parent.nodeType ? ContextNode2.get(parent) : parent; this.updateTree_(parentContext, parent != null); }; _proto.setIsRoot = function setIsRoot(isRoot) { var _this$parent$root, _this$parent; this.isRoot = isRoot; const newRoot = isRoot ? this : (_this$parent$root = (_this$parent = this.parent) == null ? void 0 : _this$parent.root) != null ? _this$parent$root : null; this.updateRoot(newRoot); }; _proto.updateRoot = function updateRoot(root) { devAssert(!root || root.isRoot); const oldRoot = this.root; if (root != oldRoot) { var _this$subscribers_, _this$children; this.root = root; this.values.rootUpdated(); (_this$subscribers_ = this.subscribers_) == null ? void 0 : _this$subscribers_.forEach((comp) => comp.rootUpdated()); (_this$children = this.children) == null ? void 0 : _this$children.forEach((child) => child.updateRoot(root)); } }; _proto.addGroup = function addGroup2(name, match, weight) { const groups = this.groups || (this.groups = new Map()); const { children, node } = this; const cn = new ContextNode2(node, name); groups.set(name, { cn, match, weight }); cn.setParent(this); children == null ? void 0 : children.forEach(discoverContextNode); return cn; }; _proto.group = function group(name) { var _this$groups, _this$groups$get; return ((_this$groups = this.groups) == null ? void 0 : (_this$groups$get = _this$groups.get(name)) == null ? void 0 : _this$groups$get.cn) || null; }; _proto.findGroup = function findGroup(node) { const { groups } = this; if (!groups) { return null; } let found = null; let maxWeight = Number.NEGATIVE_INFINITY; groups.forEach(({ cn, match, weight }) => { if (match(node, this.node) && weight > maxWeight) { found = cn; maxWeight = weight; } }); return found; }; _proto.subscribe = function subscribe2(id, Ctor, func, deps) { const subscribers = this.subscribers_ || (this.su