UNPKG

@bentoproject/accordion

Version:

Displays content sections that can be collapsed and expanded.

1,549 lines (1,520 loc) 148 kB
var __defProp = Object.defineProperty; var __markAsModule = function(target) { return __defProp(target, "__esModule", { value: true }); }; var __export = function(target, all) { __markAsModule(target); for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; // extensions/amp-accordion/1.0/build/web-component.js __export(exports, { defineElement: function() { return defineElement; } }); // 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; } var 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 false; } 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 : false; } // src/core/types/array.js function toArray(arrayLike) { return arrayLike ? Array.prototype.slice.call(arrayLike) : []; } var isArray = Array.isArray; function arrayOrSingleItemToArray(arrayOrSingleItem) { return isArray(arrayOrSingleItem) ? arrayOrSingleItem : [ arrayOrSingleItem ]; } function remove(array, shouldRemove) { var removed = []; var index = 0; for (var i4 = 0; i4 < array.length; i4++) { var item = array[i4]; if (shouldRemove(item, i4, array)) { removed.push(item); } else { if (index < i4) { 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) { var index = array.indexOf(item); if (index == -1) { return false; } array.splice(index, 1); return true; } // src/core/types/object/index.js var _Object$prototype = Object.prototype; var hasOwn_ = _Object$prototype.hasOwnProperty; var toString_ = _Object$prototype.toString; function map(opt_initial) { var 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(function(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 (var k3 in o1) { if (o1[k3] !== o22[k3]) { return false; } } for (var _k in o22) { if (o22[_k] !== o1[_k]) { return false; } } return true; } function memo(obj, prop, factory) { var 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, var_args) { if (opt_message === void 0) { opt_message = "Assertion failed"; } if (shouldBeTruthy) { return shouldBeTruthy; } if (sentinel && opt_message.indexOf(sentinel) == -1) { opt_message += sentinel; } var i4 = 3; var splitMessage = opt_message.split("%s"); var message = splitMessage.shift(); var messageArray = [message]; while (splitMessage.length) { var subValue = arguments[i4++]; var nextConstant = splitMessage.shift(); message += elementStringOrPassThru(subValue) + nextConstant; messageArray.push(subValue, nextConstant.trim()); } var error = new Error(message); error.messageArray = remove(messageArray, function(x3) { return 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 { var doc = el.ownerDocument; var testElement = doc.createElement("div"); var 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) { var _root = root, classList = _root.classList; var unique = "i-amphtml-scoped"; classList.add(unique); var scopedSelector = prependSelectorsWith(selector, "." + unique); var elements = root.querySelectorAll(scopedSelector); classList.remove(unique); return elements; } function scopedQuerySelector(root, selector) { if (isEsm() || isScopeSelectorSupported(root)) { return root.querySelector(prependSelectorsWith(selector, ":scope")); } var 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) { var matcher = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector || el.oMatchesSelector; if (matcher) { return matcher.call(el, selector); } return false; } function childNodes(parent, callback) { var nodes = []; for (var 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, function(node) { return !isInternalOrServiceNode(node); }); } function isInternalOrServiceNode(node) { if (isInternalElement(node)) { return true; } if (node.nodeType !== Node.ELEMENT_NODE) { return false; } var el = devAssertElement(node); return el.hasAttribute("placeholder") || el.hasAttribute("fallback") || el.hasAttribute("overflow"); } function isInternalElement(nodeOrTagName) { var 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 (var attr in attributes) { element.setAttribute(attr, attributes[attr]); } return element; } function createElementWithAttributes(doc, tagName, attributes) { var element = doc.createElement(tagName); return addAttributesToElement(element, attributes); } function toggleAttribute(element, name, forced) { var hasAttribute = element.hasAttribute(name); var 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) { var data = opt_data || {}; var event = devAssert(node.ownerDocument).createEvent("Event"); event.data = data; var _ref = opt_options || DEFAULT_CUSTOM_EVENT_OPTIONS, bubbles = _ref.bubbles, cancelable = _ref.cancelable; 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() { var _this = this; this.promise = new Promise(function(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, i4) { 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) : i4), 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, i4, t3, r3, o3) { var f3 = { type: n2, props: i4, 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, i4, t3, r3, o3; n3.__d && (r3 = (t3 = (l3 = n3).__v).__e, (o3 = l3.__P) && (u3 = [], (i4 = a({}, t3)).__v = t3.__v + 1, j(o3, t3, i4, 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, i4, t3, r3, o3, f3, s3, a3) { var h3, v3, p3, _3, b3, m3, g3, w3 = i4 && i4.__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(i4, 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 i4, t3 = n2.__k, r3 = 0; t3 && r3 < t3.length; r3++) { (i4 = t3[r3]) && (i4.__ = n2, l3 = typeof i4.type == "function" ? x(i4, l3, u3) : P(u3, i4, i4, t3, i4.__e, l3)); } return l3; } function P(n2, l3, u3, i4, 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 < i4.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, i4, t3) { var r3; for (r3 in u3) { r3 === "children" || r3 === "key" || r3 in l3 || H(n2, r3, null, u3[r3], i4); } 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], i4); } } 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, i4, t3) { var r3; n: if (l3 === "style") { if (typeof u3 == "string") n2.style.cssText = u3; else { if (typeof i4 == "string" && (n2.style.cssText = i4 = ""), i4) for (l3 in i4) { u3 && l3 in u3 || $(n2.style, l3, ""); } if (u3) for (l3 in u3) { i4 && u3[l3] === i4[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 ? i4 || 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, i4, 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; i4.__h != null && (c3 = i4.__h, e3 = u3.__e = i4.__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, i4.__c ? b3 = (h3 = u3.__c = i4.__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 === i4.__v) { h3.props = m3, h3.state = h3.__s, u3.__v !== i4.__v && (h3.__d = false), h3.__v = u3, u3.__e = i4.__e, u3.__k = i4.__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, i4, 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 === i4.__v ? (u3.__k = i4.__k, u3.__e = i4.__e) : u3.__e = L(i4.__e, u3, i4, 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, i4); } } 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, i4, t3, r3, o3, f3, c3) { var s3, a3, v3, y3 = i4.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 = i4.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, i4, t3, r3 && d2 !== "foreignObject", o3, f3, o3 ? o3[0] : i4.__k && k(i4, 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, i4) { try { typeof n2 == "function" ? n2(u3) : n2.current = u3; } catch (n3) { l.__e(n3, i4); } } function N(n2, u3, i4) { 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"); } i4 || 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, i4, t3) { var r3, o3, f3; l.__ && l.__(u3, i4), o3 = (r3 = typeof t3 == "function") ? null : t3 && t3.__k || i4.__k, f3 = [], j(i4, u3 = (!r3 && t3 || i4).__k = v(d, null, [u3]), o3 || e, e, i4.ownerSVGElement !== void 0, !r3 && t3 ? [t3] : o3 ? null : i4.firstChild ? n.call(i4.childNodes) : null, f3, !r3 && t3 ? t3 : o3 ? o3.__e : i4.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 Consumer(n3, l4) { return n3.children(l4); }, Provider: function Provider(n3) { var u4, i4; return this.getChildContext || (u4 = [], (i4 = {})[l3] = this, this.getChildContext = function() { return i4; }, 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 __e(n2, l3) { for (var u3, i4, t3; l3 = l3.__; ) { if ((u3 = l3.__c) && !u3.__) try { if ((i4 = u3.constructor) && i4.getDerivedStateFromError != null && (u3.setState(i4.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 i2(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 i3 = []; 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 i4 = u2.__H || (u2.__H = { __: [], __h: [] }); return t3 >= i4.__.length && i4.__.push({}), i4.__[t3]; } function l2(n2) { return o2 = 1, p(w2, n2); } function p(n2, r3, o3) { var i4 = m2(t2++, 2); return i4.t = n2, i4.__c || (i4.__ = [o3 ? o3(r3) : w2(void 0, r3), function(n3) { var t3 = i4.t(i4.__[0], n3); i4.__[0] !== t3 && (i4.__ = [t3, i4.__[1]], i4.__c.setState({})); }], i4.__c = u2), i4.__; } function y2(r3, o3) { var i4 = m2(t2++, 3); !l.__s && k2(i4.__H, o3) && (i4.__ = r3, i4.__H = o3, u2.__H.__h.push(i4)); } function h2(r3, o3) { var i4 = m2(t2++, 4); !l.__s && k2(i4.__H, o3) && (i4.__ = r3, i4.__H = o3, u2.__h.push(i4)); } 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() { i3.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); } }), i3 = []; } 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 && (i3.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 _MAP; 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 = (_MAP = {}, _MAP[Loading_Enum.AUTO] = 0, _MAP[Loading_Enum.LAZY] = 1, _MAP[Loading_Enum.EAGER] = 2, _MAP[Loading_Enum.UNLOAD] = 3, _MAP); function reducer(v1, v22) { var ordinal1 = MAP[v1] || 0; var ordinal2 = MAP[v22] || 0; var 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) { if (defaultScheduler === void 0) { defaultScheduler = null; } var scheduled = false; var handleAndUnschedule = function handleAndUnschedule2() { scheduled = false; handler(); }; var scheduleIfNotScheduled = function scheduleIfNotScheduled2(opt_scheduler) { if (!scheduled) { scheduled = true; var scheduler = opt_scheduler || defaultScheduler; scheduler(handleAndUnschedule); } }; return scheduleIfNotScheduled; } // src/core/error/index.js function _createForOfIteratorHelperLoose(o3, allowArrayLike) { var it = typeof Symbol !== "undefined" && o3[Symbol.iterator] || o3["@@iterator"]; if (it) return (it = it.call(o3)).next.bind(it); if (Array.isArray(o3) || (it = _unsupportedIterableToArray(o3)) || allowArrayLike && o3 && typeof o3.length === "number") { if (it) o3 = it; var i4 = 0; return function() { if (i4 >= o3.length) return { done: true }; return { done: false, value: o3[i4++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o3, minLen) { if (!o3) return; if (typeof o3 === "string") return _arrayLikeToArray(o3, minLen); var n2 = Object.prototype.toString.call(o3).slice(8, -1); if (n2 === "Object" && o3.constructor) n2 = o3.constructor.name; if (n2 === "Map" || n2 === "Set") return Array.from(o3); if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray(o3, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i4 = 0, arr2 = new Array(len); i4 < len; i4++) { arr2[i4] = arr[i4]; } return arr2; } function duplicateErrorIfNecessary(error) { var messageProperty = Object.getOwnPropertyDescriptor(error, "message"); if (messageProperty != null && messageProperty.writable) { return error; } var message = error.message, stack = error.stack; var e3 = new Error(message); for (var prop in error) { e3[prop] = error[prop]; } e3.stack = stack; return e3; } function createError(var_args) { var error = null; var message = ""; for (var _iterator = _createForOfIteratorHelperLoose(arguments), _step; !(_step = _iterator()).done; ) { var arg = _step.value; 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) { var error = createError.apply(null, arguments); setTimeout(function() { maybeReportError(error); throw error; }); } function tryCallback(callback) { try { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return callback.apply(null, args); } catch (e3) { rethrowAsync(e3); } } // src/core/context/scan.js function _createForOfIteratorHelperLoose2(o3, allowArrayLike) { var it = typeof Symbol !== "undefined" && o3[Symbol.iterator] || o3["@@iterator"]; if (it) return (it = it.call(o3)).next.bind(it); if (Array.isArray(o3) || (it = _unsupportedIterableToArray2(o3)) || allowArrayLike && o3 && typeof o3.length === "number") { if (it) o3 = it; var i4 = 0; return function() { if (i4 >= o3.length) return { done: true }; return { done: false, value: o3[i4++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray2(o3, minLen) { if (!o3) return; if (typeof o3 === "string") return _arrayLikeToArray2(o3, minLen); var n2 = Object.prototype.toString.call(o3).slice(8, -1); if (n2 === "Object" && o3.constructor) n2 = o3.constructor.name; if (n2 === "Map" || n2 === "Set") return Array.from(o3); if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray2(o3, minLen); } function _arrayLikeToArray2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i4 = 0, arr2 = new Array(len); i4 < len; i4++) { arr2[i4] = arr[i4]; } return arr2; } function findParent(startNode, predicate, arg, includeSelf) { if (arg === void 0) { arg = void 0; } if (includeSelf === void 0) { includeSelf = true; } for (var n2 = includeSelf ? startNode : startNode.parent; n2; n2 = n2.parent) { if (predicate(n2, arg)) { return n2; } } return null; } function deepScan(startNode, callback, arg, state, includeSelf) { if (arg === void 0) { arg = void 0; } if (state === void 0) { state = true; } if (includeSelf === void 0) { includeSelf = true; } if (includeSelf) { var newState = callback(startNode, arg, state); if (newState) { deepScan(startNode, callback, arg, newState, false); } } else if (startNode.children) { for (var _iterator = _createForOfIteratorHelperLoose2(startNode.children), _step; !(_step = _iterator()).done; ) { var node = _step.value; deepScan(node, callback, arg, state, true); } } } // src/core/context/values.js function _createForOfIteratorHelperLoose3(o3, allowArrayLike) { var it = typeof Symbol !== "undefined" && o3[Symbol.iterator] || o3["@@iterator"]; if (it) return (it = it.call(o3)).next.bind(it); if (Array.isArray(o3) || (it = _unsupportedIterableToArray3(o3)) || allowArrayLike && o3 && typeof o3.length === "number") { if (it) o3 = it; var i4 = 0; return function() { if (i4 >= o3.length) return { done: true }; return { done: false, value: o3[i4++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray3(o3, minLen) { if (!o3) return; if (typeof o3 === "string") return _arrayLikeToArray3(o3, minLen); var n2 = Object.prototype.toString.call(o3).slice(8, -1); if (n2 === "Object" && o3.constructor) n2 = o3.constructor.name; if (n2 === "Map" || n2 === "Set") return Array.from(o3); if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray3(o3, minLen); } function _arrayLikeToArray3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i4 = 0, arr2 = new Array(len); i4 < len; i4++) { arr2[i4] = arr[i4]; } return arr2; } var EMPTY_ARRAY = []; var EMPTY_FUNC = function EMPTY_FUNC2() { }; 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); var key = prop.key; var inputsByKey = this.inputsByKey_ || (this.inputsByKey_ = new Map()); var inputs = inputsByKey.get(key); if (!inputs) { inputs = { values: [], setters: [] }; inputsByKey.set(key, inputs); } var index = inputs.setters.indexOf(setter); var 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); var key = prop.key; var inputsByKey = this.inputsByKey_; var inputs = inputsByKey == null ? void 0 : inputsByKey.get(key); if (inputs) { var 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) { var used = this.startUsed_(prop); if (!pushIfNotExist(used.subscribers, handler)) { return; } var existingValue = used.value; if (isDefined(existingValue) && this.isConnected_()) { handler(existingValue); } }; _proto.unsubscribe = function unsubscribe2(prop, handler) { var _this$usedByKey_; var 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() { var _this = this; var usedByKey = this.usedByKey_; if (!usedByKey) { return; } if (this.isConnected_()) { usedByKey.forEach(function(used) { var prop = used.prop; _this.ping(prop, true); }); } else { usedByKey.forEach(function(used) { var prop = used.prop; 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) { var _this2 = this; var newScheduled = null; var usedByKey = this.usedByKey_; if (usedByKey) { usedByKey.forEach(function(used) { var prop = used.prop; var key = prop.key; if ((newScheduled || scheduled).indexOf(key) == -1) { _this2.ping(prop, true); if (_this2.contextNode_.children && _this2.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) { var _this3 = this; var deps = prop.deps, key = prop.key; var usedByKey = this.usedByKey_ || (this.usedByKey_ = new Map()); var used = usedByKey.get(key); if (!used) { used = { prop: 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: function ping(refreshParent) { if (_this3.isConnected_()) { var pending = refreshParent ? Pending_Enum.PENDING_REFRESH_PARENT : Pending_Enum.PENDING; used.pending = Math.max(used.pending, pending); _this3.checkUpdates_(); } }, pingDep: deps.length > 0 ? deps.map(function(dep, index) { return function(value) { used.depValues[index] = value; used.ping(); }; }) : EMPTY_ARRAY, pingParent: isRecursive(prop) ? function(parentValue) { used.parentValue = parentValue; used.ping(); } : null }; usedByKey.set(key, used); deps.forEach(function(dep, index) { return _this3.subscribe(dep, used.pingDep[index]); }); used.ping(false); } return used; }; _proto.stopUsed_ = function stopUsed_(used) { var _this4 = this; if (used.subscribers.length > 0) { return; } var pingDep = used.pingDep, prop = used.prop; var deps = prop.deps, key = prop.key; this.usedByKey_.delete(key); this.updateParentContextNode_(used, null); if (deps.length > 0) { deps.forEach(function(dep, index) { _this4.unsubscribe(dep, pingDep[index]); }); } }; _proto.checkUpdates_ = function checkUpdates_() { var _this5 = this; if (!this.isConnected_()) { return; } var usedByKey = this.usedByKey_; if (!usedByKey) { return; } usedByKey.forEach(function(used) { used.counter = 0; }); var updated; do { updated = 0; usedByKey.forEach(function(used) { if (used.pending != Pending_Enum.NOT_PENDING) { var key = used.prop.key; used.counter++; if (used.counter > 5) { rethrowAsync("cyclical prop: " + key); used.pending = Pending_Enum.NOT_PENDING; return; } updated++; _this5.tryUpdate_(used); } }); } while (updated > 0); }; _proto.tryUpdate_ = function tryUpdate_(used) { var refreshParent = used.pending == Pending_Enum.PENDING_REFRESH_PARENT; var 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) { var prop = used.prop, oldValue = used.value; var key = prop.key; var usedByKey = this.usedByKey_; if (oldValue === value || used !== (usedByKey == null ? void 0 : usedByKey.get(key)) || !this.isConnected_()) { return; } used.value = value; var subscribers = used.subscribers; for (var _iterator = _createForOfIteratorHelperLoose3(subscribers), _step; !(_step = _iterator()).done; ) { var handler = _step.value; handler(value); } }; _proto.calc_ = function calc_(used, refreshParent) { var _this$inputsByKey_2, _this$inputsByKey_2$g; devAssert(this.isConnected_()); var depValues = used.depValues, prop = used.prop; var compute4 = prop.compute, defaultValue = prop.defaultValue, key = prop.key; var 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; var recursive3 = calcRecursive(prop, inputValues); if (refreshParent || recursive3 != Boolean(used.parentContextNode)) { var newParentContextNode = recursive3 ? findParent(this.contextNode_, hasInput, prop, false) : null; this.updateParentContextNode_(used, newParentContextNode); } var parentValue = isDefined(used.parentValue) ? used.parentValue : recursive3 && !used.parentContextNode ? defaultValue : void 0; var newValue = void 0; var ready = depValues.every(isDefined) && (!recursive3 || isDefined(parentValue)); if (ready) { var node = this.contextNode_.node; if (inputValues && !compute4) { newValue = inputValues[0]; } else if (isRecursive(prop)) { if (inputValues || depValues.length > 0) { newValue = callRecursiveCompute(compute4, node, inputValues || EMPTY_ARRAY, parentValue, depValues); } else if (isDefined(parentValue)) { newValue = parentValue; } } else if (compute4) { newValue = callCompute(compute4, node, inputValues || EMPTY_ARRAY, depValues); } } return newValue; }; _proto.updateParentContextNode_ = function updateParentContextNode_(used, newParentContextNode) { var oldParentContextNode = used.parentContextNode, pingParent = used.pingParent, prop = used.prop; 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) { var compute4 = prop.compute, recursive3 = prop.recursive; if (typeof recursive3 == "function") { return inputs ? recursive3(inputs) : true; } if (recursive3 && inputs && !compute4) { return false; } return recursive3; } function callCompute(compute4, node, inputValues, deps) { switch (deps.length) { case 0: return compute4(node, inputValues); case 1: return compute4(node, inputValues, deps[0]); case 2: return compute4(node, inputValues, deps[0], deps[1]); case 3: return compute4(node, inputValues, deps[0], deps[1], deps[2]); default: return compute4.apply(null, [node, inputValues].concat(deps)); } } function callRecursiveCompute(compute4, node, inputValues, parentValue, deps) { switch (deps.length) { case 0: return compute4(node, inputValues, parentValue); case 1: return compute4(node, inputValues, parentValue, deps[0]); case 2: return compute4(node, inputValues, parentValue, deps[0], deps[1]); case 3: return compute