{ "version": 3, "sources": ["../../node_modules/preact/src/constants.js", "../../node_modules/preact/src/util.js", "../../node_modules/preact/src/options.js", "../../node_modules/preact/src/create-element.js", "../../node_modules/preact/src/component.js", "../../node_modules/preact/src/create-context.js", "../../node_modules/preact/src/diff/children.js", "../../node_modules/preact/src/diff/props.js", "../../node_modules/preact/src/diff/index.js", "../../node_modules/preact/src/render.js", "../../node_modules/preact/src/clone-element.js", "../../node_modules/preact/src/diff/catch-error.js", "../../node_modules/preact/devtools/src/index.js", "../../node_modules/preact/devtools/src/devtools.js", "../../node_modules/preact/debug/src/check-props.js", "../../node_modules/preact/debug/src/component-stack.js", "../../node_modules/preact/debug/src/debug.js", "../../node_modules/preact/debug/src/constants.js", "../../node_modules/preact/debug/src/util.js", "../../node_modules/@babel/runtime/helpers/esm/extends.js", "../../node_modules/resolve-pathname/esm/resolve-pathname.js", "../../node_modules/tiny-warning/dist/tiny-warning.esm.js", "../../node_modules/tiny-invariant/dist/tiny-invariant.esm.js", "../../node_modules/history/esm/history.js", "../../node_modules/htm/dist/htm.module.js", "../../node_modules/htm/preact/index.module.js", "../../node_modules/preact-router/src/util.js", "../../node_modules/preact-router/src/index.js", "../../src/utils/http.js", "../../src/utils/analytics.js", "../../node_modules/preact/hooks/src/index.js", "../../node_modules/jwt-decode/lib/atob.js", "../../node_modules/jwt-decode/lib/base64_url_decode.js", "../../node_modules/jwt-decode/lib/index.js", "../../src/utils/hooks.js", "../../src/utils/fw.js", "../../src/55913/components/CometChat.js", "../../src/55913/data/agendas.js", "../../src/55913/utils.js", "../../src/55913/components/Navbar.js", "../../src/utils/times.js", "../../src/55913/components/HookWrappers.js", "../../src/55913/components/Room.js", "../../src/55913/styles.js", "../../src/55913/components/layout.js", "../../src/55913/components/WhatsOn.js", "../../src/55913/components/TimedPopup.js", "../../src/55913/rooms/atrium.js", "../../src/55913/rooms/auditorium.js", "../../src/55913/components/AgendaSidebar.js", "../../src/55913/rooms/breakout1.js", "../../src/55913/rooms/breakout2.js", "../../src/55913/rooms/breakout3.js", "../../src/55913/components/IBMPopup.js", "../../src/55913/rooms/breakout4.js", "../../src/55913/rooms/breakouts.js", "../../src/55913/rooms/engagementSessions.js", "../../src/55913/rooms/explorationZone.js", "../../src/55913/rooms/isfSpeakers.js", "../../src/55913/rooms/lounge.js", "../../src/55913/rooms/memberSpeakers.js", "../../src/55913/components/Roundtables.js", "../../src/55913/rooms/roundTables.js", "../../src/55913/rooms/sponsorSpeakers.js", "../../src/55913/rooms/sponsorTheatre.js", "../../src/55913/components/Leaderboard.js", "../../src/55913/spa.js"], "sourcesContent": ["export const EMPTY_OBJ = {};\r\nexport const EMPTY_ARR = [];\r\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\r\n", "import { EMPTY_ARR } from \"./constants\";\r\n\r\n/**\r\n * Assign properties from `props` to `obj`\r\n * @template O, P The obj and props types\r\n * @param {O} obj The object to copy properties to\r\n * @param {P} props The object to copy properties from\r\n * @returns {O & P}\r\n */\r\nexport function assign(obj, props) {\r\n\t// @ts-ignore We change the type of `obj` to be `O & P`\r\n\tfor (let i in props) obj[i] = props[i];\r\n\treturn /** @type {O & P} */ (obj);\r\n}\r\n\r\n/**\r\n * Remove a child node from its parent if attached. This is a workaround for\r\n * IE11 which doesn't support `Element.prototype.remove()`. Using this function\r\n * is smaller than including a dedicated polyfill.\r\n * @param {Node} node The node to remove\r\n */\r\nexport function removeNode(node) {\r\n\tlet parentNode = node.parentNode;\r\n\tif (parentNode) parentNode.removeChild(node);\r\n}\r\n\r\nexport const slice = EMPTY_ARR.slice;\r\n", "import { _catchError } from './diff/catch-error';\r\n\r\n/**\r\n * The `option` object can potentially contain callback functions\r\n * that are called during various stages of our renderer. This is the\r\n * foundation on which all our addons like `preact/debug`, `preact/compat`,\r\n * and `preact/hooks` are based on. See the `Options` type in `internal.d.ts`\r\n * for a full list of available option hooks (most editors/IDEs allow you to\r\n * ctrl+click or cmd+click on mac the type definition below).\r\n * @type {import('./internal').Options}\r\n */\r\nconst options = {\r\n\t_catchError\r\n};\r\n\r\nexport default options;\r\n", "import { slice } from './util';\r\nimport options from './options';\r\n\r\nlet vnodeId = 0;\r\n\r\n/**\r\n * Create an virtual node (used for JSX)\r\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\r\n * constructor for this virtual node\r\n * @param {object | null | undefined} [props] The properties of the virtual node\r\n * @param {Array} [children] The children of the virtual node\r\n * @returns {import('./internal').VNode}\r\n */\r\nexport function createElement(type, props, children) {\r\n\tlet normalizedProps = {},\r\n\t\tkey,\r\n\t\tref,\r\n\t\ti;\r\n\tfor (i in props) {\r\n\t\tif (i == 'key') key = props[i];\r\n\t\telse if (i == 'ref') ref = props[i];\r\n\t\telse normalizedProps[i] = props[i];\r\n\t}\r\n\r\n\tif (arguments.length > 2) {\r\n\t\tnormalizedProps.children =\r\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\r\n\t}\r\n\r\n\t// If a Component VNode, check for and apply defaultProps\r\n\t// Note: type may be undefined in development, must never error here.\r\n\tif (typeof type == 'function' && type.defaultProps != null) {\r\n\t\tfor (i in type.defaultProps) {\r\n\t\t\tif (normalizedProps[i] === undefined) {\r\n\t\t\t\tnormalizedProps[i] = type.defaultProps[i];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn createVNode(type, normalizedProps, key, ref, null);\r\n}\r\n\r\n/**\r\n * Create a VNode (used internally by Preact)\r\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\r\n * Constructor for this virtual node\r\n * @param {object | string | number | null} props The properties of this virtual node.\r\n * If this virtual node represents a text node, this is the text of the node (string or number).\r\n * @param {string | number | null} key The key for this virtual node, used when\r\n * diffing it against its children\r\n * @param {import('./internal').VNode[\"ref\"]} ref The ref property that will\r\n * receive a reference to its created child\r\n * @returns {import('./internal').VNode}\r\n */\r\nexport function createVNode(type, props, key, ref, original) {\r\n\t// V8 seems to be better at detecting type shapes if the object is allocated from the same call site\r\n\t// Do not inline into createElement and coerceToVNode!\r\n\tconst vnode = {\r\n\t\ttype,\r\n\t\tprops,\r\n\t\tkey,\r\n\t\tref,\r\n\t\t_children: null,\r\n\t\t_parent: null,\r\n\t\t_depth: 0,\r\n\t\t_dom: null,\r\n\t\t// _nextDom must be initialized to undefined b/c it will eventually\r\n\t\t// be set to dom.nextSibling which can return `null` and it is important\r\n\t\t// to be able to distinguish between an uninitialized _nextDom and\r\n\t\t// a _nextDom that has been set to `null`\r\n\t\t_nextDom: undefined,\r\n\t\t_component: null,\r\n\t\t_hydrating: null,\r\n\t\tconstructor: undefined,\r\n\t\t_original: original == null ? ++vnodeId : original\r\n\t};\r\n\r\n\t// Only invoke the vnode hook if this was *not* a direct copy:\r\n\tif (original == null && options.vnode != null) options.vnode(vnode);\r\n\r\n\treturn vnode;\r\n}\r\n\r\nexport function createRef() {\r\n\treturn { current: null };\r\n}\r\n\r\nexport function Fragment(props) {\r\n\treturn props.children;\r\n}\r\n\r\n/**\r\n * Check if a the argument is a valid Preact VNode.\r\n * @param {*} vnode\r\n * @returns {vnode is import('./internal').VNode}\r\n */\r\nexport const isValidElement = vnode =>\r\n\tvnode != null && vnode.constructor === undefined;\r\n", "import { assign } from './util';\r\nimport { diff, commitRoot } from './diff/index';\r\nimport options from './options';\r\nimport { Fragment } from './create-element';\r\n\r\n/**\r\n * Base Component class. Provides `setState()` and `forceUpdate()`, which\r\n * trigger rendering\r\n * @param {object} props The initial component props\r\n * @param {object} context The initial context from parent components'\r\n * getChildContext\r\n */\r\nexport function Component(props, context) {\r\n\tthis.props = props;\r\n\tthis.context = context;\r\n}\r\n\r\n/**\r\n * Update component state and schedule a re-render.\r\n * @this {import('./internal').Component}\r\n * @param {object | ((s: object, p: object) => object)} update A hash of state\r\n * properties to update with new values or a function that given the current\r\n * state and props returns a new partial state\r\n * @param {() => void} [callback] A function to be called once component state is\r\n * updated\r\n */\r\nComponent.prototype.setState = function(update, callback) {\r\n\t// only clone state when copying to nextState the first time.\r\n\tlet s;\r\n\tif (this._nextState != null && this._nextState !== this.state) {\r\n\t\ts = this._nextState;\r\n\t} else {\r\n\t\ts = this._nextState = assign({}, this.state);\r\n\t}\r\n\r\n\tif (typeof update == 'function') {\r\n\t\t// Some libraries like `immer` mark the current state as readonly,\r\n\t\t// preventing us from mutating it, so we need to clone it. See #2716\r\n\t\tupdate = update(assign({}, s), this.props);\r\n\t}\r\n\r\n\tif (update) {\r\n\t\tassign(s, update);\r\n\t}\r\n\r\n\t// Skip update if updater function returned null\r\n\tif (update == null) return;\r\n\r\n\tif (this._vnode) {\r\n\t\tif (callback) this._renderCallbacks.push(callback);\r\n\t\tenqueueRender(this);\r\n\t}\r\n};\r\n\r\n/**\r\n * Immediately perform a synchronous re-render of the component\r\n * @this {import('./internal').Component}\r\n * @param {() => void} [callback] A function to be called after component is\r\n * re-rendered\r\n */\r\nComponent.prototype.forceUpdate = function(callback) {\r\n\tif (this._vnode) {\r\n\t\t// Set render mode so that we can differentiate where the render request\r\n\t\t// is coming from. We need this because forceUpdate should never call\r\n\t\t// shouldComponentUpdate\r\n\t\tthis._force = true;\r\n\t\tif (callback) this._renderCallbacks.push(callback);\r\n\t\tenqueueRender(this);\r\n\t}\r\n};\r\n\r\n/**\r\n * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\r\n * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\r\n * @param {object} props Props (eg: JSX attributes) received from parent\r\n * element/component\r\n * @param {object} state The component's current state\r\n * @param {object} context Context object, as returned by the nearest\r\n * ancestor's `getChildContext()`\r\n * @returns {import('./index').ComponentChildren | void}\r\n */\r\nComponent.prototype.render = Fragment;\r\n\r\n/**\r\n * @param {import('./internal').VNode} vnode\r\n * @param {number | null} [childIndex]\r\n */\r\nexport function getDomSibling(vnode, childIndex) {\r\n\tif (childIndex == null) {\r\n\t\t// Use childIndex==null as a signal to resume the search from the vnode's sibling\r\n\t\treturn vnode._parent\r\n\t\t\t? getDomSibling(vnode._parent, vnode._parent._children.indexOf(vnode) + 1)\r\n\t\t\t: null;\r\n\t}\r\n\r\n\tlet sibling;\r\n\tfor (; childIndex < vnode._children.length; childIndex++) {\r\n\t\tsibling = vnode._children[childIndex];\r\n\r\n\t\tif (sibling != null && sibling._dom != null) {\r\n\t\t\t// Since updateParentDomPointers keeps _dom pointer correct,\r\n\t\t\t// we can rely on _dom to tell us if this subtree contains a\r\n\t\t\t// rendered DOM node, and what the first rendered DOM node is\r\n\t\t\treturn sibling._dom;\r\n\t\t}\r\n\t}\r\n\r\n\t// If we get here, we have not found a DOM node in this vnode's children.\r\n\t// We must resume from this vnode's sibling (in it's parent _children array)\r\n\t// Only climb up and search the parent if we aren't searching through a DOM\r\n\t// VNode (meaning we reached the DOM parent of the original vnode that began\r\n\t// the search)\r\n\treturn typeof vnode.type == 'function' ? getDomSibling(vnode) : null;\r\n}\r\n\r\n/**\r\n * Trigger in-place re-rendering of a component.\r\n * @param {import('./internal').Component} component The component to rerender\r\n */\r\nfunction renderComponent(component) {\r\n\tlet vnode = component._vnode,\r\n\t\toldDom = vnode._dom,\r\n\t\tparentDom = component._parentDom;\r\n\r\n\tif (parentDom) {\r\n\t\tlet commitQueue = [];\r\n\t\tconst oldVNode = assign({}, vnode);\r\n\t\toldVNode._original = vnode._original + 1;\r\n\r\n\t\tdiff(\r\n\t\t\tparentDom,\r\n\t\t\tvnode,\r\n\t\t\toldVNode,\r\n\t\t\tcomponent._globalContext,\r\n\t\t\tparentDom.ownerSVGElement !== undefined,\r\n\t\t\tvnode._hydrating != null ? [oldDom] : null,\r\n\t\t\tcommitQueue,\r\n\t\t\toldDom == null ? getDomSibling(vnode) : oldDom,\r\n\t\t\tvnode._hydrating\r\n\t\t);\r\n\t\tcommitRoot(commitQueue, vnode);\r\n\r\n\t\tif (vnode._dom != oldDom) {\r\n\t\t\tupdateParentDomPointers(vnode);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {import('./internal').VNode} vnode\r\n */\r\nfunction updateParentDomPointers(vnode) {\r\n\tif ((vnode = vnode._parent) != null && vnode._component != null) {\r\n\t\tvnode._dom = vnode._component.base = null;\r\n\t\tfor (let i = 0; i < vnode._children.length; i++) {\r\n\t\t\tlet child = vnode._children[i];\r\n\t\t\tif (child != null && child._dom != null) {\r\n\t\t\t\tvnode._dom = vnode._component.base = child._dom;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn updateParentDomPointers(vnode);\r\n\t}\r\n}\r\n\r\n/**\r\n * The render queue\r\n * @type {Array}\r\n */\r\nlet rerenderQueue = [];\r\n\r\n/**\r\n * Asynchronously schedule a callback\r\n * @type {(cb: () => void) => void}\r\n */\r\n/* istanbul ignore next */\r\n// Note the following line isn't tree-shaken by rollup cuz of rollup/rollup#2566\r\nconst defer =\r\n\ttypeof Promise == 'function'\r\n\t\t? Promise.prototype.then.bind(Promise.resolve())\r\n\t\t: setTimeout;\r\n\r\n/*\r\n * The value of `Component.debounce` must asynchronously invoke the passed in callback. It is\r\n * important that contributors to Preact can consistently reason about what calls to `setState`, etc.\r\n * do, and when their effects will be applied. See the links below for some further reading on designing\r\n * asynchronous APIs.\r\n * * [Designing APIs for Asynchrony](https://blog.izs.me/2013/08/designing-apis-for-asynchrony)\r\n * * [Callbacks synchronous and asynchronous](https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/)\r\n */\r\n\r\nlet prevDebounce;\r\n\r\n/**\r\n * Enqueue a rerender of a component\r\n * @param {import('./internal').Component} c The component to rerender\r\n */\r\nexport function enqueueRender(c) {\r\n\tif (\r\n\t\t(!c._dirty &&\r\n\t\t\t(c._dirty = true) &&\r\n\t\t\trerenderQueue.push(c) &&\r\n\t\t\t!process._rerenderCount++) ||\r\n\t\tprevDebounce !== options.debounceRendering\r\n\t) {\r\n\t\tprevDebounce = options.debounceRendering;\r\n\t\t(prevDebounce || defer)(process);\r\n\t}\r\n}\r\n\r\n/** Flush the render queue by rerendering all queued components */\r\nfunction process() {\r\n\tlet queue;\r\n\twhile ((process._rerenderCount = rerenderQueue.length)) {\r\n\t\tqueue = rerenderQueue.sort((a, b) => a._vnode._depth - b._vnode._depth);\r\n\t\trerenderQueue = [];\r\n\t\t// Don't update `renderCount` yet. Keep its value non-zero to prevent unnecessary\r\n\t\t// process() calls from getting scheduled while `queue` is still being consumed.\r\n\t\tqueue.some(c => {\r\n\t\t\tif (c._dirty) renderComponent(c);\r\n\t\t});\r\n\t}\r\n}\r\nprocess._rerenderCount = 0;\r\n", "import { enqueueRender } from './component';\r\n\r\nexport let i = 0;\r\n\r\nexport function createContext(defaultValue, contextId) {\r\n\tcontextId = '__cC' + i++;\r\n\r\n\tconst context = {\r\n\t\t_id: contextId,\r\n\t\t_defaultValue: defaultValue,\r\n\t\t/** @type {import('./internal').FunctionComponent} */\r\n\t\tConsumer(props, contextValue) {\r\n\t\t\t// return props.children(\r\n\t\t\t// \tcontext[contextId] ? context[contextId].props.value : defaultValue\r\n\t\t\t// );\r\n\t\t\treturn props.children(contextValue);\r\n\t\t},\r\n\t\t/** @type {import('./internal').FunctionComponent} */\r\n\t\tProvider(props) {\r\n\t\t\tif (!this.getChildContext) {\r\n\t\t\t\tlet subs = [];\r\n\t\t\t\tlet ctx = {};\r\n\t\t\t\tctx[contextId] = this;\r\n\r\n\t\t\t\tthis.getChildContext = () => ctx;\r\n\r\n\t\t\t\tthis.shouldComponentUpdate = function(_props) {\r\n\t\t\t\t\tif (this.props.value !== _props.value) {\r\n\t\t\t\t\t\t// I think the forced value propagation here was only needed when `options.debounceRendering` was being bypassed:\r\n\t\t\t\t\t\t// https://github.com/preactjs/preact/commit/4d339fb803bea09e9f198abf38ca1bf8ea4b7771#diff-54682ce380935a717e41b8bfc54737f6R358\r\n\t\t\t\t\t\t// In those cases though, even with the value corrected, we're double-rendering all nodes.\r\n\t\t\t\t\t\t// It might be better to just tell folks not to use force-sync mode.\r\n\t\t\t\t\t\t// Currently, using `useContext()` in a class component will overwrite its `this.context` value.\r\n\t\t\t\t\t\t// subs.some(c => {\r\n\t\t\t\t\t\t// \tc.context = _props.value;\r\n\t\t\t\t\t\t// \tenqueueRender(c);\r\n\t\t\t\t\t\t// });\r\n\r\n\t\t\t\t\t\t// subs.some(c => {\r\n\t\t\t\t\t\t// \tc.context[contextId] = _props.value;\r\n\t\t\t\t\t\t// \tenqueueRender(c);\r\n\t\t\t\t\t\t// });\r\n\t\t\t\t\t\tsubs.some(enqueueRender);\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\r\n\t\t\t\tthis.sub = c => {\r\n\t\t\t\t\tsubs.push(c);\r\n\t\t\t\t\tlet old = c.componentWillUnmount;\r\n\t\t\t\t\tc.componentWillUnmount = () => {\r\n\t\t\t\t\t\tsubs.splice(subs.indexOf(c), 1);\r\n\t\t\t\t\t\tif (old) old.call(c);\r\n\t\t\t\t\t};\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\treturn props.children;\r\n\t\t}\r\n\t};\r\n\r\n\t// Devtools needs access to the context object when it\r\n\t// encounters a Provider. This is necessary to support\r\n\t// setting `displayName` on the context object instead\r\n\t// of on the component itself. See:\r\n\t// https://reactjs.org/docs/context.html#contextdisplayname\r\n\r\n\treturn (context.Provider._contextRef = context.Consumer.contextType = context);\r\n}\r\n", "import { diff, unmount, applyRef } from './index';\r\nimport { createVNode, Fragment } from '../create-element';\r\nimport { EMPTY_OBJ, EMPTY_ARR } from '../constants';\r\nimport { getDomSibling } from '../component';\r\n\r\n/**\r\n * Diff the children of a virtual node\r\n * @param {import('../internal').PreactElement} parentDom The DOM element whose\r\n * children are being diffed\r\n * @param {import('../internal').ComponentChildren[]} renderResult\r\n * @param {import('../internal').VNode} newParentVNode The new virtual\r\n * node whose children should be diff'ed against oldParentVNode\r\n * @param {import('../internal').VNode} oldParentVNode The old virtual\r\n * node whose children should be diff'ed against newParentVNode\r\n * @param {object} globalContext The current context object - modified by getChildContext\r\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\r\n * @param {Array} excessDomChildren\r\n * @param {Array} commitQueue List of components\r\n * which have callbacks to invoke in commitRoot\r\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\r\n * element any new dom elements should be placed around. Likely `null` on first\r\n * render (except when hydrating). Can be a sibling DOM element when diffing\r\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\r\n * @param {boolean} isHydrating Whether or not we are in hydration\r\n */\r\nexport function diffChildren(\r\n\tparentDom,\r\n\trenderResult,\r\n\tnewParentVNode,\r\n\toldParentVNode,\r\n\tglobalContext,\r\n\tisSvg,\r\n\texcessDomChildren,\r\n\tcommitQueue,\r\n\toldDom,\r\n\tisHydrating\r\n) {\r\n\tlet i, j, oldVNode, childVNode, newDom, firstChildDom, refs;\r\n\r\n\t// This is a compression of oldParentVNode!=null && oldParentVNode != EMPTY_OBJ && oldParentVNode._children || EMPTY_ARR\r\n\t// as EMPTY_OBJ._children should be `undefined`.\r\n\tlet oldChildren = (oldParentVNode && oldParentVNode._children) || EMPTY_ARR;\r\n\r\n\tlet oldChildrenLength = oldChildren.length;\r\n\r\n\tnewParentVNode._children = [];\r\n\tfor (i = 0; i < renderResult.length; i++) {\r\n\t\tchildVNode = renderResult[i];\r\n\r\n\t\tif (childVNode == null || typeof childVNode == 'boolean') {\r\n\t\t\tchildVNode = newParentVNode._children[i] = null;\r\n\t\t}\r\n\t\t// If this newVNode is being reused (e.g.
{reuse}{reuse}
) in the same diff,\r\n\t\t// or we are rendering a component (e.g. setState) copy the oldVNodes so it can have\r\n\t\t// it's own DOM & etc. pointers\r\n\t\telse if (\r\n\t\t\ttypeof childVNode == 'string' ||\r\n\t\t\ttypeof childVNode == 'number' ||\r\n\t\t\t// eslint-disable-next-line valid-typeof\r\n\t\t\ttypeof childVNode == 'bigint'\r\n\t\t) {\r\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\r\n\t\t\t\tnull,\r\n\t\t\t\tchildVNode,\r\n\t\t\t\tnull,\r\n\t\t\t\tnull,\r\n\t\t\t\tchildVNode\r\n\t\t\t);\r\n\t\t} else if (Array.isArray(childVNode)) {\r\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\r\n\t\t\t\tFragment,\r\n\t\t\t\t{ children: childVNode },\r\n\t\t\t\tnull,\r\n\t\t\t\tnull,\r\n\t\t\t\tnull\r\n\t\t\t);\r\n\t\t} else if (childVNode._depth > 0) {\r\n\t\t\t// VNode is already in use, clone it. This can happen in the following\r\n\t\t\t// scenario:\r\n\t\t\t// const reuse =
\r\n\t\t\t//
{reuse}{reuse}
\r\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\r\n\t\t\t\tchildVNode.type,\r\n\t\t\t\tchildVNode.props,\r\n\t\t\t\tchildVNode.key,\r\n\t\t\t\tnull,\r\n\t\t\t\tchildVNode._original\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\tchildVNode = newParentVNode._children[i] = childVNode;\r\n\t\t}\r\n\r\n\t\t// Terser removes the `continue` here and wraps the loop body\r\n\t\t// in a `if (childVNode) { ... } condition\r\n\t\tif (childVNode == null) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tchildVNode._parent = newParentVNode;\r\n\t\tchildVNode._depth = newParentVNode._depth + 1;\r\n\r\n\t\t// Check if we find a corresponding element in oldChildren.\r\n\t\t// If found, delete the array item by setting to `undefined`.\r\n\t\t// We use `undefined`, as `null` is reserved for empty placeholders\r\n\t\t// (holes).\r\n\t\toldVNode = oldChildren[i];\r\n\r\n\t\tif (\r\n\t\t\toldVNode === null ||\r\n\t\t\t(oldVNode &&\r\n\t\t\t\tchildVNode.key == oldVNode.key &&\r\n\t\t\t\tchildVNode.type === oldVNode.type)\r\n\t\t) {\r\n\t\t\toldChildren[i] = undefined;\r\n\t\t} else {\r\n\t\t\t// Either oldVNode === undefined or oldChildrenLength > 0,\r\n\t\t\t// so after this loop oldVNode == null or oldVNode is a valid value.\r\n\t\t\tfor (j = 0; j < oldChildrenLength; j++) {\r\n\t\t\t\toldVNode = oldChildren[j];\r\n\t\t\t\t// If childVNode is unkeyed, we only match similarly unkeyed nodes, otherwise we match by key.\r\n\t\t\t\t// We always match by type (in either case).\r\n\t\t\t\tif (\r\n\t\t\t\t\toldVNode &&\r\n\t\t\t\t\tchildVNode.key == oldVNode.key &&\r\n\t\t\t\t\tchildVNode.type === oldVNode.type\r\n\t\t\t\t) {\r\n\t\t\t\t\toldChildren[j] = undefined;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\toldVNode = null;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\toldVNode = oldVNode || EMPTY_OBJ;\r\n\r\n\t\t// Morph the old element into the new one, but don't append it to the dom yet\r\n\t\tdiff(\r\n\t\t\tparentDom,\r\n\t\t\tchildVNode,\r\n\t\t\toldVNode,\r\n\t\t\tglobalContext,\r\n\t\t\tisSvg,\r\n\t\t\texcessDomChildren,\r\n\t\t\tcommitQueue,\r\n\t\t\toldDom,\r\n\t\t\tisHydrating\r\n\t\t);\r\n\r\n\t\tnewDom = childVNode._dom;\r\n\r\n\t\tif ((j = childVNode.ref) && oldVNode.ref != j) {\r\n\t\t\tif (!refs) refs = [];\r\n\t\t\tif (oldVNode.ref) refs.push(oldVNode.ref, null, childVNode);\r\n\t\t\trefs.push(j, childVNode._component || newDom, childVNode);\r\n\t\t}\r\n\r\n\t\tif (newDom != null) {\r\n\t\t\tif (firstChildDom == null) {\r\n\t\t\t\tfirstChildDom = newDom;\r\n\t\t\t}\r\n\r\n\t\t\tif (\r\n\t\t\t\ttypeof childVNode.type == 'function' &&\r\n\t\t\t\tchildVNode._children === oldVNode._children\r\n\t\t\t) {\r\n\t\t\t\tchildVNode._nextDom = oldDom = reorderChildren(\r\n\t\t\t\t\tchildVNode,\r\n\t\t\t\t\toldDom,\r\n\t\t\t\t\tparentDom\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\toldDom = placeChild(\r\n\t\t\t\t\tparentDom,\r\n\t\t\t\t\tchildVNode,\r\n\t\t\t\t\toldVNode,\r\n\t\t\t\t\toldChildren,\r\n\t\t\t\t\tnewDom,\r\n\t\t\t\t\toldDom\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\tif (typeof newParentVNode.type == 'function') {\r\n\t\t\t\t// Because the newParentVNode is Fragment-like, we need to set it's\r\n\t\t\t\t// _nextDom property to the nextSibling of its last child DOM node.\r\n\t\t\t\t//\r\n\t\t\t\t// `oldDom` contains the correct value here because if the last child\r\n\t\t\t\t// is a Fragment-like, then oldDom has already been set to that child's _nextDom.\r\n\t\t\t\t// If the last child is a DOM VNode, then oldDom will be set to that DOM\r\n\t\t\t\t// node's nextSibling.\r\n\t\t\t\tnewParentVNode._nextDom = oldDom;\r\n\t\t\t}\r\n\t\t} else if (\r\n\t\t\toldDom &&\r\n\t\t\toldVNode._dom == oldDom &&\r\n\t\t\toldDom.parentNode != parentDom\r\n\t\t) {\r\n\t\t\t// The above condition is to handle null placeholders. See test in placeholder.test.js:\r\n\t\t\t// `efficiently replace null placeholders in parent rerenders`\r\n\t\t\toldDom = getDomSibling(oldVNode);\r\n\t\t}\r\n\t}\r\n\r\n\tnewParentVNode._dom = firstChildDom;\r\n\r\n\t// Remove remaining oldChildren if there are any.\r\n\tfor (i = oldChildrenLength; i--; ) {\r\n\t\tif (oldChildren[i] != null) {\r\n\t\t\tif (\r\n\t\t\t\ttypeof newParentVNode.type == 'function' &&\r\n\t\t\t\toldChildren[i]._dom != null &&\r\n\t\t\t\toldChildren[i]._dom == newParentVNode._nextDom\r\n\t\t\t) {\r\n\t\t\t\t// If the newParentVNode.__nextDom points to a dom node that is about to\r\n\t\t\t\t// be unmounted, then get the next sibling of that vnode and set\r\n\t\t\t\t// _nextDom to it\r\n\t\t\t\tnewParentVNode._nextDom = getDomSibling(oldParentVNode, i + 1);\r\n\t\t\t}\r\n\r\n\t\t\tunmount(oldChildren[i], oldChildren[i]);\r\n\t\t}\r\n\t}\r\n\r\n\t// Set refs only after unmount\r\n\tif (refs) {\r\n\t\tfor (i = 0; i < refs.length; i++) {\r\n\t\t\tapplyRef(refs[i], refs[++i], refs[++i]);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction reorderChildren(childVNode, oldDom, parentDom) {\r\n\t// Note: VNodes in nested suspended trees may be missing _children.\r\n\tlet c = childVNode._children;\r\n\tlet tmp = 0;\r\n\tfor (; c && tmp < c.length; tmp++) {\r\n\t\tlet vnode = c[tmp];\r\n\t\tif (vnode) {\r\n\t\t\t// We typically enter this code path on sCU bailout, where we copy\r\n\t\t\t// oldVNode._children to newVNode._children. If that is the case, we need\r\n\t\t\t// to update the old children's _parent pointer to point to the newVNode\r\n\t\t\t// (childVNode here).\r\n\t\t\tvnode._parent = childVNode;\r\n\r\n\t\t\tif (typeof vnode.type == 'function') {\r\n\t\t\t\toldDom = reorderChildren(vnode, oldDom, parentDom);\r\n\t\t\t} else {\r\n\t\t\t\toldDom = placeChild(\r\n\t\t\t\t\tparentDom,\r\n\t\t\t\t\tvnode,\r\n\t\t\t\t\tvnode,\r\n\t\t\t\t\tc,\r\n\t\t\t\t\tvnode._dom,\r\n\t\t\t\t\toldDom\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn oldDom;\r\n}\r\n\r\n/**\r\n * Flatten and loop through the children of a virtual node\r\n * @param {import('../index').ComponentChildren} children The unflattened\r\n * children of a virtual node\r\n * @returns {import('../internal').VNode[]}\r\n */\r\nexport function toChildArray(children, out) {\r\n\tout = out || [];\r\n\tif (children == null || typeof children == 'boolean') {\r\n\t} else if (Array.isArray(children)) {\r\n\t\tchildren.some(child => {\r\n\t\t\ttoChildArray(child, out);\r\n\t\t});\r\n\t} else {\r\n\t\tout.push(children);\r\n\t}\r\n\treturn out;\r\n}\r\n\r\nfunction placeChild(\r\n\tparentDom,\r\n\tchildVNode,\r\n\toldVNode,\r\n\toldChildren,\r\n\tnewDom,\r\n\toldDom\r\n) {\r\n\tlet nextDom;\r\n\tif (childVNode._nextDom !== undefined) {\r\n\t\t// Only Fragments or components that return Fragment like VNodes will\r\n\t\t// have a non-undefined _nextDom. Continue the diff from the sibling\r\n\t\t// of last DOM child of this child VNode\r\n\t\tnextDom = childVNode._nextDom;\r\n\r\n\t\t// Eagerly cleanup _nextDom. We don't need to persist the value because\r\n\t\t// it is only used by `diffChildren` to determine where to resume the diff after\r\n\t\t// diffing Components and Fragments. Once we store it the nextDOM local var, we\r\n\t\t// can clean up the property\r\n\t\tchildVNode._nextDom = undefined;\r\n\t} else if (\r\n\t\toldVNode == null ||\r\n\t\tnewDom != oldDom ||\r\n\t\tnewDom.parentNode == null\r\n\t) {\r\n\t\touter: if (oldDom == null || oldDom.parentNode !== parentDom) {\r\n\t\t\tparentDom.appendChild(newDom);\r\n\t\t\tnextDom = null;\r\n\t\t} else {\r\n\t\t\t// `j href (xlink:href was removed from SVG and isn't needed)\r\n\t\t\t// - className --> class\r\n\t\t\tname = name.replace(/xlink[H:h]/, 'h').replace(/sName$/, 's');\r\n\t\t} else if (\r\n\t\t\tname !== 'href' &&\r\n\t\t\tname !== 'list' &&\r\n\t\t\tname !== 'form' &&\r\n\t\t\t// Default value in browsers is `-1` and an empty string is\r\n\t\t\t// cast to `0` instead\r\n\t\t\tname !== 'tabIndex' &&\r\n\t\t\tname !== 'download' &&\r\n\t\t\tname in dom\r\n\t\t) {\r\n\t\t\ttry {\r\n\t\t\t\tdom[name] = value == null ? '' : value;\r\n\t\t\t\t// labelled break is 1b smaller here than a return statement (sorry)\r\n\t\t\t\tbreak o;\r\n\t\t\t} catch (e) {}\r\n\t\t}\r\n\r\n\t\t// ARIA-attributes have a different notion of boolean values.\r\n\t\t// The value `false` is different from the attribute not\r\n\t\t// existing on the DOM, so we can't remove it. For non-boolean\r\n\t\t// ARIA-attributes we could treat false as a removal, but the\r\n\t\t// amount of exceptions would cost us too many bytes. On top of\r\n\t\t// that other VDOM frameworks also always stringify `false`.\r\n\r\n\t\tif (typeof value === 'function') {\r\n\t\t\t// never serialize functions as attribute values\r\n\t\t} else if (\r\n\t\t\tvalue != null &&\r\n\t\t\t(value !== false || (name[0] === 'a' && name[1] === 'r'))\r\n\t\t) {\r\n\t\t\tdom.setAttribute(name, value);\r\n\t\t} else {\r\n\t\t\tdom.removeAttribute(name);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Proxy an event to hooked event handlers\r\n * @param {Event} e The event object from the browser\r\n * @private\r\n */\r\nfunction eventProxy(e) {\r\n\tthis._listeners[e.type + false](options.event ? options.event(e) : e);\r\n}\r\n\r\nfunction eventProxyCapture(e) {\r\n\tthis._listeners[e.type + true](options.event ? options.event(e) : e);\r\n}\r\n", "import { EMPTY_OBJ } from '../constants';\r\nimport { Component, getDomSibling } from '../component';\r\nimport { Fragment } from '../create-element';\r\nimport { diffChildren } from './children';\r\nimport { diffProps, setProperty } from './props';\r\nimport { assign, removeNode, slice } from '../util';\r\nimport options from '../options';\r\n\r\n/**\r\n * Diff two virtual nodes and apply proper changes to the DOM\r\n * @param {import('../internal').PreactElement} parentDom The parent of the DOM element\r\n * @param {import('../internal').VNode} newVNode The new virtual node\r\n * @param {import('../internal').VNode} oldVNode The old virtual node\r\n * @param {object} globalContext The current context object. Modified by getChildContext\r\n * @param {boolean} isSvg Whether or not this element is an SVG node\r\n * @param {Array} excessDomChildren\r\n * @param {Array} commitQueue List of components\r\n * which have callbacks to invoke in commitRoot\r\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\r\n * element any new dom elements should be placed around. Likely `null` on first\r\n * render (except when hydrating). Can be a sibling DOM element when diffing\r\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\r\n * @param {boolean} [isHydrating] Whether or not we are in hydration\r\n */\r\nexport function diff(\r\n\tparentDom,\r\n\tnewVNode,\r\n\toldVNode,\r\n\tglobalContext,\r\n\tisSvg,\r\n\texcessDomChildren,\r\n\tcommitQueue,\r\n\toldDom,\r\n\tisHydrating\r\n) {\r\n\tlet tmp,\r\n\t\tnewType = newVNode.type;\r\n\r\n\t// When passing through createElement it assigns the object\r\n\t// constructor as undefined. This to prevent JSON-injection.\r\n\tif (newVNode.constructor !== undefined) return null;\r\n\r\n\t// If the previous diff bailed out, resume creating/hydrating.\r\n\tif (oldVNode._hydrating != null) {\r\n\t\tisHydrating = oldVNode._hydrating;\r\n\t\toldDom = newVNode._dom = oldVNode._dom;\r\n\t\t// if we resume, we want the tree to be \"unlocked\"\r\n\t\tnewVNode._hydrating = null;\r\n\t\texcessDomChildren = [oldDom];\r\n\t}\r\n\r\n\tif ((tmp = options._diff)) tmp(newVNode);\r\n\r\n\ttry {\r\n\t\touter: if (typeof newType == 'function') {\r\n\t\t\tlet c, isNew, oldProps, oldState, snapshot, clearProcessingException;\r\n\t\t\tlet newProps = newVNode.props;\r\n\r\n\t\t\t// Necessary for createContext api. Setting this property will pass\r\n\t\t\t// the context value as `this.context` just for this component.\r\n\t\t\ttmp = newType.contextType;\r\n\t\t\tlet provider = tmp && globalContext[tmp._id];\r\n\t\t\tlet componentContext = tmp\r\n\t\t\t\t? provider\r\n\t\t\t\t\t? provider.props.value\r\n\t\t\t\t\t: tmp._defaultValue\r\n\t\t\t\t: globalContext;\r\n\r\n\t\t\t// Get component and set it to `c`\r\n\t\t\tif (oldVNode._component) {\r\n\t\t\t\tc = newVNode._component = oldVNode._component;\r\n\t\t\t\tclearProcessingException = c._processingException = c._pendingError;\r\n\t\t\t} else {\r\n\t\t\t\t// Instantiate the new component\r\n\t\t\t\tif ('prototype' in newType && newType.prototype.render) {\r\n\t\t\t\t\t// @ts-ignore The check above verifies that newType is suppose to be constructed\r\n\t\t\t\t\tnewVNode._component = c = new newType(newProps, componentContext); // eslint-disable-line new-cap\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// @ts-ignore Trust me, Component implements the interface we want\r\n\t\t\t\t\tnewVNode._component = c = new Component(newProps, componentContext);\r\n\t\t\t\t\tc.constructor = newType;\r\n\t\t\t\t\tc.render = doRender;\r\n\t\t\t\t}\r\n\t\t\t\tif (provider) provider.sub(c);\r\n\r\n\t\t\t\tc.props = newProps;\r\n\t\t\t\tif (!c.state) c.state = {};\r\n\t\t\t\tc.context = componentContext;\r\n\t\t\t\tc._globalContext = globalContext;\r\n\t\t\t\tisNew = c._dirty = true;\r\n\t\t\t\tc._renderCallbacks = [];\r\n\t\t\t}\r\n\r\n\t\t\t// Invoke getDerivedStateFromProps\r\n\t\t\tif (c._nextState == null) {\r\n\t\t\t\tc._nextState = c.state;\r\n\t\t\t}\r\n\t\t\tif (newType.getDerivedStateFromProps != null) {\r\n\t\t\t\tif (c._nextState == c.state) {\r\n\t\t\t\t\tc._nextState = assign({}, c._nextState);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tassign(\r\n\t\t\t\t\tc._nextState,\r\n\t\t\t\t\tnewType.getDerivedStateFromProps(newProps, c._nextState)\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\toldProps = c.props;\r\n\t\t\toldState = c.state;\r\n\r\n\t\t\t// Invoke pre-render lifecycle methods\r\n\t\t\tif (isNew) {\r\n\t\t\t\tif (\r\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\r\n\t\t\t\t\tc.componentWillMount != null\r\n\t\t\t\t) {\r\n\t\t\t\t\tc.componentWillMount();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (c.componentDidMount != null) {\r\n\t\t\t\t\tc._renderCallbacks.push(c.componentDidMount);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (\r\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\r\n\t\t\t\t\tnewProps !== oldProps &&\r\n\t\t\t\t\tc.componentWillReceiveProps != null\r\n\t\t\t\t) {\r\n\t\t\t\t\tc.componentWillReceiveProps(newProps, componentContext);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\t(!c._force &&\r\n\t\t\t\t\t\tc.shouldComponentUpdate != null &&\r\n\t\t\t\t\t\tc.shouldComponentUpdate(\r\n\t\t\t\t\t\t\tnewProps,\r\n\t\t\t\t\t\t\tc._nextState,\r\n\t\t\t\t\t\t\tcomponentContext\r\n\t\t\t\t\t\t) === false) ||\r\n\t\t\t\t\tnewVNode._original === oldVNode._original\r\n\t\t\t\t) {\r\n\t\t\t\t\tc.props = newProps;\r\n\t\t\t\t\tc.state = c._nextState;\r\n\t\t\t\t\t// More info about this here: https://gist.github.com/JoviDeCroock/bec5f2ce93544d2e6070ef8e0036e4e8\r\n\t\t\t\t\tif (newVNode._original !== oldVNode._original) c._dirty = false;\r\n\t\t\t\t\tc._vnode = newVNode;\r\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\r\n\t\t\t\t\tnewVNode._children = oldVNode._children;\r\n\t\t\t\t\tnewVNode._children.forEach(vnode => {\r\n\t\t\t\t\t\tif (vnode) vnode._parent = newVNode;\r\n\t\t\t\t\t});\r\n\t\t\t\t\tif (c._renderCallbacks.length) {\r\n\t\t\t\t\t\tcommitQueue.push(c);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak outer;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (c.componentWillUpdate != null) {\r\n\t\t\t\t\tc.componentWillUpdate(newProps, c._nextState, componentContext);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (c.componentDidUpdate != null) {\r\n\t\t\t\t\tc._renderCallbacks.push(() => {\r\n\t\t\t\t\t\tc.componentDidUpdate(oldProps, oldState, snapshot);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tc.context = componentContext;\r\n\t\t\tc.props = newProps;\r\n\t\t\tc.state = c._nextState;\r\n\r\n\t\t\tif ((tmp = options._render)) tmp(newVNode);\r\n\r\n\t\t\tc._dirty = false;\r\n\t\t\tc._vnode = newVNode;\r\n\t\t\tc._parentDom = parentDom;\r\n\r\n\t\t\ttmp = c.render(c.props, c.state, c.context);\r\n\r\n\t\t\t// Handle setState called in render, see #2553\r\n\t\t\tc.state = c._nextState;\r\n\r\n\t\t\tif (c.getChildContext != null) {\r\n\t\t\t\tglobalContext = assign(assign({}, globalContext), c.getChildContext());\r\n\t\t\t}\r\n\r\n\t\t\tif (!isNew && c.getSnapshotBeforeUpdate != null) {\r\n\t\t\t\tsnapshot = c.getSnapshotBeforeUpdate(oldProps, oldState);\r\n\t\t\t}\r\n\r\n\t\t\tlet isTopLevelFragment =\r\n\t\t\t\ttmp != null && tmp.type === Fragment && tmp.key == null;\r\n\t\t\tlet renderResult = isTopLevelFragment ? tmp.props.children : tmp;\r\n\r\n\t\t\tdiffChildren(\r\n\t\t\t\tparentDom,\r\n\t\t\t\tArray.isArray(renderResult) ? renderResult : [renderResult],\r\n\t\t\t\tnewVNode,\r\n\t\t\t\toldVNode,\r\n\t\t\t\tglobalContext,\r\n\t\t\t\tisSvg,\r\n\t\t\t\texcessDomChildren,\r\n\t\t\t\tcommitQueue,\r\n\t\t\t\toldDom,\r\n\t\t\t\tisHydrating\r\n\t\t\t);\r\n\r\n\t\t\tc.base = newVNode._dom;\r\n\r\n\t\t\t// We successfully rendered this VNode, unset any stored hydration/bailout state:\r\n\t\t\tnewVNode._hydrating = null;\r\n\r\n\t\t\tif (c._renderCallbacks.length) {\r\n\t\t\t\tcommitQueue.push(c);\r\n\t\t\t}\r\n\r\n\t\t\tif (clearProcessingException) {\r\n\t\t\t\tc._pendingError = c._processingException = null;\r\n\t\t\t}\r\n\r\n\t\t\tc._force = false;\r\n\t\t} else if (\r\n\t\t\texcessDomChildren == null &&\r\n\t\t\tnewVNode._original === oldVNode._original\r\n\t\t) {\r\n\t\t\tnewVNode._children = oldVNode._children;\r\n\t\t\tnewVNode._dom = oldVNode._dom;\r\n\t\t} else {\r\n\t\t\tnewVNode._dom = diffElementNodes(\r\n\t\t\t\toldVNode._dom,\r\n\t\t\t\tnewVNode,\r\n\t\t\t\toldVNode,\r\n\t\t\t\tglobalContext,\r\n\t\t\t\tisSvg,\r\n\t\t\t\texcessDomChildren,\r\n\t\t\t\tcommitQueue,\r\n\t\t\t\tisHydrating\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tif ((tmp = options.diffed)) tmp(newVNode);\r\n\t} catch (e) {\r\n\t\tnewVNode._original = null;\r\n\t\t// if hydrating or creating initial tree, bailout preserves DOM:\r\n\t\tif (isHydrating || excessDomChildren != null) {\r\n\t\t\tnewVNode._dom = oldDom;\r\n\t\t\tnewVNode._hydrating = !!isHydrating;\r\n\t\t\texcessDomChildren[excessDomChildren.indexOf(oldDom)] = null;\r\n\t\t\t// ^ could possibly be simplified to:\r\n\t\t\t// excessDomChildren.length = 0;\r\n\t\t}\r\n\t\toptions._catchError(e, newVNode, oldVNode);\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {Array} commitQueue List of components\r\n * which have callbacks to invoke in commitRoot\r\n * @param {import('../internal').VNode} root\r\n */\r\nexport function commitRoot(commitQueue, root) {\r\n\tif (options._commit) options._commit(root, commitQueue);\r\n\r\n\tcommitQueue.some(c => {\r\n\t\ttry {\r\n\t\t\t// @ts-ignore Reuse the commitQueue variable here so the type changes\r\n\t\t\tcommitQueue = c._renderCallbacks;\r\n\t\t\tc._renderCallbacks = [];\r\n\t\t\tcommitQueue.some(cb => {\r\n\t\t\t\t// @ts-ignore See above ts-ignore on commitQueue\r\n\t\t\t\tcb.call(c);\r\n\t\t\t});\r\n\t\t} catch (e) {\r\n\t\t\toptions._catchError(e, c._vnode);\r\n\t\t}\r\n\t});\r\n}\r\n\r\n/**\r\n * Diff two virtual nodes representing DOM element\r\n * @param {import('../internal').PreactElement} dom The DOM element representing\r\n * the virtual nodes being diffed\r\n * @param {import('../internal').VNode} newVNode The new virtual node\r\n * @param {import('../internal').VNode} oldVNode The old virtual node\r\n * @param {object} globalContext The current context object\r\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\r\n * @param {*} excessDomChildren\r\n * @param {Array} commitQueue List of components\r\n * which have callbacks to invoke in commitRoot\r\n * @param {boolean} isHydrating Whether or not we are in hydration\r\n * @returns {import('../internal').PreactElement}\r\n */\r\nfunction diffElementNodes(\r\n\tdom,\r\n\tnewVNode,\r\n\toldVNode,\r\n\tglobalContext,\r\n\tisSvg,\r\n\texcessDomChildren,\r\n\tcommitQueue,\r\n\tisHydrating\r\n) {\r\n\tlet oldProps = oldVNode.props;\r\n\tlet newProps = newVNode.props;\r\n\tlet nodeType = newVNode.type;\r\n\tlet i = 0;\r\n\r\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\r\n\tif (nodeType === 'svg') isSvg = true;\r\n\r\n\tif (excessDomChildren != null) {\r\n\t\tfor (; i < excessDomChildren.length; i++) {\r\n\t\t\tconst child = excessDomChildren[i];\r\n\r\n\t\t\t// if newVNode matches an element in excessDomChildren or the `dom`\r\n\t\t\t// argument matches an element in excessDomChildren, remove it from\r\n\t\t\t// excessDomChildren so it isn't later removed in diffChildren\r\n\t\t\tif (\r\n\t\t\t\tchild &&\r\n\t\t\t\t'setAttribute' in child === !!nodeType &&\r\n\t\t\t\t(nodeType ? child.localName === nodeType : child.nodeType === 3)\r\n\t\t\t) {\r\n\t\t\t\tdom = child;\r\n\t\t\t\texcessDomChildren[i] = null;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (dom == null) {\r\n\t\tif (nodeType === null) {\r\n\t\t\t// @ts-ignore createTextNode returns Text, we expect PreactElement\r\n\t\t\treturn document.createTextNode(newProps);\r\n\t\t}\r\n\r\n\t\tif (isSvg) {\r\n\t\t\tdom = document.createElementNS(\r\n\t\t\t\t'http://www.w3.org/2000/svg',\r\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\r\n\t\t\t\tnodeType\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\tdom = document.createElement(\r\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\r\n\t\t\t\tnodeType,\r\n\t\t\t\tnewProps.is && newProps\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\t// we created a new parent, so none of the previously attached children can be reused:\r\n\t\texcessDomChildren = null;\r\n\t\t// we are creating a new node, so we can assume this is a new subtree (in case we are hydrating), this deopts the hydrate\r\n\t\tisHydrating = false;\r\n\t}\r\n\r\n\tif (nodeType === null) {\r\n\t\t// During hydration, we still have to split merged text from SSR'd HTML.\r\n\t\tif (oldProps !== newProps && (!isHydrating || dom.data !== newProps)) {\r\n\t\t\tdom.data = newProps;\r\n\t\t}\r\n\t} else {\r\n\t\t// If excessDomChildren was not null, repopulate it with the current element's children:\r\n\t\texcessDomChildren = excessDomChildren && slice.call(dom.childNodes);\r\n\r\n\t\toldProps = oldVNode.props || EMPTY_OBJ;\r\n\r\n\t\tlet oldHtml = oldProps.dangerouslySetInnerHTML;\r\n\t\tlet newHtml = newProps.dangerouslySetInnerHTML;\r\n\r\n\t\t// During hydration, props are not diffed at all (including dangerouslySetInnerHTML)\r\n\t\t// @TODO we should warn in debug mode when props don't match here.\r\n\t\tif (!isHydrating) {\r\n\t\t\t// But, if we are in a situation where we are using existing DOM (e.g. replaceNode)\r\n\t\t\t// we should read the existing DOM attributes to diff them\r\n\t\t\tif (excessDomChildren != null) {\r\n\t\t\t\toldProps = {};\r\n\t\t\t\tfor (i = 0; i < dom.attributes.length; i++) {\r\n\t\t\t\t\toldProps[dom.attributes[i].name] = dom.attributes[i].value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (newHtml || oldHtml) {\r\n\t\t\t\t// Avoid re-applying the same '__html' if it did not changed between re-render\r\n\t\t\t\tif (\r\n\t\t\t\t\t!newHtml ||\r\n\t\t\t\t\t((!oldHtml || newHtml.__html != oldHtml.__html) &&\r\n\t\t\t\t\t\tnewHtml.__html !== dom.innerHTML)\r\n\t\t\t\t) {\r\n\t\t\t\t\tdom.innerHTML = (newHtml && newHtml.__html) || '';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tdiffProps(dom, newProps, oldProps, isSvg, isHydrating);\r\n\r\n\t\t// If the new vnode didn't have dangerouslySetInnerHTML, diff its children\r\n\t\tif (newHtml) {\r\n\t\t\tnewVNode._children = [];\r\n\t\t} else {\r\n\t\t\ti = newVNode.props.children;\r\n\t\t\tdiffChildren(\r\n\t\t\t\tdom,\r\n\t\t\t\tArray.isArray(i) ? i : [i],\r\n\t\t\t\tnewVNode,\r\n\t\t\t\toldVNode,\r\n\t\t\t\tglobalContext,\r\n\t\t\t\tisSvg && nodeType !== 'foreignObject',\r\n\t\t\t\texcessDomChildren,\r\n\t\t\t\tcommitQueue,\r\n\t\t\t\texcessDomChildren\r\n\t\t\t\t\t? excessDomChildren[0]\r\n\t\t\t\t\t: oldVNode._children && getDomSibling(oldVNode, 0),\r\n\t\t\t\tisHydrating\r\n\t\t\t);\r\n\r\n\t\t\t// Remove children that are not part of any vnode.\r\n\t\t\tif (excessDomChildren != null) {\r\n\t\t\t\tfor (i = excessDomChildren.length; i--; ) {\r\n\t\t\t\t\tif (excessDomChildren[i] != null) removeNode(excessDomChildren[i]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// (as above, don't diff props during hydration)\r\n\t\tif (!isHydrating) {\r\n\t\t\tif (\r\n\t\t\t\t'value' in newProps &&\r\n\t\t\t\t(i = newProps.value) !== undefined &&\r\n\t\t\t\t// #2756 For the -element the initial value is 0,\r\n\t\t\t\t// despite the attribute not being present. When the attribute\r\n\t\t\t\t// is missing the progress bar is treated as indeterminate.\r\n\t\t\t\t// To fix that we'll always update it when it is 0 for progress elements\r\n\t\t\t\t(i !== oldProps.value ||\r\n\t\t\t\t\ti !== dom.value ||\r\n\t\t\t\t\t(nodeType === 'progress' && !i))\r\n\t\t\t) {\r\n\t\t\t\tsetProperty(dom, 'value', i, oldProps.value, false);\r\n\t\t\t}\r\n\t\t\tif (\r\n\t\t\t\t'checked' in newProps &&\r\n\t\t\t\t(i = newProps.checked) !== undefined &&\r\n\t\t\t\ti !== dom.checked\r\n\t\t\t) {\r\n\t\t\t\tsetProperty(dom, 'checked', i, oldProps.checked, false);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn dom;\r\n}\r\n\r\n/**\r\n * Invoke or update a ref, depending on whether it is a function or object ref.\r\n * @param {object|function} ref\r\n * @param {any} value\r\n * @param {import('../internal').VNode} vnode\r\n */\r\nexport function applyRef(ref, value, vnode) {\r\n\ttry {\r\n\t\tif (typeof ref == 'function') ref(value);\r\n\t\telse ref.current = value;\r\n\t} catch (e) {\r\n\t\toptions._catchError(e, vnode);\r\n\t}\r\n}\r\n\r\n/**\r\n * Unmount a virtual node from the tree and apply DOM changes\r\n * @param {import('../internal').VNode} vnode The virtual node to unmount\r\n * @param {import('../internal').VNode} parentVNode The parent of the VNode that\r\n * initiated the unmount\r\n * @param {boolean} [skipRemove] Flag that indicates that a parent node of the\r\n * current element is already detached from the DOM.\r\n */\r\nexport function unmount(vnode, parentVNode, skipRemove) {\r\n\tlet r;\r\n\tif (options.unmount) options.unmount(vnode);\r\n\r\n\tif ((r = vnode.ref)) {\r\n\t\tif (!r.current || r.current === vnode._dom) applyRef(r, null, parentVNode);\r\n\t}\r\n\r\n\tif ((r = vnode._component) != null) {\r\n\t\tif (r.componentWillUnmount) {\r\n\t\t\ttry {\r\n\t\t\t\tr.componentWillUnmount();\r\n\t\t\t} catch (e) {\r\n\t\t\t\toptions._catchError(e, parentVNode);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tr.base = r._parentDom = null;\r\n\t}\r\n\r\n\tif ((r = vnode._children)) {\r\n\t\tfor (let i = 0; i < r.length; i++) {\r\n\t\t\tif (r[i]) {\r\n\t\t\t\tunmount(r[i], parentVNode, typeof vnode.type != 'function');\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (!skipRemove && vnode._dom != null) removeNode(vnode._dom);\r\n\r\n\t// Must be set to `undefined` to properly clean up `_nextDom`\r\n\t// for which `null` is a valid value. See comment in `create-element.js`\r\n\tvnode._dom = vnode._nextDom = undefined;\r\n}\r\n\r\n/** The `.render()` method for a PFC backing instance. */\r\nfunction doRender(props, state, context) {\r\n\treturn this.constructor(props, context);\r\n}\r\n", "import { EMPTY_OBJ } from './constants';\r\nimport { commitRoot, diff } from './diff/index';\r\nimport { createElement, Fragment } from './create-element';\r\nimport options from './options';\r\nimport { slice } from './util';\r\n\r\n/**\r\n * Render a Preact virtual node into a DOM element\r\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\r\n * @param {import('./internal').PreactElement} parentDom The DOM element to\r\n * render into\r\n * @param {import('./internal').PreactElement | object} [replaceNode] Optional: Attempt to re-use an\r\n * existing DOM tree rooted at `replaceNode`\r\n */\r\nexport function render(vnode, parentDom, replaceNode) {\r\n\tif (options._root) options._root(vnode, parentDom);\r\n\r\n\t// We abuse the `replaceNode` parameter in `hydrate()` to signal if we are in\r\n\t// hydration mode or not by passing the `hydrate` function instead of a DOM\r\n\t// element..\r\n\tlet isHydrating = typeof replaceNode === 'function';\r\n\r\n\t// To be able to support calling `render()` multiple times on the same\r\n\t// DOM node, we need to obtain a reference to the previous tree. We do\r\n\t// this by assigning a new `_children` property to DOM nodes which points\r\n\t// to the last rendered tree. By default this property is not present, which\r\n\t// means that we are mounting a new tree for the first time.\r\n\tlet oldVNode = isHydrating\r\n\t\t? null\r\n\t\t: (replaceNode && replaceNode._children) || parentDom._children;\r\n\r\n\tvnode = (\r\n\t\t(!isHydrating && replaceNode) ||\r\n\t\tparentDom\r\n\t)._children = createElement(Fragment, null, [vnode]);\r\n\r\n\t// List of effects that need to be called after diffing.\r\n\tlet commitQueue = [];\r\n\tdiff(\r\n\t\tparentDom,\r\n\t\t// Determine the new vnode tree and store it on the DOM element on\r\n\t\t// our custom `_children` property.\r\n\t\tvnode,\r\n\t\toldVNode || EMPTY_OBJ,\r\n\t\tEMPTY_OBJ,\r\n\t\tparentDom.ownerSVGElement !== undefined,\r\n\t\t!isHydrating && replaceNode\r\n\t\t\t? [replaceNode]\r\n\t\t\t: oldVNode\r\n\t\t\t? null\r\n\t\t\t: parentDom.firstChild\r\n\t\t\t? slice.call(parentDom.childNodes)\r\n\t\t\t: null,\r\n\t\tcommitQueue,\r\n\t\t!isHydrating && replaceNode\r\n\t\t\t? replaceNode\r\n\t\t\t: oldVNode\r\n\t\t\t? oldVNode._dom\r\n\t\t\t: parentDom.firstChild,\r\n\t\tisHydrating\r\n\t);\r\n\r\n\t// Flush all queued effects\r\n\tcommitRoot(commitQueue, vnode);\r\n}\r\n\r\n/**\r\n * Update an existing DOM element with data from a Preact virtual node\r\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\r\n * @param {import('./internal').PreactElement} parentDom The DOM element to\r\n * update\r\n */\r\nexport function hydrate(vnode, parentDom) {\r\n\trender(vnode, parentDom, hydrate);\r\n}\r\n", "import { assign, slice } from './util';\r\nimport { createVNode } from './create-element';\r\n\r\n/**\r\n * Clones the given VNode, optionally adding attributes/props and replacing its children.\r\n * @param {import('./internal').VNode} vnode The virtual DOM element to clone\r\n * @param {object} props Attributes/props to add when cloning\r\n * @param {Array} rest Any additional arguments will be used as replacement children.\r\n * @returns {import('./internal').VNode}\r\n */\r\nexport function cloneElement(vnode, props, children) {\r\n\tlet normalizedProps = assign({}, vnode.props),\r\n\t\tkey,\r\n\t\tref,\r\n\t\ti;\r\n\tfor (i in props) {\r\n\t\tif (i == 'key') key = props[i];\r\n\t\telse if (i == 'ref') ref = props[i];\r\n\t\telse normalizedProps[i] = props[i];\r\n\t}\r\n\r\n\tif (arguments.length > 2) {\r\n\t\tnormalizedProps.children =\r\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\r\n\t}\r\n\r\n\treturn createVNode(\r\n\t\tvnode.type,\r\n\t\tnormalizedProps,\r\n\t\tkey || vnode.key,\r\n\t\tref || vnode.ref,\r\n\t\tnull\r\n\t);\r\n}\r\n", "/**\r\n * Find the closest error boundary to a thrown error and call it\r\n * @param {object} error The thrown value\r\n * @param {import('../internal').VNode} vnode The vnode that threw\r\n * the error that was caught (except for unmounting when this parameter\r\n * is the highest parent that was being unmounted)\r\n */\r\nexport function _catchError(error, vnode) {\r\n\t/** @type {import('../internal').Component} */\r\n\tlet component, ctor, handled;\r\n\r\n\tfor (; (vnode = vnode._parent); ) {\r\n\t\tif ((component = vnode._component) && !component._processingException) {\r\n\t\t\ttry {\r\n\t\t\t\tctor = component.constructor;\r\n\r\n\t\t\t\tif (ctor && ctor.getDerivedStateFromError != null) {\r\n\t\t\t\t\tcomponent.setState(ctor.getDerivedStateFromError(error));\r\n\t\t\t\t\thandled = component._dirty;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (component.componentDidCatch != null) {\r\n\t\t\t\t\tcomponent.componentDidCatch(error);\r\n\t\t\t\t\thandled = component._dirty;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// This is an error boundary. Mark it as having bailed out, and whether it was mid-hydration.\r\n\t\t\t\tif (handled) {\r\n\t\t\t\t\treturn (component._pendingError = component);\r\n\t\t\t\t}\r\n\t\t\t} catch (e) {\r\n\t\t\t\terror = e;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tthrow error;\r\n}\r\n", "import { options } from 'preact';\r\nimport { initDevTools } from './devtools';\r\n\r\ninitDevTools();\r\n\r\n/**\r\n * Display a custom label for a custom hook for the devtools panel\r\n * @type {(value: T, name: string) => T}\r\n */\r\nexport function addHookName(value, name) {\r\n\tif (options._addHookName) {\r\n\t\toptions._addHookName(name);\r\n\t}\r\n\treturn value;\r\n}\r\n", "import { options, Fragment, Component } from 'preact';\r\n\r\nexport function initDevTools() {\r\n\tif (typeof window != 'undefined' && window.__PREACT_DEVTOOLS__) {\r\n\t\twindow.__PREACT_DEVTOOLS__.attachPreact('10.6.4', options, {\r\n\t\t\tFragment,\r\n\t\t\tComponent\r\n\t\t});\r\n\t}\r\n}\r\n", "const ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\r\n\r\nlet loggedTypeFailures = {};\r\n\r\n/**\r\n * Reset the history of which prop type warnings have been logged.\r\n */\r\nexport function resetPropWarnings() {\r\n\tloggedTypeFailures = {};\r\n}\r\n\r\n/**\r\n * Assert that the values match with the type specs.\r\n * Error messages are memorized and will only be shown once.\r\n *\r\n * Adapted from https://github.com/facebook/prop-types/blob/master/checkPropTypes.js\r\n *\r\n * @param {object} typeSpecs Map of name to a ReactPropType\r\n * @param {object} values Runtime values that need to be type-checked\r\n * @param {string} location e.g. \"prop\", \"context\", \"child context\"\r\n * @param {string} componentName Name of the component for error messages.\r\n * @param {?Function} getStack Returns the component stack.\r\n */\r\nexport function checkPropTypes(\r\n\ttypeSpecs,\r\n\tvalues,\r\n\tlocation,\r\n\tcomponentName,\r\n\tgetStack\r\n) {\r\n\tObject.keys(typeSpecs).forEach(typeSpecName => {\r\n\t\tlet error;\r\n\t\ttry {\r\n\t\t\terror = typeSpecs[typeSpecName](\r\n\t\t\t\tvalues,\r\n\t\t\t\ttypeSpecName,\r\n\t\t\t\tcomponentName,\r\n\t\t\t\tlocation,\r\n\t\t\t\tnull,\r\n\t\t\t\tReactPropTypesSecret\r\n\t\t\t);\r\n\t\t} catch (e) {\r\n\t\t\terror = e;\r\n\t\t}\r\n\t\tif (error && !(error.message in loggedTypeFailures)) {\r\n\t\t\tloggedTypeFailures[error.message] = true;\r\n\t\t\tconsole.error(\r\n\t\t\t\t`Failed ${location} type: ${error.message}${(getStack &&\r\n\t\t\t\t\t`\\n${getStack()}`) ||\r\n\t\t\t\t\t''}`\r\n\t\t\t);\r\n\t\t}\r\n\t});\r\n}\r\n", "import { options, Fragment } from 'preact';\r\n\r\n/**\r\n * Get human readable name of the component/dom node\r\n * @param {import('./internal').VNode} vnode\r\n * @param {import('./internal').VNode} vnode\r\n * @returns {string}\r\n */\r\nexport function getDisplayName(vnode) {\r\n\tif (vnode.type === Fragment) {\r\n\t\treturn 'Fragment';\r\n\t} else if (typeof vnode.type == 'function') {\r\n\t\treturn vnode.type.displayName || vnode.type.name;\r\n\t} else if (typeof vnode.type == 'string') {\r\n\t\treturn vnode.type;\r\n\t}\r\n\r\n\treturn '#text';\r\n}\r\n\r\n/**\r\n * Used to keep track of the currently rendered `vnode` and print it\r\n * in debug messages.\r\n */\r\nlet renderStack = [];\r\n\r\n/**\r\n * Keep track of the current owners. An owner describes a component\r\n * which was responsible to render a specific `vnode`. This exclude\r\n * children that are passed via `props.children`, because they belong\r\n * to the parent owner.\r\n *\r\n * ```jsx\r\n * const Foo = props =>
{props.children}
// div's owner is Foo\r\n * const Bar = props => {\r\n * return (\r\n * // Foo's owner is Bar, span's owner is Bar\r\n * )\r\n * }\r\n * ```\r\n *\r\n * Note: A `vnode` may be hoisted to the root scope due to compiler\r\n * optimiztions. In these cases the `_owner` will be different.\r\n */\r\nlet ownerStack = [];\r\n\r\n/**\r\n * Get the currently rendered `vnode`\r\n * @returns {import('./internal').VNode | null}\r\n */\r\nexport function getCurrentVNode() {\r\n\treturn renderStack.length > 0 ? renderStack[renderStack.length - 1] : null;\r\n}\r\n\r\n/**\r\n * If the user doesn't have `@babel/plugin-transform-react-jsx-source`\r\n * somewhere in his tool chain we can't print the filename and source\r\n * location of a component. In that case we just omit that, but we'll\r\n * print a helpful message to the console, notifying the user of it.\r\n */\r\nlet hasBabelPlugin = false;\r\n\r\n/**\r\n * Check if a `vnode` is a possible owner.\r\n * @param {import('./internal').VNode} vnode\r\n */\r\nfunction isPossibleOwner(vnode) {\r\n\treturn typeof vnode.type == 'function' && vnode.type != Fragment;\r\n}\r\n\r\n/**\r\n * Return the component stack that was captured up to this point.\r\n * @param {import('./internal').VNode} vnode\r\n * @returns {string}\r\n */\r\nexport function getOwnerStack(vnode) {\r\n\tconst stack = [vnode];\r\n\tlet next = vnode;\r\n\twhile (next._owner != null) {\r\n\t\tstack.push(next._owner);\r\n\t\tnext = next._owner;\r\n\t}\r\n\r\n\treturn stack.reduce((acc, owner) => {\r\n\t\tacc += ` in ${getDisplayName(owner)}`;\r\n\r\n\t\tconst source = owner.__source;\r\n\t\tif (source) {\r\n\t\t\tacc += ` (at ${source.fileName}:${source.lineNumber})`;\r\n\t\t} else if (!hasBabelPlugin) {\r\n\t\t\thasBabelPlugin = true;\r\n\t\t\tconsole.warn(\r\n\t\t\t\t'Add @babel/plugin-transform-react-jsx-source to get a more detailed component stack. Note that you should not add it to production builds of your App for bundle size reasons.'\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\treturn (acc += '\\n');\r\n\t}, '');\r\n}\r\n\r\n/**\r\n * Setup code to capture the component trace while rendering. Note that\r\n * we cannot simply traverse `vnode._parent` upwards, because we have some\r\n * debug messages for `this.setState` where the `vnode` is `undefined`.\r\n */\r\nexport function setupComponentStack() {\r\n\tlet oldDiff = options._diff;\r\n\tlet oldDiffed = options.diffed;\r\n\tlet oldRoot = options._root;\r\n\tlet oldVNode = options.vnode;\r\n\tlet oldRender = options._render;\r\n\r\n\toptions.diffed = vnode => {\r\n\t\tif (isPossibleOwner(vnode)) {\r\n\t\t\townerStack.pop();\r\n\t\t}\r\n\t\trenderStack.pop();\r\n\t\tif (oldDiffed) oldDiffed(vnode);\r\n\t};\r\n\r\n\toptions._diff = vnode => {\r\n\t\tif (isPossibleOwner(vnode)) {\r\n\t\t\trenderStack.push(vnode);\r\n\t\t}\r\n\t\tif (oldDiff) oldDiff(vnode);\r\n\t};\r\n\r\n\toptions._root = (vnode, parent) => {\r\n\t\townerStack = [];\r\n\t\tif (oldRoot) oldRoot(vnode, parent);\r\n\t};\r\n\r\n\toptions.vnode = vnode => {\r\n\t\tvnode._owner =\r\n\t\t\townerStack.length > 0 ? ownerStack[ownerStack.length - 1] : null;\r\n\t\tif (oldVNode) oldVNode(vnode);\r\n\t};\r\n\r\n\toptions._render = vnode => {\r\n\t\tif (isPossibleOwner(vnode)) {\r\n\t\t\townerStack.push(vnode);\r\n\t\t}\r\n\r\n\t\tif (oldRender) oldRender(vnode);\r\n\t};\r\n}\r\n", "import { checkPropTypes } from './check-props';\r\nimport { options, Component } from 'preact';\r\nimport {\r\n\tELEMENT_NODE,\r\n\tDOCUMENT_NODE,\r\n\tDOCUMENT_FRAGMENT_NODE\r\n} from './constants';\r\nimport {\r\n\tgetOwnerStack,\r\n\tsetupComponentStack,\r\n\tgetCurrentVNode,\r\n\tgetDisplayName\r\n} from './component-stack';\r\nimport { assign } from './util';\r\n\r\nconst isWeakMapSupported = typeof WeakMap == 'function';\r\n\r\nfunction getClosestDomNodeParent(parent) {\r\n\tif (!parent) return {};\r\n\tif (typeof parent.type == 'function') {\r\n\t\treturn getClosestDomNodeParent(parent._parent);\r\n\t}\r\n\treturn parent;\r\n}\r\n\r\nexport function initDebug() {\r\n\tsetupComponentStack();\r\n\r\n\tlet hooksAllowed = false;\r\n\r\n\t/* eslint-disable no-console */\r\n\tlet oldBeforeDiff = options._diff;\r\n\tlet oldDiffed = options.diffed;\r\n\tlet oldVnode = options.vnode;\r\n\tlet oldCatchError = options._catchError;\r\n\tlet oldRoot = options._root;\r\n\tlet oldHook = options._hook;\r\n\tconst warnedComponents = !isWeakMapSupported\r\n\t\t? null\r\n\t\t: {\r\n\t\t\t\tuseEffect: new WeakMap(),\r\n\t\t\t\tuseLayoutEffect: new WeakMap(),\r\n\t\t\t\tlazyPropTypes: new WeakMap()\r\n\t\t };\r\n\tconst deprecations = [];\r\n\r\n\toptions._catchError = (error, vnode, oldVNode) => {\r\n\t\tlet component = vnode && vnode._component;\r\n\t\tif (component && typeof error.then == 'function') {\r\n\t\t\tconst promise = error;\r\n\t\t\terror = new Error(\r\n\t\t\t\t`Missing Suspense. The throwing component was: ${getDisplayName(vnode)}`\r\n\t\t\t);\r\n\r\n\t\t\tlet parent = vnode;\r\n\t\t\tfor (; parent; parent = parent._parent) {\r\n\t\t\t\tif (parent._component && parent._component._childDidSuspend) {\r\n\t\t\t\t\terror = promise;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// We haven't recovered and we know at this point that there is no\r\n\t\t\t// Suspense component higher up in the tree\r\n\t\t\tif (error instanceof Error) {\r\n\t\t\t\tthrow error;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t\toldCatchError(error, vnode, oldVNode);\r\n\r\n\t\t\t// when an error was handled by an ErrorBoundary we will nontheless emit an error\r\n\t\t\t// event on the window object. This is to make up for react compatibility in dev mode\r\n\t\t\t// and thus make the Next.js dev overlay work.\r\n\t\t\tif (typeof error.then != 'function') {\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\tthrow error;\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t} catch (e) {\r\n\t\t\tthrow e;\r\n\t\t}\r\n\t};\r\n\r\n\toptions._root = (vnode, parentNode) => {\r\n\t\tif (!parentNode) {\r\n\t\t\tthrow new Error(\r\n\t\t\t\t'Undefined parent passed to render(), this is the second argument.\\n' +\r\n\t\t\t\t\t'Check if the element is available in the DOM/has the correct id.'\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tlet isValid;\r\n\t\tswitch (parentNode.nodeType) {\r\n\t\t\tcase ELEMENT_NODE:\r\n\t\t\tcase DOCUMENT_FRAGMENT_NODE:\r\n\t\t\tcase DOCUMENT_NODE:\r\n\t\t\t\tisValid = true;\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tisValid = false;\r\n\t\t}\r\n\r\n\t\tif (!isValid) {\r\n\t\t\tlet componentName = getDisplayName(vnode);\r\n\t\t\tthrow new Error(\r\n\t\t\t\t`Expected a valid HTML node as a second argument to render.\tReceived ${parentNode} instead: render(<${componentName} />, ${parentNode});`\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tif (oldRoot) oldRoot(vnode, parentNode);\r\n\t};\r\n\r\n\toptions._diff = vnode => {\r\n\t\tlet { type, _parent: parent } = vnode;\r\n\t\tlet parentVNode = getClosestDomNodeParent(parent);\r\n\r\n\t\thooksAllowed = true;\r\n\r\n\t\tif (type === undefined) {\r\n\t\t\tthrow new Error(\r\n\t\t\t\t'Undefined component passed to createElement()\\n\\n' +\r\n\t\t\t\t\t'You likely forgot to export your component or might have mixed up default and named imports' +\r\n\t\t\t\t\tserializeVNode(vnode) +\r\n\t\t\t\t\t`\\n\\n${getOwnerStack(vnode)}`\r\n\t\t\t);\r\n\t\t} else if (type != null && typeof type == 'object') {\r\n\t\t\tif (type._children !== undefined && type._dom !== undefined) {\r\n\t\t\t\tthrow new Error(\r\n\t\t\t\t\t`Invalid type passed to createElement(): ${type}\\n\\n` +\r\n\t\t\t\t\t\t'Did you accidentally pass a JSX literal as JSX twice?\\n\\n' +\r\n\t\t\t\t\t\t` let My${getDisplayName(vnode)} = ${serializeVNode(type)};\\n` +\r\n\t\t\t\t\t\t` let vnode = ;\\n\\n` +\r\n\t\t\t\t\t\t'This usually happens when you export a JSX literal and not the component.' +\r\n\t\t\t\t\t\t`\\n\\n${getOwnerStack(vnode)}`\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\tthrow new Error(\r\n\t\t\t\t'Invalid type passed to createElement(): ' +\r\n\t\t\t\t\t(Array.isArray(type) ? 'array' : type)\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\t(type === 'thead' || type === 'tfoot' || type === 'tbody') &&\r\n\t\t\tparentVNode.type !== 'table'\r\n\t\t) {\r\n\t\t\tconsole.error(\r\n\t\t\t\t'Improper nesting of table. Your should have a parent.' +\r\n\t\t\t\t\tserializeVNode(vnode) +\r\n\t\t\t\t\t`\\n\\n${getOwnerStack(vnode)}`\r\n\t\t\t);\r\n\t\t} else if (\r\n\t\t\ttype === 'tr' &&\r\n\t\t\tparentVNode.type !== 'thead' &&\r\n\t\t\tparentVNode.type !== 'tfoot' &&\r\n\t\t\tparentVNode.type !== 'tbody' &&\r\n\t\t\tparentVNode.type !== 'table'\r\n\t\t) {\r\n\t\t\tconsole.error(\r\n\t\t\t\t'Improper nesting of table. Your should have a parent.' +\r\n\t\t\t\t\tserializeVNode(vnode) +\r\n\t\t\t\t\t`\\n\\n${getOwnerStack(vnode)}`\r\n\t\t\t);\r\n\t\t} else if (type === 'td' && parentVNode.type !== 'tr') {\r\n\t\t\tconsole.error(\r\n\t\t\t\t'Improper nesting of table. Your parent.' +\r\n\t\t\t\t\tserializeVNode(vnode) +\r\n\t\t\t\t\t`\\n\\n${getOwnerStack(vnode)}`\r\n\t\t\t);\r\n\t\t} else if (type === 'th' && parentVNode.type !== 'tr') {\r\n\t\t\tconsole.error(\r\n\t\t\t\t'Improper nesting of table. Your .' +\r\n\t\t\t\t\tserializeVNode(vnode) +\r\n\t\t\t\t\t`\\n\\n${getOwnerStack(vnode)}`\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\tvnode.ref !== undefined &&\r\n\t\t\ttypeof vnode.ref != 'function' &&\r\n\t\t\ttypeof vnode.ref != 'object' &&\r\n\t\t\t!('$$typeof' in vnode) // allow string refs when preact-compat is installed\r\n\t\t) {\r\n\t\t\tthrow new Error(\r\n\t\t\t\t`Component's \"ref\" property should be a function, or an object created ` +\r\n\t\t\t\t\t`by createRef(), but got [${typeof vnode.ref}] instead\\n` +\r\n\t\t\t\t\tserializeVNode(vnode) +\r\n\t\t\t\t\t`\\n\\n${getOwnerStack(vnode)}`\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tif (typeof vnode.type == 'string') {\r\n\t\t\tfor (const key in vnode.props) {\r\n\t\t\t\tif (\r\n\t\t\t\t\tkey[0] === 'o' &&\r\n\t\t\t\t\tkey[1] === 'n' &&\r\n\t\t\t\t\ttypeof vnode.props[key] != 'function' &&\r\n\t\t\t\t\tvnode.props[key] != null\r\n\t\t\t\t) {\r\n\t\t\t\t\tthrow new Error(\r\n\t\t\t\t\t\t`Component's \"${key}\" property should be a function, ` +\r\n\t\t\t\t\t\t\t`but got [${typeof vnode.props[key]}] instead\\n` +\r\n\t\t\t\t\t\t\tserializeVNode(vnode) +\r\n\t\t\t\t\t\t\t`\\n\\n${getOwnerStack(vnode)}`\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Check prop-types if available\r\n\t\tif (typeof vnode.type == 'function' && vnode.type.propTypes) {\r\n\t\t\tif (\r\n\t\t\t\tvnode.type.displayName === 'Lazy' &&\r\n\t\t\t\twarnedComponents &&\r\n\t\t\t\t!warnedComponents.lazyPropTypes.has(vnode.type)\r\n\t\t\t) {\r\n\t\t\t\tconst m =\r\n\t\t\t\t\t'PropTypes are not supported on lazy(). Use propTypes on the wrapped component itself. ';\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst lazyVNode = vnode.type();\r\n\t\t\t\t\twarnedComponents.lazyPropTypes.set(vnode.type, true);\r\n\t\t\t\t\tconsole.warn(\r\n\t\t\t\t\t\tm + `Component wrapped in lazy() is ${getDisplayName(lazyVNode)}`\r\n\t\t\t\t\t);\r\n\t\t\t\t} catch (promise) {\r\n\t\t\t\t\tconsole.warn(\r\n\t\t\t\t\t\tm + \"We will log the wrapped component's name once it is loaded.\"\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tlet values = vnode.props;\r\n\t\t\tif (vnode.type._forwarded) {\r\n\t\t\t\tvalues = assign({}, values);\r\n\t\t\t\tdelete values.ref;\r\n\t\t\t}\r\n\r\n\t\t\tcheckPropTypes(\r\n\t\t\t\tvnode.type.propTypes,\r\n\t\t\t\tvalues,\r\n\t\t\t\t'prop',\r\n\t\t\t\tgetDisplayName(vnode),\r\n\t\t\t\t() => getOwnerStack(vnode)\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tif (oldBeforeDiff) oldBeforeDiff(vnode);\r\n\t};\r\n\r\n\toptions._hook = (comp, index, type) => {\r\n\t\tif (!comp || !hooksAllowed) {\r\n\t\t\tthrow new Error('Hook can only be invoked from render methods.');\r\n\t\t}\r\n\r\n\t\tif (oldHook) oldHook(comp, index, type);\r\n\t};\r\n\r\n\t// Ideally we'd want to print a warning once per component, but we\r\n\t// don't have access to the vnode that triggered it here. As a\r\n\t// compromise and to avoid flooding the console with warnings we\r\n\t// print each deprecation warning only once.\r\n\tconst warn = (property, message) => ({\r\n\t\tget() {\r\n\t\t\tconst key = 'get' + property + message;\r\n\t\t\tif (deprecations && deprecations.indexOf(key) < 0) {\r\n\t\t\t\tdeprecations.push(key);\r\n\t\t\t\tconsole.warn(`getting vnode.${property} is deprecated, ${message}`);\r\n\t\t\t}\r\n\t\t},\r\n\t\tset() {\r\n\t\t\tconst key = 'set' + property + message;\r\n\t\t\tif (deprecations && deprecations.indexOf(key) < 0) {\r\n\t\t\t\tdeprecations.push(key);\r\n\t\t\t\tconsole.warn(`setting vnode.${property} is not allowed, ${message}`);\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\tconst deprecatedAttributes = {\r\n\t\tnodeName: warn('nodeName', 'use vnode.type'),\r\n\t\tattributes: warn('attributes', 'use vnode.props'),\r\n\t\tchildren: warn('children', 'use vnode.props.children')\r\n\t};\r\n\r\n\tconst deprecatedProto = Object.create({}, deprecatedAttributes);\r\n\r\n\toptions.vnode = vnode => {\r\n\t\tconst props = vnode.props;\r\n\t\tif (\r\n\t\t\tvnode.type !== null &&\r\n\t\t\tprops != null &&\r\n\t\t\t('__source' in props || '__self' in props)\r\n\t\t) {\r\n\t\t\tconst newProps = (vnode.props = {});\r\n\t\t\tfor (let i in props) {\r\n\t\t\t\tconst v = props[i];\r\n\t\t\t\tif (i === '__source') vnode.__source = v;\r\n\t\t\t\telse if (i === '__self') vnode.__self = v;\r\n\t\t\t\telse newProps[i] = v;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// eslint-disable-next-line\r\n\t\tvnode.__proto__ = deprecatedProto;\r\n\t\tif (oldVnode) oldVnode(vnode);\r\n\t};\r\n\r\n\toptions.diffed = vnode => {\r\n\t\t// Check if the user passed plain objects as children. Note that we cannot\r\n\t\t// move this check into `options.vnode` because components can receive\r\n\t\t// children in any shape they want (e.g.\r\n\t\t// `{{ foo: 123, bar: \"abc\" }}`).\r\n\t\t// Putting this check in `options.diffed` ensures that\r\n\t\t// `vnode._children` is set and that we only validate the children\r\n\t\t// that were actually rendered.\r\n\t\tif (vnode._children) {\r\n\t\t\tvnode._children.forEach(child => {\r\n\t\t\t\tif (child && child.type === undefined) {\r\n\t\t\t\t\t// Remove internal vnode keys that will always be patched\r\n\t\t\t\t\tdelete child._parent;\r\n\t\t\t\t\tdelete child._depth;\r\n\t\t\t\t\tconst keys = Object.keys(child).join(',');\r\n\t\t\t\t\tthrow new Error(\r\n\t\t\t\t\t\t`Objects are not valid as a child. Encountered an object with the keys {${keys}}.` +\r\n\t\t\t\t\t\t\t`\\n\\n${getOwnerStack(vnode)}`\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\thooksAllowed = false;\r\n\r\n\t\tif (oldDiffed) oldDiffed(vnode);\r\n\r\n\t\tif (vnode._children != null) {\r\n\t\t\tconst keys = [];\r\n\t\t\tfor (let i = 0; i < vnode._children.length; i++) {\r\n\t\t\t\tconst child = vnode._children[i];\r\n\t\t\t\tif (!child || child.key == null) continue;\r\n\r\n\t\t\t\tconst key = child.key;\r\n\t\t\t\tif (keys.indexOf(key) !== -1) {\r\n\t\t\t\t\tconsole.error(\r\n\t\t\t\t\t\t'Following component has two or more children with the ' +\r\n\t\t\t\t\t\t\t`same key attribute: \"${key}\". This may cause glitches and misbehavior ` +\r\n\t\t\t\t\t\t\t'in rendering process. Component: \\n\\n' +\r\n\t\t\t\t\t\t\tserializeVNode(vnode) +\r\n\t\t\t\t\t\t\t`\\n\\n${getOwnerStack(vnode)}`\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\t// Break early to not spam the console\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tkeys.push(key);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n}\r\n\r\nconst setState = Component.prototype.setState;\r\nComponent.prototype.setState = function(update, callback) {\r\n\tif (this._vnode == null) {\r\n\t\t// `this._vnode` will be `null` during componentWillMount. But it\r\n\t\t// is perfectly valid to call `setState` during cWM. So we\r\n\t\t// need an additional check to verify that we are dealing with a\r\n\t\t// call inside constructor.\r\n\t\tif (this.state == null) {\r\n\t\t\tconsole.warn(\r\n\t\t\t\t`Calling \"this.setState\" inside the constructor of a component is a ` +\r\n\t\t\t\t\t`no-op and might be a bug in your application. Instead, set ` +\r\n\t\t\t\t\t`\"this.state = {}\" directly.\\n\\n${getOwnerStack(getCurrentVNode())}`\r\n\t\t\t);\r\n\t\t}\r\n\t} else if (this._parentDom == null) {\r\n\t\tconsole.warn(\r\n\t\t\t`Can't call \"this.setState\" on an unmounted component. This is a no-op, ` +\r\n\t\t\t\t`but it indicates a memory leak in your application. To fix, cancel all ` +\r\n\t\t\t\t`subscriptions and asynchronous tasks in the componentWillUnmount method.` +\r\n\t\t\t\t`\\n\\n${getOwnerStack(this._vnode)}`\r\n\t\t);\r\n\t}\r\n\r\n\treturn setState.call(this, update, callback);\r\n};\r\n\r\nconst forceUpdate = Component.prototype.forceUpdate;\r\nComponent.prototype.forceUpdate = function(callback) {\r\n\tif (this._vnode == null) {\r\n\t\tconsole.warn(\r\n\t\t\t`Calling \"this.forceUpdate\" inside the constructor of a component is a ` +\r\n\t\t\t\t`no-op and might be a bug in your application.\\n\\n${getOwnerStack(\r\n\t\t\t\t\tgetCurrentVNode()\r\n\t\t\t\t)}`\r\n\t\t);\r\n\t} else if (this._parentDom == null) {\r\n\t\tconsole.warn(\r\n\t\t\t`Can't call \"this.forceUpdate\" on an unmounted component. This is a no-op, ` +\r\n\t\t\t\t`but it indicates a memory leak in your application. To fix, cancel all ` +\r\n\t\t\t\t`subscriptions and asynchronous tasks in the componentWillUnmount method.` +\r\n\t\t\t\t`\\n\\n${getOwnerStack(this._vnode)}`\r\n\t\t);\r\n\t}\r\n\treturn forceUpdate.call(this, callback);\r\n};\r\n\r\n/**\r\n * Serialize a vnode tree to a string\r\n * @param {import('./internal').VNode} vnode\r\n * @returns {string}\r\n */\r\nexport function serializeVNode(vnode) {\r\n\tlet { props } = vnode;\r\n\tlet name = getDisplayName(vnode);\r\n\r\n\tlet attrs = '';\r\n\tfor (let prop in props) {\r\n\t\tif (props.hasOwnProperty(prop) && prop !== 'children') {\r\n\t\t\tlet value = props[prop];\r\n\r\n\t\t\t// If it is an object but doesn't have toString(), use Object.toString\r\n\t\t\tif (typeof value == 'function') {\r\n\t\t\t\tvalue = `function ${value.displayName || value.name}() {}`;\r\n\t\t\t}\r\n\r\n\t\t\tvalue =\r\n\t\t\t\tObject(value) === value && !value.toString\r\n\t\t\t\t\t? Object.prototype.toString.call(value)\r\n\t\t\t\t\t: value + '';\r\n\r\n\t\t\tattrs += ` ${prop}=${JSON.stringify(value)}`;\r\n\t\t}\r\n\t}\r\n\r\n\tlet children = props.children;\r\n\treturn `<${name}${attrs}${\r\n\t\tchildren && children.length ? '>..' : ' />'\r\n\t}`;\r\n}\r\n", "export const ELEMENT_NODE = 1;\r\nexport const DOCUMENT_NODE = 9;\r\nexport const DOCUMENT_FRAGMENT_NODE = 11;\r\n", "/**\r\n * Assign properties from `props` to `obj`\r\n * @template O, P The obj and props types\r\n * @param {O} obj The object to copy properties to\r\n * @param {P} props The object to copy properties from\r\n * @returns {O & P}\r\n */\r\nexport function assign(obj, props) {\r\n\tfor (let i in props) obj[i] = props[i];\r\n\treturn /** @type {O & P} */ (obj);\r\n}\r\n", "export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}", "function isAbsolute(pathname) {\n return pathname.charAt(0) === '/';\n}\n\n// About 1.5x faster than the two-arg version of Array#splice()\nfunction spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}\n\n// This implementation is based heavily on node's url.parse\nfunction resolvePathname(to, from) {\n if (from === undefined) from = '';\n\n var toParts = (to && to.split('/')) || [];\n var fromParts = (from && from.split('/')) || [];\n\n var isToAbs = to && isAbsolute(to);\n var isFromAbs = from && isAbsolute(from);\n var mustEndAbs = isToAbs || isFromAbs;\n\n if (to && isAbsolute(to)) {\n // to is absolute\n fromParts = toParts;\n } else if (toParts.length) {\n // to is relative, drop the filename\n fromParts.pop();\n fromParts = fromParts.concat(toParts);\n }\n\n if (!fromParts.length) return '/';\n\n var hasTrailingSlash;\n if (fromParts.length) {\n var last = fromParts[fromParts.length - 1];\n hasTrailingSlash = last === '.' || last === '..' || last === '';\n } else {\n hasTrailingSlash = false;\n }\n\n var up = 0;\n for (var i = fromParts.length; i >= 0; i--) {\n var part = fromParts[i];\n\n if (part === '.') {\n spliceOne(fromParts, i);\n } else if (part === '..') {\n spliceOne(fromParts, i);\n up++;\n } else if (up) {\n spliceOne(fromParts, i);\n up--;\n }\n }\n\n if (!mustEndAbs) for (; up--; up) fromParts.unshift('..');\n\n if (\n mustEndAbs &&\n fromParts[0] !== '' &&\n (!fromParts[0] || !isAbsolute(fromParts[0]))\n )\n fromParts.unshift('');\n\n var result = fromParts.join('/');\n\n if (hasTrailingSlash && result.substr(-1) !== '/') result += '/';\n\n return result;\n}\n\nexport default resolvePathname;\n", "var isProduction = process.env.NODE_ENV === 'production';\nfunction warning(condition, message) {\n if (!isProduction) {\n if (condition) {\n return;\n }\n\n var text = \"Warning: \" + message;\n\n if (typeof console !== 'undefined') {\n console.warn(text);\n }\n\n try {\n throw Error(text);\n } catch (x) {}\n }\n}\n\nexport default warning;\n", "var isProduction = process.env.NODE_ENV === 'production';\nvar prefix = 'Invariant failed';\nfunction invariant(condition, message) {\n if (condition) {\n return;\n }\n if (isProduction) {\n throw new Error(prefix);\n }\n var provided = typeof message === 'function' ? message() : message;\n var value = provided ? prefix + \": \" + provided : prefix;\n throw new Error(value);\n}\n\nexport { invariant as default };\n", "import _extends from '@babel/runtime/helpers/esm/extends';\nimport resolvePathname from 'resolve-pathname';\nimport valueEqual from 'value-equal';\nimport warning from 'tiny-warning';\nimport invariant from 'tiny-invariant';\n\nfunction addLeadingSlash(path) {\n return path.charAt(0) === '/' ? path : '/' + path;\n}\nfunction stripLeadingSlash(path) {\n return path.charAt(0) === '/' ? path.substr(1) : path;\n}\nfunction hasBasename(path, prefix) {\n return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1;\n}\nfunction stripBasename(path, prefix) {\n return hasBasename(path, prefix) ? path.substr(prefix.length) : path;\n}\nfunction stripTrailingSlash(path) {\n return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;\n}\nfunction parsePath(path) {\n var pathname = path || '/';\n var search = '';\n var hash = '';\n var hashIndex = pathname.indexOf('#');\n\n if (hashIndex !== -1) {\n hash = pathname.substr(hashIndex);\n pathname = pathname.substr(0, hashIndex);\n }\n\n var searchIndex = pathname.indexOf('?');\n\n if (searchIndex !== -1) {\n search = pathname.substr(searchIndex);\n pathname = pathname.substr(0, searchIndex);\n }\n\n return {\n pathname: pathname,\n search: search === '?' ? '' : search,\n hash: hash === '#' ? '' : hash\n };\n}\nfunction createPath(location) {\n var pathname = location.pathname,\n search = location.search,\n hash = location.hash;\n var path = pathname || '/';\n if (search && search !== '?') path += search.charAt(0) === '?' ? search : \"?\" + search;\n if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : \"#\" + hash;\n return path;\n}\n\nfunction createLocation(path, state, key, currentLocation) {\n var location;\n\n if (typeof path === 'string') {\n // Two-arg form: push(path, state)\n location = parsePath(path);\n location.state = state;\n } else {\n // One-arg form: push(location)\n location = _extends({}, path);\n if (location.pathname === undefined) location.pathname = '';\n\n if (location.search) {\n if (location.search.charAt(0) !== '?') location.search = '?' + location.search;\n } else {\n location.search = '';\n }\n\n if (location.hash) {\n if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;\n } else {\n location.hash = '';\n }\n\n if (state !== undefined && location.state === undefined) location.state = state;\n }\n\n try {\n location.pathname = decodeURI(location.pathname);\n } catch (e) {\n if (e instanceof URIError) {\n throw new URIError('Pathname \"' + location.pathname + '\" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');\n } else {\n throw e;\n }\n }\n\n if (key) location.key = key;\n\n if (currentLocation) {\n // Resolve incomplete/relative pathname relative to current location.\n if (!location.pathname) {\n location.pathname = currentLocation.pathname;\n } else if (location.pathname.charAt(0) !== '/') {\n location.pathname = resolvePathname(location.pathname, currentLocation.pathname);\n }\n } else {\n // When there is no prior location and pathname is empty, set it to /\n if (!location.pathname) {\n location.pathname = '/';\n }\n }\n\n return location;\n}\nfunction locationsAreEqual(a, b) {\n return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && valueEqual(a.state, b.state);\n}\n\nfunction createTransitionManager() {\n var prompt = null;\n\n function setPrompt(nextPrompt) {\n process.env.NODE_ENV !== \"production\" ? warning(prompt == null, 'A history supports only one prompt at a time') : void 0;\n prompt = nextPrompt;\n return function () {\n if (prompt === nextPrompt) prompt = null;\n };\n }\n\n function confirmTransitionTo(location, action, getUserConfirmation, callback) {\n // TODO: If another transition starts while we're still confirming\n // the previous one, we may end up in a weird state. Figure out the\n // best way to handle this.\n if (prompt != null) {\n var result = typeof prompt === 'function' ? prompt(location, action) : prompt;\n\n if (typeof result === 'string') {\n if (typeof getUserConfirmation === 'function') {\n getUserConfirmation(result, callback);\n } else {\n process.env.NODE_ENV !== \"production\" ? warning(false, 'A history needs a getUserConfirmation function in order to use a prompt message') : void 0;\n callback(true);\n }\n } else {\n // Return false from a transition hook to cancel the transition.\n callback(result !== false);\n }\n } else {\n callback(true);\n }\n }\n\n var listeners = [];\n\n function appendListener(fn) {\n var isActive = true;\n\n function listener() {\n if (isActive) fn.apply(void 0, arguments);\n }\n\n listeners.push(listener);\n return function () {\n isActive = false;\n listeners = listeners.filter(function (item) {\n return item !== listener;\n });\n };\n }\n\n function notifyListeners() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n listeners.forEach(function (listener) {\n return listener.apply(void 0, args);\n });\n }\n\n return {\n setPrompt: setPrompt,\n confirmTransitionTo: confirmTransitionTo,\n appendListener: appendListener,\n notifyListeners: notifyListeners\n };\n}\n\nvar canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);\nfunction getConfirmation(message, callback) {\n callback(window.confirm(message)); // eslint-disable-line no-alert\n}\n/**\n * Returns true if the HTML5 history API is supported. Taken from Modernizr.\n *\n * https://github.com/Modernizr/Modernizr/blob/master/LICENSE\n * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js\n * changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586\n */\n\nfunction supportsHistory() {\n var ua = window.navigator.userAgent;\n if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;\n return window.history && 'pushState' in window.history;\n}\n/**\n * Returns true if browser fires popstate on hash change.\n * IE10 and IE11 do not.\n */\n\nfunction supportsPopStateOnHashChange() {\n return window.navigator.userAgent.indexOf('Trident') === -1;\n}\n/**\n * Returns false if using go(n) with hash history causes a full page reload.\n */\n\nfunction supportsGoWithoutReloadUsingHash() {\n return window.navigator.userAgent.indexOf('Firefox') === -1;\n}\n/**\n * Returns true if a given popstate event is an extraneous WebKit event.\n * Accounts for the fact that Chrome on iOS fires real popstate events\n * containing undefined state when pressing the back button.\n */\n\nfunction isExtraneousPopstateEvent(event) {\n return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;\n}\n\nvar PopStateEvent = 'popstate';\nvar HashChangeEvent = 'hashchange';\n\nfunction getHistoryState() {\n try {\n return window.history.state || {};\n } catch (e) {\n // IE 11 sometimes throws when accessing window.history.state\n // See https://github.com/ReactTraining/history/pull/289\n return {};\n }\n}\n/**\n * Creates a history object that uses the HTML5 history API including\n * pushState, replaceState, and the popstate event.\n */\n\n\nfunction createBrowserHistory(props) {\n if (props === void 0) {\n props = {};\n }\n\n !canUseDOM ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Browser history needs a DOM') : invariant(false) : void 0;\n var globalHistory = window.history;\n var canUseHistory = supportsHistory();\n var needsHashChangeListener = !supportsPopStateOnHashChange();\n var _props = props,\n _props$forceRefresh = _props.forceRefresh,\n forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh,\n _props$getUserConfirm = _props.getUserConfirmation,\n getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,\n _props$keyLength = _props.keyLength,\n keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;\n var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';\n\n function getDOMLocation(historyState) {\n var _ref = historyState || {},\n key = _ref.key,\n state = _ref.state;\n\n var _window$location = window.location,\n pathname = _window$location.pathname,\n search = _window$location.search,\n hash = _window$location.hash;\n var path = pathname + search + hash;\n process.env.NODE_ENV !== \"production\" ? warning(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path \"' + path + '\" to begin with \"' + basename + '\".') : void 0;\n if (basename) path = stripBasename(path, basename);\n return createLocation(path, state, key);\n }\n\n function createKey() {\n return Math.random().toString(36).substr(2, keyLength);\n }\n\n var transitionManager = createTransitionManager();\n\n function setState(nextState) {\n _extends(history, nextState);\n\n history.length = globalHistory.length;\n transitionManager.notifyListeners(history.location, history.action);\n }\n\n function handlePopState(event) {\n // Ignore extraneous popstate events in WebKit.\n if (isExtraneousPopstateEvent(event)) return;\n handlePop(getDOMLocation(event.state));\n }\n\n function handleHashChange() {\n handlePop(getDOMLocation(getHistoryState()));\n }\n\n var forceNextPop = false;\n\n function handlePop(location) {\n if (forceNextPop) {\n forceNextPop = false;\n setState();\n } else {\n var action = 'POP';\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (ok) {\n setState({\n action: action,\n location: location\n });\n } else {\n revertPop(location);\n }\n });\n }\n }\n\n function revertPop(fromLocation) {\n var toLocation = history.location; // TODO: We could probably make this more reliable by\n // keeping a list of keys we've seen in sessionStorage.\n // Instead, we just default to 0 for keys we don't know.\n\n var toIndex = allKeys.indexOf(toLocation.key);\n if (toIndex === -1) toIndex = 0;\n var fromIndex = allKeys.indexOf(fromLocation.key);\n if (fromIndex === -1) fromIndex = 0;\n var delta = toIndex - fromIndex;\n\n if (delta) {\n forceNextPop = true;\n go(delta);\n }\n }\n\n var initialLocation = getDOMLocation(getHistoryState());\n var allKeys = [initialLocation.key]; // Public interface\n\n function createHref(location) {\n return basename + createPath(location);\n }\n\n function push(path, state) {\n process.env.NODE_ENV !== \"production\" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;\n var action = 'PUSH';\n var location = createLocation(path, state, createKey(), history.location);\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (!ok) return;\n var href = createHref(location);\n var key = location.key,\n state = location.state;\n\n if (canUseHistory) {\n globalHistory.pushState({\n key: key,\n state: state\n }, null, href);\n\n if (forceRefresh) {\n window.location.href = href;\n } else {\n var prevIndex = allKeys.indexOf(history.location.key);\n var nextKeys = allKeys.slice(0, prevIndex + 1);\n nextKeys.push(location.key);\n allKeys = nextKeys;\n setState({\n action: action,\n location: location\n });\n }\n } else {\n process.env.NODE_ENV !== \"production\" ? warning(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history') : void 0;\n window.location.href = href;\n }\n });\n }\n\n function replace(path, state) {\n process.env.NODE_ENV !== \"production\" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;\n var action = 'REPLACE';\n var location = createLocation(path, state, createKey(), history.location);\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (!ok) return;\n var href = createHref(location);\n var key = location.key,\n state = location.state;\n\n if (canUseHistory) {\n globalHistory.replaceState({\n key: key,\n state: state\n }, null, href);\n\n if (forceRefresh) {\n window.location.replace(href);\n } else {\n var prevIndex = allKeys.indexOf(history.location.key);\n if (prevIndex !== -1) allKeys[prevIndex] = location.key;\n setState({\n action: action,\n location: location\n });\n }\n } else {\n process.env.NODE_ENV !== \"production\" ? warning(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history') : void 0;\n window.location.replace(href);\n }\n });\n }\n\n function go(n) {\n globalHistory.go(n);\n }\n\n function goBack() {\n go(-1);\n }\n\n function goForward() {\n go(1);\n }\n\n var listenerCount = 0;\n\n function checkDOMListeners(delta) {\n listenerCount += delta;\n\n if (listenerCount === 1 && delta === 1) {\n window.addEventListener(PopStateEvent, handlePopState);\n if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange);\n } else if (listenerCount === 0) {\n window.removeEventListener(PopStateEvent, handlePopState);\n if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange);\n }\n }\n\n var isBlocked = false;\n\n function block(prompt) {\n if (prompt === void 0) {\n prompt = false;\n }\n\n var unblock = transitionManager.setPrompt(prompt);\n\n if (!isBlocked) {\n checkDOMListeners(1);\n isBlocked = true;\n }\n\n return function () {\n if (isBlocked) {\n isBlocked = false;\n checkDOMListeners(-1);\n }\n\n return unblock();\n };\n }\n\n function listen(listener) {\n var unlisten = transitionManager.appendListener(listener);\n checkDOMListeners(1);\n return function () {\n checkDOMListeners(-1);\n unlisten();\n };\n }\n\n var history = {\n length: globalHistory.length,\n action: 'POP',\n location: initialLocation,\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n goBack: goBack,\n goForward: goForward,\n block: block,\n listen: listen\n };\n return history;\n}\n\nvar HashChangeEvent$1 = 'hashchange';\nvar HashPathCoders = {\n hashbang: {\n encodePath: function encodePath(path) {\n return path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path);\n },\n decodePath: function decodePath(path) {\n return path.charAt(0) === '!' ? path.substr(1) : path;\n }\n },\n noslash: {\n encodePath: stripLeadingSlash,\n decodePath: addLeadingSlash\n },\n slash: {\n encodePath: addLeadingSlash,\n decodePath: addLeadingSlash\n }\n};\n\nfunction stripHash(url) {\n var hashIndex = url.indexOf('#');\n return hashIndex === -1 ? url : url.slice(0, hashIndex);\n}\n\nfunction getHashPath() {\n // We can't use window.location.hash here because it's not\n // consistent across browsers - Firefox will pre-decode it!\n var href = window.location.href;\n var hashIndex = href.indexOf('#');\n return hashIndex === -1 ? '' : href.substring(hashIndex + 1);\n}\n\nfunction pushHashPath(path) {\n window.location.hash = path;\n}\n\nfunction replaceHashPath(path) {\n window.location.replace(stripHash(window.location.href) + '#' + path);\n}\n\nfunction createHashHistory(props) {\n if (props === void 0) {\n props = {};\n }\n\n !canUseDOM ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Hash history needs a DOM') : invariant(false) : void 0;\n var globalHistory = window.history;\n var canGoWithoutReload = supportsGoWithoutReloadUsingHash();\n var _props = props,\n _props$getUserConfirm = _props.getUserConfirmation,\n getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,\n _props$hashType = _props.hashType,\n hashType = _props$hashType === void 0 ? 'slash' : _props$hashType;\n var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';\n var _HashPathCoders$hashT = HashPathCoders[hashType],\n encodePath = _HashPathCoders$hashT.encodePath,\n decodePath = _HashPathCoders$hashT.decodePath;\n\n function getDOMLocation() {\n var path = decodePath(getHashPath());\n process.env.NODE_ENV !== \"production\" ? warning(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path \"' + path + '\" to begin with \"' + basename + '\".') : void 0;\n if (basename) path = stripBasename(path, basename);\n return createLocation(path);\n }\n\n var transitionManager = createTransitionManager();\n\n function setState(nextState) {\n _extends(history, nextState);\n\n history.length = globalHistory.length;\n transitionManager.notifyListeners(history.location, history.action);\n }\n\n var forceNextPop = false;\n var ignorePath = null;\n\n function locationsAreEqual$$1(a, b) {\n return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash;\n }\n\n function handleHashChange() {\n var path = getHashPath();\n var encodedPath = encodePath(path);\n\n if (path !== encodedPath) {\n // Ensure we always have a properly-encoded hash.\n replaceHashPath(encodedPath);\n } else {\n var location = getDOMLocation();\n var prevLocation = history.location;\n if (!forceNextPop && locationsAreEqual$$1(prevLocation, location)) return; // A hashchange doesn't always == location change.\n\n if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace.\n\n ignorePath = null;\n handlePop(location);\n }\n }\n\n function handlePop(location) {\n if (forceNextPop) {\n forceNextPop = false;\n setState();\n } else {\n var action = 'POP';\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (ok) {\n setState({\n action: action,\n location: location\n });\n } else {\n revertPop(location);\n }\n });\n }\n }\n\n function revertPop(fromLocation) {\n var toLocation = history.location; // TODO: We could probably make this more reliable by\n // keeping a list of paths we've seen in sessionStorage.\n // Instead, we just default to 0 for paths we don't know.\n\n var toIndex = allPaths.lastIndexOf(createPath(toLocation));\n if (toIndex === -1) toIndex = 0;\n var fromIndex = allPaths.lastIndexOf(createPath(fromLocation));\n if (fromIndex === -1) fromIndex = 0;\n var delta = toIndex - fromIndex;\n\n if (delta) {\n forceNextPop = true;\n go(delta);\n }\n } // Ensure the hash is encoded properly before doing anything else.\n\n\n var path = getHashPath();\n var encodedPath = encodePath(path);\n if (path !== encodedPath) replaceHashPath(encodedPath);\n var initialLocation = getDOMLocation();\n var allPaths = [createPath(initialLocation)]; // Public interface\n\n function createHref(location) {\n var baseTag = document.querySelector('base');\n var href = '';\n\n if (baseTag && baseTag.getAttribute('href')) {\n href = stripHash(window.location.href);\n }\n\n return href + '#' + encodePath(basename + createPath(location));\n }\n\n function push(path, state) {\n process.env.NODE_ENV !== \"production\" ? warning(state === undefined, 'Hash history cannot push state; it is ignored') : void 0;\n var action = 'PUSH';\n var location = createLocation(path, undefined, undefined, history.location);\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (!ok) return;\n var path = createPath(location);\n var encodedPath = encodePath(basename + path);\n var hashChanged = getHashPath() !== encodedPath;\n\n if (hashChanged) {\n // We cannot tell if a hashchange was caused by a PUSH, so we'd\n // rather setState here and ignore the hashchange. The caveat here\n // is that other hash histories in the page will consider it a POP.\n ignorePath = path;\n pushHashPath(encodedPath);\n var prevIndex = allPaths.lastIndexOf(createPath(history.location));\n var nextPaths = allPaths.slice(0, prevIndex + 1);\n nextPaths.push(path);\n allPaths = nextPaths;\n setState({\n action: action,\n location: location\n });\n } else {\n process.env.NODE_ENV !== \"production\" ? warning(false, 'Hash history cannot PUSH the same path; a new entry will not be added to the history stack') : void 0;\n setState();\n }\n });\n }\n\n function replace(path, state) {\n process.env.NODE_ENV !== \"production\" ? warning(state === undefined, 'Hash history cannot replace state; it is ignored') : void 0;\n var action = 'REPLACE';\n var location = createLocation(path, undefined, undefined, history.location);\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (!ok) return;\n var path = createPath(location);\n var encodedPath = encodePath(basename + path);\n var hashChanged = getHashPath() !== encodedPath;\n\n if (hashChanged) {\n // We cannot tell if a hashchange was caused by a REPLACE, so we'd\n // rather setState here and ignore the hashchange. The caveat here\n // is that other hash histories in the page will consider it a POP.\n ignorePath = path;\n replaceHashPath(encodedPath);\n }\n\n var prevIndex = allPaths.indexOf(createPath(history.location));\n if (prevIndex !== -1) allPaths[prevIndex] = path;\n setState({\n action: action,\n location: location\n });\n });\n }\n\n function go(n) {\n process.env.NODE_ENV !== \"production\" ? warning(canGoWithoutReload, 'Hash history go(n) causes a full page reload in this browser') : void 0;\n globalHistory.go(n);\n }\n\n function goBack() {\n go(-1);\n }\n\n function goForward() {\n go(1);\n }\n\n var listenerCount = 0;\n\n function checkDOMListeners(delta) {\n listenerCount += delta;\n\n if (listenerCount === 1 && delta === 1) {\n window.addEventListener(HashChangeEvent$1, handleHashChange);\n } else if (listenerCount === 0) {\n window.removeEventListener(HashChangeEvent$1, handleHashChange);\n }\n }\n\n var isBlocked = false;\n\n function block(prompt) {\n if (prompt === void 0) {\n prompt = false;\n }\n\n var unblock = transitionManager.setPrompt(prompt);\n\n if (!isBlocked) {\n checkDOMListeners(1);\n isBlocked = true;\n }\n\n return function () {\n if (isBlocked) {\n isBlocked = false;\n checkDOMListeners(-1);\n }\n\n return unblock();\n };\n }\n\n function listen(listener) {\n var unlisten = transitionManager.appendListener(listener);\n checkDOMListeners(1);\n return function () {\n checkDOMListeners(-1);\n unlisten();\n };\n }\n\n var history = {\n length: globalHistory.length,\n action: 'POP',\n location: initialLocation,\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n goBack: goBack,\n goForward: goForward,\n block: block,\n listen: listen\n };\n return history;\n}\n\nfunction clamp(n, lowerBound, upperBound) {\n return Math.min(Math.max(n, lowerBound), upperBound);\n}\n/**\n * Creates a history object that stores locations in memory.\n */\n\n\nfunction createMemoryHistory(props) {\n if (props === void 0) {\n props = {};\n }\n\n var _props = props,\n getUserConfirmation = _props.getUserConfirmation,\n _props$initialEntries = _props.initialEntries,\n initialEntries = _props$initialEntries === void 0 ? ['/'] : _props$initialEntries,\n _props$initialIndex = _props.initialIndex,\n initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex,\n _props$keyLength = _props.keyLength,\n keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;\n var transitionManager = createTransitionManager();\n\n function setState(nextState) {\n _extends(history, nextState);\n\n history.length = history.entries.length;\n transitionManager.notifyListeners(history.location, history.action);\n }\n\n function createKey() {\n return Math.random().toString(36).substr(2, keyLength);\n }\n\n var index = clamp(initialIndex, 0, initialEntries.length - 1);\n var entries = initialEntries.map(function (entry) {\n return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey());\n }); // Public interface\n\n var createHref = createPath;\n\n function push(path, state) {\n process.env.NODE_ENV !== \"production\" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;\n var action = 'PUSH';\n var location = createLocation(path, state, createKey(), history.location);\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (!ok) return;\n var prevIndex = history.index;\n var nextIndex = prevIndex + 1;\n var nextEntries = history.entries.slice(0);\n\n if (nextEntries.length > nextIndex) {\n nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location);\n } else {\n nextEntries.push(location);\n }\n\n setState({\n action: action,\n location: location,\n index: nextIndex,\n entries: nextEntries\n });\n });\n }\n\n function replace(path, state) {\n process.env.NODE_ENV !== \"production\" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;\n var action = 'REPLACE';\n var location = createLocation(path, state, createKey(), history.location);\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (!ok) return;\n history.entries[history.index] = location;\n setState({\n action: action,\n location: location\n });\n });\n }\n\n function go(n) {\n var nextIndex = clamp(history.index + n, 0, history.entries.length - 1);\n var action = 'POP';\n var location = history.entries[nextIndex];\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (ok) {\n setState({\n action: action,\n location: location,\n index: nextIndex\n });\n } else {\n // Mimic the behavior of DOM histories by\n // causing a render after a cancelled POP.\n setState();\n }\n });\n }\n\n function goBack() {\n go(-1);\n }\n\n function goForward() {\n go(1);\n }\n\n function canGo(n) {\n var nextIndex = history.index + n;\n return nextIndex >= 0 && nextIndex < history.entries.length;\n }\n\n function block(prompt) {\n if (prompt === void 0) {\n prompt = false;\n }\n\n return transitionManager.setPrompt(prompt);\n }\n\n function listen(listener) {\n return transitionManager.appendListener(listener);\n }\n\n var history = {\n length: entries.length,\n action: 'POP',\n location: entries[index],\n index: index,\n entries: entries,\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n goBack: goBack,\n goForward: goForward,\n canGo: canGo,\n block: block,\n listen: listen\n };\n return history;\n}\n\nexport { createBrowserHistory, createHashHistory, createMemoryHistory, createLocation, locationsAreEqual, parsePath, createPath };\n", "var n=function(t,s,r,e){var u;s[0]=0;for(var h=1;h=5&&((e||!n&&5===r)&&(h.push(r,0,e,s),r=6),n&&(h.push(r,n,0,s),r=6)),e=\"\"},a=0;a\"===t?(r=1,e=\"\"):e=t+e[0]:u?t===u?u=\"\":e+=t:'\"'===t||\"'\"===t?u=t:\">\"===t?(p(),r=1):r&&(\"=\"===t?(r=5,s=e,e=\"\"):\"/\"===t&&(r<5||\">\"===n[a][l+1])?(p(),3===r&&(h=h[0]),r=h,(h=h[0]).push(2,0,r),r=0):\" \"===t||\"\\t\"===t||\"\\n\"===t||\"\\r\"===t?(p(),r=2):e+=t),3===r&&\"!--\"===e&&(r=4,h=h[0])}return p(),h}(s)),r),arguments,[])).length>1?r:r[0]}\n", "import{h as r,Component as o,render as t}from\"preact\";export{h,render,Component}from\"preact\";import e from\"htm\";var m=e.bind(r);export{m as html};\n", "\nconst EMPTY = {};\n\nexport function assign(obj, props) {\n\t// eslint-disable-next-line guard-for-in\n\tfor (let i in props) {\n\t\tobj[i] = props[i];\n\t}\n\treturn obj;\n}\n\nexport function exec(url, route, opts) {\n\tlet reg = /(?:\\?([^#]*))?(#.*)?$/,\n\t\tc = url.match(reg),\n\t\tmatches = {},\n\t\tret;\n\tif (c && c[1]) {\n\t\tlet p = c[1].split('&');\n\t\tfor (let i=0; i b.rank) ? -1 :\n\t\t\t\t(a.index - b.index)\n\t);\n}\n\n// filter out VNodes without attributes (which are unrankeable), and add `index`/`rank` properties to be used in sorting.\nexport function prepareVNodeForRanking(vnode, index) {\n\tvnode.index = index;\n\tvnode.rank = rankChild(vnode);\n\treturn vnode.props;\n}\n\nexport function segmentize(url) {\n\treturn url.replace(/(^\\/+|\\/+$)/g, '').split('/');\n}\n\nexport function rankSegment(segment) {\n\treturn segment.charAt(0)==':' ? (1 + '*+?'.indexOf(segment.charAt(segment.length-1))) || 4 : 5;\n}\n\nexport function rank(path) {\n\treturn segmentize(path).map(rankSegment).join('');\n}\n\nfunction rankChild(vnode) {\n\treturn vnode.props.default ? 0 : rank(vnode.props.path);\n}\n", "import { cloneElement, createElement, Component, toChildArray } from 'preact';\nimport { exec, prepareVNodeForRanking, assign, pathRankSort } from './util';\n\nlet customHistory = null;\n\nconst ROUTERS = [];\n\nconst subscribers = [];\n\nconst EMPTY = {};\n\nfunction setUrl(url, type='push') {\n\tif (customHistory && customHistory[type]) {\n\t\tcustomHistory[type](url);\n\t}\n\telse if (typeof history!=='undefined' && history[type+'State']) {\n\t\thistory[type+'State'](null, null, url);\n\t}\n}\n\n\nfunction getCurrentUrl() {\n\tlet url;\n\tif (customHistory && customHistory.location) {\n\t\turl = customHistory.location;\n\t}\n\telse if (customHistory && customHistory.getCurrentLocation) {\n\t\turl = customHistory.getCurrentLocation();\n\t}\n\telse {\n\t\turl = typeof location!=='undefined' ? location : EMPTY;\n\t}\n\treturn `${url.pathname || ''}${url.search || ''}`;\n}\n\n\n\nfunction route(url, replace=false) {\n\tif (typeof url!=='string' && url.url) {\n\t\treplace = url.replace;\n\t\turl = url.url;\n\t}\n\n\t// only push URL into history if we can handle it\n\tif (canRoute(url)) {\n\t\tsetUrl(url, replace ? 'replace' : 'push');\n\t}\n\n\treturn routeTo(url);\n}\n\n\n/** Check if the given URL can be handled by any router instances. */\nfunction canRoute(url) {\n\tfor (let i=ROUTERS.length; i--; ) {\n\t\tif (ROUTERS[i].canRoute(url)) return true;\n\t}\n\treturn false;\n}\n\n\n/** Tell all router instances to handle the given URL. */\nfunction routeTo(url) {\n\tlet didRoute = false;\n\tfor (let i=0; i {\n\t\t\t\trouteTo(getCurrentUrl());\n\t\t\t});\n\t\t}\n\t\taddEventListener('click', delegateLinkHandler);\n\t}\n\teventListenersInitialized = true;\n}\n\n\nclass Router extends Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tif (props.history) {\n\t\t\tcustomHistory = props.history;\n\t\t}\n\n\t\tthis.state = {\n\t\t\turl: props.url || getCurrentUrl()\n\t\t};\n\n\t\tinitEventListeners();\n\t}\n\n\tshouldComponentUpdate(props) {\n\t\tif (props.static!==true) return true;\n\t\treturn props.url!==this.props.url || props.onChange!==this.props.onChange;\n\t}\n\n\t/** Check if the given URL can be matched against any children */\n\tcanRoute(url) {\n\t\tconst children = toChildArray(this.props.children);\n\t\treturn this.getMatchingChildren(children, url, false).length > 0;\n\t}\n\n\t/** Re-render children with a new URL to match against. */\n\trouteTo(url) {\n\t\tthis.setState({ url });\n\n\t\tconst didRoute = this.canRoute(url);\n\n\t\t// trigger a manual re-route if we're not in the middle of an update:\n\t\tif (!this.updating) this.forceUpdate();\n\n\t\treturn didRoute;\n\t}\n\n\tcomponentWillMount() {\n\t\tROUTERS.push(this);\n\t\tthis.updating = true;\n\t}\n\n\tcomponentDidMount() {\n\t\tif (customHistory) {\n\t\t\tthis.unlisten = customHistory.listen((location) => {\n\t\t\t\tthis.routeTo(`${location.pathname || ''}${location.search || ''}`);\n\t\t\t});\n\t\t}\n\t\tthis.updating = false;\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif (typeof this.unlisten==='function') this.unlisten();\n\t\tROUTERS.splice(ROUTERS.indexOf(this), 1);\n\t}\n\n\tcomponentWillUpdate() {\n\t\tthis.updating = true;\n\t}\n\n\tcomponentDidUpdate() {\n\t\tthis.updating = false;\n\t}\n\n\tgetMatchingChildren(children, url, invoke) {\n\t\treturn children\n\t\t\t.filter(prepareVNodeForRanking)\n\t\t\t.sort(pathRankSort)\n\t\t\t.map( vnode => {\n\t\t\t\tlet matches = exec(url, vnode.props.path, vnode.props);\n\t\t\t\tif (matches) {\n\t\t\t\t\tif (invoke !== false) {\n\t\t\t\t\t\tlet newProps = { url, matches };\n\t\t\t\t\t\tassign(newProps, matches);\n\t\t\t\t\t\tdelete newProps.ref;\n\t\t\t\t\t\tdelete newProps.key;\n\t\t\t\t\t\treturn cloneElement(vnode, newProps);\n\t\t\t\t\t}\n\t\t\t\t\treturn vnode;\n\t\t\t\t}\n\t\t\t}).filter(Boolean);\n\t}\n\n\trender({ children, onChange }, { url }) {\n\t\tlet active = this.getMatchingChildren(toChildArray(children), url, true);\n\n\t\tlet current = active[0] || null;\n\n\t\tlet previous = this.previousUrl;\n\t\tif (url!==previous) {\n\t\t\tthis.previousUrl = url;\n\t\t\tif (typeof onChange==='function') {\n\t\t\t\tonChange({\n\t\t\t\t\trouter: this,\n\t\t\t\t\turl,\n\t\t\t\t\tprevious,\n\t\t\t\t\tactive,\n\t\t\t\t\tcurrent\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn current;\n\t}\n}\n\nconst Link = (props) => (\n\tcreateElement('a', assign({ onClick: handleLinkClick }, props))\n);\n\nconst Route = props => createElement(props.component, props);\n\nRouter.subscribers = subscribers;\nRouter.getCurrentUrl = getCurrentUrl;\nRouter.route = route;\nRouter.Router = Router;\nRouter.Route = Route;\nRouter.Link = Link;\nRouter.exec = exec;\n\nexport { subscribers, getCurrentUrl, route, Router, Route, Link, exec };\nexport default Router;\n", "// TOOD: Add authentication headers to all sent requests\nconst request = async (url, options) => {\n\tconst headers = {\"Content-Type\": \"application/json\", ...options.headers}\n\tconst response = await fetch(url, { ...options, headers })\n\tif (response.status < 300) {\n\t\ttry {\n\t\t\treturn await response.json()\n\t\t} catch (e) {\n\t\t\ttry {\n\t\t\t\treturn await response.body()\n\t\t\t} catch (e2) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t}\n\t} else throw response\n}\n\nconst qs = (obj = {}) => new URLSearchParams(obj).toString()\nexport const get = (url, body = {}, options = {}) => request(`${url}${body ? `?${qs(body)}` : \"\"}`, {...options, method: \"GET\"})\nexport const post = (url, body = {}, options = {}) => request(url, {...options, body: JSON.stringify(body), method: \"POST\"})\nexport const patch = (url, body = {}, options = {}) => request(url, {...options, body: JSON.stringify(body), method: \"PATCH\"})\nexport const put = (url, body = {}, options = {}) => request(url, {...options, body: JSON.stringify(body), method: \"PUT\"})\nexport const del = (url, body = {}, options = {}) => request(url, {...options, body: JSON.stringify(body), method: \"DELETE\"})\n// TODO: Add PATCH and DELETE handlers\n", "import {post} from \"./http\"\n\nexport const trackEvent = event => post(\"https://logstash.internal.tkevents.io\", event)\n", "import { options } from 'preact';\r\n\r\n/** @type {number} */\r\nlet currentIndex;\r\n\r\n/** @type {import('./internal').Component} */\r\nlet currentComponent;\r\n\r\n/** @type {number} */\r\nlet currentHook = 0;\r\n\r\n/** @type {Array} */\r\nlet afterPaintEffects = [];\r\n\r\nlet oldBeforeDiff = options._diff;\r\nlet oldBeforeRender = options._render;\r\nlet oldAfterDiff = options.diffed;\r\nlet oldCommit = options._commit;\r\nlet oldBeforeUnmount = options.unmount;\r\n\r\nconst RAF_TIMEOUT = 100;\r\nlet prevRaf;\r\n\r\noptions._diff = vnode => {\r\n\tcurrentComponent = null;\r\n\tif (oldBeforeDiff) oldBeforeDiff(vnode);\r\n};\r\n\r\noptions._render = vnode => {\r\n\tif (oldBeforeRender) oldBeforeRender(vnode);\r\n\r\n\tcurrentComponent = vnode._component;\r\n\tcurrentIndex = 0;\r\n\r\n\tconst hooks = currentComponent.__hooks;\r\n\tif (hooks) {\r\n\t\thooks._pendingEffects.forEach(invokeCleanup);\r\n\t\thooks._pendingEffects.forEach(invokeEffect);\r\n\t\thooks._pendingEffects = [];\r\n\t}\r\n};\r\n\r\noptions.diffed = vnode => {\r\n\tif (oldAfterDiff) oldAfterDiff(vnode);\r\n\r\n\tconst c = vnode._component;\r\n\tif (c && c.__hooks && c.__hooks._pendingEffects.length) {\r\n\t\tafterPaint(afterPaintEffects.push(c));\r\n\t}\r\n\tcurrentComponent = null;\r\n};\r\n\r\noptions._commit = (vnode, commitQueue) => {\r\n\tcommitQueue.some(component => {\r\n\t\ttry {\r\n\t\t\tcomponent._renderCallbacks.forEach(invokeCleanup);\r\n\t\t\tcomponent._renderCallbacks = component._renderCallbacks.filter(cb =>\r\n\t\t\t\tcb._value ? invokeEffect(cb) : true\r\n\t\t\t);\r\n\t\t} catch (e) {\r\n\t\t\tcommitQueue.some(c => {\r\n\t\t\t\tif (c._renderCallbacks) c._renderCallbacks = [];\r\n\t\t\t});\r\n\t\t\tcommitQueue = [];\r\n\t\t\toptions._catchError(e, component._vnode);\r\n\t\t}\r\n\t});\r\n\r\n\tif (oldCommit) oldCommit(vnode, commitQueue);\r\n};\r\n\r\noptions.unmount = vnode => {\r\n\tif (oldBeforeUnmount) oldBeforeUnmount(vnode);\r\n\r\n\tconst c = vnode._component;\r\n\tif (c && c.__hooks) {\r\n\t\tlet hasErrored;\r\n\t\tc.__hooks._list.forEach(s => {\r\n\t\t\ttry {\r\n\t\t\t\tinvokeCleanup(s);\r\n\t\t\t} catch (e) {\r\n\t\t\t\thasErrored = e;\r\n\t\t\t}\r\n\t\t});\r\n\t\tif (hasErrored) options._catchError(hasErrored, c._vnode);\r\n\t}\r\n};\r\n\r\n/**\r\n * Get a hook's state from the currentComponent\r\n * @param {number} index The index of the hook to get\r\n * @param {number} type The index of the hook to get\r\n * @returns {any}\r\n */\r\nfunction getHookState(index, type) {\r\n\tif (options._hook) {\r\n\t\toptions._hook(currentComponent, index, currentHook || type);\r\n\t}\r\n\tcurrentHook = 0;\r\n\r\n\t// Largely inspired by:\r\n\t// * https://github.com/michael-klein/funcy.js/blob/f6be73468e6ec46b0ff5aa3cc4c9baf72a29025a/src/hooks/core_hooks.mjs\r\n\t// * https://github.com/michael-klein/funcy.js/blob/650beaa58c43c33a74820a3c98b3c7079cf2e333/src/renderer.mjs\r\n\t// Other implementations to look at:\r\n\t// * https://codesandbox.io/s/mnox05qp8\r\n\tconst hooks =\r\n\t\tcurrentComponent.__hooks ||\r\n\t\t(currentComponent.__hooks = {\r\n\t\t\t_list: [],\r\n\t\t\t_pendingEffects: []\r\n\t\t});\r\n\r\n\tif (index >= hooks._list.length) {\r\n\t\thooks._list.push({});\r\n\t}\r\n\treturn hooks._list[index];\r\n}\r\n\r\n/**\r\n * @param {import('./index').StateUpdater} [initialState]\r\n */\r\nexport function useState(initialState) {\r\n\tcurrentHook = 1;\r\n\treturn useReducer(invokeOrReturn, initialState);\r\n}\r\n\r\n/**\r\n * @param {import('./index').Reducer} reducer\r\n * @param {import('./index').StateUpdater} initialState\r\n * @param {(initialState: any) => void} [init]\r\n * @returns {[ any, (state: any) => void ]}\r\n */\r\nexport function useReducer(reducer, initialState, init) {\r\n\t/** @type {import('./internal').ReducerHookState} */\r\n\tconst hookState = getHookState(currentIndex++, 2);\r\n\thookState._reducer = reducer;\r\n\tif (!hookState._component) {\r\n\t\thookState._value = [\r\n\t\t\t!init ? invokeOrReturn(undefined, initialState) : init(initialState),\r\n\r\n\t\t\taction => {\r\n\t\t\t\tconst nextValue = hookState._reducer(hookState._value[0], action);\r\n\t\t\t\tif (hookState._value[0] !== nextValue) {\r\n\t\t\t\t\thookState._value = [nextValue, hookState._value[1]];\r\n\t\t\t\t\thookState._component.setState({});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t];\r\n\r\n\t\thookState._component = currentComponent;\r\n\t}\r\n\r\n\treturn hookState._value;\r\n}\r\n\r\n/**\r\n * @param {import('./internal').Effect} callback\r\n * @param {any[]} args\r\n */\r\nexport function useEffect(callback, args) {\r\n\t/** @type {import('./internal').EffectHookState} */\r\n\tconst state = getHookState(currentIndex++, 3);\r\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\r\n\t\tstate._value = callback;\r\n\t\tstate._args = args;\r\n\r\n\t\tcurrentComponent.__hooks._pendingEffects.push(state);\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {import('./internal').Effect} callback\r\n * @param {any[]} args\r\n */\r\nexport function useLayoutEffect(callback, args) {\r\n\t/** @type {import('./internal').EffectHookState} */\r\n\tconst state = getHookState(currentIndex++, 4);\r\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\r\n\t\tstate._value = callback;\r\n\t\tstate._args = args;\r\n\r\n\t\tcurrentComponent._renderCallbacks.push(state);\r\n\t}\r\n}\r\n\r\nexport function useRef(initialValue) {\r\n\tcurrentHook = 5;\r\n\treturn useMemo(() => ({ current: initialValue }), []);\r\n}\r\n\r\n/**\r\n * @param {object} ref\r\n * @param {() => object} createHandle\r\n * @param {any[]} args\r\n */\r\nexport function useImperativeHandle(ref, createHandle, args) {\r\n\tcurrentHook = 6;\r\n\tuseLayoutEffect(\r\n\t\t() => {\r\n\t\t\tif (typeof ref == 'function') ref(createHandle());\r\n\t\t\telse if (ref) ref.current = createHandle();\r\n\t\t},\r\n\t\targs == null ? args : args.concat(ref)\r\n\t);\r\n}\r\n\r\n/**\r\n * @param {() => any} factory\r\n * @param {any[]} args\r\n */\r\nexport function useMemo(factory, args) {\r\n\t/** @type {import('./internal').MemoHookState} */\r\n\tconst state = getHookState(currentIndex++, 7);\r\n\tif (argsChanged(state._args, args)) {\r\n\t\tstate._value = factory();\r\n\t\tstate._args = args;\r\n\t\tstate._factory = factory;\r\n\t}\r\n\r\n\treturn state._value;\r\n}\r\n\r\n/**\r\n * @param {() => void} callback\r\n * @param {any[]} args\r\n */\r\nexport function useCallback(callback, args) {\r\n\tcurrentHook = 8;\r\n\treturn useMemo(() => callback, args);\r\n}\r\n\r\n/**\r\n * @param {import('./internal').PreactContext} context\r\n */\r\nexport function useContext(context) {\r\n\tconst provider = currentComponent.context[context._id];\r\n\t// We could skip this call here, but than we'd not call\r\n\t// `options._hook`. We need to do that in order to make\r\n\t// the devtools aware of this hook.\r\n\t/** @type {import('./internal').ContextHookState} */\r\n\tconst state = getHookState(currentIndex++, 9);\r\n\t// The devtools needs access to the context object to\r\n\t// be able to pull of the default value when no provider\r\n\t// is present in the tree.\r\n\tstate._context = context;\r\n\tif (!provider) return context._defaultValue;\r\n\t// This is probably not safe to convert to \"!\"\r\n\tif (state._value == null) {\r\n\t\tstate._value = true;\r\n\t\tprovider.sub(currentComponent);\r\n\t}\r\n\treturn provider.props.value;\r\n}\r\n\r\n/**\r\n * Display a custom label for a custom hook for the devtools panel\r\n * @type {(value: T, cb?: (value: T) => string | number) => void}\r\n */\r\nexport function useDebugValue(value, formatter) {\r\n\tif (options.useDebugValue) {\r\n\t\toptions.useDebugValue(formatter ? formatter(value) : value);\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {(error: any) => void} cb\r\n */\r\nexport function useErrorBoundary(cb) {\r\n\t/** @type {import('./internal').ErrorBoundaryHookState} */\r\n\tconst state = getHookState(currentIndex++, 10);\r\n\tconst errState = useState();\r\n\tstate._value = cb;\r\n\tif (!currentComponent.componentDidCatch) {\r\n\t\tcurrentComponent.componentDidCatch = err => {\r\n\t\t\tif (state._value) state._value(err);\r\n\t\t\terrState[1](err);\r\n\t\t};\r\n\t}\r\n\treturn [\r\n\t\terrState[0],\r\n\t\t() => {\r\n\t\t\terrState[1](undefined);\r\n\t\t}\r\n\t];\r\n}\r\n\r\n/**\r\n * After paint effects consumer.\r\n */\r\nfunction flushAfterPaintEffects() {\r\n\tlet component;\r\n\t// sort the queue by depth (outermost to innermost)\r\n\tafterPaintEffects.sort((a, b) => a._vnode._depth - b._vnode._depth);\r\n\twhile (component = afterPaintEffects.pop()) {\r\n\t\tif (!component._parentDom) continue;\r\n\t\ttry {\r\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeCleanup);\r\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeEffect);\r\n\t\t\tcomponent.__hooks._pendingEffects = [];\r\n\t\t} catch (e) {\r\n\t\t\tcomponent.__hooks._pendingEffects = [];\r\n\t\t\toptions._catchError(e, component._vnode);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nlet HAS_RAF = typeof requestAnimationFrame == 'function';\r\n\r\n/**\r\n * Schedule a callback to be invoked after the browser has a chance to paint a new frame.\r\n * Do this by combining requestAnimationFrame (rAF) + setTimeout to invoke a callback after\r\n * the next browser frame.\r\n *\r\n * Also, schedule a timeout in parallel to the the rAF to ensure the callback is invoked\r\n * even if RAF doesn't fire (for example if the browser tab is not visible)\r\n *\r\n * @param {() => void} callback\r\n */\r\nfunction afterNextFrame(callback) {\r\n\tconst done = () => {\r\n\t\tclearTimeout(timeout);\r\n\t\tif (HAS_RAF) cancelAnimationFrame(raf);\r\n\t\tsetTimeout(callback);\r\n\t};\r\n\tconst timeout = setTimeout(done, RAF_TIMEOUT);\r\n\r\n\tlet raf;\r\n\tif (HAS_RAF) {\r\n\t\traf = requestAnimationFrame(done);\r\n\t}\r\n}\r\n\r\n// Note: if someone used options.debounceRendering = requestAnimationFrame,\r\n// then effects will ALWAYS run on the NEXT frame instead of the current one, incurring a ~16ms delay.\r\n// Perhaps this is not such a big deal.\r\n/**\r\n * Schedule afterPaintEffects flush after the browser paints\r\n * @param {number} newQueueLength\r\n */\r\nfunction afterPaint(newQueueLength) {\r\n\tif (newQueueLength === 1 || prevRaf !== options.requestAnimationFrame) {\r\n\t\tprevRaf = options.requestAnimationFrame;\r\n\t\t(prevRaf || afterNextFrame)(flushAfterPaintEffects);\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {import('./internal').EffectHookState} hook\r\n */\r\nfunction invokeCleanup(hook) {\r\n\t// A hook cleanup can introduce a call to render which creates a new root, this will call options.vnode\r\n\t// and move the currentComponent away.\r\n\tconst comp = currentComponent;\r\n\tlet cleanup = hook._cleanup;\r\n\tif (typeof cleanup == 'function') {\r\n\t\thook._cleanup = undefined;\r\n\t\tcleanup();\r\n\t}\r\n\tcurrentComponent = comp;\r\n}\r\n\r\n/**\r\n * Invoke a Hook's effect\r\n * @param {import('./internal').EffectHookState} hook\r\n */\r\nfunction invokeEffect(hook) {\r\n\t// A hook call can introduce a call to render which creates a new root, this will call options.vnode\r\n\t// and move the currentComponent away.\r\n\tconst comp = currentComponent;\r\n\thook._cleanup = hook._value();\r\n\tcurrentComponent = comp;\r\n}\r\n\r\n/**\r\n * @param {any[]} oldArgs\r\n * @param {any[]} newArgs\r\n */\r\nfunction argsChanged(oldArgs, newArgs) {\r\n\treturn (\r\n\t\t!oldArgs ||\r\n\t\toldArgs.length !== newArgs.length ||\r\n\t\tnewArgs.some((arg, index) => arg !== oldArgs[index])\r\n\t);\r\n}\r\n\r\nfunction invokeOrReturn(arg, f) {\r\n\treturn typeof f == 'function' ? f(arg) : f;\r\n}\r\n", "/**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\nfunction InvalidCharacterError(message) {\n this.message = message;\n}\n\nInvalidCharacterError.prototype = new Error();\nInvalidCharacterError.prototype.name = \"InvalidCharacterError\";\n\nfunction polyfill(input) {\n var str = String(input).replace(/=+$/, \"\");\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\n \"'atob' failed: The string to be decoded is not correctly encoded.\"\n );\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = \"\";\n // get next character\n (buffer = str.charAt(idx++));\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? bs * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ?\n (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) :\n 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n}\n\nexport default (typeof window !== \"undefined\" &&\n window.atob &&\n window.atob.bind(window)) ||\npolyfill;", "import atob from \"./atob\";\n\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(\n atob(str).replace(/(.)/g, function(m, p) {\n var code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = \"0\" + code;\n }\n return \"%\" + code;\n })\n );\n}\n\nexport default function(str) {\n var output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw \"Illegal base64url string!\";\n }\n\n try {\n return b64DecodeUnicode(output);\n } catch (err) {\n return atob(output);\n }\n}", "\"use strict\";\n\nimport base64_url_decode from \"./base64_url_decode\";\n\nexport function InvalidTokenError(message) {\n this.message = message;\n}\n\nInvalidTokenError.prototype = new Error();\nInvalidTokenError.prototype.name = \"InvalidTokenError\";\n\nexport default function(token, options) {\n if (typeof token !== \"string\") {\n throw new InvalidTokenError(\"Invalid token specified\");\n }\n\n options = options || {};\n var pos = options.header === true ? 0 : 1;\n try {\n return JSON.parse(base64_url_decode(token.split(\".\")[pos]));\n } catch (e) {\n throw new InvalidTokenError(\"Invalid token specified: \" + e.message);\n }\n}", "import decode from \"jwt-decode\"\nimport {useEffect, useRef, useState} from \"preact/hooks\"\n\nimport {trackEvent} from \"./analytics\"\n\n\n// This is an example custom hook\n// The naming syntax is SPECIFICALLY \"useSomething\" for all hooks\nexport const useLocalStorage = keyName => {\n\t// We don't want to hammer localStorage continuously forever,\n\t// so we use `useState` to store the last value we got from localStorage\n\t// kind of like a cache, and we pre-set it to the current value of whatever\n\t// localStorage key we're interested in.\n\tconst [value, updateValue] = useState(JSON.parse(window.localStorage.getItem(keyName)) || null)\n\n\t// This is the function that will be called whenever localStorage updates\n\tconst listener = event => {\n\t\t// Like most event handlers, this function is given an `event` object\n\t\t// containing a whole load of stuff we don't care about, so we\n\t\t// destructure it to extract just the `key` and `newValue` properties\n\t\t// as these are the only things we care about.\n\t\tconst {key, newValue} = event\n\n\t\t// The localStorage event listener fires on every update to every key in\n\t\t// Storage, so we check the event we've been given to see if it was for\n\t\t// the key that this specific hook is looking for, by comparing the\n\t\t// `key` parameter of the event to the `keyName` this hook was told to\n\t\t// subscribe to. If (and only if!) the keys match, then we update our\n\t\t// local state to store the new value.\n\t\tif (key == keyName) { updateValue(newValue) }\n\t}\n\n\t// Because we're binding an event listener to the `window` object, executing\n\t// this hook has a long-lasting impact on the state of the browser session.\n\t// Therefore this hook would be described as \"having side effects\" - it\n\t// doesn't JUST return data, it also changes the world around it a little\n\t// bit. Since all of the code in a custom hook like this runs every time\n\t// the hook is called (which is roughly once per render) we need to specify\n\t// to (p)React that some code, like binding the event listener, should only\n\t// execute once. To do this, we wrap that code in a `useEffect` hook call,\n\t// so (p)React can go \"ok, this is a side effect, so I'm only going to run\n\t// this once.\"\n\tuseEffect(\n\t\t// The first argument to `useEffect` is a function that when called,\n\t\t// will \"do the side effect\". That might be to set up a repeating\n\t\t// series of requests to an API to regularly pull a user's\n\t\t// notifications, or to monitor future changes to the browser window's\n\t\t// size for the purposes of building responsive layouts etc. Roughly\n\t\t// speaking, anything that you don't want to run every time the\n\t\t// component renders would count as a side effect.\n\t\t() => {\n\t\t\t// Here is the side effect itself binding the event listener. If we\n\t\t\t// let this run every time the component rendered, we could\n\t\t\t// potentially end up with hundreds or thousands of event listeners\n\t\t\t// being bound which can not only cause some very strange bugs but\n\t\t\t// also memory leaks and performance problems like lag or worse.\n\t\t\twindow.addEventListener(\"storage\", listener)\n\n\t\t\t// When using `useEffect` you can also specify how to undo the side\n\t\t\t// effects. Sometimes you don't need to - if you're just doing a\n\t\t\t// fetch or something there is no long-lasting effect to clean up.\n\t\t\t// But here we need to tell (p)React how to remove the event\n\t\t\t// listener that we bound earlier. To enable this, when calling\n\t\t\t// `useEffect` we can return a function, which when called will\n\t\t\t// clear up after ourselves. In this case, because we bound an\n\t\t\t// event listener, we use the browser's built-in\n\t\t\t// `window.removeEventListener` function to unbind our event\n\t\t\t// listener. By providing (p)React with this function, it will\n\t\t\t// call it for us when our side effect is no longer needed, thus\n\t\t\t// ensuring we don't have memory leaks, bugs, performance problems\n\t\t\t// etc caused by keeping long-lasting stuff like event handlers\n\t\t\t// alive forever.\n\t\t\treturn () => window.removeEventListener(\"storage\", listener)\n\t\t},\n\n\t\t// The second argument to a `useEffect` function call is an array that\n\t\t// contains all of the variables that should \"reset\" our side effect.\n\t\t// In this case, if our hook call changes from `useLocalStorage(\"foo\")`\n\t\t// to `useLocalStorage(\"bar\")`, we don't need to do anything because\n\t\t// our side effect listens to *all* of localStorage, so we don't need\n\t\t// to unbind it, and replace it with a new one. But you can imagine if\n\t\t// our side effect could only detect changes to one specific key, we'd\n\t\t// need to unbind it so we stop seeing update to \"foo\" and re-bind with\n\t\t// a new listener that listens for changes to \"bar\". But because we\n\t\t// don't need to do that here, we can give `useEffect` an empty array.\n\t\t// You can think of this as basically saying explicitly \"even if your\n\t\t// inputs change, you don't need to clear the side effect and re-run\"\n\t\t[],\n\t)\n\n\t// Just a small function that we can give back to the code that's calling\n\t// our hook, to let it write new data *into* the localStorage key as well\n\t// as just reading from it. This effectively makes this hook behave a lot\n\t// like `useState` except that the data is persistently stored in\n\t// localStorage.\n\tconst setValue = newValue => {\n\t\tupdateValue(newValue)\n\t\twindow.localStorage.setItem(keyName, JSON.stringify(newValue))\n\t}\n\n\t// Finally, return an array containing the current value from the key we're\n\t// watching in localStorage, and a function that the caller can use to\n\t// put new data into that key.\n\treturn [value, setValue]\n}\n\n// A much smaller, simpler example hook showing how we can easily use hooks\n// inside other hooks. This one is a less-generic case, a hook we can use to\n// only read from (but not write to!) the \"user\" key in localStorage.\nexport const useUser = () => {\n\t// `useLocalStorage` returns an array as described above, but we don't care\n\t// about the second item in the array, which is the function we'd use to\n\t// save a new value into localStorage. So we destructure the return from\n\t// `useLocalStorage` to keep just the current value, which we know will be\n\t// the JWT, and return that.\n\tconst [jwt] = useLocalStorage(\"user\")\n\treturn jwt === null ? {} : decode(jwt)\n}\n\n// An example of squashing the `useUser` hook down even smaller. I wouldn't\n// recommend actually doing this, but it does sort of show how easy it can\n// be to make hooks out of other hooks\nexport const useUserCompact = () => useLocalStorage(\"user\")[0]\n\nexport const useAnalytics = packet => {\n\tuseEffect(() => {\n\t\ttrackEvent(packet)\n\t}, [packet])\n}\n\nexport const useHeartbeats = (packet, frequency) => {\n\tuseEffect(() => {\n\t\ttrackEvent(packet)\n\t\tconst intervalID = setInterval(() => trackEvent(packet), frequency)\n\t\treturn () => clearInterval(intervalID)\n\t}, [packet, frequency])\n}\n\nexport const useInterval = (callback, delay = 1000, ...args) => {\n\tconst savedCallback = useRef()\n\n\tuseEffect(() => {\n\t\tsavedCallback.current = callback\n\t}, [callback])\n\n\tuseEffect(() => {\n\t\tfunction tick () {\n\t\t\tif (savedCallback.current) {\n\t\t\t\tsavedCallback.current(...args)\n\t\t\t}\n\t\t}\n\t\tconst id = setInterval(tick, delay)\n\t\treturn () => clearInterval(id)\n\t}, [callback.toString(), delay])\n}\n\nexport const useJitsi = (options, domain = \"meet.jit.si\", meetingConfig = {\n\tallowComunication: true,\n\tonDisconnect: () => {}\n}) => {\n\tconst [isAPILoaded, setIsAPILoaded] = useState(false)\n\tconst jitsiAPIRef = useRef(null)\n\n\tconst comunicationConfig = [\n\t\t'microphone', \n\t\t'camera', \n\t\t'raisehand',\n\t\t'mute-everyone',\n\t\t'mute-video-everyone',\n\t\t'shareaudio',\n\t\t'sharedvideo',\n\t\t'desktop',\n\t\t'toggle-camera',\n\t]\n\n\t// Add the Jitsi external script to the page\n\tuseEffect(() => {\n\t\tconst jitsiScript = document.createElement(\"script\")\n\t\tjitsiScript.setAttribute(\"src\", \"https://8x8.vc/external_api.js\")\n\t\tjitsiScript.setAttribute(\"id\", \"jitsiScript\")\n\t\tdocument.head.appendChild(jitsiScript)\n\n\t\t// Clean up after ourselves by removing the Jitsi script\n\t\treturn () => document.getElementById(\"jitsiScript\").remove()\n\t}, [])\n\n\t// Once the Jitsi script has loaded, set a flag so we know we can use it\n\tuseEffect(() => {\n\t\tconst apiCheckInterval = setInterval(() => {\n\t\t\tif (window.JitsiMeetExternalAPI != undefined) {\n\t\t\t\tsetIsAPILoaded(true)\n\t\t\t\tclearInterval(apiCheckInterval)\n\t\t\t}\n\t\t}, 100)\n\n\t\t// Clean up after ourselves by clearing the interval\n\t\treturn () => clearInterval(apiCheckInterval)\n\t}, [])\n\n\t// Connect to the call\n\tuseEffect(() => {\n\t\tif (isAPILoaded && options.jwt !== \"\") {\n\t\t\tif (jitsiAPIRef.current) { jitsiAPIRef.current.dispose() }\n\n\t\t\tif (options.roomName === null) {\n\t\t\t\tjitsiAPIRef.current = null\n\t\t\t} else {\n\t\t\t\tconst jitsiAPI = new window.JitsiMeetExternalAPI(\n\t\t\t\t\tdomain,\n\t\t\t\t\t{\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\tconfigOverwrite: {\n\t\t\t\t\t\t\tremoteVideoMenu: {\n\t\t\t\t\t\t\t\tdisableKick: !meetingConfig.allowComunication,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tstartWithAudioMuted: !meetingConfig.allowComunication,\n\t\t\t\t\t\t\tdisableInviteFunctions: true,\n\t\t\t\t\t\t\tdisableRemoteMute: !meetingConfig.allowComunication,\n\t\t\t\t\t\t\ttoolbarButtons: [ ...[\n\t\t\t\t\t\t 'closedcaptions',\n\t\t\t\t\t\t\t'chat', \n\t\t\t\t\t\t 'download',\n\t\t\t\t\t\t 'embedmeeting',\n\t\t\t\t\t\t 'etherpad',\n\t\t\t\t\t\t 'feedback',\n\t\t\t\t\t\t 'filmstrip',\n\t\t\t\t\t\t 'fullscreen',\n\t\t\t\t\t\t 'hangup',\n\t\t\t\t\t\t 'help',\n\t\t\t\t\t\t 'participants-pane',\n\t\t\t\t\t\t 'profile',\n\t\t\t\t\t\t 'recording',\n\t\t\t\t\t\t 'select-background',\n\t\t\t\t\t\t 'settings',\n\t\t\t\t\t\t 'shortcuts',\n\t\t\t\t\t\t 'tileview',\n\t\t\t\t\t\t '__end'\n\t\t\t\t\t\t\t], ...(meetingConfig.allowComunication ? comunicationConfig : [])],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t)\n\n\t\t\t\tjitsiAPI.addListener(\"readyToClose\", () => {\n\t\t\t\t\tif (typeof meetingConfig.onDisconnect === \"function\") meetingConfig.onDisconnect()\n\t\t\t\t\treturn jitsiAPI.dispose()\n\t\t\t\t})\n\t\t\t\tjitsiAPIRef.current = jitsiAPI\n\t\t\t}\n\t\t}\n\n\t\t// Clean up after ourselves by disconnecting from the call\n\t\treturn () => {\n\t\t\tif (jitsiAPIRef.current) { jitsiAPIRef.current.dispose() }\n\t\t\tjitsiAPIRef.current = null\n\t\t}\n\t}, [\n\t\tisAPILoaded,\n\t\tdomain,\n\t\tJSON.stringify(options),\n\t])\n}\n\nexport const useDateTime = (resolution = \"minute\") => {\n\tconst [time, updateTime] = useState(new Date())\n\n\tuseEffect(() => window.setInterval(\n\t\t() => updateTime(new Date()),\n\t\tresolution === \"day\" ? 86400000\n\t\t: resolution === \"hour\" ? 3600000\n\t\t: resolution === \"minute\" ? 60000\n\t\t: 1000 // 1 second\n\t), [resolution])\n\n\treturn time\n}\n\nexport const useDataApi = (initialUrl, initialData) => {\n\t\n const [data, setData] = useState(initialData);\n const [url, setUrl] = useState(initialUrl);\n const [isLoading, setIsLoading] = useState(false);\n const [isError, setIsError] = useState(false);\n\n\tuseEffect(() => {\n\t\tconst fetchData = async () => {\n\t\t\tsetIsError(false);\n\t\t\tsetIsLoading(true);\n\n\t\t\ttry {\n\t\t\t\tconst result = await fetch(url);\n\n\t\t\t\tsetData(await result.json())\n\t\t\t} catch (error) {\n\t\t\t\tconsole.log(error)\n\t\t\t\tsetIsError(true);\n\t\t\t}\n\n\t\t\tsetIsLoading(false);\n\t\t};\n\n\t\tfetchData();\n\t}, [url]);\n \n return [ data, isLoading, isError ];\n };\n\n export const sendData = (initialUrl, request, initialData) => {\n\t\n const [data, setData] = useState(initialData);\n const [url, setUrl] = useState(initialUrl);\n const [isLoading, setIsLoading] = useState(false);\n const [isError, setIsError] = useState(false);\n\n\tuseEffect(() => {\n\t\tconst fetchData = async () => {\n\t\t\tsetIsError(false);\n\t\t\tsetIsLoading(true);\n\n\t\t\ttry {\n\t\t\t\tconst result = await fetch(url, {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t'Content-Type': 'application/json'\n\t\t\t\t\t},\n\t\t\t\t\tbody: JSON.stringify(request)\n\t\t\t\t});\n\n\n\t\t\t\tif (initialData == null) setData(null)\n\t\t\t\telse setData(await result.json());\n\t\t\t} catch (error) {\n\t\t\t\tsetIsError(true);\n\t\t\t}\n\n\t\t\tsetIsLoading(false);\n\t\t};\n\n\t\tfetchData();\n\t}, [url, initialData]);\n\n \n return [ data, isLoading, isError ];\n };\n", "import { html } from \"htm/preact\"\nimport { useState } from \"preact/hooks\"\n\nimport { get } from \"./http\"\nimport { useDateTime, useLocalStorage } from \"./hooks\"\n\n// Debounce is in milliseconds so a 1hr cooldown\n// on a rule activation would be 1000 * 60 * 60\nexport const triggerGamificationRule = (actionName, debounce = 0) => {\n\tconst eventId = window.dataLayer[0][\"Event ID\"]\n\tconst regId = window.dataLayer[0][\"Registrant ID\"]\n\tconst firstName = window.dataLayer[0][\"First Name\"]\n\tconst lastName = window.dataLayer[0][\"Last Name\"]\n\tconst email = window.dataLayer[0][\"Email Address\"]\n\tconst optedIn = window.dataLayer[0][\"I would like to opt in to the Leaderboard competition\"] === \"Yes\"\n\tconst lastTriggered = window.localStorage.getItem(`rule-${actionName}`) || \"2021\"\n\tif (new Date() < new Date(lastTriggered / 1 + debounce)) {\n\t\treturn false\n\t} else {\n\t\twindow.localStorage.setItem(`rule-${actionName}`, new Date().valueOf())\n\t}\n\n\tconst registrantId = `${regId}_${firstName}_${lastName}_${email}`\n\n\tconst query = { actionName, eventId, registrantId, swoogoAccess: false }\n\n\tif (optedIn) {\n\t\tget(\"https://sponsor-gamification.herokuapp.com/dynamic\", query)\n\t}\n}\n\nexport const TimeSwitch = ({ children }) => {\n\tconst now = useDateTime(\"minute\")\n\n\treturn children.find(child =>\n\t\tnew Date(child.starts) < now\n\t\t&& new Date(child.ends) > now\n\t)?.content || children[0].content ||

Something went wrong. If you feel helpful, please refresh the page and let the helpdesk know!

\n}\n\nexport const DisplayOnce = ({ id, children, ...rest}) => {\n\tconst [isDisplayed, setIsDisplayed] = useLocalStorage(`displayOnce-${id}`)\n\tif (!isDisplayed) {\n\t\treturn setIsDisplayed(true)}>{children}\n\t} else {\n\t\treturn null\n\t}\n}\n\nexport const Background = ({ imgURL, style }) =>\n\timgURL.match(/\\.mp4$/)\n\t\t? html`\n\t\t\n\t`\n\t\t: html``\n\nexport const OpenCometChatGroup = () =>\n\tfunction openChat(name) {\n\t\tCometChatWidget.openOrCloseChat(true);\n\t\tCometChatWidget.chatWithGroup(name);\n\t}\n\n\nexport const Modal = ({ children, style = {}, dismiss, dismissHTML = null, dismissStyle }) => html`\n\t\n\t\t\n\t\t\t${children}\n\t\t\t${dismissHTML}\n\t\t\n\t\n`\n\nexport const ElfsightPopup = ({ trigger, ID }) => html`\n\t${trigger && html`
`}\n\t
\n`\n\nexport const Link = ({\n\thref = null,\n\ttarget = null,\n\tonClick = () => null,\n\twidth,\n\theight,\n\tleft,\n\ttop,\n\tlabel,\n\ttitle = \"\",\n\telfsightPopupID = null,\n\tmodal = null,\n\troomName = \"\",\n\tCometChatID = null,\n\tCometChatUserID = null,\n\tflyzooChatName = \"unnamed\",\n\tchildren = null,\n\tposition = \"absolute\",\n\tisExternal = undefined,\n\tgameRule = null,\n\tgameRuleCooldown = 0,\n\tmodalOverrides = {},\n\tgaAction = \"Link Click\",\n}) => {\n\tconst optionals = {}\n\tconst [modalVisible, toggleModal] = useState(false)\n\tconst isRedirectTrackingLink = !isExternal && href?.length && !href.startsWith(\"http\") && !href.startsWith(\"/\")\n\tlet generatedOnClick = () => { }\n\n\tif (modal) {\n\t\t// eslint-disable-next-line no-param-reassign\n\t\tgeneratedOnClick = () => {\n\t\t\ttoggleModal(!modalVisible)\n\t\t}\n\t} else if (CometChatID) {\n\t\t// eslint-disable-next-line no-param-reassign\n\t\tgeneratedOnClick = () => {\n\t\t\twindow.CometChatWidget.openOrCloseChat(true)\n\t\t\twindow.CometChatWidget.chatWithGroup(CometChatID)\n\t\t}\n\t} else if (CometChatUserID) {\n\t\t// eslint-disable-next-line no-param-reassign\n\t\tgeneratedOnClick = () => {\n\t\t\twindow.CometChatWidget.openOrCloseChat(true)\n\t\t\twindow.CometChatWidget.chatWithUser(CometChatUserID)\n\t\t}\n\t} else if (isRedirectTrackingLink) {\n\t\t// eslint-disable-next-line no-param-reassign\n\t\tgeneratedOnClick = () => {\n\t\t\twindow.redirectTracking(href, 1)\n\t\t}\n\t}\n\n\tif (!isRedirectTrackingLink && href) { optionals.href = href }\n\n\tconst className = roomName ? \"_gtm-event\" : \"\"\n\n\treturn html`\n\t\t {\n\t\t\tif (onClick) { onClick(); generatedOnClick() }\n\t\t\tif (gameRule) { triggerGamificationRule(gameRule, gameRuleCooldown) }\n\t\t}}\n\t\t\tid=${label}\n\t\t\tdata-event-category=${roomName}\n\t\t\tdata-event-action=${gaAction}\n\t\t\tdata-event-label=${label}\n\t\t\ttitle=${label}\n\t\t\taria-label=${label}\n\t\t\tclass=${className}\n\t\t\tstyle=\"\n\t\t\t\twidth: ${width};\n\t\t\t\theight: ${height};\n\t\t\t\tleft: ${left};\n\t\t\t\ttop: ${top};\n\t\t\t\tposition:${position};\n\t\t\t\tcursor: pointer;\n\t\t\t\ttext-decoration: none;\n\t\t\t\"\n\t\t\t...${optionals}\n\t\t>${children}\n\t\t${modal && modalVisible && html`<${Modal} ...${modalOverrides} dismiss=${() => toggleModal(false)}>${modal}`}\n\t\t${elfsightPopupID && html`<${ElfsightPopup} ID=${elfsightPopupID} />`}\n\t`\n}\n\nexport const AccessBlock = ({ text = \"This is an ISF members-only access point\", style = {} }) => html`\n\t\n\t\t

${text}\n\t\t

Click anywhere outside this popup to close\n\t\n`\n\nexport const Links = ({ links, roomName }) => html`\n\t${links.map(\n\tlink => html`<${Link} ...${link} key=${link.label} roomName=${roomName} />`,\n)}\n`\n\nexport const MappedImage = ({ imageURL = \"\", imageFunction = () => \"\", links = [], imageStyle = \"\", children = null }) => {\n\t// useDateTime() refreshes every minute.\n\t// We don't actually care what the current dateTime is,\n\t// we just use this to trigger a redraw of the component\n\tuseDateTime(\"minute\")\n\n\tconst image = imageURL || imageFunction()\n\n\treturn html`\n\t\t

\n\t\t\t<${Background} imgURL=${image} style=${imageStyle} />\n\t\t\t<${Links} links=${links} />\n\t\t\t${children}\n\t\t
\n\t`\n}\n\nexport const VimeoFrame = ({ vidId, wrapperStyle = {} }) => html`\n
\n \n`\n\nexport const AllSponsorModal = ({ URL }) => html`\n\t\n`\n\nexport const Clue = ({ letter }) => html`\n

Congratulations, you found the letter ${letter}

\n`\n\nconst getDisplayTime = date => `${date.getHours() < 10 ? \"0\" : \"\"}${date.getHours()}:${date.getMinutes() < 10 ? \"0\" : \"\"}${date.getMinutes()}`\n\nexport const Clock = () => {\n\tconst now = useDateTime()\n\treturn

\n\t\t{getDisplayTime(now)}\n\t

\n}\n\nexport const BreakoutClock = () => {\n\tconst now = useDateTime()\n\treturn

\n\t\t{getDisplayTime(now)}\n\t

\n}\n\n\nexport const App = ({\n\tlinks,\n\tpageBackgroundURL,\n\troomName,\n\tstyles = \"\",\n\tbefore = null,\n\textras = null,\n\tonClick = () => null,\n}) => html`\n\t
${before}\n\t
\n\t\t<${Background} imgURL=${pageBackgroundURL} />\n\t\t<${Links} links=${links} roomName=${roomName} />\n\t\t${extras}\n\t\n`\n", "import { useEffect } from \"preact/hooks\";\nimport { get } from \"../../utils/http\";\n\nexport const CometChat = () => {\n\tconst regID = window.dataLayer[0][\"Registrant ID\"]\n\tconst fullName = window.dataLayer[0][\"First & Last Name\"]\n\tvar company = window.dataLayer[0]['Company (Subsidiary)'];\n\tvar userName = `${fullName} - ${company}`\n\tconst picture = window.dataLayer[0]['Please make it more personal by uploading a head and shoulders photo:'] || \"https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/Linecons_user-avatar.svg/600px-Linecons_user-avatar.svg.png\"\n\tconst regUid = regID.toString()\n\n\tuseEffect(() => {\n\t\twindow.openDM = chatGuid => {\n\t\t\twindow.CometChatWidget.openOrCloseChat(true)\n\t\t\twindow.CometChatWidget.chatWithUser(chatGuid);\n\t\t}\n\t})\n\n\tconst loadStage4 = () => {\n\t\twindow.CometChatWidget.launch({\n\t\t\talignment: \"right\",\n\t\t\tdocked: \"true\",\n\t\t\theight: \"550px\",\n\t\t\t// left or right\n\t\t\troundedCorners: \"true\",\n\t\t\twidgetID: \"6cfac693-5632-4cde-8475-93cc3736ebb1\",\n\t\t\twidth: \"400px\",\n\t\t})\n\t\tif (window.dataLayer[0][\"Registrant Type\"] === \"Non-Member\") {\n\t\t\tget(`https://isf2021.swoogo-retrofit.tkevents.io/chat/addToNonMemberChats`, { id: regUid })\n\t\t} else {\n\t\t\tget(`https://isf2021.swoogo-retrofit.tkevents.io/chat/addToMemberChats`, { id: regUid })\n\t\t}\n\t}\n\n\tconst loadStage3 = () => {\n\t\t// You can now call login function.\n\t\twindow.CometChatWidget.login({\n\t\t\tuid: regUid,\n\t\t}).then(loadStage4)\n\t}\n\n\tconst loadStage2 = () => {\n\t\twindow.CometChatWidget.createOrUpdateUser({\n\t\t\tavatar: picture,\n\t\t\tname: userName,\n\t\t\tuid: regUid,\n\t\t}).then(loadStage3)\n\t}\n\n\tconst loadStage1 = () => {\n\t\twindow.CometChatWidget.init(\n\t\t\twindow.dataLayer[0][\"Registrant Type\"] === \"Non-Member\"\n\t\t\t\t? {\n\t\t\t\t\twidgetID: \"edc922f5-80ef-4192-8bbc-4dd4d3ec9816\",\n\t\t\t\t\tappID: \"1947156a6654742b\",\n\t\t\t\t\tappRegion: \"eu\",\n\t\t\t\t\tauthKey: \"ce7eeed2c96c82fe1debbac88327e04246ba58e1\",\n\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\twidgetID: \"6cfac693-5632-4cde-8475-93cc3736ebb1\",\n\t\t\t\t\tappID: \"1947156a6654742b\",\n\t\t\t\t\tappRegion: \"eu\",\n\t\t\t\t\tauthKey: \"ce7eeed2c96c82fe1debbac88327e04246ba58e1\",\n\t\t\t\t}\n\t\t).then(loadStage2)\n\t}\n\n\tconst bootChatIfReady = () => {\n\t\tif (window.CometChatWidget === undefined) {\n\t\t\tsetTimeout(bootChatIfReady, 250)\n\t\t} else { loadStage1() }\n\t}\n\n\tbootChatIfReady()\n\n\treturn

should have a
should have a