unpoly-rails 3.14.2 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +317 -0
  3. data/README.md +61 -40
  4. data/assets/unpoly/unpoly-bootstrap3.css.map +1 -0
  5. data/assets/unpoly/unpoly-bootstrap3.js.map +1 -0
  6. data/assets/unpoly/unpoly-bootstrap3.min.css.map +1 -0
  7. data/assets/unpoly/unpoly-bootstrap3.min.js.map +1 -0
  8. data/assets/unpoly/unpoly-bootstrap4.css.map +1 -0
  9. data/assets/unpoly/unpoly-bootstrap4.js.map +1 -0
  10. data/assets/unpoly/unpoly-bootstrap4.min.css.map +1 -0
  11. data/assets/unpoly/unpoly-bootstrap4.min.js.map +1 -0
  12. data/assets/unpoly/unpoly-bootstrap5.css.map +1 -0
  13. data/assets/unpoly/unpoly-bootstrap5.js.map +1 -0
  14. data/assets/unpoly/unpoly-bootstrap5.min.css.map +1 -0
  15. data/assets/unpoly/unpoly-bootstrap5.min.js.map +1 -0
  16. data/assets/unpoly/unpoly-migrate.js +228 -149
  17. data/assets/unpoly/unpoly-migrate.js.map +1 -0
  18. data/assets/unpoly/unpoly-migrate.min.js +1 -1
  19. data/assets/unpoly/unpoly-migrate.min.js.map +1 -0
  20. data/assets/unpoly/unpoly.css.map +1 -0
  21. data/assets/unpoly/unpoly.es6.js +666 -430
  22. data/assets/unpoly/unpoly.es6.js.map +1 -0
  23. data/assets/unpoly/unpoly.es6.min.js +1 -1
  24. data/assets/unpoly/unpoly.es6.min.js.map +1 -0
  25. data/assets/unpoly/unpoly.js +2167 -1990
  26. data/assets/unpoly/unpoly.js.map +1 -0
  27. data/assets/unpoly/unpoly.min.css.map +1 -0
  28. data/assets/unpoly/unpoly.min.js +1 -1
  29. data/assets/unpoly/unpoly.min.js.map +1 -0
  30. data/lib/unpoly/rails/change/cache.rb +4 -4
  31. data/lib/unpoly/rails/change/layer.rb +3 -0
  32. data/lib/unpoly/rails/change.rb +35 -8
  33. data/lib/unpoly/rails/controller.rb +3 -2
  34. data/lib/unpoly/rails/engine.rb +7 -0
  35. data/lib/unpoly/rails/request_echo_headers.rb +10 -3
  36. data/lib/unpoly/rails/util.rb +38 -0
  37. data/lib/unpoly/rails/version.rb +1 -1
  38. metadata +31 -8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpoly.es6.js","mappings":";;;;;;AAAA,MAAM,CAAC,EAAE,GAAG;IACV,OAAO,EAAE,YAAY;CACtB;;;;;;;ACFD,EAAE,CAAC,QAAQ,GAAG,UAAS,UAAU;IAC/B,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,IAAI,IAAI,GAAG,UAAU,CAAC,IAAI;QAC1B,IAAI,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE;QAChC,IAAI,UAAU,GAAG;YACf,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC;QACzC,CAAC;QACD,UAAU,CAAC,IAAI,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC;QACxC,OAAO,UAAU;IACnB,CAAC;SAAM,CAAC;QACN,OAAO,UAAU;IACnB,CAAC;AACH,CAAC;;;;;;;ACHD,EAAE,CAAC,IAAI,GAAG,CAAC;IAQT,SAAS,IAAI;IACb,CAAC;IAQD,SAAS,SAAS;QAChB,OAAO,OAAO,CAAC,OAAO,EAAE;IAC1B,CAAC;IAYD,SAAS,OAAO,CAAC,IAAI,EAAE,SAAS;QAC9B,IAAI,KAAK,GAAG,EAAE;QAEd,OAAO,UAAS,GAAG,IAAI;YACrB,IAAI,SAAS;gBAAE,KAAK,GAAG,CAAC,IAAI,CAAC,SAAS,MAAd,IAAI,CAAC,SAAS,IAAM,EAAE,EAAC;YAC/C,IAAI,KAAK,CAAC,KAAK;gBAAE,OAAO,KAAK,CAAC,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C,EAAgC,CAAC;AACzC,mBAAO,CAAC,EAAwC,CAAC;AACjD,mBAAO,CAAC,EAAuC,CAAC;AAChD,mBAAO,CAAC,EAA2B,CAAC;AACpC,mBAAO,CAAC,EAA+B,CAAC;AACxC,mBAAO,CAAC,EAAgC,CAAC;AACzC,mBAAO,CAAC,EAA8B,CAAC;AACvC,mBAAO,CAAC,EAA2B,CAAC;AACpC,mBAAO,CAAC,EAAyB,CAAC;AAClC,mBAAO,CAAC,EAA8B,CAAC;AAEvC,mBAAO,CAAC,EAAoB,CAAC;AAC7B,mBAAO,CAAC,EAAgB,CAAC;AACzB,mBAAO,CAAC,EAAmB,CAAC;AAC5B,mBAAO,CAAC,EAAc,CAAC;AACvB,mBAAO,CAAC,EAAiB,CAAC;AAC1B,mBAAO,CAAC,EAAkB,CAAC;AAC3B,mBAAO,CAAC,EAAmB,CAAC;AAC5B,mBAAO,CAAC,EAAmB,CAAC;AAC5B,mBAAO,CAAC,EAAiB,CAAC;AAC1B,mBAAO,CAAC,EAAkB,CAAC;AAC3B,mBAAO,CAAC,EAAgB,CAAC;AACzB,mBAAO,CAAC,GAAe,CAAC;AACxB,mBAAO,CAAC,GAAe,CAAC;AACxB,mBAAO,CAAC,GAAiB,CAAC;AAC1B,mBAAO,CAAC,GAAgB,CAAC;AACzB,mBAAO,CAAC,GAAgB,CAAC;AAEzB,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE","sources":["webpack://unpoly/./src/unpoly/namespace.js.erb","webpack://unpoly/./src/unpoly/mockable.js","webpack://unpoly/./src/unpoly/util.js","webpack://unpoly/./src/unpoly/error.js","webpack://unpoly/./src/unpoly/migrate_stub.js","webpack://unpoly/./src/unpoly/browser.js","webpack://unpoly/./src/unpoly/element.js","webpack://unpoly/./src/unpoly/errors/error.js","webpack://unpoly/./src/unpoly/errors/not_implemented.js","webpack://unpoly/./src/unpoly/errors/aborted.js","webpack://unpoly/./src/unpoly/errors/blocked.js","webpack://unpoly/./src/unpoly/errors/cannot_match.js","webpack://unpoly/./src/unpoly/errors/cannot_parse.js","webpack://unpoly/./src/unpoly/errors/cannot_target.js","webpack://unpoly/./src/unpoly/errors/offline.js","webpack://unpoly/./src/unpoly/classes/record.js","webpack://unpoly/./src/unpoly/classes/config.js","webpack://unpoly/./src/unpoly/classes/log_config.js","webpack://unpoly/./src/unpoly/classes/registry.js","webpack://unpoly/./src/unpoly/classes/options_parser.js","webpack://unpoly/./src/unpoly/classes/fifo_cache.js","webpack://unpoly/./src/unpoly/classes/rect.js","webpack://unpoly/./src/unpoly/classes/body_shifter.js","webpack://unpoly/./src/unpoly/classes/change/change.js","webpack://unpoly/./src/unpoly/classes/change/addition.js","webpack://unpoly/./src/unpoly/classes/render_job.js","webpack://unpoly/./src/unpoly/classes/change/destroy_fragment.js","webpack://unpoly/./src/unpoly/classes/change/open_layer.js","webpack://unpoly/./src/unpoly/classes/change/update_layer.js","webpack://unpoly/./src/unpoly/classes/change/update_steps.js","webpack://unpoly/./src/unpoly/classes/change/close_layer.js","webpack://unpoly/./src/unpoly/classes/change/from_url.js","webpack://unpoly/./src/unpoly/classes/change/from_response.js","webpack://unpoly/./src/unpoly/classes/change/from_content.js","webpack://unpoly/./src/unpoly/classes/csp_info.js","webpack://unpoly/./src/unpoly/classes/hello_fragment.js","webpack://unpoly/./src/unpoly/classes/destructor_pass.js","webpack://unpoly/./src/unpoly/classes/event_emitter.js","webpack://unpoly/./src/unpoly/classes/event_listener.js","webpack://unpoly/./src/unpoly/classes/event_listener_group.js","webpack://unpoly/./src/unpoly/classes/selector_tracker.js","webpack://unpoly/./src/unpoly/classes/field_watcher.js","webpack://unpoly/./src/unpoly/classes/switcher.js","webpack://unpoly/./src/unpoly/classes/form_validator.js","webpack://unpoly/./src/unpoly/classes/focus_capsule.js","webpack://unpoly/./src/unpoly/classes/fragment_processor.js","webpack://unpoly/./src/unpoly/classes/fragment_finder.js","webpack://unpoly/./src/unpoly/classes/fragment_focus.js","webpack://unpoly/./src/unpoly/classes/fragment_polling.js","webpack://unpoly/./src/unpoly/classes/fragment_scrolling.js","webpack://unpoly/./src/unpoly/classes/layer/base.js","webpack://unpoly/./src/unpoly/classes/layer/overlay.js","webpack://unpoly/./src/unpoly/classes/layer/overlay_with_tether.js","webpack://unpoly/./src/unpoly/classes/layer/overlay_with_viewport.js","webpack://unpoly/./src/unpoly/classes/layer/root.js","webpack://unpoly/./src/unpoly/classes/layer/modal.js","webpack://unpoly/./src/unpoly/classes/layer/popup.js","webpack://unpoly/./src/unpoly/classes/layer/drawer.js","webpack://unpoly/./src/unpoly/classes/layer/cover.js","webpack://unpoly/./src/unpoly/classes/layer_lookup.js","webpack://unpoly/./src/unpoly/classes/layer_stack.js","webpack://unpoly/./src/unpoly/classes/link_current_urls.js","webpack://unpoly/./src/unpoly/classes/link_follow_intent.js","webpack://unpoly/./src/unpoly/classes/motion_controller.js","webpack://unpoly/./src/unpoly/classes/nonceable_callback.js","webpack://unpoly/./src/unpoly/classes/overlay_focus.js","webpack://unpoly/./src/unpoly/classes/params.js","webpack://unpoly/./src/unpoly/classes/preview.js","webpack://unpoly/./src/unpoly/classes/progress_bar.js","webpack://unpoly/./src/unpoly/classes/render_options.js","webpack://unpoly/./src/unpoly/classes/render_result.js","webpack://unpoly/./src/unpoly/classes/request.js","webpack://unpoly/./src/unpoly/classes/request/cache.js","webpack://unpoly/./src/unpoly/classes/request/queue.js","webpack://unpoly/./src/unpoly/classes/request/form_renderer.js","webpack://unpoly/./src/unpoly/classes/request/xhr_renderer.js","webpack://unpoly/./src/unpoly/classes/response.js","webpack://unpoly/./src/unpoly/classes/response_doc.js","webpack://unpoly/./src/unpoly/classes/reveal_motion.js","webpack://unpoly/./src/unpoly/classes/script_gate.js","webpack://unpoly/./src/unpoly/classes/selector.js","webpack://unpoly/./src/unpoly/classes/tether.js","webpack://unpoly/./src/unpoly/classes/url_pattern.js","webpack://unpoly/./src/unpoly/framework.js","webpack://unpoly/./src/unpoly/event.js","webpack://unpoly/./src/unpoly/protocol.js","webpack://unpoly/./src/unpoly/log.js","webpack://unpoly/./src/unpoly/script.js","webpack://unpoly/./src/unpoly/history.js","webpack://unpoly/./src/unpoly/fragment.js","webpack://unpoly/./src/unpoly/viewport.js","webpack://unpoly/./src/unpoly/motion.js","webpack://unpoly/./src/unpoly/network.js","webpack://unpoly/./src/unpoly/layer.js","webpack://unpoly/./src/unpoly/link.js","webpack://unpoly/./src/unpoly/form.js","webpack://unpoly/./src/unpoly/status.js","webpack://unpoly/./src/unpoly/radio.js","webpack://unpoly/./src/unpoly/rails.js","webpack://unpoly/webpack/bootstrap","webpack://unpoly/./src/unpoly.js"],"sourcesContent":["window.up = {\n version: '3.15.0-rc9'\n}\n","up.mockable = function(originalFn) {\n if (window.jasmine) {\n let name = originalFn.name\n let obj = { [name]: originalFn }\n let mockableFn = function() {\n return obj[name].apply(this, arguments)\n }\n mockableFn.mock = () => spyOn(obj, name) // eslint-disable-line no-undef\n return mockableFn\n } else {\n return originalFn\n }\n}\n","/*-\nHelper functions for basic JavaScript values.\n\nMost functions are predicates like `up.util.isPresent()` or `up.util.isBlank()`, or list helpers like `up.util.uniq()`, `up.util.reject()` and `up.util.pick()`. They are similar to [Lodash](https://lodash.com/), but feature parity is not a goal. The module also parses the formats used in Unpoly's attributes: `up.util.parseRelaxedJSON()` reads [[relaxed-json]], and `up.util.normalizeURL()` and `up.util.parseURL()` work with URLs.\n\n@learn-ref relaxed-json\n\n@module up.util\n*/\nup.util = (function() {\n\n /*-\n A function that does nothing.\n\n @function up.util.noop\n @stable\n */\n function noop() {\n }\n\n /*-\n A function that returns a resolved promise.\n\n @function up.util.asyncNoop\n @internal\n */\n function asyncNoop(){\n return Promise.resolve()\n }\n\n /*-\n Ensures that the given function can only be called a single time.\n Subsequent calls will return the return value of the first call.\n\n Note that this is a simple implementation that\n doesn't distinguish between argument lists.\n\n @function up.util.memoize\n @internal\n */\n function memoize(func, cacheProp) {\n let cache = {}\n\n return function(...args) {\n if (cacheProp) cache = (this[cacheProp] ||= {})\n if (cache.value) return cache.value[0]\n if (cache.error) throw cache.error\n try {\n return (cache.value = [func.apply(this, args)])[0]\n } catch (error) {\n throw (cache.error = error)\n }\n }\n }\n\n /*-\n Returns a normalized version of the given URL string.\n\n Two URLs that point to the same resource should normalize to the same string.\n\n ### Comparing normalized URLs\n\n The main purpose of this function is to normalize two URLs for string comparison:\n\n ```js\n up.util.normalizeURL('http://current-host/path') === up.util.normalizeURL('/path') // result: true\n ```\n\n By default the hostname is only included if it points to a different origin:\n\n ```js\n up.util.normalizeURL('http://current-host/path') // result: '/path'\n up.util.normalizeURL('http://other-host/path') // result: 'http://other-host/path'\n ```\n\n Relative paths are normalized to absolute paths:\n\n ```js\n up.util.normalizeURL('index.html') // result: '/path/index.html'\n ```\n\n ### Excluding URL components\n\n You may pass options to exclude URL components from the normalized string:\n\n ```js\n up.util.normalizeURL('/foo?query=bar', { search: false }) // result: '/foo'\n up.util.normalizeURL('/bar#hash', { hash: false }) // result: '/bar'\n ```\n\n ### Limitations\n\n - Username and password are always omitted from the normalized URL.\n - Only `http` and `https` schemes are supported.\n\n @function up.util.normalizeURL\n @param {string|URL} url\n the URL to normalize\n @param {boolean} [options.host='cross-domain']\n Whether to include protocol, hostname and port in the normalized URL.\n\n When set to `'cross-domain'` (the default), the host is only included if it differs from the page's hostname.\n\n The port is omitted if the port is the standard port for the given protocol, e.g. `:443` for `https://`.\n @param {boolean} [options.hash=true]\n Whether to include an `#hash` anchor in the normalized URL.\n @param {boolean} [options.search=true]\n Whether to include a `?query` string in the normalized URL.\n @param {boolean} [options.trailingSlash=true]\n Whether to include a trailing slash from the pathname.\n @return {string}\n The normalized URL.\n @stable\n */\n function normalizeURL(url, options) {\n options = newOptions(options, { host: 'cross-domain' })\n\n const parts = parseURL(url)\n let normalized = ''\n\n if (options.host === 'cross-domain') {\n options.host = isCrossOrigin(parts)\n }\n\n if (options.host) {\n normalized += parts.protocol + \"//\" + parts.host\n }\n\n let { pathname } = parts\n\n if (options.trailingSlash === false && pathname !== '/') {\n pathname = pathname.replace(/\\/$/, '')\n }\n normalized += pathname\n\n if (options.search !== false) {\n normalized += parts.search\n }\n\n if (options.hash !== false) {\n normalized += parts.hash\n }\n\n return normalized\n }\n\n function matchURLs(leftURL, rightURL, options) {\n return matchableURL(leftURL, options) === matchableURL(rightURL, options)\n }\n\n // Normalize the URL so it is better suited for path comparison.\n // In particular it strips the hash and trailing slash.\n function matchableURL(url, options) {\n if (!url) return\n return normalizeURL(url, { hash: false, trailingSlash: false, ...options })\n }\n\n function matchableURLPatternAtom(patternAtom) {\n // Convert \"https://our-host/foo\" to \"/foo\", like matchableURL() normalizes same-origin URLs\n if (patternAtom.startsWith(APP_ORIGIN + '/')) patternAtom = patternAtom.slice(APP_ORIGIN.length)\n\n // Convert \"/foo/\" to [\"/foo/\", \"/foo\"]\n if (patternAtom.endsWith('/')) return [patternAtom, patternAtom.slice(0, -1)]\n\n // Convert \"/foo/?\" to [\"/foo/?\", \"/foo?\"]\n if (patternAtom.includes('/?')) return [patternAtom, patternAtom.replace('/?', '?')]\n\n // Convert \"/foo/*\" to [\"/foo/*\", \"/foo\", \"/foo?*\"]\n if (patternAtom.endsWith('/*')) return [patternAtom, patternAtom.slice(0, -2), patternAtom.slice(0, -2) + '?*']\n\n return patternAtom\n }\n\n // We're calling isCrossOrigin() a lot.\n // Accessing location.protocol and location.hostname every time\n // is much slower than comparing cached strings.\n // https://jsben.ch/kBATt\n const APP_PROTOCOL = location.protocol\n const APP_HOSTNAME = location.hostname\n const APP_ORIGIN = location.origin\n\n function isCrossOrigin(urlOrAnchor) {\n // If the given URL does not contain a hostname we know it cannot be cross-origin.\n // In that case we don't need to parse the URL.\n if (isString(urlOrAnchor) && (urlOrAnchor.indexOf('//') === -1)) {\n return false\n }\n\n const parts = parseURL(urlOrAnchor)\n return (APP_HOSTNAME !== parts.hostname) || (APP_PROTOCOL !== parts.protocol)\n }\n\n /*-\n Parses the given URL into components such as hostname and path.\n\n If the given URL is not fully qualified, it is assumed to be relative\n to the current page.\n\n ### Example\n\n ```js\n let parsed = up.util.parseURL('/path?foo=value')\n parsed.pathname // result: '/path'\n parsed.search // result: '?foo=value'\n parsed.hash // result: ''\n ```\n\n @function up.util.parseURL\n @param {string|URL} the URL to parse\n @return {Object}\n The parsed URL as an object with\n `{ protocol, hostname, port, pathname, search, hash }` properties.\n @stable\n */\n function parseURL(url) {\n if (url.pathname) {\n return url\n }\n\n // We would prefer to use `new URL(url, location.href)` here, but that is 30% slower\n // than creating a link (see benchmark at https://jsbench.me/l7l2x9cruf/1).\n // We're parsing a *lot* of URLs for .up-active, so this matters.\n let link = document.createElement('a')\n link.href = url\n return link\n }\n\n /*-\n @function up.util.normalizeMethod\n @internal\n */\n function normalizeMethod(method) {\n return method ? method.toUpperCase() : 'GET'\n }\n\n /*-\n @function up.util.methodAllowsPayload\n @internal\n */\n function methodAllowsPayload(method) {\n return (method !== 'GET') && (method !== 'HEAD')\n }\n\n function iteratee(block) {\n if (isString(block)) {\n return (item) => item[block]\n } else {\n return block\n }\n }\n\n /*-\n Maps all items in a [list](/api/List) to a new array of items.\n\n ## Example\n\n The given mapping function will be called for each element in the list:\n\n ```js\n up.util.map(['apple', 'cherry'], (str) => str.length) // result: [5, 6]\n ```\n\n You can also pass a property name as a string,\n which will be collected from each item in the list:\n\n ```js\n up.util.map(['apple', 'cherry'], 'length') // result: [5, 6]\n ```\n\n @function up.util.map\n @param {List|Iterator} list\n @param {Function(element, index): any|string} block\n A function that will be called with each element and (optional) iteration index.\n\n You can also pass a property name as a string,\n which will be collected from each item in the list.\n @return {Array}\n A new array containing the result of each function call.\n @stable\n */\n function map(list, block) {\n if (list.length === 0) { return [] }\n block = iteratee(block)\n let mapped = []\n let i = 0\n for (let item of list) {\n mapped.push(block(item, i++))\n }\n return mapped\n }\n\n /*-\n Creates an object from the given array and mapping function.\n\n ## Example\n\n The mapping function is called with each array element. It must return a tuple of the object key and value:\n\n ```js\n up.util.mapObject(['alice', 'bob'], function(element) {\n return [element.toUpperCase(), element.length]\n })\n // result: { ALICE: 5, BOB: 3 }\n ```\n\n @param {Array} array\n The array from which to create an object.\n\n Each array element will become a property of the created object.\n\n @param {Function(element): Pair<string, any>} mapping\n A function that is called with each array element.\n\n It must return a tuple of the object key and value.\n\n @function up.util.mapObject\n @stable\n */\n function mapObject(array, pairer) {\n return Object.fromEntries(array.map(pairer))\n }\n\n /*-\n Calls the given function for each element (and optional index)\n of the given [list](/api/List) or iterator.\n\n @function up.util.each\n @param {List|Iterator} list\n @param {Function(element, index)} block\n A function that will be called with each element and (optional) iteration index.\n @stable\n */\n function each(array, block) {\n // note that the native Array.forEach is very slow (https://jsperf.com/fast-array-foreach)\n let i = 0\n for (let item of array) {\n block(item, i++)\n }\n }\n\n /*-\n Returns whether the given argument is `null`.\n\n @function up.util.isNull\n @param {any} object\n @return {boolean}\n @stable\n */\n function isNull(value) {\n return value === null\n }\n\n function isTruthy(value) {\n return !!value\n }\n\n /*-\n Returns whether the given argument is `undefined`.\n\n @function up.util.isUndefined\n @param {any} value\n @return {boolean}\n @stable\n */\n function isUndefined(value) {\n return value === undefined\n }\n\n\n /*-\n Returns whether the given argument is not `undefined`.\n\n @function up.util.isDefined\n @param {any} value\n @return {boolean}\n @stable\n */\n const isDefined = negate(isUndefined)\n\n /*-\n Returns whether the given argument is either `undefined` or `null`.\n\n Note that empty strings or zero are *not* considered to be \"missing\".\n\n For the opposite of `up.util.isMissing()` see [`up.util.isGiven()`](/api/up.util.isGiven).\n\n @function up.util.isMissing\n @param {any} value\n @return {boolean}\n @stable\n */\n function isMissing(value) {\n return isUndefined(value) || isNull(value)\n }\n\n /*-\n Returns whether the given argument is neither `undefined` nor `null`.\n\n For the opposite of `up.util.isGiven()` see [`up.util.isMissing()`](/api/up.util.isMissing).\n\n > [IMPORTANT]\n > Unpoly's concept of \"given\" does not correspond to JavaScript's concept of [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy).\n > Empty strings or the number zero are not truthy, but *are* considered to be \"given\".\n\n @function up.util.isGiven\n @param {any} value\n @return {boolean}\n @stable\n */\n const isGiven = negate(isMissing)\n\n // isNan = (object) ->\n // isNumber(value) && value != +value\n\n /*-\n Returns whether the given argument is considered to be blank.\n\n By default, this function returns `true` for:\n\n - `undefined`\n - `null`\n - Empty strings\n - Empty arrays\n - A plain object without own enumerable properties\n\n All other arguments return `false`.\n\n To implement blank-ness checks for user-defined classes,\n see `up.util.isBlank.key`.\n\n @function up.util.isBlank\n @param {any} value\n The value to check.\n @return {boolean}\n Whether the value is blank.\n @stable\n */\n function isBlank(value) {\n if (isMissing(value)) {\n return true\n }\n if (isObject(value) && value[isBlank.key]) {\n return value[isBlank.key]()\n }\n if (isString(value) || isList(value)) {\n return value.length === 0\n }\n if (isOptions(value)) {\n return Object.keys(value).length === 0\n }\n return false\n }\n\n /*-\n This property contains the name of a method that user-defined classes\n may implement to hook into the `up.util.isBlank()` protocol.\n\n ### Example\n\n We have a user-defined `Account` class that we want to use with `up.util.isBlank()`:\n\n ```js\n class Account {\n constructor(email) {\n this.email = email\n }\n\n [up.util.isBlank.key]() {\n return up.util.isBlank(this.email)\n }\n }\n ```\n\n > [NOTE]\n > The protocol method is not actually named `'up.util.isBlank.key'`.\n > Instead it is named after the *value* of the `up.util.isBlank.key` property.\n > To do so, the code sample above is using a\n > [computed property name](https://medium.com/front-end-weekly/javascript-object-creation-356e504173a8)\n > in square brackets.\n\n We may now use `Account` instances with `up.util.isBlank()`:\n\n ```js\n let foo = new Account('foo@foo.com')\n let bar = new Account('')\n\n console.log(up.util.isBlank(foo)) // prints false\n console.log(up.util.isBlank(bar)) // prints true\n ```\n\n @property up.util.isBlank.key\n @stable\n */\n isBlank.key = 'up.util.isBlank'\n\n /*-\n Returns the given argument if the argument is [present](/api/up.util.isPresent),\n otherwise returns `undefined`.\n\n @function up.util.presence\n @param {any} value\n @param {Function(value): boolean} [tester=up.util.isPresent]\n The function that will be used to test whether the argument is present.\n @return {any|undefined}\n @stable\n */\n function presence(value, tester = isPresent) {\n if (tester(value)) {\n return value\n }\n }\n\n /*-\n Returns whether the given argument is not [blank](/api/up.util.isBlank).\n\n @function up.util.isPresent\n @param {any} value\n @return {boolean}\n @stable\n @signature\n */\n const isPresent = negate(isBlank)\n\n /*-\n Returns whether the given argument is a function.\n\n @function up.util.isFunction\n @param {any} value\n @return {boolean}\n @stable\n */\n function isFunction(value) {\n return typeof(value) === 'function'\n }\n\n /*-\n Returns whether the given argument is a string.\n\n @function up.util.isString\n @param {any} value\n @return {boolean}\n @stable\n */\n function isString(value) {\n return (typeof(value) === 'string') || value instanceof String\n }\n\n /*-\n Returns whether the given argument is a boolean value.\n\n @function up.util.isBoolean\n @param {any} value\n @return {boolean}\n @stable\n */\n function isBoolean(value) {\n return (typeof(value) === 'boolean') || value instanceof Boolean\n }\n\n /*-\n Returns whether the given argument is a number.\n\n Note that this will check the argument's *type*.\n It will return `false` for a string like `\"123\"`.\n\n @function up.util.isNumber\n @param {any} value\n @return {boolean}\n @stable\n */\n function isNumber(value) {\n return (typeof(value) === 'number') || value instanceof Number\n }\n\n /*-\n Returns whether the given argument is an options hash.\n\n Unlike [`up.util.isObject()`], this returns false for\n functions, jQuery collections, promises, `FormData` instances and arrays.\n\n @function up.util.isOptions\n @param {any} value\n @return {boolean}\n @internal\n */\n function isOptions(value) {\n return (typeof(value) === 'object') && !isNull(value) && (isUndefined(value.constructor) || (value.constructor === Object))\n }\n\n /*-\n Returns whether the given argument is an object.\n\n This also returns `true` for functions, which may behave like objects in JavaScript.\n\n @function up.util.isObject\n @param {any} value\n @return {boolean}\n @stable\n */\n function isObject(value) {\n const typeOfResult = typeof(value)\n return ((typeOfResult === 'object') && !isNull(value)) || (typeOfResult === 'function')\n }\n\n /*-\n Returns whether the given argument is a [DOM element](https://developer.mozilla.org/en-US/docs/Web/API/Element).\n\n @function up.util.isElement\n @param {any} value\n @return {boolean}\n @stable\n */\n function isElement(value) {\n return value instanceof Element\n }\n\n /*-\n Returns whether the given argument is a [text node](https://developer.mozilla.org/en-US/docs/Web/API/Text).\n\n @function up.util.isTextNode\n @param {any} value\n @return {boolean}\n @internal\n */\n function isTextNode(value) {\n return value instanceof Text\n }\n\n /*-\n Returns whether the given argument is a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp).\n\n @function up.util.isRegExp\n @param {any} value\n @return {boolean}\n @internal\n */\n function isRegExp(value) {\n return value instanceof RegExp\n }\n\n /*-\n Returns whether the given argument is an error instance.\n\n @function up.util.isError\n @param {any} object\n @return {boolean}\n @internal\n */\n function isError(value) {\n return value instanceof Error\n }\n\n /*-\n Returns whether the given argument is a [jQuery collection](https://learn.jquery.com/using-jquery-core/jquery-object/).\n\n @function up.util.isJQuery\n @param {any} value\n @return {boolean}\n @stable\n */\n function isJQuery(value) {\n return up.browser.canJQuery() && value instanceof jQuery\n }\n\n /*-\n @function up.util.isElementLike\n @param {any} value\n @return {boolean}\n @internal\n */\n function isElementLike(value) {\n return !!(value && (value.addEventListener || (isJQuery(value) && value[0]?.addEventListener)))\n }\n\n /*-\n Returns whether the given argument is an object with a `then` method.\n\n @function up.util.isPromise\n @param {any} value\n @return {boolean}\n @stable\n */\n function isPromise(value) {\n return isObject(value) && isFunction(value.then)\n }\n\n /*-\n Returns whether the given argument is an array.\n\n @function up.util.isArray\n @param {any} value\n @return {boolean}\n @stable\n */\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray\n const { isArray } = Array\n\n /*-\n Returns whether the given argument is a `FormData` instance.\n\n Always returns `false` in browsers that don't support `FormData`.\n\n @function up.util.isFormData\n @param {any} value\n @return {boolean}\n @internal\n */\n function isFormData(value) {\n return value instanceof FormData\n }\n\n /*-\n Converts the given [array-like value](/api/List) into an array.\n\n If the given value is already an array, it is returned unchanged.\n\n @function up.util.toArray\n @param {any} value\n @return {Array}\n @stable\n */\n function toArray(value) {\n return isArray(value) ? value : copyArrayLike(value)\n }\n\n /*-\n Returns whether the given argument is an [array-like value](/api/List).\n\n To test whether a value is an actual `Array`, use [`up.util.isArray()`](/api/up.util.isArray).\n\n @function up.util.isList\n @param {any} value\n @return {boolean}\n @stable\n */\n function isList(value) {\n return isArray(value) ||\n isNodeList(value) ||\n isArguments(value) ||\n isJQuery(value) ||\n isHTMLCollection(value)\n }\n\n /*-\n Returns whether the given value is a [`NodeList`](https://developer.mozilla.org/en-US/docs/Web/API/NodeList).\n\n `NodeLists` are array-like objects returned by [`document.querySelectorAll()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll).\n\n @function up.util.isNodeList\n @param {any} value\n @return {boolean}\n @internal\n */\n function isNodeList(value) {\n return value instanceof NodeList\n }\n\n function isHTMLCollection(value) {\n return value instanceof HTMLCollection\n }\n\n /*-\n Returns whether the given value is an [arguments object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments).\n\n @function up.util.isArguments\n @param {any} value\n @return {boolean}\n @internal\n */\n function isArguments(value) {\n return Object.prototype.toString.call(value) === '[object Arguments]'\n }\n\n function isAdjacentPosition(value) {\n return /^(before|after)/.test(value)\n }\n\n /*-\n Returns the given value if it is [array-like](/api/List), otherwise\n returns an array with the given value as its only element.\n\n Returns an empty array if called with `null` or `undefined`.\n\n ### Example\n\n ```js\n up.util.wrapList([1, 2, 3]) // result: [1, 2, 3]\n up.util.wrapList('foo') // result: ['foo']\n up.util.wrapList(undefined) // result: []\n up.util.wrapList(null) // result: []\n ```\n\n @function up.util.wrapList\n @param {any} value\n @return {Array|NodeList|jQuery}\n @stable\n */\n function wrapList(value) {\n if (isList(value)) {\n return value\n } else if (isMissing(value)) {\n return []\n } else {\n return [value]\n }\n }\n\n /*-\n Returns a shallow copy of the given value.\n\n ### Copying protocol\n\n - By default `up.util.copy()` can copy [array-like values](/api/List),\n plain objects and `Date` instances.\n - Array-like objects are copied into new arrays.\n - Unsupported types of values are returned unchanged.\n - To make the copying protocol work with user-defined class,\n see `up.util.copy.key`.\n - Immutable objects, like strings or numbers, do not need to be copied.\n\n @function up.util.copy\n @param {any} object\n @return {any}\n @stable\n */\n function copy(value) {\n if (isObject(value) && value[copy.key]) {\n value = value[copy.key]()\n } else if (isList(value)) {\n value = copyArrayLike(value)\n } else if (isOptions(value)) {\n value = Object.assign({}, value)\n }\n return value\n }\n\n function copyArrayLike(arrayLike) {\n return Array.prototype.slice.call(arrayLike)\n }\n\n /*-\n This property contains the name of a method that user-defined classes\n may implement to hook into the `up.util.copy()` protocol.\n\n ### Example\n\n We have a user-defined `Account` class that we want to use with `up.util.copy()`:\n\n ```js\n class Account {\n constructor(email) {\n this.email = email\n }\n\n [up.util.copy.key]() {\n return new Account(this.email)\n }\n }\n ```\n\n > [NOTE]\n > The protocol method is not actually named `'up.util.copy.key'`.\n > Instead it is named after the *value* of the `up.util.copy.key` property.\n > To do so, the code sample above is using a\n > [computed property name](https://medium.com/front-end-weekly/javascript-object-creation-356e504173a8)\n > in square brackets.\n\n We may now use `Account` instances with `up.util.copy()`:\n\n ```js\n original = new Account('foo@foo.com')\n\n copy = up.util.copy(original)\n console.log(copy.email) // prints 'foo@foo.com'\n\n original.email = 'bar@bar.com' // change the original\n console.log(copy.email) // still prints 'foo@foo.com'\n ```\n\n @property up.util.copy.key\n @param {string} key\n @stable\n */\n copy.key = 'up.util.copy'\n\n // Implement up.util.copy protocol for Date\n Date.prototype[copy.key] = function() { return new Date(+this) }\n\n /*-\n Creates a new object by merging together the properties from the given objects.\n\n Source values that are `null` or `undefined` are ignored.\n\n ### Example\n\n ```js\n let a = { a: '1', b: '2' }\n let b = { b: '3', c: '4' }\n up.util.merge(a, b) // result: { a: '1', b: '3', c: '4' }\n ```\n\n @function up.util.merge\n @param {Array<Object|null|undefined>} ...sources\n The objects to merge.\n\n Sources that are `null` or `undefined` are ignored.\n\n @return {Object}\n A new object with all merged properties.\n @stable\n */\n function merge(...sources) {\n return Object.assign({}, ...sources)\n }\n\n /*-\n @function up.util.mergeDefined\n @param {Array<Object>} ...sources\n @return {Object}\n @internal\n */\n function mergeDefined(...sources) {\n const result = {}\n for (let source of sources) {\n if (source) {\n for (let key in source) {\n const value = source[key]\n if (isDefined(value)) {\n result[key] = value\n }\n }\n }\n }\n return result\n }\n\n /*-\n Creates an options hash from the given argument and some defaults.\n\n The semantics of this function are confusing.\n We want to get rid of this in the future.\n\n @function up.util.options\n @param {Object} object\n @param {Object} [defaults]\n @return {Object}\n @internal\n */\n function newOptions(object, defaults) {\n if (defaults) {\n return merge(defaults, object)\n } else if (object) {\n return copy(object)\n } else {\n return {}\n }\n }\n\n function parseArgIntoOptions(args, argKey) {\n let [positionalArg, options] = parseArgs(args, 'val', 'options')\n if (isDefined(positionalArg)) {\n options[argKey] = positionalArg\n }\n return options\n }\n\n /*-\n Passes each element in the given [array-like value](/api/List) to the given function.\n Returns the first element for which the function returns a truthy value.\n\n If no element matches, returns `undefined`.\n\n @function up.util.find\n @param {List<T>} list\n @param {Function(value): boolean} tester\n @return {T|undefined}\n @stable\n */\n function findInList(list, tester) {\n tester = iteratee(tester)\n let match\n for (let element of list) {\n if (tester(element)) {\n match = element\n break\n }\n }\n return match\n }\n\n /*-\n Returns whether the given function returns a truthy value\n for any element in the given [array-like value](/api/List).\n\n @function up.util.some\n @param {List} list\n @param {Function(value, index): boolean} tester\n A function that will be called with each element and (optional) iteration index.\n\n @return {boolean}\n @stable\n */\n function some(list, tester) {\n return !!findResult(list, tester)\n }\n\n /*-\n Consecutively calls the given function with each element\n in the given list. Returns the first truthy return value.\n\n Returns `undefined` if the function does not return a truthy\n value for any element in the list.\n\n @function up.util.findResult\n @param {List|Iterator} list\n @param {Function(element): any} tester\n A function that will be called with each element and (optional) iteration index.\n\n @return {any|undefined}\n @stable\n */\n function findResult(list, tester) {\n tester = iteratee(tester)\n let i = 0\n for (let item of list) {\n const result = tester(item, i++)\n if (result) {\n return result\n }\n }\n }\n\n /*-\n Returns whether the given function returns a truthy value\n for all elements in the given [list](/api/List) or iterator.\n\n @function up.util.every\n @param {List|Iterator} list\n @param {Function(element, index): boolean} tester\n A function that will be called with each element and (optional) iteration index.\n\n @return {boolean}\n @stable\n */\n function every(list, tester) {\n tester = iteratee(tester)\n let match = true\n let i = 0\n for (let item of list) {\n if (!tester(item, i++)) {\n match = false\n break\n }\n }\n return match\n }\n\n /*-\n Returns all elements from the given [list](/api/List) that are\n neither `null` nor `undefined`.\n\n @function up.util.compact\n @param {List<T>} list\n @return {Array<T>}\n @stable\n */\n function compact(array) {\n return filterList(array, isGiven)\n }\n\n function compactObject(object) {\n return pickBy(object, isGiven)\n }\n\n /*-\n Returns the given array without duplicates.\n\n @function up.util.uniq\n @param {Array<T>} array\n @return {Array<T>}\n @stable\n @signature\n */\n function uniq(array) {\n if (array.length < 2) { return array }\n return Array.from(new Set(array))\n }\n\n /*-\n This function is like [`uniq`](/api/up.util.uniq), except that\n the given function is invoked for each element to generate the value\n for which uniqueness is computed.\n\n @function up.util.uniqBy\n @param {Array} array\n @param {Function(value): any} array\n @return {Array}\n @experimental\n */\n function uniqBy(array, mapper) {\n if (array.length < 2) { return array }\n mapper = iteratee(mapper)\n const seenElements = new Set()\n return filterList(array, function(elem, index) {\n const mapped = mapper(elem, index)\n if (seenElements.has(mapped)) {\n return false\n } else {\n seenElements.add(mapped)\n return true\n }\n })\n }\n\n /*-\n Returns all elements from the given [list](/api/List) that return\n a truthy value when passed to the given function.\n\n @function up.util.filter\n @param {List|Iterator} list\n @param {Function(value, index): boolean} tester\n @return {Array}\n @stable\n */\n function filterList(list, tester) {\n tester = iteratee(tester)\n const matches = []\n each(list, function(element, index) {\n if (tester(element, index)) {\n return matches.push(element)\n }\n })\n return matches\n }\n\n /*-\n Returns all elements from the given [array-like value](/api/List) that do not return\n a truthy value when passed to the given function.\n\n @function up.util.reject\n @param {List} list\n @param {Function(element, index): boolean} tester\n @return {Array}\n @stable\n @signature\n */\n function reject(list, tester) {\n tester = negate(iteratee(tester))\n return filterList(list, tester)\n }\n\n /*-\n Returns the intersection of the given two arrays.\n\n Implementation is not optimized. Don't use it for large arrays.\n\n @function up.util.intersect\n @internal\n */\n function intersect(array1, array2) {\n return filterList(array1, (element) => contains(array2, element))\n }\n\n /*-\n Waits for the given number of milliseconds, then runs the given callback.\n\n This function works like the built-in [`setTimeout()`](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout), except that the argument order is flipped for\n ergonomic reasons.\n\n Instead of `up.util.timer(0, fn)` you can also use [`up.util.task(fn)`](/api/up.util.task).\n\n ### Example\n\n ```js\n up.util.timer(3000, function() {\n console.log(\"Look, it's 3 seconds later!\")\n })\n ```\n\n @function up.util.timer\n @param {number} millis\n The time interval to wait in milliseconds.\n @param {Function()} callback\n The function to call after waiting.\n @return {number}\n The ID of the scheduled timeout.\n\n To unschedule the task, pass this ID to [`clearTimeout()`](https://developer.mozilla.org/en-US/docs/Web/API/clearTimeout).\n @stable\n */\n function scheduleTimer(millis, callback) {\n return setTimeout(callback, millis)\n }\n\n /*-\n Schedules a function to the [JavaScript task queue](https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/) (also \"macrotask queue\").\n\n ## Example\n\n Pass a function argument to schedule it for the next macrotask:\n\n ```js\n up.util.task(() => console.log('Hello from next task!'))\n console.log('Hello from current task!')\n ```\n\n @function up.util.task\n @param {Function()} callback\n The function to schedule.\n @stable\n */\n function queueTask(task) {\n setTimeout(task)\n }\n\n /*-\n Schedules a macrotask.\n\n Unlike `up.util.task()`, this function uses `postMessage()` instead of `setTimeout()`.\n This has pros and cons:\n\n - This *tends* to cause the task to run before `setTimeout()`, sometimes even before the browser paints the screen.\n - Safari does not honor the order of `postMessage()` calls on multiple `MessageChannels`, making\n it hard to reason about the order of tasks.\n - Safari sometimes executes a `postMessage()` task before a `setTimeout()` task.\n\n @function up.util.fastTask\n @internal\n */\n function queueFastTask(task) {\n const channel = new MessageChannel()\n channel.port1.onmessage = () => task()\n channel.port2.postMessage(0)\n }\n\n /*-\n Returns the last element of the given array or string.\n\n @function up.util.last\n @param {Array<T>|string} array\n @return {T|string}\n @stable\n */\n function last(value) {\n return value[value.length - 1]\n }\n\n /*-\n Returns whether the given value contains another value.\n\n If `value` is a string, this returns whether `subValue` is a sub-string of `value`.\n\n If `value` is an array, this returns whether `subValue` is an element of `value`.\n\n @function up.util.contains\n @param {Array|NodeList|string} value\n @param {any} subValue\n @return {boolean} Whether the value is contained.\n @stable\n */\n function contains(value, subValue) {\n let indexOf = value.indexOf || Array.prototype.indexOf\n return indexOf.call(value, subValue) >= 0\n }\n\n /*-\n Returns whether the first list contains all elements of the second list.\n\n Element order is ignored for this check.\n\n @function up.util.containsAll\n @param {Array|NodeList|string} values\n @param {Array|NodeList|string} subValues\n @return {boolean} Whether all values are contained.\n @internal\n */\n function containsAll(values, subValues) {\n return every(subValues, (subValue) => contains(values, subValue))\n }\n\n\n /*-\n Returns whether `object`'s entries are a superset\n of `subObject`'s entries.\n\n @function up.util.objectContains\n @param {Object} object\n @param {Object} subObject\n @internal\n */\n function objectContains(object, subObject) {\n const reducedValue = pick(object, Object.keys(subObject))\n return isEqual(subObject, reducedValue)\n }\n\n /*-\n Returns a copy of the given object that only contains\n the given keys.\n\n ## Example\n\n ```js\n let object = { foo: 1, bar: 2, baz: 3 }\n up.util.pick(object, ['foo', 'baz']) // result: { foo:1, baz: 3 }\n ```\n\n @function up.util.pick\n @param {Object} object\n @param {Array} keys\n @return {Object}\n @stable\n @signature\n */\n function pick(object, keys) {\n const filtered = {}\n for (let key of keys) {\n if (key in object) {\n filtered[key] = object[key]\n }\n }\n return filtered\n }\n\n /*-\n Returns a copy of the given object that only contains\n properties that pass the given tester function.\n\n @function up.util.pickBy\n @param {Object} object\n @param {Function(value, key): boolean} tester\n A function that will be called with each property.\n\n The arguments are the property value and key.\n @return {Object}\n @experimental\n */\n function pickBy(object, tester) {\n tester = iteratee(tester)\n const filtered = {}\n for (let key in object) {\n const value = object[key]\n if (tester(value, key)) {\n filtered[key] = object[key]\n }\n }\n return filtered\n }\n\n /*-\n Returns a copy of the given object that contains all except\n the given keys.\n\n ## Example\n\n ```js\n let object = { foo: 1, bar: 2, baz: 3 }\n up.util.omit(object, ['foo', 'baz']) // result: { bar: 2 }\n ```\n\n @function up.util.omit\n @param {Object} object\n @param {Array} keys\n @stable\n */\n function omit(object, keys) {\n return pickBy(object, (_value, key) => !contains(keys, key))\n }\n\n /*-\n Returns a promise that will never be resolved.\n\n @function up.util.unresolvablePromise\n @internal\n */\n function unresolvablePromise() {\n return new Promise(noop)\n }\n\n /*-\n Removes the given element from the given array.\n\n This changes the given array.\n\n @function up.util.remove\n @param {Array<T>} array\n The array to change.\n @param {T} element\n The element to remove.\n @return {T|undefined}\n The removed element, or `undefined` if the array didn't contain the element.\n @stable\n */\n function remove(array, element) {\n const index = array.indexOf(element)\n if (index >= 0) {\n array.splice(index, 1)\n return element\n }\n }\n\n /*-\n If the given `value` is a function, calls the function with the given `args`.\n Otherwise it just returns `value`.\n\n ### Example\n\n ```js\n up.util.evalOption(5) // => 5\n\n let fn = () => 1 + 2\n up.util.evalOption(fn) // result: 3\n ```\n\n @function up.util.evalOption\n @param {any} value\n @param {Array} ...args\n @return {any}\n @stable\n */\n function evalOption(value, ...args) {\n return isFunction(value) ? value(...args) : value\n }\n\n function evalAutoOption(value, autoMeans, ...args) {\n value = evalOption(value, ...args)\n // Allow functions to return 'auto'\n if (value === 'auto') {\n value = evalOption(autoMeans, ...args)\n }\n return value\n }\n\n const ESCAPE_HTML_ENTITY_MAP = {\n \"&\": \"&amp;\",\n \"<\": \"&lt;\",\n \">\": \"&gt;\",\n '\"': '&quot;',\n \"'\": '&#x27;'\n }\n\n /*-\n Escapes the given string of HTML by replacing control chars with their HTML entities.\n\n @function up.util.escapeHTML\n @param {string} string\n The text that should be escaped.\n @stable\n */\n function escapeHTML(string) {\n return string.replace(/[&<>\"']/g, (char) => ESCAPE_HTML_ENTITY_MAP[char])\n }\n\n /*-\n @function up.util.escapeRegExp\n @internal\n */\n function escapeRegExp(string) {\n // From https://github.com/benjamingr/RegExp.escape\n return string.replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n }\n\n // function groupBy(list, block) {\n // block = iteratee(block)\n // let groups = {}\n // for (let entry in list) {\n // let key = block(entry)\n // let group = (groups[key] ||= [])\n // group.push(entry)\n // }\n // return groups\n // }\n\n /*-\n Deletes the property with the given key from the given object\n and returns its value.\n\n @function up.util.pluckKey\n @param {Object} object\n The object from which to pluck a property.\n @param {string} key\n The name of the property to pluck.\n @return {any}\n The value of the property before it was deleted.\n\n If the object didn't have the property, returns `undefined`.\n @stable\n */\n function pluckKey(object, key) {\n const value = object[key]\n delete object[key]\n return value\n }\n\n function renameKey(object, oldKey, newKey) {\n if (oldKey in object) {\n object[newKey] = pluckKey(object, oldKey)\n }\n }\n\n function extractLastArg(args, tester) {\n if (tester(last(args))) {\n return args.pop()\n }\n }\n\n// extractFirstArg = (args, tester) ->\n// firstArg = args[0]\n// if tester(firstArg)\n// return args.shift()\n\n function extractCallback(args) {\n return extractLastArg(args, isFunction)\n }\n\n function extractOptions(args) {\n return extractLastArg(args, isOptions) || {}\n }\n\n// partial = (fn, fixedArgs...) ->\n// return (callArgs...) ->\n// fn.apply(this, fixedArgs.concat(callArgs))\n//\n// function partialRight(fn, ...fixedArgs) {\n// return function(...callArgs) {\n// return fn.apply(this, [...callArgs, ...fixedArgs])\n// }\n// }\n\n//function throttle(callback, limit) { // From https://jsfiddle.net/jonathansampson/m7G64/\n// var wait = false // Initially, we're not waiting\n// return function () { // We return a throttled function\n// if (!wait) { // If we're not waiting\n// callback.call() // Execute users function\n// wait = true // Prevent future invocations\n// setTimeout(function () { // After a period of time\n// wait = false // And allow future invocations\n// }, limit)\n// }\n// }\n//}\n\n function identity(arg) {\n return arg\n }\n\n// ###**\n// ###\n// parsePath = (input) ->\n// path = []\n// pattern = /([^\\.\\[\\]\\\"\\']+)|\\[\\'([^\\']+?)\\'\\]|\\[\\\"([^\\\"]+?)\\\"\\]|\\[([^\\]]+?)\\]/g\n// while match = pattern.exec(input)\n// path.push(match[1] || match[2] || match[3] || match[4])\n// path\n\n// ###**\n// Given an async function that will return a promise, returns a proxy function\n// with an additional `.promise` attribute.\n//\n// When the proxy is called, the inner function is called.\n// The proxy's `.promise` attribute is available even before the function is called\n// and will resolve when the inner function's returned promise resolves.\n//\n// If the inner function does not return a promise, the proxy's `.promise` attribute\n// will resolve as soon as the inner function returns.\n//\n// @function up.util.previewable\n// @internal\n// ###\n// previewable = (fun) ->\n// deferred = newDeferred()\n// preview = (args...) ->\n// funValue = fun(args...)\n// # If funValue is again a Promise, it will defer resolution of `deferred`\n// # until `funValue` is resolved.\n// deferred.resolve(funValue)\n// funValue\n// preview.promise = deferred.promise()\n// preview\n\n /*-\n @function up.util.sequence\n\n @param {Array<Function()>} functions\n @return {Function()}\n A function that will call all `functions` if called.\n\n Its arguments are passed on to each function.\n @internal\n */\n function sequence(...fns) {\n return (...callArgs) => callAll(fns, ...callArgs)\n }\n\n function callAll(fns, ...args) {\n fns = scanFunctions(fns)\n return map(fns, (fn) => fn(...args))\n }\n\n// ###**\n// @function up.util.race\n// @internal\n// ###\n// race = (promises...) ->\n// raceDone = newDeferred()\n// each promises, (promise) ->\n// promise.then -> raceDone.resolve()\n// raceDone.promise()\n\n// ###**\n// Returns `'left'` if the center of the given element is in the left 50% of the screen.\n// Otherwise returns `'right'`.\n//\n// @function up.util.horizontalScreenHalf\n// @internal\n// ###\n// horizontalScreenHalf = (element) ->\n// elementDims = element.getBoundingClientRect()\n// elementMid = elementDims.left + 0.5 * elementDims.width\n// screenMid = 0.5 * up.viewport.rootWidth()\n// if elementMid < screenMid\n// 'left'\n// else\n// 'right'\n\n /*-\n Flattens the given `array` a single depth level.\n\n Will also flatten [array-like](/api/List) values, like a `NodeList`.\n\n ### Example\n\n ```js\n let nested = [1, [2, 3], [4]]\n up.util.flatten(nested) // result: [1, 2, 3, 4]\n ```\n\n @function up.util.flatten\n @param {Array} array\n An array which might contain other arrays\n @return {Array}\n The flattened array\n @stable\n */\n function flatten(array) {\n const flattened = []\n for (let object of array) {\n if (isList(object)) {\n flattened.push(...object)\n } else {\n flattened.push(object)\n }\n }\n return flattened\n }\n\n// flattenObject = (object) ->\n// result = {}\n// for key, value of object\n// result[key] = value\n// result\n\n /*-\n Maps each element using a mapping function,\n then [flattens](/api/up.util.flatten) the result into a new array.\n\n @function up.util.flatMap\n @param {List|Iterator} list\n @param {Function(element)} mapping\n @return {Array}\n @stable\n */\n function flatMap(array, block) {\n return flatten(map(array, block))\n }\n\n /*-\n Sets the given callback as both fulfillment and rejection handler for the given promise.\n\n [Unlike `Promise#finally()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally#Description), `up.util.always()` may change the settlement value\n of the given promise.\n\n ### Example: Callback style\n\n ```js\n let process = (value) => console.log(value)\n up.util.always(promise, process)\n ```\n\n ### Example with `await`\n\n ```js\n let value = await up.util.always(promise)\n console.log(value)\n ```\n\n @function up.util.always\n @internal\n */\n function always(promise, callback = identity) {\n return promise.then(callback, callback)\n }\n\n /*-\n @function up.util.newDeferred\n @internal\n */\n function newDeferred() {\n let { promise, resolve, reject } = Promise.withResolvers()\n return Object.assign(promise, { resolve, reject })\n }\n\n// ###**\n// Calls the given block. If the block throws an exception,\n// a rejected promise is returned instead.\n//\n// @function up.util.rejectOnError\n// @internal\n// ###\n// rejectOnError = (block) ->\n// try\n// block()\n// catch error\n// Promise.reject(error)\n\n// sum = (list, block) ->\n// block = iteratee(block)\n// totalValue = 0\n// for entry in list\n// entryValue = block(entry)\n// if isGiven(entryValue) # ignore undefined/null, like SQL would do\n// totalValue += entryValue\n// totalValue\n\n function isBasicObjectProperty(k) {\n return Object.hasOwn(Object.prototype, k)\n }\n\n /*-\n Returns whether the two arguments are equal by value.\n\n ### Comparison protocol\n\n - By default `up.util.isEqual()` can compare strings, numbers,\n [array-like values](/api/List), plain objects and `Date` objects.\n - To make the comparison protocol work with user-defined classes,\n see `up.util.isEqual.key`.\n - Objects without a defined comparison protocol are\n compared by reference (`===`).\n\n @function up.util.isEqual\n @param {any} a\n The first value to compare.\n @param {any} b\n The second value to compare.\n @return {boolean}\n Whether the arguments are considered equal.\n @stable\n */\n function isEqual(a, b) {\n // When two values have trivial equality, return immediately instead of going\n // through the extensive normalization and comparison below.\n if (a === b) {\n return true\n }\n\n if (a?.valueOf) { a = a.valueOf() } // Date, String objects, Number objects\n if (b?.valueOf) { b = b.valueOf() } // Date, String objects, Number objects\n\n if (a === b) {\n return true\n }\n\n if (typeof(a) !== typeof(b)) {\n return false\n }\n\n if (isList(a) && isList(b)) {\n return isEqualList(a, b)\n }\n\n if (isObject(a) && a[isEqual.key]) {\n return a[isEqual.key](b)\n }\n\n if (isOptions(a) && isOptions(b)) {\n return isEqualOptions(a, b)\n }\n\n return false\n }\n\n function isEqualOptions(a, b) {\n const aKeys = Object.keys(a)\n const bKeys = Object.keys(b)\n return isEqualList(aKeys, bKeys) && every(aKeys, (key) => isEqual(a[key], b[key]))\n }\n\n /*-\n This property contains the name of a method that user-defined classes\n may implement to hook into the `up.util.isEqual()` protocol.\n\n ### Example\n\n We have a user-defined `Account` class that we want to use with `up.util.isEqual()`:\n\n ```js\n class Account {\n constructor(email) {\n this.email = email\n }\n\n [up.util.isEqual.key](other) {\n return this.email === other.email\n }\n }\n ```\n\n Note that the protocol method is not actually named `'up.util.isEqual.key'`.\n Instead it is named after the *value* of the `up.util.isEqual.key` property.\n To do so, the code sample above is using a\n [computed property name](https://medium.com/front-end-weekly/javascript-object-creation-356e504173a8)\n in square brackets.\n\n We may now use `Account` instances with `up.util.isEqual()`:\n\n ```js\n let one = new Account('foo@foo.com')\n let two = new Account('foo@foo.com')\n let three = new Account('bar@bar.com')\n\n up.util.isEqual(one, two) // returns true\n up.util.isEqual(one, three) // returns false\n ```\n\n @property up.util.isEqual.key\n @param {string} key\n @stable\n */\n isEqual.key = 'up.util.isEqual'\n\n function isEqualList(a, b) {\n return (a.length === b.length) && every(a, (elem, index) => isEqual(elem, b[index]))\n }\n\n function getSimpleTokens(value, { json = false, separator = /[,\\s]/ } = {}) {\n if (!isString(value)) {\n return wrapList(value)\n } else if (json && /^\\[.*]$/.test(value)) {\n return parseRelaxedJSON(value)\n } else {\n return splitSimpleTokenString(value, separator)\n }\n }\n\n function splitSimpleTokenString(value, separator) {\n let parts = up.migrate.splitAtOr?.(value) || value.split(separator)\n return parts.map((s) => s.trim()).filter(identity)\n }\n\n function getComplexTokens(value) {\n if (!isString(value)) {\n return wrapList(value)\n } else {\n let { maskedTokens, restore } = complexTokenOutlines(value)\n return maskedTokens.map((token) => restore(token))\n }\n }\n\n function complexTokenOutlines(string) {\n let { masked, restore } = expressionOutline(string)\n let maskedTokens = splitSimpleTokenString(masked, ',')\n return { maskedTokens, restore }\n }\n\n function wrapValue(constructor, ...args) {\n return (args[0] instanceof constructor) ? args[0] : new constructor(...args)\n }\n\n// wrapArray = (objOrArray) ->\n// if isUndefined(objOrArray)\n// []\n// else if isArray(objOrArray)\n// objOrArray\n// else\n// [objOrArray]\n\n let nextUid = 0\n\n function uid() {\n return nextUid++\n }\n\n /*-\n Returns a copy of the given object, with its keys transformed by the given function.\n\n If the given function returns `undefined` for a key, that key\n will be omitted from the returned object.\n\n @function up.util.withRenamedKeys\n @param {Object} object\n @param {Function(string): string|undefined} renameKeyFn\n @internal\n */\n function withRenamedKeys(object, renameKeyFn) {\n const renamed = {}\n for (let key in object) {\n let transformed = renameKeyFn(key)\n if (isGiven(transformed)) {\n renamed[transformed] = object[key]\n }\n }\n return renamed\n }\n\n function camelToKebabCase(str) {\n return str.replace(/[A-Z]/g, (char) => '-' + char.toLowerCase())\n }\n\n function kebabToCamelCase(str) {\n return str.replace(/-([a-z])/g, (_match, char) => char.toUpperCase())\n }\n\n // function prefixCamelCase(str, prefix) {\n // return prefix + upperCaseFirst(str)\n // }\n //\n // function unprefixCamelCase(str, prefix) {\n // const pattern = new RegExp('^' + prefix + '(.+)$')\n // let match = str.match(pattern)\n // if (match) {\n // return lowerCaseFirst(match[1])\n // }\n // }\n\n function lowerCaseFirst(str) {\n return str[0].toLowerCase() + str.slice(1)\n }\n\n function upperCaseFirst(str) {\n return str[0].toUpperCase() + str.slice(1)\n }\n\n function defineDelegates(object, props, targetProvider) {\n for (let prop of props) {\n Object.defineProperty(object, prop, {\n get() {\n const target = targetProvider.call(this)\n let value = target[prop]\n if (isFunction(value)) {\n value = value.bind(target)\n }\n return value\n },\n set(newValue) {\n const target = targetProvider.call(this)\n target[prop] = newValue\n }\n })\n }\n }\n\n function delegatePromise(object, targetProvider) {\n return defineDelegates(\n object,\n ['then', 'catch', 'finally'],\n targetProvider\n )\n }\n\n // function defineTemporaryDelegates(object, props, targetProvider) {\n // let undo = sequence(props.map((prop) => {\n // let oldDescriptor = Object.getOwnPropertyDescriptor(object, prop)\n // // There's a case where Object.getOwnPropertyDescriptor() is missing because it is\n // // a inherited property. In this case it is non-trivial to undo the temporary delegation.\n // // Since we don't need that case, we don't handle it.\n // return () => Object.defineProperty(object, prop, oldDescriptor)\n // }\n // ))\n // defineDelegates(object, props, targetProvider)\n // return undo\n // }\n\n function stringifyArg(arg, placeholder = '%o', ancestors = new Set()) {\n let string\n const maxLength = 200\n\n // Discard color styles: https://developer.mozilla.org/en-US/docs/Web/API/Console#styling_console_output\n if (placeholder === '%c') {\n return ''\n }\n\n // In the browser console %s always stringifies the output.\n // Objects become \"[object Object]\".\n if (placeholder === '%s' && isGiven(arg)) {\n arg = arg.toString()\n }\n\n // Values nested in an array or object print like a value passed directly with %o.\n let stringifyNested = (value) => stringifyArg(value, '%o', ancestors)\n\n if (isString(arg)) {\n string = arg.trim().replace(/[\\n\\r\\t ]+/g, ' ')\n\n // In the browser console %o displays a string with quotes\n if (placeholder === '%o') {\n // This adds quotes and will log line breaks as verbatim `\\n`.\n string = JSON.stringify(string)\n }\n } else if (isFunction(arg)) {\n string = arg.toString()\n } else if (isJQuery(arg)) {\n string = `$(${map(arg, stringifyNested).join(', ')})`\n } else if (isElement(arg)) {\n string = tagOuterHTML(arg)\n } else if (isError(arg)) {\n string = `${arg.name}(${arg.message})`\n } else if (isObject(arg)) {\n // Arrays and objects. Functions, elements and errors are objects, too, but are handled above.\n // Our own classes declare a [Symbol.toStringTag] because minifiers may drop their class names.\n let label = arg[Symbol.toStringTag] || arg.constructor?.name\n\n if (ancestors.has(arg)) {\n string = '(circular)'\n } else if (isArray(arg) || isOptions(arg)) {\n // Track the arrays and objects we're currently printing, so a cycle doesn't recurse infinitely.\n // An object that appears twice without a cycle is printed in full both times.\n ancestors.add(arg)\n if (isArray(arg)) {\n string = `[${map(arg, stringifyNested).join(', ')}]`\n } else {\n let pairs = Object.entries(arg).map(([key, value]) => `${key}: ${stringifyNested(value)}`)\n string = pairs.length ? `{ ${pairs.join(', ')} }` : '{}'\n }\n ancestors.delete(arg)\n } else if (arg.toString !== Object.prototype.toString) {\n // A class instance with its own readable name, like an up.Request or a Date.\n string = `${label}(${arg.toString()})`\n } else {\n string = `${label} {…}`\n }\n } else {\n // undefined, null, booleans, numbers\n string = String(arg)\n }\n\n if (string.length > maxLength) {\n string = `${string.substr(0, maxLength)}…${last(string)}`\n }\n return string\n }\n\n const SPRINTF_PLACEHOLDERS = /%[oOdisfc]/g\n\n /*-\n See https://developer.mozilla.org/en-US/docs/Web/API/Console#Using_string_substitutions\n\n @function up.util.sprintf\n @internal\n */\n function sprintf(message, ...args) {\n return message.replace(SPRINTF_PLACEHOLDERS, (placeholder) => stringifyArg(args.shift(), placeholder))\n }\n\n const SERIALIZED_TAG_PATTERN = /<(\"[^\"]*\"|[^\">])*>/\n\n // This could go in up.element, but we want up.util to not have any dependencies\n // so every other module can depend on up.util.\n function tagOuterHTML(element) {\n return element.cloneNode().outerHTML.match(SERIALIZED_TAG_PATTERN)[0]\n }\n\n function negate(fn) {\n return function(...args) {\n return !fn(...args)\n }\n }\n\n function memoizeMethod(object, propLiteral) {\n // We're accepting the property names as the keys of an object. We don't care about the values.\n // We do this so that object's keys go through the same property mangling as the rest of the code.\n for (let prop in propLiteral) {\n // TODO: Why can't we just get the old prop using object[prop] ?\n let originalDescriptor = Object.getOwnPropertyDescriptor(object, prop)\n let oldImpl = originalDescriptor.value\n let memoizedImpl = memoize(oldImpl, `__${prop}MemoizeCache`)\n object[prop] = memoizedImpl\n }\n }\n\n function safeStringifyJSON(value) {\n let json = JSON.stringify(value)\n return escapeHighASCII(json)\n }\n\n function escapeHighASCII(string) {\n let unicodeEscape = (char) => \"\\\\u\" + char.charCodeAt(0).toString(16).padStart(4, '0')\n return string.replace(/[^\\x00-\\x7F]/g, unicodeEscape)\n }\n\n function variant(source, changes = {}) {\n let variant = Object.create(source)\n Object.assign(variant, changes)\n return variant\n }\n\n function parseArgs(args, ...specs) {\n let results = []\n\n // let originalArgs = copy(args)\n // let originalSpecs = copy(specs)\n\n while (specs.length) {\n let lastSpec = specs.pop()\n\n if (lastSpec === 'options') {\n results.unshift(extractOptions(args))\n } else if (lastSpec === 'callback') {\n results.unshift(extractCallback(args))\n } else if (lastSpec === 'val') {\n results.unshift(args.pop())\n } else if (isFunction(lastSpec)) {\n let value = lastSpec(last(args)) ? args.pop() : undefined\n // Write undefined if the tester failed. This makes the result order deterministic.\n // The caller can set a default liike this:\n //\n // let [foo = 'default'] = up.util.args(args, tester)\n results.unshift(value)\n }\n }\n\n // if (args.length) {\n // throw new up.CannotParse(['Invalid argument list (%o vs. %o), left is %o', originalArgs, originalSpecs, args])\n // }\n\n return results\n }\n\n // /*-\n // [Assigns](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) the given properties to the given object.\n //\n // Returns a function that restores the object's properties to the value they had before assignment.\n //\n // ### Example\n //\n // ```js\n // let obj = { a: 1, b: 2, c: 3, d: 4 }\n // let undo = up.util.assignTemp(obj, { b: 20, c: 30 })\n // console.log(obj) // logs { a: 1, b: 20, c: 30, d: 4 }\n //\n // undo()\n // console.log(obj) // logs { a: 1, b: 2, c: 3, d: 4 }\n // ```\n //\n // ### Limitations\n //\n // The returned function can only restore properties that existed before re-assignment.\n //\n // @function up.util.assignTemp\n // @param {Object} target\n // The target object to mutate.\n // @param {Object} props\n // An object containing the properties you want to apply.\n //\n // All enumerable own properties of `props` will be copied to `object`.\n // @return {Function}\n // A function that undoes the mutation of `target` when called.\n //\n // Only properties listed in `props` will be restored.\n // @experimental\n // */\n // function assignTemp(target, props) {\n // let oldProps = pick(target, Object.keys(props))\n // Object.assign(target, props)\n // return () => Object.assign(target, oldProps)\n // }\n\n function scanFunctions(...values) {\n return values.flat(2).filter(isFunction)\n }\n\n function cleaner(order = 'lifo') {\n let fns = []\n\n let track = function(values, transform) {\n values = scanFunctions(values).map(transform)\n fns.push(...scanFunctions(values))\n }\n\n let api = function(...values) {\n track(values, identity)\n }\n\n api.guard = function(...values) {\n track(values, up.error.guardFn)\n }\n\n api.clean = function(...args) {\n // By default, we run clean-up actions in the reverse order that they were scheduled in\n if (order === 'lifo') fns.reverse()\n\n // We don't allow clean-up actions to schedule more clean-up actions, to\n // prevent infinite loops. E.g. a user misunderstanding Preview#show() calls\n // Preview#hide() in an undo action.\n //\n // We can leverage the behavior of forEach(), which sets its range before the first iteration\n // and does not iterate over additional elements.\n // https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.foreach\n // AFAIK for ... of loops would behave differently.\n fns.forEach((fn) => fn(...args))\n\n // Allow the cleaner to be re-used.\n fns = []\n }\n\n return api\n }\n\n function maskPattern(str, patterns, { keepDelimiters = false } = {}) {\n let maskCount = 0\n let maskPattern = /§\\d+/g\n let maskings = {}\n let replaceLayers = []\n\n let replace = (replacePattern, allowRestoreTransform) => {\n let didReplace = false\n\n str = str.replaceAll(replacePattern, function(match) {\n didReplace = true\n let mask = '§' + (maskCount++)\n let remain\n let masked\n\n if (keepDelimiters) {\n let startDelimiter = match[0]\n let endDelimiter = match.slice(-1)\n masked = match.slice(1, -1)\n remain = startDelimiter + mask + endDelimiter\n } else {\n masked = match\n remain = mask\n }\n\n maskings[mask] = masked\n return remain\n })\n\n if (didReplace) replaceLayers.unshift({ allowRestoreTransform })\n }\n\n // If the input already contains a mask pattern (like §5), we mask it, but don't allow transforms on restore.\n replace(maskPattern, false)\n\n // When we mask the given patterns, we allow an optional transform on restore.\n for (let pattern of patterns) replace(pattern, true)\n\n let restore = (s, transform = identity) => {\n for (let { allowRestoreTransform } of replaceLayers) {\n let iterationTransform = allowRestoreTransform ? transform : identity\n s = s.replace(maskPattern, (match) => iterationTransform(assert(maskings[match], isString)))\n }\n return s\n }\n\n return { masked: str, restore }\n }\n\n const QUOTED_STRING_PATTERN = /'(?:\\\\\\\\|\\\\'|[^'])*'|\"(?:\\\\\\\\|\\\\\"|[^\"])*\"/g\n // TODO: Remove\n // const NESTED_BRACES = /{(?:[^{}]|{[^{}]*})*}/g\n // const NESTED_PARENTHESES = /\\((?:[^\\(\\)]|\\([^\\(\\)]*\\))*\\)/g\n // const NESTED_BRACKETS = /\\[(?:[^\\[\\]]|\\[[^\\[\\]]*\\])*\\]/g\n const NESTED_GROUP_PATTERN = /{(?:[^{}]|{[^{}]*})*}|\\((?:[^\\(\\)]|\\([^\\(\\)]*\\))*\\)|\\[(?:[^\\[\\]]|\\[[^\\[\\]]*\\])*\\]/g // eslint-disable-line no-useless-escape\n\n function expressionOutline(str) {\n return maskPattern(str, [QUOTED_STRING_PATTERN, NESTED_GROUP_PATTERN], { keepDelimiters: true })\n }\n\n // (\"foo\") => (\"foo\")\n // ('foo') => (\"foo\")\n // ('foo\"bar\\'baz\"') => (\"foo\\\"bar'baz\")\n function ensureDoubleQuotes(str) {\n // If we already have double-quoted string, there's nothing to do.\n if (str[0] === '\"') return str\n assert(str[0] === \"'\")\n str = str.slice(1, -1)\n\n let transformed = str.replace(/(\\\\\\\\)|(\\\\')|(\\\\\")|(\")/g, function(_match, escapedBackslash, escapedSingleQuote, _doubleQuote) {\n return escapedBackslash // keep (\\\\)\n || (escapedSingleQuote && \"'\") // convert (\\') to just (')\n || '\\\\\"' // convert (\") to (\\\")\n })\n return '\"' + transformed + '\"'\n }\n\n function parseString(value) {\n return JSON.parse(ensureDoubleQuotes(value))\n }\n\n /*-\n Parses a string of [relaxed JSON](/api/relaxed-json) into a JavaScript value.\n\n ## Example\n\n ```js\n let value = up.util.parseRelaxedJSON(\"{ foo: 'one', bar: 'two', }\")\n console.log(value) // logs an object { foo: 'one', bar: 'two' }\n ```\n\n ## Syntax errors\n\n When the passed text is not in relaxed JSON format, a `SyntaxError` is thrown.\n\n @function up.util.parseRelaxedJSON\n @param {string} text\n The text to parse.\n @return {Object|Array|string|number|boolean|null}\n The parsed JSON value.\n @experimental\n */\n function parseRelaxedJSON(str) {\n let { masked, restore } = maskPattern(str, [QUOTED_STRING_PATTERN])\n masked = masked.replace(/([a-z_$][\\w$]*:)/gi, (unquotedProperty) => ('\"' + unquotedProperty.slice(0, -1) + '\":'))\n masked = masked.replace(/,\\s*([}\\]])/g, '$1')\n masked = restore(masked, ensureDoubleQuotes)\n return JSON.parse(masked)\n }\n\n function parseScalarJSONPairs(str) {\n let { maskedTokens, restore } = complexTokenOutlines(str)\n\n return maskedTokens.map((maskedToken) => {\n let [_match, string, json] = maskedToken.match(/([^{]+)({[^}]*})?/)\n return [\n restore(string.trim()),\n json && parseRelaxedJSON(restore(json))\n ]\n })\n }\n\n function spanObject(keys, value) {\n return mapObject(keys, (key) => [key, value])\n }\n\n /*-\n Parses the given value and returns a number.\n\n ## Example\n\n ```js\n up.util.parseNumber(\"123.4\") // result: 123.4\n ```\n\n ## Supported values\n\n The list of supported notations differs slightly from [`parseFloat()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat)\n and [`Number()`](https://www.w3schools.com/jsref/jsref_number.asp):\n\n <table>\n <thead>\n <tr>\n <th colspan=\"2\">Supported argument</th>\n <th>Return value</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>✔️ Zero</td>\n <td><code>\"0\"</code></td>\n <td><code>0</code></td>\n </tr>\n <tr>\n <td>✔️ Positive integer</td>\n <td><code>\"123\"</code></td>\n <td><code>123</code></td>\n </tr>\n <tr>\n <td>✔️ Negative value</td>\n <td><code>\"-5\"</code></td>\n <td><code>-5</code></td>\n </tr>\n <tr>\n <td>✔️ Floating point number</td>\n <td><code>\"4.6\"</code></td>\n <td><code>4.6</code></td>\n </tr>\n <tr>\n <td>✔️ Numeric separators</td>\n <td><code>\"1_000_000\"</code></td>\n <td><code>1000000</code></td>\n </tr>\n <tr>\n <td>✔️ Already a number</td>\n <td><code>10</code></td>\n <td><code>10</code></td>\n </tr>\n <tr>\n <td>✔️ Negative zero</td>\n <td><code>\"-0\"</code></td>\n <td><code>-0</code></td>\n </tr>\n </tbody>\n </table>\n\n If the argument cannot be parsed, it returns `undefined`.\n This function never throws an error and never returns `NaN`.\n\n <table>\n <thead>\n <tr>\n <th colspan=\"2\">Unsupported argument</th>\n <th>Return value</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>❌ Unparseable format</td>\n <td><code>\"foo\"</code></td>\n <td><code>undefined</code></td>\n </tr>\n <tr>\n <td>❌ Missing argument</td>\n <td><code>undefined</code></td>\n <td><code>undefined</code></td>\n </tr>\n <tr>\n <td>❌ Infinity</td>\n <td><code>\"Infinity\"</code></td>\n <td><code>undefined</code></td>\n </tr>\n <tr>\n <td>❌ Exponential notation</td>\n <td><code>\"314e-2\"</code></td>\n <td><code>undefined</code></td>\n </tr>\n <tr>\n <td>❌ Unparseable type</td>\n <td><code>{ foo: 3 }</code></td>\n <td><code>undefined</code></td>\n </tr>\n </tbody>\n </table>\n\n @function up.util.parseNumber\n @param {string|number} value\n The value to parse, usually a string.\n\n If a number is given, it is returned without further processing.\n @return {number|undefined}\n The parsed number value.\n\n If the argument cannot be parsed, `undefined` is returned.\n @experimental\n */\n function parseNumber(str) {\n if (isNumber(str)) {\n return str\n } else if (isString(str) && /^-?\\.?\\d[\\d._]*$/.test(str)) {\n return parseFloat(str.replaceAll('_', ''))\n }\n }\n\n function assert(value, testFn = isTruthy) {\n if (testFn(value)) {\n return value\n } else {\n throw \"assert failed\"\n }\n }\n\n return {\n parseURL,\n normalizeURL,\n matchableURL,\n matchableURLPatternAtom,\n matchURLs,\n normalizeMethod,\n methodAllowsPayload,\n copy,\n merge,\n mergeDefined,\n options: newOptions,\n parseArgIntoOptions,\n each,\n map,\n flatMap,\n mapObject,\n spanObject,\n findResult,\n some,\n every,\n find: findInList,\n filter: filterList,\n reject,\n intersect,\n compact,\n compactObject,\n uniq,\n uniqBy,\n last,\n isNull,\n isDefined,\n isUndefined,\n isGiven,\n isMissing,\n isPresent,\n isBlank,\n presence,\n isObject,\n isFunction,\n isString,\n isBoolean,\n isNumber,\n isElement,\n isTextNode,\n isJQuery,\n isElementLike,\n isPromise,\n isOptions,\n isArray,\n isFormData,\n // isNodeList,\n // isArguments,\n isList,\n isRegExp,\n isAdjacentPosition,\n timer: scheduleTimer,\n contains,\n containsAll,\n objectContains,\n toArray,\n pick,\n pickBy,\n omit,\n unresolvablePromise,\n remove,\n memoize,\n pluckKey,\n renameKey,\n extractOptions,\n extractCallback,\n noop,\n asyncNoop,\n identity,\n escapeHTML,\n escapeRegExp,\n sequence,\n callAll,\n evalOption,\n evalAutoOption,\n flatten,\n newDeferred,\n always,\n isBasicObjectProperty,\n isCrossOrigin,\n task: queueTask,\n fastTask: queueFastTask,\n isEqual,\n getSimpleTokens,\n getComplexTokens,\n wrapList,\n wrapValue,\n uid,\n upperCaseFirst,\n lowerCaseFirst,\n delegate: defineDelegates,\n delegatePromise,\n // temporaryDelegate: defineTemporaryDelegates,\n // prefixCamelCase,\n // unprefixCamelCase,\n camelToKebabCase,\n kebabToCamelCase,\n sprintf,\n withRenamedKeys,\n memoizeMethod,\n safeStringifyJSON,\n // groupBy,\n variant,\n cleaner,\n scanFunctions,\n args: parseArgs,\n parseRelaxedJSON,\n parseScalarJSONPairs,\n maskPattern,\n expressionOutline,\n parseString,\n assert,\n parseNumber,\n // partialRight,\n }\n})()\n","up.error = (function() {\n\n /*-\n Throws a [JavaScript error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)\n with the given message.\n\n The message may contain [substitution marks](https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions).\n\n ### Examples\n\n up.fail('Division by zero')\n up.fail('Unexpected result %o', result)\n\n @function up.fail\n @param {string} message\n A message with details about the error.\n\n The message can contain [substitution marks](https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions)\n like `%s` or `%o`.\n @param {Array<string>} vars...\n A list of variables to replace any substitution marks in the error message.\n @internal\n */\n function fail(...args) {\n // Yes, we pass the message plus all substitution vars as an array in the first arg slot.\n throw new up.Error(args)\n }\n\n function isCritical(error) {\n return (typeof error !== 'object') || ((error.name !== 'AbortError') && !(error instanceof up.RenderResult) && !(error instanceof up.Response))\n }\n\n /*-\n Registers an empty rejection handler in case the given promise\n rejects with an uncritical error.\n\n This prevents browsers from printing \"Uncaught (in promise)\" to the error\n console when the promise is rejected.\n\n This is helpful for event handlers where you know that no rejection\n handler will be registered:\n\n ```js\n up.on('submit', 'form[up-target]', (event, form) => {\n promise = up.submit(form)\n up.error.muteUncriticalRejection(promise)\n })\n ```\n\n Uncritical errors include:\n\n - `AbortError`\n - A failed `up.Response`\n - A failed `up.RenderResult`\n\n Other types of errors will not be muted.\n\n @function up.error.muteUncriticalRejection\n @param {Promise} promise\n @return {Promise}\n @internal\n */\n function muteUncriticalRejection(promise) {\n return promise.catch(throwCritical)\n }\n\n function muteUncriticalSync(block) {\n try {\n return block()\n } catch (e) {\n throwCritical(e)\n }\n }\n\n function throwCritical(value) {\n if (isCritical(value)) {\n throw value\n }\n }\n\n function guard(fn, ...args) {\n try {\n return fn(...args)\n } catch (error) {\n reportError(error)\n }\n }\n\n function guardPromise(promise) {\n return promise.catch(reportError)\n }\n\n function guardFn(fn) {\n if (fn) {\n return (...args) => guard(() => fn(...args))\n }\n }\n\n return {\n fail,\n throwCritical,\n muteUncriticalRejection,\n muteUncriticalSync,\n guard,\n guardPromise,\n guardFn,\n }\n})()\n\nup.fail = up.error.fail\n","// This object will gain properties when users load the optional unpoly-migrate.js\nup.migrate = {\n config: {},\n}\n","/*-\nWe tunnel some browser APIs through this module for easier mocking in tests.\n\n@module up.browser\n@internal\n*/\nup.browser = (function() {\n /*-\n Submits the given form with a full page load.\n\n For mocking in specs.\n\n @function up.browser.submitForm\n @internal\n */\n function submitForm(form) {\n form.submit()\n }\n\n /*-\n Returns whether this browser supports manipulation of the current URL\n via [`history.pushState`](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState).\n\n When `pushState` is not supported (e.g. through [`up.follow()`](/api/up.follow)), Unpoly will gracefully\n fall back to a full page load.\n\n > [NOTE]\n > Unpoly will not use `pushState` if the initial page was loaded with a request method other than GET.\n\n @function up.browser.canPushState\n @return {boolean}\n @internal\n */\n function canPushState() {\n // We cannot use pushState if the initial request method is a POST for two reasons:\n //\n // 1. Unpoly replaces the initial state so it can handle the pop event when the\n // user goes back to the initial URL later. If the initial request was a POST,\n // Unpoly will wrongly assume that it can restore the state by reloading with GET.\n //\n // 2. Some browsers have a bug where the initial request method is used for all\n // subsequently pushed states. That means if the user reloads the page on a later\n // GET state, the browser will wrongly attempt a POST request.\n // This issue affects Safari 9 and 10 (last tested in 2017-08).\n // Modern Firefoxes, Chromes and IE10+ don't have this behavior.\n //\n // The way that we work around this is that we don't support pushState if the\n // initial request method was anything other than GET (but allow the rest of the\n // Unpoly framework to work). This way Unpoly will fall back to full page loads until\n // the framework was booted from a GET request.\n return up.protocol.initialRequestMethod() === 'GET'\n }\n\n // Don't memoize so a build may publish window.jQuery after Unpoly was loaded\n function canJQuery() {\n return !!window.jQuery\n }\n\n function popCookie(name) {\n let value = document.cookie.match(new RegExp(name+\"=(\\\\w+)\"))?.[1]\n if (value) {\n document.cookie = name + '=;Max-Age=0;Path=/'\n return value\n }\n }\n\n /*-\n @return {boolean}\n @function up.browser.ensureConfirmed\n @param {string} options.confirm\n @param {boolean} options.preload\n @internal\n */\n function assertConfirmed(options) {\n const confirmed = !options.confirm || window.confirm(options.confirm)\n if (!confirmed) {\n throw new up.Aborted('User canceled action')\n }\n return true\n }\n\n return {\n submitForm,\n canPushState,\n canJQuery,\n assertConfirmed,\n popCookie,\n }\n})()\n","require('./element.sass')\n\n/*-\nLow-level functions to access and change the DOM.\n\n`up.element.get()` and `up.element.subtree()` look up elements. `up.element.createFromHTML()` and `up.element.createFromSelector()` build elements, and `up.element.affix()` builds one and attaches it to a parent. Functions like `up.element.attr()`, `up.element.numberAttr()` and `up.element.jsonAttr()` parse attribute values into typed values, and `up.element.toggle()` or `up.element.hide()` change visibility through the `[hidden]` attribute.\n\nThese functions know nothing about layers or animation. For a fragment-aware API, prefer `up.fragment`.\n\n@module up.element\n*/\nup.element = (function() {\n\n const u = up.util\n\n /*-\n Returns the first descendant element matching the given selector.\n\n @function first\n @param {Element} [parent=document]\n The parent element whose descendants to search.\n\n If omitted, all elements in the `document` will be searched.\n @param {string} selector\n The CSS selector to match.\n @return {Element|undefined|null}\n The first element matching the selector.\n\n Returns `null` or `undefined` if no element matches.\n @internal\n */\n function first(...args) {\n let [root = document, selector] = u.args(args, 'val', 'val')\n return root.querySelector(selector)\n }\n\n /*-\n Returns a list of a `root` element's descendants matching the given selector.\n\n If the `root` element itself matches the selector, it is also included in the returned list.\n\n @function up.element.subtree\n @param {Element} root\n The root element for the search.\n @param {string} selector\n The CSS selector to match.\n @return {NodeList<Element>|Array<Element>}\n A list of all matching elements.\n @stable\n */\n function subtree(root, selector) {\n const descendantMatches = root.querySelectorAll(selector)\n\n if (elementLikeMatches(root, selector)) {\n return [root, ...descendantMatches]\n } else {\n return descendantMatches\n }\n }\n\n function subtreeFirst(root, selector) {\n return elementLikeMatches(root, selector) ? root : root.querySelector(selector)\n }\n\n /*-\n Like `Element#matches()`, but returns `false` for a `Document` or `Window` argument.\n\n @function elementLikeMatches\n @internal\n */\n function elementLikeMatches(elementLike, selector) {\n return u.isElement(elementLike) && elementLike.matches(selector)\n }\n\n /*-\n Returns whether the given element is either the given root element\n or its descendants.\n\n @function contains\n @internal\n */\n function contains(root, selectorOrElement) {\n const element = getOne(selectorOrElement)\n // We cannot use `root.contains(element)` as <form> elements with an input named \"contains\"\n // would define `root.contains` to return that input (GH#507).\n return Node.prototype.contains.call(root, element)\n }\n\n /*-\n @function up.element.ancestor\n @internal\n */\n function ancestor(element, selector) {\n return element.parentNode?.closest(selector)\n }\n\n function around(element, selector) {\n // Only the closest match around the element, not all ancestors. This is intentional for viewports:\n // outer viewports show other content (a page around a scrolling sidebar, the page behind an overlay),\n // and scrolling them when a fragment updates would be an unexpected side effect.\n return getList(element.closest(selector), subtree(element, selector))\n }\n\n /*-\n Returns the native [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) for the given value.\n\n This function is not aware of [layers](/api/up.layer) or [elements being destroyed](/api/up-destroying)\n and does not support non-standard selectors like `:main`. For this, use `up.fragment.get()`.\n\n ### Casting rules\n\n - If given an element, returns that element.\n - If given a CSS selector string, returns the first element matching that selector.\n - If given a jQuery collection, returns the first element in the collection.\n Throws an error if the collection contains more than one element.\n - If given any other argument (`undefined`, `null`, `document`, `window`…), returns the argument unchanged.\n\n ### Example\n\n Passing a CSS selector will return the first matching element:\n\n ```js\n up.element.get('.foo') // returns the first matching element\n ```\n\n @function up.element.get\n @param {Element} [parent=document]\n The parent element whose descendants to search if `value` is a CSS selector string.\n\n If omitted, all elements in the `document` will be searched.\n @param {Element|jQuery|string} value\n The value to look up.\n @return {Element}\n The obtained `Element`.\n @stable\n */\n function getOne(...args) {\n const value = args.pop()\n\n if (u.isElement(value)) { // Return an element before we run any other expensive checks\n return value\n } else if (u.isString(value)) {\n return first(...args, value)\n } else if (u.isList(value)) {\n if (value.length > 1) {\n up.fail('up.element.get(): Cannot cast multiple elements (%o) to a single element', value)\n }\n return value[0]\n } else {\n // undefined, null, Window, Document, DocumentFragment, ...\n return value\n }\n }\n\n /*-\n Composes a list of elements from the given arguments.\n\n ### Casting rules\n\n - If given a string, returns all elements matching that string.\n - If given any other argument, returns the argument [wrapped as a list](/api/up.util.wrapList).\n\n ### Example\n\n ```javascript\n $jquery = $('.jquery') // returns jQuery (2) [div.jquery, div.jquery]\n nodeList = document.querySelectorAll('.node') // returns NodeList (2) [div.node, div.node]\n element = document.querySelector('.element') // returns Element div.element\n selector = '.selector' // returns String '.selector'\n\n elements = up.element.list($jquery, nodeList, undefined, element, selector)\n // returns [div.jquery, div.jquery, div.node, div.node, div.element, div.selector]\n ```\n\n @function up.element.list\n @param {Array<jQuery|Element|Array<Element>|string|undefined|null>} ...args\n @return {Array<Element>}\n @internal\n */\n function getList(...args) {\n return u.flatMap(args, valueToList)\n }\n\n function valueToList(value) {\n if (u.isString(value)) {\n return document.querySelectorAll(value)\n } else {\n return u.wrapList(value)\n }\n }\n\n /*-\n Hides the given element.\n\n Also see `up.element.show()` and `up.element.toggle()`.\n\n ### Implementation\n\n The element is hidden by setting an `[hidden]` attribute.\n This effectively gives the element a `display: none` rule.\n\n To customize the CSS rule for hiding, see `[hidden]`.\n\n @function up.element.hide\n @param {Element} element\n @stable\n */\n function hide(element) {\n setVisible(element, false)\n }\n\n /*-\n Elements with this attribute are hidden from the page.\n\n @learn-ref switching-form-state\n\n When Unpoly hides an element for any reason, it will set an `[hidden]` attribute\n instead of using an inline style like `display: none`.\n This allows users to customize the hiding implementation using CSS.\n\n ## Customizing the CSS\n\n While `[hidden]` is a [standard HTML attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden),\n its default implementation is [not very useful](https://meowni.ca/hidden.is.a.lie.html).\n In particular, it cannot hide elements with any `display` rule.\n Unpoly improves the default CSS styles of `[hidden]` so it can hide arbitrary elements.\n\n Unpoly's default styles for `[hidden]` look like this:\n\n ```css\n [hidden][hidden] {\n display: none !important;\n }\n ```\n\n You can override the CSS to hide an element in a different way, e.g. by giving it a zero height:\n\n ```css\n .my-element[hidden] {\n display: block !important;\n height: 0 !important;\n }\n ```\n\n > [IMPORTANT]\n > Any overriding selector must have a [specificity of `(0, 2, 0)`](https://polypane.app/css-specificity-calculator/#selector=.element%5Bhidden%5D).\n > Also, all rules should be defined with [`!important`](https://www.w3schools.com/css/css_important.asp) to override other\n > styles defined on that element.\n\n @selector [hidden]\n @experimental\n */\n\n /*-\n Shows the given element.\n\n Also see `up.element.hide()` and `up.element.toggle()`.\n\n ### Limitations\n\n The element is shown by removing the `[hidden]` attribute set by `up.element.hide()`.\n If the element is hidden by an inline style (`[style=\"display: none\"]`),\n that inline style is also removed.\n\n You may have CSS rules causing the element to remain hidden after calling `up.element.show(element)`.\n Unpoly will *not* handle such cases to keep this function performant. As a workaround, you may\n manually set `element.style.display = 'block'`.\n\n @function up.element.show\n @param {Element} element\n The element to show.\n @stable\n */\n function show(element) {\n setVisible(element, true)\n }\n\n function showTemp(element) {\n return setVisibleTemp(element, true)\n }\n\n function hideTemp(element) {\n return setVisibleTemp(element, false)\n }\n\n function setVisibleTemp(element, newVisible) {\n if (newVisible === isVisible(element)) return u.noop\n setVisible(element, newVisible)\n return () => setVisible(element, !newVisible)\n }\n\n function setVisible(element, newVisible) {\n if (newVisible) {\n // Remove the attribute set by `up.element.hide()`.\n element.removeAttribute('hidden')\n\n // In case the element was manually hidden through an inline style\n // of `display: none`, we also remove that.\n if (element.style.display === 'none') {\n element.style.display = ''\n }\n } else {\n // Set an attribute that the user can style with custom \"hidden\" styles.\n // E.g. certain JavaScript components cannot initialize properly within a\n // { display: none }, as such an element has no width or height.\n element.setAttribute('hidden', '')\n }\n }\n\n /*-\n Changes whether the given element is [shown](/api/up.element.show) or [hidden](/api/up.element.hide).\n\n @function up.element.toggle\n @param {Element} element\n The element to toggle.\n @param {boolean} [newVisible]\n Pass `true` to show the element or `false` to hide it.\n\n If omitted, the element will be hidden if shown and shown if hidden.\n @stable\n @signature\n */\n function toggle(element, newVisible = !isVisible(element)) {\n setVisible(element, newVisible)\n }\n\n function setAttrPresence(element, attr, value, newPresent) {\n if (newPresent) {\n return element.setAttribute(attr, value)\n } else {\n return element.removeAttribute(attr)\n }\n }\n\n /*-\n Sets properties from the given object as attributes on the given element.\n\n ### Example\n\n ```js\n up.element.setAttrs(element, { title: 'Tooltip', tabindex: 1 })\n\n element.getAttribute('title') // result: \"Tooltip\"\n element.getAttribute('tabindex') // result: \"1\"\n ```\n\n @function up.element.setAttrs\n @param {Element} element\n The element on which to set attributes.\n @param {Object} attributes\n An object of attribute names and values to set.\n\n To set an empty attribute, pass an empty string value.\n\n To remove an attribute, use a value of `null` or `undefined`.\n @stable\n */\n function setAttrs(element, attrs) {\n for (let key in attrs) {\n const value = attrs[key]\n if (u.isGiven(value)) {\n element.setAttribute(key, value)\n } else {\n element.removeAttribute(key)\n }\n }\n }\n\n /*-\n Temporarily sets attributes on the given element.\n\n Returns a function that restores the attributes to their value before the change.\n\n ### Example\n\n ```js\n let element = up.element.createFromSelector(\"div[title='Original']\")\n element.getAttribute('title') // => \"Original\"\n\n let undo = up.element.setAttrsTemp(element, { title: 'Changed' })\n element.getAttribute('title') // => \"Changed\"\n\n undo()\n element.getAttribute('title') // result: \"Original\"\n ```\n\n @function up.element.setAttrsTemp\n @param element\n @like up.element.setAttrs\n @param attributes\n @like up.element.setAttrs\n @return {Function}\n A function that restores the attributes to their value before the change.\n @internal\n */\n function setAttrsTemp(element, attrs) {\n let keys = Object.keys(attrs)\n let oldAttrs = pickAttrs(element, keys)\n setAttrs(element, attrs)\n return () => setAttrs(element, oldAttrs)\n }\n\n /*-\n @function up.element.metaContent\n @internal\n */\n function metaContent(name) {\n const selector = \"meta\" + attrSelector('name', name)\n return document.head.querySelector(selector)?.content\n }\n\n /*-\n @function up.element.insertBefore\n @internal\n */\n function insertBefore(existingNode, newNode) {\n // We're not using insertAdjacentElement() because that does not work with Text nodes\n existingNode.parentNode.insertBefore(newNode, existingNode)\n }\n\n /*-\n Creates an element matching the given CSS selector.\n\n The created element will not yet be attached to the DOM tree.\n Attach it with [`Element#appendChild()`](https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild),\n or use `up.element.affix()` to create an already-attached element.\n\n Use `up.hello()` to activate [JavaScript behavior](/api/up.script) within the created element.\n\n ### Examples\n\n To create an element with a given tag name:\n\n ```js\n element = up.element.createFromSelector('span')\n // element is <span></span>\n ```\n\n To create an element with a given class:\n\n ```js\n element = up.element.createFromSelector('.klass')\n // element is <div class=\"klass\"></div>\n ```\n\n To create an element with a given ID:\n\n ```js\n element = up.element.createFromSelector('#foo')\n // element is <div id=\"foo\"></div>\n ```\n\n ### Setting attributes\n\n To create an element with a given boolean attribute:\n\n ```js\n element = up.element.createFromSelector('[attr]')\n // element is <div attr></div>\n ```\n\n To create an element with a given attribute value:\n\n ```js\n element = up.element.createFromSelector('[attr=\"value\"]')\n // element is <div attr=\"value\"></div>\n ```\n\n You may also pass an object of attribute names and values as a second argument:\n\n ```js\n element = up.element.createFromSelector('div', { attr: 'value' })\n // element is <div attr=\"value\"></div>\n ```\n\n ### Passing child nodes\n\n You may set the element's inner text by passing a `{ text }` option (HTML control characters will\n be escaped):\n\n ```js\n element = up.element.createFromSelector('div', { text: 'inner text' })\n // element is <div>inner text</div>\n ```\n\n You may set the element's inner HTML by passing a `{ content }` option:\n\n ```js\n element = up.element.createFromSelector('div', { content: '<span>inner text</span>' })\n // element is <div><span>inner text</span></div>\n ```\n\n ### Setting inline styles\n\n You may set inline styles by passing an object of CSS properties as a `{ style }` option:\n\n ```js\n element = up.element.createFromSelector('div', { style: { color: 'red' }})\n // element is <div style=\"color: red\"></div>\n ```\n\n @function up.element.createFromSelector\n @include up.element.createFromSelector/all\n @stable\n */\n function createFromSelector(selector, attrs = {}) {\n let { includePath } = parseSelector(selector)\n\n let rootElement\n let depthElement\n let previousElement\n\n for (let includeSegment of includePath) {\n let { tagName } = includeSegment\n\n if (!tagName || tagName === '*') {\n tagName = 'div'\n }\n\n depthElement = document.createElement(tagName)\n\n if (!rootElement) {\n rootElement = depthElement\n }\n\n makeVariation(depthElement, includeSegment)\n\n previousElement?.appendChild(depthElement)\n previousElement = depthElement\n }\n\n for (let key in attrs) {\n let value = attrs[key]\n if (key === 'class') {\n addClasses(rootElement, u.wrapList(value))\n } else if (key === 'style') {\n setInlineStyle(rootElement, value)\n } else if (key === 'text') {\n rootElement.textContent = value\n } else if (key === 'content') {\n if (u.isString(value)) {\n rootElement.innerHTML = value\n } else {\n rootElement.append(...u.wrapList(value))\n }\n } else {\n rootElement.setAttribute(key, value)\n }\n }\n\n return rootElement\n }\n\n function makeVariation(element, { id, classNames, attributes }) {\n if (id) {\n element.id = id\n }\n\n for (let [name, value] of Object.entries(attributes)) {\n element.setAttribute(name, value)\n }\n\n addClasses(element, classNames)\n }\n\n /*-\n Parses a not-too-complex CSS selector.\n\n ### Example\n\n ```js\n up.element.parseSelector('.content > form[action=\"/\"]:not(.bar)')\n => {\n includePath: [\n { tagName: null,\n classNames: ['content'],\n id: null,\n attributes: {}\n },\n { tagName: 'form',\n classNames: [],\n id: null,\n attributes: { action: \"/\" }\n }\n ],\n includeRaw: '.content > form[action=\"/\"]',\n excludeRaw: ':not(.bar)'\n }\n ```\n\n @function up.element.parseSelector\n @internal\n */\n function parseSelector(rawSelector) {\n let excludeRaw\n\n const {\n masked: selectorOutline,\n restore: restoreSelectorLiterals,\n } = u.expressionOutline(rawSelector)\n\n const includeWithoutAttrs = selectorOutline.replace(/:not\\([^)]*\\)/, function(match) {\n excludeRaw = restoreSelectorLiterals(match)\n return ''\n })\n\n let includeRaw = restoreSelectorLiterals(includeWithoutAttrs)\n\n const includeSegments = includeWithoutAttrs.split(/[ >]+/)\n\n let includePath = includeSegments.map(function(depthSelector) {\n let parsed = {\n tagName: null,\n classNames: [],\n id: null,\n attributes: {}\n }\n\n depthSelector = depthSelector.replace(/^[\\w-*]+/, function(match) {\n parsed.tagName = match\n return ''\n })\n\n depthSelector = depthSelector.replace(/#([\\w-]+)/, function(_match, id) {\n parsed.id = id\n return ''\n })\n\n depthSelector = depthSelector.replace(/\\.([\\w-]+)/g, function(_match, className) {\n parsed.classNames.push(className)\n return ''\n })\n\n depthSelector = depthSelector.replace(/\\[[^\\]]*]/g, function(attr) {\n attr = restoreSelectorLiterals(attr)\n let [_raw, name, _operator, quote, value] = attr.match(/\\[([\\w-]+)(?:([~|^$*]?=)([\"'])?([^\\3\\]]*?)\\3)?]/)\n quote ||= '\"'\n parsed.attributes[name] = value ? u.parseString(quote + value + quote) : ''\n return ''\n })\n\n if (depthSelector) {\n up.fail('Cannot parse selector: ' + rawSelector)\n }\n\n return parsed\n })\n\n return {\n includePath,\n includeRaw,\n excludeRaw,\n }\n }\n\n /*-\n Creates an element matching the given CSS selector and attaches it to the given parent element.\n\n To create a detached element from a selector, see `up.element.createFromSelector()`.\n\n Use `up.hello()` to activate [JavaScript behavior](/api/up.script) within the created element.\n\n ### Example\n\n ```js\n element = up.element.affix(document.body, '.klass')\n element.parentElement // returns document.body\n element.className // returns 'klass'\n ```\n\n See `up.element.createFromSelector()` for many more examples.\n\n @function up.element.affix\n @section Position\n @param {Element} parent\n The parent to which to attach the created element.\n @param {string} [position='beforeend']\n The position of the new element in relation to `parent`.\n\n @include adjacent-positions\n @include up.element.createFromSelector/all\n @stable\n @signature\n */\n function affix(...args) {\n let [parent, position = 'beforeend', selector, attributes] = u.args(args, 'val', u.isAdjacentPosition, 'val', 'options')\n const element = createFromSelector(selector, attributes)\n parent.insertAdjacentElement(position, element)\n return element\n }\n\n // Not covered by specs: rendering into <html> or <body> would replace the Jasmine runner.\n const SINGLETON_TAG_NAMES = ['HTML', 'BODY', 'HEAD', 'TITLE']\n\n /*-\n @function up.element.isSingleton\n @internal\n */\n const isSingleton = up.mockable((element) => element.matches(SINGLETON_TAG_NAMES.join()))\n\n /*-\n @function up.element.attrSelector\n @internal\n */\n function attrSelector(attribute, value) {\n if (u.isGiven(value)) {\n value = value.replace(/\"/g, '\\\\\"')\n // We could get away with omitting the quotes for simple alphanumeric strings,\n // but e.g. not for a string with quotes or spaces or a string that is all numbers.\n // Better add the quotes in all cases.\n return `[${attribute}=\"${value}\"]`\n } else {\n return `[${attribute}]`\n }\n }\n\n function idSelector(id) {\n if (id.match(/^[a-z][a-z0-9\\-_]*$/i)) {\n return `#${id}`\n } else {\n return attrSelector('id', id)\n }\n }\n\n /*-\n @function up.element.classSelector\n @internal\n */\n function classSelector(klass) {\n klass = klass.replace(/[^\\w-]/g, '\\\\$&')\n return `.${klass}`\n }\n\n /*-\n Parses a new `Document` instance from the given HTML.\n\n This function always creates a full document with a <html> root,\n even if the given `html` string only contains a fragment.\n\n Due to quirks in the `DOMParser` spec, `<script>` and `<noscript>`\n elements in the returned document will be inert. Also, media elements may\n not work fully on Safari. To make them active, clone them after insertion\n into the destination document using `up.element.revivedClone()`.\n\n @function up.element.createBrokenDocumentFromHTML\n @param {string} html\n @return {Document}\n @internal\n */\n function createBrokenDocumentFromHTML(html) {\n // DOMParser is usually smart enough to parse an incomplete HTML fragment into a full <html> document.\n // However, any table components without an enclosing <table> will be parsed into a simple text node.\n const firstTag = firstTagNameInHTML(html)\n if (['TR', 'TD', 'TH', 'THEAD', 'TBODY'].includes(firstTag)) {\n html = `<table>${html}</table>`\n }\n return new DOMParser().parseFromString(html, 'text/html')\n }\n\n // /*-\n // Fixes `<script>` and `<noscript>` elements in documents parsed by `up.element.createBrokenDocumentFromHTML()`.\n //\n // This addresses some quirks [in the `DOMParser` spec](http://w3c.github.io/DOM-Parsing/#dom-domparser-parsefromstring)\n // and in some browsers:\n //\n // 1. Children of a <nonscript> tag are expected to be a verbatim text node in a scripting-capable browser.\n // However, `DOMParser` parses children into actual DOM nodes.\n // This confuses libraries that work with <noscript> tags, such as lazysizes.\n // 2. <script> elements are inert and will not run code when inserted into the main `document`.\n // 3. Safari cannot parse auto-playing media elements.\n //\n // @function up.element.fixParserDamage\n // @param {Element} scriptish\n // A `<script>` or `<noscript>` element.\n // @internal\n // */\n // function fixParserDamage(element) {\n // let clone = revivedClone(element)\n // element.replaceWith(clone)\n // }\n\n function revivedClone(element) {\n // We cannot use `scriptish.cloneNode(true)` as this does not fix broken <noscript> elements\n let clone = createFromHTML(element.outerHTML)\n // When a CSP is set, the browser masks the nonce from .getAttribute() and .outerHTML\n if ('nonce' in element) clone.nonce = element.nonce\n return clone\n }\n\n /*-\n Parses an element from the given HTML fragment string.\n\n Use `up.hello()` to activate [JavaScript behavior](/api/up.script) within the created element.\n\n ### Example\n\n ```js\n element = up.element.createFromHTML('<div class=\"foo\"><span>text</span></div>')\n element.className // returns 'foo'\n element.children[0] // returns <span> element\n element.children[0].textContent // returns 'text'\n ```\n\n @function up.element.createFromHTML\n @param {string} html\n A string of HTML from which to create the element.\n\n The given HTML must have a single tag at its root or an error is thrown.\n @return {Element}\n The root element of the parsed DOM tree.\n @stable\n @signature\n */\n function createFromHTML(html) {\n return extractSingular(createNodesFromHTML(html))\n }\n\n /*-\n Checks if the given list contains a single `Element` and returns that element.\n\n Throws an error if the given list contains more than one node,\n or if the given list only contains a `Text` node.\n\n @function up.element.extractSingular\n @param {List<Node>} nodes\n @return {Element}\n @internal\n */\n function extractSingular(nodes) {\n return tryExtractSingular(nodes) || up.fail('Expected a single element, but got %d nodes', nodes.length)\n }\n\n function tryExtractSingular(nodes) {\n if (nodes.length === 1 && u.isElementLike(nodes[0])) {\n return nodes[0]\n }\n }\n\n /*-\n Parses a [list](/api/List) of [nodes](https://developer.mozilla.org/en-US/docs/Web/API/Node) from a string of HTML.\n\n The returned list can be a mixed list of `Element`, `Text`, or `Comment` nodes.\n\n ## Example\n\n ```js\n let list = up.element.createNodesFromHTML('foo <p>bar</p> baz') // result: NodeList(3)\n list.length // result: 3\n list[0] // result: Text \"foo \"\n list[1] // result: Element \"<p>bar</p>\"\n list[2] // result: Text \" baz\"\n ```\n\n ## Whitespace trimming {#whitespace}\n\n Before parsing, whitespace will be trimmed from the beginning and end of the string.\n This prevents the creation of all-whitespace `Text` nodes at the edges of the list:\n\n ```js\n let list = up.element.createNodesFromHTML(' <p>bar</p> ') // result: NodeList(1)\n list.length // result: 1\n ```\n\n No changes will be made to whitespace in the middle of the given string.\n\n @function up.element.createNodesFromHTML\n @param {string} html\n A string of HTML to parse.\n @return {List<Node>}\n A list of `Element`, `Text`, or `Comment` nodes.\n\n @experimental\n */\n function createNodesFromHTML(html) {\n // Prevent all-whitespace text nodes at the beginning or end\n html = html.trim()\n\n // (1) We cannot use createBrokenDocumentFromHTML() here, since up.ResponseDoc\n // needs to create <noscript> elements, and DOMParser cannot create those.\n // Also it always parses a full document, and we would need to rediscover our element\n // root within that.\n // (2) We cannot use innerHTML on an anonymous element here, since up.ResponseDoc\n // needs to create executable <script> elements and setting innerHTML will\n // create inert <script> elements.\n // (3) Using Range#createContextualFragment() is significantly faster than setting\n // innerHTML on Chrome. See https://jsben.ch/QQngJ\n const range = document.createRange()\n range.setStart(document.body, 0)\n const fragment = range.createContextualFragment(html)\n return fragment.childNodes\n }\n\n /*-\n @function up.element.root\n @internal\n */\n function getRoot() {\n return document.documentElement\n }\n\n /*-\n Forces the browser to paint the given element now.\n\n @function up.element.paint\n @internal\n */\n function paint(element) {\n element.offsetHeight\n }\n\n /*-\n @function up.element.fixedToAbsolute\n @internal\n */\n function fixedToAbsolute(element) {\n const elementRectAsFixed = element.getBoundingClientRect()\n\n // Set the position to 'absolute' so it gains an offsetParent\n element.style.position = 'absolute'\n\n const offsetParentRect = element.offsetParent.getBoundingClientRect()\n\n setInlineStyle(element, {\n left: (elementRectAsFixed.left - computedStyleNumber(element, 'margin-left') - offsetParentRect.left) + 'px',\n top: (elementRectAsFixed.top - computedStyleNumber(element, 'margin-top') - offsetParentRect.top) + 'px',\n right: '',\n bottom: ''\n })\n }\n\n /*-\n On the given element, sets attributes that are still missing.\n\n @function up.element.setMissingAttrs\n @internal\n */\n function setMissingAttrs(element, attrs) {\n for (let key in attrs) {\n setMissingAttr(element, key, attrs[key])\n }\n }\n\n function setMissingAttr(element, key, value) {\n // (1) We skip a null or undefined value, e.g. from the attribute of another element that doesn't have it.\n // (2) We set false as \"false\". Some callers set [up-etag=false] on purpose.\n if (u.isGiven(value) && u.isMissing(element.getAttribute(key))) {\n element.setAttribute(key, value)\n }\n }\n\n /*-\n @function up.element.unwrap\n @internal\n */\n function unwrap(wrapper) {\n preservingFocus(function() {\n // Make a copy as it is a live list and we to iterate over it while also mutating it.\n let childNodes = [...wrapper.childNodes]\n for (let child of childNodes) insertBefore(wrapper, child)\n wrapper.remove()\n })\n }\n\n function wrapNodes(nodeOrNodes) {\n const wrapper = document.createElement('up-wrapper')\n wrapper.append(...u.wrapList(nodeOrNodes))\n return wrapper\n }\n\n function wrapIfRequired(nodes) {\n if (nodes.length === 1 && u.isElement(nodes[0])) {\n return nodes[0]\n } else {\n // There are multiple cases when we want to create a wrapper:\n // (1) We have multiple nodes, possibly a mix of Element and Text nodes\n // (2) We have a single Text node\n // (3) We have an empty list\n return wrapNodes(nodes)\n }\n }\n\n function wrapChildren(element) {\n const wrapper = wrapNodes(element.childNodes)\n element.append(wrapper)\n // <element>\n // <up-wrapper>\n // <child>\n // <child>\n // </up-wrapper>\n // </element>\n return wrapper\n }\n\n function preservingFocus(fn) {\n const oldFocusElement = document.activeElement\n // Moving an element resets its scroll position and selection range.\n const cursorProps = up.viewport.copyCursorProps(oldFocusElement)\n try {\n return fn()\n } finally {\n if (oldFocusElement && oldFocusElement !== document.activeElement) {\n // Firefox needs focus-related props to be set *before* we focus the element\n up.viewport.copyCursorProps(cursorProps, oldFocusElement)\n oldFocusElement.focus({ preventScroll: true })\n }\n }\n }\n\n function parseAttr(element, attribute, ...parsers) {\n // The document does not respond to #hasAttribute()\n if (!element.hasAttribute?.(attribute)) return undefined\n let rawValue = element.getAttribute(attribute)\n\n for (let parser of parsers) {\n let parserResult = parser(rawValue, attribute, element)\n if (u.isDefined(parserResult)) return parserResult\n }\n }\n\n /*-\n Returns the given `attribute` value for the given `element`.\n\n If the element does not have the given attribute, it returns `undefined`.\n This is a difference from the native `Element#getAttribute()`, which [mostly returns `null` in that case](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute#Non-existing_attributes).\n\n If the element has the attribute but without a value (e.g. `<input readonly>`), it returns an empty string.\n\n @function up.element.attr\n @param {Element} element\n The element from which to read an attribute.\n @param {string} attribute\n The name of the attribute to read.\n @return {string|undefined}\n The attribute value.\n\n Returns `undefined` if the attribute is not set on the given element.\n @stable\n */\n function stringAttr(element, attribute) {\n return parseAttr(element, attribute, tryParseString)\n }\n\n let tryParseString = u.identity\n\n /*-\n Returns the value of the given attribute on the given element, cast as a boolean value.\n\n If the attribute value cannot be cast to `true` or `false`, `undefined` is returned.\n\n ## Casting rules\n\n This function deviates from the\n [HTML Standard for boolean attributes](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes)\n to allow `undefined` values. When an attribute is missing, Unpoly considers the value to be `undefined`\n (whereas the standard would assume `false`).\n\n Unpoly also allows `\"true\"` and `\"false\"` as attribute values.\n\n The table below shows return values for `up.element.booleanAttr(element, 'foo')` given different elements:\n\n | Element | Return value |\n |---------------------|--------------|\n | `<div foo>` | `true` |\n | `<div foo=\"foo\">` | `true` |\n | `<div foo=\"true\">` | `true` |\n | `<div foo=\"\">` | `true` |\n | `<div foo=\"false\">` | `false` |\n | `<div>` | `undefined` |\n | `<div foo=\"bar\">` | `true` |\n\n @function up.element.booleanAttr\n @param {Element} element\n The element from which to retrieve the attribute value.\n @param {string} attribute\n The attribute name.\n @return {boolean|undefined}\n The cast attribute value.\n @stable\n */\n function booleanAttr(element, attribute) {\n return parseAttr(element, attribute, tryParseBoolean)\n }\n\n function tryParseBoolean(value, attribute) {\n switch (value) {\n case 'false': {\n return false\n }\n case 'true':\n case '': // Empty attribute value, as in <button disabled> or <button disabled=\"\"> (equivalent)\n case attribute: // The attribute name itself, e.g. <input checked=\"checked\">\n {\n return true\n }\n }\n }\n\n /*-\n Returns the given attribute value cast as boolean.\n\n If the attribute value cannot be cast, returns the attribute value unchanged.\n\n @function up.element.booleanOrStringAttr\n @param {Element} element\n The element from which to retrieve the attribute value.\n @param {string} attribute\n The attribute name.\n @return {boolean|string|undefined}\n The cast attribute value.\n @internal\n */\n function booleanOrStringAttr(element, attribute) {\n return parseAttr(element, attribute, tryParseBoolean, tryParseString)\n }\n\n /*-\n Returns the given attribute value cast as boolean.\n\n If the attribute value cannot be cast to a boolean, tries to cast the attribute value to a number.\n\n If the attribute value cannot be cast to either boolean or number, returns `undefined`.\n\n @function up.element.booleanOrNumberAttr\n @param {Element} element\n The element from which to retrieve the attribute value.\n @param {string} attribute\n The attribute name.\n @return {boolean|number|undefined}\n The cast attribute value.\n @internal\n */\n function booleanOrNumberAttr(element, attribute) {\n return parseAttr(element, attribute, tryParseBoolean, tryParseNumber)\n }\n\n /*-\n Returns the given attribute value cast as boolean or number.\n\n If the attribute value cannot be cast, returns the attribute value unchanged.\n\n @function up.element.booleanOrNumberOrStringAttr\n @param {Element} element\n The element from which to retrieve the attribute value.\n @param {string} attribute\n The attribute name.\n @return {boolean|string|undefined}\n The cast attribute value.\n @internal\n */\n function booleanOrNumberOrStringAttr(element, attribute) {\n return parseAttr(element, attribute, tryParseBoolean, tryParseNumber, tryParseString)\n }\n\n /*-\n Returns the value of the given attribute on the given element, cast to a number.\n\n If the attribute value cannot be cast to a number, `undefined` is returned.\n\n @function up.element.numberAttr\n @param {Element} element\n The element from which to retrieve the attribute value.\n @param {string} attribute\n The attribute name.\n @return {number|undefined}\n The cast attribute value.\n @stable\n */\n function numberAttr(element, attribute) {\n return parseAttr(element, attribute, tryParseNumber)\n }\n\n function tryParseNumber(value) {\n // Call without second argument\n return u.parseNumber(value)\n }\n\n /*-\n Reads the given attribute from the element, parsed as [relaxed JSON](/api/relaxed-json).\n\n Returns `undefined` if the attribute value is [blank](/api/up.util.isBlank) or only consists of whitespace.\n\n Throws a `SyntaxError` if the attribute value is an invalid JSON string.\n\n @function up.element.jsonAttr\n @param {Element} element\n The element from which to retrieve the attribute value.\n @param {string} attribute\n The attribute name.\n @return {Object|undefined}\n The cast attribute value.\n @stable\n */\n function jsonAttr(element, attribute) {\n return parseAttr(element, attribute, tryParseJSON)\n }\n\n function tryParseJSON(value) {\n if (value?.trim()) {\n return u.parseRelaxedJSON(value)\n }\n }\n\n function closestAttr(element, attr, readAttrFn = stringAttr) {\n let match = element.closest('[' + attr + ']')\n if (match) {\n return readAttrFn(match, attr)\n }\n }\n\n function addClasses(element, classes) {\n // Don't use element.classList.add(...classes) because that sets an empty [class]\n // attribute if classes is an empty array.\n for (let klass of classes) element.classList.add(klass)\n }\n\n /*-\n Temporarily adds a CSS class to the given element.\n\n Returns a function that restores the original class list when called.\n\n ### Example\n\n ```js\n let element = up.element.createFromSelector('.foo')\n element.className // => 'foo'\n\n let undo = up.element.addClassTemp(element, 'bar')\n element.className // => 'foo bar'\n\n undo()\n element.className // result: 'foo'\n ```\n\n @function up.element.addClassTemp\n @param {Element} element\n @param {string} klass\n @return {Function}\n A function that restores the original class list when called.\n @internal\n */\n function addClassTemp(element, klass) {\n return setClassStateTemp(element, klass, true)\n }\n\n function removeClassTemp(element, klass) {\n return setClassStateTemp(element, klass, false)\n }\n\n function setClassStateTemp(element, klass, targetState) {\n if (element.classList.contains(klass) === targetState) return u.noop\n element.classList.toggle(klass, targetState)\n return () => element.classList.toggle(klass, !targetState)\n }\n\n /*-\n Returns [computed CSS styles](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle)\n for the given element.\n\n If a property is not set, it will be returned as an empty string.\n\n ### Examples\n\n When requesting a single CSS property, its value will be returned as a string:\n\n ```js\n let value = up.element.style(element, 'font-size')\n // value is '16px'\n ```\n\n When requesting multiple CSS properties, the function returns an object of property names and values:\n\n ```js\n let value = up.element.style(element, ['font-size', 'margin-top'])\n // value is { 'font-size': '16px', 'margin-top': '10px' }\n ```\n\n @function up.element.style\n @param {Element} element\n @param {string|Array} propOrProps\n One or more CSS property names in kebab-case.\n @return {string|Object}\n The requested style value or values.\n @stable\n */\n function computedStyle(element, props) {\n const style = window.getComputedStyle(element)\n return extractFromStyleObject(style, props)\n }\n\n /*-\n Returns a [computed CSS property value](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle)\n for the given element, cast as a number.\n\n The value is cast by removing the property's [unit](https://www.w3schools.com/cssref/css_units.asp) (which is usually `px` for computed properties).\n The result is then parsed as a floating point number.\n\n Returns `undefined` if the property value is missing. Returns `NaN` if the value cannot be parsed as a number.\n\n ### Examples\n\n ```js\n let value = up.element.style(element, 'font-size')\n // value is '16px'\n\n value = up.element.styleNumber(element, 'font-size')\n // value is 16\n ```\n\n @function up.element.styleNumber\n @param {Element} element\n @param {string} prop\n A single property name in kebab-case.\n @return {number|undefined|NaN}\n The cast property value.\n @stable\n */\n function computedStyleNumber(element, prop) {\n const rawValue = computedStyle(element, prop)\n if (u.isPresent(rawValue)) {\n return parseFloat(rawValue)\n }\n }\n\n /*-\n Gets the given inline style(s) from the given element's `[style]` attribute.\n\n If a property is not set, it will be returned as an empty string.\n\n @function up.element.inlineStyle\n @param {Element} element\n @param {string|Array} propOrProps\n One or more CSS property names in kebab-case.\n @return {string|Object}\n @internal\n */\n function inlineStyle(element, props) {\n const { style } = element\n return extractFromStyleObject(style, props)\n }\n\n function extractFromStyleObject(style, keyOrKeys) {\n if (up.migrate.loaded) keyOrKeys = up.migrate.fixGetStyleProps(keyOrKeys)\n\n if (u.isString(keyOrKeys)) {\n return style.getPropertyValue(keyOrKeys)\n } else { // array\n return u.mapObject(keyOrKeys, (key) => [key, style.getPropertyValue(key)])\n }\n }\n\n /*-\n Sets the given CSS properties as inline styles on the given element.\n\n ## Example\n\n ```js\n up.element.setStyle(element, { color: 'red', 'font-size': '2em' })\n ```\n\n @function up.element.setStyle\n @param {Element} element\n The element on which to change inline styles.\n @param {Object} styles\n One or more CSS properties with kebab-case keys.\n @stable\n */\n function setInlineStyle(element, props, unit = '') {\n if (up.migrate.loaded) props = up.migrate.fixSetStyleProps(props, unit)\n\n if (u.isString(props)) {\n element.setAttribute('style', props)\n } else {\n const { style } = element\n for (let key in props) {\n let value = props[key]\n // value = normalizeStyleValueForWrite(key, value)\n style.setProperty(key, value + unit)\n }\n }\n }\n\n /*-\n Temporarily sets inline CSS styles on the given element.\n\n Returns a function that restores the original inline styles when called.\n\n ### Example\n\n ```js\n let element = document.querySelector('div')\n getComputedStyle(element).fontSize // => '12px'\n\n let undo = up.element.setStyleTemp(element, { 'font-size': '50px' })\n getComputedStyle(element).fontSize // => '50px'\n\n undo()\n getComputedStyle(element).fontSize // result: '12px'\n ```\n\n @function up.element.setStyleTemp\n @param element\n @like up.element.setStyle\n @param styles\n @like up.element.setStyle\n @return {Function()}\n A function that restores the original inline styles when called.\n @internal\n */\n function setStyleTemp(element, newStyles) {\n const oldStyles = inlineStyle(element, Object.keys(newStyles))\n setInlineStyle(element, newStyles)\n return () => setInlineStyle(element, oldStyles)\n }\n\n /*-\n Returns whether the given element is currently visible.\n\n An element is considered visible if it consumes space in the document.\n Elements with `{ visibility: hidden }` or `{ opacity: 0 }` are considered visible since they still consume space in the layout.\n\n Elements not attached to the DOM are considered hidden.\n\n @function up.element.isVisible\n @param {Element} element\n The element to check.\n @return {boolean}\n Whether the given element is visible.\n @stable\n */\n function isVisible(element) {\n // From https://github.com/jquery/jquery/blame/9cb162f6b62b6d4403060a0f0d2065d3ae96bbcc/src/css/hiddenVisibleSelectors.js#L12\n return !!(element.offsetWidth || element.offsetHeight || element.getClientRects().length)\n }\n\n function isUpPrefixed(string) {\n return /^up-/.test(string)\n }\n\n function pickAttrs(element, attrNames) {\n return u.mapObject(attrNames, (name) => [name, element.getAttribute(name)])\n }\n\n function upAttrs(element) {\n let attrNames = element.getAttributeNames().filter(isUpPrefixed)\n return pickAttrs(element, attrNames)\n }\n\n function upClasses(element) {\n return u.filter(element.classList.values(), isUpPrefixed)\n }\n\n /*-\n Returns whether the given element has no content.\n\n An element is considered to have content if it has either child elements or non-whitespace text.\n\n ### Examples\n\n These `<div>` elements are all considered empty:\n\n ```html\n <div></div>\n\n <div> </div>\n\n <div attr=\"text\"></div>\n ```\n\n These `<div>` elements are *not* considered empty:\n\n ```html\n <div>\n Text\n </div>\n\n <div>\n <span>Text</span>\n </div>\n\n <div>\n <span></span>\n </div>\n ```\n\n @function up.element.isEmpty\n @param {Element} element\n @return {boolean}\n Whether the given element is empty.\n @experimental\n */\n function isEmpty(element) {\n return !element.children.length > 0 && !element.innerText.trim()\n }\n\n function crossOriginSelector(attr) {\n return `[${attr}*=\"//\"]:not([${attr}*=\"//${location.host}/\"])`\n }\n\n function isIntersectingWindow(element, { margin = 0 } = {}) {\n const rect = up.Rect.fromElement(element)\n rect.grow(margin)\n\n return (rect.bottom > 0) && (rect.top < window.innerHeight) &&\n (rect.right > 0) && (rect.left < window.innerWidth)\n }\n\n /*-\n ```\n up.element.unionSelector(['input', 'textarea']) // result: ':is(input,textarea)'\n up.element.unionSelector(['input', 'textarea'], undefined) // result: ':is(input,textarea)'\n up.element.unionSelector(['input', 'textarea'], ['.disabled', '[disabled]']) // result: ':is(input,textarea):not(.disabled,[disabled])'\n up.element.unionSelector(['input', 'textarea'], ['.disabled', '[disabled]'], '.active') // result: ':is(input,textarea):not(.disabled,[disabled]):is(.active)'\n ```\n\n @function up.element.unionSelector\n @param {Array<string>} includes\n @param {Array<string>} [excludes]\n @param {string} [condition]\n @internal\n */\n function unionSelector(includes, excludes, condition) {\n let selector = `:is(${includes.join()})`\n if (u.isPresent(excludes)) selector += `:not(${excludes.join()})`\n if (condition) selector += `:is(${condition})`\n return selector\n }\n\n function documentPosition(element) {\n let nextSibling = element.nextElementSibling\n if (nextSibling) {\n return [nextSibling, 'beforebegin']\n } else {\n // We're the only or last child of our parent.\n return [element.parentElement, 'beforeend']\n }\n }\n\n // HTML allows comments before a <!DOCTYPE> or <html> tag (issue #726)\n const FIRST_TAG_NAME_PATTERN = /^\\s*(<!--[^-]*.*?-->\\s*)*<([a-z-!]+)\\b/i\n\n function firstTagNameInHTML(html) {\n return FIRST_TAG_NAME_PATTERN.exec(html)?.[2].toUpperCase()\n }\n\n function isFullDocumentHTML(html) {\n let firstTag = firstTagNameInHTML(html)\n return firstTag === 'HTML' || firstTag === '!DOCTYPE'\n }\n\n function leadingElement(nodes) {\n for (let node of nodes) {\n if (u.isElement(node)) {\n return node\n } else if (u.isTextNode(node) && node.textContent.trim()) {\n return\n } else {\n // Empty text node or comment node. Try the next node.\n }\n }\n }\n\n function removeAttrsFromHTML(html, attrs) {\n let tagPattern = /<[^<]+>/g\n let attrPattern = new RegExp(`\\\\s+(${attrs.join('|')})=\"[^\"]*\"`, 'g')\n let cleanTag = (match) => match.replace(attrPattern, '')\n html = html.replace(tagPattern, cleanTag)\n return html\n }\n\n // Tag names for which trackDefinitions() is already waiting.\n //\n // Unlike all other module state, this is never reset on up:framework:reset.\n // A custom element definition cannot be undone, so forgetting a tag name would only\n // start a second promise for the same definition. A tag name that is never defined\n // (e.g. a custom element that only exists for CSS) leaves one pending promise that\n // references nothing else.\n const awaitedTagNames = new Set()\n\n /*-\n Emits `up:element:defined` when a custom element in the given root gets defined.\n\n Looks for elements in the given root and its descendants that are not yet [defined](https://developer.mozilla.org/en-US/docs/Web/CSS/:defined),\n and waits for their definitions. Each tag name is only awaited once.\n\n Some selectors only match a custom element once it is defined. E.g. a [form-associated custom element](/learn/custom-form-fields#form-associated)\n only matches `:enabled` after `customElements.define()`.\n\n @function up.element.trackDefinitions\n @param {Element} root\n @internal\n */\n function trackDefinitions(root) {\n for (let { localName } of subtree(root, ':not(:defined)')) {\n if (!awaitedTagNames.has(localName)) {\n awaitedTagNames.add(localName)\n customElements.whenDefined(localName).then(() => up.emit('up:element:defined', { localName, log: false }))\n }\n }\n }\n\n /*-\n This event is emitted when a custom element on the page gets defined.\n\n Only tag names that were in a fragment Unpoly compiled before their definition are observed.\n See `up.element.trackDefinitions()`.\n\n @event up:element:defined\n @param {string} event.localName\n The tag name of the custom element that was defined.\n @internal\n */\n\n return {\n subtree,\n subtreeFirst,\n contains,\n closestAttr,\n ancestor,\n around,\n get: getOne,\n list: getList,\n toggle,\n hide,\n hideTemp,\n show,\n showTemp,\n metaContent,\n insertBefore,\n createFromSelector,\n setAttrs,\n setAttrsTemp,\n affix,\n idSelector,\n classSelector,\n isSingleton,\n attrSelector,\n createBrokenDocumentFromHTML,\n revivedClone,\n createNodesFromHTML,\n createFromHTML,\n extractSingular,\n get root() { return getRoot() },\n paint,\n fixedToAbsolute,\n setMissingAttrs,\n setMissingAttr,\n unwrap,\n wrapChildren,\n wrapIfRequired,\n attr: stringAttr,\n booleanAttr,\n numberAttr,\n jsonAttr,\n parseAttr,\n booleanOrStringAttr,\n booleanOrNumberAttr,\n booleanOrNumberOrStringAttr,\n setStyleTemp,\n style: computedStyle,\n styleNumber: computedStyleNumber,\n inlineStyle,\n setStyle: setInlineStyle,\n isVisible,\n upAttrs,\n upClasses,\n setAttrPresence,\n addClasses,\n addClassTemp,\n removeClassTemp,\n parseSelector,\n isEmpty,\n crossOriginSelector,\n isIntersectingWindow,\n unionSelector,\n elementLikeMatches,\n documentPosition,\n isFullDocumentHTML,\n leadingElement,\n removeAttrsFromHTML,\n trackDefinitions,\n }\n})()\n","up.Error = class Error extends window.Error {\n constructor(message, props = {}) {\n if (Array.isArray(message)) {\n message = up.util.sprintf(...message)\n }\n super(message)\n // Minifiers in app bundlers drop class names, but not a string from our tag.\n Object.assign(this, { name: this[Symbol.toStringTag] }, props)\n }\n\n get [Symbol.toStringTag]() { return 'up.Error' }\n}\n","up.NotImplemented = class NotImplemented extends up.Error {\n get [Symbol.toStringTag]() { return 'up.NotImplemented' }\n}\n","// AbortController already throws an abort error, which is really a DOMException(message, 'AbortError')\nup.Aborted = class Aborted extends up.Error {\n constructor(message) {\n super(message, { name: 'AbortError' })\n }\n\n get [Symbol.toStringTag]() { return 'up.Aborted' }\n}\n","up.Blocked = class Blocked extends up.Error {\n get [Symbol.toStringTag]() { return 'up.Blocked' }\n}\n","up.CannotMatch = class CannotMatch extends up.Error {\n get [Symbol.toStringTag]() { return 'up.CannotMatch' }\n}\n","up.CannotParse = class CannotParse extends up.Error {\n get [Symbol.toStringTag]() { return 'up.CannotParse' }\n}\n","up.CannotTarget = class CannotTarget extends up.Error {\n get [Symbol.toStringTag]() { return 'up.CannotTarget' }\n}\n","up.Offline = class Offline extends up.Error {\n get [Symbol.toStringTag]() { return 'up.Offline' }\n}\n","const u = up.util\n\nup.Record = class Record {\n\n keys() {\n throw 'Return an array of keys'\n }\n\n // Return a new object on every call. The constructor copies its top-level properties,\n // but nested values (like an object or array) are shared with the defaults object.\n defaults(_options) {\n return {}\n }\n\n constructor(options) {\n Object.assign(this, u.mergeDefined(this.defaults(options), this.attributes(options)))\n }\n\n attributes(source = this) {\n return u.pick(source, this.keys())\n }\n\n [u.copy.key]() {\n return u.variant(this)\n }\n\n [u.isEqual.key](other) {\n return (this.constructor === other.constructor) && u.isEqual(this.attributes(), other.attributes())\n }\n\n // static is(value) {\n // return value instanceof this\n // }\n\n}\n","const u = up.util\nconst e = up.element\n\nup.Config = class Config {\n\n constructor(label, blueprintFn = (() => ({}))) {\n this._label = label\n this._blueprintFn = blueprintFn\n this._knownKeys = []\n this.reset()\n // Our private properties and the blueprint's keys.\n this._knownKeys.push(...Object.keys(this))\n\n document.addEventListener('up:framework:reset', () => this.reset())\n // We check one task after booting, to also see settings made by up:framework:boot or\n // up:framework:booted listeners, or by compilers on the initial page.\n document.addEventListener('up:framework:boot', () => u.task(() => this.logUnknownKeys()))\n }\n\n // Logs an error for a setting that doesn't exist, e.g. a misspelled or renamed key.\n // This is an error rather than a warning, because an ignored setting may be a security setting.\n // We only check top-level keys: a nested object like up.layer.config.modal may hold any layer option.\n // We only check once, right after booting. Settings made later are not checked.\n //\n // This method is not private because a spec calls it.\n logUnknownKeys() {\n for (let key of Object.keys(this)) {\n if (!this._knownKeys.includes(key)) {\n up.log.error(this._label, 'Ignoring unknown setting %s. Fix its name or remove it.', key)\n }\n }\n }\n\n reset() {\n Object.assign(this, this._blueprintFn())\n }\n\n matches(element, prop, condition) {\n return element?.matches(this.selector(prop, condition))\n }\n\n matchesFn(prop) {\n return (element, condition) => this.matches(element, prop, condition)\n }\n\n selector(prop, condition = '') {\n let includes = this[prop]\n let excludes = this['no' + u.upperCaseFirst(prop)]\n return e.unionSelector(includes, excludes, condition)\n }\n\n selectorFn(prop) {\n return (condition) => this.selector(prop, condition)\n }\n\n selectorFns(prop) {\n return [this.selectorFn(prop), this.matchesFn(prop)]\n }\n}\n","let enabledKey = 'up.log.enabled'\nlet enabled = false\n\ntry {\n // All supported browsers have sessionStorage, but the property is `null`\n // in private browsing mode in Safari and the default Android webkit browser.\n // See https://makandracards.com/makandra/32865-sessionstorage-per-window-browser-storage\n enabled = !!sessionStorage?.getItem(enabledKey)\n} catch {\n // Chrome explodes upon access of window.sessionStorage when\n // user blocks third-party cookies and site data and this page is embedded\n // as an <iframe>. See https://bugs.chromium.org/p/chromium/issues/detail?id=357625\n}\n\nup.LogConfig = class LogConfig extends up.Config {\n\n constructor() {\n super('up.log.config', () => ({\n banner: true,\n // Console styles are only useful for humans. A browser controlled by automation software\n // (Selenium, Playwright, Puppeteer) usually feeds the log into a test runner or agent.\n format: !navigator.webdriver,\n }))\n }\n\n get enabled() {\n return enabled\n }\n\n set enabled(newEnabled) {\n enabled = newEnabled\n try {\n sessionStorage?.setItem(enabledKey, newEnabled ? '1' : '')\n } catch {\n // If sessionStorage is now available (see above) we only update the local variable `enabled`.\n // This will cause state to be lost on the next reload.\n }\n }\n\n}\n","const u = up.util\n\nup.Registry = class Registry {\n constructor(valueDescription, normalize = u.identity) {\n this._data = {}\n this._normalize = normalize\n this._valueDescription = valueDescription\n this.put = this.put.bind(this)\n document.addEventListener('up:framework:reset', () => this.reset())\n }\n\n put(key, object) {\n object = this._normalize(object)\n object.isDefault = up.framework.evaling\n this._data[key] = object\n }\n\n get(name) {\n return this._data[name] || up.fail(\"Unknown %s %o\", this._valueDescription, name)\n }\n\n reset() {\n this._data = u.pickBy(this._data, 'isDefault')\n }\n\n}\n","const u = up.util\nconst e = up.element\n\nup.OptionsParser = class OptionsParser {\n\n /*-\n @constructor up.OptionsParser\n @param {Object} options\n Explicit options passed by a programmatic caller. These usually override everything.\n\n All parsed options are assigned to this given `options` argument.\n @param {Element} element\n An element from which to parse `[up-attr]` attributes.\n @param {boolean} parserOptions.fail\n Whether to automatically parse `[up-fail-attr]` into `{ failAttr }` option.\n @param {boolean} parserOptions.closest\n Whether to also look for `[up-attr]` matches in the descendants of `element`.\n @param {Object} parserOptions.defaults\n An object of default key/values if an option can neither be found in `options`\n nor can be parsed from `element`.\n @internal\n */\n constructor(element, options, parserOptions = {}) {\n this._options = options\n this._element = element\n this._fail = parserOptions.fail\n this._closest = parserOptions.closest\n this._attrPrefix = parserOptions.attrPrefix || 'up-'\n this._defaults = parserOptions.defaults ?? {}\n }\n\n string(key, keyOptions) {\n this.parse(e.attr, key, keyOptions)\n }\n\n boolean(key, keyOptions) {\n this.parse(e.booleanAttr, key, keyOptions)\n }\n\n number(key, keyOptions) {\n this.parse(e.numberAttr, key, keyOptions)\n }\n\n booleanOrString(key, keyOptions) {\n this.parse(e.booleanOrStringAttr, key, keyOptions)\n }\n\n booleanOrNumber(key, keyOptions) {\n this.parse(e.booleanOrNumberAttr, key, keyOptions)\n }\n\n booleanOrNumberOrString(key, keyOptions) {\n this.parse(e.booleanOrNumberOrStringAttr, key, keyOptions)\n }\n\n json(key, keyOptions) {\n this.parse(e.jsonAttr, key, keyOptions)\n }\n\n // // Currently not needed anywhere\n // callback(key, keyOptions = {}) {\n // let attrReader = (link, attr) => e.callbackAttr(link, attr, keyOptions)\n // this.parse(attrReader, key, keyOptions)\n // }\n\n renderCallback(key, keyOptions = {}) {\n let attrReader = (link, attr) => up.RenderOptions.callbackAttr(link, attr, key)\n this.parse(attrReader, key, keyOptions)\n }\n\n parse(attrReader, key, keyOptions = {}) {\n const attrNames = u.wrapList(keyOptions.attr ?? this._attrNameForKey(key))\n\n // Below we will only set @options[key] = value if value is defined.\n let value = this._options[key]\n\n for (let attrName of attrNames) {\n value ??= this._parseFromAttr(attrReader, this._element, attrName)\n }\n\n if (this._defaults !== false) {\n value ??= keyOptions.default ?? this._defaults[key]\n }\n\n if (u.isDefined(value)) {\n let normalizeFn = keyOptions.normalize\n if (normalizeFn) {\n value = normalizeFn(value)\n }\n\n this._options[key] = value\n }\n\n let failKey\n if (this._fail && (failKey = up.fragment.failKey(key))) {\n const failAttrNames = u.compact(u.map(attrNames, (attrName) => this._deriveFailAttrName(attrName)))\n this.parse(attrReader, failKey, { ... keyOptions, attr: failAttrNames })\n }\n }\n\n include(optionsFn, parserOptions) {\n // let fnResult = optionsFn(this._element, this._options, this._parserOptions)\n let fnResult = optionsFn(this._element, this._options, { defaults: this._defaults, ...parserOptions })\n Object.assign(this._options, fnResult)\n }\n\n _parseFromAttr(attrValueFn, element, attrName) {\n if (this._closest) {\n return e.closestAttr(element, attrName, attrValueFn)\n } else {\n return attrValueFn(element, attrName)\n }\n }\n\n _deriveFailAttrName(attr) {\n return this._deriveFailAttrNameForPrefix(attr, this._attrPrefix + 'on-') ||\n this._deriveFailAttrNameForPrefix(attr, this._attrPrefix)\n }\n\n _deriveFailAttrNameForPrefix(attr, prefix) {\n if (attr.startsWith(prefix)) {\n return `${prefix}fail-${attr.substring(prefix.length)}`\n }\n }\n\n _attrNameForKey(option) {\n return `${this._attrPrefix}${u.camelToKebabCase(option)}`\n }\n}\n","const u = up.util\n\nup.FIFOCache = class FIFOCache {\n\n constructor({ capacity = 10, normalizeKey = u.identity } = {}) {\n this._map = new Map()\n this._capacity = capacity\n this._normalizeKey = normalizeKey\n }\n\n get(key) {\n key = this._normalizeKey(key)\n return this._map.get(key)\n }\n\n set(key, value) {\n if (this._map.size === this._capacity) {\n let oldestKey = this._map.keys().next().value\n this._map.delete(oldestKey)\n }\n\n key = this._normalizeKey(key)\n this._map.set(key, value)\n }\n\n clear() {\n this._map.clear()\n }\n\n}\n","up.Rect = class Rect extends up.Record {\n\n keys() {\n return [\n 'left',\n 'top',\n 'width',\n 'height'\n ]\n }\n\n get bottom() {\n return this.top + this.height\n }\n\n get right() {\n return this.left + this.width\n }\n\n grow(padding) {\n this.left -= padding\n this.top -= padding\n this.width += padding * 2\n this.height += padding * 2\n }\n\n static fromElement(element) {\n return new (this)(element.getBoundingClientRect())\n }\n\n static fromElementAsFixed(element) {\n // We create a clone with `position: fixed` instead of temporarily setting the position: fixed.\n // This avoids re-layouting any elements below `element` in the DOM.\n // The clone should be rendered on its own compositing layer.\n let fixedClone = element.cloneNode(true)\n element.after(fixedClone)\n fixedClone.style.position = 'fixed'\n let rect = this.fromElement(fixedClone)\n fixedClone.remove()\n return rect\n }\n\n}\n","const e = up.element\nconst u = up.util\nconst SHIFT_CLASS = 'up-scrollbar-away'\n\n// Gives `<body>` a right padding in the width of a scrollbar.\n// Also gives elements anchored to the right side of the screen\n// an increased `right`.\n//\n// This is to prevent the body and elements from jumping when we add the\n// modal overlay, which has its own scroll bar.\n// This is screwed up, but Bootstrap does the same.\nup.BodyShifter = class BodyShifter {\n\n constructor() {\n this._anchoredElements = new Set()\n this._stack = 0\n this._cleaner = u.cleaner()\n }\n\n lowerStack() {\n if (--this._stack === 0) this._unshiftNow()\n }\n\n raiseStack() {\n if (++this._stack === 1) this._shiftNow()\n }\n\n onAnchoredElementInserted(element) {\n this._anchoredElements.add(element)\n\n // If the new element was inserted after we shifted, we must now shift its { right }.\n this._shiftElement(element, 'right')\n\n // Destructor\n return () => this._anchoredElements.delete(element)\n }\n\n _isShifted() {\n // If the scrollbar never took space away from the main viewport's client width,\n // we do not need to change any styles.\n return this._stack > 0\n }\n\n _shiftNow() {\n // Remember whether the root viewport has a visible scrollbar at rest.\n // It will disappear when we set overflow-y: hidden below.\n this._rootScrollbarWidth = up.viewport.rootScrollbarWidth()\n\n // Always publish on the <html> element for consistency, even if the scrolling element\n // is sometimes <body>. The property will be inherited\n this._cleaner(e.setStyleTemp(e.root, {\n '--up-scrollbar-width': this._rootScrollbarWidth + 'px'\n }))\n\n this._shiftElement(document.body, 'padding-right')\n\n for (let element of this._anchoredElements) {\n this._shiftElement(element, 'right')\n }\n }\n\n _unshiftNow() {\n this._cleaner.clean()\n }\n\n _shiftElement(element, styleProp) {\n if (!this._isShifted()) return\n\n // viewport.sass wants to add the scrollbar with to the value, so we store it in a separate property.\n let originalValue = e.style(element, styleProp)\n\n this._cleaner(\n e.setStyleTemp(element, { ['--up-original-' + styleProp]: originalValue }),\n e.addClassTemp(element, SHIFT_CLASS),\n )\n }\n\n}\n","up.Change = class Change {\n\n constructor(options) {\n this.options = options\n }\n\n execute() {\n throw new up.NotImplemented()\n }\n\n deriveFailOptions() {\n // This will merge shared keys and unprefix failKeys.\n return up.RenderOptions.deriveFailOptions(this.options)\n }\n\n}\n","const u = up.util\nconst e = up.element\n\nup.Change.Addition = class Addition extends up.Change {\n\n constructor(options) {\n super(options)\n this._acceptLayer = options.acceptLayer\n this._dismissLayer = options.dismissLayer\n this._eventPlans = options.eventPlans || []\n this._response = options.response\n }\n\n // TODO: Consider moving this to up.Layer.Base\n handleLayerChangeRequests(newElements, newLocation) {\n if (this.layer.isOverlay()) {\n // TODO: Can we do this with \"close\"? Please recheck\n\n // The server may send an HTTP header `X-Up-Accept-Layer: value`\n this._tryAcceptLayerFromServer()\n this.layer.assertAlive()\n\n // A close condition { acceptLocation: '/path' } might have been\n // set when the layer was opened.\n this.layer.tryAcceptForLocation(newLocation, this._response)\n this.layer.assertAlive()\n\n this.layer.tryAcceptForElements(newElements, this._response)\n this.layer.assertAlive()\n\n // The server may send an HTTP header `X-Up-Dismiss-Layer: value`\n this._tryDismissLayerFromServer()\n this.layer.assertAlive()\n\n // A close condition { dismissLocation: '/path' } might have been\n // set when the layer was opened.\n this.layer.tryDismissForLocation(newLocation, this._response)\n this.layer.assertAlive()\n\n this.layer.tryDismissForElements(newElements, this._response)\n this.layer.assertAlive()\n }\n\n // On the server we support up.layer.emit('foo'), which sends:\n //\n // X-Up-Events: [{ layer: 'current', type: 'foo'}]\n //\n // We must set the current layer to @layer so { layer: 'current' } will emit on\n // the layer that is being updated, instead of the front layer.\n //\n // A listener to such a server-sent event might also close the layer.\n this.layer.asCurrent(() => {\n for (let eventPlan of this._eventPlans) {\n up.emit({ ...eventPlan, response: this._response })\n this.layer.assertAlive()\n }\n })\n }\n\n _tryAcceptLayerFromServer() {\n // When accepting without a value, the server will send X-Up-Accept-Layer: null\n if (u.isDefined(this._acceptLayer)) {\n this.layer.accept(this._acceptLayer, { response: this._response })\n }\n }\n\n _tryDismissLayerFromServer() {\n // When dismissing without a value, the server will send X-Up-Dismiss-Layer: null\n if (u.isDefined(this._dismissLayer)) {\n this.layer.dismiss(this._dismissLayer, { response: this._response })\n }\n }\n\n _setSource({ oldElement, newElement, source }) {\n // (1) When the server responds with an error, or when the request method is not\n // reloadable (not GET), we keep the same source as before.\n // (2) Don't set a source if someone tries to 'keep' when opening a new layer\n if (source === 'keep') {\n source = (oldElement && up.fragment.source(oldElement))\n }\n\n // (1) Don't set a source if { false } is passed.\n // (2) Don't set a source if the element HTML already has an [up-source] attribute.\n // (3) Don't use u.matchableURL() here. We need to keep a trailing slash\n // to support backends that care about trailing slashes.\n if (source) {\n e.setMissingAttr(newElement, 'up-source', up.fragment.normalizeSource(source))\n }\n }\n\n _setTime({ newElement, time }) {\n // If the server didn't send a Last-Modified header, tag the element\n // with [up-time=false] to indicate that we cannot use an ancestor's [up-time].\n e.setMissingAttr(newElement, 'up-time', time ? time.toUTCString() : false)\n }\n\n _setETag({ newElement, etag }) {\n // If the server didn't send an Etag header, tag the element\n // with [up-etag=false] to indicate that we cannot use an ancestor's [up-etag].\n e.setMissingAttr(newElement, 'up-etag', etag || false)\n }\n\n setReloadAttrs(options) {\n this._setSource(options)\n this._setTime(options)\n this._setETag(options)\n }\n\n executeSteps({ steps, responseDoc, noneOptions }) {\n return new up.Change.UpdateSteps({ steps, noneOptions }).execute(responseDoc)\n }\n\n}\n","const u = up.util\n\n/*-\nA queued render task.\n\nRendering functions like `up.render()` or `up.submit()` return an `up.RenderJob`.\nCallers can inspect the job's [render options](/api/up.RenderJob.prototype.renderOptions) or [`await` its completion](/learn/render-lifecycle#running-code-after-rendering).\n\nSee [render hooks](/learn/render-lifecycle) for examples of awaiting rendering completion\nand how to handle errors.\n\n## Example\n\n```js\nlet job = up.render('.foo', { url: '/users' })\nconsole.log(job.renderOptions.target) // logs \".foo\"\nconsole.log(job.renderOptions.url) // logs \"/users\"\nlet renderResult = await job // fragments were updated\nconsole.log(renderResult.fragment) // logs the updated fragment\nlet finalResult = await job.finished // animations are done and cached content was revalidated\nconsole.log(finalResult.fragment) // logs the revalidated fragment\n```\n\n@class up.RenderJob\n@parent up.fragment\n*/\nup.RenderJob = class RenderJob {\n\n constructor(renderOptions) {\n this.renderOptions = renderOptions\n }\n\n execute() {\n this._rendered = this._executePromise()\n return this\n }\n\n /*-\n The [render options](/api/up.render#parameters) for this job.\n\n @property up.RenderJob#renderOptions\n @param {Object} renderOptions\n @stable\n */\n\n async _executePromise() {\n try {\n this._emitGuardEvent()\n\n // Do this after emitting { guardEvent }, in case listeners want to augment render options\n // that are shortcuts (e.g. { layer: 'new modal' }) or that affect other options.\n this.renderOptions = up.RenderOptions.preprocess(this.renderOptions)\n\n // Throw if { confirm } is given and the user rejects the dialog.\n // Do this after emitting { guardEvent }, in case listeners want to augment render options.\n up.browser.assertConfirmed(this.renderOptions)\n\n // Ensure we have either { url, content, fragment, document } option.\n // Do this after emitting { guardEvent }, in case listeners want to augment render options.\n up.RenderOptions.assertContentGiven(this.renderOptions)\n\n // TODO: Should the change always return a successful result for easier handling here, and we then throw on !result.ok?\n\n let result = await this._getChange().execute()\n this._handleResult(result)\n return result\n } catch (resultOrError) {\n this._handleResult(resultOrError) || this._handleError(resultOrError)\n throw resultOrError\n }\n }\n\n _handleResult(result) {\n // There may be multiple reasons why `result` is not an up.RenderResult:\n //\n // (1) There was an error during the request (return value is up.Offline, up.Aborted, etc.)\n // (2) No fragment could be matched (return value is up.CannotMatch)\n // (3) We're preloading (early return value is up.Request)\n if (result instanceof up.RenderResult) {\n let { onRendered, onFinished } = result.renderOptions\n\n // We call result.renderOptions.onRendered() instead of this.renderOptions.onRendered()\n // as this will call the correct options.onRendered() or onFailRendered()\n // depending on options.failOptions.\n if (!result.none) up.error.guard(() => onRendered?.(result))\n\n // Run an { onFinished } callback if revalidation succeeds.\n // There is no callback for a failed revalidation.\n //\n // After an error response, this.finished rejects with the failed up.RenderResult.\n // We run its { onFinished } (the user's { onFailFinished }) then.\n //\n // We need to pay attention to not creating unnecessary promises that will fail with unhandled rejections:\n //\n // (1) Only access result.finished through this.finished to avoid creating new promises\n // (2) The then() will create a new chain, and we don't want to fail that\n\n let guardedOnFinished = function(result) {\n up.error.guard(() => onFinished?.(result))\n }\n\n // Ignoring other rejections prevents Chrome from logging an `unhandledrejection` event\n // to the error console, hiding details about a failed revalidation. We could fix this by\n // handling errors with `up.error.throwCritical` instead.\n //\n // However, handling errors with `up.error.throwCritical` will cause Safari (not Chrome)\n // to emit an `unhandledrejection` event whenever there is a critical error, even if there are\n // other error handlers registered via `job.finished.catch()`.\n //\n // I think Safari is in the right here, as every individual `then()` chain should require\n // an error handler or log an `unhandledrejection` event when an error is thrown. However I cannot\n // find a solution that has the same behavior in both Safari and Chrome.\n //\n // Although Chrome will fail to log error traces that way, we still log the error name and message\n // in _handleError().\n this.finished.then(guardedOnFinished, (reason) => !result.ok && reason instanceof up.RenderResult && guardedOnFinished(reason))\n\n return true\n }\n }\n\n _handleError(error) {\n let prefix = error instanceof up.Aborted ? 'Rendering was aborted' : 'Error while rendering'\n up.puts('up.render()', `${prefix}: ${error.name}: ${error.message}`)\n up.error.guard(() => this.renderOptions.onError?.(error))\n }\n\n /*-\n A promise that fulfills when fragments were updated and all [postprocessing steps](/learn/render-lifecycle#postprocessing) have concluded.\n\n The promise will reject when the server responds with an [HTTP error status](/learn/error-responses),\n when any request is [aborted](/learn/aborting-requests) or when there is a [network issue](/learn/network-issues).\n\n See [render hooks](/learn/render-lifecycle) for examples for awaiting rendering completion.\n\n @property up.RenderJob#finished\n @param {Promise<up.RenderResult>} finished\n The [revalidated](/learn/caching#revalidation) render result.\n @stable\n */\n get finished() {\n return this._awaitFinished()\n }\n\n // Method is memoized below\n async _awaitFinished() {\n try {\n let result = await this._rendered\n return await result.finished\n } catch (error) {\n if (error instanceof up.RenderResult) {\n throw await error.finished\n } else {\n // Fatal error, not a failure result.\n throw error\n }\n }\n }\n\n _getChange() {\n // (1) With a given { url } we want to handle { abort } when the new request is known.\n // This way we can exclude the new request from aborting.\n // The { handleAbort } callback is called in up.Change.FromURL#_onRequestProcessed()\n // (2) When rendering local content, we want to handle { abort } when we render.\n // This way we don't abort when the pass was aborted by { guardEvent }, { confirm }\n // or any other error on the way.\n // The { handleAbort } callback is called in up.Change.FromContent#_onPlanApplicable()\n // (3) FromURL is eventually going to call FromContent.\n // We memoize the callback so we only run it once.\n let handleAbort = u.memoize((request) => this._handleAbortOption(request))\n let renderOptions = { ...this.renderOptions, handleAbort }\n\n if (renderOptions.url) {\n return new up.Change.FromURL(renderOptions)\n } else if (renderOptions.response) {\n return new up.Change.FromResponse(renderOptions)\n } else {\n return new up.Change.FromContent(renderOptions)\n }\n }\n\n _emitGuardEvent() {\n let guardEvent = u.pluckKey(this.renderOptions, 'guardEvent')\n if (guardEvent) {\n // Allow guard event handlers to manipulate render options for the default behavior.\n //\n // Note that we have removed { guardEvent } from options to not recursively define\n // guardEvent.renderOptions.guardEvent. This would cause an infinite loop for event\n // listeners that prevent the default and re-render.\n guardEvent.renderOptions = this.renderOptions\n if (up.emit(guardEvent, { target: this.renderOptions.origin }).defaultPrevented) {\n throw new up.Aborted(`Rendering was prevented by ${guardEvent.type} listener`)\n }\n }\n }\n\n _handleAbortOption({ bindFragments, bindLayer, origin, layer, request }) {\n // When preloading up.RenderOptions forces { abort: false }.\n let { abort } = this.renderOptions\n\n // The only case where we don't call up.fragment.abort() is with { abort: false }.\n // Even with no requests in flight we will call up.fragment.abort(),\n // so non-network async jobs can wait for up:fragment:aborted as an aborting signal.\n if (!abort) return\n\n let abortOptions = {\n except: request, // don't abort the request we just made\n logOnce: ['up.render()', 'Change with { abort } option will abort other requests'],\n newLayer: (layer === 'new'),\n origin,\n jid: this.renderOptions.jid,\n }\n\n if (abort === 'target') {\n // Abort requests in the subtree of the targeted fragment\n up.fragment.abort(bindFragments, { ...abortOptions })\n } else if (abort === 'layer') {\n // Abort requests targeting any fragment in the targeted layer\n up.fragment.abort({ ...abortOptions, layer: bindLayer })\n } else if (abort === 'all' || abort === true) {\n // Abort requests targeting any fragment in any layer\n up.fragment.abort({ ...abortOptions, layer: 'any' })\n } else if (u.isFunction(abort)) {\n // Required by unpoly-migrate to convert { solo: URLPatternString } and { solo: Function(up.Request): boolean }.\n // We don't advertise this variant as aborting arbitrary requests cannot support\n // up:fragment:aborted events or the up.fragment.onAborted() function.\n abort(abortOptions)\n } else {\n // (1) Abort requests in the subtree of a given selector (string)\n // (2) Abort requests targeting a given element\n up.fragment.abort(abort, { ...abortOptions, layer: bindLayer })\n }\n }\n\n /*-\n An `up.RenderJob` is also a promise for its completion.\n\n The promise is *fulfilled* with an `up.RenderResult` when a fragment\n was updated from a successful server response.\n\n The promise will *reject* for responses with an [HTTP error status](/learn/error-responses),\n when the request is [aborted](/learn/aborting-requests), or when there is a\n [network issue](/learn/network-issues).\n\n See [render hooks](/learn/render-lifecycle) for examples of awaiting rendering completion\n and how to handle errors.\n\n @function up.RenderJob#then\n @param {Function(up.RenderResult)} onFulfilled\n @param {Function(up.RenderResult|Error)} onRejected\n @return {Promise<up.RenderResult>}\n A promise that fulfills with an `up.RenderResult` once the page has been updated.\n @stable\n */\n static {\n // A request is also a promise (\"thenable\") for its initial render pass.\n u.delegatePromise(this.prototype, function() { return this._rendered })\n\n u.memoizeMethod(this.prototype, {\n _awaitFinished: true,\n _getChange: true,\n })\n }\n\n}\n","up.Change.DestroyFragment = class DestroyFragment extends up.Change {\n\n constructor(options) {\n super(options)\n this._layer = up.layer.get(options) || up.layer.current\n this._element = this.options.element\n this._animation = this.options.animation\n this._log = this.options.log\n }\n\n execute() {\n // Destroying a fragment is a sync function.\n //\n // A variant of the logic below can also be found in up.Change.UpdateLayer.\n // Updating (swapping) a fragment also involves destroying the old version,\n // but the logic needs to be interwoven with the insertion logic for the new\n // version.\n\n // Save the parent because we emit up:fragment:destroyed on the parent\n // after removing @element.\n this._parent = this._element.parentNode\n\n // The destroying fragment gets an .up-destroying class so we can\n // recognize elements that are being destroyed but are still playing out their\n // removal animation.\n up.fragment.markAsDestroying(this._element)\n\n up.animate(this._element, this._animation, up.RenderOptions.chainCallbacks(this.options, {\n onFinished: () => {\n this._erase()\n this._emitDestroyed()\n }\n }))\n }\n\n _erase() {\n this._layer.asCurrent(() => {\n up.fragment.abort(this._element)\n up.script.clean(this._element, { layer: this._layer })\n this._element.remove()\n })\n }\n\n _emitDestroyed() {\n up.fragment.emitDestroyed(this._element, { parent: this._parent, log: this._log })\n }\n\n}\n","let u = up.util\n\nup.Change.OpenLayer = class OpenLayer extends up.Change.Addition {\n\n constructor(options) {\n super(options)\n this.target = options.target\n this._origin = options.origin\n this._baseLayer = options.baseLayer\n // Don't extract too many @properties from @options, since listeners\n // to up:layer:open may modify layer options.\n }\n\n getPreflightProps() {\n // We assume that the server will respond with our target.\n // Hence this change will always be applicable.\n\n return {\n mode: this.options.mode,\n context: this._buildLayer().context,\n origin: this.options.origin,\n\n // The target will always exist in the current page, since\n // we're opening a new layer that will match the target.\n target: this.target,\n\n // We associate this request to our base layer so up:request events may be emitted on something\n // more specific than the document. This will also abort this request when\n // `up.fragment.abort({ layer })` is called for the base layer.\n bindLayer: this._baseLayer,\n layer: 'new',\n\n // We associate this request with the base layer's main element. This way the request\n // will be aborted if the base layer receives a major navigation, but not when a\n // minor fragment is updated.\n bindFragments: u.compact([up.fragment.get(':main', { layer: this._baseLayer })]),\n fragments: [],\n }\n }\n\n execute(responseDoc, onApplicable) {\n // Find our target in the responseDoc.\n // If it cannot be matched, up.CannotMatch is thrown and up.Change.FromContent will try the next plan.\n this._matchPostflight(responseDoc)\n\n // If our steps can be matched, up.Change.FromContent wants a chance to some final\n // preparations before we start rendering.\n onApplicable()\n\n // Create the overlay elements, but don't render content yet.\n // This sets this.layer.\n this._createOverlay()\n\n // If our layer ends up being closed during rendering, we still want to render\n // [up-hungry][up-if-layer=any] elements on other layers.\n let renderOtherLayersOnce = u.memoize(() => this._renderOtherLayers(responseDoc))\n let unbindClosing = this.layer.on('up:layer:accepting up:layer:dismissing', renderOtherLayersOnce)\n\n try {\n let partialResults = [\n this._renderOverlayContent(responseDoc),\n ...renderOtherLayersOnce(),\n ]\n\n return new up.RenderResult({\n layer: this.layer,\n target: this.target,\n renderOptions: this.options,\n partialResults,\n })\n } finally {\n unbindClosing()\n }\n }\n\n _matchPostflight(responseDoc) {\n if (this.target === ':none') {\n this._content = document.createElement('up-none')\n } else {\n this._content = responseDoc.select(this.target)\n }\n\n if (!this._content || !this._baseLayer.isAlive()) {\n // An error message will be chosen by up.Change.FromContent\n throw new up.CannotMatch()\n }\n }\n\n _createOverlay() {\n up.puts('up.render()', `Opening element \"${this.target}\" in new overlay`)\n\n this._assertOpenEventEmitted()\n\n this.layer = this._buildLayer()\n\n // (1) Make sure that the baseLayer layer doesn't already have a child layer.\n // This cannot be prevented with { peel: false }, as the layer stack must be a sequence,\n // not a tree.\n //\n // (2) Only restore the base layer's history if the new overlay does not add one of its own.\n // Otherwise we would add an intermediate history entries when swapping overlays\n // with { layer: 'swap' } (issue #397).\n this._baseLayer.peel({ history: !this.layer.history, intent: this.options.peel })\n\n // (1) The parent's saved history will be restored when this new overlay is closed.\n // (2) Save the parent's history as long as it is the topmost layer in the stack,\n // otherwise parent.showsLiveHistory(aspect) becomes false for every aspect.\n this._baseLayer.saveHistory()\n\n // Don't wait for peeling to finish. Change the stack sync so there is no state\n // when the new overlay is scheduled to be pushed, but not yet in the stack.\n up.layer.stack.push(this.layer)\n\n this.layer.createElements()\n this.layer.setupHandlers()\n }\n\n _renderOverlayContent(responseDoc) {\n // The server may trigger multiple signals that may cause the overlay to close immediately:\n //\n // - Close the layer directly through X-Up-Accept-Layer or X-Up-Dismiss-Layer\n // - Emit an event with X-Up-Events, to which a listener may close the layer\n // - Update the location to a URL for which { acceptLocation } or { dismissLocation }\n // will close the layer.\n //\n // Note that @handleLayerChangeRequests() also throws an up.Aborted error\n // if any of these options cause the layer to close.\n this.handleLayerChangeRequests([this._content], this._getNewLocation())\n\n // Preprocess content element before insertion.\n responseDoc.commitElement(this._content)\n\n // Only if handleLayerChangeRequests() does not abort, we insert the content in the overlay.\n // If it does abort we want to use the content for [up-hungry][up-if-layer=any] elements\n // on background layers.\n this.layer.setContent(this._content)\n\n // Adopt CSP nonces and fix broken script tags\n responseDoc.finalizeElement(this._content)\n\n // Change history before compilation, so new fragments see the new location.\n this._handleHistory()\n\n // Remember where the element came from to support up.reload(element).\n this.setReloadAttrs({ newElement: this._content, source: this.options.source })\n\n // Start compilation in the sync phase of postprocessing.\n let compilePromise = this._compileLayer()\n\n // A11Y: Place the focus on the overlay element and setup a focus circle.\n this._handleFocus()\n\n // Don't wait for the open animation to finish.\n // Otherwise a popup would start to open and only reveal itself after the animation.\n this._handleScroll()\n\n // Emit up:layer:opened to indicate that the layer was opened successfully.\n // This is a good time for listeners to manipulate the overlay optics.\n this.layer.state = 'opened'\n this._emitOpenedEvent()\n\n // In case a listener to up:layer:opened immediately dismisses the new layer,\n // reject the promise returned by up.layer.open().\n this.layer.assertAlive()\n\n let animatePromise = this.layer.startOpenAnimation()\n\n return {\n fragments: [this._content],\n finished: Promise.all([compilePromise, animatePromise]),\n verifyFinished: () => this.layer.assertAlive()\n }\n }\n\n _renderOtherLayers(responseDoc) {\n // We execute steps on other layers after this layer. However, if the render pass ends up\n // closing this layer (e.g. by reaching a close condition or X-Up-Accept-Layer), we execute them\n // before the layer closes (see execute()). This way we can:\n //\n // (1) ... use the discarded content for hungry elements on other layers that have [up-if-layer=any].\n // (2) ... see updated hungry elements on other layers in onDismissed/onAccepted handlers.\n let steps = this._getHungrySteps().other\n return this.executeSteps({ steps, responseDoc })\n }\n\n async _compileLayer() {\n // Compile the entire layer, not just the user content.\n // E.g. [up-dismiss] in the layer elements needs to go through a macro.\n await up.hello(this.layer.element, {\n ...this.options,\n layer: this.layer,\n dataRoot: this._content\n })\n }\n\n _buildLayer() {\n const beforeNew = (optionsWithLayerDefaults) => {\n return this.options = up.RenderOptions.finalize(optionsWithLayerDefaults)\n }\n\n return up.layer.build(this.options, beforeNew)\n }\n\n _handleHistory() {\n // If the layer is opened with { history } auto, the new overlay will from now\n // on have visible history *if* its initial fragment has auto-history.\n if (this.layer.history === 'auto') {\n this.layer.history = up.fragment.hasAutoHistory([this._content], this.layer)\n }\n\n // If an ancestor layer was opened with the wish to not affect history, this\n // child layer must not affect it either, regardless of its @history setting.\n this.layer.history &&= this._baseLayer.history\n\n // For the initial fragment insertion we always update its location, even if the layer\n // does not have visible history ({ history } attribute). This ensures that a\n // layer always has a #location.\n this.layer.updateHistory(this._getEffectiveHistoryOptions())\n }\n\n _handleFocus() {\n this._baseLayer.overlayFocus?.moveToBack()\n this.layer.overlayFocus.moveToFront()\n\n const fragmentFocus = new up.FragmentFocus({\n fragment: this._content,\n layer: this.layer,\n autoMeans: ['autofocus', 'layer'],\n inputDevice: this.options.inputDevice,\n focusVisible: this.options.focusVisible,\n })\n\n fragmentFocus.process(this.options.focus)\n }\n\n _handleScroll() {\n const scrollingOptions = {\n ...this.options,\n fragment: this._content,\n layer: this.layer,\n autoMeans: ['hash', 'layer']\n }\n const scrolling = new up.FragmentScrolling(scrollingOptions)\n scrolling.process(this.options.scrollMap ?? this.options.scroll)\n }\n\n _assertOpenEventEmitted() {\n // The initial up:layer:open event is emitted on the document, since the layer\n // element has not been attached yet and there is no obvious element it should\n // be emitted on. We don't want to emit it on @layer.parent.element since users\n // might confuse this with the event for @layer.parent itself opening.\n //\n // There is no { onOpen } or [up-on-open] handler to accompany the DOM event.\n up.event.assertEmitted('up:layer:open', {\n origin: this._origin,\n baseLayer: this._baseLayer, // sets up.layer.current\n layerOptions: this.options,\n log: \"Opening new overlay\"\n })\n }\n\n _emitOpenedEvent() {\n this.layer.emit('up:layer:opened', {\n origin: this._origin,\n callback: this.layer.callback('onOpened'),\n log: `Opened new ${this.layer}`\n }\n )\n }\n\n _getHungrySteps() {\n return up.radio.hungrySteps(this._getEffectiveRenderOptions())\n }\n\n _getEffectiveRenderOptions() {\n return {\n ...this.options,\n layer: this.layer,\n history: this.layer.history,\n }\n }\n\n _getEffectiveHistoryOptions() {\n // For the initial fragment insertion we always update its location, even if the layer\n // does not have visible history ({ history } attribute). This ensures that a\n // layer always has a #location.\n return up.history.options(this.options)\n }\n\n _getNewLocation() {\n return this._getEffectiveRenderOptions().location\n }\n\n}\n","const u = up.util\n\nup.Change.UpdateLayer = class UpdateLayer extends up.Change.Addition {\n\n constructor(options) {\n options = up.RenderOptions.finalize(options)\n super(options)\n this.layer = options.layer\n this.target = options.target\n this._context = options.context\n // up.fragment.expandTargets() was already called by up.Change.FromContent\n this._steps = up.fragment.parseTargetSteps(this.target, this.options)\n // this.uid = Math.random()\n }\n\n getPreflightProps() {\n // This will throw up.CannotMatch if { target } cannot be found in { layer }.\n this._matchPreflight()\n\n let fragments = this._getFragments()\n\n return {\n layer: this.layer,\n bindLayer: this.layer,\n mode: this.layer.mode,\n context: u.merge(this.layer.context, this._context),\n origin: this.options.origin,\n target: this._bestPreflightSelector(),\n fragments,\n bindFragments: fragments,\n }\n }\n\n _bestPreflightSelector() {\n this._matchPreflight()\n\n const isProbable = (step) => !step.maybe || step.oldElement?.isConnected\n let bestSteps = this._steps.filter(isProbable)\n let selectors = u.map(bestSteps, 'selector')\n return selectors.join(', ') || ':none'\n }\n\n _getFragments() {\n this._matchPreflight()\n\n return u.map(this._steps, 'oldElement')\n }\n\n execute(responseDoc, onApplicable) {\n // (1) For each step, find a `step.newElement` that matches both in this.layer\n // and in the response document.\n // (2) Match newElements here instead of relying on up.Change.UpdateSteps to\n // do it later. This way we will throw up.CannotMatch early, and our caller\n // up.Change.FromContent knows that this plan is not applicable. It can then\n // try a fallback plan.\n this._matchPostflight(responseDoc)\n\n // If our steps can be matched, up.Change.FromContent wants a chance to some final\n // preparations before we start rendering.\n onApplicable()\n\n // If our layer ends up being closed during rendering, we still want to render\n // [up-hungry][up-if-layer=any] elements on other layers.\n let renderOtherLayersOnce = u.memoize(() => this._renderOtherLayers(responseDoc))\n\n // TODO: Can this be a try ... catch ?\n let unbindClosing = this.layer.on('up:layer:accepting up:layer:dismissing', renderOtherLayersOnce)\n try {\n let partialResults = [\n ...this._renderCurrentLayer(responseDoc),\n ...renderOtherLayersOnce(),\n ]\n\n return new up.RenderResult({\n target: this.target,\n layer: this.layer,\n renderOptions: this.options,\n partialResults,\n })\n } finally {\n unbindClosing()\n }\n }\n\n _renderCurrentLayer(responseDoc) {\n if (this._steps.length) {\n // Don't log this.target since that does not include hungry elements\n up.puts('up.render()', `Updating \"${this._bestPreflightSelector()}\" in ${this.layer}`)\n }\n\n // Make sure only the first step will have scroll-related options.\n this._coordinateSteps()\n\n if (this.options.saveScroll) {\n up.viewport.saveScroll({ layer: this.layer })\n }\n\n if (this.options.saveFocus) {\n // TODO: This creates the same up.FocusCapsule that we already built in _setScrollAndFocusOption()\n up.viewport.saveFocus({ layer: this.layer })\n }\n\n let { peel } = this.options\n if (peel) {\n // (1) Layer#peel() will manipulate the stack sync.\n // We don't wait for the peeling animation to finish.\n //\n // (2) Closing a layer will also abort requests targeting that layer.\n //\n // (3) Only restore the base layer's history if the fragment update adds a\n // history entry (issue #397).\n this.layer.peel({ history: !this._hasHistory(), intent: peel })\n }\n\n // Unless the user has explicitly opted out of the default { abort: 'target' }\n // by passing { abort: false }, we abort pending requests targeting\n // the elements that we're about to remove.\n if (this.options.abort !== false) {\n up.fragment.abort(this._getFragments(), {\n reason: 'Fragment is being replaced',\n jid: this.options.jid,\n })\n }\n\n // A key that the server sends with a null value is set to null, not deleted.\n // This is intentional: a null value may be meaningful, and there is no need to delete keys over the protocol.\n Object.assign(this.layer.context, this._context)\n\n // If the update causes the overlay to close, we don't want to render changes.\n //\n // The server may trigger multiple signals that may cause the layer to close:\n //\n // - Close the layer directly through X-Up-Accept-Layer or X-Up-Dismiss-Layer\n // - Event an event with X-Up-Events, to which a listener may close the layer\n // - Update the location to a URL for which { acceptLocation } or { dismissLocation }\n // will close the layer.\n //\n // Note that @handleLayerChangeRequests() also throws an `up.Aborted` error\n // if any of these options cause the layer to close.\n this.handleLayerChangeRequests(\n u.map(this._steps, 'newElement'),\n this._getNewLocation(),\n )\n\n // Change history before compilation, so new fragments see the new location.\n this.layer.updateHistory(this._getEffectiveHistoryOptions())\n\n return this.executeSteps({\n steps: this._steps,\n noneOptions: this.options,\n responseDoc,\n })\n }\n\n _renderOtherLayers(responseDoc) {\n // We execute steps on other layers after this layer. However, if the render pass ends up\n // closing this layer (e.g. by reaching a close condition or X-Up-Accept-Layer), we execute them\n // before the layer closes (see execute()). This way we can:\n //\n // (1) ... use the discarded content for hungry elements on other layers that have [up-if-layer=any].\n // (2) ... see updated hungry elements on other layers in onDismissed/onAccepted handlers.\n let otherLayerSteps = this._getHungrySteps().other\n\n return this.executeSteps({\n steps: otherLayerSteps,\n responseDoc,\n })\n }\n\n _matchPreflight() {\n this._matchOldElements()\n this._compressNestedSteps()\n }\n\n _matchPostflight(responseDoc) {\n this._matchOldElements()\n this._addHungryStepsOnCurrentLayer()\n this._compressNestedSteps()\n this._matchNewElements(responseDoc)\n }\n\n _addHungryStepsOnCurrentLayer() {\n this._steps.push(...this._getHungrySteps().current)\n }\n\n _matchOldElements() {\n this._steps = this._steps.filter((step) => {\n\n const finder = new up.FragmentFinder(u.pick(step, ['selector', 'origin', 'layer', 'match', 'preferOldElements']))\n\n // Try to find fragments matching step.selector within step.layer.\n // Note that step.oldElement might already have been set by up.radio.hungrySteps().\n step.oldElement ||= finder.find()\n\n if (step.oldElement) {\n return true\n } else if (!step.maybe) {\n // An error message will be chosen by up.Change.FromContent\n throw new up.CannotMatch()\n }\n })\n }\n\n _matchNewElements(responseDoc) {\n this._steps = responseDoc.selectSteps(this._steps)\n }\n\n _compressNestedSteps() {\n this._steps = up.fragment.compressNestedSteps(this._steps)\n }\n\n _getHungrySteps() {\n // Find all [up-hungry] elements matching our layer and fragments.\n return up.radio.hungrySteps(this._getEffectiveRenderOptions())\n }\n\n _coordinateSteps() {\n // Store the focused element's selector, scroll position and selection range\n // in an up.FocusCapsule for later restoration.\n let focusCapsule = up.FocusCapsule.preserve(this.layer)\n let oldScrollTops = up.viewport.getScrollTops({ layer: this.layer })\n\n this._steps.forEach((step, i) => {\n step.focusCapsule = focusCapsule\n step.oldScrollTops = oldScrollTops\n\n // A { scrollMap } option always overrides a { scroll } option.\n if (step.scrollMap) step.scroll = false\n\n // We only have a single scroll position and focus, so only scroll/focus for the first step.\n if (i > 0) {\n step.focus = false\n step.scrollMap = undefined\n // The only option we apply to all fragments is { scroll: 'keep' }.\n if (step.scroll !== 'keep') step.scroll = false\n\n // Data is only applied to the primary target.\n // To override data for secondary or hungry targets, use { dataMap }.\n step.data = undefined\n }\n })\n }\n\n _hasHistory() {\n return u.evalAutoOption(this.options.history, this._hasAutoHistory.bind(this))\n }\n\n _hasAutoHistory() {\n // We update the history with { history: 'auto' } when at least\n // one targeted fragment has auto-history.\n const oldFragments = u.map(this._steps, 'oldElement')\n return up.fragment.hasAutoHistory(oldFragments, this.layer)\n }\n\n _getNewLocation() {\n return this._getEffectiveHistoryOptions().location\n }\n\n _getEffectiveRenderOptions() {\n return {\n ...this.options,\n layer: this.layer,\n history: this._hasHistory(),\n }\n }\n\n _getEffectiveHistoryOptions() {\n if (this._hasHistory()) {\n return up.history.options(this.options)\n } else {\n return {}\n }\n }\n\n static {\n u.memoizeMethod(this.prototype, {\n _matchPreflight: true,\n _matchOldElements: true,\n _hasHistory: true,\n _getHungrySteps: true,\n })\n }\n\n}\n","const u = up.util\nconst e = up.element\n\nup.Change.UpdateSteps = class UpdateSteps extends up.Change.Addition {\n\n constructor(options) {\n super(options)\n\n this._steps = u.copy(u.assert(options.steps)) // we mutate it below\n this._noneOptions = options.noneOptions || {}\n }\n\n execute(responseDoc) {\n this.responseDoc = responseDoc\n\n // Fill in `step.newElement` unless it was already done by our caller.\n // This may throw up.CannotMatch for non-optional steps that don't match in `responseDoc`.\n this._steps = responseDoc.selectSteps(this._steps)\n\n // Now that we know our steps will succeed, we detach them from `responseDoc`.\n // This way they won't be moved by hungry elements later.\n this._steps = responseDoc.commitSteps(this._steps)\n\n return [\n this._executeSteps(),\n this._assertLayersAlive(),\n ]\n }\n\n _executeSteps() {\n if (this._steps.length) {\n // (1) Insert all new fragments, in target order (hungry steps last).\n let insertions = this._steps.map((step) => this._insertStep(step))\n\n return {\n fragments: u.flatMap(insertions, 'fragments'),\n finished: this._completeSteps(insertions),\n }\n } else {\n return this._executeNoSteps()\n }\n }\n\n // Runs synchronously up to the `await`, so all phases happen in the same task.\n // Being async, an exception here rejects `finished` but not `up.render()`.\n async _completeSteps(insertions) {\n // (2) Compile all new fragments, in target order. Compilers see all fragments of this pass.\n let welcomed = insertions.map((insertion) => insertion.welcome())\n\n // (3) Focus and scroll after all fragments were inserted and compiled. This way\n // { focus: 'main-if-lost' } sees focus lost in any fragment, and we scroll with the final layout.\n // Only the first step has focus and scroll options, except { scroll: 'keep' }.\n this._steps.forEach((step, i) => {\n this._handleFocus(insertions[i].focusElement, step)\n this._handleScroll(insertions[i].scrollElement, step)\n })\n\n // (4) Start transitions and animations, remove old elements, unwrap wrappers.\n let motions = insertions.map((insertion) => insertion.startMotion?.())\n\n await Promise.all([...welcomed, ...motions])\n }\n\n _assertLayersAlive() {\n return {\n verifyFinished: () => {\n // If our layer was closed while animations are running, don't finish\n // and reject with an up.Aborted error.\n for (let step of this._steps) {\n step.layer.assertAlive()\n }\n }\n }\n }\n\n _insertStep(step) {\n switch (step.placement) {\n case 'swap': {\n let keepPlan = up.fragment.keepPlan(step)\n if (keepPlan) {\n return this._insertKeepEverythingStep(step, keepPlan)\n } else {\n return this._insertSwapStep(step)\n }\n }\n case 'content': {\n return this._insertSwapChildrenStep(step)\n }\n case 'before':\n case 'after': {\n return this._insertChildrenStep(step)\n }\n default: {\n up.fail('Unknown placement: %o', step.placement)\n }\n }\n }\n\n _executeNoSteps() {\n this._handleFocus(null, this._noneOptions)\n this._handleScroll(null, this._noneOptions)\n\n return {}\n }\n\n _insertKeepEverythingStep(step, keepPlan) {\n // Nothing to mutate in the DOM.\n return {\n fragments: [],\n focusElement: step.oldElement,\n scrollElement: step.oldElement,\n welcome: () => up.fragment.emitKept(keepPlan),\n }\n }\n\n _insertSwapStep(step) {\n const parent = step.parentElement ?? step.oldElement.parentNode\n\n up.fragment.markAsDestroying(step.oldElement)\n\n // This needs to happen before up.script.clean() below.\n // Otherwise we would run destructors for elements we want to keep.\n this._preserveDescendantKeepables(step)\n\n // up.motion decides when the old element leaves the DOM: now, or after the transition.\n // We tell it what to do at that moment. Everything else happens in our phases (see the returned object).\n let startMotion = up.motion.swap(step.oldElement, step.newElement, step.transition, {\n ...step,\n beforeRemove: () => {\n up.script.clean(step.oldElement, { layer: step.layer })\n },\n afterRemove: () => {\n up.fragment.emitDestroyed(step.oldElement, { parent, log: false })\n step.afterRemove?.()\n }\n })\n\n // Restore keepable before finalizing. Finalizing will rewrite elements that DOMParser broke,\n // causing a keepPlans's newElement to point to a rewritten element that is now detached.\n // Hence we lose the original position of the keepable.\n this._restoreDescendantKeepables(step)\n\n return {\n fragments: [step.newElement],\n focusElement: step.newElement,\n scrollElement: step.newElement,\n welcome: () => {\n let compilePromise = this._welcomeElement(step.newElement, step)\n\n // Remove the .up-keeping classes and emit up:fragment:kept.\n this._finalizeDescendantKeepables(step)\n\n return compilePromise\n },\n startMotion,\n }\n }\n\n _insertSwapChildrenStep(step) {\n // Make a copy since it's a live HTMLCollection, and we're going to move these elements.\n let newChildren = [...step.newElement.children]\n\n let oldWrapper = e.wrapChildren(step.oldElement)\n let newWrapper = e.wrapChildren(step.newElement)\n\n let wrapperInsertion = this._insertSwapStep({\n ...step,\n placement: 'swap',\n parentElement: step.oldElement.parentNode, // TODO: Test that we get up:fragment:destroyed on the parent, not the wrapper.\n oldElement: oldWrapper,\n newElement: newWrapper,\n // Unwrapping preserves focus.\n afterRemove: () => e.unwrap(newWrapper),\n })\n\n return {\n ...wrapperInsertion,\n fragments: newChildren,\n // Since we never inserted step.newElement (only its children), we handle focus on step.oldElement.\n focusElement: step.oldElement,\n }\n }\n\n _insertChildrenStep(step) {\n // Make a copy since it's a live HTMLCollection, and we're going to move these elements.\n let newChildren = [...step.newElement.children]\n\n // We're either appending or prepending. No keepable elements must be honored.\n\n // Text nodes are wrapped in an <up-wrapper> container so we can\n // animate them and measure their position/size for scrolling.\n // This is not possible for container-less text nodes.\n let wrapper = e.wrapChildren(step.newElement)\n\n // Note that since we're prepending/appending instead of replacing,\n // newElement will not actually be inserted into the DOM, only its children.\n let position = step.placement === 'before' ? 'afterbegin' : 'beforeend'\n step.oldElement.insertAdjacentElement(position, wrapper)\n\n return {\n fragments: newChildren,\n // (A) We never inserted step.newElement, only its children.\n // (B) We focus the first new element child. If it's all text nodes, we focus step.oldElement.\n // (C) Unwrapping preserves focus.\n focusElement: e.leadingElement(wrapper.childNodes) || step.oldElement,\n // Reveal the element that was being prepended/appended.\n scrollElement: wrapper,\n welcome: () => this._welcomeElement(wrapper, step),\n startMotion: () => up.animate(wrapper, step.animation, { ...step, onFinished: () => e.unwrap(wrapper) }),\n }\n }\n\n _welcomeElement(element, step) {\n // Adopt CSP nonces and fix broken script tags\n this.responseDoc.finalizeElement(element)\n\n // Set [up-source], [up-etag], [up-time] from request/response.\n this.setReloadAttrs(step)\n\n // Run macros and compilers. This also snapshots for [up-keep=\"same-html\"].\n return up.hello(element, step)\n }\n\n // This will find all [up-keep] descendants in oldElement, overwrite their partner\n // element in newElement and leave a visually identical clone in oldElement for a later transition.\n // Returns an array of keepPlans.\n _preserveDescendantKeepables(step) {\n const descendantKeepPlans = []\n\n if (step.keep) {\n for (let keepable of step.oldElement.querySelectorAll('[up-keep]')) {\n let keepPlan = up.fragment.keepPlan({ ...step, oldElement: keepable, descendantsOnly: true })\n if (keepPlan) {\n // Replace keepable with its clone so it looks good in a transition\n // between oldElement and newElement.\n const keepableClone = keepable.cloneNode(true)\n keepable.insertAdjacentElement('beforebegin', keepableClone)\n\n // Mark the original keepable to up.ResponseDoc#finalizeElement() knows to skip it.\n keepable.classList.add('up-keeping')\n\n // When the newElement from the response has a response, it will be inserted\n // into the DOM during the transition. Only at the end it will be replaced by the keepable.\n // To prevent the execution of these placeholder-scripts, we change their { type }.\n up.script.block(keepPlan.newElement)\n\n // Attaching a viewport to another element will cause it to lose\n // its scroll position, even if both parents are in the same document.\n let viewports = up.viewport.subtree(keepPlan.oldElement)\n keepPlan.revivers = u.map(viewports, function(viewport) {\n let cursorProps = up.viewport.copyCursorProps(viewport)\n return () => up.viewport.copyCursorProps(cursorProps, viewport)\n })\n\n if (this._willChangeBody()) {\n // Since we're going to swap the entire oldElement and newElement containers afterwards,\n // replace the matching element with keepable so it will eventually return to the DOM.\n keepPlan.newElement.replaceWith(keepable)\n } else {\n // If keepable is a media element, detaching it (or attaching it to another document) would cause it\n // to lose playback state. To avoid this we temporarily move the keepable (keepPlan.oldElement)\n // so it can remain attached while we swap fragment versions. We will move it to its place within\n // the new fragment version once the swap is complete.\n document.body.append(keepable)\n }\n\n // // Since we're going to swap the entire oldElement and newElement containers afterwards,\n // // replace the matching element with keepable so it will eventually return to the DOM.\n // keepPlan.newElement.replaceWith(keepable)\n descendantKeepPlans.push(keepPlan)\n }\n }\n }\n\n step.descendantKeepPlans = descendantKeepPlans\n }\n\n _restoreDescendantKeepables(step) {\n for (let keepPlan of step.descendantKeepPlans) {\n // Now that we know the final destination of { newElement }, we can replace it with the keepable.\n keepPlan.newElement.replaceWith(keepPlan.oldElement)\n\n for (let reviver of keepPlan.revivers) {\n reviver()\n }\n }\n }\n\n _finalizeDescendantKeepables(step) {\n for (let keepPlan of step.descendantKeepPlans) {\n keepPlan.oldElement.classList.remove('up-keeping')\n up.fragment.emitKept(keepPlan)\n }\n }\n\n // Legacy apps might e.g. replace the <body> and an element in the <head>.\n // In that case we cannot use the body as \"safe harbor\" to remporarily move\n // [up-keep] elements.\n _willChangeBody() {\n return u.some(this._steps, (step) => step.oldElement.matches('body'))\n }\n\n _handleFocus(fragment, options) {\n const fragmentFocus = new up.FragmentFocus({\n ...options,\n fragment,\n autoMeans: up.fragment.config.autoFocus,\n })\n fragmentFocus.process(options.focus)\n }\n\n _handleScroll(fragment, options) {\n const scrolling = new up.FragmentScrolling({\n ...options,\n fragment,\n autoMeans: up.fragment.config.autoScroll\n })\n scrolling.process(options.scrollMap ?? options.scroll)\n }\n\n}\n","const u = up.util\n\nup.Change.CloseLayer = class CloseLayer extends up.Change {\n\n constructor(options) {\n super(options)\n\n this._verb = options.verb\n this.layer = up.layer.get(options)\n this._origin = options.origin\n this._value = options.value\n this._preventable = options.preventable ?? true\n this._response = options.response\n this._history = options.history ?? true\n }\n\n execute() {\n // Closing a layer is a sync function.\n\n // Abort when this layer is already closing, or when it has finished closing.\n this.layer.assertAlive()\n\n up.browser.assertConfirmed(this.options)\n\n if (this._emitCloseEvent().defaultPrevented && this._preventable) {\n throw new up.Aborted('Close event was prevented')\n }\n\n this._emitClosingEvent()\n\n // Abort all pending requests targeting the layer we're now closing.\n up.fragment.abort({ reason: 'Layer is closing', layer: this.layer })\n\n // Mark the element as closing. This will prevent some actions that we don't want\n // during closing time, such as the overlay re-attaching itself after every\n // up:fragment:destroyed event.\n this.layer.state = 'closing'\n\n // Remember the parent, which will no longer be accessible once we\n // remove @layer from the @stack.\n const { parent } = this.layer\n\n // Close any child-layers we might have.\n // We don't wait for peeling to finish, since changes that affect the\n // layer stack should happen sync:\n this.layer.peel()\n\n // Move focus before destroying elements, as this involves checking if the closing\n // overlay had focus.\n this._handleFocus(parent)\n\n this.layer.teardownHandlers()\n\n // Destroy the overlay's container element and all of its contents.\n // This will also pass the { onFinished } option\n this.layer.destroyElements(this.options)\n\n // Remove ourselves from the layer stack.\n this.layer.stack.remove(this.layer)\n\n // Restore the history of the parent layer we just uncovered.\n // This will only work after parent layer has become the front layer.\n if (this._history) {\n parent.restoreHistory()\n }\n\n // We immediately emit up:layer:accepted/:dismissed and execute onAccepted/onDismissed callbacks.\n // We don't wait for the closing animation to finish.\n this.layer.state = 'closed'\n this._emitClosedEvent(parent)\n\n // After an { onAccepted } or { onDismissed } callback, reload a fragment from { onAcceptedReload } or { onDismissedReload }.\n this._reloadParent(parent)\n }\n\n _reloadParent(parent) {\n let selector = this.layer[`on${u.upperCaseFirst(this._verb)}edReload`]\n // When the parent layer is closing too, e.g. when it peels this overlay, there is nothing to reload.\n if (selector && parent.isAlive()) {\n // (1) We prefer a match near the link that opened the overlay, and allow :origin in the selector.\n // (2) The overlay is already closed. Like for a throwing { onAccepted } callback, we report an error\n // instead of throwing it, e.g. for a selector that matches nothing.\n // (3) Like other reloads, we ignore an aborted request or an error response.\n up.error.guard(() => up.error.muteUncriticalRejection(up.reload(selector, { layer: parent, origin: this.layer.origin })))\n }\n }\n\n _emitCloseEvent() {\n // The close event is emitted on the layer that is about to close.\n let event = this.layer.emit(\n this._buildEvent(`up:layer:${this._verb}`), {\n callback: this.layer.callback(`on${u.upperCaseFirst(this._verb)}`),\n log: [`Will ${this._verb} ${this.layer} with value %o`, this._value]\n })\n\n // Allow an event listener to replace event.value with a new value.\n this._value = event.value\n\n return event\n }\n\n _emitClosingEvent() {\n let event = this._buildEvent(`up:layer:${this._verb}ing`)\n this.layer.emit(event, { log: false })\n }\n\n _emitClosedEvent(formerParent) {\n const verbPast = `${this._verb}ed`\n const verbPastUpperCaseFirst = u.upperCaseFirst(verbPast)\n\n // layer.emit({ ensureBubbles: true }) will automatically emit a second event on document\n // because the layer is detached. We do not want to emit it on the parent layer where users\n // might confuse it with an event for the parent layer itself. Since @layer.element\n // is now detached, the event will no longer bubble up to the document where global\n // event listeners can receive it. So we explicitly emit the event a second time\n // on the document.\n return this.layer.emit(\n this._buildEvent(`up:layer:${verbPast}`), {\n // Set up.layer.current to the parent of the closed layer, which is now likely\n // to be the front layer.\n baseLayer: formerParent,\n callback: this.layer.callback(`on${verbPastUpperCaseFirst}`),\n ensureBubbles: true,\n log: [`${verbPastUpperCaseFirst} ${this.layer} with value %o`, this._value]\n }\n )\n }\n\n _buildEvent(name) {\n return up.event.build(name, {\n layer: this.layer,\n value: this._value,\n origin: this._origin,\n response: this._response,\n })\n }\n\n _handleFocus(formerParent) {\n let hadFocus = this.layer.hasFocus()\n\n // A11Y: Stop trapping focus in the layer that's about to close\n this.layer.overlayFocus.teardown()\n\n // A11Y: Start trapping focus in the parent layer that is being promoted to front.\n formerParent.overlayFocus?.moveToFront()\n\n if (hadFocus) {\n // A11Y: Focus the element that originally opened this layer.\n // Otherwise focus the parent layer. Its focus element was made focusable by moveToFront() above.\n let newFocusElement = this.layer.origin || formerParent.getFocusElement()\n\n up.focus(newFocusElement, { preventScroll: true })\n }\n }\n}\n","const u = up.util\n\nup.Change.FromURL = class FromURL extends up.Change {\n\n async execute() {\n let newPageReason = this._newPageReason()\n if (newPageReason) {\n up.puts('up.render()', newPageReason)\n up.network.loadPage(this.options)\n // Prevent our caller from executing any further code, since we're already\n // navigating away from this JavaScript environment.\n return u.unresolvablePromise()\n }\n\n let requestAttrs = this._getRequestAttrs()\n let request = this.request = up.request(requestAttrs)\n this.options.onRequestKnown?.(request)\n\n if (this.options.preload) return request\n\n this.options.handleAbort({ request, ...requestAttrs })\n request.runPreviews(this.options)\n\n // Use always() since _onRequestSettled() will decide whether the promise\n // will be fulfilled or rejected.\n return await u.always(request, (responseOrError) => this._onRequestSettled(responseOrError))\n }\n\n _newPageReason() {\n // Rendering content from cross-origin URLs is out of scope for Unpoly.\n // We still allow users to call up.render() with a cross-origin URL, but\n // we will then make a full-page request.\n if (u.isCrossOrigin(this.options.url)) {\n return 'Loading cross-origin content in new page'\n }\n\n // Unpoly may have been booted without suppport for history.pushState.\n // E.g. when the initial page was loaded from a POST response.\n // In this case we make a full page load in hopes to reboot with\n // pushState support. We don't need to when we would not change the browser URL anyway.\n if (this.options.history && !up.browser.canPushState() && up.history.isEnabled('location')) {\n return 'Loading content in new page to restore history support'\n }\n }\n\n // - Includes the render options\n // - Includes the preflight props of the actual Change instance\n // - Includes the preflight props for fail-prefixed options\n _getRequestAttrs() {\n const successAttrs = this._preflightPropsForRenderOptions(this.options)\n const failAttrs = this._preflightPropsForRenderOptions(this.deriveFailOptions(), { optional: true })\n\n return {\n ...this.options, // contains preflight keys relevant for the request, e.g. { url, method }\n ...successAttrs, // contains meta information for an successful update, e.g. { layer, mode, context, target }\n ...u.withRenamedKeys(failAttrs, up.fragment.failKey), // contains meta information for a failed update, e.g. { failTarget },\n }\n }\n\n // This is required by up.RenderJob to handle { abort: 'target' }.\n // TODO: I think this is no longer required. Instead _handleAbortOption() is called with { bindFragments }...\n\n getPreflightProps() {\n return this._getRequestAttrs()\n }\n\n _preflightPropsForRenderOptions(renderOptions, getPreflightPropsOptions) {\n const preflightChange = new up.Change.FromContent({ ...renderOptions, preflight: true })\n // #getPreflightProps() will return meta information about the change that is most\n // likely before the request was dispatched.\n // This might change postflight if the response does not contain the desired target.\n return preflightChange.getPreflightProps(getPreflightPropsOptions)\n }\n\n _onRequestSettled(response) {\n if (response instanceof up.Response) {\n return this._onRequestSettledWithResponse(response)\n } else {\n // Value is up.Aborted, up.Offline or another fatal error that can never\n // be used as a fragment update. At this point up:request:aborted or up:request:offline\n // have already been emitted by up.Request.\n return this._onRequestSettledWithError(response)\n }\n }\n\n _onRequestSettledWithResponse(response) {\n return new up.Change.FromResponse({ ...this.options, response }).execute()\n }\n\n _onRequestSettledWithError(error) {\n if (error instanceof up.Offline) {\n let log = ['Cannot load fragment from %s: %s', error.request, error.reason]\n this.request.emit('up:fragment:offline', {\n callback: this.options.onOffline,\n renderOptions: this.options,\n retry: (retryOptions) => up.render({ ...this.options, ...retryOptions }),\n log,\n })\n }\n\n // `error` might also be an `up.Aborted`. In that case we do *not* emit `up:fragment:aborted`\n // event here. This is already done by `up.fragment.abort()`.\n\n // (1) Even if an { onOffline } callback retries, we still fail the initial render() call\n // We cannot check if the user has retried, since { onOffline } might render a\n // notification and retry some time later (async).\n //\n // (2) up.Offline errors also run { onError } callbacks.\n throw error\n }\n\n static {\n u.memoizeMethod(this.prototype, {\n _getRequestAttrs: true,\n })\n }\n}\n","const u = up.util\n\nup.Change.FromResponse = class FromResponse extends up.Change {\n\n constructor(options) {\n super(options)\n\n this._response = options.response\n this._request = this._response.request\n }\n\n execute() {\n if (up.fragment.config.skipResponse(this._loadedEventProps())) {\n this._skip()\n } else {\n // Allow listeners to inspect the response and either prevent the fragment change\n // or manipulate change options. An example for when this is useful is a maintenance\n // page with its own layout, that cannot be loaded as a fragment and must be loaded\n // with a full page load.\n this._request.assertEmitted('up:fragment:loaded', {\n ...this._loadedEventProps(),\n callback: this.options.onLoaded, // One callback is used for both success and failure. There is no { onFailLoaded }.\n log: ['Loaded fragment from %s', this._response],\n skip: () => this._skip()\n })\n\n this._assetRenderableResponse()\n }\n\n // Listeners to up:fragment:loaded may have changed renderOptions.fail\n // to force success or failure options.\n let fail = u.evalOption(this.options.fail, this._response) ?? !this._response.ok\n\n if (fail) {\n throw this._updateContentFromResponse(this.deriveFailOptions())\n }\n\n return this._updateContentFromResponse(this.options)\n }\n\n _assetRenderableResponse() {\n if (!up.fragment.config.renderableResponse(this._response)) {\n throw new up.CannotParse(['Cannot render response with content-type \"%s\" (configure with up.fragment.config.renderableResponse)', this._response.contentType])\n }\n }\n\n _skip() {\n up.puts('up.render()', 'Skipping %s', this._response)\n this.options.target = ':none'\n this.options.failTarget = ':none'\n }\n\n _updateContentFromResponse(finalRenderOptions) {\n if (finalRenderOptions.didForceFailOptions) {\n up.puts('up.render()', 'Rendering error response using fail-prefixed options (https://unpoly.com/learn/error-responses)')\n }\n\n // The response might carry some updates for our change options,\n // like a server-set location, or server-sent events.\n this._augmentOptionsFromResponse(finalRenderOptions)\n\n // When up.Change.FromContent eventually compiles fragments, the { meta } object\n // will be passed as a third argument to compilers.\n finalRenderOptions.meta = this._helloMeta()\n\n // After the initial render pass has finished, consider reloading stale content.\n finalRenderOptions.verifyFinished = (result) => this._revalidate(result, finalRenderOptions)\n\n return new up.Change.FromContent(finalRenderOptions).execute()\n }\n\n async _revalidate(renderResult, originalRenderOptions) {\n if (!up.fragment.shouldRevalidate(this._request, this._response, originalRenderOptions)) return\n\n // This is an explicit target passed as `{ render }` option.\n // It may be `undefined` if the user has not given an explicit selector and relies on a fallback.\n // If it is given, it may still contain ':before' or ':after'.\n let inputTarget = originalRenderOptions.target\n\n // This is the target that we ended up rendering.\n // It may be a fallback target. It is always defined.\n let effectiveTarget = renderResult.target\n\n if (/:(before|after)/.test(inputTarget)) {\n up.warn('up.render()', 'Cannot revalidate cache when prepending/appending (target %s)', inputTarget)\n } else {\n up.puts('up.render()', 'Revalidating cached response for target \"%s\"', effectiveTarget)\n let revalidateResult = await up.reload(effectiveTarget, {\n ...originalRenderOptions,\n ...up.RenderOptions.NO_MOTION, // offering something like { verifyTransition } would mean we need to delay { onFinished } even further\n ...up.RenderOptions.NO_INPUT_INTERFERENCE,\n ...up.RenderOptions.NO_PREVIEWS,\n feedback: originalRenderOptions.feedback, // we do want to keep { feedback } for .up-revalidating\n preferOldElements: renderResult.fragments, // ensure we match the same fragments when initial render pass matched around { origin } and { origin } has been detached\n layer: renderResult.layer, // if the original render opened a layer, we now update it\n onFinished: null, // the earlier onFinished handler will already be honored by the up.RenderJob that called us\n expiredResponse: this._response, // flag will be forwarded to up:fragment:loaded\n preview: this._revalidatePreview(originalRenderOptions),\n abort: false,\n cache: false, // This implies { revalidate: false }. We will still update the expired cache entry.\n background: true,\n // The guardEvent was already plucked from render options in up.RenderJob#guardRender().\n })\n\n // A well-behaved server will respond with \"304 Not Modified\" if the reload\n // produced the same E-tag or Last-Modified timestamp. In that case we keep\n // the original up.RenderResult.\n //\n // In this case the up.RenderJob from up.reload() has already seen that the result has no content,\n // and will *not* have called { onResult } a second time. We will however return the original\n // render result so it can be passed to up.RenderJob#finished() callbacks.\n if (!revalidateResult.none) {\n return revalidateResult\n }\n }\n }\n\n _revalidatePreview({ preview, revalidatePreview }) {\n if (revalidatePreview === true) {\n return preview\n } else {\n return revalidatePreview\n }\n }\n\n _loadedEventProps() {\n const { expiredResponse } = this.options\n\n return {\n request: this._request,\n response: this._response,\n renderOptions: this.options,\n revalidating: !!expiredResponse,\n expiredResponse,\n }\n }\n\n _helloMeta() {\n // (1) We avoid exposing values that would prevent garbage collection\n // by compilers holding a reference to their meta arg in their closure.\n //\n // (3) We avoid exposing values that we cannot provide for the initial page load.\n // That includes the request and response.\n //\n // (3) Another property { layer } will be assigned by up.hello().\n let meta = { revalidating: !!this.options.expiredResponse, ok: this._response.ok }\n up.migrate.processHelloMeta?.(meta, this._response)\n return meta\n }\n\n _augmentOptionsFromResponse(renderOptions) {\n // Also see preprocessing of server response in up.Request#extractResponseFromXHR().\n\n const responseURL = this._response.url\n\n // The server may send a #hash with X-Up-Location. Otherwise we keep the #hash of the requested URL,\n // like a browser does when it follows a redirect.\n let responseHash = u.parseURL(responseURL).hash\n let hash = responseHash || this._request.hash\n let serverLocation = responseHash ? responseURL : responseURL + (hash || '')\n if (hash) renderOptions.hash = hash\n\n const isReloadable = (this._response.method === 'GET')\n\n if (isReloadable) {\n // Remember where we got the fragment from so we can up.reload() it later.\n renderOptions.source = up.history.refineOption(renderOptions.source, responseURL)\n } else {\n // Keep the source of the previous fragment (e.g. the form that was submitted into failure).\n renderOptions.source = up.history.refineOption(renderOptions.source, 'keep')\n // Since the current URL is not retrievable over the GET-only address bar,\n // we can only provide history if an *explicit* location URL is passed as an option.\n renderOptions.history = !!renderOptions.location\n }\n\n let openLayerOptions = this._response.openLayer\n if (openLayerOptions) {\n // For callback strings like { onAccepted } we need to\n // (1) check up.script.config.allow and possibly block\n // (2) adopt any prefixed nonces\n // (3) parse the string into a function\n up.script.adoptRenderOptionsFromHeader(openLayerOptions, this._response.cspInfo)\n\n Object.assign(renderOptions, {\n ...up.Layer.Overlay.UNSET_VISUALS, // When we're already opening an overlay, don't adopt its visuals.\n target: undefined, // The original target may no longer be appropriate, even if it exists in the response.\n ...up.fragment.config.navigateOptions, // Options like `{ history, focus, scroll }` might no longer work. Also enable a fallback target.\n ...openLayerOptions, // Anything explicitly passed as the value of `X-Up-Open-Layer`.\n layer: 'new', // Don't accept `X-Up-Open-Layer: { layer: 'parent' }`.\n })\n }\n\n renderOptions.location = up.history.refineOption(renderOptions.location, serverLocation)\n renderOptions.title = up.history.refineOption(renderOptions.title, this._response.title)\n renderOptions.eventPlans = this._response.eventPlans\n\n let serverTarget = this._response.target\n if (serverTarget) {\n renderOptions.target = serverTarget\n }\n\n renderOptions.acceptLayer = this._response.acceptLayer\n renderOptions.dismissLayer = this._response.dismissLayer\n renderOptions.document = this._response.text\n\n if (this._response.none) {\n renderOptions.target = ':none'\n }\n\n // If the server has provided an update to our context via the X-Up-Context\n // response header, merge it into our existing { context } option.\n renderOptions.context = u.merge(renderOptions.context, this._response.context)\n\n renderOptions.cspInfo = this._response.cspInfo\n renderOptions.time ??= this._response.lastModified\n renderOptions.etag ??= this._response.etag\n }\n\n static {\n u.memoizeMethod(this.prototype, {\n _loadedEventProps: true,\n })\n }\n}\n","const u = up.util\n\nup.Change.FromContent = class FromContent extends up.Change {\n\n constructor(options) {\n super(options)\n\n // Only extract options required for step building, since #execute() will be called with an\n // postflightOptions argument once the response is received and has provided refined\n // options.\n this._origin = options.origin\n this._preflight = options.preflight\n this._layers = up.layer.getAll(options)\n }\n\n _getPlans() {\n let plans = []\n\n this._filterLayers()\n this._improveOptionsFromResponseDoc()\n\n // First seek { target } in all layers, then seek { fallback } in all layers.\n this._expandIntoPlans(plans, this._layers, this.options.target)\n this._expandIntoPlans(plans, this._layers, this.options.fallback)\n\n return plans\n }\n\n _isRenderableLayer(layer) {\n return (layer === 'new') || layer.isAlive()\n }\n\n _filterLayers() {\n this._layers = u.filter(this._layers, this._isRenderableLayer)\n }\n\n _expandIntoPlans(plans, layers, targets) {\n for (let layer of layers) {\n // An abstract selector like :main may expand into multiple\n // concrete selectors, like ['main', '.content'].\n for (let target of this._expandTargets(targets, layer)) {\n // Any plans we add will inherit all properties from @options\n const props = { ...this.options, target, layer, defaultPlacement: this._defaultPlacement() }\n const change = layer === 'new' ? new up.Change.OpenLayer(props) : new up.Change.UpdateLayer(props)\n plans.push(change)\n }\n }\n }\n\n _expandTargets(targets, layer) {\n return up.fragment.expandTargets(targets, { layer, mode: this.options.mode, origin: this._origin })\n }\n\n execute() {\n // Preloading from local content is a no-op.\n if (this.options.preload) {\n // TODO: This is not an async method? So just return undefined?\n return Promise.resolve()\n }\n\n return this._seekPlan(this._executePlan.bind(this)) || this._cannotMatchPostflightTarget()\n }\n\n _executePlan(matchedPlan) {\n // Group compilation and emission of up:fragment:inserted into a mutation block.\n // This allows up.SelectorTracker to only sync once after the mutation, and\n // ignore any events in between.\n return up.fragment.mutate(() =>\n matchedPlan.execute(\n this._getResponseDoc(),\n this._onPlanApplicable.bind(this, matchedPlan)\n )\n )\n }\n\n _isApplicablePlanError(error) {\n // (1) Only an up.CannotMatch means \"this plan doesn't fit, try the next one\".\n // (2) Once a plan has started to change the page, we cannot try another plan on top of it.\n return !(error instanceof up.CannotMatch) || this._planApplied\n }\n\n // Final preparations before elements are being changed.\n _onPlanApplicable(plan) {\n let primaryPlan = this._getPlans()[0]\n if (plan !== primaryPlan) {\n up.puts('up.render()', 'Could not match primary target \"%s\". Updating a fallback target \"%s\".', primaryPlan.target, plan.target)\n }\n\n let { assets } = this._getResponseDoc()\n if (assets) {\n up.script.assertAssetsOK(assets, plan.options)\n }\n\n // Used by up.RenderJob\n this.options.handleAbort(this.getPreflightProps())\n\n // From here on the plan changes the page. Set this last: getPreflightProps() above\n // also uses _seekPlan(), and must still be able to skip plans that don't fit.\n this._planApplied = true\n }\n\n _getResponseDoc() {\n if (this._preflight) return\n\n const docOptions = u.pick(this.options, [\n 'target',\n 'content',\n 'fragment',\n 'document',\n 'html',\n 'cspInfo',\n 'origin',\n 'data',\n ])\n up.migrate.handleResponseDocOptions?.(docOptions)\n\n // If neither { document } nor { fragment } source is given, we assume { content }.\n if (this._defaultPlacement() === 'content') {\n // When processing { content }, ResponseDoc needs a { target }\n // to create a matching element.\n docOptions.target = this._firstExpandedTarget(docOptions.target)\n }\n\n return new up.ResponseDoc(docOptions)\n }\n\n _improveOptionsFromResponseDoc() {\n if (this._preflight) return\n\n let responseDoc = this._getResponseDoc()\n\n if (this.options.fragment) {\n // ResponseDoc allows to pass innerHTML as { fragment }, but then it also\n // requires a { target }. We use a target that matches the parsed { fragment }.\n this.options.target ||= responseDoc.rootSelector()\n }\n\n this.options.title = up.history.refineOption(this.options.title, responseDoc.title)\n this.options.metaTags = up.history.refineOption(this.options.metaTags, responseDoc.metaTags)\n this.options.lang = up.history.refineOption(this.options.lang, responseDoc.lang)\n }\n\n _defaultPlacement() {\n if (!this.options.document && !this.options.fragment) {\n return 'content'\n }\n }\n\n // When the user provided a { content } we need an actual CSS selector for\n // which up.ResponseDoc can create a matching element.\n _firstExpandedTarget(target) {\n // When the user passes a closed layer as { layer } option, we expand the target with the root\n // layer instead of having up.fragment.expandTargets() throw. In many cases we get the same result.\n let layer = this._layers[0] || up.layer.root\n return this._expandTargets(target || ':main', layer)[0]\n }\n\n // Returns information about the change that is most likely before the request was dispatched.\n // This might change postflight if the response does not contain the desired target.\n getPreflightProps(opts = {}) {\n const getPlanProps = (plan) => plan.getPreflightProps()\n return this._seekPlan(getPlanProps) || opts.optional || this._cannotMatchPreflightTarget()\n }\n\n _cannotMatchPreflightTarget() {\n this._cannotMatchTarget('Could not find target in current page')\n }\n\n _cannotMatchPostflightTarget() {\n this._cannotMatchTarget('Could not find common target in current page and response')\n }\n\n _cannotMatchTarget(reason) {\n if (this._getPlans().length) {\n const planTargets = u.uniq(u.map(this._getPlans(), 'target'))\n const humanizedLayerOption = up.layer.optionToString(this.options.layer)\n throw new up.CannotMatch([reason + \" (tried selectors %o in %s)\", planTargets, humanizedLayerOption])\n } else if (this._layers.length === 0) {\n this._cannotMatchLayer()\n } else if (this.options.didForceFailOptions) {\n throw new up.CannotMatch('No target selector given for error responses (https://unpoly.com/learn/error-responses)')\n } else {\n throw new up.CannotMatch('No target selector given')\n }\n }\n\n _cannotMatchLayer() {\n throw new up.CannotMatch('Could not find a layer to render in. You may have passed an unmatchable layer reference, or a detached element.')\n }\n\n _seekPlan(fn) {\n for (let plan of this._getPlans()) {\n try {\n // A return statement stops iteration of a vanilla for loop,\n // but would not stop an u.each() or Array#forEach().\n return fn(plan)\n } catch (error) {\n // Re-throw any unexpected type of error, but ignore up.CannotMatch to try the next plan.\n if (this._isApplicablePlanError(error)) {\n throw error\n }\n }\n }\n }\n\n static {\n u.memoizeMethod(this.prototype, {\n _getPlans: true,\n _getResponseDoc: true,\n getPreflightProps: true,\n })\n }\n\n}\n","const u = up.util\n\nconst NONCE_PATTERN = /'nonce-([^']+)'/g\n\nfunction findNonces(cspPart) {\n let matches = cspPart.matchAll(NONCE_PATTERN)\n return u.map(matches, '1')\n}\n\nup.CSPInfo = class CSPInfo {\n\n constructor(declaration = '', nonces = []) {\n this.declaration = declaration\n this.nonces = nonces\n }\n\n isStrictDynamic() {\n return this.declaration.includes(\"'strict-dynamic'\")\n }\n\n isUnsafeEval() {\n return this.declaration.includes(\"'unsafe-eval'\")\n }\n\n static fromHeader(cspHeader) {\n let results = {}\n\n if (cspHeader) {\n let declarations = cspHeader.split(/\\s*;\\s*/)\n for (let declaration of declarations) {\n let directive = declaration.match(/^(script|default)-src\\s/)?.[1]\n if (directive) {\n results[directive] = [declaration, findNonces(declaration)]\n }\n }\n }\n\n let bestResult = results.script || results.default\n if (bestResult) {\n return new this(...bestResult)\n } else {\n return this.none()\n }\n }\n\n static none() {\n return new this()\n }\n\n}\n","const u = up.util\nconst e = up.element\n\nup.HelloFragment = class HelloFragment {\n\n constructor(root, macros, compilers, { layer, data, dataRoot, dataMap, meta, insertedEvent }) {\n // (1) If a caller has already looked up the layer we don't want to look it up again.\n // (2) Default to the current layer in case the user manually compiles a detached element.\n layer ||= up.layer.get(root) || up.layer.current\n\n this._root = root\n this._macros = macros\n this._compilers = compilers\n this._layer = layer\n this._data = data\n this._dataRoot = dataRoot || root\n this._dataMap = dataMap\n this._compilePromises = []\n this._insertedEvent = insertedEvent ?? true\n\n // (A) When a render pass compilers, it passes along a { meta } option.\n // When up.hello() is called by the user, { meta } will be missing and we set defaults.\n // (B) We cannot make a new object literal here.\n // The meta arg may have a deprecated getter on { response }, defined by unpoly-migrate.js.\n meta ||= {}\n meta.layer ??= layer\n meta.ok ??= true\n meta.revalidating ??= false\n this._meta = meta\n }\n\n async run() {\n up.puts('up.hello()', \"Compiling fragment %o\", this._root)\n this._assignDataToElements()\n\n this._runCompilers(this._macros)\n this._emitCompileEvent()\n this._runCompilers(this._compilers)\n\n // Some selectors only match a custom element after its definition, which may arrive\n // after the element was inserted. Emit up:element:defined when that happens, so\n // e.g. an up.SelectorTracker can sync again.\n //\n // We scan after running compilers, which may insert undefined custom elements themselves.\n e.trackDefinitions(this._root)\n\n this._emitInsertedEvent()\n await Promise.all(this._compilePromises)\n return this._root\n }\n\n _emitCompileEvent() {\n up.emit(this._root, 'up:compilers:before', { log: false })\n }\n\n _emitInsertedEvent() {\n if (this._insertedEvent) {\n up.fragment.emitInserted(this._root, this._meta)\n }\n }\n\n _assignDataToElements() {\n if (this._data) {\n this._dataRoot.upCompileData = this._data\n }\n\n if (this._dataMap) {\n for (let selector in this._dataMap) {\n for (let match of this._select(selector)) {\n match.upCompileData = this._dataMap[selector]\n }\n }\n }\n }\n\n _runCompilers(compilers) {\n // If we're compiling a fragment in a background layer, we want\n // up.layer.current to resolve to that background layer, not the front layer.\n this._layer.asCurrent(() => {\n for (let compiler of compilers) {\n this._runCompiler(compiler)\n }\n })\n }\n\n _runCompiler(compiler) {\n const matches = this._selectOnce(compiler)\n if (!matches.length) { return }\n\n if (!compiler.isDefault) {\n up.puts('up.hello()', 'Compiling %d× \"%s\" on %s', matches.length, compiler.selector, this._layer)\n }\n\n if (compiler.batch) {\n this._compileBatch(compiler, matches)\n } else {\n for (let match of matches) {\n this._compileOneElement(compiler, match)\n }\n }\n\n up.migrate.postCompile?.(matches, compiler)\n }\n\n _compileOneElement(compiler, element) {\n const compileArgs = [element]\n // (A) For performance reason, do not parse [up-data] unless the compiler function expects a second argument.\n // (B) We must pass data for an argument count of 0, since then the function might take varargs.\n if (compiler.length !== 1) {\n const data = up.script.data(element)\n compileArgs.push(data, this._meta)\n }\n\n let onDestructor = (destructor) => up.destructor(element, destructor)\n this._applyCompilerFunction(compiler, element, compileArgs, onDestructor)\n }\n\n _compileBatch(compiler, elements) {\n const compileArgs = [elements]\n // Do not retrieve and parse [up-data] unless the compiler function\n // expects a second argument. Note that we must pass data for an argument\n // count of 0, since then the function might take varargs.\n if (compiler.length !== 1) {\n const dataList = u.map(elements, up.script.data)\n compileArgs.push(dataList, this._meta)\n }\n\n let onDestructor = () => this._reportBatchCompilerWithDestructor(compiler)\n this._applyCompilerFunction(compiler, elements, compileArgs, onDestructor)\n }\n\n async _applyCompilerFunction(compiler, elementOrElements, compileArgs, onDestructor) {\n let maybeDestructor = up.error.guard(() => compiler.apply(elementOrElements, compileArgs))\n\n if (u.isPromise(maybeDestructor)) {\n // If the async compiler rejects, emit an `error` event but don't reject.\n let guardedPromise = up.error.guardPromise(maybeDestructor)\n\n // Remember this promise for the return value of #run()\n this._compilePromises.push(guardedPromise)\n\n // (1) We don't know yet if the async compiler function will return destructors.\n // (2) Ideally we want to avoid setting .up-can-clean on every element that is async-compiled.\n // (3) There is an edge case where a an element is destroyed, before its async compiler\n // function resolves. In that case we still want to execute a returned destructor function.\n maybeDestructor = await guardedPromise\n }\n\n if (maybeDestructor) onDestructor(maybeDestructor)\n }\n\n _reportBatchCompilerWithDestructor(compiler) {\n let error = new up.Error(['Batch compiler (%s) cannot return a destructor', compiler.selector])\n reportError(error)\n }\n\n _select(selector) {\n return up.fragment.subtree(this._root, u.evalOption(selector), { layer: this._layer } )\n }\n\n _selectOnce(compiler) {\n let matches = this._select(compiler.selector)\n\n if (!compiler.rerun) {\n matches = u.filter(matches, (element) => {\n let appliedCompilers = (element.upAppliedCompilers ||= new Set())\n if (!appliedCompilers.has(compiler)) {\n appliedCompilers.add(compiler)\n return true\n }\n })\n }\n\n return matches\n }\n\n}\n","const u = up.util\n\nup.DestructorPass = class DestructorPass {\n\n constructor(fragment, options) {\n this._fragment = fragment\n this._options = options\n }\n\n run() {\n for (let cleanable of this._selectCleanables()) {\n // In the case of [up-keep] elements we may run on a clone that matches .up-can-clean\n // but has no { upDestructors } property.\n let registry = u.pluckKey(cleanable, 'upDestructors')\n registry?.clean(cleanable)\n }\n }\n\n _selectCleanables() {\n // fragment functions usually ignore elements that are being destroyed\n const selectOptions = { ...this._options, destroying: true }\n return up.fragment.subtree(this._fragment, '.up-can-clean', selectOptions)\n }\n\n}\n","const u = up.util\nconst e = up.element\n\nup.EventEmitter = class EventEmitter extends up.Record {\n\n keys() {\n return [\n 'target',\n 'event',\n 'baseLayer',\n 'callback',\n 'log',\n 'ensureBubbles',\n ]\n }\n\n emit() {\n this._logEmission()\n\n if (this.baseLayer) {\n this.baseLayer.asCurrent(() => this._dispatchEvent())\n } else {\n this._dispatchEvent()\n }\n return this.event\n }\n\n _dispatchEvent() {\n this.target.dispatchEvent(this.event)\n\n if (this.ensureBubbles && !this.target.isConnected) {\n document.dispatchEvent(this.event)\n }\n\n up.error.guard(() => this.callback?.(this.event))\n }\n\n assertEmitted() {\n const event = this.emit()\n if (event.defaultPrevented) {\n throw new up.Aborted(`Event ${event.type} was prevented`)\n }\n }\n\n _logEmission() {\n if (!up.log.config.enabled) { return }\n\n let message = this.log\n let messageArgs\n\n if (u.isArray(message)) {\n [message, ...messageArgs] = message\n } else {\n messageArgs = []\n }\n\n const { type } = this.event\n\n if (u.isString(message)) {\n up.puts(type, message, ...messageArgs)\n } else if (message !== false) {\n up.puts(type, `Event ${type}`)\n }\n }\n\n static fromEmitArgs(args, defaults = {}) {\n // Event-emitting functions are crazy overloaded:\n //\n // - up.emit([target], eventType, [eventProps])\n // - up.emit([target], eventPlan) # eventPlan must contain { type } property\n // - up.emit([target], event, [emitDetails]) # emitDetails may contain options like { layer } or { callback }\n //\n // Hence the insane argument parsing logic seen below.\n //\n // We begin by removing an options hash from the end of the argument list.\n // This might be an object of event properties, which might or might contain a\n // { type } property for the event type. In case we are passed a pre-built\n // Event object, the hash will contain emission that options that cannot be\n // carried by the event object, such as { layer } or { callback }.\n let options = u.extractOptions(args)\n\n // Event-emitting functions may instantiate their up.EventEmitter with preconfigured\n // defaults. E.g. up.Layer#emit() will set the default { layer: this }.\n options = u.merge(defaults, options)\n\n // If we are passed an element or layer as a first argument, this is the event\n // target. We remove it from the argument list and store it in options.\n if (u.isElementLike(args[0])) {\n options.target = e.get(args.shift())\n } else if (args[0] instanceof up.Layer) {\n options.layer = args.shift()\n }\n\n // Setting a { layer } is a shorthand to (1) emit the event on the layer's\n // element and (2) to set up.layer.current to that layer during emission.\n let layer\n if (u.isGiven(options.layer)) {\n layer = up.layer.get(options.layer)\n options.target ||= layer.element\n options.baseLayer ||= layer\n }\n\n // Setting { baseLayer } will fix up.layer.current to that layer during emission.\n // In case we get a layer name like 'root' (instead of an up.Layer object) we look\n // up the actual up.Layer object.\n if (options.baseLayer) {\n options.baseLayer = up.layer.get(options.baseLayer)\n }\n\n if (u.isString(options.target)) {\n options.target = up.fragment.get(options.target, { layer: options.layer })\n } else if (!options.target) {\n // If no element is given, we emit the event on the document.\n options.target = document\n }\n\n if (args[0]?.preventDefault) {\n // In this branch we receive an Event object that was already built:\n // up.emit([target], event, [emitOptions])\n options.event = args[0]\n options.log ??= args[0].log\n } else if (u.isString(args[0])) {\n // In this branch we receive an Event type and props object.\n // The props object may also include options for the emission, such as\n // { layer }, { target }, { baseLayer } or { log }.\n // up.emit([target], eventType, [eventPropsAndEmitOptions])\n options.event = up.event.build(args[0], options)\n } else {\n // In this branch we receive an object that contains the event type as a { type } property:\n // up.emit([target, { type: 'foo', prop: 'value' }\n options.event = up.event.build(options)\n }\n\n return new (this)(options)\n }\n}\n","const u = up.util\n\nup.EventListener = class EventListener extends up.Record {\n\n keys() {\n return [\n 'element',\n 'eventType',\n\n 'selector',\n 'callback',\n 'guard',\n 'baseLayer',\n 'passive',\n 'once',\n 'capture',\n 'beforeBoot',\n ]\n }\n\n constructor(attributes) {\n super(attributes)\n this._key = this.constructor._buildKey(attributes)\n this.isDefault = up.framework.evaling\n\n // We don't usually run up.on() listeners before Unpoly has booted.\n // This is done so incompatible code is not called on browsers that don't support Unpoly.\n // Listeners that do need to run before Unpoly boots can pass { beforeBoot: true } to override.\n // We also default to { beforeBoot: true } for framework events that are emitted\n // before booting.\n this.beforeBoot ??= (this.eventType.indexOf('up:framework:') === 0)\n\n // Need to store the bound nativeCallback function because addEventListener()\n // and removeEventListener() need to see the exact same reference.\n this.nativeCallback = this.nativeCallback.bind(this)\n }\n\n bind() {\n const map = (this.element.upEventListeners ||= {})\n if (map[this._key]) {\n up.fail('up.on(): The %o callback %o cannot be registered more than once', this.eventType, this.callback)\n }\n map[this._key] = this\n\n this.element.addEventListener(...this._addListenerArg())\n }\n\n _addListenerArg() {\n // Avoid setting a default { passive: false } since some browsers have non-false\n // defaults for some event types like `touchstart`.\n // See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#parameters\n let options = u.compactObject(u.pick(this, ['once', 'passive', 'capture']))\n return [this.eventType, this.nativeCallback, options]\n }\n\n unbind() {\n let map = this.element.upEventListeners\n if (map) {\n delete map[this._key]\n }\n this.element.removeEventListener(...this._addListenerArg())\n }\n\n nativeCallback(event) {\n if (up.framework.beforeBoot && !this.beforeBoot) {\n return\n }\n\n // 1. Since we're listing on `document`, event.currentTarget is now `document`.\n // 2. event.target is the element that received an event, which might be a\n // child of `selector`.\n // 3. There is only a single event bubbling up the DOM, so we are only called once.\n let element = event.target\n if (this.selector) {\n let selector = u.evalOption(this.selector)\n element = element.closest(selector)\n }\n\n if (this.guard && !this.guard(event)) {\n return\n }\n\n if (element) {\n const args = [event, element]\n\n // Do not retrieve and parse [up-data] unless the listener function\n // expects a third argument. Note that we must pass data for an argument\n // count of 0, since then the function might take varargs.\n const expectedArgCount = this.callback.length\n\n if (expectedArgCount !== 1 && expectedArgCount !== 2) {\n const data = up.script.data(element)\n args.push(data)\n }\n\n // Do not allow click events from disabled elements to propagate.\n // The platform only suppresses *trusted* clicks, so a click dispatched by a script is\n // delivered even to a disabled <button>. We use the field accessor outside fields, since\n // \"does this element consider itself disabled\" is the same question.\n if (this.eventType === 'click' && up.form.readFieldDisabled(element)) {\n return\n }\n\n const applyCallback = this.callback.bind(element, ...args)\n\n if (this.baseLayer) {\n // Unpoly will usually set up.layer.current when emitting an event.\n // But Unpoly-unaware code will not set up.layer.current when emitting events.\n\n // Hence layerInstance.on('click') will use this to set layer.current to layerInstance.\n this.baseLayer.asCurrent(applyCallback)\n } else {\n applyCallback()\n }\n }\n }\n\n static fromElement(attributes) {\n let map = attributes.element.upEventListeners\n if (map) {\n const key = this._buildKey(attributes)\n return map[key]\n }\n }\n\n static _buildKey(attributes) {\n // Give the callback function a numeric identifier so it\n // can become part of the upEventListeners key.\n attributes.callback.upUid ||= u.uid()\n\n return [\n attributes.eventType,\n attributes.selector,\n attributes.callback.upUid\n ].join('|')\n }\n\n static allNonDefault(element) {\n let map = element.upEventListeners\n if (map) {\n const listeners = Object.values(map)\n return u.reject(listeners, 'isDefault')\n } else {\n return []\n }\n }\n}\n","const u = up.util\n\nup.EventListenerGroup = class EventListenerGroup extends up.Record {\n\n keys() {\n return [\n 'elements',\n 'eventTypes',\n\n 'selector',\n 'callback',\n 'guard',\n 'baseLayer',\n 'passive',\n 'once',\n 'capture',\n 'beforeBoot',\n ]\n }\n\n bind() {\n const cleaner = u.cleaner()\n\n this._eachListenerAttributes(function(attrs) {\n const listener = new up.EventListener(attrs)\n listener.bind()\n return cleaner(listener.unbind.bind(listener))\n })\n\n return cleaner.clean\n }\n\n _eachListenerAttributes(fn) {\n for (let element of this.elements) {\n for (let eventType of this.eventTypes) {\n fn(this._listenerAttributes(element, eventType))\n }\n }\n }\n\n _listenerAttributes(element, eventType) {\n return { ...this.attributes(), element, eventType }\n }\n\n unbind() {\n this._eachListenerAttributes(function(attrs) {\n let listener = up.EventListener.fromElement(attrs)\n if (listener) {\n listener.unbind()\n }\n })\n }\n\n /*\n Constructs a new up.EventListenerGroup from arguments with many different combinations:\n\n [[elements], eventTypes, [selector], [options], callback]\n\n @function up.EventListenerGroup.fromBindArgs\n @internal\n */\n static fromBindArgs(args, overrides) {\n args = u.copy(args)\n\n // A callback function is given in all arg variants.\n const callback = args.pop()\n\n // The user can pass an element (or the document, or the window) as the\n // first argument. If omitted, the listener will bind to the document.\n let elements\n if (args[0].addEventListener) {\n elements = [args.shift()]\n } else if (u.isJQuery(args[0]) || (u.isList(args[0]) && args[0][0].addEventListener)) {\n elements = args.shift()\n } else {\n elements = [document]\n }\n\n // Event names are given in all arg variants\n let eventTypes = u.getSimpleTokens(args.shift())\n let fixTypes = up.migrate.fixEventTypes\n if (fixTypes) {\n eventTypes = fixTypes(eventTypes)\n }\n\n const options = u.extractOptions(args)\n\n // A selector is given if the user wants to delegate events.\n // It might be undefined.\n const selector = args[0]\n\n const attributes = { elements, eventTypes, selector, callback, ...options, ...overrides }\n return new (this)(attributes)\n }\n}\n","const u = up.util\n\nup.SelectorTracker = class SelectorTracker {\n\n constructor(selectFn, addCallback) {\n this._selectFn = selectFn\n this._addCallback = addCallback\n this._knownMatches = new Map()\n this._syncScheduled = false\n }\n\n start() {\n // Get initial matches immediately. If we waited for scheduleSync(), the following race condition\n // could occur:\n //\n // (1) When we encounter [up-switch], we immediately-sync read field values.\n // (2) A later user compiler (after) us changes a field value and emits 'change'.\n // The change event would normally cause us to re-read field values.\n // But we aren't yet listening to field events!\n // (3) The change event is only registered via trackFields() and up.SelectorTracker, which\n // only syncs the current mutation (after up:fragment:insert) for performance reasons.\n this.sync()\n\n return u.sequence(\n this._trackFragments(),\n () => this._removeAllMatches(),\n )\n }\n\n _trackFragments() {\n // A custom element may only match our selector after its definition, which can arrive\n // after the element was inserted (e.g. a form-associated custom element only matches\n // :enabled once defined).\n return up.on('up:fragment:inserted up:fragment:destroyed up:element:defined', () => this._scheduleSync())\n }\n\n _scheduleSync() {\n if (!this._syncScheduled) {\n this._syncScheduled = true\n // When we're in the middle of a render pass, we don't want to react to every\n // up:fragment:inserted/destroyed event, for performance reasons.\n // We want to only sync once at the end of the render pass.\n up.fragment.afterMutate(() => this.sync())\n }\n }\n\n // No _ prefix: specs spy on this name, and _-prefixed members are mangled in the minified build.\n sync() {\n this._syncScheduled = false\n\n let removeMap = new Map(this._knownMatches)\n this._knownMatches.clear()\n\n for (let newMatch of this._selectFn()) {\n let knownRemoveCallback = removeMap.get(newMatch)\n removeMap.delete(newMatch)\n let removeCallback = knownRemoveCallback || this._addCallback(newMatch) || u.noop\n this._knownMatches.set(newMatch, removeCallback)\n }\n\n this._runRemoveCallbacks(removeMap)\n }\n\n _removeAllMatches() {\n this._runRemoveCallbacks(this._knownMatches)\n }\n\n _runRemoveCallbacks(map) {\n for (let [element, removeCallback] of map) {\n removeCallback(element)\n }\n }\n\n}\n","const u = up.util\n\nup.FieldWatcher = class FieldWatcher {\n\n constructor(root, options, callback) {\n this._options = options\n this._root = root\n this._callback = callback\n this._batch = options.batch\n this._logPrefix = options.logPrefix ?? 'up.watch()'\n this._includeDisabled = options.includeDisabled\n\n this._ensureWatchable()\n }\n\n start() {\n this._scheduledValues = null\n this._processedValues = this._readFieldValues()\n this._currentTimer = null\n this._callbackRunning = false\n\n return u.sequence(\n this._trackFields(),\n this._trackAbort(),\n this._trackReset(),\n () => this._abort(),\n )\n }\n\n _ensureWatchable() {\n const fail = (message) => up.fail(message, this._logPrefix, this._root)\n\n if (!this._callback) {\n fail('No callback provided for %s (%o)')\n }\n\n if (this._root.matches('input[type=radio]')) {\n fail('Use %s with the container of a radio group, not with an individual radio button (%o)')\n }\n\n if (up.form.isField(this._root) && !up.form.readFieldName(this._root)) {\n fail('%s can only watch fields with a name (%o)')\n }\n }\n\n _trackFields() {\n if (up.form.isField(this._root)) {\n return this._watchField(this._root)\n } else {\n return up.form.trackFields(this._root, (field) => this._watchField(field))\n }\n }\n\n _trackAbort() {\n let guard = ({ target }) => target.contains(this._region)\n return up.on('up:fragment:aborted', { guard }, () => this._abort())\n }\n\n _trackReset() {\n let guard = ({ target }) => target === this._region\n return up.on('reset', { guard }, (event) => this._onFormReset(event))\n }\n\n get _region() {\n return up.form.getRegion(this._root)\n }\n\n _fieldOptions(field) {\n let rootOptions = u.copy(this._options)\n return up.form.watchOptions(field, rootOptions, { defaults: { event: 'input' } })\n }\n\n _watchField(field) {\n let fieldOptions = this._fieldOptions(field)\n let eventType = fieldOptions.event\n\n // Return a function that unbinds all events when the field is removed from _root.\n // Note that an [up-keep] field may be moved to another root.\n return up.on(field, eventType, (event) => this._check(event, fieldOptions))\n }\n\n _abort() {\n // This causes the next call to _requestCallback() to return early.\n this._scheduledValues = null\n }\n\n _scheduleValues(values, fieldOptions) {\n this._scheduledValues = values\n this._scheduledFieldOptions = fieldOptions\n let delay = fieldOptions.delay || 0\n clearTimeout(this._currentTimer) // debounce a previously set timer\n\n this._currentTimer = u.timer(delay, () => {\n this._currentTimer = null\n this._requestCallback()\n })\n }\n\n _isNewValues(values) {\n return !u.isEqual(values, this._processedValues) && !u.isEqual(this._scheduledValues, values)\n }\n\n async _requestCallback() {\n // When aborted we nullify _scheduledValues to cancel a scheduled callback.\n if (!this._scheduledValues) return\n\n // We don't run callbacks when a prior async callback is still running.\n // We will call _requestCallback() again once the prior callback terminates.\n if (this._callbackRunning) return\n\n // When we re-called _requestCallback() after waiting for a prior callback, another\n // debounce delay may have started while waiting for the prior callback.\n // We must not shorten that debounce delay.\n if (this._currentTimer) return\n\n // If the form was manually detached (not destroyed) while a callback was scheduled,\n // we don't run the callback.\n if (!up.fragment.isAlive(this._region)) return\n\n // Don't forward { event, delay } because\n // (1) we have already processed them here and\n // (2) those aren't render options.\n let callbackOptions = u.omit(this._scheduledFieldOptions, ['event', 'delay'])\n const diff = this._changedValues(this._processedValues, this._scheduledValues)\n this._processedValues = this._scheduledValues\n this._scheduledValues = null\n this._callbackRunning = true\n this._scheduledFieldOptions = null\n\n const callbackReturnValues = []\n if (this._batch) {\n callbackReturnValues.push(this._runCallback(diff, callbackOptions))\n } else {\n for (let name in diff) {\n const value = diff[name]\n callbackReturnValues.push(this._runCallback(value, name, callbackOptions))\n }\n }\n\n if (u.some(callbackReturnValues, u.isPromise)) {\n let callbackDone = Promise.allSettled(callbackReturnValues)\n await callbackDone\n }\n\n this._callbackRunning = false\n\n // A debounce delay may have finished and returned earlier while a priour async callback was still running.\n this._requestCallback()\n }\n\n _runCallback(...args) {\n return up.error.guard(this._callback, ...args)\n }\n\n _changedValues(previous, next) {\n const changes = {}\n let keys = Object.keys(previous)\n keys = keys.concat(Object.keys(next))\n keys = u.uniq(keys)\n for (let key of keys) {\n const previousValue = previous[key]\n const nextValue = next[key]\n if (!u.isEqual(previousValue, nextValue)) {\n changes[key] = nextValue\n }\n }\n return changes\n }\n\n _readFieldValues() {\n return up.Params.fromContainer(this._root, { includeDisabled: this._includeDisabled }).toObject()\n }\n\n _check(event, fieldOptions = {}) {\n const values = this._readFieldValues()\n\n if (this._isNewValues(values)) {\n up.log.putsEvent(event)\n this._scheduleValues(values, fieldOptions)\n }\n }\n\n _onFormReset(event) {\n // We need to wait 1 task for the reset button to affect field values\n u.task(() => this._check(event))\n }\n}\n","const u = up.util\nconst e = up.element\n\nconst BUILTIN_SWITCH_EFFECTS = [\n { attr: 'up-hide-for', toggle(target, active) { e.toggle(target, !active) } },\n { attr: 'up-show-for', toggle(target, active) { e.toggle(target, active) } },\n { attr: 'up-disable-for', toggle(target, active) { up.form.setDisabled(target, active) } },\n { attr: 'up-enable-for', toggle(target, active) { up.form.setDisabled(target, !active) } },\n]\n\nup.Switcher = class Switcher {\n\n constructor(root) {\n // The root should either be an individual input, or a container of radio buttons.\n this._root = root\n this._switcheeSelector = root.getAttribute('up-switch') || up.fail(\"No switch target given for %o\", root)\n this._regionSelector = root.getAttribute('up-switch-region')\n }\n\n start() {\n // Switch our region once immediately.\n // Don't risk unswitched state showing up in the browser.\n this._switchRegion()\n\n return u.sequence(\n this._trackFieldChanges(),\n this._trackNewSwitchees(),\n )\n }\n\n _trackFieldChanges() {\n let callback = () => this._onFieldChanged()\n return up.migrate.watchForSwitch?.(this._root, callback)\n // Switching effects are client-side and cheap, so we never debounce them.\n // A { delay } meant for requests (from config or [up-watch-delay]) would only make switching lag,\n // and would let an autosubmitting form read its fields before they were switched.\n || up.watch(this._root, { logPrefix: '[up-switch]', includeDisabled: true, delay: 0 }, callback)\n }\n\n _trackNewSwitchees() {\n let onSwitcheeAdded = (switchee) => this._switchSwitchee(switchee)\n return up.fragment.trackSelector(() => this._findSwitchees(), onSwitcheeAdded)\n }\n\n _onFieldChanged() {\n this._switchRegion()\n }\n\n _switchRegion() {\n const fieldTokens = this._buildFieldTokens()\n for (let switchee of this._findSwitchees()) {\n this._switchSwitchee(switchee, fieldTokens)\n }\n }\n\n _switchSwitchee(switchee, fieldTokens = this._buildFieldTokens()) {\n let previousValues = switchee.upSwitchValues\n if (!u.isEqual(previousValues, fieldTokens)) {\n switchee.upSwitchValues = fieldTokens\n this.switchSwitcheeNow(switchee, fieldTokens)\n }\n }\n\n // No _ prefix: specs spy on this name, and _-prefixed members are mangled in the minified build.\n switchSwitcheeNow(switchee, fieldTokens) {\n for (let { attr, toggle } of BUILTIN_SWITCH_EFFECTS) {\n let attrValue = switchee.getAttribute(attr)\n if (attrValue) {\n let activeTokens = this._parseSwitcheeTokens(attrValue)\n let isActive = u.intersect(fieldTokens, activeTokens).length > 0\n toggle(switchee, isActive)\n }\n }\n let log = ['Switching %o', switchee]\n up.emit(switchee, 'up:form:switch', { field: this._root, fieldTokens, log })\n }\n\n _findSwitchees() {\n let scope = this._scope\n return scope ? up.fragment.subtree(scope, this._switcheeSelector) : []\n }\n\n get _scope() {\n if (this._regionSelector) {\n return up.fragment.get(this._regionSelector, { origin: this._root })\n } else {\n return up.form.getRegion(this._root)\n }\n }\n\n _parseSwitcheeTokens(str) {\n return u.getSimpleTokens(str, { json: true })\n }\n\n _buildFieldTokens() {\n let values = up.Params.fromContainer(this._root, { includeDisabled: true }).values()\n let tokens = [...values]\n\n let anyPresent = u.some(values, u.isPresent)\n tokens.push(anyPresent ? ':present' : ':blank')\n\n let fields = up.form.fields(this._root)\n if (fields[0]?.matches('[type=radio], [type=checkbox]')) {\n let anyChecked = u.some(fields, 'checked')\n tokens.push(anyChecked ? ':checked' : ':unchecked')\n }\n\n return tokens\n }\n\n}\n","const u = up.util\nconst e = up.element\n\nup.FormValidator = class FormValidator {\n\n constructor(form) {\n this._form = form\n this._dirtySolutions = []\n this._nextRenderTimer = null\n this._rendering = false\n this._honorAbort()\n }\n\n start() {\n let guard = (field) => this._isValidatingField(field)\n let callback = (field) => this._onFieldAdded(field)\n return up.form.trackFields(this._form, { guard }, callback)\n }\n\n _isValidatingField(field) {\n return field.closest('[up-validate]:not([up-validate=false])')\n }\n\n _onFieldAdded(field) {\n let eventType = up.form.validateOptions(field).event\n return up.on(field, eventType, (event) => {\n if (!field.closest('.up-keeping')) {\n up.log.putsEvent(event)\n up.error.muteUncriticalRejection(this.validate({ origin: field }))\n }\n })\n }\n\n _honorAbort() {\n up.fragment.onAborted(this._form, (event) => this._onAborted(event))\n }\n\n _onAborted(event) {\n let abortedError = new up.Aborted(event.reason)\n let solution\n while (solution = this._dirtySolutions.shift()) {\n solution.deferred.reject(abortedError)\n }\n }\n\n validate(options = {}) {\n let newSolutions = this._getSolutions(options)\n this._dirtySolutions.push(...newSolutions)\n this._scheduleNextRender()\n return newSolutions[0]?.deferred\n }\n\n _getSolutions(options) {\n let solutions = this._getTargetSelectorSolutions(options)\n || this._getFieldSolutions(options)\n || this._getElementSolutions(options.origin)\n\n // Although a single validate() call may update multiple fragments,\n // they will all share the same render pass.\n let deferred = u.newDeferred()\n\n for (let solution of solutions) {\n // Remember solution-specific render options from\n // (1) the given options object\n // (2) any [up-watch-] prefixed attributes parsed from the origin\n // (3) any [up-validate-] prefixed attributes parsed from the origin\n let renderOptions = up.form.validateOptions(solution.origin, options)\n solution.batch = u.pluckKey(renderOptions, 'batch')\n solution.renderOptions = renderOptions\n\n solution.destination = `${renderOptions.method} ${renderOptions.url}`\n // Resolve :origin pseudo here, as a batched validation will only\n // have a single { origin } (set to the form).\n solution.target = up.fragment.resolveOrigin(solution.target, solution)\n solution.deferred = deferred\n }\n\n return solutions\n }\n\n _getFieldSolutions({ origin, ...options }) {\n if (up.form.isField(origin)) {\n return this._getValidateAttrSolutions(origin) || this._getFormGroupSolutions(origin, options)\n }\n }\n\n _getFormGroupSolutions(field, { formGroup = true }) {\n if (!formGroup) return\n\n let solution = up.form.groupSolution(field, { targetable: true })\n if (solution) {\n up.puts('up.validate()', 'Validating form group of field %o', field)\n return [solution]\n }\n }\n\n _getTargetSelectorSolutions({ target, origin }) {\n if (u.isString(target)) {\n up.puts('up.validate()', 'Validating target \"%s\"', target)\n let simpleSelectors = up.fragment.splitTarget(target)\n return u.compact(simpleSelectors.map(function(simpleSelector) {\n let element = up.fragment.get(simpleSelector, { origin })\n if (element) {\n return {\n element,\n target: simpleSelector,\n origin\n }\n } else {\n up.fail('Validation target \"%s\" does not match an element', simpleSelector)\n }\n }))\n }\n }\n\n _getElementSolutions(element) {\n up.puts('up.validate()', 'Validating element %o', element)\n return [{\n element,\n target: up.fragment.toTarget(element),\n origin: element\n }]\n }\n\n _getValidateAttrSolutions(field) {\n // In case of radio buttons the [up-validate] attribute will\n // be set on a container containing the entire radio button group.\n let containerWithAttr = field.closest('[up-validate]')\n\n if (containerWithAttr) {\n let target = e.booleanOrStringAttr(containerWithAttr, 'up-validate')\n return this._getTargetSelectorSolutions({ target, origin: field })\n }\n }\n\n _scheduleNextRender() {\n let solutionDelays = this._dirtySolutions.map((solution) => solution.renderOptions.delay)\n let shortestDelay = Math.min(...solutionDelays) || 0\n // Render requests always reset the timer, using their then-current delay.\n clearTimeout(this._nextRenderTimer)\n this._nextRenderTimer = u.timer(shortestDelay, () => {\n this._nextRenderTimer = null\n this._renderDirtySolutions()\n })\n }\n\n _renderDirtySolutions() {\n up.error.muteUncriticalRejection(this._doRenderDirtySolutions())\n }\n\n async _doRenderDirtySolutions() {\n // We do *not* remove solutions for which the origin no longer exists,\n // as a delayed solution's { target } may still require an update.\n\n // When aborted we clear out _dirtySolutions to cancel a scheduled callback.\n if (!this._dirtySolutions.length) return\n\n // We don't run callbacks when a prior async callback is still running.\n // We will call _requestCallback() again once the prior callback terminates.\n if (this._rendering) return\n\n // When we re-called _requestCallback() after waiting for a prior callback, another\n // debounce delay may have started while waiting for the prior callback.\n // We must not shorted that debounce delay.\n if (this._nextRenderTimer) return\n\n let solutionsBatch = this._selectDirtySolutionsBatch()\n\n let renderOptions = this._mergeRenderOptions(solutionsBatch)\n\n // We don't render concurrently. If additional fields want to validate\n // while our request is in flight, they add to a new @dirtySolutions array.\n this._rendering = true\n\n try {\n // Resolve all promises we have handed out for the now-rendered solutions.\n let renderPromise = up.render(renderOptions)\n for (let solution of solutionsBatch) {\n solution.deferred.resolve(renderPromise)\n }\n await renderPromise\n } finally {\n this._rendering = false\n // Additional solutions may have become dirty while we were _rendering so we check again.\n // If no pending solutions are found, the method will return immediately.\n this._renderDirtySolutions()\n }\n }\n\n _selectDirtySolutionsBatch() {\n let batch = []\n let i = 0\n while (i < this._dirtySolutions.length) {\n let solution = this._dirtySolutions[i]\n if (batch.length === 0 || this._canBatchSolutions(batch[0], solution)) {\n batch.push(solution)\n this._dirtySolutions.splice(i, 1)\n } else {\n i++\n }\n }\n return batch\n }\n\n _canBatchSolutions(s1, s2) {\n return s1.destination === s2.destination && s1.batch && s2.batch\n }\n\n _mergeRenderOptions(dirtySolutions) {\n // Dirty fields are the fields that triggered the validation, not the fields contained\n // by the solution elements. This is not the same thing in a scenario like this:\n //\n // <form>\n // <input type=\"text\" name=\"email\" up-validate=\".results\">\n // <div class=\"results\"></div>\n // </form>\n\n // Remove duplicate names as a radio button group has multiple inputs with the same name.\n let dirtyOrigins = u.map(dirtySolutions, 'origin')\n let dirtyFields = u.flatMap(dirtyOrigins, up.form.fields)\n // Without this filter an unnamed field pads the header with an empty token (\"email \"). Two of\n // them can even join into a truthy \" \" — u.uniq() keeps both when one reports '' and the other\n // null — which would skip the ':unknown' fallback in _addValidateHeader() below.\n let dirtyNames = u.uniq(u.filter(u.map(dirtyFields, up.form.readFieldName), u.isPresent))\n let dirtyRenderOptionsList = u.map(dirtySolutions, 'renderOptions')\n\n // A validation is not a real submission: no button was pressed, so only the <form> element\n // decides where the request goes and what it sends.\n let formDestinationOptions = up.form.destinationOptions(this._form, { submitButton: false })\n\n // (1) Merge together all render options for all origins.\n // (2) Adopt some formDestinationOptions that cannot be overridden by solutions,\n // like { contentType }.\n // (3) u.mergeDefined() does not skip undefined objects, it skips entries in objects\n // that have an undefined value.\n let options = u.mergeDefined(formDestinationOptions, ...dirtyRenderOptionsList)\n\n // Update the collected targets of all solutions.\n options.target = u.map(dirtySolutions, 'target').join(', ')\n\n // Since we may render multiple dirty elements we cannot have individual origins\n // for each. We already resolved an :origin selector in getSolution(), so we don't\n // need { origin } for target resolution.\n options.origin = this._form\n\n // In case we're replacing an input that the user is typing in,\n // preserve focus, selection and scroll positions.\n options.focus ??= 'keep'\n\n // The protocol doesn't define whether the validation results in a status code.\n // Some backends might want to communicate a failed validation, others might not.\n // In any case we render the same targets for both success and failure.\n //\n // In cases when the server does respond with an error status, we still want to\n // reject the up.validate() promise. Hence we use { failOptions: false } instead of\n // { fail: false }.\n options.failOptions = false\n\n // Re-rendering forms may cause dependent elements to disappear.\n // Let's not blow up the render pass in that case.\n options.defaultMaybe = true\n\n // We can receive params from\n // (1) A <form up-params=\"...\"> JSON attribute, obtained by up.form.destinationOptions() above\n // (2) one or more up.validate({ params }) calls\n options.params = up.Params.merge(\n formDestinationOptions.params,\n ...u.map(dirtyRenderOptionsList, 'params')\n )\n\n // We can receive headers from\n // (1) A <form up-headers=\"...\"> JSON attribute, obtained by up.form.destinationOptions() above\n // (2) one or more up.validate({ headers }) calls\n options.headers = u.merge(\n formDestinationOptions.headers,\n ...u.map(dirtyRenderOptionsList, 'headers')\n )\n\n // Make sure the X-Up-Validate header is present, so the server-side\n // knows that it should not persist the form submission\n this._addValidateHeader(options.headers, dirtyNames)\n\n // If any solution wants feedback, they all get it.\n // When no solution has an opinion we leave { feedback } unset, so the render default applies.\n let feedbacks = u.compact(u.map(dirtyRenderOptionsList, 'feedback'))\n if (feedbacks.length) options.feedback = feedbacks.includes(true)\n\n // Each up.validate({ data }) call should only apply to the targeted element,\n options.data = undefined\n options.dataMap = u.mapObject(dirtySolutions, ({ target, element, renderOptions: { data, keepData } }) => [\n target,\n keepData ? up.data(element) : data\n ])\n\n // Each up.validate({ preview }) call should only apply to the targeted element,\n options.preview = undefined\n options.previewMap = u.mapObject(dirtySolutions, ({ target, renderOptions: { preview } }) => [target, preview])\n\n // Each up.validate({ placeholder }) call should only apply to the targeted element,\n options.placeholder = undefined\n options.placeholderMap = u.mapObject(dirtySolutions, ({ target, renderOptions: { placeholder } }) => [target, placeholder])\n\n // We may render multiple solutions with { disable } options, and most disable options\n // are specific to an { origin }, e.g. `{ disable: '.form-group:has(:origin)'}\n // Since up.render() can only take a single { origin },\n // we resolve it here.\n //\n // Disabling the same elements multiple time is not an issue since up.form.disableTemp()\n // only sees enabled elements.\n options.disable = dirtySolutions.map((solution) => up.fragment.resolveOrigin(solution.renderOptions.disable, solution))\n\n // The guardEvent will be emitted on the render pass' { origin }, so the form in this case.\n // The guardEvent will also be assigned a { renderOptions } attribute in up.render()\n options.guardEvent = up.event.build('up:form:validate', {\n fields: dirtyFields,\n log: 'Validating form',\n params: options.params,\n form: this._form,\n })\n\n return options\n }\n\n _addValidateHeader(headers, names) {\n let key = up.protocol.headerize('validate')\n let value = names.join(' ')\n if (!value || value.length > up.protocol.config.maxHeaderSize) value = ':unknown'\n headers[key] = value\n }\n\n}\n","up.FocusCapsule = class FocusCapsule {\n\n constructor(element, target) {\n this._element = element\n this._target = target\n this._cursorProps = up.viewport.copyCursorProps(this._element)\n }\n\n wasLost() {\n return document.activeElement !== this._element && !this._voided\n }\n\n /*-\n Invalidates this capsule when an explicit focus change by the user was detected.\n\n Call it *after* your own focus-losing DOM mutation:\n\n ```js\n let capsule = up.FocusCapsule.preserve(layer)\n domChangeThatMayLoseFocus() // e.g. disabling\n capsule.autoVoid()\n await timeInWhichUserMayChangeFocusExplictly()\n capsule.restore()\n ```\n\n @function up.FocusCapsule.prototype.autoVoid\n @internal\n */\n autoVoid() {\n up.on('focusin', { once: true }, () => this._voided = true)\n }\n\n restore(layer, focusOptions) {\n if (!this.wasLost()) {\n // Signal callers that we could not restore.\n // This matters to up.FragmentFocus to know that a { focus: ['restore', '.other'] }\n // option could not restore focus, and should focus the next option (\".other\".).\n return false\n }\n\n // Without a target we cannot rediscover the element in a new fragment.\n let rediscoveredElement = this._target && up.fragment.get(this._target, { layer })\n if (rediscoveredElement) {\n // Firefox needs focus-related props to be set *before* we focus the element\n up.viewport.copyCursorProps(this._cursorProps, rediscoveredElement)\n up.focus(rediscoveredElement, focusOptions)\n\n // Signals callers that we could restore.\n // This matters to up.FragmentFocus to know that a { focus: ['restore', '.other'] }\n // option could restore focus, and should not focus the next option (\".other\".).\n return true\n }\n }\n\n static preserve(layer) {\n let focusedElement = up.viewport.focusedElementWithin(layer.element)\n if (!focusedElement) return\n\n // We also preserve an element that we cannot target. We won't be able to restore its focus,\n // but we can still tell whether it was lost, e.g. for { focus: 'target-if-lost' }.\n let target = up.fragment.tryToTarget(focusedElement)\n return new this(focusedElement, target)\n }\n\n}\n","const u = up.util\n\nup.FragmentProcessor = class FragmentProcessor extends up.Record {\n\n keys() {\n return [\n 'fragment',\n 'autoMeans',\n 'origin',\n 'layer'\n ]\n }\n\n process(opt) {\n let preprocessed = this.preprocessOnce(opt)\n return this.tryProcess(preprocessed)\n }\n\n preprocessOnce(opt) {\n return u.getComplexTokens(opt)\n }\n\n tryProcess(opt) {\n if (u.isArray(opt)) {\n return this.processArray(opt)\n }\n\n if (u.isOptions(opt)) {\n return this.processSelectorMap(opt)\n }\n\n if (u.isFunction(opt)) {\n let result = up.error.guard(opt, this.fragment, this.attributes())\n // The function result can be another processable value.\n return this.tryProcess(result)\n }\n\n if (u.isElement(opt)) {\n return this.processElement(opt) // TODO: Test that { focus: Element } works\n }\n\n if (u.isString(opt)) {\n if (opt === 'auto') {\n return this.tryProcess(this.autoMeans)\n }\n\n let match = opt.match(/^(.+?)-if-(.+?)$/)\n if (match) {\n return this.resolveCondition(match[2]) && this.tryProcess(match[1])\n }\n }\n\n return this.processPrimitive(opt)\n }\n\n processSelectorMap(map) {\n return Object.keys(map).filter((selector) => {\n let match = this.findSelector(selector)\n if (match) {\n let matchProcessor = new this.constructor({ ...this.attributes(), fragment: match })\n let opt = map[selector]\n return matchProcessor.process(opt)\n }\n })\n }\n\n processArray(array) {\n return u.find(array, (opt) => this.tryProcess(opt))\n }\n\n resolveCondition(condition) {\n if (condition === 'main') {\n return this.fragment && up.fragment.contains(this.fragment, ':main')\n }\n }\n\n findSelector(selector) {\n const lookupOpts = { layer: this.layer, origin: this.origin }\n\n let matchWithinFragment = this.fragment && up.fragment.get(this.fragment, selector, lookupOpts)\n // Prefer selecting a descendant of @fragment, but if not possible search through @fragment's entire layer\n let match = matchWithinFragment || up.fragment.get(selector, lookupOpts)\n\n if (match) {\n return match\n } else {\n up.warn('up.render()', 'Could not find an element matching \"%s\"', selector)\n // Return undefined so { focus: 'auto' } will try the next option from { autoMeans }\n }\n }\n}\n","const u = up.util\nconst DESCENDANT_SELECTOR = /^([^ >+(]+) (.+)$/\n\nup.FragmentFinder = class FragmentFinder {\n\n constructor(options) {\n this._options = options\n this._origin = options.origin\n // Selector is a string, not an up.Selector\n this._selector = options.selector\n // This option is for matching fragments in detached content, as needed by up.ResponseDoc.\n this._document = options.document || window.document\n this._match = options.match ?? up.fragment.config.match\n this._preferOldElements = options.preferOldElements\n }\n\n find() {\n return this._findInPreferredElements() || this._findInRegion() || this._findFirst()\n }\n\n _findInPreferredElements() {\n if (this._preferOldElements) {\n return this._preferOldElements.find((preferOldElement) => this._document.contains(preferOldElement) && up.fragment.matches(preferOldElement, this._selector))\n }\n }\n\n _findInRegion() {\n if (this._match === 'region' && !up.fragment.containsMainPseudo(this._selector) && this._origin?.isConnected) {\n return this._findClosest() || this._findDescendantInRegion()\n }\n }\n\n _findClosest() {\n return up.fragment.closest(this._origin, this._selector, this._options)\n }\n\n _findDescendantInRegion() {\n let simpleSelectors = up.fragment.splitTarget(this._selector)\n\n return u.findResult(simpleSelectors, (simpleSelector) => {\n let parts = simpleSelector.match(DESCENDANT_SELECTOR)\n if (parts) {\n let parent = up.fragment.closest(this._origin, parts[1], this._options)\n if (parent) {\n return up.fragment.getFirstDescendant(parent, parts[2], this._options)\n }\n }\n })\n }\n\n _findFirst() {\n return up.fragment.getFirstDescendant(this._document, this._selector, this._options)\n }\n}\n","const u = up.util\nconst e = up.element\n\nconst PREVENT_SCROLL_OPTIONS = { preventScroll: true }\n\nup.FragmentFocus = class FragmentFocus extends up.FragmentProcessor {\n\n keys() {\n return super.keys().concat([\n 'hash',\n 'focusVisible',\n 'focusCapsule',\n 'inputDevice',\n ])\n }\n\n processPrimitive(opt) {\n switch (opt) {\n case 'keep':\n // Try to keep the focus from before the fragment update.\n return this._restoreLostFocus()\n case 'restore':\n // Restore the focus we saved at a previous visit the current location.\n return this._restorePreviousFocusForLocation()\n case 'target':\n case true:\n return this._focusElement(this.fragment)\n case 'layer':\n return this._focusElement(this.layer.getFocusElement())\n case 'main':\n return this._focusSelector(':main')\n case 'hash':\n return this._focusHash()\n case 'autofocus':\n return this._autofocus()\n default:\n if (u.isString(opt)) {\n return this._focusSelector(opt)\n }\n }\n }\n\n processElement(element) {\n return this._focusElement(element)\n }\n\n resolveCondition(condition) {\n if (condition === 'lost') {\n return this._wasFocusLost()\n } else {\n return super.resolveCondition(condition)\n }\n }\n\n _focusSelector(selector) {\n let match = this.findSelector(selector)\n return this._focusElement(match)\n }\n\n _restoreLostFocus() {\n return this.focusCapsule?.restore(this.layer, PREVENT_SCROLL_OPTIONS)\n }\n\n _restorePreviousFocusForLocation() {\n return up.viewport.restoreFocus({ layer: this.layer })\n }\n\n _autofocus() {\n let autofocusElement = this.fragment && e.subtreeFirst(this.fragment, '[autofocus]')\n if (autofocusElement) {\n return this._focusElement(autofocusElement)\n }\n }\n\n _focusElement(element) {\n if (element) {\n up.focus(element, {\n force: true, // force focus on otherwise non-focusable elements\n ...PREVENT_SCROLL_OPTIONS,\n inputDevice: this.inputDevice,\n focusVisible: this.focusVisible,\n })\n return true\n }\n }\n\n _focusHash() {\n let hashTarget = up.viewport.firstHashTarget(this.hash, { layer: this.layer })\n if (hashTarget) {\n return this._focusElement(hashTarget)\n }\n }\n\n _wasFocusLost() {\n return this.focusCapsule?.wasLost()\n }\n\n}\n","const e = up.element\nconst u = up.util\n\nup.FragmentPolling = class FragmentPolling {\n\n static forFragment(fragment) {\n return fragment.upPolling ||= new this(fragment)\n }\n\n constructor(fragment) {\n this._options = up.radio.pollOptions(fragment)\n\n this._fragment = fragment\n up.destructor(fragment, this._onFragmentDestroyed.bind(this))\n\n this._state = 'stopped' // stopped | started\n this._forceIntent = null // stop | start\n\n this._reloadJID = u.uid()\n\n // this._abortable = true\n this._loading = false\n this._satisfyInterval()\n }\n\n onPollAttributeObserved() {\n this._start()\n }\n\n _onFragmentAborted({ newLayer, jid }) {\n const isOurAbort = (jid === this._reloadJID)\n if (isOurAbort || newLayer) return\n this._stop()\n }\n\n _onFragmentKept() {\n if (this._forceIntent !== 'stop') {\n this._start()\n }\n }\n\n _onFragmentDestroyed() {\n // The element may come back (when it is swapped) or or may not come back (when it is destroyed).\n // If it does come back, `onPollAttributeObserved()` will restart the polling.\n this._stop()\n }\n\n _start(options) {\n Object.assign(this._options, options)\n\n if (this._state === 'stopped') {\n if (!up.fragment.isTargetable(this._fragment)) {\n up.warn('[up-poll]', 'Cannot poll untargetable fragment %o', this._fragment)\n return\n }\n\n this._state = 'started'\n this._bindEvents()\n this._scheduleRemainingTime()\n }\n }\n\n _stop() {\n if (this._state === 'started') {\n this._clearReloadTimer() // don't keep inactive tabs awake\n this._state = 'stopped'\n }\n }\n\n forceStart(options) {\n Object.assign(this._options, options)\n this._forceIntent = 'start'\n this._start()\n }\n\n forceStop() {\n this._forceIntent = 'stop'\n this._stop()\n }\n\n _bindEvents() {\n if (this._eventsBound) return\n this._eventsBound = true\n\n up.destructor(this._fragment, up.on('visibilitychange up:layer:opened up:layer:dismissed up:layer:accepted', this._onVisibilityChange.bind(this)))\n up.fragment.onAborted(this._fragment, this._onFragmentAborted.bind(this))\n up.fragment.onKept(this._fragment, this._onFragmentKept.bind(this))\n }\n\n _onVisibilityChange() {\n if (this._isFragmentVisible()) {\n this._scheduleRemainingTime() // will check started\n } else {\n this._clearReloadTimer()\n }\n }\n\n _isFragmentVisible() {\n return (!document.hidden) &&\n (this._options.ifLayer === 'any' || this._isOnFrontLayer())\n }\n\n _clearReloadTimer() {\n clearTimeout(this._reloadTimer)\n this._reloadTimer = null\n }\n\n _scheduleRemainingTime() {\n if (this._reloadTimer || this._loading || this._state === 'stopped') return\n\n this._clearReloadTimer()\n this._reloadTimer = setTimeout(\n this._onTimerReached.bind(this),\n this._getRemainingDelay()\n )\n }\n\n _onTimerReached() {\n this._reloadTimer = null\n this._tryReload()\n }\n\n _tryReload() {\n // The setTimeout(doReload) callback might already be scheduled\n // before the polling stopped.\n if (this._state === 'stopped') {\n return\n }\n\n if (!up.fragment.isAlive(this._fragment)) {\n this._stop()\n up.puts('[up-poll]', 'Stopped polling a detached fragment')\n return\n }\n\n if (!this._isFragmentVisible()) {\n up.puts('[up-poll]', 'Will not poll hidden fragment')\n // (1) We don't need to re-schedule a timer here. _onVisibilityChange() will do that for us.\n // (2) Also we prefer to not have pending timers in inactive tabs to save resources.\n return\n }\n\n this._reloadNow()\n }\n\n _getFullDelay() {\n return this._options.interval ?? e.numberAttr(this._fragment, 'up-interval') ?? up.radio.config.pollInterval\n }\n\n _getRemainingDelay() {\n return Math.max(this._getFullDelay() - this._getFragmentAge(), 0)\n }\n\n _getFragmentAge() {\n return new Date() - this._lastAttempt\n }\n\n _isOnFrontLayer() {\n this.layer ||= up.layer.get(this._fragment)\n return this.layer?.isFront?.()\n }\n\n _reloadNow() {\n // If we were called manually (not by a timeout), clear a scheduled timeout to prevent concurrency.\n // The timeout will be re-scheduled by this._onReloadSuccess() or this._onReloadFailure().\n this._clearReloadTimer()\n\n // Don't schedule timers while we're loading. _onReloadSuccess() and _onReloadFailure() will do that for us.\n this._loading = true\n\n let guardEvent = up.event.build('up:fragment:poll', { log: ['Polling fragment', this._fragment] })\n let reloadOptions = { ...this._options, guardEvent, jid: this._reloadJID }\n\n up.reload(this._fragment, reloadOptions).then(\n this._onReloadSuccess.bind(this),\n this._onReloadFailure.bind(this)\n )\n }\n\n _onReloadSuccess({ fragment }) {\n this._loading = false\n this._satisfyInterval()\n\n if (fragment) {\n // No need to _scheduleRemainingTime() in this branch:\n //\n // (1) Either the new fragment also has an [up-poll] and we have already started in _onPollAttributeObserved().\n // (2) Or we are force-started and we will start in _onFragmentSwapped().\n this._onFragmentSwapped(fragment)\n } else {\n // The server may have opted to not send an update (e.g. if there is no fresher content) or if the fragment was kept.\n // In that case we try again in the next interval.\n this._scheduleRemainingTime()\n }\n }\n\n _onFragmentSwapped(newFragment) {\n if (this._forceIntent === 'start' && up.fragment.matches(this._fragment, newFragment)) {\n // Force start the new up.Polling instance for the new fragment.\n this.constructor.forFragment(newFragment).forceStart(this._options)\n }\n }\n\n _onReloadFailure(reason) {\n // An error response rejects with an up.RenderResult (rendered into { failTarget: ':none' }),\n // which is not critical. Only a fatal render error will be thrown below.\n this._loading = false\n this._satisfyInterval()\n this._scheduleRemainingTime()\n up.error.throwCritical(reason)\n }\n\n _satisfyInterval() {\n // This will delay the next timer scheduling for a full interval.\n this._lastAttempt = new Date()\n }\n\n}\n","const u = up.util\n\nup.FragmentScrolling = class FragmentScrolling extends up.FragmentProcessor {\n\n keys() {\n return super.keys().concat([\n 'hash',\n 'mode',\n 'revealTop',\n 'revealMax',\n 'revealSnap',\n 'revealPadding',\n 'behavior',\n 'oldScrollTops',\n ])\n }\n\n constructor(options) {\n // Render options call it { scrollBehavior } to stand out among many other options.\n // The viewport functions we call only take scrolling options, and call it { behavior }.\n super({ ...options, behavior: options.scrollBehavior })\n }\n\n processPrimitive(opt) {\n switch (opt) {\n case 'top':\n return this._scrollTo(0)\n case 'bottom':\n return this._scrollTo(-0)\n case 'layer':\n return this._revealLayer()\n case 'main':\n return this._revealSelector(':main')\n case 'keep':\n return this._restoreOld()\n case 'restore':\n return this._restoreSaved()\n case 'hash':\n return this.hash && up.viewport.revealHash(this.hash, this.attributes())\n case 'target':\n case 'reveal':\n case true:\n return this._revealElement(this.fragment)\n default:\n if (u.isNumber(opt)) {\n return this._scrollTo(opt)\n } else if (u.isString(opt)) {\n return this._revealSelector(opt)\n }\n }\n }\n\n processElement(element) {\n return this._revealElement(element)\n }\n\n _revealElement(element) {\n if (element) {\n up.reveal(element, this.attributes())\n return true\n }\n }\n\n _revealSelector(selector) {\n let match = this.findSelector(selector)\n return this._revealElement(match)\n }\n\n _revealLayer() {\n // Reveal the layer's box instead of the layer's element.\n // If the layer has its own viewport, like a modal, revealing the box will\n // scroll the layer viewport. Revealing the layer element would scroll\n // the main document viewport.\n return this._revealElement(this.layer.getBoxElement())\n }\n\n _scrollTo(position) {\n // With { around: undefined }, scrollToTop() resets all viewports in { layer }\n return up.viewport.scrollTo(position, { ...this.attributes(), around: this.fragment })\n }\n\n _restoreOld() {\n if (this.oldScrollTops) {\n return this._restoreSaved({ scrollTops: this.oldScrollTops })\n }\n }\n\n _restoreSaved(extraOptions) {\n // With { around: undefined }, restoreScroll() restores all viewports in { layer }\n return up.viewport.restoreScroll({ ...this.attributes(), around: this.fragment, ...extraOptions })\n }\n\n}\n","const e = up.element\nconst u = up.util\n\n/*-\nEach layer has an `up.Layer` instance.\n\nMost functions in the `up.layer` package interact with the [current layer](/api/up.layer.current).\nFor example, `up.layer.dismiss()` is a shortcut for `up.layer.current.dismiss()`.\n\n`up.layer.current` is set to the right layer in compilers and most events,\neven if that layer is not the frontmost layer. E.g. if you're compiling a fragment for a background layer, `up.layer.current` will be\nthe background layer during compilation.\n\n@class up.Layer\n@parent up.layer\n*/\nup.Layer = class Layer extends up.Record {\n\n /*-\n This layer's outmost container element.\n\n ### Example\n\n ```js\n let rootLayer = up.layer.root\n let overlay = await up.layer.open()\n\n rootLayer.element // returns <body>\n overlay.element // returns <up-modal>\n ```\n\n @property up.Layer#element\n @param {Element} element\n The layer's container element.\n @stable\n */\n\n /*-\n Whether this layer has [visible history](/learn/history-in-overlays).\n\n When it does, fragment updates within this layer can change the browser's address bar and window title.\n If a layer does not have visible history, its descendant layers cannot have visible history either.\n\n @learn-ref history-in-overlays\n\n @property up.Layer#history\n @param {boolean} history\n Whether this layer has visible history.\n @stable\n */\n\n /*-\n This layer's mode which governs its appearance and behavior.\n\n Requests targeting this layer will send the mode value as an `X-Up-Mode` header.\n\n @learn-ref customizing-overlays\n\n @property up.Layer#mode\n @param {string} mode\n The layer mode.\n @stable\n */\n\n /*-\n This layer's [context](/learn/layer-context).\n\n ### Example\n\n You may access the context properties like a regular JavaScript object.\n\n ```js\n let layer = up.layer.current\n layer.context.message = 'Please select a contact'\n console.log(layer.context) // logs \"{ message: 'Please select a contact' }\"\n ```\n\n @learn-ref layer-context\n\n @property up.Layer#context\n @param {Object} context\n The context object.\n\n If no context has been set an empty object is returned.\n @experimental\n */\n\n keys() {\n return [\n 'element',\n 'stack',\n 'history',\n 'mode',\n 'context',\n 'lastScrollTops',\n 'lastFocusCapsules',\n ]\n }\n\n defaults() {\n return {\n context: {}, // To reset root\n lastScrollTops: up.viewport.newStateCache(),\n lastFocusCapsules: up.viewport.newStateCache(),\n // Reset the root layer's history, so it falls back to what the browser shows.\n _savedTitle: undefined,\n _savedMetaTags: undefined,\n _savedLocation: undefined,\n _savedLang: undefined,\n }\n }\n\n constructor(options = {}) {\n super(options)\n u.assert(this.mode)\n }\n\n setupHandlers() {\n up.link.convertClicks(this)\n this._unbindLocationChanged = up.on('up:location:changed', (event) => this._onBrowserLocationChanged(event))\n }\n\n teardownHandlers() {\n this._unbindLocationChanged?.()\n }\n\n mainTargets() {\n return up.layer.mainTargets(this.mode)\n }\n\n /*-\n Synchronizes this layer with the rest of the page.\n\n For instance, a popup overlay will re-calculate its position arounds its anchoring element.\n\n You only need to call this method after DOM changes unknown to Unpoly have brought\n overlays out of alignment with the rest of the page.\n\n @function up.Layer#sync\n @experimental\n */\n sync() {\n // no-op so users can blindly sync without knowing the current mode\n }\n\n /*-\n [Closes this overlay](/learn/closing-overlays) with an accepting intent,\n e.g. when a change was confirmed or when a value was selected.\n\n To dismiss a layer *without* an accepting intent, use `up.Layer#dismiss()` instead.\n\n @learn-ref closing-overlays\n\n @function up.Layer#accept\n @section Acceptance\n @param {any} [value]\n The [acceptance value](/learn/closing-overlays#acceptance-values) that will be passed to `{ onAccepted }` callbacks.\n\n If there isn't an acceptance value, omit this argument.\n If you need to pass options without an acceptance value, pass `null`:\n\n ```js\n up.layer.accept(null, { animation: 'move-to-bottom' })\n ```\n @param {string} [options.confirm]\n A message the user needs to confirm before the overlay is closed.\n\n See [[confirmation-dialogs#overlays]].\n\n @param {boolean} [options.preventable=true]\n Whether the closing can be prevented by an event listener.\n\n @internal\n\n @param {up.Response} [options.response]\n The server response that caused this overlay to close.\n\n May be left blank if the overlay was not closed in reaction to a server response.\n\n See [Using the discarded response](/learn/closing-overlays#using-the-discarded-response).\n\n @section Animation\n @param {string|Function(Element, Object)} [options.animation]\n The [animation](/api/up.animate) to use for closing this layer.\n\n Defaults to the close animation [configured](/api/up.layer.config) for this layer mode.\n @param {number} [options.duration]\n The duration for the close animation in milliseconds.\n @param {string} [options.easing]\n The [timing function](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function)\n that controls the acceleration of the close animation.\n @param {Function} [options.onFinished]\n A callback that will run when the elements have been removed from the DOM.\n\n If the layer has a close animation, the callback will run after the animation has finished.\n\n @section History\n @param {boolean} [options.history=true]\n Whether to restore the parent layer's [history state](/learn/updating-history#history-state)\n in the browser's address bar.\n\n @experimental\n @stable\n */\n accept() {\n throw new up.NotImplemented()\n }\n\n /*-\n [Closes this overlay](/learn/closing-overlays) *without* an accepting intent,\n e.g. when a \"Cancel\" button was clicked.\n\n To close an overlay with an accepting intent, use `up.Layer#accept()` instead.\n\n @learn-ref closing-overlays\n\n @function up.Layer#dismiss\n @param {any} [value]\n The [dismissal value](/learn/closing-overlays#dismissal-values) that will be passed to `{ onDismissed }` callbacks.\n\n If there isn't a dismissal value, omit this argument.\n If you need to pass options without a dismissal value, pass `null`:\n\n ```js\n up.layer.dismiss(null, { animation: 'move-to-bottom' })\n ```\n @param {Object} [options]\n See options for `up.Layer#accept()`.\n @stable\n */\n dismiss() {\n throw new up.NotImplemented()\n }\n\n /*-\n [Dismisses](/api/up.Layer.prototype.dismiss) all descendant overlays,\n making this layer the [frontmost layer](/api/up.layer.front) in the [layer stack](/api/up.layer.stack).\n\n Descendant overlays will be dismissed with value `':peel'`.\n\n Listeners to `up:layer:dismiss` or `up:layer:accept` cannot keep a descendant overlay open.\n\n @function up.Layer#peel\n @section Closing\n @param {any} [options.value=\":peel\"]\n The [result value](/learn/closing-overlays#result-values) for the descendant overlays.\n\n @param {string} [options.intent=\"dismiss\"]\n The [close intent](/learn/closing-overlays#intents) for the descendant overlays.\n\n By default descendant overlays will be dismissed.\\\n You can pass `{ intent: \"accept\" }` to\n accept them instead.\n\n @section Animation\n @param {string|Function(Element, Object)} [options.animation]\n The [animation](/api/up.animate) to use for closing descendant overlays.\n\n Defaults to the close animation [configured](/api/up.layer.config) for the respective layer modes.\n\n @param [options.duration]\n @like up.Layer#accept\n\n @param [options.easing]\n @like up.Layer#accept\n\n @stable\n */\n peel(options) {\n this.stack.peel(this, options)\n }\n\n evalOption(option) {\n return u.evalOption(option, this)\n }\n\n /*-\n Returns whether this layer is the [current layer](/api/up.layer.current).\n\n @function up.Layer#isCurrent\n @return {boolean}\n Whether this layer is the current layer.\n @stable\n */\n isCurrent() {\n return this.stack.isCurrent(this)\n }\n\n /*-\n Returns whether this layer is the [frontmost layer](/api/up.layer.front).\n\n @function up.Layer#isFront\n Whether this layer is the front layer.\n @return {boolean}\n @stable\n */\n isFront() {\n return this.stack.isFront(this)\n }\n\n /*-\n Returns whether this layer is the [root layer](/api/up.layer.root).\n\n @function up.Layer#isRoot\n @return {boolean}\n Whether this layer is the root layer.\n @stable\n */\n isRoot() {\n return this.stack.isRoot(this)\n }\n\n /*-\n Returns whether this layer is *not* the [root layer](/api/up.layer.root).\n\n @function up.Layer#isOverlay\n @return {boolean}\n @stable\n */\n isOverlay() {\n return this.stack.isOverlay(this)\n }\n\n /*-\n Returns whether this layer is part of the [layer stack](/api/up.layer.stack) and can be interacted with.\n\n ## When a layer is alive\n\n A layer that is alive can be [targeted](/learn/targeting-fragments) with fragment changes, or [queried](/api/up.fragment.get) for containing elements.\n\n The [root layer](/learn/overlays#layer-modes) is always alive.\n An overlay is alive as soon as it enters the DOM, even when it is still playing its opening animation.\n\n An overlay stops being alive as soon as it starts [closing](/learn/closing-overlays),\n even while its closing animation is still playing.\n\n | Overlay state | `up.Layer#isAlive()` |\n |---------------------------|----------------------|\n | Entered DOM | `true` |\n | Opening animation playing | `true` |\n | Opened | `true` |\n | Closing animation playing | `false` |\n | Removed from DOM | `false` |\n\n ## See also\n\n - The `.up-destroying` class is automatically assigned to elements in their exit animation.\n - All `up.fragment` functions (like `up.fragment.get()`) ignore elements in their exit animation.\n - The `up.fragment.isAlive()` function checks if an element is attached to the DOM and also not in an exit animation.\n\n @function up.Layer#isAlive\n @return {boolean}\n Whether this layer is considered alive.\n @stable\n */\n isAlive() {\n throw new up.NotImplemented()\n }\n\n assertAlive() {\n if (!this.isAlive()) {\n // Wind up the call stack. Whoever has closed the layer will also clean up\n // elements, handlers, etc.\n throw new up.Aborted(\"Layer is no longer alive\")\n }\n }\n\n /*-\n Returns this layer's parent layer.\n\n The parent layer is the layer that opened this layer. It is visually in the background of this layer.\n\n Returns `undefined` for the [root layer](/api/up.layer.root).\n\n ## Example\n\n ```js\n up.layer.open()\n\n up.layer.parent // returns up.Layer.Root\n ```\n\n @property up.Layer#parent\n @param {up.Layer} parent\n This layer's parent layer.\n @stable\n */\n get parent() {\n return this.stack.parentOf(this)\n }\n\n /*-\n Returns this layer's child layer.\n\n The child layer is the layer that was opened on top of this layer. It visually overlays this layer.\n\n Returns `undefined` if this layer has not opened a child layer.\n\n A layer can have at most one child layer. Opening an overlay on a layer with an existing child will\n first dismiss the existing child before replacing it with the new child.\n\n @property up.Layer#child\n @return {up.Layer} child\n This layer's direct child overlay.\n @stable\n */\n get child() {\n return this.stack.childOf(this)\n }\n\n /*-\n Returns an array of this layer's ancestor layers.\n\n The array elements are ordered by distance to this layer.\n The first element is this layer's direct parent. The last element\n is the [root layer](/api/up.layer.root).\n\n ## Example\n\n ```js\n // Open two overlays\n up.layer.open({ mode: 'drawer' })\n up.layer.open({ mode: 'modal' })\n\n up.layer.current.ancestors // returns [up.Layer.Drawer, up.Layer.Root]\n ```\n\n @property up.Layer#ancestors\n @return {Array<up.Layer>} ancestors\n This layer's ancestors.\n @stable\n */\n get ancestors() {\n return this.stack.ancestorsOf(this)\n }\n\n /*-\n Returns an array of this layer's descendant layers, with the closest descendants listed first.\n\n Descendant layers are all layers that visually overlay this layer.\n\n The array elements are ordered by distance to this layer.\n The first element is this layer's direct child. The last element\n is the [frontmost layer](/api/up.layer.front).\n\n ## Example\n\n ```js\n up.layer.open()\n up.layer.current // returns up.Layer.Modal\n up.layer.current.descendants // returns []\n up.layer.root.descendants // returns [up.Layer.Modal]\n ```\n\n\n @property up.Layer#descendants\n @return {Array<up.Layer>} descendants\n This layer's descendants.\n @stable\n */\n get descendants() {\n return this.stack.descendantsOf(this)\n }\n\n /*-\n Returns an array of this layer and its descendant layers, with the closest descendants listed first.\n\n Descendant layers are all layers that visually overlay this layer.\n\n The array elements are ordered by distance to this layer.\n The first element is this layer.\n The second element is this layer's direct child. The last element\n is the [frontmost layer](/api/up.layer.front).\n\n @property up.Layer#subtree\n @return {Array<up.Layer>} subtree\n An array of this layer and its descendants.\n @experimental\n */\n get subtree() {\n return [this, ...this.descendants]\n }\n\n /*-\n Returns the zero-based position of this layer in the [layer stack](/api/up.layer.stack).\n\n The [root layer](/api/up.layer.root) has an index of `0`, its child overlay has an index of `1`, and so on.\n\n This property has no defined behavior for layers that are [closed or are being closed](/api/up.Layer.prototype.isAlive).\n\n @property up.Layer#index\n @return {number} index\n The position of this layer in the stack.\n @stable\n */\n get index() {\n return this._index ??= this.stack.indexOf(this)\n }\n\n getContentElement() {\n return this.contentElement || this.element\n }\n\n getBoxElement() {\n return this.boxElement || this.element\n }\n\n getFocusElement() {\n return this.getBoxElement()\n }\n\n getFirstSwappableElement() {\n throw new up.NotImplemented()\n }\n\n /*-\n Returns whether the given `element` is contained by this layer.\n\n This function will always return `false` for elements in [descendant](/api/up.Layer.prototype.descendants) overlays,\n even if the descendant overlay's element is nested into the DOM tree of this layer.\n\n @function up.Layer#contains\n @param {Element} element\n The element to test.\n @return {boolean}\n Whether the layer contains the element.\n @stable\n */\n contains(element) {\n // Test that the closest parent is the element and not another layer with elements nested\n // into this layer's element.\n return up.layer.closestLayerElement(element) === this.element\n }\n\n /*-\n Listens to a [DOM event](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Events) that originated\n on an element [contained](/api/up.Layer.prototype.contains) by this layer.\n\n This will ignore events emitted on elements in [descendant](/api/up.Layer.prototype.descendants) overlays,\n even if the descendant overlay's element is nested into the DOM tree of this layer.\n\n The arguments for this function are the same as for `up.on()`.\n\n ### Example\n\n ```js\n let rootLayer = up.layer.root\n let overlay = await up.layer.open()\n\n rootLayer.on('foo', (event) => console.log('Listener called'))\n\n rootLayer.emit('foo') // logs \"Listener called\"\n overlay.emit('foo') // listener is not called\n ```\n\n ### Most Unpoly events have a layer reference\n\n Whenever possible Unpoly will emit its events on associated layers instead of `document`.\n This way you can listen to events on one layer without receiving events from other layers.\n\n E.g. to listen to all [requests](/api/up.request) originating from a given layer:\n\n ```js\n let rootLayer = up.layer.root\n let rootLink = rootLayer.affix('a[href=/foo]')\n\n let overlay = await up.layer.open()\n let overlayLink = overlay.affix('a[href=/bar]')\n\n rootLayer.on('up:request:load', (event) => console.log('Listener called'))\n\n up.follow(rootLink) // logs \"Listener called\"\n up.follow(overlayLink) // listener is not called\n ```\n\n @function up.Layer#on\n @include up.on/after-element\n @stable\n */\n on(...args) {\n return this._buildEventListenerGroup(args).bind()\n }\n\n /*-\n Unbinds an event listener previously bound with `up.Layer#on()`.\n\n @function up.Layer#off\n @include up.off/after-element\n @stable\n */\n off(...args) {\n return this._buildEventListenerGroup(args).unbind()\n }\n\n _buildEventListenerGroup(args) {\n return up.EventListenerGroup.fromBindArgs(args, {\n guard: (event) => this._containsEventTarget(event),\n elements: [this.element],\n baseLayer: this\n })\n }\n\n _containsEventTarget(event) {\n // Since the root layer will receive events emitted on descendant layers\n // we need to manually check whether the event target is contained\n // by this layer.\n return this.contains(event.target)\n }\n\n wasHitByMouseEvent({ clientX, clientY }) {\n const hittableElement = document.elementFromPoint(clientX, clientY)\n return !hittableElement || this.contains(hittableElement)\n }\n\n _buildEventEmitter(args) {\n return up.EventEmitter.fromEmitArgs(args, { layer: this })\n }\n\n /*-\n [Emits](/api/up.emit) an event on [this layer's element](/api/up.Layer.prototype.element).\n\n The value of [up.layer.current](/api/up.layer.current) will be set to this layer\n while event listeners are running.\n\n ## Example\n\n ```js\n let rootLayer = up.layer.root\n let overlay = await up.layer.open()\n\n rootLayer.on('foo', (event) => console.log('Listener called'))\n\n rootLayer.emit('foo') // logs \"Listener called\"\n overlay.emit('foo') // listener is not called\n ```\n\n @function up.Layer#emit\n @param eventType\n @like up.emit\n @param props\n @like up.emit\n @param props.log\n @like up.emit\n @return\n @like up.emit\n @stable\n */\n emit(...args) {\n return this._buildEventEmitter(args).emit()\n }\n\n saveHistory() {\n // (1) showsLiveHistory() would always return false unless we're the front layer\n // (2) Getters like this.title would always return this._savedTitle unless we're the front layer\n u.assert(this.isFront())\n\n // (1) Only save the aspects that Unpoly keeps in sync with the browser.\n // (2) An aspect that is not live already holds what this layer rendered.\n // If the root layer has not rendered it yet, its getter keeps following the browser.\n if (this.showsLiveHistory('title')) this._savedTitle = document.title\n if (this.showsLiveHistory('metaTags')) this._savedMetaTags = up.history.findMetaTags()\n if (this.showsLiveHistory('location')) this._savedLocation = up.history.location\n if (this.showsLiveHistory('lang')) this._savedLang = up.history.getLang()\n }\n\n restoreHistory() {\n // Only restore the aspects that Unpoly keeps in sync with the browser.\n // The app may have changed an excluded aspect while an overlay was open.\n\n // We may not have a #savedLocation when we were opened from an HTML string instead of a URL.\n if (this._savedLocation && this.showsLiveHistory('location')) {\n // We cannot use the `this.title` setter as that does not\n // push a state if `newLocation === this._savedLocation`.\n up.history.push(this._savedLocation)\n }\n\n if (this._savedTitle && this.showsLiveHistory('title')) {\n document.title = this._savedTitle\n }\n\n if (this._savedMetaTags && this.showsLiveHistory('metaTags')) {\n up.history.updateMetaTags(this._savedMetaTags)\n }\n\n if (u.isString(this._savedLang) && this.showsLiveHistory('lang')) {\n up.history.updateLang(this._savedLang)\n }\n }\n\n /*-\n Temporarily changes the [current layer](/api/up.layer.current) while the given\n function is running.\n\n Calls the given function and restores the original current layer when the function\n terminates.\n\n ## Example\n\n ```js\n up.layer.current // returns up.Layer.Root\n\n up.layer.open() // open an overlay\n up.layer.current // returns up.Layer.Modal\n\n up.layer.parent.asCurrent(function() {\n up.layer.current // returns up.Layer.Root\n })\n\n up.layer.current // returns up.Layer.Modal\n ```\n\n @param {Function()} fn\n The synchronous function to call.\n\n Async functions are not supported.\n @function up.Layer#asCurrent\n @stable\n */\n asCurrent(fn) {\n return this.stack.asCurrent(this, fn)\n }\n\n updateHistory(options) {\n // (1) The layer always stores the values it rendered.\n // (2) The updaters only change the browser for an aspect that Unpoly keeps in sync (see showsLiveHistory()).\n // Since up.history.config.enabled can exclude aspects, render options can only narrow the config,\n // never update an aspect that it excludes.\n\n // Set unless { location: false }\n if (u.isString(options.location)) {\n this.updateLocation(options.location, { push: true })\n }\n\n // Set unless { metaTags: false }\n if (u.isList(options.metaTags)) {\n up.migrate?.warnOfHungryMetaTags?.(options.metaTags)\n this._updateMetaTags(options.metaTags)\n }\n\n // Set unless { title: false }\n if (u.isString(options.title)) {\n this.updateTitle(options.title)\n }\n\n // Set unless { lang: false }\n if (u.isString(options.lang)) {\n this._updateLang(options.lang)\n }\n }\n\n // Returns whether Unpoly keeps the given history aspect of the browser in sync with this layer.\n // The aspect is one of 'location', 'title', 'metaTags' or 'lang'.\n showsLiveHistory(aspect) {\n return this.history && this.isFront() && up.history.isEnabled(aspect)\n }\n\n // A layer's title, meta tags, lang or location is what it rendered,\n // unless Unpoly keeps that aspect of the browser in sync with the layer.\n _getHistory(aspect, savedValue, getLiveValue) {\n // (1) Read a live aspect from the browser, so Unpoly-unaware code can change it directly,\n // e.g. by setting document.title or calling history.pushState().\n // (2) Until the root layer has rendered a value, it shows what the initial page shows.\n if (this.showsLiveHistory(aspect) || (this.isRoot() && savedValue === undefined)) {\n return getLiveValue()\n } else {\n return savedValue\n }\n }\n\n _onBrowserLocationChanged({ location }) {\n if (this.showsLiveHistory('location')) {\n this.updateLocation(location, { push: false })\n }\n }\n\n /*-\n This layer's window title.\n\n If this layer does not have [visible history](/api/up.Layer.prototype.history),\n the browser window shows the title of an ancestor layer.\n This property still returns the title the layer would use if it had visible history.\n The same applies when `up.history.config.enabled` [turns off](/learn/updating-history#disabling)\n the `'title'` aspect.\n\n @learn-ref history-in-overlays\n\n @property up.Layer#title\n @param {string} title\n This layer's title.\n @experimental\n */\n get title() {\n return this._getHistory('title', this._savedTitle, () => document.title)\n }\n\n // No _ prefix: specs spy on this name, and _-prefixed members are mangled in the minified build.\n updateTitle(title) {\n this._savedTitle = title\n\n if (this.showsLiveHistory('title')) {\n document.title = title\n }\n }\n\n get metaTags() {\n return this._getHistory('metaTags', this._savedMetaTags, up.history.findMetaTags)\n }\n\n _updateMetaTags(metaTags) {\n this._savedMetaTags = metaTags\n\n if (this.showsLiveHistory('metaTags')) {\n up.history.updateMetaTags(metaTags)\n }\n }\n\n get lang() {\n return this._getHistory('lang', this._savedLang, up.history.getLang)\n }\n\n _updateLang(lang) {\n this._savedLang = lang\n\n if (this.showsLiveHistory('lang')) {\n up.history.updateLang(lang)\n }\n }\n\n /*-\n This layer's location URL.\n\n If the layer has [no visible history](/api/up.Layer.prototype.history), this property\n still returns the URL of the content in the overlay. In this case\n the browser's address bar will show the location of an ancestor layer.\n\n When `up.history.config.enabled` [turns off](/learn/updating-history#disabling) the `'location'` aspect,\n this property returns the URL of the rendered content, while the address bar keeps its URL.\n\n @learn-ref history-in-overlays\n\n @property up.Layer#location\n @param {string} location\n The layer's current location.\n @experimental\n */\n get location() {\n // (1) When up.history.config.enabled excludes 'location', this returns the location of the\n // rendered content, not the unchanged browser URL. Hence [up-nav] follows the content.\n // (2) When the location is live, Unpoly-unaware code may use the pushState API directly.\n // This will implicitly change the front layer's location.\n return this._getHistory('location', this._savedLocation, () => up.history.location)\n }\n\n // No _ prefix: specs spy on this name, and _-prefixed members are mangled in the minified build.\n updateLocation(newLocation, { push }) {\n let prevSavedLocation = this._savedLocation\n let liveLocation = up.history.location\n\n // (A) Update _savedLocation before we push a new state below.\n // Pushing a new state will emit up:location:changed, which will re-call updateLocation()\n // (B) Don't emit up:layer:location:changed before the browser location changed.\n this._savedLocation = newLocation\n\n // We compare the newLocation with the current browser location, not with _savedLocation.\n // Comparing with _savedLocation would not push a history entry in the following edge case.\n //\n // - We have the root layer at /root and an overlay on /overlay\n // - The overlay makes a request to /root with [up-layer=root]\n // - The render pass will automatically close the overlay and bring the root layer back to front (\"peeling\").\n // - Because we think a history state is coming, we don't insert a state for the root layer restoration (issue #397).\n // - Because newLocation is also rootLayer._savedLocation, we don't push a new state.\n // - We end up not changing the URL from /overlay to /root, because neither peeling nor the fragment update\n // has pushed a state.\n if (newLocation !== liveLocation && this.showsLiveHistory('location') && push) {\n up.history.push(newLocation)\n }\n\n // (A) Only emit up:layer:location:changed after we pushed a new history entry.\n // (B) Don't emit when initially opening an overlay.\n if (newLocation !== prevSavedLocation && this.state !== 'opening') {\n this.emit('up:layer:location:changed', { location: newLocation, previousLocation: prevSavedLocation, log: false })\n }\n }\n\n selector(part) {\n return this.constructor.selector(part)\n }\n\n static selector(_part) {\n throw new up.NotImplemented()\n }\n\n toString() {\n throw new up.NotImplemented()\n }\n\n /*-\n Creates an element with the given `selector` and appends it to this layer's content.\n\n For the [root layer](/api/up.layer.root) the element is appended to the `<body>`.\n For an overlay it is appended to the overlay's top-level content element, like its `<main>`.\n\n Also see `up.element.affix()`.\n\n ### Example\n\n ```js\n layer = await up.layer.open({ content: '<main></main>' })\n element = layer.affix('.klass')\n element.parentElement // returns the <main> element\n element.className // returns 'klass'\n ```\n\n @function up.Layer#affix\n @include up.element.createFromSelector/all\n @experimental\n */\n affix(...args) {\n return e.affix(this.getFirstSwappableElement(), ...args)\n }\n\n [u.isEqual.key](other) {\n return (this.constructor === other.constructor) && (this.element === other.element)\n }\n\n hasFocus() {\n let focusedElement = document.activeElement\n return focusedElement !== document.body && this.element.contains(focusedElement)\n }\n\n reset() {\n // Re-assigning defaults will also reset context as well as\n // caches for scroll positions and focus.\n Object.assign(this, this.defaults())\n }\n\n}\n","const e = up.element\nconst u = up.util\n\n/*-\n@class up.Layer\n*/\nup.Layer.Overlay = class Overlay extends up.Layer {\n\n /*-\n The button or link that opened this overlay.\n\n @property up.Layer#origin\n @param {Element} origin\n The element that opened this overlay.\n @stable\n */\n\n /*-\n The [size](/learn/customizing-overlays#overlay-sizes) of this overlay.\n\n Returns a string like `'medium'` or `'large'`.\n\n @property up.Layer#size\n @param {string} size\n This layer's size setting.\n @stable\n */\n\n /*-\n The [position](/learn/customizing-overlays#popup-position) of this popup or drawer overlay.\n\n Returns a string like `'top'`, '`right`', `'bottom'` or `'left'`.\n\n @property up.Layer#position\n @param {string} [position]\n This layer's position setting.\n @stable\n */\n\n /*-\n The [alignment](/learn/customizing-overlays#popup-position) of this popup overlay.\n\n Returns a string like `'left'` or `'right'`.\n\n Returns `undefined` for an overlay that isn't a popup.\n\n @property up.Layer#align\n @param {string} align\n This layer's alignment setting.\n @stable\n */\n\n static VISUAL_KEYS = [\n 'mode',\n 'position',\n 'align',\n 'size',\n 'origin', // for tethered anchor element\n 'class',\n 'backdrop',\n 'dismissible',\n 'dismissLabel',\n 'dismissARIALabel',\n 'openAnimation',\n 'closeAnimation',\n 'openDuration',\n 'closeDuration',\n 'openEasing',\n 'closeEasing',\n 'trapFocus',\n ]\n\n static UNSET_VISUALS = u.spanObject(this.VISUAL_KEYS, undefined)\n\n keys() {\n return [\n ...super.keys(),\n ...this.constructor.VISUAL_KEYS,\n\n // Events and close conditions\n 'onOpened',\n 'onAccept',\n 'onAccepted',\n 'onDismiss',\n 'onDismissed',\n 'onAcceptedReload',\n 'onDismissedReload',\n 'acceptEvent',\n 'dismissEvent',\n 'acceptLocation',\n 'dismissLocation',\n 'acceptFragment',\n 'dismissFragment',\n ]\n }\n\n\n constructor(options) {\n super(options)\n\n // We need to mark the layer as \"opening\" so its topmost swappable element\n // does not resolve from the :layer pseudo-selector. Since :layer is a part of\n // up.fragment.config.mainTargets and :main is a part of fragment.config.autoHistoryTargets,\n // this would otherwise cause auto-history for *every* overlay regardless of initial target.\n this.state = 'opening'\n\n if (this.dismissible === true) {\n this.dismissible = ['button', 'key', 'outside']\n } else if (this.dismissible === false) {\n this.dismissible = []\n } else {\n this.dismissible = u.getSimpleTokens(this.dismissible)\n }\n\n if (this.acceptLocation) {\n this.acceptLocation = new up.URLPattern(this.acceptLocation)\n }\n\n if (this.dismissLocation) {\n this.dismissLocation = new up.URLPattern(this.dismissLocation)\n }\n }\n\n callback(name) {\n // Only binds the callback to the layer instance.\n // Note if the callback was created by an UJS attribute like [up-on-accepted], the\n // callback is already bound to the origin element to mimic the behavior of built-in\n // handler attributes like [onclick]. In that case our additional bind() will have\n // no effect.\n //\n // The up.layer.current value within a callback is controlled by the event\n // emission in up.Change.OpenLayer and up.Change.CloseLayer\n let fn = this[name]\n if (fn) {\n return fn.bind(this)\n }\n }\n\n createElement(parentElement) {\n this.nesting ||= this._suggestVisualNesting()\n const elementAttrs = u.compactObject(u.pick(this, ['align', 'position', 'size', 'class', 'nesting']))\n this.element = this.affixPart(parentElement, null, elementAttrs)\n }\n\n createBackdropElement(parentElement) {\n this.backdropElement = this.affixPart(parentElement, 'backdrop')\n }\n\n createViewportElement(parentElement) {\n // Give the viewport element an [up-viewport] attribute so it will be found\n // by up.viewport.get().\n this.viewportElement = this.affixPart(parentElement, 'viewport', { 'up-viewport': '' })\n }\n\n createBoxElement(parentElement) {\n this.boxElement = this.affixPart(parentElement, 'box')\n }\n\n createContentElement(parentElement) {\n this.contentElement = this.affixPart(parentElement, 'content')\n }\n\n setContent(content) {\n this.contentElement.append(content)\n this.onContentSet()\n }\n\n // Optional callback used by sub-classes\n onContentSet() {\n }\n\n createDismissElement(parentElement) {\n this.dismissElement = this.affixPart(parentElement, 'dismiss', {\n 'up-dismiss': '\":button\"', // value must be JSON\n 'aria-label': this.dismissARIALabel\n })\n // Since the dismiss button already has an accessible [aria-label]\n // we hide the \"X\" label from screen readers.\n return e.affix(this.dismissElement, 'span[aria-hidden=\"true\"]', { text: this.dismissLabel })\n }\n\n affixPart(parentElement, part, options = {}) {\n return e.affix(parentElement, this.selector(part), options)\n }\n\n static selector(part) {\n return u.compact(['up', this.mode, part]).join('-')\n }\n\n _suggestVisualNesting() {\n const { parent } = this\n if (this.mode === parent.mode) {\n return 1 + parent._suggestVisualNesting()\n } else {\n return 0\n }\n }\n\n setupHandlers() {\n super.setupHandlers()\n\n this.overlayFocus = new up.OverlayFocus(this)\n\n if (this._supportsDismissMethod('button')) {\n this.createDismissElement(this.getBoxElement())\n }\n\n if (this._supportsDismissMethod('outside')) {\n // If this overlay has its own viewport, a click outside the frame will hit\n // the viewport and not the parent element.\n if (this.viewportElement) {\n up.on(this.viewportElement, 'up:click', (event) => {\n // Don't react when a click into the overlay frame bubbles to the viewportElement\n if (event.target === this.viewportElement) {\n this._onOutsideClicked(event, true)\n }\n })\n } else {\n // Only bind to the parent if there's not already a viewport.\n // This prevents issues with other overlay libs appending elements to document.body,\n // but overlaying this overlay with a huge z-index. Clicking such a foreign overlay\n // would close this layer, as Unpoly considers it to be on the root layer (our parent).2\n this._unbindParentClicked = this.parent.on('up:click', (event, element) => {\n if (!up.layer.isWithinForeignOverlay(element)) {\n // When our origin is clicked again, halt the click event\n // We achieve this by halting the click event.\n const originClicked = this.origin && this.origin.contains(element)\n this._onOutsideClicked(event, originClicked)\n }\n })\n }\n }\n\n if (this._supportsDismissMethod('key')) {\n this._unbindEscapePressed = up.event.onEscape((event) => this.onEscapePressed(event))\n }\n\n // <a up-accept=\"value\">OK</a>\n this.registerAttrCloser('up-accept', (value, closeOptions) => {\n this.accept(value, closeOptions)\n })\n\n // <a up-dismiss=\"value\">Cancel</a>\n this.registerAttrCloser('up-dismiss', (value, closeOptions) => {\n this.dismiss(value, closeOptions)\n })\n\n up.migrate.registerLayerCloser?.(this)\n\n // let { userId } = await up.layer.open({ acceptEvent: 'user:show' })\n // _registerExternalEventCloser() will fill in this and arguments.\n this._registerExternalEventCloser(this.acceptEvent, this.accept)\n this._registerExternalEventCloser(this.dismissEvent, this.dismiss)\n\n this.on('up:click', 'label[for]', (event, label) => this._onLabelForClicked(event, label))\n }\n\n _onLabelForClicked(event, label) {\n // We do our own focus logic when the user clicks an label[for].\n // If an input with the same [id] is on an ancestor layer the browser would\n // focus that (even though label and input are in different forms).\n // The browser always focuses the first input matching the ID from [for].\n let id = label.getAttribute('for')\n let fieldSelector = up.form.fieldSelector(e.idSelector(id))\n\n let fieldsAnywhere = up.fragment.all(fieldSelector, { layer: 'any' })\n let fieldsInLayer = up.fragment.all(fieldSelector, { layer: this })\n\n // We would much rather not interfere with label clicking logic,\n // and let the browser do its thing. Hence we only interfere if there\n // are multiple matching inputs, and the first one is not in this layer.\n if (fieldsAnywhere.length > 1 && fieldsInLayer[0] !== fieldsAnywhere[0]) {\n event.preventDefault()\n\n const field = fieldsInLayer[0]\n\n field.focus()\n\n if (field.matches('input[type=checkbox], input[type=radio]')) {\n field.click()\n }\n }\n }\n\n _onOutsideClicked(event, halt) {\n up.log.putsEvent(event)\n // We still halt a click we ignore below, or a popup's origin would be followed again.\n if (halt) up.event.halt(event)\n\n // When the user double-clicks a link that opens an overlay right away, the second click\n // lands outside the new overlay. We don't want to dismiss the overlay the user just opened.\n // The up:click event has no { detail }, so we read the click count from the native event.\n // Keyboard activations and element.click() have a { detail } of 0.\n if (event.originalEvent?.detail > 1) return\n\n up.error.muteUncriticalSync(() =>\n this.dismiss(':outside', { origin: event.target })\n )\n }\n\n onEscapePressed(event) {\n // A widget within the overlay may handle Escape itself, e.g. to close a dropdown.\n if (event.defaultPrevented) return\n\n // All overlays listen to the Escape key being pressed, but only the front layer\n // should react. Note that we're using the *front* layer, not the *current* layer.\n // The current layer might be in the visual background, e.g. if a fragment is being\n // compiled in a background layer.\n if (this.isFront()) {\n let field = up.form.focusedField()\n if (field) {\n // Allow screen reader users to get back to a state where they can dismiss the\n // modal with escape.\n field.blur()\n } else if (this._supportsDismissMethod('key')) {\n up.event.halt(event, { log: true })\n up.error.muteUncriticalSync(() =>\n this.dismiss(':key')\n )\n }\n }\n }\n\n registerAttrCloser(attribute, closeFn) {\n this._registerClickCloser(attribute, closeFn)\n this._registerSubmitCloser(attribute, closeFn)\n }\n\n _registerClickCloser(attribute, closeFn) {\n // Allow the fallbacks to be both vanilla links and Unpoly [up-follow] links\n this.on('up:click', `[${attribute}]:not(form)`, (event, link) => {\n // Since we're defining this handler on up.Overlay, we will not prevent\n // a link from being followed on the root layer.\n up.event.halt(event, { log: true })\n\n const value = e.jsonAttr(link, attribute)\n this._onAttrCloserActivated(link, value, closeFn)\n })\n }\n\n _registerSubmitCloser(attribute, closeFn) {\n // Allow the fallbacks to be both vanilla forms and Unpoly [up-submit] forms\n this.on('submit', `[${attribute}]`, (event, element) => {\n // Since we're defining this handler on up.Overlay, we will not prevent\n // a form from being submitted on the root layer.\n up.event.halt(event, { log: true })\n\n // (1) `element` is whichever element carries the attribute, which for the documented\n // markup is the form itself. Read the form from the event instead, so we cannot\n // hand a non-form to up.Params.fromForm().\n // (2) The opener is interested in the form's full params, including the button the user\n // pressed. When nothing submitted the form (a script dispatched the event) there is\n // no button to attribute, and we must not guess the form's first one.\n const value = up.Params.fromForm(event.target, { submitButton: event.submitter ?? false })\n this._onAttrCloserActivated(element, value, closeFn)\n })\n }\n\n _onAttrCloserActivated(origin, value, closeFn) {\n const closeOptions = { origin }\n const parser = new up.OptionsParser(origin, closeOptions)\n parser.booleanOrString('animation')\n parser.string('easing')\n parser.number('duration')\n parser.string('confirm')\n\n up.error.muteUncriticalSync(() => closeFn(value, closeOptions))\n }\n\n _registerExternalEventCloser(eventTypes, closeFn) {\n if (!eventTypes) { return }\n return this.on(eventTypes, (event) => {\n event.preventDefault()\n up.error.muteUncriticalSync(() =>\n closeFn.call(this, event, { response: event.response })\n )\n })\n }\n\n tryAcceptForElements(newElements, response) {\n this._tryCloseForElements(this.acceptFragment, this.accept, newElements, response)\n }\n\n tryDismissForElements(newElements, response) {\n this._tryCloseForElements(this.dismissFragment, this.dismiss, newElements, response)\n }\n\n _tryCloseForElements(selector, closeFn, newElements, response) {\n let match = u.findResult(newElements, (element) => e.subtreeFirst(element, selector))\n if (match) {\n const closeValue = up.data(match)\n up.error.muteUncriticalSync(() =>\n closeFn.call(this, closeValue, { response })\n )\n }\n }\n\n tryAcceptForLocation(newLocation, response) {\n this._tryCloseForLocation(newLocation, this.acceptLocation, this.accept, response)\n }\n\n tryDismissForLocation(newLocation, response) {\n this._tryCloseForLocation(newLocation, this.dismissLocation, this.dismiss, response)\n }\n\n _tryCloseForLocation(newLocation, urlPattern, closeFn, response) {\n let resolution = newLocation && urlPattern?.recognize(newLocation)\n if (resolution) {\n // resolution now contains named capture groups, e.g. when\n // '/decks/:deckId/cards/:cardId' is matched against\n // '/decks/123/cards/456' resolution is { deckId: 123, cardId: 456 }.\n const closeValue = { ...resolution, location: newLocation }\n up.error.muteUncriticalSync(() =>\n closeFn.call(this, closeValue, { response })\n )\n }\n }\n\n teardownHandlers() {\n super.teardownHandlers()\n this._unbindParentClicked?.()\n this._unbindEscapePressed?.()\n }\n\n /*-\n Destroys the elements that make up this overlay.\n\n @function up.Layer.prototype.destroyElements\n @param {string|Function(Element, Object)} [options.animation=this.closeAnimation]\n @param {number} [options.duration=this.closeDuration]\n @param {string} [options.easing=this.closeEasing]\n @param {Function} [options.onFinished]\n A callback that will run when the elements have been removed from the DOM.\n If the destruction is animated, the callback will run after the animation has finished.\n @return {Promise}\n A resolved promise.\n @internal\n */\n destroyElements(options) {\n const animationProps = this.closeAnimationProps(options)\n\n const onFinished = () => {\n this.onElementsRemoved() // callback for layer implementations that need to clean up\n options.onFinished?.() // callback for callers of up.layer.dismiss/accept()\n }\n\n // Do not re-use `options`, or we would call startCloseAnimation(animation: startCloseAnimation)!\n up.destroy(this.element, {\n ...options,\n ...animationProps,\n onFinished,\n log: false,\n })\n }\n\n // Optional callback used by sub-classes\n onElementsRemoved() {\n }\n\n _animationFn(boxAnimation, backdropAnimation) {\n // If we don't animate the box, we don't animate the backdrop either.\n if (up.motion.isNone(boxAnimation)) return false\n\n // Only animate the backdrop element if this layer has a backdrop.\n backdropAnimation = this.backdrop && backdropAnimation\n\n return (_element, animateOptions) => {\n const boxDone = up.animate(this.getBoxElement(), boxAnimation, animateOptions)\n const backdropDone = up.animate(this.backdropElement, backdropAnimation, animateOptions)\n\n // Promise.all() ignores non-Thenables in the given array\n return Promise.all([boxDone, backdropDone])\n }\n }\n\n startOpenAnimation(options = {}) {\n const animationProps = this.openAnimationProps(options)\n const onFinished = () => {\n this.wasEverVisible = true\n options.onFinished?.()\n }\n\n return up.animate(this.element, animationProps.animation, { ...animationProps, onFinished })\n }\n\n openAnimationProps(options = {}) {\n let boxAnimation = options.animation ?? this.evalOption(this.openAnimation)\n let backdropAnimation = 'fade-in' // _animationFn() will ignore this animation unless the box is also animating\n let animationFn = this._animationFn(boxAnimation, backdropAnimation)\n\n return {\n animation: animationFn,\n easing: options.easing || this.openEasing,\n duration: options.duration || this.openDuration,\n }\n }\n\n closeAnimationProps(options = {}) {\n let boxAnimation = this.wasEverVisible && (options.animation ?? this.evalOption(this.closeAnimation))\n let backdropAnimation = 'fade-out' // _animationFn() will ignore this animation unless the box is also animating\n let animationFn = this._animationFn(boxAnimation, backdropAnimation)\n\n return {\n animation: animationFn,\n easing: options.easing || this.closeEasing,\n duration: options.duration ?? this.closeDuration,\n }\n }\n\n isAlive() {\n return ['opening', 'opened'].includes(this.state)\n }\n\n // Documented in up.Layer.Base\n accept(value = null, options = {}) {\n return this._executeCloseChange('accept', value, options)\n }\n\n // Documented in up.Layer.Base\n dismiss(value = null, options = {}) {\n return this._executeCloseChange('dismiss', value, options)\n }\n\n _supportsDismissMethod(method) {\n return u.contains(this.dismissible, method)\n }\n\n _executeCloseChange(verb, value, options) {\n options = { ...options, verb, value, layer: this }\n return new up.Change.CloseLayer(options).execute()\n }\n\n getFirstSwappableElement() {\n return this.getContentElement().children[0]\n }\n\n toString() {\n return `${this.mode} overlay`\n }\n}\n","up.Layer.OverlayWithTether = class OverlayWithTether extends up.Layer.Overlay {\n\n createElements() {\n if (!this.origin) {\n up.fail('Missing { origin } option')\n }\n\n // We first construct an un-started Tether object so we can\n // ask for its parent element.\n this._tether = new up.Tether({\n anchor: this.origin,\n align: this.align,\n position: this.position\n })\n this.createElement(this._tether.parent)\n this.createContentElement(this.element)\n }\n\n onContentSet() {\n this._tether.start(this.element)\n }\n\n onElementsRemoved() {\n this._tether.stop()\n }\n\n sync() {\n // In case some async code calls #sync() on a layer that was already closed,\n // don't run the code below that might re-attach the overlay.\n if (!this.isAlive()) return\n\n if (up.fragment.isAlive(this.element) && this._tether.isAlive()) {\n // The fragment update might have moved elements around.\n // This is a good moment to sync our position relative to the anchor.\n this._tether.sync()\n } else {\n // If our tether parent and anchor is gone, the best thing we can\n // do now is to dismiss ourselves and have a consistent layer stack.\n this.dismiss(\n ':detached', { // custom dismiss value so listeners can distinguish from other dismissals\n animation: false, // no need to animate since we're already hidden\n preventable: false // since we're cleaning up a broken stack, don't allow user intervention\n })\n }\n }\n}\n","up.Layer.OverlayWithViewport = class OverlayWithViewport extends up.Layer.Overlay {\n\n // For stubbing in tests\n static getParentElement() {\n // Always make a fresh lookup of the <body>, since the <body>\n // might be swapped out with a new element.\n return document.body\n }\n\n /*-\n @function up.Layer.OverlayWithViewport#openNow\n @internal\n */\n createElements() {\n up.viewport.bodyShifter.raiseStack()\n this.createElement(this.constructor.getParentElement())\n if (this.backdrop) { this.createBackdropElement(this.element) }\n this.createViewportElement(this.element)\n this.createBoxElement(this.viewportElement)\n this.createContentElement(this.boxElement)\n }\n\n onElementsRemoved() {\n up.viewport.bodyShifter.lowerStack()\n }\n\n sync() {\n // A swapping of <body> might have removed this overlay from the DOM, so we\n // attach it again.\n //\n // We also check #isOpen() in case some async code calls #sync() on a layer\n // that was already closed. In that case don't run the code below that might\n // re-attach the overlay.\n if (this.isAlive() && !this.element.isConnected) {\n this.constructor.getParentElement().appendChild(this.element)\n }\n }\n}\n","const e = up.element\n\nup.Layer.Root = class Root extends up.Layer {\n\n static mode = 'root'\n\n get element() {\n // Let's talk about our choice of @element for the root layer.\n //\n // 1. We don't want to use `document`, since that is for our global event bus.\n // For instance, take a look how up.Change.CloseLayer emits the up:layer:dismiss\n // event first on `@layer.element`, then on `document`.\n // Also `document` is not really an element, just an event target.\n // 2. We might want but cannot use <body> element. Since Unpoly boots before\n // the DOM is ready, document.body is still undefined. We also cannot delay\n // booting until the DOM is ready, since by then all user-defined event listeners\n // and compilers will have registered.\n // 3. That leaves the <html> element, which is available before the DOM is ready\n // on Chrome, Firefox, IE11, Safari.\n // 4. A nice benefit of using <html> is that up.fragment.get('html', layer: 'root')\n // will yield a result.\n // 5. Also it's nice that elements in the <head> also belong to the root layer.\n // Otherwise they would not belong to any layer.\n //\n // We always return the current <html> instead of caching it,\n // since the developer might replace it with a new version.\n return e.root\n }\n\n constructor(options) {\n super(options)\n this.setupHandlers()\n }\n\n getFirstSwappableElement() {\n return document.body\n }\n\n static selector() {\n return 'html'\n }\n\n setupHandlers() {\n // When we reset the framework during tests, we might re-initialize this\n // layer with the same <html> element. In this case we do not want to\n // setup handlers more than once.\n if (!this.element.upHandlersApplied) {\n this.element.upHandlersApplied = true\n super.setupHandlers()\n }\n }\n\n sync() {\n // In case a fragment update has swapped the <html> element we need to re-apply\n // event handlers to the new <html> element.\n this.setupHandlers()\n }\n\n isAlive() {\n return true\n }\n\n accept() {\n this._cannotCloseRoot()\n }\n\n dismiss() {\n this._cannotCloseRoot()\n }\n\n _cannotCloseRoot() {\n up.fail('Cannot close the root layer')\n }\n\n get [Symbol.toStringTag]() { return 'up.Layer.Root' }\n\n toString() {\n return \"root layer\"\n }\n}\n","up.Layer.Modal = class Modal extends up.Layer.OverlayWithViewport {\n static mode = 'modal'\n\n get [Symbol.toStringTag]() { return 'up.Layer.Modal' }\n}\n","up.Layer.Popup = class Popup extends up.Layer.OverlayWithTether {\n static mode = 'popup'\n\n get [Symbol.toStringTag]() { return 'up.Layer.Popup' }\n}\n","up.Layer.Drawer = class Drawer extends up.Layer.OverlayWithViewport {\n static mode = 'drawer'\n\n get [Symbol.toStringTag]() { return 'up.Layer.Drawer' }\n}\n","up.Layer.Cover = class Cover extends up.Layer.OverlayWithViewport {\n static mode = 'cover'\n\n get [Symbol.toStringTag]() { return 'up.Layer.Cover' }\n}\n","const u = up.util\nconst e = up.element\n\nup.LayerLookup = class LayerLookup {\n\n constructor(stack, options) {\n this._stack = stack\n\n // Options normalization might change `options` relevant to the lookup:\n // (1) It will default { layer } to 'origin' if an { origin } element is given.\n // (2) It will also lookup a string { baseLayer }.\n // (3) It will set the default layer to 'current' if nothing matches.\n if (options.normalizeLayerOptions !== false) {\n up.layer.normalizeOptions(options)\n }\n\n this._options = options\n this._values = u.getSimpleTokens(options.layer)\n }\n\n all() {\n let results = u.flatMap(this._values, (value) => this._resolveValue(value))\n results = u.compact(results)\n results = u.uniq(results)\n return results\n }\n\n static all(stack, ...args) {\n const options = u.parseArgIntoOptions(args, 'layer')\n\n // We can process some very frequent calls like all(up.Layer)\n // without going through a full lookup, which would require layer options normalization etc.\n\n const { layer } = options\n\n if (layer instanceof up.Layer) {\n return [layer]\n }\n\n // We need a full lookup\n return new this(stack, options).all()\n }\n\n _forElement(element) {\n element = e.get(element) // unwrap jQuery\n return this._stack.layers.findLast((layer) => layer.contains(element))\n }\n\n _forIndex(value) {\n return this._stack.at(value)\n }\n\n _resolveValue(value) {\n if (value instanceof up.Layer) {\n return value\n }\n\n if (u.isNumber(value)) {\n return this._forIndex(value)\n }\n\n if (/^\\d+$/.test(value)) {\n return this._forIndex(Number(value))\n }\n\n if (u.isElementLike(value)) {\n return this._forElement(value)\n }\n\n switch (value) {\n case 'any':\n // Return all layers, but prefer a layer that's either the current\n // layer, or closer to the front.\n return [this._getBaseLayer(), ...this._stack.reversed()]\n case 'current':\n return this._getBaseLayer()\n case 'closest':\n return this._stack.selfAndAncestorsOf(this._getBaseLayer())\n case 'parent':\n return this._getBaseLayer().parent\n case 'ancestor':\n case 'ancestors':\n return this._getBaseLayer().ancestors\n case 'child':\n return this._getBaseLayer().child\n case 'descendant':\n case 'descendants':\n return this._getBaseLayer().descendants\n case 'subtree':\n return this._getBaseLayer().subtree\n case 'new':\n return 'new' // pass-through\n case 'root':\n return this._stack.root\n case 'overlay':\n case 'overlays':\n return this._stack.overlays.toReversed()\n case 'front':\n return this._stack.front\n case 'origin':\n return this._getOriginLayer()\n default:\n return up.fail(\"Unknown { layer } option: %o\", value)\n }\n }\n\n _getOriginLayer() {\n let { origin, originLayer } = this._options\n\n if (originLayer) {\n return originLayer\n }\n\n if (origin) {\n return this._forElement(origin)\n }\n }\n\n _getBaseLayer() {\n let { baseLayer } = this._options\n\n if (u.isString(baseLayer)) {\n // The { baseLayer } option may itself be a string like \"parent\".\n // In this case we look it up using a new up.LayerLookup instance, using\n // up.layer.current as the { baseLayer } for that second lookup.\n const recursiveOptions = { ...this._options, baseLayer: this._stack.current, normalizeLayerOptions: false, layer: baseLayer }\n return this.constructor.all(this._stack, recursiveOptions)[0]\n } else {\n return baseLayer || this._getOriginLayer() || this._stack.current\n }\n }\n\n static {\n u.memoizeMethod(this.prototype, {\n _getBaseLayer: true,\n _getOriginLayer: true,\n })\n }\n\n}\n","const u = up.util\n\nup.LayerStack = class LayerStack {\n\n constructor() {\n this._currentOverrides = []\n this.layers = [this._buildRoot()]\n this._closingLayers = []\n }\n\n _buildRoot() {\n return up.layer.build({ mode: 'root', stack: this })\n }\n\n remove(layer) {\n u.remove(this.layers, layer)\n // A closed overlay may keep its element for its exit animation. See attachedCount.\n this._closingLayers.push(layer)\n }\n\n peel(layer, options = {}) {\n // We will dismiss descendants closer to the front first to prevent\n // recursive calls of peel().\n const descendants = layer.descendants.toReversed()\n\n // (1) Callers expect the effects of peel() to manipulate the layer stack sync.\n // Because of this we will dismiss all descendants sync rather than waiting\n // for each descendant to finish its closing animation.\n // (2) Listeners cannot prevent peeling. Peeling happens after the server has responded,\n // so keeping an overlay open could not undo the request, only hide its result.\n const closeOptions = { ...options, preventable: false }\n\n // We allow to dismiss using either { peel: 'dismiss' } (explicit) or { peel: true } (don't care).\n const closeMethod = options.intent === 'accept' ? 'accept' : 'dismiss'\n\n const closeValue = options.value ?? ':peel'\n\n for (let descendant of descendants) {\n descendant[closeMethod](closeValue, closeOptions)\n }\n }\n\n reset() {\n this.peel(this.root, { animation: false })\n this._currentOverrides = []\n this.root.reset()\n }\n\n parentOf(layer) {\n return this.layers[layer.index - 1]\n }\n\n childOf(layer) {\n return this.layers[layer.index + 1]\n }\n\n ancestorsOf(layer) {\n // Return closest ancestors first\n return this.layers.slice(0, layer.index).toReversed()\n }\n\n selfAndAncestorsOf(layer) {\n // Order for layer.closest()\n return [layer, ...layer.ancestors]\n }\n\n descendantsOf(layer) {\n return this.layers.slice(layer.index + 1)\n }\n\n isRoot(layer) {\n return this.root === layer\n }\n\n isOverlay(layer) {\n return this.root !== layer\n }\n\n isCurrent(layer) {\n return this.current === layer\n }\n\n isFront(layer) {\n return this.front === layer\n }\n\n get(...args) {\n return this.getAll(...args)[0]\n }\n\n getAll(...args) {\n return up.LayerLookup.all(this, ...args)\n }\n\n sync() {\n for (let layer of this.layers) {\n layer.sync()\n }\n }\n\n asCurrent(layer, fn) {\n try {\n this._currentOverrides.push(layer)\n return fn()\n } finally {\n this._currentOverrides.pop()\n }\n }\n\n reversed() {\n return this.layers.toReversed()\n }\n\n dismissOverlays(value = null, options = {}) {\n options.dismissible = false\n for (let overlay of this.overlays.toReversed()) {\n overlay.dismiss(value, options)\n }\n }\n\n at(index) {\n return this.layers[index]\n }\n\n indexOf(layer) {\n return this.layers.indexOf(layer)\n }\n\n get count() {\n return this.layers.length\n }\n\n // Layers whose elements are in the DOM: the open layers, plus closed overlays\n // that are still playing their exit animation.\n get attachedCount() {\n if (this._closingLayers.length) {\n this._closingLayers = this._closingLayers.filter((layer) => layer.element.isConnected)\n }\n return this.layers.length + this._closingLayers.length\n }\n\n get root() {\n return this.layers[0]\n }\n\n get overlays() {\n return this.root.descendants\n }\n\n get current() {\n // Event listeners and compilers will push into @currentOverrides\n // to temporarily set up.layer.current to the layer they operate in.\n return u.last(this._currentOverrides) || this.front\n }\n\n get front() {\n return u.last(this.layers)\n }\n\n}\n","const u = up.util\n\nup.LinkCurrentURLs = class LinkCurrentURLs {\n\n constructor(link) {\n // A link with an unsafe method will never be highlighted with .up-current.\n this._isSafe = up.link.isSafe(link)\n\n if (this._isSafe) {\n const href = link.getAttribute('href')\n if (href && (href !== '#')) {\n this._href = u.matchableURL(href)\n }\n\n const upHREF = link.getAttribute('up-href')\n if (upHREF) {\n this._upHREF = u.matchableURL(upHREF)\n }\n\n const alias = link.getAttribute('up-alias')\n if (alias) {\n this._aliasPattern = new up.URLPattern(alias)\n }\n }\n }\n\n isCurrent(normalizedLocation) {\n // In overlays without history no link is considered current.\n if (!normalizedLocation) {\n return false\n }\n\n // It is important to return false instead of a falsey value.\n // up.status feeds the return value to element.classList.toggle(),\n // which would use a default for undefined.\n return !!(\n this._href === normalizedLocation ||\n this._upHREF === normalizedLocation ||\n this._aliasPattern?.test?.(normalizedLocation, false)\n )\n }\n\n isAnyCurrent(normalizedLocations) {\n // It is important to return false instead of a falsey value.\n // up.status feeds the return value to element.classList.toggle(),\n // which would use a default for undefined.\n return normalizedLocations.some((normalizedLocation) => (\n this._href === normalizedLocation ||\n this._upHREF === normalizedLocation ||\n this._aliasPattern?.test?.(normalizedLocation, false)\n ))\n }\n}\n","const u = up.util\nconst e = up.element\n\nup.LinkFollowIntent = class LinkFollowIntent {\n\n constructor(link, callback) {\n this._link = link\n this._callback = callback\n this._lastRequest = null\n this._on('mouseenter mousedown touchstart', (event) => this._scheduleCallback(event))\n this._on('mouseleave', () => this._unscheduleCallback())\n // Don't preload if the link was removed from the DOM while we were waiting for the timer.\n // This also happens in specs, when the timer terminates after a spec has ended.\n up.fragment.onAborted(this._link, () => this._unscheduleCallback())\n }\n\n _on(eventType, fn) {\n up.on(this._link, eventType, { passive: true }, fn)\n }\n\n _scheduleCallback(event) {\n // Don't preload when the user is holding down CTRL or SHIFT.\n if (!up.link.shouldHandleClick(event, this._link)) return\n\n // A preload request is already known, e.g. from hovering before a mousedown.\n // We must not abort and repeat it, but let the click reuse it.\n if (this._lastRequest) return\n\n this._unscheduleCallback()\n\n // On pointerdown we preload immediately.\n // On mouseenter we wait for a short while (90ms) whether the cursor stays on the link.\n const applyDelay = (event.type === 'mouseenter')\n if (applyDelay) {\n let delay = this._parseDelay()\n this._timer = u.timer(delay, () => this._runCallback(event))\n } else {\n this._runCallback(event)\n }\n }\n\n _unscheduleCallback() {\n clearTimeout(this._timer)\n\n // Only abort if the request is still preloading.\n // If the user has clicked on the link while the request was in flight,\n // and then unhovered the link, we do not abort the navigation.\n if (this._lastRequest?.background) this._lastRequest.abort()\n this._lastRequest = null\n }\n\n _parseDelay() {\n return e.numberAttr(this._link, 'up-preload-delay') ?? up.link.config.preloadDelay\n }\n\n _runCallback(event) {\n up.log.putsEvent(event)\n\n // We unschedule the delayed callback then the link is aborted.\n // However, there are edge cases when the link can still be detached while\n // waiting for the delay:\n //\n // - The link (or its container) is [up-hungry] so it won't be eagerly\n // aborted when it is targeted.\n // - We render an [up-preload] link from an expired cache entry\n // - We schedule another callback\n // - The expired content is revalidated (which does not abort eagerly).\n // - The link is replaced with the revalidated content.\n // - The callback delay finishes and tries to follow a detached link.\n if (!up.fragment.isAlive(this._link)) return\n\n // (1) Remember the request when sent\n // (2) All callbacks from up.link already mute uncritical rejections.\n // We cannot do it here, as the callbacks are also passed to other places,\n // like to onFirstIntersect().\n this._callback({ onRequestKnown: (request) => this._lastRequest = request })\n }\n}\n","const u = up.util\n\nup.MotionController = class MotionController {\n\n constructor(name) {\n // TODO: Make finishEvent concrete string everywhere. We only have a singgle MotionController.\n this.finishEvent = `up:${name}:finish`\n this._resetProps()\n }\n\n // Whether we're currently starting a motion function.\n // This helps us detect nested calls to up.morph() or up.animate(), e.g. from a transition function.\n get nested() {\n return this._startingCount > 0\n }\n\n /*-\n Calls the given function and tracks the animation it starts, so it can be\n [`finished`](/up.MotionController.finish) later.\n\n Does not finish existing animations. Callers are expected to finish previous\n animations on their elements before they first change the DOM, unless they are nested.\n\n The function is expected to return a promise that is fulfilled when\n the animation ends. The function is also expected to listen to\n `this.finishEvent` and instantly skip to the last frame\n when the event is observed.\n\n @function startFunction\n @param {List<Element>} cluster\n A list of elements that will be affected by the motion.\n @param {Function(): Promise} startMotionFn\n @return {Promise}\n A promise that fulfills when the animation ends.\n */\n startFunction(newCluster, startMotionFn) {\n // Remember that we're currently starting a motion function.\n this._startingCount++\n\n try {\n this._playingClusters.push(newCluster)\n let promise = up.error.muteUncriticalRejection(startMotionFn())\n return promise.finally(() => u.remove(this._playingClusters, newCluster))\n } finally {\n // This must happen sync. We cannot await the promise above, or we will be too late.\n this._startingCount--\n }\n }\n\n finish(element = document.body) {\n for (let playingCluster of this._findPlayingClusters(element)) {\n u.remove(this._playingClusters, playingCluster)\n\n for (let playingElement of playingCluster) {\n this._emitFinishEvent(playingElement)\n }\n }\n }\n\n _findPlayingClusters(queryElement) {\n return this._playingClusters.filter((cluster) => {\n return u.some(cluster, (clusterElement) => queryElement.contains(clusterElement))\n })\n }\n\n _emitFinishEvent(element) {\n return up.emit(element, this.finishEvent, { log: false })\n }\n\n _resetProps() {\n this._startingCount = 0\n this._playingClusters = []\n }\n\n reset() {\n this.finish()\n this._resetProps()\n }\n}\n","const e = up.element\n\nup.NonceableCallback = class NonceableCallback {\n\n constructor(script, nonce) {\n this.script = script\n this.nonce = nonce\n }\n\n static fromCallbackString(string) {\n let match = string.match(/^(nonce-(\\S+)\\s)?(.*)$/)\n return new this(match[3], match[2])\n }\n\n unsafeEval(evalEnv) {\n if (this.nonce) {\n return this._runAsScriptElement(evalEnv)\n } else {\n return this._runAsFunction(evalEnv)\n }\n }\n\n toCallbackString() {\n return `nonce-${this.nonce} ${this.script}`\n }\n\n _runAsFunction({ argNames, argValues, thisContext }) {\n let fn = new Function(...argNames, this.script)\n return fn.apply(thisContext, argValues)\n }\n\n _runAsScriptElement(evalEnv) {\n // A strict CSP will block use of `eval()` or `new Function()`.\n // What we can do instead is insert an inline script that is allowed per a [nonce] attr.\n let wrappedScript = `\n try {\n up.noncedEval.value = (function(${evalEnv.argNames.join()}) {\n ${this.script}\n }).apply(up.noncedEval.thisContext, up.noncedEval.argValues)\n } catch (error) {\n up.noncedEval.error = error\n }\n `\n\n let scriptElement\n try {\n up.noncedEval = { ...evalEnv }\n scriptElement = e.affix(document.body, 'script', { nonce: this.nonce, text: wrappedScript })\n if (up.noncedEval.error) {\n throw up.noncedEval.error\n } else {\n return up.noncedEval.value\n }\n } finally {\n up.noncedEval = undefined\n scriptElement?.remove()\n }\n }\n\n}\n","const e = up.element\n\nup.OverlayFocus = class OverlayFocus {\n\n constructor(layer) {\n this._layer = layer\n this._focusElement = this._layer.getFocusElement()\n this._trapFocus = this._layer.trapFocus\n }\n\n moveToFront() {\n if (this._active) { return }\n this._active = true\n\n this._unsetAttrs = e.setAttrsTemp(this._focusElement, {\n // Make layer.element focusable.\n // It would be slightly nicer to give it [tabindex=-1] to make it focusable through JS,\n // but remove it from the keyboard tab sequence. However, then we would need additional\n // code to prevent an infinite loop between focus traps in an overlay that has no\n // focusable elements.\n 'tabindex': '0',\n // Make screen readers speak \"dialog field\" as we focus layer.element.\n 'role': 'dialog',\n // Tell modern screen readers to make all elements outside layer.element's subtree inert.\n 'aria-modal': this._trapFocus.toString()\n })\n\n if (this._trapFocus) {\n this._untrapFocus = up.on('focusin', (event) => this._onFocus(event))\n this._focusTrapBefore = e.affix(this._focusElement, 'beforebegin', 'up-focus-trap[tabindex=0]')\n this._focusTrapAfter = e.affix(this._focusElement, 'afterend', 'up-focus-trap[tabindex=0]')\n }\n }\n\n moveToBack() {\n this.teardown()\n }\n\n teardown() {\n if (!this._active) { return }\n this._active = false\n\n // Remove [aria-modal] attribute to not confuse screen readers with multiple\n // mutually exclusive [aria-modal] layers.\n this._unsetAttrs()\n\n if (this._trapFocus) {\n this._untrapFocus()\n this._focusTrapBefore.remove()\n this._focusTrapAfter.remove()\n }\n }\n\n _onFocus(event) {\n const { target } = event\n\n // (1) Ignore focus events triggered by this method.\n // (2) Ignore focus events within overlays by other libraries.\n if (this._processingFocusEvent || up.layer.isWithinForeignOverlay(target)) {\n return\n }\n\n this._processingFocusEvent = true\n\n if (target === this._focusTrapBefore) {\n // User shift-tabbed from the first focusable element in the overlay.\n // Focus pierced through the layer the the beginning.\n // We want to wrap around and focus the end of the overlay.\n this._focusEnd()\n } else if ((target === this._focusTrapAfter) || !this._layer.contains(target)) {\n // User tabbed from the last focusable element in the overlay\n // OR user moved their virtual cursor on an element outside the layer.\n // We want to to trap focus and focus the start of the overlay.\n this._focusStart()\n }\n\n this._processingFocusEvent = false\n }\n\n _focusStart(focusOptions) {\n // Focusing the overlay element with its [role=dialog] will read out\n // \"dialog field\" in many screen readers.\n up.focus(this._focusElement, focusOptions)\n }\n\n _focusEnd() {\n // The end will usually be the dismiss button, if there is one.\n // Otherwise it will be the last focusable element.\n // We focus on the box element since focusing on the layer container\n // would include the viewport, which is focusable due to scroll bars.\n this._focusLastDescendant(this._layer.getBoxElement()) || this._focusStart()\n }\n\n _focusLastDescendant(element) {\n // Don't use forEach since we need to break out of the loop with `return`\n for (let child of [...element.children].toReversed()) {\n if (up.viewport.tryFocus(child) || this._focusLastDescendant(child)) {\n return true\n }\n }\n }\n}\n","const u = up.util\nconst e = up.element\n\n/*-\nThe `up.Params` class offers a consistent API to read and manipulate request parameters\nindependent of their type.\n\nRequest parameters are used in [form submissions](/api/up.Params.fromForm) and\n[URLs](/api/up.Params.fromURL). Methods like `up.submit()` or `up.render()` accept\nrequest parameters as a `{ params }` option.\n\n### Supported parameter types\n\nThe following types of parameter representation are supported:\n\n1. An object like `{ email: 'foo@bar.com' }`\n2. A query string like `'email=foo%40bar.com'`\n3. An array of `{ name, value }` objects like `[{ name: 'email', value: 'foo@bar.com' }]`\n4. A [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) object.\n\n@class up.Params\n@parent up.form\n*/\nup.Params = class Params {\n\n /*-\n Constructs a new `up.Params` instance.\n\n @constructor up.Params\n @param {Object|Array|string|FormData|up.Params} [params]\n An existing list of params with which to initialize the new `up.Params` object.\n\n The given params value may be of any [supported type](/api/up.Params).\n @return {up.Params}\n @stable\n */\n constructor(raw) {\n this.clear()\n this.addAll(raw)\n }\n\n /*-\n Removes all params from this object.\n\n @function up.Params#clear\n @stable\n */\n clear() {\n this.entries = []\n }\n\n [u.copy.key]() {\n return new up.Params(this)\n }\n\n /*-\n Returns an object representation of this `up.Params` instance.\n\n The returned value is a simple JavaScript object with properties\n that correspond to the key/values in the given `params`.\n\n ### Example\n\n ```js\n let params = new up.Params('foo=bar&baz=bam')\n let object = params.toObject()\n\n // object is now: {\n // foo: 'bar',\n // baz: 'bam'\n // }\n ```\n\n @function up.Params#toObject\n @return {Object}\n @experimental\n */\n toObject() {\n const obj = {}\n for (let entry of this.entries) {\n const { name, value } = entry\n if (!u.isBasicObjectProperty(name)) {\n if (this._isArrayKey(name)) {\n obj[name] ||= []\n obj[name].push(value)\n } else {\n obj[name] = value\n }\n }\n }\n return obj\n }\n\n /*-\n Returns an array representation of this `up.Params` instance.\n\n The returned value is a JavaScript array with elements that are objects with\n `{ name }` and `{ value }` properties.\n\n ### Example\n\n ```js\n let params = new up.Params('foo=bar&baz=bam')\n let array = params.toArray()\n\n // array is now: [\n // { name: 'foo', value: 'bar' },\n // { name: 'baz', value: 'bam' }\n // ]\n ```\n\n @function up.Params#toArray\n @return {Array}\n @experimental\n */\n toArray() {\n return this.entries\n }\n\n /*-\n Returns a [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) representation\n of this `up.Params` instance.\n\n ### Example\n\n ```js\n let params = new up.Params('foo=bar&baz=bam')\n let formData = params.toFormData()\n\n formData.get('foo') // 'bar'\n formData.get('baz') // 'bam'\n ```\n\n @function up.Params#toFormData\n @return {FormData}\n @stable\n */\n toFormData() {\n const formData = new FormData()\n for (let entry of this.entries) {\n formData.append(entry.name, entry.value)\n }\n if (!formData.entries) {\n // If this browser cannot inspect FormData with the #entries()\n // iterator, assign the original array for inspection by specs.\n formData.originalArray = this.entries\n }\n return formData\n }\n\n /*-\n Returns a [query string](https://en.wikipedia.org/wiki/Query_string) for this `up.Params` instance.\n\n The keys and values in the returned query string will be [percent-encoded](https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding).\n Non-primitive values (like [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File)) will be omitted from\n the returned query string.\n\n ### Example\n\n ```js\n let params = new up.Params({ foo: 'bar', baz: 'bam' })\n let query = params.toQuery()\n\n // query is now: 'foo=bar&baz=bam'\n ```\n\n @function up.Params#toQuery\n @return {string}\n A query string built from this `up.Params` instance.\n @stable\n */\n toQuery() {\n let simpleEntries = this.withoutBinaryEntries().entries\n let parts = simpleEntries.map(this._arrayEntryToQuery)\n return parts.join('&')\n }\n\n get [Symbol.toStringTag]() { return 'up.Params' }\n\n toString() {\n return this.toQuery()\n }\n\n _arrayEntryToQuery(entry) {\n const { value } = entry\n\n let query = encodeURIComponent(entry.name)\n // There is a subtle difference when encoding blank values:\n // 1. An undefined or null value is encoded to `key` with no equals sign\n // 2. An empty string value is encoded to `key=` with an equals sign but no value\n if (u.isGiven(value)) {\n query += \"=\"\n query += encodeURIComponent(value)\n }\n return query\n }\n\n /*-\n Returns whether the given entry cannot be encoded into a query string.\n\n We will have `File` values in our params when we serialize a form with a file input.\n These entries will be filtered out when converting to a query string.\n\n @function up.Params#_isBinaryEntry\n @internal\n */\n _isBinaryEntry({ value }) {\n return value instanceof Blob\n }\n\n hasBinaryEntries() {\n return u.some(this.entries, this._isBinaryEntry)\n }\n\n withoutBinaryEntries() {\n let simpleEntries = u.reject(this.entries, this._isBinaryEntry)\n return new this.constructor(simpleEntries)\n }\n\n /*-\n Builds a URL string from the given base URL and\n this `up.Params` instance as a [query string](https://en.wikipedia.org/wiki/Query_string).\n\n The base URL may or may not already contain a query string. The\n additional query string will be joined with `&` or `?` accordingly.\n\n @function up.Params#toURL\n @param {string} base\n The base URL that will be prepended to this `up.Params` object as a query string.\n @return {string}\n The built URL.\n @experimental\n */\n toURL(base) {\n let parts = [base, this.toQuery()]\n parts = u.filter(parts, u.isPresent)\n const separator = u.contains(base, '?') ? '&' : '?'\n return parts.join(separator)\n }\n\n /*-\n Adds a new entry with the given `name` and `value`.\n\n An `up.Params` instance can hold multiple entries with the same name.\n To overwrite all existing entries with the given `name`, use `up.Params#set()` instead.\n\n ### Example\n\n ```js\n let params = new up.Params()\n params.add('foo', 'fooValue')\n\n let foo = params.get('foo')\n // foo is now 'fooValue'\n ```\n\n @function up.Params#add\n @param {string} name\n The name of the new entry.\n @param {any} value\n The value of the new entry.\n @stable\n */\n add(name, value) {\n this.entries.push({ name, value })\n }\n\n /*-\n Adds all entries from the given list of params.\n\n The given params value may be of any [supported type](/api/up.Params).\n\n @function up.Params#addAll\n @param {Object|Array|string|FormData|up.Params|undefined} params\n @stable\n */\n addAll(raw) {\n if (u.isMissing(raw)) {\n // nothing to do\n } else if (raw instanceof this.constructor) {\n this.entries.push(...raw.entries)\n } else if (u.isArray(raw)) {\n // internal use for copying\n this.entries.push(...raw)\n } else if (u.isString(raw)) {\n this._addAllFromQuery(raw)\n } else if (u.isFormData(raw)) {\n this._addAllFromFormData(raw)\n } else if (u.isObject(raw)) {\n this._addAllFromObject(raw)\n } else {\n up.fail(\"Unsupported params type: %o\", raw)\n }\n }\n\n /*-\n @function up.Params#keys\n @internal\n */\n keys() {\n return u.map(this.entries, 'name')\n }\n\n /*-\n @function up.Params#values\n @internal\n */\n values() {\n return u.map(this.entries, 'value')\n }\n\n _addAllFromObject(object) {\n for (let key in object) {\n const value = object[key]\n // We cannot use up.util.wrapList() because we want to keep null as [null], not []\n const valueElements = u.isArray(value) ? value : [value]\n for (let valueElement of valueElements) {\n this.add(key, valueElement)\n }\n }\n }\n\n _addAllFromQuery(query) {\n for (let part of query.split('&')) {\n if (part) {\n let [name, value] = part.split('=')\n name = decodeURIComponent(name)\n // There are three forms we need to handle:\n // (1) foo=bar should become { name: 'foo', bar: 'bar' }\n // (2) foo= should become { name: 'foo', bar: '' }\n // (3) foo should become { name: 'foo', bar: null }\n if (u.isGiven(value)) {\n value = decodeURIComponent(value)\n } else {\n value = null\n }\n this.add(name, value)\n }\n }\n }\n\n _addAllFromFormData(formData) {\n for (let value of formData.entries()) {\n this.add(...value)\n }\n }\n\n /*-\n Sets the `value` for the entry with given `name`.\n\n An `up.Params` instance can hold multiple entries with the same name.\n All existing entries with the given `name` are [deleted](/api/up.Params.prototype.delete) before the\n new entry is set. To add a new entry even if the `name` is taken, use `up.Params#add()`.\n\n @function up.Params#set\n @param {string} name\n The name of the entry to set.\n @param {any} value\n The new value of the entry.\n @stable\n */\n set(name, value) {\n this.delete(name)\n this.add(name, value)\n }\n\n /*-\n Deletes all entries with the given `name`.\n\n @function up.Params#delete\n @param {string} name\n @stable\n */\n delete(name) {\n this.entries = u.reject(this.entries, this._matchEntryFn(name))\n }\n\n _matchEntryFn(name) {\n return (entry) => entry.name === name\n }\n\n /*-\n Returns the first param value with the given `name`.\n\n Returns `undefined` if no param value with that name is set.\n\n If the `name` denotes an array field (e.g. `foo[]`), *all* param values with the given `name`\n are returned as an array. If no param value with that array name is set, an empty\n array is returned.\n\n To always return a single value, use `up.Params#getFirst()` instead.\n To always return an array of values, use `up.Params#getAll()` instead.\n\n ### Example\n\n ```js\n let params = new up.Params([\n { name: 'foo', value: 'fooValue' },\n { name: 'bar[]', value: 'barValue1' },\n { name: 'bar[]', value: 'barValue2' }\n ])\n\n let foo = params.get('foo')\n // foo is now 'fooValue'\n\n let bar = params.get('bar[]')\n // bar is now ['barValue1', 'barValue2']\n ```\n\n @function up.Params#get\n @param {string} name\n @stable\n */\n get(name) {\n if (this._isArrayKey(name)) {\n return this.getAll(name)\n } else {\n return this.getFirst(name)\n }\n }\n\n /*-\n Returns the first param value with the given `name`.\n\n Returns `undefined` if no param value with that name is set.\n\n @function up.Params#getFirst\n @param {string} name\n @return {any}\n The value of the param with the given name.\n @experimental\n */\n getFirst(name) {\n const entry = u.find(this.entries, this._matchEntryFn(name))\n return entry?.value\n }\n\n /*-\n Returns an array of all param values with the given `name`.\n\n Returns an empty array if no param value with that name is set.\n\n @function up.Params#getAll\n @param {string} name\n @return {Array}\n An array of all values with the given name.\n @experimental\n */\n getAll(name) {\n const entries = u.filter(this.entries, this._matchEntryFn(name))\n return u.map(entries, 'value')\n }\n\n _isArrayKey(key) {\n return u.evalOption(up.form.config.arrayParam, key)\n }\n\n [u.isBlank.key]() {\n return this.entries.length === 0\n }\n\n /*-\n Constructs a new `up.Params` instance from the given `<form>`.\n\n The returned params may be passed as `{ params }` option to\n `up.request()` or `up.render()`.\n\n The params are built with the browser's own\n [form-data algorithm](https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData),\n so they contain exactly what a regular form submission would send:\n\n - All `<input>` types are supported.\n - Field values are usually strings, but an `<input type=\"file\">` will produce\n [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) values.\n - An `<input type=\"radio\">` or `<input type=\"checkbox\">` is only added if it is checked.\n - A `<select>` adds every selected option.\n - Fields that are disabled, or inside a `<fieldset disabled>`, are ignored.\n - Fields without a `[name]` attribute are ignored.\n - Fields [outside the form](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#form)\n that reference it with a `[form]` attribute are included.\n - [Form-associated custom elements](/learn/custom-form-fields#form-associated) are included.\n - Values appended by a [`formdata`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/formdata_event)\n event listener are included.\n - The [submit button](#submit-button) contributes its `[name]` and `[value]`.\n\n On top of that, [elements registered as fields](/learn/custom-form-fields#registering) in\n `up.form.config.fieldSelectors` are included. The browser cannot know about those.\n\n ### Example\n\n Given this HTML form:\n\n ```html\n <form id=\"signup\">\n <input type=\"text\" name=\"email\" value=\"foo@bar.com\">\n <input type=\"password\" name=\"pass\" value=\"secret\">\n </form>\n ```\n\n This serializes the form into params:\n\n ```js\n let params = up.Params.fromForm(document.querySelector('#signup'))\n let email = params.get('email') // email is now 'foo@bar.com'\n let pass = params.get('pass') // pass is now 'secret'\n ```\n\n ### Submit buttons {#submit-button}\n\n A submit button only contributes params when it is the one that submitted the form.\n Pass the button as a `{ submitButton }` option, or `false` to submit no button at all.\n Without the option the first submit button is assumed, which is also what a browser\n does when the user submits from a field by pressing `Enter`.\n\n The button must belong to the form. Like the browser's `FormData`, `up.Params.fromForm()` throws\n an error for a button of another form.\n\n ### Disabled fields {#disabled-fields}\n\n Like in a browser submission, a disabled field contributes no params.\n The exceptions are fields and buttons that a [preview](/api/up.Preview.prototype.disable) disabled while a request is loading,\n e.g. with [`[up-disable]`](/api/up-submit#up-disable). These still count as part of the form,\n so a second submission sends the same params as the first one.\n\n @function up.Params.fromForm\n @param {Element} form\n A `<form>` element.\n @param {Element|false} [options.submitButton]\n The submit button that submitted the form.\n\n The button must belong to the form, or an error is thrown.\n Pass `false` to include no submit button.\n @return {up.Params}\n A new `up.Params` instance with values from the given form.\n @stable\n */\n static fromForm(form, options = {}) {\n form = e.get(form)\n let restore = up.form.prepareParamsReadTemp(form)\n\n try {\n // The FormData constructor accepts undefined for no submitter, but throws for false.\n // It also throws for a button that doesn't belong to the form.\n let submitButton = e.get(options.submitButton ?? up.form.defaultSubmitButton(form)) || undefined\n\n // We let the browser serialize the form, instead of iterating over up.form.fields():\n //\n // - Only the browser can read the value of a form-associated custom element. The element\n // reports it through ElementInternals.setFormValue(), which no script can read back.\n // - The browser knows the full serialization rules: files, <select multiple>, the submitter\n // (including an image button's click coordinates), [dirname], fields in a\n // <fieldset disabled>, newline normalization, and whatever comes next.\n let params = new this(new FormData(form, submitButton))\n\n // up.form.fields() also finds elements registered through up.form.config.fieldSelectors.\n // The browser doesn't know they are fields.\n //\n // We recognize the fields the browser already handled by their membership in form.elements,\n // since a FormData entry cannot be mapped back to the element that contributed it.\n // A control that *is* in form.elements but that the browser refuses to serialize (a reset\n // button, an <output>) is therefore not re-added.\n let browserControls = new Set(form.elements)\n for (let field of up.form.fields(form)) {\n if (!browserControls.has(field) && !field.closest('fieldset:disabled')) params.addField(field)\n }\n return params\n } finally {\n restore()\n }\n }\n\n /*-\n Constructs a new `up.Params` instance from the fields within the given container.\n\n Unlike `up.Params.fromForm()`, the container may be any element.\n The params contain the values of all [fields](/api/up.form.fields) within the container,\n and no submit button.\n\n @function up.Params.fromContainer\n @param {Element|jQuery} container\n The element to scan for fields.\n @param {boolean} [options.includeDisabled=false]\n Whether to add fields that are disabled.\n @return {up.Params}\n @experimental\n */\n static fromContainer(container, options) {\n return this.fromFields(up.form.fields(container), options)\n }\n\n /*-\n Constructs a new `up.Params` instance from one or more\n [HTML form fields](https://www.w3schools.com/html/html_form_elements.asp).\n\n The constructed `up.Params` will include exactly those form values that would be\n included for the given fields in a regular form submission. If a given field wouldn't\n submit a value (like an unchecked `<input type=\"checkbox\">`), nothing will be added.\n\n See `up.Params.fromForm()` for more details and examples.\n\n @function up.Params.fromFields\n @param {Element|List<Element>|jQuery} fields\n @return {up.Params}\n @experimental\n */\n static fromFields(fields, { includeDisabled } = {}) {\n const params = new this()\n for (let field of u.wrapList(fields)) {\n params.addField(field, { includeDisabled })\n }\n return params\n }\n\n /*-\n Adds params from the given [HTML form field](https://www.w3schools.com/html/html_form_elements.asp).\n\n The added params will include exactly those form values that would be\n included for the given field in a regular form submission. If the given field wouldn't\n submit a value (like an unchecked `<input type=\"checkbox\">`), nothing will be added.\n\n See `up.Params.fromForm()` for more details and examples.\n\n @function up.Params#addField\n @param {Element|jQuery} field\n @param {boolean} [options.includeDisabled=false]\n Whether to add a field that is disabled.\n\n A field that a [preview](/api/up.Preview.prototype.disable) disabled is always added.\n @experimental\n */\n addField(field, { includeDisabled } = {}) {\n field = e.get(field) // unwrap jQuery\n\n // A field is excluded from a form submission if it has no name, or if it is disabled.\n let name = up.form.readFieldName(field)\n if (!name || (up.form.readFieldDisabled(field) && !includeDisabled && !field.upPreviewDisabled)) return\n\n let { tagName, type } = field\n let values = []\n\n if (tagName === 'SELECT') {\n // A <select> can have multiple selected options.\n values = u.map(field.selectedOptions, 'value')\n } else if ((type === 'checkbox') || (type === 'radio')) {\n if (field.checked) values = [up.form.readFieldValue(field)]\n } else if (type === 'file') {\n // The value of an input[type=file] is the local path displayed in the form.\n // The actual File objects are in the #files property.\n values = field.files\n } else {\n // A custom control may expose a { name } without a readable { value },\n // in which case it has nothing to contribute.\n let value = up.form.readFieldValue(field)\n if (u.isDefined(value)) values = [value]\n }\n\n for (let value of values) {\n this.add(name, value)\n }\n }\n\n [u.isEqual.key](other) {\n return (this.constructor === other.constructor) && u.isEqual(this.entries, other.entries)\n }\n\n /*-\n Constructs a new `up.Params` instance from the given URL's\n [query string](https://en.wikipedia.org/wiki/Query_string).\n\n Constructs an empty `up.Params` instance if the given URL has no query string.\n\n ### Example\n\n ```js\n let params = up.Params.fromURL('http://foo.com?foo=fooValue&bar=barValue')\n let foo = params.get('foo')\n // foo is now: 'fooValue'\n ```\n\n @function up.Params.fromURL\n @param {string} url\n The URL from which to extract the query string.\n @return {up.Params}\n The params from the given URL's query string.\n @stable\n */\n static fromURL(url) {\n const params = new (this)()\n const urlParts = u.parseURL(url)\n let query = urlParts.search\n if (query) {\n query = query.replace(/^\\?/, '')\n params.addAll(query)\n }\n return params\n }\n\n /*-\n Returns the given URL without its [query string](https://en.wikipedia.org/wiki/Query_string).\n\n ### Example\n\n ```js\n let url = up.Params.stripURL('http://foo.com?key=value')\n // url is now: 'http://foo.com/'\n ```\n\n @function up.Params.stripURL\n @param {string} url\n A URL (with or without a query string).\n @return {string}\n The given URL without its query string.\n @experimental\n */\n static stripURL(url) {\n return u.normalizeURL(url, { search: false })\n }\n\n static merge(start, ...objects) {\n let merged = u.copy(start)\n\n for (let object of objects) {\n let other = u.wrapValue(this, object)\n // We cannot use iterate over other.entries and call set(), since other.entries\n // might have multiple values for the same array key.\n for (let key of other.keys()) merged.delete(key)\n merged.addAll(other)\n }\n\n return merged\n }\n\n}\n","const u = up.util\nconst e = up.element\n\n/*-\nInstances of `up.Preview` can describe temporary changes to a page.\n\nYou can use this to describe [arbitrary loading state](/learn/previews) or [implement optimistic rendering](/learn/optimistic-rendering).\n\nPreviews are usually defined using `up.preview()` (lowercase)\nand then applied using the `[up-preview]` attribute or [`{ preview }`](/api/up.render#options.preview) option.\nSee [Previews](/learn/previews) for an overview.\n\n@class up.Preview\n@parent up.status\n*/\nup.Preview = class Preview {\n\n /*-\n @constructor up.Preview\n @internal\n */\n constructor({ fragment, request, renderOptions, cleaner }) {\n this.fragment = fragment\n this.request = request\n this.renderOptions = renderOptions\n this._cleaner = cleaner\n }\n\n /*-\n The targeted `Element` that is being previewed.\n\n When [updating multiple fragments](/learn/targeting-fragments#multiple), the first targeted fragment will be previewed.\n\n Also see [inspecting the preview context](/learn/previews#inspecting-the-preview-context).\n\n @property up.Preview#fragment\n @return {Element}\n @stable\n */\n\n /*-\n The [request](/api/up.Request) that is loading.\n\n When the request ends for [any reason](/learn/previews#ending), all preview changes will be reverted\n before the server response is processed further.\n\n Also see [inspecting the preview context](/learn/previews#inspecting-the-preview-context).\n\n @property up.Preview#request\n @return {up.Request}\n @stable\n */\n\n /*-\n The [render options](/api/up.render#parameters) for this render pass.\n\n Preview functions may mutate this object to influence\n the render pass after the request ends. Note that the request has already been queued\n when previews run. Thus, setting request-related render options will have no effect.\n\n Also see [inspecting the preview context](/learn/previews#inspecting-the-preview-context).\n\n @property up.Preview#renderOptions\n @return {Object}\n @stable\n */\n\n /*-\n Register a function that will revert this preview's effects\n when the preview [ends](/learn/previews#ending).\n\n See [Advanced preview mutations](/learn/previews#advanced-mutations) for an elaborate example.\n\n ## Example\n\n The preview below sets a `[foo]` attribute on the targeted fragment.\n It uses `#undo()` to remove the attribute when the preview ends:\n\n ```js\n up.preview('my-preview', function(preview) {\n if (preview.fragment.hasAttribute('foo')) return\n preview.fragment.setAttribute('foo', 'foo-value')\n preview.undo(() => preview.fragment.removeAttribute('foo'))\n })\n ```\n\n Instead of registering a callback with `#undo()` a preview function can also return\n a function:\n\n ```js\n up.preview('my-preview', function(preview) {\n if (preview.fragment.hasAttribute('foo')) return\n preview.fragment.setAttribute('foo', 'foo-value')\n return () => preview.fragment.removeAttribute('foo') // mark: return\n })\n ```\n\n Common DOM mutations can be expressed more concisely using an `up.Preview` method.\n These methods automatically undo their changes, without you needing to call `#undo()`:\n\n ```js\n up.preview('my-preview', function(preview) {\n preview.setAttrs({ foo: 'foo-value' })\n })\n ```\n\n @function up.Preview#undo\n @param {Function} undoFn\n A function that will be called when the preview ends.\n @stable\n */\n undo(...args) {\n if (this.ended) {\n // We might have the idea to immediately undo an effect when the preview has ended,\n // but it might lead to infinite loops in cases like this:\n //\n // up.preview('broken', function(preview) {\n // preview.show('#element')\n // return () => preview.hide('#element')\n // })\n reportError(new up.Error('Preview used after end of request'))\n } else {\n this._cleaner.guard(...args)\n }\n }\n\n /*-\n The [origin](/api/origin) element that triggered this render pass.\n\n For example, when the user clicked a link with a preview effect, `preview.origin` will be the\n clicked `a[href]` element.\n\n @property up.Preview#origin\n @return {Element}\n @stable\n */\n get origin() {\n return this.request.origin\n }\n\n /*-\n Form data for the request being previewed.\n\n See [Previewing form submissions](/learn/optimistic-rendering#previewing-form-submissions) for an example.\n\n @property up.Preview#params\n @return {up.Params}\n @stable\n */\n get params() {\n return this.request.params\n }\n\n /*-\n The [layer](/api/up.layer) that the previewed render pass is going to update.\n\n When [opening a new overlay](/learn/opening-overlays), this property has the value `\"new\"`:\n\n ```js\n up.preview('my-preview', function(preview) {\n if (preview.layer === 'new') {\n console.log(\"Opening a layer with mode\", preview.renderOptions.mode)\n } else {\n console.log(\"Updating layer\", preview.layer)\n }\n })\n ```\n\n @property up.Preview#layer\n @return {up.Layer|string}\n @stable\n */\n get layer() {\n return this.request.layer\n }\n\n /*-\n Whether this preview has [ended](/learn/previews#ending).\n\n When a [preview function](/api/up.preview) is called, its associated\n request has just been queued and `preview.ended` is always `false`.\n\n `preview.ended` can only be `true` if the preview function is async.\n See [Delaying previews](/learn/previews#delaying) for an example.\n\n @property up.Preview#ended\n @return {boolean}\n @stable\n */\n get ended() {\n return this.request.ended\n }\n\n /*-\n When [revalidating a cache entry](/api/up.Preview.prototype.revalidating),\n this property is the cached response with expired content.\n\n When not revalidating, this property is `undefined`.\n\n @property up.Preview#expiredResponse\n @return {up.Response|undefined}\n The expired response object.\n @experimental\n */\n get expiredResponse() {\n return this.renderOptions.expiredResponse\n }\n\n /*-\n Whether the previewed render pass is a [revalidation of an expired cache entry](/learn/caching#revalidation).\n\n Cache revalidation is only previewed when an\n [`[up-revalidate-preview]`](/api/up-follow#up-revalidate-preview) attribute is set\n or when a [`{ revalidatePreview: true }`](/api/up.render#options.revalidatePreview)\n render option is passed.\n\n When revalidating, the preview will be called *after* the expired content has been rendered\n from the cache.\n\n @property up.Preview#revalidating\n @return {boolean}\n Whether the preview is shown while revalidating.\n @experimental\n */\n get revalidating() {\n return !!this.expiredResponse\n }\n\n /*-\n Runs another preview function.\n\n ## Example\n\n To run another preview function registered with `up.preview()`, pass its\n name:\n\n ```js\n up.preview('foo', function(preview) { // mark: 'foo'\n // ...\n })\n\n up.preview('bar', function(preview) {\n preview.run('foo') // mark: 'foo'\n })\n ```\n\n ## Undo callbacks are merged\n\n All [undo callbacks](/api/up.Preview.prototype.undo) from the other\n preview will be added to this preview.\n\n In the example below, `preview2` will call both `undo1()` and\n `undo2()` when the preview [ends](/learn/previews#ending):\n\n ```js\n function undo1() { ... }\n function undo2() { ... }\n\n up.preview('preview1', function(preview) {\n preview.undo(undo1)\n })\n\n up.preview('preview2', function(preview) {\n preview.run('preview1')\n preview.undo(undo2)\n })\n ```\n\n ## Passing options\n\n To call a [preview with parameters](/learn/previews#parameters),\n pass an options object as a second argument:\n\n ```js\n up.preview('foo', function(preview, { size, speed }) {\n // ...\n })\n\n up.preview('bar', function(preview) {\n preview.run('foo', { size: 'large', speed: 'fast' })\n })\n ```\n\n ## Sharing behavior between previews\n\n Instead of running a preview by its registered name,\n you can pass any function that accepts an `up.Preview` argument.\n\n This is a way to share common behavior between multiple\n preview functions:\n\n ```js\n function shared(preview) {\n // ...\n }\n\n up.preview('foo', function(preview) {\n preview.run(shared)\n })\n\n up.preview('bar', function(preview) {\n preview.run(shared)\n })\n ```\n\n\n\n @function up.Preview#run\n @param {string|Function(up.Preview, Object)} nameOrFn\n Another preview function or its [registered name](/api/up.preview).\n @param {Object} options\n [Parameters](/learn/previews#parameters) that will be passed\n to the other preview function.\n @experimental\n */\n run(value, options = {}) {\n for (let fn of up.status.resolvePreviewFns(value)) {\n this.undo(up.error.guard(fn, this, options))\n }\n }\n\n /*-\n Reverts all effects of this preview.\n\n Called automatically when the previewed request ends.\n\n @function up.Preview#revert\n @internal\n */\n revert() {\n this._cleaner.clean()\n }\n\n /*-\n Temporarily changes an element's attributes.\n\n The element's original attributes will be restored\n when the preview [ends](/learn/previews#ending).\n\n ## Example\n\n This preview sets a temporary `[app-loading=true]` attribute on the targeted fragment:\n\n ```js\n up.preview('loading-attr', function(preview) {\n preview.setAttrs({ 'app-loading': true })\n })\n ```\n\n @function up.Preview#setAttrs\n @param {Element|string} [element=this.fragment]\n The element or selector to change.\n\n If omitted, the [targeted fragment](/api/up.Preview.prototype.fragment) will be changed.\n @param {Object} attributes\n An object of attribute names and values to set.\n\n To set an empty attribute, pass an empty string value.\n\n To remove an attribute, use a value of `null` or `undefined`.\n @stable\n */\n setAttrs(...args) {\n let [element, attrs] = this._parseMutatorArgs(args, 'val', 'val')\n this.undo(e.setAttrsTemp(element, attrs))\n }\n\n /*-\n Temporarily adds a CSS class to an element.\n\n The class will be removed once the preview [ends](/learn/previews#ending).\n\n ## Example\n\n This preview sets a temporary `.loading` class on the targeted fragment:\n\n ```js\n up.preview('loading-class', function(preview) {\n preview.addClass('loading')\n })\n ```\n\n @function up.Preview#addClass\n @param {Element|string} [element=this.fragment]\n The element or selector to change.\n\n If omitted, the [targeted fragment](/api/up.Preview.prototype.fragment) will be changed.\n @param {string} className\n The CSS class to add.\n @stable\n */\n addClass(...args) {\n let [element, klass] = this._parseMutatorArgs(args, 'val', 'val')\n this.undo(e.addClassTemp(element, klass))\n }\n\n /*-\n Adds one or more classes to one or more elements.\n\n @function up.Preview#addClassBatch\n @internal\n */\n addClassBatch(elements, classes) {\n for (let element of elements) {\n for (let klass of classes) {\n this.addClass(element, klass)\n }\n }\n }\n\n /*-\n Temporarily removes a CSS class from an element.\n\n The removed class will be restored once the preview [ends](/learn/previews#ending).\n\n @function up.Preview#removeClass\n @param {Element|string} [element=this.fragment]\n The element or selector to change.\n\n If omitted, the [targeted fragment](/api/up.Preview.prototype.fragment) will be changed.\n @param {string} className\n The CSS class to remove.\n @stable\n */\n removeClass(...args) {\n let [element, klass] = this._parseMutatorArgs(args, 'val', 'val')\n this.undo(e.removeClassTemp(element, klass))\n }\n\n /*-\n Temporarily sets inline CSS styles on an element.\n\n ## Example\n\n This preview temporarily changes the background and foreground colors of\n the targeted fragment:\n\n ```js\n up.preview('highlight', function(preview) {\n preview.setStyle({\n 'color': 'yellow',\n 'background-color': 'red'\n })\n })\n ```\n\n @function up.Preview#setStyle\n @param {Element|string} [element=this.fragment]\n The element or selector to change.\n\n If omitted, the [targeted fragment](/api/up.Preview.prototype.fragment) will be changed.\n @param {Object} styles\n One or more CSS properties with kebab-case keys.\n @stable\n */\n setStyle(...args) {\n let [element, styles] = this._parseMutatorArgs(args, 'val', 'val')\n this.undo(e.setStyleTemp(element, styles))\n }\n\n /*-\n Temporarily disables fields and buttons.\n\n The disabled controls will be re-enabled when the preview [ends](/learn/previews#ending).\n\n Also see [Disabling forms while working](/learn/disabling-forms).\n\n ## Example\n\n This preview disables an `input[name=email]` and all controls within a container matching `.button-bar`:\n\n ```js\n up.preview('sign-in', function(preview) {\n preview.disable('input[name=email]')\n preview.disable('.button-bar')\n })\n ```\n\n @param {Element|string} [element=this.fragment]\n The element (or selector) within which fields and buttons should be disabled.\n\n If omitted, fields and buttons within the [targeted fragment](/api/up.Preview.prototype.fragment) will be disabled.\n @function up.Preview#disable\n @stable\n */\n disable(...args) {\n let [element] = this._parseMutatorArgs(args, 'val')\n this.undo(up.form.disableTemp(element, { preview: true }))\n }\n\n /*-\n Temporarily inserts an element.\n\n The element will be removed when the preview [ends](/learn/previews#ending).\n\n ## Providing the new element\n\n The new element is passed as the last argument to the `insert()` method.\n\n For example, this preview will insert a `.spinner` element as the last child of the targeted fragment:\n\n ```js\n up.preview('spinner', function(preview) {\n let spinnerElement = up.element.createFromHTML('<span class=\"spinner\">Please wait...</span>')\n preview.insert(spinnerElement)\n })\n ```\n\n You may also pass a string of HTML:\n\n ```js\n up.preview('spinner', function(preview) {\n preview.insert('<span class=\"spinner\">Please wait...</span>')\n })\n ```\n\n ## Cloning templates {#templates}\n\n If the given element is a [template](/learn/templates), it will be cloned before insertion.\n\n Let's say we have a template for the spinner element:\n\n ```html\n <template id=\"spinner-template\">\n <span class=\"spinner\">\n Please wait ...\n </span>\n </template>\n ```\n\n We can pass a selector for the template to clone:\n\n ```js\n up.preview('spinner', function(preview) {\n preview.insert('#spinner-template')\n })\n ```\n\n Any [template variables](/learn/templates#dynamic) can be appended after the\n selector as [relaxed JSON](/api/relaxed-json):\n\n ```js\n up.preview('spinner', function(preview) {\n preview.insert('#spinner-template { message: \"One moment...\" }')\n })\n ```\n\n For more control you may clone the template manually using `up.template.clone()`:\n\n ```js\n up.preview('spinner', function(preview) {\n let [spinnerElement] = up.template.clone('#spinner-template', { message: \"One moment...\" })\n spinnerElement.classList.add('big')\n preview.insert(spinnerElement)\n })\n ```\n\n ## Controlling the insert position\n\n You can control where the new element is inserted by providing a *reference element* and an *adjacent position* relative\n to the reference argument.\n\n For example, this preview will create a `.spinner` element as the *first* child of the `<body>`:\n\n ```js\n up.preview('spinner', function(preview) {\n preview.insert(document.body, 'afterbegin', '<span class=\"spinner\">Please wait...</span>')\n })\n ```\n\n The following insert positions are supported:\n\n @include adjacent-positions\n\n If the reference element is omitted, the new element will be inserted relative to\n the [targeted fragment](/api/up.Preview.prototype.fragment).\n\n If the adjacent position is omitted, the new element will become the new last child\n of the reference element (`'beforeend'`).\n\n ## Compilation\n\n When this function inserts a new element, it is [compiled](/learn/enhancing-elements).\\\n When the preview [ends](/learn/previews#ending), the element is [destroyed](/learn/enhancing-elements#destructor).\n\n ## Moving existing elements\n\n When the last argument is an attached element, it is moved to the indicated position relative to the reference element.\n When the preview ends, the element is returned to its initial position.\n\n Moved elements are neither [compiled nor destroyed](#compilation) by this function.\n\n @function up.Preview#insert\n\n @param {Element|string} [reference=this.fragment]\n The reference element relative to which the new element will be inserted.\n\n You may pass an `Element` or a CSS selector.\n\n @param {string} [position='beforeend']\n The insert position relative to the `reference` element.\n\n @param {Element|string} newElement\n The element to insert.\n\n You may pass an `Element`, a CSS selector or a snippet of HTML.\n\n @stable\n */\n insert(...args) {\n // (1) tempValue can have on of the following forms:\n // - A string of HTML\n // - A CSS selector string matching a template\n // - An Element node\n // - A Text node\n // - A NodeList with mixed Element and Text nodes\n // (2) When tempValue resolves to multiple nodes, it will be wrapped\n // in an <up-wrapper> container.\n let [reference, position = 'beforeend', tempValue] = this._parseMutatorArgs(args, 'val', u.isAdjacentPosition, 'val')\n this.undo(up.fragment.insertTemp(reference, position, tempValue))\n }\n\n /*-\n Temporarily [shows](/api/up.element.show) a hidden element.\n\n The element will be [hidden](/api/up.element.hide) when the preview [ends](/learn/previews#ending).\n\n ## Example\n\n This preview shows a hidden `#spinner` element while the request is loading:\n\n ```js\n up.preview('show-spinner', function(preview) {\n preview.show('#spinner')\n })\n ```\n\n @function up.Preview#show\n @param {Element|string} [element=this.fragment]\n The element or selector to change.\n\n If omitted, the [targeted fragment](/api/up.Preview.prototype.fragment) will be changed.\n @stable\n */\n show(...args) {\n let [element] = this._parseMutatorArgs(args, 'val')\n this.undo(e.showTemp(element))\n }\n\n /*-\n Temporarily [hides](/api/up.element.hide) an element.\n\n The element will be [shown](/api/up.element.show) when the preview [ends](/learn/previews#ending).\n\n > [tip]\n > To visually remove elements during a preview, prefer hiding over detaching. See [Prefer additive changes](/learn/previews#prefer-additive-changes).\n\n ## Example\n\n This preview hides an element `#nav` while the request is loading:\n\n ```js\n up.preview('hide-nav', function(preview) {\n preview.hide('#nav')\n })\n ```\n\n @function up.Preview#hide\n @param {Element|string} [element=this.fragment]\n The element or selector to change.\n\n If omitted, the [targeted fragment](/api/up.Preview.prototype.fragment) will be changed.\n @stable\n */\n hide(...args) {\n let [element] = this._parseMutatorArgs(args, 'val')\n this.undo(e.hideTemp(element))\n }\n\n /*-\n Temporarily [hides](/api/up.element.hide) the children of an element.\n\n The children will be [shown](/api/up.element.show) when the preview [ends](/learn/previews#ending).\n\n > [tip]\n > To visually remove elements during a preview, prefer hiding over detaching. See [Prefer additive changes](/learn/previews#prefer-additive-changes).\n\n ## Example\n\n This preview visually replaces the children of the [targeted fragment](/api/up.Preview.prototype.fragment)\n with a `.spinner` element:\n\n ```js\n up.preview('spinner', function(preview) {\n preview.hideContent()\n preview.insert('<span class=\"spinner\">Please wait...</span>')\n })\n ```\n\n For a more concise way to temporarily swap children with a temporary element,\n see the [`swapContent()`](/api/up.Preview.prototype.swapContent) method.\n\n @function up.Preview#hideContent\n @param {Element|string} [element=this.fragment]\n The element or selector to hide the children of.\n\n If omitted, the children of the [targeted fragment](/api/up.Preview.prototype.fragment) will be hidden.\n @experimental\n */\n hideContent(...args) {\n let [parent] = this._parseMutatorArgs(args, 'val')\n // Place all children in a wrapper so we can hide text nodes.\n let wrapper = e.wrapChildren(parent)\n e.hide(wrapper)\n this.undo(() => e.unwrap(wrapper))\n }\n\n /*-\n Shows a temporary [placeholder](/learn/placeholders) within an element.\n\n The element's existing children will be hidden for the duration of this preview.\n When the preview ends, the placeholder will be removed and the element's original children\n are shown again.\n\n If the previewed render pass [opens a new overlay](/learn/opening-overlays), the placeholder\n will be shown in a temporary overlay with the same [visual style](/learn/customizing-overlays) and open animation.\n\n ## Example\n\n This preview shows a `.skeleton` element within the [targeted fragment](/api/up.Preview.prototype.fragment):\n\n ```js\n up.preview('skeleton', function(preview) {\n preview.showPlaceholder('<span class=\"skeleton\">...</span>')\n })\n ```\n\n You may also clone a [template](/learn/templates):\n\n ```js\n up.preview('skeleton', function(preview) {\n preview.showPlaceholder('#skeleton-template')\n })\n ```\n\n To show the placeholder within another element, pass it as a first reference argument:\n\n ```js\n up.preview('showPlaceholder', function(preview) {\n preview.showPlaceholder('body', '#skeleton-template')\n })\n ```\n\n @function up.Preview#showPlaceholder\n @param {Element|string} [element=this.fragment]\n The element within which to show a placeholder, or its selector.\n @param {Element|string} newContent\n The placeholder to insert.\n\n You may pass an `Element`, a CSS selector or a snippet of HTML.\n\n If the given element is a [template](/learn/templates), it will be cloned before insertion.\n @experimental\n */\n showPlaceholder(...args) {\n let [parent, placeholderReference] = this._parseMutatorArgs(args, 'val', 'val')\n\n // We do not need to wrap a NodeList of mixed Text and Element nodes.\n // Both swapContent() and openLayer() can deal with that.\n let placeholderNodes = up.fragment.provideNodes(placeholderReference, { origin: this.origin })\n\n up.puts('[up-placeholder]', 'Showing placeholder %o', placeholderReference)\n\n if (parent) {\n this.swapContent(parent, placeholderNodes)\n } else if (this.layer === 'new') {\n this.openLayer(placeholderNodes, { closeAnimation: false })\n // Now that the renderOptions have served as defaults for openLayer(),\n // we can disable animations for the upcoming render pass. This way\n // we don't see flickering when another overlay opens with the final content.\n this.renderOptions.openAnimation = false\n }\n }\n\n /*-\n Visually replaces the children of an element with new content for the duration of this preview.\n\n The visual effect is achieved by [hiding existing children](/api/up.Preview.prototype.hideContent)\n and [inserting a new element](/api/up.Preview.prototype.insert) as the\n only visible child. When the preview [ends](/learn/previews#ending) all changes will be reverted.\n\n > [tip]\n > To visually remove elements during a preview, prefer hiding over detaching. See [Prefer additive changes](/learn/previews#prefer-additive-changes).\n\n ## Example\n\n This preview visually replaces the children of the [targeted fragment](/api/up.Preview.prototype.fragment)\n with a `.spinner` element:\n\n ```js\n up.preview('spinner', function(preview) {\n preview.swapContent('<span class=\"spinner\">Please wait...</span>')\n })\n ```\n\n To swap the content of another element, pass it as a first reference argument:\n\n ```js\n up.preview('spinner', function(preview) {\n preview.swapContent('body', '<span class=\"spinner\">Please wait...</span>')\n })\n ```\n\n @function up.Preview#swapContent\n @param {Element|string} [element=this.fragment]\n The element or selector to visually swap children of.\n\n If omitted, the children of the [targeted fragment](/api/up.Preview.prototype.fragment) will be swapped.\n @param {Element|string} newContent\n The new content to insert.\n\n You may pass an `Element`, a CSS selector or a snippet of HTML.\n\n If the given element is a [template](/learn/templates), it will be cloned before insertion.\n\n @experimental\n */\n swapContent(...args) {\n let [parent, newContent] = this._parseMutatorArgs(args, 'val', 'val')\n this.hideContent(parent)\n this.insert(parent, newContent)\n }\n\n /*-\n Opens a temporary overlay.\n\n When the preview ends, the overlay will be [dismissed](/learn/closing-overlays)\n with a [dismissal value](/learn/closing-overlays#dismissal-values) of `\":undo-preview\"`.\n\n When the user dismisses the temporary overlay before the server responds,\n the previewed request will be [aborted](/learn/aborting-requests).\n\n When previewing a render pass that is going to [open an overlay](/learn/opening-overlays),\n the temporary overlay will use the same [visual style](/learn/customizing-overlays) and animations.\n\n ## Example\n\n This preview opens a temporary overlay with a loading message:\n\n ```js\n up.preview('spinner-overlay', function(preview) {\n preview.openLayer('Please wait...')\n })\n ```\n\n @function up.Preview#openLayer\n @experimental\n */\n openLayer(content, options = {}) {\n let undoDismissValue = ':undo-preview'\n\n let onDismiss = ({ value }) => {\n // Abort the request when the user dismisses the overlay,\n // but not when we ourselves dismiss it when reverting.\n if (value !== undoDismissValue) this.request.abort({ reason: 'Preview overlay dismissed' })\n }\n\n up.layer.open({\n ...u.pick(this.renderOptions, [...up.Layer.Overlay.VISUAL_KEYS, 'target']),\n ...options,\n content,\n abort: false,\n onDismiss\n })\n\n // The new overlay is already in the stack. However, this function must be be sync and cannot\n // wait a microtask for (the fulfilled) up.layer.open() promise.\n let overlay = up.layer.front\n\n this.undo(() => overlay.dismiss(undoDismissValue, { preventable: false }))\n\n return overlay\n }\n\n _parseMutatorArgs(args, ...specs) {\n let [element, ...rest] = u.args(args, ...specs)\n // (1) up.fragment.get(undefined) returns undefined\n // (2) up.fragment.get(Element) returns the element\n // (3) this.fragment is undefined when opening a new layer\n element = up.fragment.get(element, { layer: this.layer, origin: this.origin }) || this.fragment\n return [element, ...rest]\n }\n\n}\n","const e = up.element\n\nconst TRANSITION_DELAY = 300\n\nup.ProgressBar = class ProgressBar {\n\n constructor() {\n this._step = 0\n this._element = e.affix(document.body, 'up-progress-bar')\n this._element.style.transition = `width ${TRANSITION_DELAY}ms ease-out`\n\n this._moveTo(0)\n // The element must be painted at width: 0 before we apply the target width.\n // If the first paint sees the bar at the target width, we don't get an animated transition.\n e.paint(this._element)\n\n this._width = 31\n this._nextStep()\n }\n\n _nextStep() {\n let diff\n if (this._width < 80) {\n if (Math.random() < 0.15) {\n // Sometimes the bar grows quickly by (7..12) percent.\n diff = 7 + (5 * Math.random())\n } else {\n // Most of the time the bar progresses by (1.5..2) percent.\n diff = 1.5 + (0.5 * Math.random())\n }\n } else {\n // Above 80% completion we grow the bar more slowly,\n // using a formula that can never reach 100%.\n diff = 0.13 * (100 - this._width) * Math.random()\n }\n\n this._moveTo(this._width + diff)\n this._step++\n\n // Steps occur less frequent the longer we wait for the server.\n const nextStepDelay = TRANSITION_DELAY + (this._step * 40)\n this.timeout = setTimeout(this._nextStep.bind(this), nextStepDelay)\n }\n\n _moveTo(width) {\n this._width = width\n this._element.style.width = `${width}vw`\n }\n\n destroy() {\n clearTimeout(this.timeout)\n this._element.remove()\n }\n\n conclude() {\n clearTimeout(this.timeout)\n this._moveTo(100)\n setTimeout(this.destroy.bind(this), TRANSITION_DELAY)\n }\n}\n","const u = up.util\n\nup.RenderOptions = (function() {\n\n // Sometimes we need to use given render options, but disable preview effects.\n const NO_PREVIEWS = {\n preview: false,\n disable: false,\n placeholder: false,\n feedback: false,\n }\n\n // Sometimes we need to use given render options, but disable meddling with user control.\n const NO_INPUT_INTERFERENCE = {\n scroll: 'keep',\n focus: 'keep',\n confirm: false,\n }\n\n // Sometimes we need to use given render options, but disable animation.\n const NO_MOTION = {\n transition: false,\n animation: false,\n openAnimation: false,\n closeAnimation: false,\n }\n\n // These properties are used before the request is sent.\n // Hence there cannot be a failVariant.\n const PREFLIGHT_KEYS = [\n 'url',\n 'method',\n 'origin',\n 'headers',\n 'params',\n 'cache',\n 'fallback', // this may produce a different X-Up-Target request header if { target } is missing on page\n 'abort',\n 'abortable',\n 'handleAbort',\n 'confirm',\n 'feedback',\n 'disable',\n 'placeholder',\n 'preview',\n 'origin',\n 'originLayer',\n 'baseLayer',\n 'navigate', // Also set navigate defaults for fail options\n 'fail',\n 'onError',\n ]\n\n // These properties are used between success options and fail options.\n // There's a lot of room to think differently about what should be shared and what\n // should explicitly be set separately for both cases. An argument can always be\n // that it's either convenient to share, or better to be explicit.\n //\n // Generally we have decided to share:\n //\n // - Options that are relevant before the request is sent (e.g. { url } or { abort }).\n // - Options that change how we think about the entire rendering operation.\n // E.g. if we always want to see a server response, we set { fallback: true }.\n //\n // Generally we have decided to not share:\n //\n // - Layer-related options (e.g. target layer or options for a new layer)\n // - Options that change focus. The user might focus a specific element from a success element,\n // like { focus: '.result', failFocus: '.errors' }.\n // We do however set { focus: 'auto', failFocus: 'auto' } in up.fragment.config.navigateOptions,\n // as 'auto' is generic enough for a shared default.\n // - Options that change scrolling. The user might scroll to a specific element from a success element,\n // like { scroll: '.result', failScroll: '.errors' }.\n // We do however set { scroll: 'auto', failScroll: 'auto' } in up.fragment.config.navigateOptions.\n // as 'auto' is generic enough for a shared default.\n const SHARED_KEYS = PREFLIGHT_KEYS.concat([\n 'keep', // If I want to discard [up-keep] elements, I also want to discard them for the fail case.\n 'hungry', // If I want to opportunistically update [up-hungry] elements, I also want it for the fail case.\n 'history', // Note that regardless of setting, we only set history for reloadable responses (GET).\n 'source', // No strong opinions about that one. Wouldn't one always have a source? Might as well not be an option.\n 'saveScroll', // No strong opinions about that one. Wouldn't one always want to saveScroll? Might as well not be an option.\n ])\n\n // At least one of these properties must be given for Unpoly to render content.\n const CONTENT_KEYS = [\n 'url',\n 'response',\n 'content',\n 'fragment',\n 'document',\n ]\n\n // preprocess() will leave out properties for which there may be a better default\n // later, in particular from the layer config in up.Change.OpenLayer.\n const LATE_KEYS = [\n 'history',\n 'focus',\n 'scroll',\n ]\n\n const EVENT_CALLBACK = {} // default in up.element.parseCallback() is { mainKey: 'event' }\n const RESULT_CALLBACK = { argNames: ['result'] }\n const ERROR_CALLBACK = { argNames: ['error'] }\n const OPEN_LAYER_CALLBACK = { expandObject: ['layer'] }\n const CLOSE_LAYER_CALLBACK = { expandObject: ['layer', 'value', 'response'] }\n\n const CALLBACKS = {\n onLoaded: EVENT_CALLBACK,\n onRendered: RESULT_CALLBACK,\n onFinished: RESULT_CALLBACK,\n onOffline: EVENT_CALLBACK,\n onError: ERROR_CALLBACK,\n onOpened: OPEN_LAYER_CALLBACK,\n onAccept: CLOSE_LAYER_CALLBACK,\n onAccepted: CLOSE_LAYER_CALLBACK,\n onDismiss: CLOSE_LAYER_CALLBACK,\n onDismissed: CLOSE_LAYER_CALLBACK,\n }\n\n function parseCallback(key, code) {\n return up.script.parseCallback(code, parseCallbackOptions(key))\n }\n\n function parseCallbackOptions(key) {\n return CALLBACKS[key] ?? up.fail(`Unknown callback { ${key} }`)\n }\n\n function callbackAttr(element, attrName, key) {\n // return e.parseAttr(element, attrName, (value) => parseCallback(key, value))\n return up.script.callbackAttr(element, attrName, parseCallbackOptions(key))\n }\n\n function navigateDefaults(options) {\n if (options.navigate) {\n return up.fragment.config.navigateOptions\n }\n }\n\n function normalizeURL({ url }) {\n // Absolutize a relative URL in case render options are re-used later,\n // after the location base changed. For example:\n //\n // (1) We're navigating to a relative URL (which changes history) and the fragment\n // is revalidated. Then revalidation should not use its own changed location as a new base.\n //\n // (2) There is a network issue, which emits up:fragment:offline.\n // Then the location changes for some reason. Then a listener calls event.retry(),\n // which renders with the original render options.\n if (url) {\n return { url: u.normalizeURL(url) }\n }\n }\n\n // Rename keys like { useData } to just { data }.\n //\n // When we parse render options from attributes, we need to infix some attributes\n // with \"-use-\" to distinguish them from a similar attribute affecting the element itself.\n // E.g. a[up-data] is a link's own structured data, but a[up-use-data] overrides data\n // for the first fragment updated by the link once clicked.\n //\n // For reasons of aesthetics and conciseness, we still prefer the render option to just\n // be { data, dataMap }, not { useData, useDataMap }. Because we otherwise have full symmetry\n // between attributes and options, *except* for this one distinction, we also accept\n // { useData } for { data }.\n function removeUsePrefix(options) {\n u.renameKey(options, 'useData', 'data')\n u.renameKey(options, 'useHungry', 'hungry')\n u.renameKey(options, 'useKeep', 'keep')\n }\n\n function preprocess(options) {\n up.migrate.preprocessRenderOptions?.(options)\n up.layer.normalizeOptions(options)\n removeUsePrefix(options)\n\n const defaults = u.merge(\n up.fragment.config.renderOptions,\n navigateDefaults(options)\n )\n\n return u.merge(\n // Leave out properties for which there may be a better default later, in particular\n // from the layer config in up.Change.OpenLayer. If we merged it now we could\n // not distinguish a user option (which always has highest priority) with a\n // default that may be overridden by the layer config. If there is no better default\n // later, the original defaults will be applied in finalize().\n u.omit(defaults, LATE_KEYS),\n // Remember the defaults in a { default } prop so we can re-use it\n // later in deriveFailOptions() and finalize().\n { defaults },\n { inputDevice: up.event.inputDevice },\n options,\n normalizeURL(options),\n rememberOriginLayer(options),\n )\n }\n\n // Look up the origin layers*before* we make the request.\n // In case of { layer: 'origin' } the { origin } element may get removed while the request was in flight,\n // making up.Change.FromContent#execute() fail with a message like \"layer { origin } does not exist\" or\n // \"Could not find a layer to render in. You may have passed an unmatchable layer reference, or a detached element.\".\n function rememberOriginLayer({ origin, originLayer }) {\n if (origin && !originLayer) {\n return {\n originLayer: up.layer.get(origin),\n }\n }\n }\n\n function finalize(preprocessedOptions, lateDefaults) {\n return u.merge(\n preprocessedOptions.defaults,\n lateDefaults,\n preprocessedOptions\n )\n }\n\n function assertContentGiven(options) {\n if (!u.some(CONTENT_KEYS, (contentKey) => u.isGiven(options[contentKey]))) {\n // up.layer.open() should open an empty layer without a content key.\n if (options.defaultToEmptyContent) {\n options.content = ''\n } else {\n up.fail('up.render() needs either { ' + CONTENT_KEYS.join(', ') + ' } option')\n }\n }\n }\n\n function failOverrides(options) {\n const overrides = {}\n for (let key in options) {\n // Note that up.fragment.successKey(key) only returns a value\n // if the given key is prefixed with \"fail\".\n const value = options[key]\n let unprefixed = up.fragment.successKey(key)\n if (unprefixed) {\n overrides[unprefixed] = value\n }\n }\n return overrides\n }\n\n function deriveFailOptions(preprocessedOptions) {\n // Remember that this pass was a failure (for up.RenderResult#ok)\n let markFailure = { didFail: true }\n\n // Collect all fail-prefixed options\n let overrides = failOverrides(preprocessedOptions)\n\n if (preprocessedOptions.failOptions) {\n return {\n // Only use global defaults and a few keys shared between success and failure.\n ...preprocessedOptions.defaults,\n ...u.pick(preprocessedOptions, SHARED_KEYS),\n ...overrides,\n // We sometimes want to log that fail-prefixed options were used, to alert the\n // user of the fact that there are different option sets for success and failure.\n didForceFailOptions: true,\n ...markFailure,\n }\n } else {\n return {\n // Use all the success options.\n ...preprocessedOptions,\n // We still allow to override individual options.\n // This is relevant for up.validate() which does not use fail options,\n // but lets users still override individual options for the failure case.\n ...overrides,\n ...markFailure,\n }\n }\n }\n\n // Returns a copy of the given options where each callback in ownCallbacks runs before\n // the caller's callback of the same name.\n function chainCallbacks(options, ownCallbacks) {\n let chained = { ...options }\n for (let key in ownCallbacks) {\n chained[key] = u.sequence(ownCallbacks[key], options[key])\n }\n return chained\n }\n\n return {\n preprocess,\n finalize,\n assertContentGiven,\n deriveFailOptions,\n parseCallback,\n callbackAttr,\n chainCallbacks,\n NO_PREVIEWS,\n NO_MOTION,\n NO_INPUT_INTERFERENCE,\n }\n})()\n","const u = up.util\n\n/*-\nInstances of `up.RenderResult` describe the effects of [rendering](/api/up.render).\n\nFunctions like `up.render()`, `up.follow()` or `up.submit()` return a promise\nthat resolves with an `up.RenderResult`:\n\n```js\nlet result = await up.render('.target', { content: 'foo' })\nconsole.log(result.fragments) // result: [<div class=\"target\">...</div>]\nconsole.log(result.layer) // result: up.Layer.Root\nconsole.log(result.renderOptions) // result: { target: '.target', content: 'foo', ... }\n```\n\n@class up.RenderResult\n@parent up.fragment\n*/\nup.RenderResult = class RenderResult {\n\n /*-\n The effective fragments that ended up being inserted.\n\n @property up.RenderResult#fragments\n @param {Array<Element>} fragments\n @stable\n */\n\n /*-\n The updated [layer](/api/up.layer).\n\n @property up.RenderResult#layer\n @param {up.Layer} layer\n @stable\n */\n\n /*-\n The [target selector](/learn/targeting-fragments) for the rendered fragments.\n\n When the given target contains an abstract selector like `:main` or `:layer`,\n this property describes the specific selector that matched:\n\n ```js\n let result = await up.render({ target: ':main' })\n result.target // result: \"[up-main='']\"\n ```\n\n If any `[up-hungry]` elements were added to the render pass, they\n are *not* included in `result.target`.\n\n @property up.RenderResult#target\n @param {string} target\n @experimental\n */\n\n /*-\n The [render](/api/up.render) options used to produce this result.\n\n If this result was produced from an [error response](/learn/error-responses),\n [`fail` prefixes](/learn/error-responses#fail-options)\n have been removed from the render options.\n\n @property up.RenderResult#renderOptions\n @param {Object} renderOptions\n @experimental\n */\n\n /*-\n A promise that settles when no further DOM changes will be caused by this render pass.\n\n In particular:\n\n - [Animations](/api/up.motion) have concluded and [transitioned](/api/up-transition) elements were removed from the DOM tree.\n - A [cached response](/api/up.render#options.cache) was [revalidated with the server](/learn/caching#revalidation).\n If the server has responded with new content, this content has also been rendered.\n\n The promise resolves to the last `up.RenderResult` that updated a fragment.\n If [revalidation](/learn/caching#revalidation) re-rendered the fragment, it is the result from the\n second render pass. If no revalidation was performed, or if revalidation yielded an [empty response](/learn/caching#when-nothing-changed),\n it is the result from the initial render pass.\n\n The promise will reject if the server sends an error status,\n if there is a network issue, or if targets could not be matched.\n\n Also see [Awaiting postprocessing](/learn/render-lifecycle#postprocessing).\n\n ### Example\n\n ```js\n let result = await up.render({ url: '/path' }).finished\n console.log(result.fragments)\n ```\n\n @property up.RenderResult#finished\n @param {Promise<up.RenderResult>} finished\n A promise that settles after all DOM changes.\n @stable\n */\n\n constructor({ layer, target, renderOptions = {}, partialResults = [] } = {}) {\n this.layer = layer\n this.target = target\n this.renderOptions = renderOptions\n\n this.fragments = this._partialPhase(partialResults, 'fragments').flat()\n this.finished = this._finish(partialResults)\n }\n\n _partialPhase(partialResults, phase, extraValue) {\n return u.compact([...u.map(partialResults, phase), extraValue])\n }\n\n async _finish(partialResults) {\n let finishedPromises = this._partialPhase(partialResults, 'finished')\n let verifyFns = this._partialPhase(partialResults, 'verifyFinished', this.renderOptions.verifyFinished)\n await Promise.all(finishedPromises)\n\n let finishedResult = this\n for (let verifyFn of verifyFns) {\n let verifyerResult = await verifyFn(finishedResult)\n finishedResult = verifyerResult || finishedResult\n }\n return finishedResult\n }\n\n /*-\n Whether this render pass did not result in any fragments being rendered.\n\n There are some cases where no fragments were rendered:\n\n - The server sent HTTP status `304 Not Modified` to [avoid re-rendering unchanged content](/learn/conditional-requests).\n - The server sent HTTP status `204 No Content`.\n - The target selector was set to `':none'` by either client or server.\n - The server sent an `X-Up-Accept-Layer` or `X-Up-Dismiss-Layer` header.\n This [closes an overlay](/learn/closing-overlays#from-server) before content is rendered.\n - Every targeted element was [kept](/learn/keeping-elements) by `[up-keep]`.\n\n @property up.RenderResult#none\n @param {boolean} none\n @stable\n */\n get none() {\n return !this.fragments.length\n }\n\n /*-\n Returns the inserted fragment.\n\n When [multiple fragments](/learn/targeting-fragments#multiple) were inserted, the first fragment is returned.\n To get a list of all inserted fragments, use the [`{ fragments }`](/api/up.RenderResult.prototype.fragments) property.\n\n See also `up.Request#fragment`.\n\n @property up.RenderResult#fragment\n @param {Element} fragment\n @stable\n */\n get fragment() {\n return this.fragments[0]\n }\n\n /*-\n Whether this render pass has rendered a successful response.\n\n By default responses with a `2xx` status code are considered successful.\n Other HTTP codes (like `500` or `404`) are considered [error responses](/learn/error-responses#fail-options).\n\n Rendering a [string of HTML](/learn/providing-html#string) is always successful.\n\n @property up.RenderResult#ok\n @param {boolean} up.RenderResult#ok\n @experimental\n */\n get ok() {\n return !this.renderOptions.didFail\n }\n\n}\n","const u = up.util\n\n/*-\nA normalized description of an [HTTP request](/api/up.request).\n\nYou can queue a request using the `up.request()` method:\n\n```js\nlet request = up.request('/foo')\nconsole.log(request.url)\n\n// A request object is also a promise for its response\nlet response = await request\nconsole.log(response.text)\n```\n\n@class up.Request\n@parent up.network\n*/\nup.Request = class Request extends up.Record {\n\n /*-\n The HTTP method for the request.\n\n @property up.Request#method\n @param {string} method\n @stable\n */\n\n /*-\n The requested URL.\n\n @property up.Request#url\n @param {string} url\n @stable\n */\n\n /*-\n The [hash component](https://en.wikipedia.org/wiki/URI_fragment) of this request's URL.\n\n The `{ hash }` property is automatically extracted from the given URL:\n\n ```js\n let request = up.request({ url: '/path#section' })\n request.url // result: '/path'\n request.hash // result: '#section'\n ```\n\n @property up.Request#hash\n @param {string} hash\n @stable\n */\n\n /*-\n [Parameters](/api/up.Params) that should be sent as the request's payload.\n\n @property up.Request#params\n @param {Object|FormData|string|Array} params\n @stable\n */\n\n /*-\n The CSS selector [targeted](/learn/targeting-fragments) by this request.\n\n The selector will be sent as an `X-Up-Target` header.\n\n @learn-ref targeting-fragments\n\n @property up.Request#target\n @param {string} target\n @stable\n */\n\n /*-\n The CSS selector [targeted](/learn/targeting-fragments) by this request in case\n the server responds with an [error code](/learn/error-responses).\n\n The selector will be sent as an `X-Up-Fail-Target` header.\n\n @learn-ref error-responses#fail-options\n\n @property up.Request#failTarget\n @param {string} failTarget\n @stable\n */\n\n /*-\n An object of HTTP headers that will be sent with this request.\n\n Unpoly will by default send a number of custom request headers.\n See `up.protocol` for details.\n\n To read a single header, use `up.Request#header()`.\n\n @property up.Request#headers\n @param {Object} headers\n @stable\n */\n\n /*-\n Returns the HTTP request header value with the given name.\n\n Returns `undefined` if the given header name will not be sent with this request.\n\n > [note]\n > For implementation reasons, the search for the header is case-sensitive.\n\n @function up.Request#header\n @param {string} name\n The case-sensitive name.\n @return {string|undefined}\n The value of the header.\n @stable\n */\n\n /*-\n A timeout in milliseconds.\n\n If the request is queued due to [many concurrent requests](/api/up.network.config#config.concurrency),\n the timeout will not include the time spent waiting in the queue.\n\n @property up.Request#timeout\n @param {Object|undefined} timeout\n @stable\n */\n\n /*-\n Whether to wrap non-standard HTTP methods in a POST request.\n\n If this is set, methods other than GET and POST will be converted to a `POST` request\n and carry their original method as a `_method` parameter. This is to [prevent unexpected redirect behavior](https://makandracards.com/makandra/38347).\n\n Defaults to [`up.network.config`](/api/up.network.config#config.wrapMethod).\n\n @property up.Request#wrapMethod\n @param {boolean} wrapMethod\n @stable\n */\n\n /*-\n The [context](/learn/layer-context) of the layer targeted by this request.\n\n The context object will be sent as an `X-Up-Context` header.\n\n @learn-ref layer-context\n\n @property up.Request#context\n @param {Object} context\n @experimental\n */\n\n /*-\n The [context](/learn/layer-context) of the layer targeted by this request in case the server responds with an [error code](/learn/error-responses).\n\n The context object will be sent as an `X-Up-Fail-Context` header.\n\n @property up.Request#failContext\n @param {Object} failContext\n @experimental\n */\n\n /*-\n The [layer](/api/up.layer) targeted by this request.\n\n Setting the `{ layer }` property will automatically derive `{ context }` and `{ mode }` properties.\n\n When this request will [open a new overlay](/learn/opening-overlays), the string `\"new\"` is returned.\n\n To prevent memory leaks, this property is removed shortly after the response is received.\n\n @property up.Request#layer\n @param {up.Layer|string} layer\n @stable\n */\n\n /*-\n The [layer](/api/up.layer) targeted by this request in case the server responds with an [error code](/learn/error-responses).\n\n Setting the `{ failLayer }` property will automatically derive `{ failContext }` and `{ failMode }` properties.\n\n To prevent memory leaks, this property is removed shortly after the response is received.\n\n @property up.Request#failLayer\n @param {up.Layer} layer\n @stable\n */\n\n /*-\n The element that triggered the request.\n\n For example, when this request was triggered by a click on a link, the link\n element is set as the `{ origin }`.\n\n To prevent memory leaks, this property is removed shortly after the response is received.\n\n @property up.Request#origin\n @param {Element} origin\n @stable\n */\n\n /*-\n The [mode](/api/up.Layer.prototype.mode) of the layer targeted by this request.\n\n The value will be sent as an `X-Up-Mode` header.\n\n @learn-ref customizing-overlays\n\n @property up.Request#mode\n @param {string} mode\n @stable\n */\n\n /*-\n The [mode](/api/up.Layer.prototype.mode) of the layer targeted by this request in case the server responds with an [error code](/learn/error-responses).\n\n The value will be sent as an `X-Up-Fail-Mode` header.\n\n @property up.Request#failMode\n @param {string} failMode\n @stable\n */\n\n /*-\n The [mode](/api/up.Layer.prototype.mode) of the layer from which the interaction [originated](/api/origin).\n\n The value will be sent as an `X-Up-Origin-Mode` header.\n\n @property up.Request#originMode\n @param {string} originMode\n @experimental\n */\n\n /*-\n The format in which the [request params](/api/up.Request.prototype.params) will be encoded.\n\n @property up.Request#contentType\n @param {string} contentType\n @stable\n */\n\n /*-\n The payload that the request will encode into its body.\n\n By default Unpoly will build a payload from the given `{ params }` option.\n\n @property up.Request#payload\n @param {string} payload\n @stable\n */\n\n /*-\n Whether the request is abortable through `up.fragment.abort()`.\n\n This belongs to the `up.fragment` API, not `up.request`.\n A request with `{ abortable: false }` can still be aborted through `up.network.abort()`.\n\n @property up.Request#abortable\n @param {boolean} [abortable=true]\n @internal\n */\n\n /*-\n Whether this request is loading in the background.\n\n Background requests are deprioritized over foreground requests.\n Background requests also won't emit `up:network:late` events and won't trigger\n the [progress bar](/learn/progress-bar).\n\n @learn-ref background-requests\n\n @property up.Request#background\n @param {boolean} [background=false]\n @stable\n */\n\n /*-\n The number of milliseconds after which this request can cause\n an `up:network:late` event and show the [progress bar](/learn/progress-bar).\n\n Defaults to `up.network.config.lateDelay`.\n\n @property up.Request#lateDelay\n @param {number|boolean} [lateDelay]\n @stable\n */\n\n keys() {\n return [\n // 'signal',\n 'method',\n 'url',\n 'hash',\n 'params',\n 'target',\n 'failTarget',\n 'headers',\n 'timeout',\n 'background',\n 'cache', // since up.network.request() options are sometimes wrapped in this class\n 'expireCache', // since up.network.request() options are sometimes wrapped in this class\n 'evictCache', // since up.network.request() options are sometimes wrapped in this class\n\n // While requests are queued or in flight we keep the layer they're targeting.\n // If that layer is closed we will cancel all pending requests targeting that layer.\n // Note that when opening a new layer, this { layer } attribute will be the set to\n // the current layer. The { mode } and { failMode } attributes will belong to the\n // new layer being opened.\n 'layer',\n 'mode', // we would love to delegate @mode to @layer.mode, but @layer might be the string \"new\"\n 'context', // we would love to delegate @context to @layer.context, but @layer might be string \"new\"\n 'failLayer',\n 'failMode', // we would love to delegate @failMode to @failLayer.mode, but @failLayer might be the string \"new\"\n 'failContext', // we would love to delegate @failContext to @failLayer.mode, but @failLayer might be the string \"new\"\n 'origin',\n 'originLayer',\n 'originMode',\n 'builtAt',\n 'wrapMethod',\n 'contentType',\n 'payload',\n 'onLoading',\n 'onSettle',\n 'fail',\n 'abortable',\n 'lateDelay',\n 'previews',\n ]\n }\n\n defaults() {\n let config = up.network.config\n return {\n state: 'new',\n abortable: true,\n expired: false,\n headers: {},\n timeout: config.timeout,\n builtAt: new Date(),\n previews: [],\n wrapMethod: config.wrapMethod,\n }\n }\n\n /*-\n Creates a new `up.Request` object.\n\n This will not actually send the request over the network. For that use `up.request()`.\n\n @constructor up.Request\n @param {string} attrs.url\n @param {string} [attrs.method='get']\n @param {up.Params|string|Object|Array|FormData} [attrs.params]\n @param {string} [attrs.target]\n @param {string} [attrs.failTarget]\n @param {Object<string, string>} [attrs.headers]\n @param {number} [attrs.timeout]\n @internal\n */\n constructor(options) {\n super(options)\n\n this.params = new up.Params(this.params) // copies, which we want\n\n // Normalize a first time to get a normalized cache key.\n this._normalize()\n\n if ((this.target || this.layer || this.origin) && !options.basic) {\n const layerLookupOptions = { origin: this.origin }\n // Calling up.layer.get() will give us:\n //\n // (1) Resolution of strings like 'current' to an up.Layer instance\n // (2) Default of origin's layer\n // (3) Default of up.layer.current\n //\n // up.layer.get('new') will return 'new' unchanged, but I'm not sure\n // if any code actually calls up.request({ ..., layer: 'new' }).\n // In up.Change.OpenLayer we connect requests to the base layer we're stacking upon.\n this.layer = up.layer.get(this.layer, layerLookupOptions)\n this.context ||= this.layer.context || {} // @layer might be \"new\", so we default to {}\n this.mode ||= this.layer.mode\n\n this.failLayer = up.layer.get(this.failLayer, layerLookupOptions)\n this.failContext ||= this.failLayer?.context || {} // @failLayer might be \"new\", so we default to {}\n this.failMode ||= this.failLayer?.mode\n\n this.originLayer ||= up.layer.get(this.origin) || up.layer.current\n this.originMode ||= this.originLayer?.mode\n }\n\n this.bindLayer = options.bindLayer || this.layer\n\n this._fragments = options.fragments\n\n // We don't want to default this to this.fragments here, because\n // that may be an expensive getter, so we do it lazily.\n this._bindFragments = options.bindFragments\n\n // This up.Request object is also promise for its up.Response.\n // We delegate all promise-related methods (then, catch, finally) to an internal\n // _deferred object.\n this._deferred = u.newDeferred()\n\n this._setAutoHeaders()\n }\n\n get effectiveLateTime() {\n if (this.background) {\n return false\n } else {\n return this.lateDelay ?? u.evalOption(up.network.config.lateDelay, this)\n }\n }\n\n isTimed() {\n return u.isNumber(this.effectiveLateTime)\n }\n\n /*-\n Returns the underlying `XMLHttpRequest` instance.\n\n @property up.Request#xhr\n @param {XMLHttpRequest} xhr\n @stable\n */\n get xhr() {\n // Initialize the xhr request on first access,\n // so listeners on up:request:send events have a chance to access the xhr.\n return this._xhr ??= new XMLHttpRequest()\n }\n\n /*-\n Returns the fragments matched by this request's [target selector](/api/up.Request.prototype.target).\n\n When this request will [open a new overlay](/learn/opening-overlays), an empty array is returned.\n\n See also `up.RenderResult#fragments`.\n\n @property up.Request#fragments\n @param {List<Element>} fragments\n A list of targeted fragments.\n @stable\n */\n get fragments() {\n // This property is required for `up.fragment.abort()` to select requests within\n // the subtree that we're canceling.\n //\n // We allow users to pass in pre-matched `{ fragments }` in the constructor.\n // We use this in `up.Change.FromURL` since we already know the element's we're trying\n // to replace.\n //\n // If we haven't received a `{ fragments }` property (or if it has been deleted by\n // evictExpensitveAttrs()) but did we receive a `{ target }`, we find matching elements here.\n return (this._fragments ||= this._findFragments())\n }\n\n _findFragments() {\n let steps = up.fragment.parseTargetSteps(this.target)\n let lookupOpts = { origin: this.origin, layer: this.layer }\n // Look for one match per step.\n let matches = u.map(steps, (step) => up.fragment.get(step.selector, lookupOpts))\n return u.compact(matches)\n }\n\n get bindFragments() {\n return this._bindFragments || this.fragments\n }\n\n /*-\n Returns the fragment matched by this request's [target selector](/api/up.Request.prototype.target).\n\n When [multiple fragments](/learn/targeting-fragments#multiple) are targeted, the first fragment is returned.\n To get a list of all targeted fragments, use the [`{ fragments }`](/api/up.Request.prototype.fragments) property.\n\n When this request will [open a new overlay](/learn/opening-overlays), `undefined` is returned.\n\n See also `up.RenderResult#fragment`.\n\n @property up.Request#fragment\n @param {Element} fragment\n The first targeted fragment.\n @stable\n */\n get fragment() {\n return this.fragments?.[0]\n }\n\n _normalize() {\n this.method = u.normalizeMethod(this.method)\n this._extractHashFromURL()\n this._transferParamsToURL()\n\n // This consistently strips the hostname from same-origin requests.\n this.url = u.normalizeURL(this.url)\n }\n\n _evictExpensiveAttrs() {\n // We want to allow up:request:loaded events etc. to still access the properties that\n // we are about to evict, so we wait for one more frame. It shouldn't matter for GC.\n u.task(() => {\n // (1) While the request is still in flight, we require the target layer\n // to be able to cancel it when the layers gets closed. We now\n // evict this property, since response.request.layer.element will\n // prevent the layer DOM tree from garbage collection while the response\n // is cached by up.network.\n //\n // (2) Although we must take care to not evict attributes that are part of our #cacheKey(),\n // we have already copied all layer-relevant properties, e.g. this.mode, this.context.\n this.layer = undefined\n this.failLayer = undefined\n this.bindLayer = undefined\n\n // We want to provide the triggering element as { origin } to the function\n // providing the CSRF function. We now evict this property, since\n // response.request.origin will prevent its (now maybe detached) DOM tree\n // from garbage collection while the response is cached by up.network.\n this.origin = undefined\n this.originLayer = undefined\n\n this._fragments = undefined\n this._bindFragments = undefined // there is also a bindLayer() getter\n })\n }\n\n _extractHashFromURL() {\n let match = this.url?.match(/^([^#]*)(#.+)$/)\n if (match) {\n this.url = match[1]\n // Remember the #hash for later revealing.\n return this.hash = match[2]\n }\n }\n\n _transferParamsToURL() {\n if (!this.url || this.allowsPayload() || u.isBlank(this.params)) {\n return\n }\n\n // GET methods are not allowed to have a payload, so we transfer { params } params to the URL.\n this.url = this.params.toURL(this.url)\n // Now that we have transfered the params into the URL, we delete them from the { params } option.\n this.params.clear()\n }\n\n /*-\n Returns whether this request uses a [safe](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.1.1)\n HTTP method like `GET`.\n\n @function up.Request#isSafe\n @return {boolean}\n Whether the request uses a safe HTTP method.\n @experimental\n */\n isSafe() {\n return up.network.isSafeMethod(this.method)\n }\n\n allowsPayload() {\n return u.methodAllowsPayload(this.method)\n }\n\n will302RedirectWithGET() {\n return this.isSafe() || (this.method === 'POST')\n }\n\n willCache() {\n return up.network.config.cacheEnabled && u.evalAutoOption(this.cache, up.network.config.autoCache, this)\n }\n\n runQueuedCallbacks() {\n u.always(this, () => this._evictExpensiveAttrs())\n }\n\n load() {\n // If the request was aborted before it was sent (e.g. because it was queued)\n // we don't send it.\n if (this.state !== 'new') return\n\n if (this._emitLoad()) {\n this.state = 'loading'\n\n // Listeners to up:request:load may have mutated properties that need to be\n // re-normalized and/or are part of a cache key.\n //\n // To be correct we would also need to re-run _setAutoHeaders() here. However since\n // this is costly and also rare that listeners mutate properties like #target or #layer,\n // we leave it to the listener to update headers.\n this._normalize()\n\n // This callback is used by up.network to re-cache the request after its cache key\n // may have changed by mutation from a up:request:load listener.\n this.onLoading?.()\n\n // If someone expired this link while it was waiting in the queue (e.g. through\n // expiring everyhing with up.cache.expire(), it now becomes fresh through the\n // act of loading.\n this.expired = false\n\n // Convert from XHR's callback-based API to up.Request's promise-based API\n new up.Request.XHRRenderer(this).buildAndSend({\n onload: () => this._onXHRLoad(),\n onerror: () => this._onXHRError(),\n ontimeout: () => this._onXHRTimeout(),\n onabort: () => this._onXHRAbort()\n })\n\n // Signal to callers (in particular to up.Queue) that load() was not aborted.\n return true\n } else {\n this.abort({ reason: 'Prevented by event listener' })\n }\n }\n\n runPreviews(renderOptions) {\n if (!this.ended && !this.fromCache) {\n this._revertPreviews = up.status.runPreviews(this, renderOptions)\n }\n }\n\n _emitLoad() {\n let event = this.emit('up:request:load', { log: ['Loading %s', this] })\n return !event.defaultPrevented\n }\n\n /*-\n Loads this request object as a full-page request, replacing the entire browser environment\n with a new page from the server response.\n\n The full-page request will be loaded with the [URL](/api/up.Request.prototype.url),\n [method](/api/up.Request.prototype.method) and [params](/api/up.Request.prototype.params)\n from this request object.\n\n Aborts all pending requests.\n\n ## Limitations\n\n Some request properties cannot be transported with a full-page request and will be ignored.\n Such properties include:\n\n - Custom HTTP headers\n - Binary param values (from file inputs)\n\n @function up.Request#loadPage\n @stable\n */\n loadPage() {\n // This method works independently of @state, since it is often\n // a fallback for a request that cannot be processed as a fragment update\n // (see up:fragment:loaded event).\n\n // Abort all pending requests so their callbacks won't run\n // while we're already navigating away.\n up.network.abort()\n new up.Request.FormRenderer(this).buildAndSubmit()\n }\n\n _onXHRLoad() {\n const response = this._extractResponseFromXHR()\n\n const log = ['Loaded %s', response]\n this.emit('up:request:loaded', { request: response.request, response, log })\n\n this.respondWith(response)\n }\n\n _onXHRError() {\n // Neither XHR nor fetch() provide any meaningful error message.\n // Hence we ignore the passed ProgressEvent and use our own error message.\n this._setOfflineState('Network error')\n }\n\n _onXHRTimeout() {\n // We used to treat timeouts like a client-side abort. While this is technically\n // what happens, it is more practical for users to consider a timeout like a failed\n // connection that we can retry with up.render({ onOffline }) etc.\n this._setOfflineState('Timeout')\n }\n\n _onXHRAbort() {\n // Use the default message that callers of request.abort() would also get.\n this._setAbortedState()\n }\n\n /*-\n Aborts this request.\n\n The request's promise will reject with an `up.Aborted` error.\n\n ### Example\n\n ```javascript\n let request = up.request('/path')\n\n request.abort()\n\n try {\n let response = await request\n } catch (result) {\n if (result.name === 'AbortError') {\n console.log('Request was aborted.')\n }\n }\n ```\n\n @function up.Request#abort\n @param {string} [options.reason]\n A message describing the reason for aborting this request.\n\n If omitted, a generic reason like `\"Aborted request to GET /path\"` will be used.\n\n The reason will be set as the error's message.\n @stable\n */\n abort({ reason } = {}) {\n // _setAbortedState() must be called before xhr.abort(), since xhr's event handlers\n // will call _setAbortedState() a second time, without a message.\n if (this._setAbortedState(reason) && this._xhr) {\n this._xhr.abort()\n }\n }\n\n _setAbortedState(reason = 'Unknown reason') {\n if (this.ended) return\n\n let log = [\"Aborted request to %s: %s\", this, reason]\n this.state = 'aborted'\n this._reject(new up.Aborted(log))\n this.emit('up:request:aborted', { log })\n\n // Return true so callers know we didn't return early without actually aborting anything.\n return true\n }\n\n _setOfflineState(reason = 'Unknown reason') {\n if (this.ended) return\n\n let log = ['Cannot load request from %s: %s', this, reason]\n this.state = 'offline'\n this.emit('up:request:offline', { log })\n this._reject(new up.Offline(log, { reason, request: this }))\n }\n\n respondWith(response) {\n this.response = response\n\n if (this.ended) return\n this.state = 'loaded'\n\n if (response.ok) {\n this._resolve(response)\n } else {\n this._reject(response)\n }\n }\n\n // Settle our promise before running settle callbacks. A callback may settle a u.variant() of this\n // request (like up.Response#redirectRequest), which shares our deferred and would settle it first.\n _resolve(response) {\n this._deferred.resolve(response)\n this._runSettleCallbacks(response)\n }\n\n _reject(responseOrError) {\n this._deferred.reject(responseOrError)\n this._runSettleCallbacks(responseOrError)\n }\n\n _runSettleCallbacks(responseOrError) {\n // Do this sync so previews are reverted before another DOM mutation.\n // awaiting the response would delay this for too long.\n this._revertPreviews?.()\n\n // This callback is used by up.network to update the cache before a new request\n // (made synchronously after this request settles) can hit a stale cache entry.\n this.onSettle?.(responseOrError)\n }\n\n /*-\n Returns whether this request is no longer waiting for the network.\n\n A request is considered to have ended in one of the following states:\n\n - A response has been loaded, with any [status code](/api/up.Response.prototype.status).\n - It has been [aborted](/learn/aborting-requests).\n - It failed due to a [network issue](/learn/network-issues).\n - It failed due to a timeout.\n\n @property up.Request#ended\n @param {boolean} ended\n Whether this request has ended.\n @stable\n */\n get ended() {\n return (this.state !== 'new') && (this.state !== 'loading') && (this.state !== 'tracking')\n }\n\n csrfHeader() {\n return up.protocol.csrfHeader()\n }\n\n csrfParam() {\n return up.protocol.csrfParam()\n }\n\n // Returns a CSRF token if this request requires it\n csrfToken() {\n if (!this.isSafe() && !this.isCrossOrigin()) {\n return up.protocol.csrfToken()\n }\n }\n\n isCrossOrigin() {\n return u.isCrossOrigin(this.url)\n }\n\n _extractResponseFromXHR() {\n const responseAttrs = {\n method: this.method,\n url: this.url,\n request: this,\n xhr: this.xhr,\n text: this.xhr.responseText,\n status: this.xhr.status,\n title: up.protocol.titleFromXHR(this.xhr),\n target: up.protocol.targetFromXHR(this.xhr),\n openLayer: up.protocol.openLayerFromXHR(this.xhr),\n acceptLayer: up.protocol.acceptLayerFromXHR(this.xhr),\n dismissLayer: up.protocol.dismissLayerFromXHR(this.xhr),\n eventPlans: up.protocol.eventPlansFromXHR(this.xhr),\n context: up.protocol.contextFromXHR(this.xhr),\n expireCache: up.protocol.expireCacheFromXHR(this.xhr),\n evictCache: up.protocol.evictCacheFromXHR(this.xhr),\n fail: this.fail,\n }\n\n let methodFromResponse = up.protocol.methodFromXHR(this.xhr)\n\n let urlFromResponse = up.protocol.locationFromXHR(this.xhr)\n if (urlFromResponse) {\n // On browsers other than IE11 we can ask the XHR object for its { responseURL },\n // which contains the final URL after redirects. The server may also use the\n // custom X-Up-Location header to signal the final URL for all browsers.\n //\n // Unfortunately we cannot ask the XHR object for its response method.\n // The server may use the custom X-Up-Method for that. If that header is missing\n // AND the URLs changed between request and response, we assume GET.\n if (!u.matchURLs(this.url, urlFromResponse)) {\n methodFromResponse ||= 'GET'\n }\n\n responseAttrs.url = urlFromResponse\n }\n\n if (methodFromResponse) {\n responseAttrs.method = methodFromResponse\n }\n\n return new up.Response(responseAttrs)\n }\n\n _buildEventEmitter(args) {\n // We prefer emitting request-related events on the targeted layer.\n // This way listeners can observe event-related events on a given layer.\n // This request has an optional { layer } attribute, which is used by\n // EventEmitter.\n return up.EventEmitter.fromEmitArgs(args, {\n layer: this.bindLayer,\n request: this,\n origin: this.origin\n })\n }\n\n emit(...args) {\n return this._buildEventEmitter(args).emit()\n }\n\n assertEmitted(...args) {\n this._buildEventEmitter(args).assertEmitted()\n }\n\n get [Symbol.toStringTag]() { return 'up.Request' }\n\n toString() {\n return this.method + ' ' + this.url\n }\n\n isBoundToSubtrees(subtreeRoots) {\n subtreeRoots = u.wrapList(subtreeRoots)\n\n return u.some(this.bindFragments, function(fragment) {\n return u.some(subtreeRoots, (subtreeElement) => subtreeElement.contains(fragment))\n })\n }\n\n isBoundToLayers(layers) {\n return u.contains(layers, this.bindLayer)\n }\n\n get age() {\n return new Date() - this.builtAt\n }\n\n header(name) {\n return this.headers[name]\n }\n\n _setAutoHeaders() {\n // Add information about the response's intended use, so the server may\n // customize or shorten its response.\n for (let key of ['target', 'failTarget', 'mode', 'failMode', 'context', 'failContext', 'originMode']) {\n this._setPropertyHeader(key)\n }\n\n let csrfHeader, csrfToken\n if ((csrfHeader = this.csrfHeader()) && (csrfToken = this.csrfToken())) {\n this._setAutoHeader(csrfHeader, csrfToken)\n }\n\n this._setAutoHeader(up.protocol.headerize('version'), up.version)\n }\n\n _setPropertyHeader(key) {\n this._setAutoHeader(\n up.protocol.headerize(key),\n this[key]\n )\n }\n\n _setAutoHeader(name, value) {\n if (u.isMissing(value)) {\n return\n }\n\n if (u.isOptions(value) || u.isArray(value)) {\n value = u.safeStringifyJSON(value)\n }\n this.headers[name] = value\n }\n\n mergeIfUnsent(trackingRequest) {\n // We can only merge a tracking request if the original request has not been sent to the network.\n // This can happen if multiple [up-defer] requests are sent during the same render pass.\n if (this.state !== 'new') return\n\n // Only merge requests with a target. Otherwise we could inadvertently change a request\n // without target (expecting a full page response) to a request with a target (allowing\n // a fragment response).\n if (!this.target || !trackingRequest.target) return\n\n let targetAtoms = up.fragment.splitTarget(this.target + ',' + trackingRequest.target)\n this.target = u.uniq(targetAtoms).join(', ')\n this._setPropertyHeader('target') // X-Up-Target header was set in the response\n\n this._fragments = u.uniq([...this.fragments, ...trackingRequest.fragments])\n }\n\n static tester(condition, { except } = {}) {\n let testFn\n if (u.isFunction(condition)) {\n testFn = condition\n } else if (condition instanceof this) {\n testFn = (request) => condition === request\n } else if (u.isString(condition)) {\n let pattern = new up.URLPattern(condition)\n testFn = (request) => pattern.test(request.url)\n } else { // boolean, truthy/falsy values\n testFn = (_request) => condition\n }\n\n if (except) {\n return (request) => !up.cache.willHaveSameResponse(request, except) && testFn(request)\n } else {\n return testFn\n }\n }\n\n /*-\n An `up.Request` is also a promise for the server response.\n\n A request is *fulfilled* with an `up.Response` when the server sends a response\n with a status code of 2xx or [304](/learn/conditional-requests#rendering-nothing).\n\n The promise will reject for responses with an [HTTP error status](/learn/error-responses),\n when the request is [aborted](/learn/aborting-requests) or when there is a\n [network issue](/learn/network-issues).\n\n ### Example\n\n ```js\n try {\n let response = await up.request('foo')\n console.log('Successful response:', response.text)\n } catch (error) {\n if (error instanceof up.Response) {\n console.log('Response with error code:', error.text)\n } else {\n console.log(\"Other error during request:\", error)\n }\n }\n ```\n\n @function up.Request#then\n @param {Function(up.Response)} onFulfilled\n @param {Function(up.Response|Error)} onRejected\n @return {Promise<up.Response>}\n A promise that fulfills when the server response was fully loaded.\n @stable\n */\n static {\n // A request is also a promise (\"thenable\") for its response.\n u.delegatePromise(this.prototype, function() { return this._deferred })\n }\n}\n","const u = up.util\n\n// One route per method and URL.\nclass Route {\n\n // A list of `Vary` header names that we have seen in responses\n // to earlier requests with this route's method and URL.\n varyHeaders = new Set()\n\n // Cached requests for this route's method and URL.\n requests = []\n\n matchBest(newRequest) {\n let matches = this.requests.filter((cachedRequest) => this.satisfies(cachedRequest, newRequest))\n // Newer requests are always appended\n return u.last(matches)\n }\n\n delete(request) {\n u.remove(this.requests, request)\n }\n\n put(request) {\n this.requests.push(request)\n }\n\n updateVary(response) {\n for (let headerName of response.varyHeaderNames) {\n this.varyHeaders.add(headerName)\n }\n }\n\n satisfies(cachedRequest, newRequest) {\n if (cachedRequest === newRequest) return true\n\n return u.every(this.varyHeaders, (varyHeader) => {\n let cachedValue = cachedRequest.header(varyHeader)\n let newValue = newRequest.header(varyHeader)\n\n if (varyHeader === 'X-Up-Target' || varyHeader === 'X-Up-Fail-Target') {\n // A response that was not tailored to a target is a match for all targets\n if (!cachedValue) return true\n\n // A response tailored to a target is never a match for a response without a target\n if (!newValue) return false\n\n let cachedTokens = up.fragment.splitTarget(cachedValue)\n let newTokens = up.fragment.splitTarget(newValue)\n\n return u.containsAll(cachedTokens, newTokens)\n } else {\n return cachedValue === newValue\n }\n })\n }\n}\n\nup.Request.Cache = class Cache {\n\n constructor() {\n this.reset()\n }\n\n reset() {\n this._routes = {}\n this._requests = []\n }\n\n get(request) {\n request = this._wrap(request)\n let route = this._getRoute(request)\n\n let cachedRequest = route.matchBest(request)\n if (cachedRequest) {\n if (this._isUsable(cachedRequest)) {\n return cachedRequest\n } else {\n // Cache hit, but too old\n this._delete(request, route)\n }\n }\n }\n\n async put(request) {\n request = this._wrap(request)\n let route = this._getRoute(request)\n\n // put() is called both (1) before the request was made and (2) when the response was received.\n // A response may carry new Vary headers that we need to respect for future cache lookups.\n let { response } = request\n if (response) route.updateVary(response)\n\n // Delete all cached requests for which this newer request is also a match.\n // This could also match an earlier entry for the same request.\n let superseded = route.requests.filter((oldRequest) => route.satisfies(request, oldRequest))\n // Delete in two steps so we (1) don't change the list we're iterating over and\n // (2) only rewrite the requests array if necessary.\n for (let r of superseded) { this._delete(r) }\n\n // Wait for deletion above before we set request.cacheRoute.\n // We are often going to match and delete our own request, and this clears request.cacheRoute.\n request.cacheRoute = route\n\n // Store the request with the route for fast lookup.\n route.put(request)\n\n // Store the request in a global list for quick iteration over all cache entries.\n this._requests.push(request)\n\n // Make sure that our size doesn't exceed our capacity.\n this._limitSize()\n }\n\n // TODO: Move this to up.Request\n async track(existingRequest, newRequest, options = {}) {\n newRequest.trackedRequest = existingRequest\n newRequest.state = 'tracking'\n\n let value\n\n // In case existingRequest is already settled, we need to settle newRequest sync, not one microtask later.\n // This is required to reliably revert active previews before making a new request.\n if (existingRequest.ended && existingRequest.response) {\n value = existingRequest.response\n } else {\n // Wait until existingRequest responds or errors.\n // Note that while we're waiting, existingRequest could be evicted, e.g. after a failed response.\n value = await u.always(existingRequest)\n\n // If newRequest was aborted while waiting, it must stay aborted.\n // In particular we must not re-send it on a Vary mismatch, or delegate its state to existingRequest.\n if (newRequest.ended) return\n }\n\n if (value instanceof up.Response) {\n if (options.force || existingRequest.cacheRoute.satisfies(existingRequest, newRequest)) {\n // Remember that newRequest was settled from cache.\n // This makes it a candidate for cache revalidation.\n newRequest.fromCache = true\n\n // Create a variant where response.request === newRequest.\n // This is needed so up.render({ response }) can see the correct value for response.request.fromCache,\n // which is true for the cache-missing request but false for the cache-hitting request.\n value = u.variant(value, { request: newRequest })\n\n // respondWith() will check response.ok and either fulfill or reject newRequest's promise.\n newRequest.respondWith(value)\n\n // Since this request object is never in the cache, we need\n // to expire ourselves when otherRequest is expired.\n u.delegate(newRequest, ['expired', 'state'], () => existingRequest)\n } else {\n // A supposed cache hit turns out to be a cache *miss* due to the response carrying\n // an incompatible Vary header.\n delete newRequest.trackedRequest\n newRequest.state = 'new'\n\n // The two requests turned out to not be cache hits for each other, as\n // the response carried a Vary header. We will re-process newRequest as if it\n // was just queued.\n options.onIncompatible?.(newRequest)\n }\n } else {\n // Copy terminal state like 'offline' or 'aborted'\n newRequest.state = existingRequest.state\n // If we did not get an up.Response, it must be an error\n newRequest._reject(value)\n }\n }\n\n // Used by up.Request.Tester\n willHaveSameResponse(existingRequest, newRequest) {\n return existingRequest === newRequest || existingRequest === newRequest.trackedRequest\n }\n\n evict(condition = true, testerOptions) {\n this._eachMatch(condition, testerOptions,\n // It is generally not a great idea to manipulate the list we're iterating over,\n // but this._eachMatch() copies results before iterating.\n (request) => this._delete(request)\n )\n }\n\n expire(condition = true, testerOptions) {\n this._eachMatch(condition, testerOptions,\n // We need to force cached responses to be expired, regardless of their age.\n // It may seem strange that we're setting an { expired } property on the *request*\n // instead, but there are two good reasons:\n //\n // (1) The cache only holds request references. These are also promises for their\n // responses, but we only have sync access to the requests.\n // (2) By marking in-flight requests as stale, this will also expire their responses\n // when they are eventually received.\n (request) => request.expired = true\n )\n }\n\n reindex(request) {\n this._delete(request)\n\n // The cacheRoute is about to change because the request\n // changed URL or params in up:request:load.\n delete request.cacheRoute\n\n this.put(request)\n }\n\n _delete(request) {\n u.remove(this._requests, request)\n request.cacheRoute?.delete(request)\n }\n\n _getRoute(request) {\n return request.cacheRoute || (this._routes[request.method + ' ' + request.url] ||= new Route())\n }\n\n _isUsable(request) {\n return request.age < up.network.config.cacheEvictAge\n }\n\n // Read by specs\n get currentSize() {\n return this._requests.length\n }\n\n get _capacity() {\n return up.network.config.cacheSize\n\n }\n\n _limitSize() {\n for (let i = 0; i < (this.currentSize - this._capacity); i++) {\n // The _requests array is in insertion order, so the oldest entry will be first\n this._delete(this._requests[0])\n }\n }\n\n _eachMatch(condition = true, testerOptions, fn) {\n let tester = up.Request.tester(condition, testerOptions)\n\n // Copy results so evict() can delete from the list we're iterating over\n let results = u.filter(this._requests, tester)\n\n u.each(results, fn)\n }\n\n _wrap(requestOrOptions) {\n return u.wrapValue(up.Request, requestOrOptions)\n }\n\n}\n","const u = up.util\n\nup.Request.Queue = class Queue {\n\n constructor() {\n this.reset()\n }\n\n reset() {\n this._queuedRequests = []\n this._currentRequests = []\n // Requests that reuse a cached request in flight (see up.Request.Cache#track()).\n // They never load, so they don't count for concurrency or late/recover, but they can be aborted.\n this._trackingRequests = []\n this._emittedLate = false\n }\n\n track(request) {\n this._trackingRequests.push(request)\n // The braces matter: u.remove() returns the removed request, a thenable that would make\n // the derived promise adopt the request's rejection.\n u.always(request, () => { u.remove(this._trackingRequests, request) })\n }\n\n get allRequests() {\n return this._currentRequests.concat(this._queuedRequests)\n }\n\n asap(request) {\n request.runQueuedCallbacks()\n u.always(request, () => this._onRequestSettled(request))\n\n // When considering whether a request is \"slow\", we're measuring the duration between request.queuedAt\n // and the moment when the request gets settled. Note that when setSlowTimer() occurs, it will\n // make its own check whether a request in the queue is considered slow.\n this._scheduleSlowTimer(request)\n this._queueRequest(request)\n queueMicrotask(() => this._poke())\n }\n\n // Promotes a background request to a non-background request.\n //\n // Does not change the request's position in the queue, but foreground requests\n // are prioritized when picking the next request under concurrency constraints.\n //\n // Does nothing if the given request is not a background request.\n promoteToForeground(request) {\n if (request.background) {\n request.background = false\n\n // If the request has been loading longer than its lateDelay, we have\n // already ignored its up:network:late event. Hence we schedule another check.\n this._scheduleSlowTimer(request)\n }\n }\n\n _scheduleSlowTimer(request) {\n if (!request.isTimed()) return\n\n // In case the request was loading in the background before it was promoted to\n // the foreground, the request may have less time left than request.lateDelay.\n let timeUntilLate = Math.max(request.effectiveLateTime - request.age)\n\n // We may have multiple timers running concurrently.\n // Nonethess we don't emit duplicate events due to the check in @_checkLate().\n u.timer(timeUntilLate, () => this._checkForLate())\n }\n\n _getMaxConcurrency() {\n return u.evalOption(up.network.config.concurrency)\n }\n\n _hasConcurrencyLeft() {\n const maxConcurrency = this._getMaxConcurrency()\n return (maxConcurrency === -1) || (this._currentRequests.length < maxConcurrency)\n }\n\n get size() {\n return this.allRequests.length\n }\n\n isBusy() {\n return this.size > 0\n }\n\n _queueRequest(request) {\n // Queue the request at the end of our FIFO queue.\n this._queuedRequests.push(request)\n }\n\n _pluckNextRequest() {\n // We always prioritize foreground requests over background requests.\n // Only when there is no foreground request left in the queue we will send a background request.\n // Note that if a queued preload request is requested without { preload: true } we will\n // promote it to the foreground (see @promoteToForeground()).\n let request = u.find(this._queuedRequests, (request) => !request.background)\n request ||= this._queuedRequests[0]\n return u.remove(this._queuedRequests, request)\n }\n\n _sendRequestNow(request) {\n if (request.load()) {\n this._currentRequests.push(request)\n }\n }\n\n _onRequestSettled(request) {\n // If the request was aborted before it was sent, it still sits in @queuedRequests.\n u.remove(this._currentRequests, request) || u.remove(this._queuedRequests, request)\n\n queueMicrotask(() => this._poke())\n\n // Check if we can emit up:network:recover after a previous up:network:late event.\n // We do give other code one more task to queue another requests, e.g. a queued watcher diff.\n // This way a long-running chain of requests only shows a single, un-interrupted progress bar.\n u.task(() => this._checkForRecover())\n }\n\n _poke() {\n let request\n if (this._hasConcurrencyLeft() && (request = this._pluckNextRequest())) {\n return this._sendRequestNow(request)\n }\n }\n\n // Aborting a request will cause its promise to reject, which will also uncache it\n abort(...args) {\n let [conditions = true, { except, reason, logOnce }] = u.args(args, 'val', 'options')\n\n let tester = up.Request.tester(conditions, { except })\n\n for (let list of [this._currentRequests, this._queuedRequests, this._trackingRequests]) {\n const abortableRequests = u.filter(list, tester)\n for (let abortableRequest of abortableRequests) {\n if (logOnce) {\n up.puts(...logOnce)\n logOnce = null\n }\n abortableRequest.abort({ reason })\n // Avoid changing the list we're iterating over.\n u.remove(list, abortableRequest)\n }\n }\n }\n\n _checkForLate() {\n if (!this._emittedLate && this._hasLateTimedRequests()) {\n this._emittedLate = true\n up.emit('up:network:late', { log: 'Server is slow to respond' })\n }\n }\n\n _checkForRecover() {\n // We we ever emitted \"late\" (and probably are showing a progress bar), we wait for the\n // entire queue to clear before we emit \"recover\". This includes waiting for non-late requests.\n // This is to show a continuous progress bar for a chain of queued requests, e.g.\n // when a pending watch callback waits for a previous callback to finish.\n if (this._emittedLate && !this._timedRequests.length) {\n this._emittedLate = false\n up.emit('up:network:recover', { log: 'Slow requests were loaded' })\n }\n }\n\n get _timedRequests() {\n // Exclude requests that return false.\n // These are requests that were initialized with { lateDelay: false } or { background: true }.\n return this.allRequests.filter((request) => request.isTimed())\n }\n\n // Returns queued requests that are (1) timed (effectiveLateTime not false)\n // and (2) have been longer queued than their effectiveLateTime.\n _hasLateTimedRequests() {\n // If lateDelay is 200, we're scheduling the _checkLate() timer after 200 ms.\n // The request must be slow when _checkLate() is called, or we will never look\n // at it again. Since the JavaScript setTimeout() is inaccurate, we allow a request\n // to \"be slow\" a few ms earlier than actually configured.\n const timerTolerance = 1\n const isLate = (request) => request.age >= (request.effectiveLateTime - timerTolerance)\n return u.some(this._timedRequests, isLate)\n }\n\n}\n","const u = up.util\nconst e = up.element\n\n// In HTML5, forms may only have a GET or POST method.\n// There were several proposals to extend this to PUT, DELETE, etc.\n// but they have all been abandoned.\nconst HTML_FORM_METHODS = ['GET', 'POST']\n\nup.Request.FormRenderer = class FormRenderer {\n\n constructor(request) {\n this._request = request\n }\n\n buildAndSubmit() {\n // We cannot serialize binary entries as input fields\n this.params = this._request.params.withoutBinaryEntries()\n\n let action = this._request.url\n let { method } = this._request\n\n // GET forms cannot have an URL with a query section in their [action] attribute.\n // The query section would be overridden by the serialized input values on submission.\n const paramsFromQuery = up.Params.fromURL(action)\n this.params.addAll(paramsFromQuery)\n action = up.Params.stripURL(action)\n\n if (!u.contains(HTML_FORM_METHODS, method)) {\n // HTML forms can only have a GET or POST method. Other HTTP methods will be converted\n // to a `POST` request and carry their original method as a `_method` parameter.\n method = up.protocol.wrapMethod(method, this.params)\n }\n\n this._form = e.affix(document.body, 'form.up-request-loader', { method, action })\n\n // We only need an [enctype] attribute if the user has explicitly\n // requested one. If none is given, we can use the browser's default\n // [enctype]. Binary values cannot be sent by this renderer anyway, so\n // we don't need to default to multipart/form-data in this case.\n let contentType = this._request.contentType\n if (contentType) {\n this._form.setAttribute('enctype', contentType)\n }\n\n let csrfParam, csrfToken\n if ((csrfParam = this._request.csrfParam()) && (csrfToken = this._request.csrfToken())) {\n this.params.add(csrfParam, csrfToken)\n }\n\n // @params will be undefined for GET requests, since we have already\n // transfered all params to the URL during normalize().\n u.each(this.params.toArray(), this._addField.bind(this))\n\n up.browser.submitForm(this._form)\n }\n\n _addField(attrs) {\n e.affix(this._form, 'input[type=hidden]', attrs)\n }\n}\n","const CONTENT_TYPE_URL_ENCODED = 'application/x-www-form-urlencoded'\nconst CONTENT_TYPE_FORM_DATA = 'multipart/form-data'\n\nconst u = up.util\n\nup.Request.XHRRenderer = class XHRRenderer {\n\n constructor(request) {\n this._request = request\n }\n\n buildAndSend(handlers) {\n const xhr = this._request.xhr\n\n // We copy params since we will modify them below.\n // This would confuse API clients and cache key logic in up.network.\n this._params = u.copy(this._request.params)\n\n // IE11 explodes it we're setting an undefined timeout property\n if (this._request.timeout) {\n xhr.timeout = this._request.timeout\n }\n\n // The XMLHttpRequest method must be opened before we can add headers to it.\n xhr.open(this._getMethod(), this._request.url)\n\n // The { contentType } will be missing in case of a FormData payload.\n // In this case the browser will choose a content-type with MIME boundary,\n // like: multipart/form-data; boundary=----WebKitFormBoundaryHkiKAbOweEFUtny8\n let contentType = this._getContentType()\n if (contentType) {\n xhr.setRequestHeader('Content-Type', contentType)\n }\n\n for (let headerName in this._request.headers) {\n let headerValue = this._request.headers[headerName]\n xhr.setRequestHeader(headerName, headerValue)\n }\n\n Object.assign(xhr, handlers)\n\n xhr.send(this._getPayload())\n }\n\n _getMethod() {\n // By default HTTP methods other than `GET` or `POST` will be converted into a `POST`\n // request and carry their original method as a `_method` parameter. This is to\n // [prevent unexpected redirect behavior](https://makandracards.com/makandra/38347)\n // if the server redirects with 302 (Rails default) instead of 303.\n let method = this._request.method\n if (this._request.wrapMethod && !this._request.will302RedirectWithGET()) {\n method = up.protocol.wrapMethod(method, this._params)\n }\n return method\n }\n\n _getContentType() {\n this._finalizePayload()\n return this._contentType\n }\n\n _getPayload() {\n this._finalizePayload()\n return this._payload\n }\n\n _finalizePayload() {\n this._payload = this._request.payload\n this._contentType = this._request.contentType\n\n // (1) If a user sets { payload } we also expect them to set a { contentType }.\n // In that case we don't change anything.\n // (2) We don't send a { contentType } or { payload } for GET requests.\n if (!this._payload && this._request.allowsPayload()) {\n\n // Determine the effective Content-Type by looking at our params values.\n if (!this._contentType) {\n this._contentType = this._params.hasBinaryEntries() ? CONTENT_TYPE_FORM_DATA : CONTENT_TYPE_URL_ENCODED\n }\n\n // Serialize our payload\n if (this._contentType === CONTENT_TYPE_FORM_DATA) {\n // The effective Content-Type header will look like\n // multipart/form-data; boundary=----WebKitFormBoundaryHkiKAbOweEFUtny8\n // When we send a FormData payload the browser will automatically\n // chooose a boundary and set the payload.\n this._contentType = null\n this._payload = this._params.toFormData()\n } else {\n // Only in form submissions %-encoded spaces are sent as a plus characater (\"+\")\n this._payload = this._params.toQuery().replace(/%20/g, '+')\n }\n }\n }\n\n static {\n u.memoizeMethod(this.prototype, {\n _finalizePayload: true,\n _getMethod: true,\n })\n }\n}\n","const u = up.util\nconst HTML_CONTENT_TYPE = /^(text\\/html|application\\/xhtml\\+xml) *(;|$)/i\n\n/*-\nA response to an [HTTP request](/api/up.request).\n\n### Example\n\n```js\nlet response = await up.request('/foo')\nconsole.log(response.status) // 200\nconsole.log(response.text) // \"<html><body>...\"\n```\n\n@class up.Response\n@parent up.network\n*/\nup.Response = class Response extends up.Record {\n\n /*-\n The HTTP method used for the request that produced this response.\n\n This is usually the HTTP method used by the initial request, but if the server\n redirected, multiple requests may have been involved. In this case this property reflects\n the method used by the last request.\n\n If the response's URL changed from the request's URL,\n Unpoly will assume a redirect and set the method to `GET`.\n Also see the `X-Up-Method` header.\n\n @property up.Response#method\n @param {string} method\n @stable\n */\n\n /*-\n The URL from which the response was loaded.\n\n This is usually the [requested URL](/api/up.Request.prototype.url), or the final URL after the server redirected.\n\n @property up.Response#url\n @param {string} url\n @stable\n */\n\n /*-\n The response body as a `string`.\n\n @property up.Response#text\n @param {string} text\n @stable\n */\n\n /*-\n The response's\n [HTTP status code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)\n as a `number`.\n\n A successful response will usually have a `200` or `201` status code.\n\n @property up.Response#status\n @param {number} status\n @stable\n */\n\n /*-\n The original [request](/api/up.Request) that triggered this response.\n\n @property up.Response#request\n @param {up.Request} request\n @internal\n */\n\n /*-\n The [`XMLHttpRequest`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest)\n object that was used to create this response.\n\n @property up.Response#xhr\n @param {XMLHttpRequest} xhr\n @experimental\n */\n\n /*-\n A [document title pushed by the server](/api/X-Up-Title).\n\n If the server pushed no title via HTTP header, this will be `undefined`.\n\n @property up.Response#title\n @param {string|undefined} [title]\n The decoded title.\n @experimental\n */\n\n /*-\n A [render target pushed by the server](/api/X-Up-Target).\n\n If the server pushed no target via HTTP header, this will be `undefined`.\n\n @property up.Response#target\n @param {string|undefined} [target]\n The decoded target.\n @stable\n */\n\n /*-\n Changes to the current [context](/learn/layer-context) as [set by the server](/api/X-Up-Context).\n\n @learn-ref layer-context\n\n @property up.Response#context\n @experimental\n */\n\n keys() {\n return [\n 'method',\n 'url',\n 'text',\n 'status',\n 'request',\n 'xhr', // optional\n 'target',\n 'title',\n 'openLayer',\n 'acceptLayer',\n 'dismissLayer',\n 'eventPlans',\n 'context',\n 'expireCache',\n 'evictCache',\n 'headers', // custom headers to for synthetic reponses without { xhr } property\n 'loadedAt',\n 'fail',\n ]\n }\n\n defaults() {\n return {\n headers: {},\n loadedAt: new Date(),\n }\n }\n\n /*-\n Returns whether the server responded with a `2xx` HTTP status.\n\n @property up.Response#ok\n @param {boolean} ok\n @stable\n */\n get ok() {\n return !u.evalOption(this.fail ?? up.network.config.fail, this)\n }\n\n /*-\n Returns whether the response has an empty body text.\n\n There are some cases where the server might send us an empty body:\n\n - HTTP status `304 Not Modified` (especially when reloading)\n - HTTP status `204 No Content`\n - Header `X-Up-Target: :none`\n - Header `X-Up-Accept-Layer` or `X-Up-Dismiss-Layer`, although the server\n may send an optional body in case the response is used on the root layer.\n\n @property up.Response#none\n @param {boolean} none\n @internal\n */\n get none() {\n return !this.text\n }\n\n /*-\n Returns the HTTP header value with the given name.\n\n The search for the header is case-insensitive.\n\n Returns `null` or `undefined` if the given header name was not included in the response.\n\n @function up.Response#header\n @param {string} name\n @return {string|null|undefined}\n The value of the header.\n @stable\n */\n header(name) {\n return this.headers[name] || this.xhr?.getResponseHeader(name)\n }\n\n get varyHeaderNames() {\n let varyHeaderValue = this.header('Vary')\n return u.getSimpleTokens(varyHeaderValue, { separator: ',' })\n }\n\n /*-\n The response's [content-type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type).\n\n @property up.Response#contentType\n @param {string} contentType\n @stable\n */\n get contentType() {\n return this.header('Content-Type')\n }\n\n /*-\n Returns whether the response has a [content-type](/api/up.Response.prototype.contentType)\n for HTML or XHTML.\n\n This method tests if the `Content-Type` header is either `text/html` or `application/xhtml+xml`.\n It doesn't test if the response body actually contains a valid HTML\n document.\n\n @function up.Response#isHTML\n @return {boolean}\n Whether the response has an HTML mime type.\n @experimental\n */\n isHTML() {\n return HTML_CONTENT_TYPE.test(this.contentType)\n }\n\n /*-\n @property up.Response#cspInfo\n @param {Object} cspInfo\n @internal\n */\n get cspInfo() {\n let policy = this.header('Content-Security-Policy') || this.header('Content-Security-Policy-Report-Only')\n return up.CSPInfo.fromHeader(policy)\n }\n\n /*-\n The last modification time of the response's underlying content.\n\n This is extracted from the `Last-Modified` header sent by the server.\n\n @property up.Response#lastModified\n @param {Date|undefined} lastModified\n @stable\n */\n get lastModified() {\n let header = this.header('Last-Modified')\n if (header) {\n return new Date(header)\n }\n }\n\n /*-\n The response's [ETag](https://en.wikipedia.org/wiki/HTTP_ETag).\n\n This is extracted from the `ETag` header sent by the server.\n\n @property up.Response#etag\n @param {string|undefined} etag\n @stable\n */\n get etag() {\n return this.header('ETag')\n }\n\n /*-\n The response body parsed from JSON.\n\n The parsed JSON object is cached with the response object,\n so multiple accesses will call `JSON.parse()` only once.\n\n > [note]\n > This method can only parse regular JSON values. [Relaxed JSON](/api/relaxed-json) is not supported here.\n\n ### Example\n\n ```js\n let response = await up.request('/profile.json')\n console.log(\"User name is \" + response.json.name)\n ```\n\n @property up.Response#json\n @param {Object} json\n @stable\n */\n get json() {\n return this.parsedJSON ||= JSON.parse(this.text)\n }\n\n /*-\n The number of milliseconds since this response was received.\n\n @property up.Response#age\n @param {number} age\n @stable\n */\n get age() {\n let now = new Date()\n return now - this.loadedAt\n }\n\n /*-\n Returns whether this [cached](/learn/caching) response has expired.\n\n Content rendered from an expired response is [revalidated](/learn/caching#revalidation) with the server.\n\n @property up.Response#expired\n @param {boolean} expired\n @stable\n */\n get expired() {\n return this.age > up.network.config.cacheExpireAge ||\n // When the user calls up.cache.expire() it will expire requests, not responses.\n // Hence we need to delegate to our request.\n this.request.expired\n }\n\n get [Symbol.toStringTag]() { return 'up.Response' }\n\n toString() {\n return `HTTP ${this.status} response to ${this.request}`\n }\n\n get redirect() {\n return (this.url !== this.request.url) || (this.method !== this.request.method)\n }\n\n get redirectRequest() {\n if (!this.redirect) return\n\n let finalRequest = u.variant(this.request, {\n method: this.method,\n url: this.url,\n // The { cacheRoute } prop may no longer be correctly cached\n // TODO: Maybe we can find a way to get rid of this prop?\n cacheRoute: null,\n // Don't run up.network's cache handling a second time when this variant settles\n onSettle: null,\n })\n\n up.cache.track(this.request, finalRequest, { force: true })\n\n return finalRequest\n }\n\n}\n","const u = up.util\nconst e = up.element\n\nup.ResponseDoc = class ResponseDoc {\n\n constructor({ document, fragment, content, target, origin, data, cspInfo, match }) {\n if (document) {\n this._parseDocument(document, origin, data)\n } else if (fragment) {\n this._parseFragment(fragment, origin, data)\n } else {\n // Parsing { inner } is the last option we try. It should always succeed in case someone\n // tries `up.layer.open()` without any args. Hence we default the innerHTML to an empty string.\n this._parseContent(content || '', origin, target, data)\n }\n\n // This is the parsed script-src declaration from the response\n this._cspInfo = cspInfo\n up.script.warnOfUnsafeCSP(cspInfo)\n\n if (origin) {\n let originSelector = up.fragment.tryToTarget(origin)\n if (originSelector) {\n this._rediscoveredOrigin = this.select(originSelector)\n }\n }\n\n this._match = match\n }\n\n _parseDocument(value, origin, data) {\n if (value instanceof Document) { // Document\n this._document = value\n this._isFullDocument = true\n } else if (u.isString(value)) { // String of HTML or maybe a <template> selector\n // Remember whether the HTML originally contained a full document.\n // Asset comparison needs to know whether the document has a <head> because\n // e.createBrokenDocumentFromHTML() always creates an (empty) <head> if missing in the HTML.\n this._isFullDocument = e.isFullDocumentHTML(value)\n\n let htmlParser = (html) => [e.createBrokenDocumentFromHTML(html)]\n let nodes = up.fragment.provideNodes(value, { origin, data, htmlParser })\n\n // If value is HTML, e.createBrokenDocumentFromHTML() will parse it into a Document.\n // Even if value is only a fragment, or multiple sibling nodes, it will always be\n // wrapped into a Document.\n if (nodes[0] instanceof Document) {\n this._document = nodes[0]\n } else {\n // If value is a template reference, a custom up:template:clone handler\n // may have passed us a non-document.\n this._document = this._buildFauxDocument(nodes)\n }\n } else { // Element\n this._document = this._buildFauxDocument(value)\n }\n }\n\n _parseFragment(value, origin, data) {\n let element = e.extractSingular(up.fragment.provideNodes(value, { origin, data }))\n this._document = this._buildFauxDocument(element)\n }\n\n _parseContent(value, origin, target, data) {\n if (!target) up.fail(\"must pass a { target } when passing { content }\")\n\n // We are only provided with inner child content.\n // To simplify other code we wrap it in an element matching { target }.\n let simplifiedTarget = u.map(up.fragment.parseTargetSteps(target), 'selector').join()\n let nodes = up.fragment.provideNodes(value, { origin, data })\n let matchingElement = e.createFromSelector(simplifiedTarget, { content: nodes })\n\n this._document = this._buildFauxDocument(matchingElement)\n }\n\n _buildFauxDocument(nodes) {\n nodes = u.wrapList(nodes)\n\n // We're creating a faux document to wrap around a fragment root that is not already a `Document`.\n // This has two motivations:\n //\n // (1) When a step plucks the fragment root it will no longer be available for selection by a later step.\n // (2) We can select any element (including the fragment root) by fauxDocument.querySelector()\n // and do not use a more expensive subtree() operation.\n let fauxDocument = document.createElement('up-document')\n fauxDocument.append(...nodes)\n return fauxDocument\n }\n\n rootSelector() {\n // We want to say this._document.documentElement, but we sometimes have\n // a faux document with multiple children.\n return up.fragment.toTarget(this._document.children[0])\n }\n\n get title() {\n // We get it from the <head> instead of this._document.title.\n // We want to distinguish between a parsed document that does not have a <head> or <title>\n // and a given, but empty title.\n return this._fromHead(this._getTitleText)\n }\n\n /*\n Returns the root's `<head>`, if it has one.\n\n Returns `undefined` if the root has no contentful `<head>`, e.g. if the root was\n parsed from a fragment, or from a document without a `<head>` element.\n */\n // No _ prefix: specs call this directly, and _-prefixed members are mangled in the minified build.\n getHead() {\n // The root may be a `Document` (which always has a `#head`, even if it wasn't present in the HTML)\n // or an `Element` (which never has a `#head`).\n if (this._isFullDocument) {\n return this._document.head\n }\n }\n\n _fromHead(fn) {\n let head = this.getHead()\n return head && fn(head)\n }\n\n get metaTags() {\n return this._fromHead(up.history.findMetaTags)\n }\n\n get assets() {\n return this._fromHead((head) => {\n let assets = up.script.findAssets(head)\n\n // Need to use up.util.map() for a NodeList, which does not support #map()\n return u.map(assets, (asset) => {\n // (A) Assets might contain elements that need to be re-created in the current document context.\n // (B) Returns copies so multiple calls to #assets return the same array, even if some assets where inserted.\n asset = e.revivedClone(asset)\n\n // Rewrite [nonce] attributes so we don't see up:assets:changed with every request.\n up.script.adoptDetachedHeadAsset(asset, this._cspInfo)\n\n return asset\n })\n })\n }\n\n get lang() {\n // Although DOMParser always produces a document with <html> element, we must\n // only use the [lang] attribute if the initial document contained a <html> element.\n // Otherwise Unpoly would delete the attribute from the current page.\n if (this._isFullDocument) {\n return up.history.getLang(this._document)\n }\n }\n\n _getTitleText(head) {\n // We must find inside the head ('head title') instead of 'title'\n // so we won't match the <title> of an inline SVG image.\n return head.querySelector('title')?.textContent\n }\n\n // (1) Selects a single fragment with the given selector.\n // (2) Supports custom Unpoly selectors like :has() or :main.\n // (3) Supports origin-aware lookup priorities.\n // (4) Returns undefined if there is no match.\n select(selector) {\n let finder = new up.FragmentFinder({\n selector: selector,\n origin: this._rediscoveredOrigin,\n document: this._document,\n match: this._match,\n })\n return finder.find()\n }\n\n selectSteps(steps) {\n return steps.filter((step) => {\n return this._trySelectStep(step) || this._cannotMatchStep(step)\n })\n }\n\n commitSteps(steps) {\n // If multiple steps want to match the same new element, the first step will remain in the left.\n // This will happen when multiple layers have the same hungry element with [up-if-layer=any].\n return steps.filter((step) => this.commitElement(step.newElement))\n }\n\n _trySelectStep(step) {\n // TODO: Why do we need this check?\n if (step.newElement) {\n return true\n }\n\n // Look for a match in the new content.\n // The new content has no layers, so no { layer } option here.\n let newElement = this.select(step.selector)\n\n if (!newElement) {\n return\n }\n\n let { selectEvent } = step\n if (selectEvent) {\n selectEvent.newFragment = newElement\n selectEvent.renderOptions = step.originalRenderOptions\n up.emit(step.oldElement, selectEvent, { callback: step.selectCallback })\n if (selectEvent.defaultPrevented) {\n return\n }\n }\n\n step.newElement = newElement\n return true\n }\n\n _cannotMatchStep(step) {\n if (!step.maybe) {\n // An error message will be chosen by up.Change.FromContent\n throw new up.CannotMatch()\n }\n }\n\n commitElement(element) {\n // If multiple steps want to match the name new element, only he first will succeed.\n // This will happen when multiple layers have the same hungry element with [up-if-layer=any].\n if (this._document.contains(element)) {\n // (A) If the user doesn't want to run scripts in the new fragment, we block all <script> elements.\n // We cannot wait until finalizeElement(), because then the script has already been inserted and has executed.\n // (B) For the remaining scripts we verify and adopt CSP nonces so they can be executed in the current page.\n up.script.adoptNewFragment(element, this._cspInfo)\n\n // Ensure that the element cannot be matched for subsequent selects().\n element.remove()\n\n return true\n }\n }\n\n finalizeElement(element) {\n // If we plucked elements from a Document we assume that document was created by DOMParser,\n // which operates in a different context and creates inert elements:\n //\n // (1) Children of a <nonscript> tag are expected to be a verbatim text node in a scripting-capable browser.\n // However, `DOMParser` parses children into actual DOM nodes.\n // This confuses libraries that work with <noscript> tags, such as lazysizes.\n // (2) <script> elements are inert and will not run code when inserted into the main `document`.\n // (3) Safari cannot parse (or move?) auto-playing media elements.\n if (this._document instanceof Document) {\n for (let brokenElement of e.subtree(element, ':is(noscript, script, audio, video):not(.up-keeping, .up-keeping *)')) {\n // throw \"why does this not re-execute a <script> tag? wouldn't it be safer to disable all scripts, then revive some of them?\"\n let clone = e.revivedClone(brokenElement)\n brokenElement.replaceWith(clone)\n }\n }\n }\n\n static {\n // Cache since multiple plans will query this.\n u.memoizeMethod(this.prototype, {\n getHead: true,\n })\n }\n\n}\n","const e = up.element\nconst u = up.util\n\nup.RevealMotion = class RevealMotion {\n\n constructor(element, options = {}) {\n this._element = element\n this._viewport = e.get(options.viewport) || up.viewport.get(this._element)\n this._obstructionsLayer = up.layer.get(this._viewport)\n this._behavior = options.behavior ?? 'instant'\n\n const viewportConfig = up.viewport.config\n this._snap = options.snap ?? options.revealSnap ?? viewportConfig.revealSnap\n this._padding = options.padding ?? options.revealPadding ?? viewportConfig.revealPadding\n this._top = options.top ?? options.revealTop ?? viewportConfig.revealTop\n this._max = options.max ?? options.revealMax ?? viewportConfig.revealMax\n\n this._topObstructionSelector = viewportConfig.selector('fixedTopSelectors')\n this._bottomObstructionSelector = viewportConfig.selector('fixedBottomSelectors')\n }\n\n start() {\n const viewportRect = this._getViewportRect(this._viewport)\n const elementRect = up.Rect.fromElement(this._element)\n if (this._max) {\n const maxPixels = u.evalOption(this._max, this._element)\n elementRect.height = Math.min(elementRect.height, maxPixels)\n }\n\n elementRect.grow(this._padding)\n this._substractObstructions(viewportRect)\n\n // Cards test (topics dropdown) throw an error when we also fail at zero\n if (viewportRect.height < 0) {\n up.fail('Viewport has no visible area')\n }\n\n const originalScrollTop = this._viewport.scrollTop\n let newScrollTop = originalScrollTop\n\n if (this._top || (elementRect.height > viewportRect.height)) {\n // Element is either larger than the viewport,\n // or the user has explicitly requested for the element to align at top\n // => Scroll the viewport so the first element row is the first viewport row\n const diff = elementRect.top - viewportRect.top\n newScrollTop += diff\n } else if (elementRect.top < viewportRect.top) {\n // Element fits within viewport, but sits too high\n // => Scroll up (reduce scrollY), so the element comes down\n newScrollTop -= (viewportRect.top - elementRect.top)\n } else if (elementRect.bottom > viewportRect.bottom) {\n // Element fits within viewport, but sits too low\n // => Scroll down (increase scrollY), so the element comes up\n newScrollTop += (elementRect.bottom - viewportRect.bottom)\n }\n else {\n // Element is fully visible within viewport.\n // Do nothing.\n }\n\n if (u.isNumber(this._snap) && (newScrollTop < this._snap) && (elementRect.top < (0.5 * viewportRect.height))) {\n newScrollTop = 0\n }\n\n if (newScrollTop !== originalScrollTop) {\n this._viewport.scrollTo({ top: newScrollTop, behavior: this._behavior })\n }\n }\n\n _getViewportRect() {\n if (up.viewport.isRoot(this._viewport)) {\n // Other than an element with overflow-y, the document viewport\n // stretches to the full height of its contents. So we create a viewport\n // sized to the usuable screen area.\n return new up.Rect({\n left: 0,\n top: 0,\n width: up.viewport.rootWidth(),\n height: up.viewport.rootHeight()\n })\n } else {\n return up.Rect.fromElement(this._viewport)\n }\n }\n\n _computeObstructionRects(selector) {\n let elements = up.fragment.all(selector, { layer: this._obstructionsLayer })\n elements = u.filter(elements, e.isVisible)\n return u.map(elements, (element) => {\n if (e.style(element, 'position') === 'sticky') {\n // There is no simple way to detect if a sticky element is in static or fixed positioning.\n // We pretend it is always fixed for the purpose of measuring obstruction.\n return up.Rect.fromElementAsFixed(element)\n } else {\n return up.Rect.fromElement(element)\n }\n })\n }\n\n _substractObstructions(viewportRect) {\n for (let obstructionRect of this._computeObstructionRects(this._topObstructionSelector)) {\n let diff = obstructionRect.bottom - viewportRect.top\n if (diff > 0) {\n viewportRect.top += diff\n viewportRect.height -= diff\n }\n }\n\n for (let obstructionRect of this._computeObstructionRects(this._bottomObstructionSelector)) {\n let diff = viewportRect.bottom - obstructionRect.top\n if (diff > 0) {\n viewportRect.height -= diff\n }\n }\n }\n}\n","const e = up.element\nconst u = up.util\n\n// Options in an X-Up-Open-Layer header that start with \"on\", but take a selector instead of a callback.\nconst NON_CALLBACK_KEYS = ['onAcceptedReload', 'onDismissedReload']\n\nup.ScriptGate = class ScriptGate {\n\n constructor(cspInfo = up.CSPInfo.none()) {\n // Only parse the page nonce once for adopting multiple items.\n // TODO: Consider moving page none parsing to CSPInfo\n let pageNonce = up.script.cspNonce()\n\n this._evalCallbackPolicy = new EvalCallbackPolicy(pageNonce, cspInfo)\n this._scriptElementPolicy = new BodyScriptElementPolicy(pageNonce, cspInfo)\n this._detachedAssetPolicy = new DetachedAssetPolicy(pageNonce, cspInfo)\n }\n\n warnOfUnsafeCSP() {\n if (up.script.config.cspWarnings) {\n this._evalCallbackPolicy.warnOfUnsafeCSP()\n this._scriptElementPolicy.warnOfUnsafeCSP()\n }\n }\n\n evalCallback(nonceableCallback, evalEnv) {\n const policy = this._evalCallbackPolicy\n\n // There are multiple reasons why we explicitly check if a callback is allowed,\n // instead of relying on the document's CSP checks:\n //\n // (A) The user might have configured a blocking script policy in up.script.config.evalCallbackPolicy.\n // This policy might be stricter than the CSP, e.g. to prevent callbacks entirely.\n // (B) While we proactively block scripts in new fragments, we may have unprocessed scripts\n // from the initial page load, or from an attacker that has some control over the HTML.\n // (C) We might have a nonced callback, meaning we need to execute using a <script nonce> element.\n // With a viral strict-dynamic CSP the browser will happily let Unpoly execute *any* <script>,\n // even if a nonce is missing or incorrect. In this case we want to explicitly check for\n // a valid nonce. Otherwise an attacker could set an [up-on-loaded] callback with an incorrect nonce,\n // trigger <script nonce> execution and run arbitrary JavaScript.\n if (policy.passesItem(nonceableCallback.nonce)) {\n try {\n return nonceableCallback.unsafeEval(evalEnv)\n } catch (error) {\n if (error instanceof EvalError) {\n throw new up.Blocked(error.message)\n } else {\n throw error\n }\n }\n } else {\n // We don't rewrite the callback string in the DOM.\n throw new up.Blocked('Blocked callback: ' + nonceableCallback.script)\n }\n }\n\n adoptNewFragment(fragment) {\n this._adoptScriptElements(fragment)\n this._adoptAttrCallbacks(fragment)\n }\n\n adoptDetachedHeadAsset(asset) {\n if (!up.script.isScript(asset)) return\n\n // (A) These assets are not normally going to be inserted into the page, but may emit up:assets:changed.\n // (B) We need to adopt script[nonce] attributes for the comparison, and in case the user wants to insert manually.\n // (C) We don't block untrusted scripts for the same reason.\n let item = new ScriptElementItem(asset)\n this._detachedAssetPolicy.processItem(item)\n }\n\n adoptRenderOptionsFromHeader(object) {\n let policy = this._evalCallbackPolicy\n\n for (let key of Object.keys(object)) {\n let script = object[key]\n\n // Any other on* key is a callback, so a mistyped key fails with \"Unknown callback\".\n if (/^on[A-Z]/.test(key) && !NON_CALLBACK_KEYS.includes(key) && u.isString(script)) {\n let item = new ObjectPropertyItem(object, key)\n policy.processItem(item)\n object[key] = up.RenderOptions.parseCallback(key, object[key])\n }\n }\n }\n\n _adoptScriptElements(root) {\n const policy = this._scriptElementPolicy\n\n for (let script of up.script.findScripts(root)) {\n let item = new ScriptElementItem(script)\n policy.processItem(item)\n }\n }\n\n _adoptAttrCallbacks(root) {\n const policy = this._evalCallbackPolicy\n\n // TODO: It is weird that we keep a list of callback options in RenderOptions, but the list of nonceable attrs is in up.script? Maybe at least move them together?\n for (let attribute of up.script.config.nonceableAttributes) {\n let matches = e.subtree(root, e.attrSelector(attribute))\n for (let element of matches) {\n let item = new AttributeItem(element, attribute, policy)\n policy.processItem(item)\n }\n }\n }\n\n}\n\nclass Policy {\n\n constructor(pageNonce, cspInfo) {\n this.pageNonce = pageNonce\n\n // TODO: Consider moving nonce checking to CSPInfo\n this.cspInfo = cspInfo\n\n this._validNonces = new Set(cspInfo.nonces)\n // (A) Allow the page nonce for up.script.evalCallback(), which checks an already adopted callback.\n // (B) Allow the page nonce for developers who do keep their nonces stable across sessions.\n if (pageNonce) this._validNonces.add(pageNonce)\n }\n\n isValidNonce(nonce) {\n return this._validNonces.has(nonce)\n }\n\n tryRewriteNonce(allowedItem, nonce = allowedItem.readNonce()) {\n // (A) Only rewrite nonces if we know a better nonce from <meta name=\"csp-nonce\">. Don't set \"undefined\".\n // (B) Even with \"pass\" we only want to adopt valid nonces. Otherwise we might accidentally allow a\n // script with disallowed hostname in a host-based CSPs that also has nonces for callbacks.\n if (this.pageNonce && this.isValidNonce(nonce)) {\n allowedItem.writeNonce(this.pageNonce)\n }\n }\n\n warnOfUnsafeCSP() {\n throw new up.NotImplemented()\n }\n\n processItem(item) {\n // We need the nonce twice below. Only read it once for performance.\n let nonce = item.readNonce()\n let blocked = !this.passesItem(nonce)\n\n if (blocked) {\n // (A) Script elements need to be blocked on adoption, as inserting a script immediately executes them.\n // (B) Callback strings will get another check during execution. We still block them during adoption for debuggability.\n this.log(...item.logBlockedDescriptor())\n item.block()\n } else {\n this.tryRewriteNonce(item, nonce)\n }\n }\n\n passesItem(_itemNonce) {\n throw new up.NotImplemented()\n }\n\n}\n\nclass DetachedAssetPolicy extends Policy {\n\n constructor(...args) {\n super(...args)\n }\n\n passesItem(_itemNonce) {\n return true\n }\n\n}\n\nclass ConfigurablePolicy extends Policy {\n\n constructor(configProp, pageNonce, cspInfo) {\n // Page nonce and CSP info must be known for #resolveAuto()\n super(pageNonce, cspInfo)\n\n this._configProp = configProp\n\n let policyString = up.script.config[configProp]\n if (policyString === 'auto') policyString = this.resolveAuto()\n if (policyString === 'nonce' && !this.pageNonce) {\n this.warn('Enforcing nonces requires a <meta name=\"csp-nonce\">.')\n policyString = 'block'\n }\n this.policyString = policyString\n }\n\n resolveAuto() {\n throw new up.NotImplemented()\n }\n\n passesItem(itemNonce) {\n switch (this.policyString) {\n // Always pass. Script must pass CSP.\n // Bad idea for a strict-dynamic CSP, which allows everything.\n case 'pass': return true\n\n // Always block, regardless of CSP.\n case 'block': return false\n\n // Block any non-nonced scripts.\n // Nonces will be checked in processItem().\n case 'nonce': return this.isValidNonce(itemNonce)\n\n default: up.fail('Unknown policy: %s = %o', this.configExpression(), this.policyString)\n }\n }\n\n log(...descriptorArgs) {\n up.puts(this.configExpression(), ...descriptorArgs)\n }\n\n warn(...descriptorArgs) {\n up.warn(this.configExpression(), ...descriptorArgs)\n }\n\n configExpression() {\n return 'up.script.config.' + this._configProp\n }\n\n}\n\nclass EvalCallbackPolicy extends ConfigurablePolicy {\n\n constructor(...args) {\n super('evalCallbackPolicy', ...args)\n }\n\n resolveAuto() {\n // When the user inserted a <meta name=\"csp-nonce\">, we assume their intent is to\n // enforce nonces for any callback.\n if (this.pageNonce) {\n return 'nonce'\n } else {\n return 'pass'\n }\n }\n\n warnOfUnsafeCSP() {\n if (this.policyString === 'pass' && this.cspInfo.isUnsafeEval()) {\n this.warn(`An 'unsafe-eval' CSP allows arbitrary [up-on...] callbacks. Consider setting ${this.configExpression()} = 'nonce'.`)\n }\n }\n\n}\n\nclass BodyScriptElementPolicy extends ConfigurablePolicy {\n\n constructor(...args) {\n super('scriptElementPolicy', ...args)\n }\n\n resolveAuto() {\n // (A) With a strict-dynamic CSP, it's a good idea to enforce nonces in the new content.\n // Otherwise, we would allow *all* scripts as strict-dynamic is viral, and Unpoly is already an allowed script.\n // (B) Don't assume 'nonce' when we see a <meta name=\"csp-nonce\">. The user might want to provide\n // a nonce for Unpoly callbacks, but still use a hostname-based allowlist.\n if (this.cspInfo.isStrictDynamic()) {\n return 'nonce'\n } else {\n return 'pass'\n }\n }\n\n warnOfUnsafeCSP() {\n if (this.policyString === 'pass' && this.cspInfo.isStrictDynamic()) {\n this.warn(`A 'strict-dynamic' CSP allows arbitrary <script> elements in new fragments. Consider setting ${this.configExpression()} = 'nonce'.`)\n }\n }\n\n}\n\n\nclass StringCallbackItem {\n\n readNonce() {\n return this._getCallback().nonce\n }\n\n writeNonce(nonce) {\n let callback = this._getCallback()\n callback.nonce = nonce\n this.writeCallbackString(callback.toCallbackString())\n }\n\n _getCallback() {\n return this._cacheCallback ||= up.NonceableCallback.fromCallbackString(this.readCallbackString())\n }\n\n logBlockedDescriptor() {\n throw new up.NotImplemented()\n }\n\n block() {\n this.writeCallbackString('/* blocked */')\n }\n\n readCallbackString() {\n throw new up.NotImplemented()\n }\n\n writeCallbackString(_newString) {\n throw new up.NotImplemented()\n }\n\n}\n\nclass AttributeItem extends StringCallbackItem {\n\n constructor(element, attribute) {\n super()\n this._element = element\n this._attribute = attribute\n }\n\n logBlockedDescriptor() {\n return ['Blocked callback attribute: %s', e.attrSelector(this._attribute, this.readCallbackString())]\n }\n\n readCallbackString() {\n return this._element.getAttribute(this._attribute)\n }\n\n writeCallbackString(newString) {\n this._element.setAttribute(this._attribute, newString)\n }\n\n}\n\nclass ObjectPropertyItem extends StringCallbackItem {\n\n constructor(object, key) {\n super()\n this._object = object\n this._key = key\n }\n\n logBlockedDescriptor() {\n return ['Blocked string callback: { %s: %o }', this._key, this.readCallbackString()]\n }\n\n readCallbackString() {\n return this._object[this._key]\n }\n\n writeCallbackString(newString) {\n this._object[this._key] = newString\n }\n\n}\n\nclass ScriptElementItem {\n\n constructor(element) {\n this._element = element\n }\n\n readNonce() {\n return this._element.nonce\n }\n\n writeNonce(nonce) {\n // Set an attribute (instead of the property), so the change is reflected in the DOM explorer for easier debugging\n this._element.setAttribute('nonce', nonce)\n }\n\n logBlockedDescriptor() {\n return ['Blocked <script> element: %o', this._element]\n }\n\n block() {\n up.script.block(this._element)\n }\n\n}\n","const u = up.util\nconst e = up.element\n\nup.Selector = class Selector {\n\n constructor(selector, elementOrDocument, options = {}) {\n // If we're given an element that is detached *or* from another document\n // (think up.ResponseDoc), it has no layer and no destroying ancestors.\n let externalDocument = elementOrDocument && !document.contains(elementOrDocument)\n this._filters = (externalDocument || options.destroying) ? [] : [up.fragment.isNotDestroying]\n\n // Some up.fragment functions center around an element, like up.fragment.closest(element, selector).\n // In this case up.fragment passes us that element, and we search the element's layer unless told otherwise.\n options.layer ??= u.presence(elementOrDocument, u.isElement)\n\n // With a single layer in the DOM, every element belongs to it and we can skip the layer lookup.\n // We count layers in the DOM, not open layers: a closed overlay may still be playing its exit animation.\n let noLayers = externalDocument || options.layer === 'any' || up.layer.attachedCount === 1\n\n // Also normalizes options: a missing { layer } with an { origin } becomes 'origin'.\n let layers = options.layer !== 'new' && !noLayers && up.layer.getAll(options)\n let expandTargetLayer\n\n if (options.layer === 'new') {\n // (1) A layer that is about to open does not exist yet, so we cannot filter by it.\n // Expand layer-specific selectors like `:main` for the new layer's { mode }.\n expandTargetLayer = 'new'\n } else if (noLayers) {\n // (2) There is no layer to tell matches apart by.\n // Use the root layer to expand layer-specific selectors like `:main` or `:layer`.\n expandTargetLayer = up.layer.root\n } else if (layers.length) {\n // (3) Only match within the given layers. Earlier layers are preferred.\n // Use the first layer to expand layer-specific selectors like `:main` or `:layer`.\n this._layers = layers\n this._filters.push((match) => u.some(layers, (layer) => layer.contains(match)))\n expandTargetLayer = layers[0]\n } else if (u.isElementLike(options.layer) || (options.layer === 'origin' && options.origin)) {\n // (4) The layer of the given element-like value (root, { layer } or { origin }) has closed.\n // Its elements may still be in the DOM, playing their exit animation,\n // but nothing in a closed layer can match.\n this._selectors = []\n } else {\n // (5) A named layer that doesn't exist, e.g. { layer: 'child' } without a child.\n throw new up.CannotMatch([\"Unknown layer: %o\", options.layer])\n }\n\n this._selectors ??= up.fragment.expandTargets(selector, { ...options, layer: expandTargetLayer })\n\n // No selectors match nothing: in case (4), or when the user has set config.mainTargets = []\n // and we got a :main selector.\n this._unionSelector = this._selectors.join() || 'match-none'\n }\n\n matches(element) {\n return e.elementLikeMatches(element, this._unionSelector) && this._passesFilter(element)\n }\n\n closest(element) {\n return this._filterOne(element.closest(this._unionSelector))\n }\n\n descendants(root = document) {\n return this._filterMany(root.querySelectorAll(this._unionSelector))\n }\n\n firstDescendant(root) {\n // Note that we query per expanded selector, not once for their union: when\n // `up.fragment.config.mainTargets` matches both .container and body, up.fragment.get(':main')\n // must prefer .container even though body comes first in the document.\n //\n // An *element* root is searched directly. The layer filter in this._filters is what\n // keeps matches inside the requested layers, and it must: a root like <body> contains\n // other layers' elements, since an overlay is appended to <body>.\n //\n // A Document root narrows nothing, so it is not a root for our purposes. Treating it\n // as one would search the whole document and let the layer filter (which accepts a\n // match in *any* requested layer) pick, losing the layer preference below.\n if (u.isElement(root)) {\n return this._firstSelectorMatch((selector) => root.querySelectorAll(selector))\n } else if (!this._layers) {\n // With layers out of the picture the container is a whole document: the one we were\n // given (up.ResponseDoc passes its own), or ours.\n return this._firstSelectorMatch((selector) => (root || document).querySelectorAll(selector))\n } else {\n // Earlier layers win, so u.findResult() tries one layer at a time. E.g.\n // up.fragment.get('main', { layer: 'current root' }) may match in both layers, but\n // must return the match in 'current'. A layer element may itself be the match, as in\n // up.fragment.get('body'), hence e.subtree().\n return u.findResult(this._layers, (layer) => {\n return this._firstSelectorMatch((selector) => e.subtree(layer.element, selector))\n })\n }\n }\n\n subtree(root) {\n return this._filterMany(e.subtree(root, this._unionSelector))\n }\n\n _firstSelectorMatch(fn) {\n return u.findResult(this._selectors, (selector) => {\n return this._filterMany(fn(selector))[0]\n })\n }\n\n _passesFilter(element) {\n return element && u.every(this._filters, (filter) => filter(element))\n }\n\n _filterOne(element) {\n return u.presence(element, this._passesFilter.bind(this))\n }\n\n _filterMany(elements) {\n return u.filter(elements, this._passesFilter.bind(this))\n }\n\n}\n","const u = up.util\nconst e = up.element\n\nup.Tether = class Tether {\n\n constructor(options) {\n this._anchor = options.anchor\n this._align = options.align\n this._position = options.position\n\n this._alignAxis = (this._position === 'top') || (this._position === 'bottom') ? 'horizontal' : 'vertical'\n\n this._viewport = up.viewport.get(this._anchor)\n // The document viewport is <html> on some browsers, and we cannot attach children to that.\n this.parent = this._viewport === e.root ? document.body : this._viewport\n\n // If the offsetParent is within the viewport (or is the viewport) we can simply\n // `position: absolute` and it will move as the viewport scrolls, without JavaScript.\n // If not however, we have no choice but to move it on every scroll event.\n this._syncOnScroll = !this._viewport.contains(this._anchor.offsetParent)\n }\n\n start(element) {\n this._element = element\n this._element.style.position = 'absolute'\n this._setOffset(0, 0)\n this.sync()\n this._changeEventSubscription('on')\n }\n\n stop() {\n this._changeEventSubscription('off')\n }\n\n _changeEventSubscription(fn) {\n let doScheduleSync = this._scheduleSync.bind(this)\n up[fn](window, 'resize', doScheduleSync)\n if (this._syncOnScroll) { up[fn](this._viewport, 'scroll', doScheduleSync) }\n }\n\n _scheduleSync() {\n clearTimeout(this.syncTimer)\n return this.syncTimer = u.task(this.sync.bind(this))\n }\n\n isAlive() {\n // return !this.parent.isConnected || !this._anchor.isConnected\n return up.fragment.isAlive(this.parent) && up.fragment.isAlive(this._anchor)\n }\n\n sync() {\n const elementBox = this._element.getBoundingClientRect()\n\n const elementMargin = {\n top: e.styleNumber(this._element, 'margin-top'),\n right: e.styleNumber(this._element, 'margin-right'),\n bottom: e.styleNumber(this._element, 'margin-bottom'),\n left: e.styleNumber(this._element, 'margin-left')\n }\n\n const anchorBox = this._anchor.getBoundingClientRect()\n\n let left\n let top\n\n switch (this._alignAxis) {\n case 'horizontal': { // position is 'top' or 'bottom'\n switch (this._position) {\n case 'top':\n top = anchorBox.top - elementMargin.bottom - elementBox.height\n break\n // element\n // -------\n // margin\n // -------\n // anchor\n case 'bottom':\n top = anchorBox.top + anchorBox.height + elementMargin.top\n break\n }\n // anchor\n // ------\n // margin\n // ------\n // element\n switch (this._align) {\n case 'left':\n // anchored to anchor's left, grows to the right\n left = anchorBox.left + elementMargin.left\n break\n // mg | element\n // ------------\n // anchor\n case 'center':\n // anchored to anchor's horizontal center, grows equally to left/right\n left = anchorBox.left + (0.5 * (anchorBox.width - elementBox.width))\n break\n // e l e m e n t\n // -------------\n // anchor\n case 'right':\n // anchored to anchor's right, grows to the left\n left = (anchorBox.left + anchorBox.width) - elementBox.width - elementMargin.right\n break\n // element | mg\n // ------------\n // anchor\n }\n break\n }\n case 'vertical': { // position is 'left' or 'right'\n switch (this._align) {\n case 'top':\n // anchored to the top, grows to the bottom\n top = anchorBox.top + elementMargin.top\n break\n // margin | anchor\n // --------|\n // element |\n case 'center':\n // anchored to anchor's vertical center, grows equally to left/right\n top = anchorBox.top + (0.5 * (anchorBox.height - elementBox.height))\n break\n // ele |\n // men | anchor\n // t |\n case 'bottom':\n // anchored to the bottom, grows to the top\n top = (anchorBox.top + anchorBox.height) - elementBox.height - elementMargin.bottom\n break\n // element |\n // ------- |\n // margin | anchor\n }\n switch (this._position) {\n case 'left':\n left = anchorBox.left - elementMargin.right - elementBox.width\n break\n // element | margin | anchor\n case 'right':\n left = anchorBox.left + anchorBox.width + elementMargin.left\n break\n // anchor | margin | element\n }\n break\n }\n }\n\n if (u.isDefined(left) || u.isDefined(top)) {\n this._moveTo(left, top)\n } else {\n up.fail('Invalid tether constraints: %o', this._describeConstraints())\n }\n }\n\n _describeConstraints() {\n return { position: this._position, align: this._align }\n }\n\n _moveTo(targetLeft, targetTop) {\n const elementBox = this._element.getBoundingClientRect()\n this._setOffset(\n (targetLeft - elementBox.left) + this.offsetLeft,\n (targetTop - elementBox.top) + this.offsetTop\n )\n }\n\n _setOffset(left, top) {\n this.offsetLeft = left\n this.offsetTop = top\n e.setStyle(this._element, { left, top }, 'px')\n }\n}\n","const u = up.util\n\nup.URLPattern = class URLPattern {\n\n constructor(fullPattern) {\n this._groups = []\n\n const positiveList = []\n const negativeList = []\n\n for (let pattern of u.getSimpleTokens(fullPattern)) {\n if (pattern[0] === '-') {\n negativeList.push(pattern.substring(1))\n } else {\n positiveList.push(pattern)\n }\n }\n\n this._positiveRegexp = this._buildRegexp(positiveList, true)\n this._negativeRegexp = this._buildRegexp(negativeList, false)\n }\n\n _buildRegexp(list, capture) {\n if (!list.length) { return }\n\n list = u.flatMap(list, u.matchableURLPatternAtom)\n list = list.map(u.escapeRegExp)\n\n let reCode = list.join('|')\n\n // Wildcards (*)\n reCode = reCode.replace(/\\\\\\*/g, '.*?')\n\n // Placeholders (:string or $digit)\n reCode = reCode.replace(/(:|\\\\\\$)([a-z][\\w-]*)/ig, (match, type, name) => {\n // It's \\\\$ instead of $ because we do u.escapeRegExp above\n if (type === '\\\\$') {\n if (capture) { this._groups.push({ name, cast: Number }) }\n return '(\\\\d+)'\n } else {\n if (capture) { this._groups.push({ name, cast: String }) }\n return '([^/?#]+)'\n }\n })\n\n return new RegExp('^(?:' + reCode + ')$')\n }\n\n // This method is performance-sensitive. It's called for every link in an [up-nav]\n // after every fragment update.\n test(url, doNormalize = true) {\n if (doNormalize) { url = u.matchableURL(url) }\n // Use RegExp#test() instead of RegExp#recognize() as building match groups is expensive,\n // and we only need to know whether the URL matches (true / false).\n return this._positiveRegexp.test(url) && !this._isExcluded(url)\n }\n\n recognize(url, doNormalize = true) {\n if (doNormalize) { url = u.matchableURL(url) }\n let match = this._positiveRegexp.exec(url)\n if (match && !this._isExcluded(url)) {\n const resolution = {}\n this._groups.forEach((group, groupIndex) => {\n let value = match[groupIndex + 1]\n if (value) {\n return resolution[group.name] = group.cast(value)\n }\n })\n return resolution\n }\n }\n\n _isExcluded(url) {\n return this._negativeRegexp?.test(url)\n }\n}\n","/*-\nFeatures to control when Unpoly boots.\n\nBy default Unpoly boots on `DOMContentLoaded`, after your own scripts have had a chance to configure it and register compilers. You rarely need this module. Boot manually with `up.boot()` only when you load Unpoly with `<script async>`, or when you set `[up-boot=manual]` on the `<html>` element and boot later yourself. `up.framework.isSupported()` returns whether Unpoly can boot in the current browser. On an unsupported browser Unpoly stays inactive, leaving a server-side web application without JavaScript enhancements.\n\n@module up.framework\n*/\n\nup.framework = (function() {\n\n // Event up.framework.readyState document.readyState\n // ------------------------------------------------------------------------------------------------------\n // Browser starts parsing HTML - loading\n // Unpoly script is running evaling loading (if sync) or interactive (if defered)\n // ... submodules are running evaling loading (if sync) or interactive (if defered)\n // User scripts are running configuring loading (if sync) or interactive (if defered)\n // DOMContentLoaded configuring => booting interactive\n // Initial page is compiling booting interactive\n // Document resources loaded booted complete\n let readyState = 'evaling' // evaling => configuring => booting => booted\n\n /*-\n Whether Unpoly has finished booting.\n\n Compilers may query this property to check if the initial page is being compiled\n (as opposed to a subsequent fragment update).\n\n @property up.framework.booted\n @param {boolean} boolean\n @experimental\n */\n\n /*-\n Resets Unpoly to the state when it was booted.\n All custom event handlers, animations, etc. that have been registered\n will be discarded.\n\n Emits event [`up:framework:reset`](/up:framework:reset).\n\n @function up.framework.reset\n @internal\n */\n function emitReset() {\n up.emit('up:framework:reset', { log: false })\n }\n\n /*-\n This event is [emitted](/api/up.emit) when Unpoly is [reset](/up.framework.reset) during unit tests.\n\n @event up:framework:reset\n @internal\n */\n\n /*-\n Manually boots the Unpoly framework.\n\n It is not usually necessary to call `up.boot()` yourself. When you load [Unpoly's JavaScript file](/learn/install),\n Unpoly will automatically boot on [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event).\n There are only two cases when you would boot manually:\n\n - When you load Unpoly with `<script async>`\n - When you explicitly ask to manually boot by setting an [`<html up-boot=\"manual\">`](/api/up-boot-manual) attribute.\n\n Before you manually boot, Unpoly should be configured and compilers should be registered.\n Booting will cause Unpoly to [compile](/api/up.hello) the initial page.\n\n Unpoly will refuse to boot if the current browser is [not supported](/api/up.framework.isSupported).\n This leaves you with a classic server-side application on legacy browsers.\n\n @function up.boot\n @experimental\n @signature\n */\n function boot({ mode = 'manual' } = {}) {\n if (readyState !== 'configuring') {\n // In an app with a lot of async script the user may attempt to boot us twice.\n console.error('Unpoly has already booted')\n return\n }\n\n // This is called synchronously after all Unpoly modules have been parsed\n // and executed. We cannot delay booting until the DOM is ready, since by then\n // all user-defined event listeners and compilers will have registered.\n // Note that any non-async scripts after us will delay DOMContentLoaded.\n let issue = supportIssue()\n if (!issue) {\n // Change the state in case any user-provided compiler calls up.boot().\n // up.boot() is a no-op unless readyState === 'configuring'.\n readyState = 'booting'\n up.emit('up:framework:boot', { mode, log: false })\n readyState = 'booted'\n // The initial page has been compiled, so CSS can stop hiding unprocessed elements.\n document.documentElement.classList.add('up-booted')\n up.emit('up:framework:booted', { mode, log: false })\n } else {\n console.error(\"Unpoly cannot boot: %s\", issue)\n }\n }\n\n function mustManualBoot() {\n // (A) If we're loaded via <script async>, there are no guarantees when we're called or when\n // subsequent scripts that configure Unpoly have executed.\n // (B) We cannot rely on document.currentScript being present.\n // This function runs before the support check, we may be dealing with a browser that doesn't support `document.currentScript` (e.g. IE11).\n // Also `document.currentScript` is `undefined` for a `<script type=\"module\">`.\n if (document.currentScript?.async) {\n return true\n }\n\n // (A) If we're loaded with <html up-boot=\"manual\"> the user explicitly requested to boot Unpoly manually.\n // (B) There is a legacy API to also allow <script up-boot=\"manual\">.\n // We cannot migrate this in unpoly-migrate, as unpoly-migrate will be evaled after us.\n if (document.querySelector('[up-boot=manual]:is(html, script)')) {\n return true\n }\n\n // If we're loaded this late, someone loads us dynamically.\n // We don't know when subsequent scripts that configure Unpoly\n // have executed.\n if (document.readyState === 'complete') {\n return true\n }\n }\n\n /*-\n This event is emitted after Unpoly has [booted](/api/up.boot).\n\n @learn-ref install\n\n For most apps this event will be emitted in the same [task](https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/)\n as [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event).\n All [compilers](/api/up.script) will already have run on the initial page content.\n\n @event up:framework:booted\n @param {string} event.mode\n A string indicating what caused Unpoly to boot.\n\n If set to `'auto'`, Unpoly was booted automatically on `DOMContentLoaded`.\n\n If set to `'manual'`, Unpoly was booted [manually](/api/up-boot-manual).\n\n @experimental\n @experimental\n */\n\n /*-\n This class is set on the `<html>` element after Unpoly has [booted](/api/up.boot).\n\n @learn-ref switching-form-state#before-booting\n\n All [compilers](/api/up.script) will already have run on the initial page content.\n\n You can use this class to hide elements until Unpoly has processed them,\n e.g. to [hide switched elements before booting](/learn/switching-form-state#before-booting):\n\n ```css\n html:not(.up-booted) :is([up-show-for], [up-hide-for]) {\n display: none;\n }\n ```\n\n The class is not set when Unpoly [cannot boot](/api/up.framework.isSupported) or fails to load.\n Elements hidden by such a rule would then stay hidden.\n\n @selector .up-booted\n @experimental\n */\n\n /*-\n Prevent Unpoly from booting automatically.\n\n @learn-ref install\n\n By default Unpoly [automatically boots](/learn/install#initialization)\n on [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event).\n To prevent this, add an `[up-boot=\"manual\"]` attribute to the `<html>` element:\n\n ```html\n <html up-boot=\"manual\"> <!-- mark: up-boot=\"manual\" -->\n ...\n </html>\n ```\n You may then call `up.boot()` to manually boot Unpoly at a later time.\n\n @selector [up-boot=manual]\n @experimental\n @signature\n */\n\n function onEvaled() {\n up.emit('up:framework:evaled', { log: false })\n\n if (mustManualBoot()) {\n console.debug('Call up.boot() after you have configured Unpoly')\n } else {\n // (1) On DOMContentLoaded we know that all non-[async] scripts have executed.\n // (2) Deferred scripts execute after the DOM was parsed (document.readyState === 'interactive'),\n // but before DOMContentLoaded. That's why we must *not* boot synchonously when\n // document.readyState === 'interactive'. We must wait until DOMContentLoaded, when we know that\n // subsequent users scripts have executed and (possibly) configured Unpoly.\n // (3) There are no guarantees when [async] scripts execute. These must boot Unpoly manually.\n document.addEventListener('DOMContentLoaded', () => boot({ mode: 'auto' }))\n }\n\n // After this line user scripts may run and configure Unpoly, add compilers, etc.\n readyState = 'configuring'\n }\n\n function startExtension() {\n if (readyState !== 'configuring') {\n throw new Error('Unpoly extensions must be loaded before booting')\n }\n readyState = 'evaling'\n }\n\n function stopExtension() {\n readyState = 'configuring'\n }\n\n /*-\n Returns whether Unpoly can boot in the current browser.\n\n If this returns `false` Unpoly will not automatically [boot](/api/up.boot)\n and will not [compile](/learn/enhancing-elements) the initial page.\n This leaves you with a server-side web application without any JavaScript enhancements.\n\n The support check is very cursory. While it will exclude most legacy browsers\n like Internet Explorer, there may be cases where `up.framework.isSupported()`\n returns `true` on a browser with other support issues.\n To use your own conditions for browser support, [boot manually](/api/up-boot-manual).\n\n ### Browser support\n\n Unpoly aims to support all modern browsers.\n\n #### Chrome, Firefox, Microsoft Edge\n\n Unpoly supports recent versions of these [evergreen](https://stephenweiss.dev/evergreen-browsers) browsers.\n\n #### Safari, Mobile Safari\n\n Unpoly supports the last two major versions of Safari.\n\n #### Internet Explorer\n\n Internet Explorer 11 or lower is [no longer supported](https://github.com/unpoly/unpoly/discussions/340).\n\n If you need to support Internet Explorer 11, use Unpoly 2.\n\n @function up.framework.isSupported\n @stable\n @signature\n */\n function isSupported() {\n return !supportIssue()\n }\n\n function supportIssue() {\n for (let feature of ['Promise', 'DOMParser', 'FormData', 'reportError']) {\n if (!window[feature]) {\n return `Browser doesn't support the ${feature} API`\n }\n }\n\n if (document.compatMode === 'BackCompat') {\n return 'Browser is in quirks mode (missing DOCTYPE?)'\n }\n\n for (let selector of [':is(*)', ':has(*)']) {\n if (!CSS.supports(`selector(${selector})`)) {\n return `Browser doesn't support the ${selector} selector`\n }\n }\n }\n\n return {\n onEvaled,\n boot,\n startExtension,\n stopExtension,\n reset: emitReset,\n get evaling() { return readyState === 'evaling' },\n get booted() { return readyState === 'booted' },\n get beforeBoot() { return readyState !== 'booting' && readyState !== 'booted' },\n isSupported,\n }\n})()\n\nup.boot = up.framework.boot\n","/*-\nFeatures to emit and observe DOM events.\n\n`up.on()` listens on `document` or a given element, and can delegate to a selector so it also catches events from elements inserted later. It returns a function that unbinds the listener, and unbinds automatically when the element is destroyed. `up.emit()` emits a custom event with the given properties and returns it, so you can check whether a listener prevented it. An `[up-emit]` attribute emits a custom event when the element is clicked.\n\n@module up.event\n*/\nup.event = (function() {\n\n const u = up.util\n const e = up.element\n\n function reset() {\n // Resets the list of registered event listeners to the\n // moment when the framework was booted.\n for (let globalElement of [window, document, e.root, document.body]) {\n for (let listener of up.EventListener.allNonDefault(globalElement)) {\n listener.unbind()\n }\n }\n }\n\n /*-\n Listens to a [DOM event](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Events)\n on `document` or a given element.\n\n `up.on()` has some quality of life improvements over\n [`Element#addEventListener()`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener):\n\n - You may pass a selector for [event delegation](https://davidwalsh.name/event-delegate).\n - The [event target](https://developer.mozilla.org/en-US/docs/Web/API/Event/target) is automatically passed as a second argument.\n - Your event listener will not be called when Unpoly has not [booted](/api/up.boot) in an unsupported browser\n - You may register a listener to multiple events by passing a space-separated list of event names (e.g. `\"click mousedown\"`)\n - You may register a listener to multiple elements in a single `up.on()` call, by passing a [list](/api/List) of elements.\n - Any [data attached to the observed element](/learn/data) will be passed as a third argument to your handler function.\n\n You can prevent the event from being processed further with [up.event.halt(event)](/api/up.event.halt).\n\n ### Basic example\n\n The code below will call the listener when a `<a>` is clicked\n anywhere in the `document`:\n\n ```js\n up.on('click', 'a', function(event, element) {\n console.log(\"Click on a link %o\", element)\n })\n ```\n\n You may also bind the listener to a given element instead of `document`:\n\n ```js\n let form = document.querySelector('form')\n up.on(form, 'click', function(event, form) {\n console.log(\"Click within %o\", form)\n })\n ```\n\n ### Event delegation\n\n You may pass both an element and a selector\n for [event delegation](https://davidwalsh.name/event-delegate).\n\n The example below registers a single event listener to the given `form`,\n but only calls the listener when the clicked element is a `select` element:\n\n ```\n let form = document.querySelector('form')\n up.on(form, 'click', 'select', function(event, select) {\n console.log(\"Click on select %o within %o\", select, form)\n })\n ```\n\n ### Attaching data\n\n Any [data attached to the observed element](/learn/data) will be passed to your event handler.\n\n For instance, this element has attached data in its `[up-data]` attribute:\n\n ```html\n <span class=\"user\" up-data=\"{ age: 18, name: 'Bob' }\">Bob</span>\n ```\n\n The parsed data will be passed to your event handler as a third argument:\n\n ```js\n up.on('click', '.user', function(event, element, data) {\n console.log(\"This is %o who is %o years old\", data.name, data.age)\n })\n ```\n\n ### Unbinding an event listener\n\n `up.on()` returns a function that unbinds the event listeners when called:\n\n ```js\n // Define the listener\n let listener = function(event) { ... }\n\n // Binding the listener returns an unbind function\n let unbind = up.on('click', listener)\n\n // Unbind the listener\n unbind()\n ```\n\n There is also a function [`up.off()`](/api/up.off) which you can use for the same purpose:\n\n ```js\n // Define the listener\n let listener = function(event) { ... }\n\n // Bind the listener\n up.on('click', listener)\n\n // Unbind the listener\n up.off('click', listener)\n ```\n\n ### Binding to multiple elements\n\n You may register a listener to multiple elements in a single `up.on()` call, by passing a [list](/api/List) of elements:\n\n ```js\n let allForms = document.querySelectorAll('form')\n up.on(allForms, 'submit', function(event, form) {\n console.log('Submitting form %o', form)\n })\n ```\n\n ### Binding to multiple event types\n\n You may register a listener to multiple event types by separating types with a space or comma:\n\n ```js\n let element = document.querySelector(...)\n up.on(element, 'mouseenter mouseleave', function(event) {\n console.log('Mouse entered or left')\n })\n ```\n\n @function up.on\n\n @section Observed events\n @param {Element|jQuery} [element=document]\n The element on which to register the event listener.\n\n If no element is given, the listener is registered on the `document`.\n\n @include up.on/after-element\n\n @stable\n @signature\n */\n function on(...args) {\n return buildListenerGroup(args).bind()\n }\n\n /*-\n Runs a callback when the given event is observed on the given element *or its ancestors*.\n\n ## Example\n\n ```js\n up.event.onClosest(element, 'click', function() {\n // chip: Someone clicked on element or its ancestors\n })\n ```\n\n @function up.event.onClosest\n @param {Element} element\n The element to observe with its ancestors.\n @param {string} eventType\n The event type to observe.\n @param {string|up.Layer} [options.layer]\n Only observe ancestors in the given [layer](/api/up.layer).\n\n The layer is looked up with the observed element as `{ origin }`.\n Pass `'origin'` to observe ancestors in the element's own layer.\n\n By default the callback runs for any ancestor in the DOM, including the element of a parent layer.\n @param {Function(event)} callback\n The callback to run.\n\n It will be called with the observed event.\n @return {Function}\n A function that unsubscribes the callback.\n\n When the element is destroyed, the callback will be unsubscribed automatically.\n @experimental\n */\n function onClosest(...args) {\n let [fragment, eventType, { layer }, callback] = u.args(args, 'val', 'val', 'options', 'callback')\n layer &&= up.layer.get(layer, { origin: fragment })\n let guard = (event) => event.target.contains(fragment) && (!layer || layer.contains(event.target))\n let unsubscribe = up.on(eventType, { guard }, callback)\n\n // Since we're binding to an element that is an ancestor of the fragment,\n // we should unregister the event listener when the fragment is removed.\n up.destructor(fragment, unsubscribe)\n return unsubscribe\n }\n\n /*-\n Unbinds an event listener previously bound with `up.on()`.\n\n ### Example\n\n Let's say you are listening to clicks on `.button` elements:\n\n ```js\n let listener = function() { ... }\n up.on('click', '.button', listener)\n ```\n\n You can stop listening to these events like this:\n\n ```js\n up.off('click', '.button', listener)\n ```\n\n @function up.off\n\n @section Observed events\n @param {Element|jQuery} [element=document]\n The element from which to unbind the listener.\n @include up.off/after-element\n @stable\n */\n function off(...args) {\n return buildListenerGroup(args).unbind()\n }\n\n function buildListenerGroup(args, options) {\n return up.EventListenerGroup.fromBindArgs(args, options)\n }\n\n function buildEmitter(args) {\n return up.EventEmitter.fromEmitArgs(args)\n }\n\n /*-\n Emits a custom event with the given name and properties.\n\n The event will be dispatched on the `document` or on the given element.\n\n You can listen to events of that type using\n [`addEventListener()`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener)\n or [`up.on()`](/api/up.on).\n\n ### Example\n\n ```js\n up.on('my:event', function(event) {\n console.log(event.foo)\n })\n\n up.emit('my:event', { foo: 'bar' })\n // Prints \"bar\" to the console\n ```\n\n @function up.emit\n\n @section Event\n @param {Element|jQuery} [target=document]\n The element on which the event is triggered.\n\n If omitted, the event will be emitted on the `document`.\n\n @param {string} eventType\n The event type, e.g. `my:event`.\n\n @param {Object} [props={}]\n A list of properties to become part of the event object that will be passed to listeners.\n\n @section Options\n @param {up.Layer|string|number} [props.layer]\n The [layer](/api/up.layer) on which to emit this event.\n\n If this property is set, the event will be emitted on the [layer's outmost element](/api/up.Layer.prototype.element).\n Also [up.layer.current](/api/up.layer.current) will be set to the given layer while event listeners\n are running.\n\n @param {Element|jQuery} [props.target=document]\n The element on which the event is triggered.\n\n Alternatively the target element may be passed as the first argument.\n\n @param {string|Array} [props.log]\n A message to print to the [log](/api/up.log) when the event is emitted.\n\n Pass `false` to not log this event emission.\n\n @experimental\n\n @return {Event}\n The emitted event object.\n @stable\n @signature\n */\n function emit(...args) {\n return buildEmitter(args).emit()\n }\n\n /*-\n Builds an event with the given type and properties.\n\n The returned event is not [emitted](/api/up.emit).\n\n ## Example\n\n ```js\n let event = up.event.build('my:event', { foo: 'bar' })\n console.log(event.type) // logs \"my:event\"\n console.log(event.foo) // logs \"bar\"\n console.log(event.defaultPrevented) // logs \"false\"\n up.emit(event) // emits the event\n ```\n\n @function up.event.build\n @param {string} [type]\n The event type.\n\n May also be passed as a property `{ type }`.\n @param {Object} [props={}]\n An object with event properties.\n @param {string} [props.type]\n The event type.\n\n May also be passed as a first string argument.\n @return {Event}\n The unemitted event object.\n @stable\n */\n function build(...args) {\n const props = u.extractOptions(args)\n const type = args[0] || props.type || up.fail('Missing event type')\n\n const event = new Event(type, { bubbles: true, cancelable: true })\n Object.assign(event, u.omit(props, ['type', 'target']))\n\n return event\n }\n\n /*-\n [Emits](/api/up.emit) the given event and throws an `up.Aborted` error if it was prevented.\n\n @function up.event.assertEmitted\n @param {string} eventType\n @param {Object} eventProps\n @param {string|Array} [eventProps.message]\n @return {Event}\n @internal\n */\n function assertEmitted(...args) {\n return buildEmitter(args).assertEmitted()\n }\n\n /*-\n Registers an event listener to be called when the user\n presses the `Escape` key.\n\n ### Example\n\n ```js\n up.event.onEscape(function(event) {\n console.log('Escape pressed!')\n })\n ```\n @function up.event.onEscape\n @param {Function(Event)} listener\n The listener function that will be called when `Escape` is pressed.\n @experimental\n */\n function onEscape(listener) {\n return on('keydown', function(event) {\n if (event.key === 'Escape') {\n return listener(event)\n }\n })\n }\n\n /*-\n Prevents the event from being processed further.\n\n In detail:\n\n - It prevents the event from bubbling up the DOM tree.\n - It prevents other event handlers bound on the same element.\n - It prevents the event's default action.\n\n ### Example\n\n ```js\n up.on('click', 'a.disabled', function(event) {\n up.event.halt(event)\n })\n ```\n\n @function up.event.halt\n @param {Event} event\n The event to stop processing for.\n @stable\n */\n function halt(event, options = {}) {\n if (options.log) up.log.putsEvent(event)\n event.stopImmediatePropagation()\n event.preventDefault()\n }\n\n const keyModifiers = ['metaKey', 'shiftKey', 'ctrlKey', 'altKey']\n\n /*-\n @function up.event.isModified\n @internal\n */\n function isModified(event) {\n return (event.button > 0) || u.some(keyModifiers, (modifier) => event[modifier])\n }\n\n /*-\n Returns whether the given click was made by JavaScript, e.g. with `element.click()` or `dispatchEvent()`.\n\n Clicks from a real mouse, touch or keyboard are trusted by the browser.\n A click made by code has no meaningful coordinates and no preceding `mousedown`,\n so `up.link.convertClicks()` skips its checks against mouse effects for such clicks.\n\n @function up.event.isSyntheticClick\n @param {Event} event\n @return {boolean}\n @internal\n */\n function isSyntheticClick(event) {\n return !event.isTrusted\n }\n\n function fork(originalEvent, newType, copyKeys = []) {\n const newEvent = build(newType, u.pick(originalEvent, copyKeys))\n newEvent.originalEvent = originalEvent; // allow users to access other props through event.originalEvent.prop\n\n ['stopPropagation', 'stopImmediatePropagation', 'preventDefault'].forEach(function(key) {\n const originalMethod = newEvent[key]\n\n return newEvent[key] = function() {\n originalEvent[key]()\n return originalMethod.call(newEvent)\n }\n })\n\n // If the source event was already prevented, the forked event should also be.\n if (originalEvent.defaultPrevented) {\n newEvent.preventDefault()\n }\n\n return newEvent\n }\n\n /*-\n Emits a custom event when this element is clicked.\n\n The event is emitted on this element and bubbles up to the `document`.\n To listen to the event, use [`addEventListener()`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener) or `up.on()`\n on the element, or on its ancestors.\n\n While the `[up-emit]` attribute is often used with an `<a>` or `<button>` element,\n you can also apply it to non-interactive elements, like a `<span>`.\n\n @learn-ref faux-interactive-elements\n\n ### Example\n\n This button will emit a `user:select` event when pressed:\n\n ```html\n <button type=\"button\" up-emit='user:select'>Alice</button>\n ```\n\n The event can be handled by a listener:\n\n ```js\n document.addEventListener('user:select', function(event) {\n up.reload('#user-details')\n })\n ```\n\n ### Event properties\n\n By default `[up-emit]` will emit an event with only basic properties like [`{ target }`](https://developer.mozilla.org/en-US/docs/Web/API/Event/target).\n\n To set custom properties on the event object, encode them as [relaxed JSON](/api/relaxed-json) in an `[up-emit-props]` attribute:\n\n ```html\n <button type=\"button\"\n up-emit=\"user:select\"\n up-emit-props=\"{ id: 5, firstName: 'Alice' }\">\n Alice\n </button>\n\n <script>\n up.on('user:select', function(event) {\n console.log(event.id) // logs 5\n console.log(event.firstName) // logs \"Alice\"\n })\n </script>\n ```\n\n ### Fallback URLs {#fallback}\n\n Use `[up-emit]` on a link to define a fallback URL that is rendered in case no listener handles the event:\n\n ```html\n <a href=\"/menu\" up-emit='menu:open'>Menu</a>\n ```\n\n When a listener has handled the `menu:open` event, it should call `event.preventDefault()`.\n This also prevents the original `click` event, causing the link to no longer be followed:\n\n ```js\n document.addEventListener('menu:open', function(event) {\n event.preventDefault() // prevent the link from being followed\n })\n ```\n\n If no listener prevents the `menu:open` event, the browser will [navigate](/api/up-follow)\n to the `/menu` path.\n\n > [tip]\n > When an [event closes an overlay](/learn/subinteractions#event-condition) via `[up-accept-event]` or `[up-dismiss-event]`, its default is prevented.\n > You can use fallback URLs to make a link that emits a closing event in an overlay, but navigates to a different page on the [root layer](/api/up.layer.root).\n\n\n @selector [up-emit]\n @param up-emit\n The [type](https://developer.mozilla.org/en-US/docs/Web/API/Event/type) of the event to be emitted, e.g. `my:event`.\n @param [up-emit-props='{}']\n The event properties, serialized as [relaxed JSON](/api/relaxed-json).\n @stable\n */\n function executeEmitAttr(event, element) {\n if (isModified(event)) { return }\n const eventType = e.attr(element, 'up-emit')\n const eventProps = e.jsonAttr(element, 'up-emit-props')\n const forkedEvent = fork(event, eventType)\n Object.assign(forkedEvent, eventProps)\n up.emit(element, forkedEvent)\n }\n\n on('up:click', '[up-emit]', executeEmitAttr)\n\n let inputDevices = ['unknown']\n\n /*-\n The class of input device used to cause the current event.\n\n It can assume one of the following values:\n\n | Value | Meaning |\n |--------------|-------------------------------------------------------------------------|\n | `'key'` | The event was caused by a keyboard interaction. |\n | `'pointer'` | The event was caused by an interaction via mouse, touch or stylus. |\n | `'unknown'` | The input device is unknown or this event was not caused by user input. |\n\n ## Example\n\n In event listeners, `up.event.inputDevice` returns the type of input device that caused the event:\n\n ```js\n document.addEventListener('mousedown', function() {\n console.log(up.event.inputDevice) // will print \"pointer\"\n })\n\n document.addEventListener('keydown', function() {\n console.log(up.event.inputDevice) // will print \"key\"\n })\n\n document.addEventListener('click', function() {\n // will print either \"pointer\" or \"key\", depending on\n // whether the link was activated with mouse or keyboard\n console.log(up.event.inputDevice)\n })\n ```\n\n ## Limitations\n\n Unpoly can only detect the input device when the user interacts with the document area.\n Interactions with browser-drawn UI elements (like the back button or scroll bar) cannot be detected:\n\n ```js\n window.addEventListener('scroll', function() {\n console.log(up.event.inputDevice) // will print \"unknown\"\n })\n ```\n\n\n @property up.event.inputDevice\n @param {string} inputDevice\n A string describing the current input device class.\n @experimental\n */\n function getInputDevice() {\n return u.last(inputDevices)\n }\n\n function observeInputDevice(newModality) {\n inputDevices.push(newModality)\n setTimeout(() => inputDevices.pop())\n }\n\n on('keydown keyup', { capture: true }, () => observeInputDevice('key'))\n on('pointerdown pointerup', { capture: true }, () => observeInputDevice('pointer'))\n\n on('up:framework:reset', reset)\n\n return {\n on,\n onClosest,\n off,\n build,\n emit,\n assertEmitted,\n onEscape,\n halt,\n isModified,\n isSyntheticClick,\n fork,\n keyModifiers,\n get inputDevice() { return getInputDevice() }\n }\n})()\n\nup.on = up.event.on\nup.off = up.event.off\nup.emit = up.event.emit\n","/*-\nHTTP headers that let your server inspect and steer Unpoly's rendering.\n\nRequest headers tell your server what Unpoly is about to render, and response headers let the server change what Unpoly does with the response. Ready-made implementations exist for popular frameworks, see [[protocol-implementations]]. `up.protocol.config` holds the CSRF token settings.\n\n@learn-ref backend-integration\n\n@module up.protocol\n*/\nup.protocol = (function() {\n\n const u = up.util\n const e = up.element\n\n const headerize = function(camel) {\n const header = camel.replace(/(^.|[A-Z])/g, (char) => '-' + char.toUpperCase())\n return 'X-Up' + header\n }\n\n const extractHeader = function(xhr, shortHeader, parseFn = u.identity) {\n let value = xhr.getResponseHeader(headerize(shortHeader))\n if (value) {\n return parseFn(value)\n }\n }\n\n /*-\n @function up.protocol.targetFromXHR\n @internal\n */\n function targetFromXHR(xhr) {\n return extractHeader(xhr, 'target')\n }\n\n /*-\n This request header contains the current Unpoly version to mark this request as a fragment update.\n\n Server-side code may check for the presence of an `X-Up-Version` header to\n distinguish [fragment updates](/api/up.link) from full page loads.\n\n The `X-Up-Version` header is guaranteed to be set for all [requests made through Unpoly](/api/up.request).\n\n ### Example\n\n The user updates a fragment. Unpoly automatically includes the following request header:\n\n ```http\n X-Up-Version: 1.0.0\n ```\n\n The server chooses to render different HTML for Unpoly requests, e.g. by excluding the document `<head>`\n and only rendering the `<body>`. The server responds with the following HTTP:\n\n ```http\n Vary: X-Up-Version\n\n <body>\n ...\n </body>\n ```\n\n @include vary-header-note\n\n @header X-Up-Version\n @stable\n */\n\n /*-\n The `X-Up-Target` request and response headers allow the server to [read](#request) or [change](#response)\n the [target selector](/learn/targeting-fragments) for a fragment update.\n\n Server-side code is free to [optimize its response](/learn/optimizing-responses) by only rendering HTML\n that matches the selector. For example, you might prefer to not render an\n expensive sidebar if the sidebar is not targeted.\n\n > [note]\n > Unpoly will often [update a different selector for an error response](/learn/error-responses#fail-options).\n > The target selector for error responses is sent as a separate request header (`X-Up-Fail-Target`).\n\n\n ## Detecting the targeted fragment on the server {#request}\n\n When the user updates a fragment `.menu`, Unpoly automatically includes the following request header:\n\n ```http\n X-Up-Target: .menu\n ```\n\n The server chooses to render only the HTML for the updating fragment.\n It responds with the following HTTP:\n\n ```http\n Vary: X-Up-Target\n\n <div class=\"menu\">...</div>\n ```\n\n ### Merging of request targets {#merging}\n\n When two [caching](/learn/caching) requests are sent to the same URL within the same [microtask](https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide),\n only a single request is sent. The request will contain both targets in its `X-Up-Target` header.\n\n For example, these two render passes render different selectors from `/path`:\n\n ```js\n up.render('.foo', { url: '/path', cache: true })\n up.render('.bar', { url: '/path', cache: true })\n ```\n\n Unpoly will send a single request with both targets:\n\n ```http\n GET /path HTTP/1.1\n X-Up-Target: .foo, .bar\n ```\n\n ### Optional targets are omitted {#optional-targets}\n\n An optional selector part (`:maybe` suffix) will be omitted from the `X-Up-Target` header unless it\n matches in the current page.\n\n Required selector parts are always included in the `X-Up-Target` header.\n\n @include vary-header-note\n\n\n ## Changing the render target from the server {#response}\n\n The server may change the render target context by including a CSS selector as an `X-Up-Target` header\n in its response.\n\n ```http\n Content-Type: text/html\n X-Up-Target: .selector-from-server\n\n <div class=\"selector-from-server\">\n ...\n </div>\n ```\n\n The frontend will use the `X-Up-Target` selector for both successful (HTTP status `200 OK`)\n and error (status `4xx` or `5xx`) responses. There is no <code autolink=\"false\">X-Up-Fail-Target</code>\n header in the response.\n\n\n ### Rendering nothing\n\n The server may send an `X-Up-Target: :none` response header with an empty body to skip the current render pass.\n\n Also see [rendering nothing](/learn/conditional-requests#rendering-nothing).\n\n @header X-Up-Target\n @stable\n @signature\n */\n\n /*-\n This request header contains the [target selector](/learn/targeting-fragments) that Unpoly updates when the server sends an [error response](/learn/error-responses).\n\n An error response has a status code other than 2xx, but still contains HTML.\n\n Server-side code is free to [optimize its response](/learn/optimizing-responses) to an error response by only rendering HTML\n that matches the provided selector. For example, you might prefer to not render an\n expensive sidebar if the sidebar is not targeted.\n\n ### Example\n\n ```http\n X-Up-Target: .menu\n X-Up-Fail-Target: body\n ```\n\n ### Signaling failed form submissions\n\n When [submitting a form](/learn/submitting-forms),\n Unpoly needs to know whether the form submission has failed (to update the form with\n validation errors) or succeeded (to update the `[up-target]` selector).\n\n For Unpoly to be able to detect a failed form submission, the response must\n return a non-2xx HTTP status code. We recommend using\n [HTTP 422](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422) (Unprocessable Entity).\n\n To do so in [Ruby on Rails](http://rubyonrails.org/), pass a [`:status` option to `render`](http://guides.rubyonrails.org/layouts_and_rendering.html#the-status-option):\n\n ```ruby\n class UsersController < ApplicationController\n\n def create\n user_params = params[:user].permit(:email, :password)\n @user = User.new(user_params)\n if @user.save\n sign_in @user\n else\n render 'form', status: :unprocessable_entity\n end\n end\n\n end\n ```\n\n The example uses Ruby on Rails, but works similarly with any other backend.\n\n @header X-Up-Fail-Target\n @stable\n */\n\n /*-\n This request header contains the targeted layer's [mode](/api/up.layer.mode).\n\n Server-side code is free to render different HTML for different modes.\n For example, you might prefer to not render a site navigation for overlays.\n\n ### Example\n\n The user updates a fragment `main` within a [drawer overlay](/learn/overlays#layer-modes).\n Unpoly automatically includes the following request headers:\n\n ```http\n X-Up-Mode: drawer\n X-Up-Target: main\n ```\n\n The server chooses to render only the HTML required for the overlay.\n It responds with the following HTTP:\n\n ```http\n Vary: X-Up-Mode\n\n <main>...</main>\n ```\n\n @include vary-header-note\n\n @header X-Up-Mode\n @stable\n */\n\n /*-\n This request header contains the [mode](/api/up.layer.mode) of the layer\n that Unpoly updates when the server sends an [error response](/learn/error-responses).\n\n An error response has a status code other than 2xx, but still contains HTML.\n\n Server-side code is free to render different HTML for different modes.\n For example, you might prefer to not render a site navigation for overlays.\n\n ### Example\n\n Assume we have the following form in a drawer overlay. The form targets\n the root layer:\n\n ```html\n <!-- label: Form within an overlay -->\n <form action=\"/submit\" up-submit up-layer=\"root\"> <!-- mark: up-layer=\"root\" -->\n ...\n </form>\n ```\n\n Because [failed form submissions update the `<form>` element](/learn/validation#changing-how-validation-errors-are-rendered),\n submitting this form will send the following headers:\n\n ```http\n X-Up-Mode: root\n X-Up-Fail-Mode: drawer\n ```\n\n @header X-Up-Fail-Mode\n @stable\n */\n\n /*-\n This request header contains the [mode](/api/up.layer.mode) of the layer\n from which the interaction [originated](/api/origin).\n\n Links or forms may target another layer than their own.\n The targeted layer is sent as an `X-Up-Mode` header.\n\n ## Example\n\n Assume we have the following link in a modal overlay. The link targets\n the root layer:\n\n ```html\n <!-- label: Link within an overlay -->\n <a href=\"/\" up-follow up-layer=\"root\">Click me</a> <!-- mark: up-layer=\"root\" -->\n ```\n\n When the link is clicked, the following request headers are sent:\n\n ```http\n X-Up-Mode: root\n X-Up-Origin-Mode: modal\n ```\n\n ## Interaction origins\n\n The origin element is automatically set for many actions, for example:\n\n @include default-origins\n\n When the origin element is unknown, this header is not sent.\n\n @header X-Up-Origin-Mode\n @experimental\n */\n\n /*-\n This response header contains a hash identifying the content in the response body.\n\n Typically, the ETag value is a hash of the underlying data that was rendered,\n or a hash of the data's last modification time.\n\n ETags can be used to prevent unnecessary re-rendering of unchanged content.\n See [Conditional requests](/learn/conditional-requests) for details and examples.\n\n ### Format\n\n A (weak) ETag typically looks like this:\n\n ```http\n ETag: W/\"55e4d42a148795d9f25f89d4\"\n ```\n\n For more information about an ETag's format, see\n [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) and [RFC 7232](https://www.rfc-editor.org/rfc/rfc7232#section-2.3).\n\n ### Alternatives\n\n Instead of sending this header, the server may also render fragments with `[up-etag]` attributes.\n\n @header ETag\n @stable\n */\n\n /*-\n This request header contains the ETag of a fragment that is being reloaded.\n\n The server can use the header value to prevent unnecessary re-rendering of unchanged content.\n See [Conditional requests](/learn/conditional-requests) for details and examples.\n\n The header is only set when Unpoly knows the ETag of the loading fragment.\n For this the fragment must have been rendered with an `ETag` response header or `[up-etag]` attribute.\n\n ### Format\n\n The `If-None-Match` header uses the same format as the `ETag` header:\n\n ```http\n If-None-Match: W/\"55e4d42a148795d9f25f89d4\"\n ```\n\n @header If-None-Match\n @stable\n */\n\n /*-\n This response header contains the time when the content in the response body was last modified.\n\n Last modification times can be used to prevent unnecessary re-rendering of unchanged content.\n See [Conditional requests](/learn/conditional-requests) for details and examples.\n\n ### Format\n\n The header value is a date/time in [RFC 1123](https://www.rfc-editor.org/rfc/rfc1123) format:\n\n ```http\n Last-Modified: Wed, 15 Nov 2000 13:11:22 GMT\n ```\n\n For a readable description of the time format, see [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified).\n\n ### Alternatives\n\n Instead of sending this header, the server may also render fragments with `[up-time]` attributes.\n\n @header Last-Modified\n @stable\n */\n\n /*-\n This request header contains the last modification time of a fragment that is being reloaded.\n\n The server can use the header value to prevent unnecessary re-rendering of unchanged content.\n See [Conditional requests](/learn/conditional-requests) for details and examples.\n\n The header is only set when Unpoly knows the last modification time of the loading fragment.\n For this the fragment must have been rendered with an `Last-Modified` response header or `[up-time]` attribute.\n\n ### Format\n\n The header value is a date/time in [RFC 1123](https://www.rfc-editor.org/rfc/rfc1123) format:\n\n ```http\n If-Modified-Since: Wed, 15 Nov 2000 13:11:22 GMT\n ```\n\n @header If-Modified-Since\n @stable\n */\n\n function parseModifyCacheValue(value) {\n if (value === 'false') {\n return false\n } else {\n return value\n }\n }\n\n function evictCacheFromXHR(xhr) {\n return extractHeader(xhr, 'evictCache', parseModifyCacheValue)\n }\n\n /*-\n The server may send this optional response header to control which previously [cached](/learn/caching)\n responses should be [evicted](/learn/caching#eviction) when this response is received.\n\n The value of this header is a [URL pattern](/api/url-patterns) matching responses that should be evicted.\n\n For example, to evict all responses to URLs starting with `/notes/`:\n\n ```http\n X-Up-Evict-Cache: /notes/*\n ```\n\n To evict all cache entries:\n\n ```http\n X-Up-Evict-Cache: *\n ```\n\n To evict nothing, send `false`:\n\n ```http\n X-Up-Evict-Cache: false\n ```\n\n @header X-Up-Evict-Cache\n @stable\n */\n\n\n function expireCacheFromXHR(xhr) {\n return extractHeader(xhr, 'expireCache', parseModifyCacheValue) ?? up.migrate.clearCacheFromXHR?.(xhr)\n }\n\n /*-\n The server may send this optional response header to control which previously [cached](/learn/caching)\n responses should be [expired](/learn/caching#expiration) when this response is received.\n\n The value of this header is a [URL pattern](/api/url-patterns) matching responses that should be expired.\n\n For example, to expire all responses to URLs starting with `/notes/`:\n\n ```http\n X-Up-Expire-Cache: /notes/*\n ```\n\n To expire all cache entries:\n\n ```http\n X-Up-Expire-Cache: *\n ```\n\n To expire nothing beyond what the client has already expired, send `false`:\n\n ```http\n X-Up-Expire-Cache: false\n ```\n\n ### Relation to the client-side default\n\n When Unpoly sends a non-GET request, it [expires the entire cache](/api/up.network.config#config.expireCache)\n before the server responds. This header can only expire *additional* entries.\n It cannot undo an expiration that has already happened.\n\n To keep the cache fresh after a non-GET request, configure the client instead.\n For example, set an [`[up-expire-cache=\"false\"]`](/api/up-follow#up-expire-cache) attribute\n on the link or form, or customize `up.network.config.expireCache`.\n\n @header X-Up-Expire-Cache\n @stable\n */\n\n function contextFromXHR(xhr) {\n return extractHeader(xhr, 'context', u.parseRelaxedJSON)\n }\n\n /*-\n This request header contains the targeted layer's [context](/learn/layer-context), serialized as JSON.\n\n ### Example\n\n The current layer has a context `{ lives: 3 }`.\n When the user updates a fragment, Unpoly automatically includes the following request headers:\n\n ```http\n X-Up-Context: { \"lives\": 3 }\n X-Up-Target: main\n ```\n\n The server may choose to render HTML based on that context, e.g. by including\n a live counter in the response. It responds with the following HTTP:\n\n ```http\n Vary: X-Up-Context\n\n <main>\n 3 lives left\n ...\n </main>\n ```\n\n @include vary-header-note\n\n ### Updating context from the server\n\n The server may update the layer context by sending a `X-Up-Context` response header with\n changed key/value pairs:\n\n ```http\n Content-Type: text/html\n X-Up-Context: { \"lives\": 2 }\n\n <html>\n ...\n </html>\n ```\n\n @include unicode-header-values\n\n Upon seeing the response header, Unpoly will merge the server-provided context object into\n the layer's context object, adding or replacing keys as needed.\n Client-side context keys not mentioned in the response will remain unchanged.\n\n There is no explicit protocol to *remove* keys from the context, but the server may send a key\n with a `null` value to effectively remove a key.\n\n The frontend will use the server-provided context updates for both successful (HTTP status `200 OK`)\n and error (status `4xx` or `5xx`) responses. If no `X-Up-Context` response header is set,\n the updating layer's context will not be changed.\n\n It is recommended that the server only places changed key/value pairs into the `X-Up-Context`\n response header, and not echo the entire context object. Otherwise any client-side changes made while\n the request was in flight will get overridden by the server-provided context.\n\n @header X-Up-Context\n @experimental\n */\n\n /*-\n This request header contains the [context](/learn/layer-context) of the layer\n that Unpoly updates when the server sends an [error response](/learn/error-responses), serialized as JSON.\n\n An error response has a status code other than 2xx, but still contains HTML.\n\n Server-side code is free to render different HTML for different contexts.\n\n ### Example\n\n ```http\n X-Up-Fail-Context: { \"lives\": 3 }\n ```\n\n @header X-Up-Fail-Context\n @experimental\n */\n\n /*-\n @function up.protocol.methodFromXHR\n @internal\n */\n function methodFromXHR(xhr) {\n return extractHeader(xhr, 'method', u.normalizeMethod)\n }\n\n /*-\n The server may set this optional response header to change the HTTP method after a fragment update.\n\n Without this header Unpoly will use the [requested method](/api/up.Request.prototype.method).\n\n ### Signaling the HTTP method after a redirect\n\n Without an `X-Up-Method` header, Unpoly will assume a `GET` method after a redirect.\n\n This assumption is correct for redirects with status codes 301, 302 and 303,\n and incorrect for the [less common codes 307 and 308](https://makandracards.com/makandra/501468-modern-http-status-codes-for-redirecting).\n\n Also for technical reasons Unpoly cannot detect redirects to the same URL, but using a different method. For example, when a request\n to `POST /users` redirects to `GET /users`.\n\n You can address both edge cases by including an `X-Up-Method` header in your responses.\n\n ### Example\n\n ```http\n X-Up-Location: /users\n X-Up-Method: GET\n ```\n\n @header X-Up-Method\n @stable\n */\n\n /*-\n @function up.protocol.titleFromXHR\n @internal\n */\n function titleFromXHR(xhr) {\n return up.migrate.titleFromXHR?.(xhr) ?? extractHeader(xhr, 'title', u.parseRelaxedJSON)\n }\n\n /*-\n The server may set this optional response header to change the document title after a fragment update.\n\n The title must be encoded as a [relaxed JSON](/api/relaxed-json) string.\n\n Without this header Unpoly will extract the `<title>` from the server response.\n\n This header is useful when you [optimize your response](/learn/optimizing-responses) to not render\n the application layout unless targeted. When your shortened response\n no longer includes a `<title>`, you can instead use this HTTP header to pass the document title.\n\n @include unicode-header-values\n\n ### Example\n\n ```http\n X-Up-Title: \"Playlist browser\"\n ```\n\n Note that the quotes must be included in the JSON-encoded header value.\n\n @header X-Up-Title\n @stable\n */\n\n /*-\n This request header contains the names of the [form fields being validated](/api/up-validate).\n\n When seeing this header, the server is [expected](/api/up-validate#backend-protocol)\n to validate (but not save) the form submission and render a new form state with validation errors.\n See the documentation for `[up-validate]` for more information\n on how server-side validation works in Unpoly.\n\n ### Example\n\n Let's look at a registration form that uses `[up-validate]` to validate form groups\n as the user completes fields:\n\n ```html\n <form action=\"/users\">\n\n <fieldset>\n <label for=\"email\">E-mail</label>\n <input type=\"text\" id=\"email\" name=\"email\" up-validate> <!-- mark: up-validate -->\n </fieldset>\n\n <fieldset>\n <label for=\"password\">Password</label>\n <input type=\"password\" id=\"password\" name=\"password\" up-validate> <!-- mark: up-validate -->\n </fieldset>\n\n <button type=\"submit\">Register</button>\n\n </form>\n ```\n\n When the `email` input is changed, Unpoly will submit the form with an\n additional `X-Up-Validate` header:\n\n ```http\n X-Up-Validate: email\n X-Up-Target: fieldset:has(#email)\n ```\n\n ### Batched validations\n\n If multiple validations are [batched](/api/up.validate#batching) into a single request,\n `X-Up-Validate` contains a space-separated list of all validating field names:\n\n ```http\n X-Up-Validate: email password\n X-Up-Target: fieldset:has(#password), fieldset:has(#email)\n ```\n\n ### When no origin field is known\n\n When `up.validate()` is called with a non-field element, Unpoly might not know\n which element triggered the validation. In that case the header value will be `:unknown`:\n\n ```http\n X-Up-Validate: :unknown\n X-Up-Target: .preview\n ```\n\n ### When too many fields are validated\n\n Validating a long form may cause the `X-Up-Validate` header to become excessively long.\n This may cause web infrastructure to reject the request with a `413 Entity Too Large` error.\n\n To prevent this, the header value is set to `:unknown` if its length exceeds `up.protocol.config.maxHeaderSize`.\n\n @header X-Up-Validate\n @stable\n @signature\n */\n\n function eventPlansFromXHR(xhr) {\n return extractHeader(xhr, 'events', u.parseRelaxedJSON)\n }\n\n /*-\n The server may set this response header to [emit events](/api/up.emit) with the\n requested [fragment update](/api/up-follow).\n\n The header value is a [relaxed JSON](/api/relaxed-json) array.\n Each element in the array is an object representing an event to be emitted\n on the `document`.\n\n The object property `{ \"type\" }` defines the event's [type](https://developer.mozilla.org/en-US/docs/Web/API/Event/type). Other properties become properties of the emitted event object.\n\n @include unicode-header-values\n\n ### Example\n\n ```http\n Content-Type: text/html\n X-Up-Events: [{ type: 'user:created', id: 5012 }, { type: 'signup:completed' }]\n ...\n\n <html>\n ...\n </html>\n ```\n\n ### Emitting an event on a layer\n\n Instead of emitting an event on the `document`, the server may also choose to\n [emit the event on the layer being updated](/api/up.layer.emit). To do so, add a property\n `{ layer: 'current' }` to the JSON object of an event:\n\n ```http\n Content-Type: text/html\n X-Up-Events: [{ type: 'user:created', name: 'foobar', layer: 'current' }]\n ...\n\n <html>\n ...\n </html>\n ```\n\n @header X-Up-Events\n @stable\n */\n\n function openLayerFromXHR(xhr) {\n // When no specific options are given, the server will send X-Up-Open-Layer: {}\n return extractHeader(xhr, 'openLayer', u.parseRelaxedJSON)\n }\n\n /*-\n The server can send this response header to force its response to [open a new overlay](/learn/opening-overlays).\n\n ## Basic example\n\n The following will select the [main](/api/main) element from the HTML payload\n and open it with a basic `modal` overlay:\n\n ```http\n Content-Type: text/html\n X-Up-Open-Layer: {}\n\n <html>\n <main>\n Overlay content\n </main>\n </html>\n ```\n\n ## Custom layer options {#options}\n\n When `X-Up-Open-Layer` is used without options, the new overlay will have the [default mode](/api/up.layer.config#config.mode) (`modal`), select a [main target](/api/main)\n and use [default navigation options](/api/up.fragment.config#config.navigateOptions).\n\n You can customize the target and appearance of the new overlay, by setting the header value to a [relaxed JSON](/api/relaxed-json) string\n with render options:\n\n ```http\n Content-Type: text/html\n X-Up-Open-Layer: { target: '#menu', mode: 'drawer', animation: 'fade-in' }\n\n <div id=\"menu\">\n Overlay content\n </div>\n ```\n\n Many options from `up.layer.open()` are supported.\n\n ### Callback options {#callbacks}\n\n Callbacks like `{ onAccepted }` or `{ onDismissed }` can be passed as a string of JavaScript:\n\n ```http\n Content-Type: text/html\n X-Up-Open-Layer: { onAccepted: 'up.reload(\"#users-list\")' }\n ```\n\n With a strict CSP you can [prefix your callback with a nonce](/learn/script-security#callback-nonces):\n\n ```http\n Content-Type: text/html\n X-Up-Open-Layer: { onAccepted: 'nonce-secret123 up.reload(\"#users-list\")' }\n ```\n\n To only reload an element after the overlay closes, pass a selector as `{ onAcceptedReload }` or `{ onDismissedReload }`.\n This runs no JavaScript, so it needs no nonce:\n\n ```http\n Content-Type: text/html\n X-Up-Open-Layer: { onAcceptedReload: '#users-list' }\n ```\n\n\n @header X-Up-Open-Layer\n @experimental\n */\n\n function acceptLayerFromXHR(xhr) {\n // Even if acceptance has no value, the server will send\n // X-Up-Accept-Layer: null\n return extractHeader(xhr, 'acceptLayer', u.parseRelaxedJSON)\n }\n\n /*-\n The server may set this response header to [accept](/api/up.layer.accept) the targeted overlay\n in response to a fragment update.\n\n Upon seeing the header, Unpoly will cancel the fragment update and accept the layer instead.\n\n The header value is the acceptance value serialized as a [relaxed JSON](/api/relaxed-json) value.\n To accept an overlay without value, set the header value to the string `null`.\n\n @include unicode-header-values\n\n ### Example\n\n The response below will accept the targeted overlay with the value `{ user_id: 1012 }`:\n\n ```http\n Content-Type: text/html\n X-Up-Accept-Layer: { user_id: 1012 }\n\n <html>\n ...\n </html>\n ```\n\n ### Rendering content\n\n The response may contain `text/html` content. If the root layer is targeted,\n the `X-Up-Accept-Layer` header is ignored and the fragment is updated with\n the response's HTML content.\n\n If you know that an overlay will be closed and don't want to render HTML,\n have the server change the render target to `:none`:\n\n ```http\n Content-Type: text/html\n X-Up-Accept-Layer: { user_id: 1012 }\n X-Up-Target: :none\n ```\n\n @header X-Up-Accept-Layer\n @stable\n @signature\n */\n\n function dismissLayerFromXHR(xhr) {\n // Even if dismissal has no value, the server will send\n // X-Up-Dismiss-Layer: null\n return extractHeader(xhr, 'dismissLayer', u.parseRelaxedJSON)\n }\n\n /*-\n The server may set this response header to [dismiss](/api/up.layer.dismiss) the targeted overlay\n in response to a fragment update.\n\n Upon seeing the header, Unpoly will cancel the fragment update and dismiss the layer instead.\n\n The header value is the dismissal value serialized as a [relaxed JSON](/api/relaxed-json) value.\n To dismiss an overlay without value, set the header value to the string `null`.\n\n @include unicode-header-values\n\n ### Example\n\n The response below will dismiss the targeted overlay without a dismissal value:\n\n ```http\n HTTP/1.1 200 OK\n Content-Type: text/html\n X-Up-Dismiss-Layer: null\n\n <html>\n ...\n </html>\n ```\n\n ### Rendering content\n\n The response may contain `text/html` content. If the root layer is targeted,\n the `X-Up-Dismiss-Layer` header is ignored and the fragment is updated with\n the response's HTML content.\n\n If you know that an overlay will be closed and don't want to render HTML,\n have the server change the render target to `:none`:\n\n ```http\n HTTP/1.1 200 OK\n Content-Type: text/html\n X-Up-Dismiss-Layer: { user_id: 1012 }\n X-Up-Target: :none\n ```\n\n @header X-Up-Dismiss-Layer\n @stable\n */\n\n /*-\n Server-side companion libraries like unpoly-rails set this cookie so we\n have a way to detect the request method of the initial page load.\n There is no JavaScript API for this.\n\n @function up.protocol.initialRequestMethod\n @internal\n */\n const initialRequestMethod = u.memoize(function() {\n return u.normalizeMethod(up.browser.popCookie('_up_method'))\n })\n\n /*-\n The server may set this optional cookie to echo the HTTP method of the initial request.\n\n When the initial page was loaded with a method other than `GET`, set a cookie with that method:\n\n ```http\n Set-Cookie: _up_method=POST\n ```\n\n The **simplest implementation** is to set this cookie for every request that is neither\n `GET` nor an [Unpoly request](/api/X-Up-Version). For all other requests\n an existing `_up_method` cookie should be deleted.\n\n When Unpoly boots it will look for this cookie and configure itself accordingly.\n The cookie is then deleted in order to not affect following requests.\n\n If the initial page was loaded with a non-`GET` HTTP method, Unpoly prefers to make a full\n page load when you try to update a fragment. Once the next page was loaded with a `GET` method,\n Unpoly will again update fragments. This fixes two edge cases:\n\n 1. Unpoly replaces the initial page state so it can later restore it when the user\n goes back to that initial URL. However, if the initial request was a POST,\n Unpoly will wrongly assume that it can restore the state by reloading with GET.\n 2. Some browsers have a bug where the initial request method is used for all\n subsequently pushed states. That means if the user reloads the page on a later\n GET state, the browser will wrongly attempt a POST request.\n This issue affected Safari 9-12.\n\n @cookie _up_method\n @stable\n */\n\n /*-\n @function up.protocol.locationFromXHR\n @internal\n */\n function locationFromXHR(xhr) {\n // We prefer the X-Up-Location header to xhr.responseURL.\n // If the server redirected to a new location, Unpoly-related headers\n // will be encoded in the request's query params like this:\n //\n // /redirect-target?_up[target]=.foo\n //\n // To prevent these these `_up` params from showing up in the browser URL,\n // the X-Up-Location header will omit these params while `xhr.responseURL`\n // will still contain them.\n let location = extractHeader(xhr, 'location') || xhr.responseURL\n if (location) {\n return u.normalizeURL(location)\n }\n }\n\n /*-\n The server may set this response header to set a custom browser location after a fragment update.\n\n Without an `X-Up-Location` header Unpoly will set the browser location to the\n [requested URL](/api/up.Request.prototype.url). After a redirect the URL of the last request is used.\n You only need to set `X-Up-Location` when you want to explicitly set a different URL.\n\n When setting `X-Up-Location` it is recommended to also set `X-Up-Method`.\n\n ### Example\n\n ```http\n X-Up-Location: /current-url\n X-Up-Method: GET\n ```\n\n ### Revealing an element\n\n The URL may contain a `#hash`, e.g. `X-Up-Location: /users#alice`. Unpoly then\n [reveals](/learn/scrolling) the element with that ID, like after following a link to `/users#alice`.\n A `#hash` in this header replaces any `#hash` of the requested URL.\n\n @header X-Up-Location\n @stable\n */\n\n /*-\n Request headers that influenced a response should be listed in a `Vary` response header.\n\n This tells Unpoly to [partition its cache](/learn/optimizing-responses#vary) for that URL so that each\n request header value gets a separate cache entry.\n\n You can set a `Vary` header manually from your server-side code. You may also be using\n a library like [unpoly-rails](https://github.com/unpoly/unpoly-rails) that sets the `Vary` header automatically.\n\n\n > [tip]\n > Server-side Unpoly apps may inspect [request headers](/api/up.protocol) to [customize or shorten responses](/learn/optimizing-responses),\n > e.g. by omitting content that isn't [targeted](/learn/targeting-fragments).\n > When a response is optimized in that fashion, a `Vary` header should be sent.\n\n ### Example\n\n @include vary-header-example\n\n See [How cache entries are matched](/learn/optimizing-responses#cache-matching) for more examples.\n\n ### Resources\n\n - [RFC 9110: Vary](https://httpwg.org/specs/rfc9110.html#field.vary)\n - [MDN: Vary](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary)\n - [Key CDN: Vary](https://www.keycdn.com/support/vary-header)\n\n @header Vary\n @stable\n */\n\n /*-\n Configures strings used in the optional [server protocol](/api/up.protocol).\n\n @property up.protocol.config\n\n @section CSRF\n @param {string} [config.csrfHeader='X-CSRF-Token']\n The name of the HTTP header that will include the\n [CSRF token](https://en.wikipedia.org/wiki/Cross-site_request_forgery#Synchronizer_token_pattern)\n for requests made by Unpoly.\n\n @param {string|Function(): string} [config.csrfParam]\n The `name` of the hidden `<input>` used for sending a\n [CSRF token](https://en.wikipedia.org/wiki/Cross-site_request_forgery#Synchronizer_token_pattern) when\n the browser submits a form without Unpoly. For requests made by Unpoly the token is sent as an\n [HTTP header](/api/up.protocol.config#config.csrfHeader) instead.\n\n The parameter name can be configured as a string or as function that returns the parameter name.\n If no name is set, no token will be sent.\n\n Defaults to the `content` attribute of a `<meta>` tag named `csrf-param`:\n\n ```html\n <meta name=\"csrf-param\" content=\"authenticity_token\">\n ```\n\n @param {string|Function(): string} [config.csrfToken]\n The [CSRF token](https://en.wikipedia.org/wiki/Cross-site_request_forgery#Synchronizer_token_pattern)\n to send for unsafe requests. The token will be sent as either an HTTP header (for requests made by Unpoly)\n or a hidden form `<input>` (for form submissions without Unpoly).\n\n The token can either be configured as a string or as function that returns the token.\n If no token is set, no token will be sent.\n\n Defaults to the `content` attribute of a `<meta>` tag named `csrf-token`:\n\n ```\n <meta name='csrf-token' content='secret12345'>\n ```\n\n @section Method wrapping\n @param {string} [config.methodParam='_method']\n The name of request parameter containing the original request method when Unpoly needs to\n [wrap](/api/up.network.config#config.wrapMethod) the method.\n\n Methods must be wrapped when making a [full page request](/api/up.network.loadPage) with a methods other\n than GET or POST. In this case Unpoly will make a POST request with the original request method\n in a form parameter named `_method`:\n\n ```http\n POST /test HTTP/1.1\n Host: example.com\n Content-Type: application/x-www-form-urlencoded\n Content-Length: 11\n\n _method=PUT\n ```\n\n @section Header size\n @param {number} [config.maxHeaderSize]\n The preferred maximum length of an `X-Up`-prefixed header's value.\n\n This is currently only honored for `X-Up-Validate`.\n\n @experimental\n\n @stable\n */\n const config = new up.Config('up.protocol.config', () => ({\n methodParam: '_method',\n csrfParam() { return e.metaContent('csrf-param') },\n csrfToken() { return e.metaContent('csrf-token') },\n // TODO: Let's move config.cspNonce() to up.script.config after all\n csrfHeader: 'X-CSRF-Token', // Used by Rails. Other frameworks use different headers.\n maxHeaderSize: 2048,\n }))\n\n function csrfHeader() {\n return u.evalOption(config.csrfHeader)\n }\n\n function csrfParam() {\n return u.evalOption(config.csrfParam)\n }\n\n function csrfToken() {\n return u.evalOption(config.csrfToken)\n }\n\n function wrapMethod(method, params) {\n params.add(config.methodParam, method)\n return 'POST'\n }\n\n return {\n config,\n locationFromXHR,\n titleFromXHR,\n targetFromXHR,\n methodFromXHR,\n openLayerFromXHR,\n acceptLayerFromXHR,\n contextFromXHR,\n dismissLayerFromXHR,\n eventPlansFromXHR,\n expireCacheFromXHR,\n evictCacheFromXHR,\n csrfHeader,\n csrfParam,\n csrfToken,\n initialRequestMethod,\n headerize,\n wrapMethod,\n }\n})()\n","/*-\nFeatures to log Unpoly's activity to the browser console.\n\nBy default only errors are logged. Call `up.log.enable()` to turn on debug logging and `up.log.disable()` to turn it off again. `up.log.config` adjusts the output, like the banner and CSS formatting.\n\n<figure>\n <img src=\"images/log-interaction-event.png\" alt=\"Screenshot of Unpoly's log in the browser console\" width=\"800\">\n <figcaption>\n\nThe log of a user hovering over a link and then clicking it. The link opens a modal overlay.\nEach line starts with a badge that names the event or function that logged it, followed by a message.\nHovering (`mouseenter`) preloads the link: `up:link:preload`, `up:request:load`, `up:request:loaded`.\nClicking (`mousedown`) follows the link and re-uses the preloaded request.\nThe next lines show the fragment being loaded, a new overlay opening, the location changing,\ncompilers running on the new fragment and, last, `up:layer:opened`.\n\n </figcaption>\n</figure>\n\n@module up.log\n*/\nup.log = (function() {\n\n const u = up.util\n\n /*-\n Configures the logging output to the developer console.\n\n @property up.log.config\n @param {boolean} [config.enabled=false]\n Whether Unpoly will print debugging information to the developer console.\n\n Debugging information includes which elements are being [compiled](/api/up.script)\n and which [events](/api/up.event) are being emitted.\n Note that errors will always be printed, regardless of this setting.\n @param {boolean} [config.banner=true]\n Print the Unpoly banner to the developer console.\n @param {boolean} [config.format]\n Format output using CSS.\n\n Defaults to `true` in normal browsers.\n Defaults to `false` in browsers controlled by automation software like Selenium, Playwright or Puppeteer\n (when [`navigator.webdriver`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver) is `true`).\n This keeps the log readable for test runners and coding agents that read the console as plain text.\n @stable\n */\n const config = new up.LogConfig()\n\n\n /*-\n Prints a logging message to the browser console.\n\n @function up.puts\n @param {string} context\n @param {string} message\n @param {Array} ...args\n @internal\n */\n function printToStandard(...args) {\n if (config.enabled) {\n printToStream('log', ...args)\n }\n }\n\n /*-\n @function up.warn\n @internal\n */\n const printToWarn = (...args) => printToStream('warn', ...args)\n\n /*-\n @function up.log.error\n @internal\n */\n const printToError = (...args) => printToStream('error', ...args)\n\n function printToStream(stream, prefix, message, ...args) {\n printToStreamStyled(stream, prefix, '', message, ...args)\n }\n\n function printToStreamStyled(stream, prefix, customStyles, message, ...args) {\n if (message) {\n if (config.format) {\n console[stream](\n `%c${prefix}%c ${message}`,\n 'color: #666666; padding: 1px 3px; border: 1px solid #bbbbbb; border-radius: 2px; font-size: 90%; display: inline-block;' + customStyles,\n '', // reset for message after trace\n ...args\n )\n } else {\n console[stream](`[${prefix}] ${u.sprintf(message, ...args)}`)\n }\n }\n }\n\n // With multiple watchers on the same field we only want to print once.\n let lastPrintedUserEvent\n\n function printUserEvent(event) {\n if (config.enabled && lastPrintedUserEvent !== event) {\n lastPrintedUserEvent = event\n let originalEvent = event.originalEvent || event\n let color = '#5566cc'\n printToStreamStyled('log', originalEvent.type, `color: white; border-color: ${color}; background-color: ${color}`, 'Interaction on %o', originalEvent.target)\n }\n }\n\n function printBanner() {\n if (!config.banner) { return }\n\n // The ASCII art looks broken in code since we need to escape backslashes\n const logo =\n \" __ _____ ___ ___ / /_ __\\n\" +\n `/ // / _ \\\\/ _ \\\\/ _ \\\\/ / // / ${up.version}\\n` +\n \"\\\\___/_//_/ .__/\\\\___/_/\\\\_. / \\n\" +\n \" / / / /\\n\\n\"\n\n let text = \"\"\n\n if (!up.migrate.loaded) {\n text += \"Load unpoly-migrate.js to polyfill deprecated APIs.\\n\\n\"\n }\n\n if (config.enabled) {\n text += \"Call `up.log.disable()` to disable logging for this session.\"\n } else {\n text += \"Call `up.log.enable()` to enable logging for this session.\"\n }\n\n const color = 'color: #777777'\n\n if (config.format) {\n console.log('%c' + logo + '%c' + text, 'font-family: monospace;' + color, color)\n } else {\n console.log(logo + text)\n }\n }\n\n up.on('up:framework:boot', printBanner)\n\n\n /*-\n Starts printing debugging information to the developer console.\n\n Debugging information includes which elements are being [compiled](/api/up.script)\n and which [events](/api/up.event) are being emitted.\n\n Errors will always be printed, regardless of this setting.\n\n @function up.log.enable\n @stable\n @signature\n */\n function enable() {\n config.enabled = true\n }\n\n /*-\n Stops printing debugging information to the developer console.\n\n Errors will still be printed, even with logging disabled.\n\n @function up.log.disable\n @stable\n @signature\n */\n function disable() {\n config.enabled = false\n }\n\n return {\n puts: printToStandard,\n putsEvent: printUserEvent,\n error: printToError,\n warn: printToWarn,\n config,\n enable,\n disable,\n }\n})()\n\nup.puts = up.log.puts\nup.warn = up.log.warn\n","/*-\nFeatures to attach JavaScript behavior to HTML elements whenever they enter the page.\n\nRegister a compiler with `up.compiler()`. It can return a destructor that cleans up when the element is removed, or you register one with `up.destructor()`. Elements pass structured data to their compilers through an `[up-data]` attribute, which `up.data()` reads. Macros registered with `up.macro()` run before all other compilers, usually to set other Unpoly attributes on the element.\n\nWhen your own code inserts HTML into the page, call `up.hello()` on the new element so its compilers run. Elements marked `[up-asset]` track your scripts and stylesheets, so Unpoly can notice when a new version was deployed.\n\n@learn-ref scripting\n\n@module up.script\n*/\nup.script = (function() {\n\n const u = up.util\n const e = up.element\n\n /*-\n Configures defaults for script handling and asset tracking.\n\n @section Assets\n @param {Array<string>} [config.assetSelectors]\n An array of CSS selectors matching default [assets](/api/up-asset).\n\n By default, all remote scripts and stylesheets in the `<head>` are considered assets.\n [Inline scripts](https://simpledev.io/lesson/inline-script-javascript-1/) and\n [internal styles](https://www.tutorialspoint.com/How-to-use-internal-CSS-Style-Sheet-in-HTML)\n are not tracked by default, but you can include them with an `[up-asset]` attribute.\n\n Unpoly only tracks assets in the `<head>`. Elements in the `<body>` are never tracked,\n even if they match one of the configured selectors.\n\n See [Tracking assets](/learn/handling-asset-changes#tracking-assets) for examples.\n\n @param {Array<string>} [config.noAssetSelectors]\n Exceptions to `up.script.config.assetSelectors`.\n\n Matching elements will *not* be considered [assets](/api/up-asset),\n even if they match `up.script.config.assetSelectors`.\n\n @section Scripts\n @param {Array<string>} [config.scriptSelectors]\n An array of CSS selectors matching elements that run JavaScript.\n\n By default, this matches all `<script>` elements with a JavaScript type.\n\n This configuration does not affect what Unpoly considers [assets](/api/up-asset).\n For this, configure `up.script.config.assetSelectors`.\n\n @param {Array<string>} [config.noScriptSelectors]\n Exceptions to `up.script.config.scriptSelectors`.\n\n @param {string} [config.evalCallbackPolicy='auto']\n Whether Unpoly will [run callbacks in HTML attributes](/learn/script-security#attribute-callbacks) like [`[up-on-loaded]`](/api/up-follow#up-on-loaded).\n\n @param {string} [config.scriptElementPolicy='auto']\n Whether Unpoly will [run `<script>` elements in new fragments](/learn/script-security#script-elements).\n\n @param {string|Function(): string} [config.cspNonce]\n A [CSP script nonce](https://content-security-policy.com/nonce/)\n for the initial page that [booted](/api/up.boot) Unpoly.\n\n The nonce lets Unpoly run JavaScript in HTML attributes like\n [`[up-on-loaded]`](/api/up-follow#up-on-loaded) or [`[up-on-accepted]`](/api/up-layer-new#up-on-accepted).\n See [Restricting callbacks with nonces](/learn/script-security#callback-nonces).\n\n The nonce can either be configured as a string or as a function that returns the nonce.\n\n Defaults to the `content` attribute of a `<meta>` tag named `csp-nonce`:\n\n ```\n <meta name='csp-nonce' content='secret4367243'>\n ```\n\n @param {boolean} [config.cspWarnings=true]\n Whether Unpoly will print a warning when it observes a potentially unsafe `Content-Security-Policy` header.\n\n @property up.script.config\n @stable\n */\n const config = new up.Config('up.script.config', () => ({\n cspNonce() { return e.metaContent('csp-nonce') },\n cspWarnings: true,\n scriptElementPolicy: 'auto',\n evalCallbackPolicy: 'auto',\n assetSelectors: [\n 'link[rel=stylesheet]',\n 'script[src]',\n '[up-asset]'\n ],\n noAssetSelectors: [\n '[up-asset=false]',\n ],\n nonceableAttributes: [\n 'up-watch',\n 'up-on-keep',\n 'up-on-hungry',\n 'up-on-opened',\n 'up-on-accept',\n 'up-on-accepted',\n 'up-on-dismiss',\n 'up-on-dismissed',\n 'up-on-loaded',\n 'up-on-rendered',\n 'up-on-finished',\n 'up-on-error',\n 'up-on-offline',\n ],\n scriptSelectors: [\n 'script:not([type])',\n 'script[type=\"text/javascript\"]',\n 'script[type=\"module\"]',\n 'script[type=\"importmap\"]',\n ],\n noScriptSelectors: [\n 'script[type=\"application/ld+json\"]'\n ]\n }))\n\n const SYSTEM_MACRO_PRIORITIES = {\n '[up-back]': -100, // sets [up-href] to previous URL\n '[up-clickable]': -200, // A11y for link-like elements\n '[up-drawer]': -200, //\n '[up-modal]': -200, //\n '[up-cover]': -200, //\n '[up-popup]': -200, //\n '[up-tooltip]': -200, //\n '[up-dash]': -200, // sets [up-href] unless already set, also other [up-*] attributes\n '[up-flashes]': -200, //\n '[up-expand]': -300, // distributes [up-*] attributes to parents\n '[data-method]': -400, // converts [data-method] to [up-method] only if link has followable [up-*] attributes\n '[data-confirm]': -400, // converts [data-confirm] to [up-confirm] only if link has followable [up-*] attributes\n '[up-keep]': 9999999999, // cache the identity of e.g. [up-keep=\"same-html\"] before any client-side changes\n }\n\n let registeredCompilers = []\n let registeredMacros = []\n\n /*-\n Registers a function to be called when Unpoly inserts a matching element.\n\n @learn-ref enhancing-elements\n\n ## When compilers are called\n\n A compiler is called for matching elements:\n\n - on the initial page, when Unpoly [boots](/api/up.boot)\n - in every new fragment that Unpoly renders\n - in elements that you pass to [`up.hello()`](/api/up.hello)\n\n Elements that other code inserts, e.g. a framework like React, are not compiled automatically.\n See [compiling elements inserted by other code](/learn/enhancing-elements#hello).\n\n ## Anatomy of a compiler\n\n This code registers a function that is called when an element with a `.foo` class\n is inserted:\n\n ```js\n up.compiler('.foo', function(element, data, meta) {\n // do something with `element`\n })\n ```\n\n The compiler function is passed three arguments:\n\n 1. The newly inserted `element` matching the selector\n 2. Any [data attached to the element](/learn/data)\n 3. [Meta information](/learn/enhancing-elements#meta) about the current render pass\n\n ## Destructor functions {#destructor}\n\n When a compiler registers effects *outside* the compiling element's subtree,\n it must return a destructor function that reverts the effect. The destructor\n function is called automatically when the element is swapped or destroyed later.\n\n Examples of non-local effects are global event handlers bound to\n the `document`, or `setInterval()`:\n\n ```js\n up.compiler('.current-time', function(element) {\n let update = () => element.textContent = new Date().toString()\n let updateInterval = setInterval(update, 1000)\n return () => clearInterval(updateInterval)\n })\n ```\n\n See [cleaning up after yourself](/learn/enhancing-elements#destructor)\n for more details and examples.\n\n ## Batching multiple elements\n\n When multiple elements in an update match the selector, the compiler function\n is called once for each element.\n\n Let's say a fragment with three `.card` elements is inserted and compiled:\n\n ```html\n <div class=\"fragment\">\n <div class=\"card\">...</div>\n <div class=\"card\">...</div>\n <div class=\"card\">...</div>\n </div>\n ```\n\n A compiler function for `.card` would be called three separate times:\n\n ```js\n up.compiler('.card', function(card, data) {\n // chip: called three times\n })\n ```\n\n If you would like the compiler to run *once* for all matches within\n a render pass, use the `{ batch: true }` option:\n\n ```js\n up.compiler('.card', { batch: true }, function(cards, datas) {\n console.debug(`We have ${cards.length} new cards`)\n })\n ```\n\n\n ## Error handling {#errors}\n\n It is safe to throw exceptions from a compiler or its [destructor](#destructor).\n A crashing compiler will *not* interrupt a render pass or prevent other compilers on the same element.\n\n Exceptions thrown by compiler functions are logged to the browser's [error console](https://developer.mozilla.org/en-US/docs/Web/API/console/error).\n Unpoly also emits an [`error` event on `window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/error_event).\n\n See [errors in user code](/learn/render-lifecycle#errors-in-user-code) for details.\n\n ## Compilation order {#order}\n\n Compilers are called in the order they were registered.\n\n You can control the order by passing a `{ priority }` option.\n The default priority is `0`. Compilers with a higher priority are run first.\n\n ```js\n up.compiler('.foo', { priority: 999 }, function() {\n // called before compilers with a lower priority\n })\n ```\n\n When a compiler sets an Unpoly attribute, this usually has no effect since attributes have already been evaluated.\n Use a [macro](/api/up.macro) instead.\n\n See [Rendering lifecycle](/learn/render-lifecycle) for a full overview of\n Unpoly's rendering steps.\n\n ## Asynchronous compilers {#async}\n\n Compiler functions can be [`async`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function).\n This is useful when a compiler needs to fetch network resources\n or when calling a library with an asynchronous API:\n\n ```js\n up.compiler('textarea.wysiwyg', async function(textarea) { // mark: async\n let editor = await import('wysiwyg-editor') // mark: await\n editor.init(textarea)\n })\n ```\n\n You can also use this to split up expensive tasks, giving the browser a chance\n to render and process user input:\n\n ```js\n up.compiler('.element', async function(element) {\n doRenderBlockingWork(element)\n await scheduler.yield() // mark-line\n doUserVisibleWork(element)\n })\n ```\n\n ### Cleaning up async work {#async-destructors}\n\n Like synchronous compilers, async compiler functions can return a [destructor function](#destructor):\n\n ```js\n up.compiler('textarea.wysiwyg', async function(textarea) {\n let editor = await import('wysiwyg-editor')\n editor.init(textarea)\n return () => editor.destroy(textarea) // mark-line\n })\n ```\n\n Unpoly guarantees that the destructor is called even if the element is destroyed\n before the compiler function terminates.\n\n ### Timing render-blocking mutations {#async-timing}\n\n Unpoly will run the first [task](https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/) of every compiler\n function before allowing the browser to render DOM changes. If an async compiler function runs for multiple tasks,\n the browser will render between tasks. If you have render-blocking mutations that should be hidden from the user,\n they must happen in the first task.\n\n <figure>\n <img src=\"images/compiler-tasks.svg\" alt=\"Timing diagram of compiler tasks and browser renders\" width=\"670\">\n <figcaption>\n\n After Unpoly updates the DOM, it runs synchronous compilers and the first task of each async compiler.\n Only then does the browser render. The promise returned by `up.render()` fulfills after this first task.\n The second task of an async compiler runs after the browser has rendered.\n `up.render().finished` fulfills only after that task is done.\n\n </figcaption>\n </figure>\n\n Async compilers will not delay the promise returned by rendering functions `up.render()` or `up.layer.open()`.\\\n Async compilers *will* delay the promise returned by [`up.render().finished`](/learn/render-lifecycle#postprocessing)\n and `up.hello()`.\n\n ## Registering compilers after booting {#late}\n\n When you [deliver your JavaScript in multiple files](https://makandracards.com/makandra/498036-webpacker-loading-code-on-demand),\n you may register compilers after Unpoly has booted.\n\n When compilers are registered after Unpoly has booted, they are run\n on current elements, but **only** if the compiler has the default priority.\n\n If the compiler has a non-default [priority](#order), it is run on future\n fragments only. In this case, either remove the `{ priority }` option\n or manually call `up.hello()` on an element that should be\n [recompiled](/api/up.hello#recompiling-elements).\n\n\n @function up.compiler\n\n @param {string} selector\n The selector to match.\n\n @param {number} [options.priority=0]\n The priority of this compiler.\n\n Compilers with a higher priority are run first.\n Two compilers with the same priority are run in the order they were registered.\n\n @param {boolean} [options.batch=false]\n If set to `true` and a fragment insertion contains multiple\n elements matching `selector`, the `compiler` function is only called once\n with all these elements.\n\n @param {Function(element, data, meta): (Function|Array<Function>|Promise<Function>|undefined)} compiler\n The function to call when an element matching `selector` is inserted.\n\n Up to three arguments can be accepted:\n\n 1. The newly inserted `element` matching the selector\n 2. Any [data attached to the element](/learn/data)\n 3. [Meta information](/learn/enhancing-elements#meta) about the current render pass\n\n The function may return a [destructor function](/learn/enhancing-elements#destructor) that is called\n before it is removed from the DOM. The destructor function is called with the compiled element.\n\n The compiler function can be [`async`](/api/up.compiler#async).\n\n @stable\n @signature\n */\n function registerCompiler(...args) {\n registerProcessor(args)\n }\n\n /*-\n Registers a [compiler](/learn/enhancing-elements) that is run before all other compilers.\n\n @learn-ref enhancing-elements#macros\n\n A macro lets you set attributes that will be compiled afterward.\n\n If you want default attributes for *every* link and form, consider customizing your\n [navigation options](/learn/navigation-defaults) or configuring Unpoly to [handle everything](/learn/handling-all-links).\n\n ## Example\n\n In this example every link opens a modal with a [custom animation](/api/up.animation) `shake`:\n\n ```html\n <a href=\"/page1\" up-layer=\"new modal\" up-class=\"warning\" up-animation=\"shake\">Page 1</a>\n <a href=\"/page2\" up-layer=\"new modal\" up-class=\"warning\" up-animation=\"shake\">Page 2</a>\n <a href=\"/page3\" up-layer=\"new modal\" up-class=\"warning\" up-animation=\"shake\">Page 3</a>\n ```\n\n A new `[shake-modal]` attribute would make the same links shorter:\n\n ```html\n <a href=\"/page1\" shake-modal>Page 1</a>\n <a href=\"/page2\" shake-modal>Page 2</a>\n <a href=\"/page3\" shake-modal>Page 3</a>\n ```\n\n We can define the `[shake-modal]` attribute by registering a macro that\n sets the `[up-layer]`, `[up-class]`, and `[up-animation]` attributes for us:\n\n ```js\n up.macro('[shake-modal]', function(link) {\n link.setAttribute('up-layer', 'new modal')\n link.setAttribute('up-class', 'warning')\n link.setAttribute('up-animation', 'shake')\n })\n ```\n\n @function up.macro\n\n @param selector\n @like up.compiler\n\n @param [options.priority]\n @like up.compiler\n\n @param [options.batch]\n @like up.compiler\n\n @param macro\n @like up.compiler/compiler\n @stable\n @signature\n */\n function registerMacro(...args) {\n registerProcessor(args, { macro: true })\n }\n\n function registerAttrCompiler(...args) {\n let [attr, options, valueCallback] = parseProcessorArgs(args)\n\n let selector = `[${attr}]`\n let { defaultValue } = options\n\n let callback = (element) => {\n let value = e.booleanOrStringAttr(element, attr)\n\n // Do nothing in a case like [up-defer=false]\n if (value === false) return\n\n // Some attributes have a default value in case no value is given.\n // E.g. [up-defer=\"\"] or [up-defer=\"true\"] defaults to [up-defer=\"insert\"].\n if (u.isDefined(defaultValue) && value === true) value = defaultValue\n\n return valueCallback(element, value)\n }\n registerProcessor([selector, options, callback])\n }\n\n function detectSystemMacroPriority(macroSelector) {\n macroSelector = u.evalOption(macroSelector)\n for (let substr in SYSTEM_MACRO_PRIORITIES) {\n if (macroSelector.indexOf(substr) >= 0) {\n return SYSTEM_MACRO_PRIORITIES[substr]\n }\n }\n up.fail('Unregistered priority for system macro %o', macroSelector)\n }\n\n function registerProcessor(args, overrides = {}) {\n let processor = buildProcessor(args, overrides)\n\n if (processor.macro) {\n if (up.framework.evaling) {\n // Don't allow the default priority (0) for Unpoly's own macros.\n processor.priority ||= detectSystemMacroPriority(processor.selector)\n\n }\n insertProcessor(registeredMacros, processor)\n } else {\n insertProcessor(registeredCompilers, processor)\n }\n\n }\n\n const parseProcessorArgs = function(args) {\n return u.args(args, 'val', 'options', 'callback')\n }\n\n function buildProcessor(args, overrides) {\n let [selector, options, callback] = parseProcessorArgs(args)\n\n options = u.options(options, {\n selector,\n isDefault: up.framework.evaling,\n priority: 0,\n batch: false,\n rerun: false,\n })\n return Object.assign(callback, options, overrides)\n }\n\n function insertProcessor(queue, newCompiler) {\n let existingCompiler\n let index = 0\n while ((existingCompiler = queue[index]) && (existingCompiler.priority >= newCompiler.priority)) {\n index += 1\n }\n queue.splice(index, 0, newCompiler)\n\n if (up.framework.booted) {\n if (newCompiler.priority === 0) {\n for (let layer of up.layer.stack) {\n hello(layer.element, { layer, compilers: [newCompiler], macros: [], insertedEvent: false })\n }\n } else {\n up.puts('up.compiler()', 'Compiler with priority (%s) was registered after booting Unpoly. Compiler will run for future fragments only.', newCompiler.selector)\n }\n }\n\n return newCompiler\n }\n\n /*-\n Registers a function to be called when the given element\n is destroyed.\n\n @learn-ref enhancing-elements#destructor\n\n Elements are destroyed when they are swapped during a render pass, when their [layer](/api/up.layer)\n closes, or when `up.destroy()` is called on the element or its container.\n\n An alternative way to register a destructor function is to\n [return it from your compiler function](/learn/enhancing-elements#destructor).\n\n ## Example\n\n The code below will log a message when `element` exits the DOM:\n\n ```js\n let element = document.querySelector('.element')\n up.destructor(element, () => console.log('Element was destroyed!'))\n ```\n\n ## Registration time\n\n The element should be attached when the destructor is registered. This is commonly done during\n [compilation](/learn/enhancing-elements).\n\n If called on a detached element, Unpoly assumes\n an [async compiler](/api/up.compiler#async) has registered the destructor after the element has been destroyed.\n The destructor is then run immediately.\n\n ## Reusing destructor functions\n\n You may reuse the same destructor function for multiple elements.\n The destructor function is called with the element being destroyed:\n\n ```js\n let fn = (element) => console.log('Element %o was destroyed', element)\n\n for (let element of document.querySelectorAll('div')) {\n up.destructor(element, fn)\n }\n ```\n\n @function up.destructor\n @param {Element} element\n The element to observe.\n @param {Function(Element)|Array<Function(Element)>} destructor\n One or more destructor functions.\n @stable\n */\n function registerDestructor(element, value) {\n let fns = u.scanFunctions(value)\n if (!fns.length) return\n\n // (A) If the element has already been destroyed, registering a destructor function\n // has no effect. No one will ever look at the destructor registry again.\n // In this case we immediately call the destructor function.\n // (B) Because destructors are called *after* an destroy animation, we don't need\n // to check .up-destroying here. We can use the cheaper Element#isConnected instead.\n if (element.isConnected) {\n let registry = (element.upDestructors ||= buildDestructorRegistry(element))\n registry.guard(fns)\n } else {\n // The element was destroyed before an async compiler function resolved.\n up.puts('up.destructor()', 'Immediately calling destructor for detached element (%o)', element)\n for (let fn of fns) up.error.guard(fn, element)\n }\n }\n\n function buildDestructorRegistry(element) {\n let registry = u.cleaner()\n registry(e.addClassTemp(element, 'up-can-clean'))\n return registry\n }\n\n /*-\n Manually compiles a page fragment that has been inserted into the DOM\n by external code.\n\n @learn-ref enhancing-elements#hello\n\n All registered [compilers](/learn/enhancing-elements) and [macros](/api/up.macro) will be called\n with matches in the given `element`.\n\n The [`up:fragment:inserted`](/api/up:fragment:inserted) event is emitted on the compiled element.\n\n ## Unpoly automatically calls `up.hello()`\n\n When the page is manipulated using Unpoly functions or `[up-*]` attributes,\n Unpoly will automatically call `up.hello()` on new fragments:\n\n ```js\n let link = document.querySelector('a[href]')\n let { fragment } = await up.follow(link)\n // The fragment is already compiled. No need to call up.hello().\n ```\n\n You only need to use `up.hello()` after creating DOM elements without Unpoly's involvement, for example:\n\n - Creating elements with `document.createElement()`\n - Setting the `innerHTML` property on an existing element\n - Parsing HTML into elements using browser APIs like `DOMParser()`\n - Elements created by other libraries\n\n In this case, compilers will *not* run automatically and some of Unpoly's own `[up-*]` attributes will not be active.\n We can address this by manually calling `up.hello()` on new elements:\n\n ```js\n let element = document.createElement('div')\n element.innerHTML = '<a href=\"/path\" up-follow>click me</a>'\n // The element is not compiled yet. We must compile it manually:\n up.hello(element)\n ```\n\n ## Recompiling elements\n\n It is safe to call `up.hello()` multiple times with the same elements.\n In particular, every compiler function is guaranteed to run only once for each matching element.\n\n If a new compiler is registered after initial compilation,\n that new compiler is [run automatically on current elements](/api/up.compiler#late).\n\n ## Detecting compiler errors\n\n If a compiler function throws an error, `up.hello()` will still finish the compilation and *not* throw an error.\n\n Instead, compiler errors will print to the [error console](https://developer.mozilla.org/en-US/docs/Web/API/console/error)\n and emit an [`error` event on `window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/error_event):\n\n ```js\n window.addEventListener('error', function(event) {\n alert(\"Got an error \" + event.error.name)\n })\n\n up.hello(element)\n ```\n\n See [errors in user code](/learn/render-lifecycle#errors-in-user-code) for details.\n\n ## Awaiting asynchronous compilation {#async}\n\n Unpoly supports [`async` compiler functions](/api/up.compiler#async):\n\n ```js\n up.compiler('textarea.wysiwyg', async function(textarea) { // mark: async\n let editor = await import('wysiwyg-editor') // mark: await\n await editor.init(textarea) // mark: await\n return () => editor.destroy(textarea)\n })\n ```\n\n The `up.hello()` function returns a promise that fulfills when all synchronous and asynchronous\n compilers have terminated:\n\n ```js\n let textarea = up.element.createFromHTML('<textarea class=\"wysiwyg\"></textarea>')\n document.body.append(textarea)\n await up.hello(textarea) // mark: await\n // chip: WYSIWYG editor is now initialized\n ```\n\n The fulfillment value is the same element that was passed as an argument:\n\n ```js\n let textarea = up.element.affix(document.body, 'textarea.wysiwyg')\n let compiled = await up.hello(textarea) // compiled === textarea\n ```\n\n @function up.hello\n\n @param {Element|jQuery|string} element\n The root element of the new page fragment.\n\n @param {Object} [options.layer]\n An existing `up.Layer` object can be passed to prevent re-lookup.\n @internal\n\n @param {Object} [options.data]\n Overrides properties from the new fragment's `[up-data]`\n with the given [data object](/learn/data).\n @experimental\n\n @param {Object} [options.dataMap]\n An object mapping selectors to `options.data`.\n @internal\n\n @param {Object} [options.meta={}]\n An object containing [information about this compiler pass](/learn/enhancing-elements#meta).\n\n This typically contains `{ layer, revalidating }` properties.\n\n It will be passed as a third [compiler](/learn/enhancing-elements) argument.\n @experimental\n\n @param {Object} [options.compilers]\n A list of compilers to use.\n\n Defaults to all registered compilers.\n @internal\n\n @param {Object} [options.compilers]\n A list of macros to use.\n\n Defaults to all registered macros.\n @internal\n\n @param {boolean} [insertedEvent]\n Whether to emit `up:fragment:inserted` after compilation:\n @internal\n\n @return {Promise<Element>}\n A promise that fulfills when the element has finished compilation.\n\n The fulfillment value is the `element` argument.\n\n @stable\n @signature\n */\n function hello(element, options = {}) {\n // If passed a selector, up.fragment.get() will prefer a match on the current layer.\n element = up.fragment.get(element, options)\n\n // We default to running all registered processor fns, but callers\n // can opt to only run given processor arguments.\n let macros = options.macros ?? registeredMacros\n let compilers = options.compilers ?? registeredCompilers\n\n const pass = new up.HelloFragment(element, macros, compilers, options)\n return pass.run()\n }\n\n /*-\n Runs any destructors on the given fragment and its descendants in the same layer.\n\n Unlike [`up.destroy()`](/api/up.destroy), this does not emit any events\n and does not remove the element from the DOM.\n\n @function up.script.clean\n @param {Element} fragment\n @param {up.Layer} options.layer\n @internal\n */\n function clean(fragment, options = {}) {\n new up.DestructorPass(fragment, options).run()\n }\n\n /*-\n Returns the [data](/learn/data) attached to the given element.\n\n If the element has no attached data, an empty object is returned.\n\n Multiple `up.data()` calls for the same element always return the same object reference.\n\n @learn-ref data\n\n ## Use with `[up-data]`\n\n You have an element with JSON data serialized into an `[up-data]` attribute:\n\n ```html\n <span class=\"person\" up-data=\"{ age: 18, name: 'Bob' }\">Bob</span>\n ```\n\n Calling `up.data()` will deserialize the JSON string into a JavaScript object:\n\n ```js\n up.data('.person') // returns { age: 18, name: 'Bob' }\n ```\n\n ## Use with data attributes\n\n You may also use standard [`[data-*]` attributes](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes)\n to attach data to an element.\n\n ```html\n <span class='person' data-first-name='Alice' data-last-name='Anderson'>Alice</span>\n ```\n\n The object returned by `up.data()` will contain all data attributes with camelCased keys:\n\n ```js\n up.data('.person') // returns { firstName: 'Alice', lastName: 'Anderson' }\n ```\n\n You may use both `[up-data]` and `[data-*]` attributes on the same element.\n The object returned by `up.data()` will contain values from both.\n\n @function up.data\n @param {string|Element|jQuery} element\n The element for which to return data.\n @return {Object}\n The [data](/learn/data) attached to the element.\n\n Returns an empty object if the element has no attached data.\n\n Multiple `up.data()` calls for the same element always return the same object reference.\n @stable\n */\n\n /*-\n Attaches structured data to an element to be consumed by a compiler or event handler.\n\n If an element with an `[up-data]` attribute enters the DOM,\n Unpoly will parse the JSON and pass the resulting object to any matching\n `up.compiler()` functions and `up.on()` callbacks.\n\n To programmatically parse an `[up-data]` attribute into an object, use `up.data(element)`.\n\n @learn-ref data\n\n ## Example\n\n A container for a [Google Map](https://developers.google.com/maps/documentation/javascript/tutorial)\n might attach the location and names of its marker pins:\n\n ```html\n <div class=\"google-map\" up-data=\"{ pins: [\n { lat: 48.36, lng: 10.99, title: 'Friedberg' },\n { lat: 48.75, lng: 11.45, title: 'Ingolstadt' }\n ] }\"></div>\n ```\n\n The attribute value will be parsed as [relaxed JSON](/api/relaxed-json).\n The parsed object is passed to your compiler as a second argument:\n\n ```js\n up.compiler('.google-map', function(element, data) {\n let map = new google.maps.Map(element)\n for (let pin of data.pins) {\n let position = new google.maps.LatLng(pin.lat, pin.lng)\n new google.maps.Marker({ position, map, title: pin.title })\n }\n })\n ```\n\n Similarly, when an event is triggered on an element annotated with\n `[up-data]`, the parsed object will be passed to any matching\n [`up.on()`](/api/up.on) handlers:\n\n ```js\n up.on('click', '.google-map', function(event, element, data) {\n console.log(\"There are %d pins on the clicked map\", data.pins.length)\n })\n ```\n\n You may also parse the data object programmatically using the `up.data()` function:\n\n ```js\n let data = up.data('.google-map')\n data.pins[0].lat // result: 48.36\n data.pins[0].lng // result: 10.99\n data.pins[0].title // result: 'Friedberg'\n ```\n\n @selector [up-data]\n @param up-data\n A data object serialized as [relaxed JSON](/api/relaxed-json).\n @stable\n @signature\n */\n function readData(element) {\n // If passed a selector, up.fragment.get() will prefer a match on the current layer.\n element = up.fragment.get(element)\n\n return element.upData ||= buildData(element)\n }\n\n function buildData(element) {\n let parsedJSON = e.jsonAttr(element, 'up-data') ?? {}\n\n // If the [up-data] JSON isn't an object then we cannot offer live merging\n // of [up-data] and [data-...] attributes.\n //\n // It would be better to parse this lazily, but I don't want to pay\n // the bytes for a second Proxy handler when dealing with this edge case.\n if (!u.isOptions(parsedJSON)) {\n return parsedJSON\n }\n\n return {\n ...element.upTemplateData,\n ...element.dataset,\n ...parsedJSON,\n ...element.upCompileData,\n }\n }\n\n /*-\n @function up.script.assets\n @param {Element} [head=document.head]\n @return {NodeList}\n @internal\n */\n function findAssets(head = document.head) {\n return head.querySelectorAll(config.selector('assetSelectors'))\n }\n\n /*-\n Tracks an element as a [frontend asset](/learn/handling-asset-changes), usually JavaScript and stylesheets.\n\n When [rendering](/api/up.render), Unpoly compares the assets on the current page with the new assets\n from the server response. If the assets don't match, an `up:assets:changed` event is emitted.\n\n @learn-ref handling-asset-changes\n\n\n ## Default assets\n\n By default, all remote scripts and stylesheets in the `<head>` are considered assets:\n\n ```html\n <html>\n <head>\n <link rel=\"stylesheet\" href=\"/assets/frontend-5f3aa101.css\"> <!-- mark-line -->\n <script src=\"/assets/frontend-81ba23a9.js\"></script> <!-- mark-line -->\n </head>\n <body>\n ...\n </body>\n </html>\n ```\n\n Unpoly only tracks assets in the `<head>`. Elements in the `<body>` are never tracked.\n\n [Inline scripts](https://simpledev.io/lesson/inline-script-javascript-1/) and\n [internal styles](https://www.tutorialspoint.com/How-to-use-internal-CSS-Style-Sheet-in-HTML)\n are not tracked by default, but you can [include them explicitly](#including-assets).\n\n\n ## Excluding assets from tracking {#excluding-assets}\n\n To *exclude* an element in the `<head>` from tracking, mark it with an `[up-asset=\"false\"]` attribute:\n\n ```html\n <script src=\"/assets/analytics.js\" up-asset=\"false\"></script>\n ```\n\n To exclude assets by default, configure `up.script.config.noAssetSelectors`.\n\n\n ## Tracking additional assets {#including-assets}\n\n To track additional assets in the `<head>`, mark them with an `[up-asset]` attribute.\n\n For example, [inline scripts](https://simpledev.io/lesson/inline-script-javascript-1/) are not tracked by default,\n but you can include them explicitly:\n\n ```html\n <script up-asset>\n window.SALE_START = new Date('2024-05-01')\n </script>\n ```\n\n Only elements in the `<head>` can be matched this way.\n\n To track additional assets by default, configure `up.script.config.assetSelectors`.\n\n ## Tracking the backend version {#tracking-backend-versions}\n\n To detect a new deployment of your *backend* code, consider including the deployed commit hash in a `<meta>` tag.\n\n By marking the `<meta>` tag with `[up-asset]`, it will also emit an `up:assets:changed` event when the commit hash changes:\n\n ```html\n <meta name=\"backend-version\" content=\"d50c6dd629e9bbc80304e14a6ba99a18c32ba738\" up-asset>\n ```\n\n @selector [up-asset]\n @stable\n */\n\n function assertAssetsOK(newAssets, renderOptions) {\n let { response } = renderOptions\n let oldAssets = findAssets()\n\n if (assetsIdentity(oldAssets) !== assetsIdentity(newAssets)) {\n up.event.assertEmitted('up:assets:changed', { oldAssets, newAssets, renderOptions, response })\n }\n }\n\n function assetsIdentity(assets) {\n return u.map(assets, assetIdentity).join()\n }\n\n function assetIdentity(assetElement) {\n // Remove the [nonce] attribute which the browser usually masks from the outerHTML of <script> elements.\n // However it isn't masked for inert scripts (e.g. when they fail a CSP check).\n return e.removeAttrsFromHTML(assetElement.outerHTML, ['nonce'])\n }\n\n /*-\n This event is emitted when [frontend code](/api/up-asset) changes while the application is running.\n\n When a server response has no `<head>`, this event is never emitted.\n\n The event is emitted on the `document`.\n\n @learn-ref handling-asset-changes\n\n There is no default behavior when assets have changed.\n In particular, no asset elements from the response are updated in the current page.\n Event listeners may [handle changed frontend code](/learn/handling-asset-changes#tracking-assets),\n e.g., by [notifying the user](/learn/handling-asset-changes#notifying-the-user) or [loading new assets](/learn/handling-asset-changes#loading-new-assets).\n\n ## Example\n\n The code below inserts a clickable `<div id=\"new-version\">` banner when assets change.\n The user can then choose to reload at their convenience by clicking on the notification.\n\n @include new-asset-notification-example\n\n For more examples, see [Handling asset changes](/learn/handling-asset-changes).\n\n ## Emission time\n\n The event is emitted at a particular time in the [render lifecycle](/learn/render-lifecycle):\n\n - *after* new content has been loaded from the server\n - *before* any fragments have been changed on the page\n - *before* the [browser history](/api/up.history) was changed. A future history location may be found in `event.renderOptions.location`.\n\n If you cannot allow the rendering to proceed with changed assets, listeners may abort the render pass by calling `event.preventDefault()`.\n\n @event up:assets:changed\n\n @param {List<Element>} event.newAssets\n A list of all [assets](/api/up-asset) in the new content.\n\n The list also includes assets that have a matching element on the current page.\n\n By default, no new assets are inserted into the current page.\n Event listeners must [explicitly load new assets](/learn/handling-asset-changes#loading-new-assets).\n\n @param {List<Element>} event.oldAssets\n A list of [assets](/api/up-asset) in the `<head>` of the current page.\n\n @param {Object} event.renderOptions\n The [render options](/api/up.render#parameters) for the current render pass.\n\n @param {up.Response} [event.response]\n The response that contained new assets.\n\n When [rendering from a string](/learn/providing-html#string), this property is `undefined`.\n\n @experimental\n\n @param event.preventDefault()\n Aborts this render pass before new content is inserted.\n\n @stable\n */\n\n function block(root) {\n for (let script of findScripts(root)) {\n script.type = 'up-blocked-script'\n }\n }\n\n function findScripts(root, condition = '') {\n let selector = config.selector('scriptSelectors', condition)\n return e.subtree(root, selector)\n }\n\n function isScript(value) {\n return config.matches(value, 'scriptSelectors')\n }\n\n function adoptNewFragment(fragment, cspInfo) {\n new up.ScriptGate(cspInfo).adoptNewFragment(fragment)\n }\n\n function adoptDetachedHeadAsset(script, cspInfo) {\n new up.ScriptGate(cspInfo).adoptDetachedHeadAsset(script)\n }\n\n function adoptRenderOptionsFromHeader(renderOptions, cspInfo) {\n new up.ScriptGate(cspInfo).adoptRenderOptionsFromHeader(renderOptions)\n }\n\n function callbackAttr(element, attrName, parseOpts) {\n return e.parseAttr(element, attrName, (code) => {\n let fn = parseCallback(code, parseOpts)\n // Emulate the behavior of the `onclick` attribute, where `this` refers to the clicked element.\n return fn.bind(element)\n })\n }\n\n function parseCallback(code, { argNames = ['event'], expandObject = false } = {}) {\n // Return an unbound function so callers can bind to an object of their choice.\n return function(...argValues) {\n let callArgNames = argNames\n\n if (expandObject) {\n let object = argValues[0]\n callArgNames = [...argNames, ...expandObject]\n argValues = [object, ...Object.values(u.pick(object, expandObject))]\n }\n\n const nonceableCallback = up.NonceableCallback.fromCallbackString(code)\n const evalEnv = { thisContext: this, argNames: callArgNames, argValues }\n return new up.ScriptGate().evalCallback(nonceableCallback, evalEnv)\n }\n }\n\n function cspNonce() {\n return u.evalOption(config.cspNonce)\n }\n\n function warnOfUnsafeCSP(cspInfo) {\n new up.ScriptGate(cspInfo).warnOfUnsafeCSP()\n }\n\n /*\n Resets the list of registered compiler directives to the\n moment when the framework was booted.\n */\n function reset() {\n registeredCompilers = u.filter(registeredCompilers, 'isDefault')\n registeredMacros = u.filter(registeredMacros, 'isDefault')\n }\n\n up.on('up:framework:reset', reset)\n\n return {\n config,\n compiler: registerCompiler,\n macro: registerMacro,\n attrCompiler: registerAttrCompiler,\n destructor: registerDestructor,\n hello,\n clean,\n data: readData,\n findAssets,\n assertAssetsOK,\n block,\n adoptNewFragment,\n adoptRenderOptionsFromHeader,\n adoptDetachedHeadAsset,\n parseCallback,\n cspNonce,\n warnOfUnsafeCSP,\n callbackAttr,\n isScript,\n findScripts,\n }\n})()\n\nup.compiler = up.script.compiler\nup.destructor = up.script.destructor\nup.macro = up.script.macro\nup.data = up.script.data\nup.hello = up.script.hello\nup.attribute = up.script.attrCompiler\n","/*-\nFeatures to update the browser history and handle the Back button.\n\n`up.history.location` is the current URL as Unpoly sees it, and `up:location:changed` is emitted whenever it changes, for example to track page views. When the user goes back, `up:location:restore` is emitted before Unpoly fetches the restored URL and renders it; listeners can prevent this to handle restoration themselves. An `[up-back]` link points to the previous URL. To change history from your own code, call `up.history.push()` or `up.history.replace()`.\n\n@learn-ref history\n\n@module up.history\n*/\nup.history = (function() {\n\n const u = up.util\n const e = up.element\n\n /*-\n Configures behavior when the user goes back or forward in browser history.\n\n @property up.history.config\n @section History\n @param {Array} [config.restoreTargets=['body']]\n A list of possible CSS selectors to [replace](/api/up.render)\n when the user [goes back or forward in history](/learn/restoring-history).\n\n If more than one target is configured, the first selector matching both\n the current page and server response will be updated.\n\n If nothing is configured, the `<body>` element will be replaced.\n @param {boolean|Array<string>} [config.enabled=true]\n Configures which aspects of history [fragment updates](/api/up.render) can [update](/learn/updating-history).\n\n If set to `true`, Unpoly may change the browser URL, the window title,\n [meta tags](/learn/updating-history#history-state) and the `<html>` element's `[lang]` attribute.\n\n If set to `false`, Unpoly will never change any of these.\n\n To only update some aspects, set an array of the aspects Unpoly may update:\n\n | Aspect | Updates |\n |--------------|---------|\n | `'location'` | The browser URL and history entries. |\n | `'title'` | The window title. |\n | `'metaTags'` | [Meta tags](/api/up-meta) in the `<head>`. |\n | `'lang'` | The `<html>` element's `[lang]` attribute. |\n\n For example, this configuration never changes the browser URL, but still updates the `[lang]` attribute\n when the user switches to another language:\n\n ```js\n up.history.config.enabled = ['lang']\n ```\n\n An empty array has the same effect as `false`.\n\n Render options can only narrow this setting, never update an aspect that it excludes.\n An overlay without [visible history](/learn/history-in-overlays) never updates history, regardless of this setting.\n\n See [Turning off history aspects](/learn/updating-history#disabling) for the consequences of excluding an aspect.\n\n @section Meta tags\n @param {boolean} [config.updateMetaTags]\n Configures whether [history changes](/learn/updating-history) update\n [meta tags](/learn/updating-history#history-state) in addition\n to the document's title and URL.\n\n @deprecated\n Omit `'metaTags'` from an array of aspects in `up.history.config.enabled` instead.\n\n @param {Array<string>} [config.metaTagSelectors]\n An array of CSS selectors matching default [meta tags](/api/up-meta)\n that are updated during [history changes](/learn/updating-history).\n\n By default, the following elements are matched:\n\n - All `meta` elements\n - A `link[rel=\"alternate\"]` element\n - A `link[rel=\"canonical\"]` element\n - A `link[rel=\"icon\"]` element\n - [JSON-LD](https://json-ld.org/) annotations\n\n You can [include additional elements](/api/up-meta#including-meta-tags) by assigning an `[up-meta]` attribute\n or by pushing their selector into this configuration array.\n\n Only elements in the `<head>` can be matched. Elements in the `<body>` are never considered,\n even if they match one of the configured selectors.\n\n @param {Array<string>} [config.noMetaTagSelectors]\n Exceptions to `up.history.config.metaTagSelectors`.\n\n Matching elements will *not* be considered [meta tags](/api/up-meta)\n even if they match `up.history.config.metaTagSelectors`.\n\n @stable\n */\n const config = new up.Config('up.history.config', () => ({\n enabled: true,\n // Prefer restoring the body instead of :main, in case the last fragment update\n // changed the page layout. See https://github.com/unpoly/unpoly/issues/237.\n restoreTargets: ['body'],\n metaTagSelectors: [\n 'meta',\n 'link[rel=alternate]',\n 'link[rel=canonical]',\n 'link[rel=icon]',\n '[up-meta]',\n 'script[type=\"application/ld+json\"]',\n ],\n noMetaTagSelectors: [\n 'meta[http-equiv]',\n '[up-meta=false]',\n // Do not invalidate existing nonced callbacks.\n // New nonced callbacks from the response will validates and then rewritten to match the existing nonce.\n 'meta[name=csp-nonce]',\n ],\n }))\n\n /*-\n Returns a normalized URL for the previous history entry.\n\n If no previous history entry is known, returns `undefined`.\n\n @property up.history.previousLocation\n @param {string} previousLocation\n @stable\n */\n let previousLocation\n let nextPreviousLocation\n let nextTrackOptions\n let adoptedBases = new up.FIFOCache({ capacity: 100, normalizeKey: getBase })\n\n function reset() {\n previousLocation = undefined\n nextPreviousLocation = undefined\n nextTrackOptions = undefined\n adoptedBases.clear()\n trackCurrentLocation({ reason: null, alreadyHandled: true })\n adoptBase() // make sure we will process the current history entry\n }\n\n // Values we want to keep:\n // - false (no update)\n // - string (forced update)\n // - list of elements (forced update of meta tags)\n // Values we want to override:\n // - true (do update with defaults)\n function refineOption(existingValue, newValue) {\n if ((existingValue === false) || u.isString(existingValue) || u.isList(existingValue)) {\n return existingValue\n } else {\n return newValue\n }\n }\n\n /*-\n Returns whether `up.history.config.enabled` allows Unpoly to update the given aspect of history.\n\n @function up.history.isEnabled\n @param {string} aspect\n One of `'location'`, `'title'`, `'metaTags'` or `'lang'`.\n @return {boolean}\n @internal\n */\n function isEnabled(aspect) {\n let { enabled } = config\n return u.isArray(enabled) ? enabled.includes(aspect) : !!enabled\n }\n\n function historyOptions(options) {\n return u.pick(options, [\n 'location',\n 'title',\n 'metaTags',\n 'lang'\n ])\n }\n\n /*-\n Returns a normalized URL for the current browser location.\n\n The returned URL is an absolute pathname like `\"/path\"` without a hostname or port.\n It will include a `#hash` fragment and query string, if present.\n\n > [NOTE]\n > If the current [layer](/api/up.layer) does not have [visible history](/api/up.Layer.prototype.history),\n > the browser's address bar will show the location of an ancestor layer.\n > When `up.history.config.enabled` [turns off](/learn/updating-history#disabling) the `'location'` aspect,\n > the address bar keeps its URL while layers render other locations.\n > To get the location of the current layer, use `up.layer.location`.\n\n @property up.history.location\n @param {string} location\n @stable\n @signature\n */\n function currentLocation() {\n return u.normalizeURL(location.href)\n }\n\n function withTrackOptions(trackOptions, fn) {\n try {\n nextTrackOptions = trackOptions\n fn()\n } finally {\n nextTrackOptions = undefined\n }\n }\n\n /*-\n Remembers the current URL so we can use `previousLocation` on pop.\n\n @function trackCurrentLocation\n @internal\n */\n function trackCurrentLocation(trackOptions) {\n let { reason, alreadyHandled, pauseTracking } = nextTrackOptions || trackOptions\n if (pauseTracking) return\n\n // The currentLocation() function normalizes\n let location = currentLocation()\n\n if (isAdoptedState()) {\n // The user might have refreshed the page, making us lose adoptedBases.\n // However, we can still recognize the { up: true } marker from history.state.\n adoptBase(location)\n } else if (isAdoptedBase(location)) {\n // When the user navigates from an adopted base to a #hash, the browser pushes a history\n // entry with an empty state. We must mark that entry with an { up: true } state\n // so we can recognize it when the user reloads the page.\n adoptState()\n }\n\n if (nextPreviousLocation !== location) {\n previousLocation = nextPreviousLocation\n nextPreviousLocation = location\n\n if (reason === 'detect') {\n reason = (getBase(location) === getBase(previousLocation)) ? 'hash' : 'pop'\n }\n\n let willHandle = !alreadyHandled && isAdoptedBase(location)\n\n let locationChangedEvent = up.event.build('up:location:changed', {\n reason,\n location,\n previousLocation,\n alreadyHandled,\n willHandle,\n log: `New location is ${location}`\n })\n\n up.migrate.prepareLocationChangedEvent?.(locationChangedEvent)\n\n if (reason) {\n up.emit(locationChangedEvent)\n reactToChange(locationChangedEvent)\n }\n }\n }\n\n /*-\n This event is [emitted](/api/up.emit) after the browser's address bar has been updated with a new URL.\n\n There may be several reasons why the browser location was changed:\n\n - A fragment update changes history through [navigation](/learn/navigation-defaults) or rendering with `{ history: true }`.\n - The user uses the back or forward buttons in their browser UI.\n - Programmatic calls to functions like `up.history.push()` or `history.pushState()`.\n - The user navigates to a different `#hash` within the page.\n\n The `up:location:changed` event is *not* emitted when the page is loaded initially.\n For this, observe `up:framework:booted`.\n\n @learn-ref updating-history#observing\n\n ## Handling the change {#handling}\n\n This event cannot be prevented, but you can mutate the `event.willHandle` property to decide whether\n Unpoly should handle the change by restoring a location or revealing a fragment matching the location `#hash`.\n\n ## Location changes in overlays {#overlays}\n\n Overlays can configure whether their history state is reflected in the browser's address bar.\n\n When a [layer](/api/up.layer) has no [visible history](/api/up.Layer.prototype.history), no `up:location:changed` event will be emitted.\n However, an `up:layer:location:changed` will be emitted even if the address bar did not change.\n\n Also see [History in overlays](/learn/history-in-overlays).\n\n @event up:location:changed\n @section Change\n @param {string} event.location\n The new URL after the change.\n\n When this event is emitted, the [browser location](/api/up.history.location) has already been updated.\n @param {string} event.previousLocation\n The URL before the change.\n\n @experimental\n @param {string} event.reason\n The action that caused this change in history state.\n\n The value of this property is one of the following:\n\n | Value | Reason |\n |-------|--------|\n | `'hash'` | The location was changed, but only the `#hash` changed from the [previous location](/api/up.history.previousLocation). |\n | `'push'` | A new history entry was added via `up.history.push()` or `history.pushState()`. |\n | `'replace'` | The current history entry was replaced via `up.history.replace()` or `history.replaceState()`. |\n | `'pop'` | The user navigated back to the current location. |\n @section Handling\n @param {boolean} event.alreadyHandled\n Whether Unpoly thinks this change has already been handled and requires no additional processing.\n\n For example, updating history by [navigating](/learn/navigation-defaults) or calling `history.pushState()` is\n considered to be already handled.\n\n @experimental\n @param {boolean} event.willHandle\n Whether Unpoly will handle this change.\n\n By default Unpoly handles changes to [owned locations](/learn/restoring-history#handled-entries)\n when the change has not [already been handled](#event.alreadyHandled).\n\n Listeners can tell Unpoly to *not* handle a change by setting `event.willHandle = false`.\n You can then handle the change with your own code.\n\n Listeners can tell Unpoly to handle a change it does not own by setting `event.willHandle = true`.\n Regardless of this, Unpoly will never handle a change that has [already been handled](#event.alreadyHandled).\n\n @experimental\n @stable\n @signature\n */\n\n function splitLocation(location) {\n return location?.split(/(?=#)/) || []\n }\n\n function getBase(location) {\n return splitLocation(location)[0]\n }\n\n /*-\n Returns whether the given URL matches the [current browser location](/api/up.history.location).\n\n ### Examples\n\n ```js\n location.pathname // => '/path'\n\n up.history.isLocation('/path') // result: true\n up.history.isLocation('/other') // result: false\n ```\n\n By default, a trailing `#hash` and a `?query` string are considered for the comparison.\n To ignore the `#hash`, pass `{ hash: false }`:\n\n ```js\n location.pathname // => '/path'\n\n up.history.isLocation('/path#hash') // result: false\n up.history.isLocation('/path#hash', { hash: false }) // result: true\n up.history.isLocation('/path?query') // result: false\n ```\n\n The given URL is [normalized](/api/up.util.normalizeURL), so any URL string pointing to the browser location\n will match:\n\n ```js\n location.hostname // result: 'current-host'\n location.pathname // => '/foo'\n\n up.history.isLocation('/foo') // result: true\n up.history.isLocation('http://current-host/foo') // result: true\n up.history.isLocation('http://other-host/foo') // result: false\n ```\n\n @function up.history.isLocation\n @param {string} url\n The URL to compare against the current browser location.\n\n This can be either an absolute pathname (`/path`), a relative filename (`index.html`), or a fully qualified URL (`https://...`).\n @param {boolean} [options.hash=true]\n Whether to consider `#hash` fragments in the given or current URLs.\n\n When set to `false`, this function will consider the URLs `/foo#one` and `/foo#two` to be equal.\n @return {boolean}\n Whether the browser is currently at the given location.\n @stable\n */\n function isLocation(url, options) {\n return u.matchURLs(url, location.href, { hash: true, ...options })\n }\n\n /*-\n Replaces the current history entry and updates the browser's location bar.\n\n ## Restoration\n\n The replaced history entry will be owned by Unpoly.\n When the user navigates back to this history entry,\n Unpoly will [restore the content](/learn/restoring-history) at that URL.\n\n To replace a history entry that you want to restore yourself, use the browser's\n [`history.replaceState()`](https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState) function\n or handle the `up:location:changed` event.\n\n ## When history is turned off\n\n This function does nothing when `up.history.config.enabled` excludes the `'location'` aspect.\n See [Turning off history aspects](/learn/updating-history#disabling).\n\n @function up.history.replace\n @param {string} url\n @experimental\n */\n function replace(location, trackOptions) {\n placeAdoptedHistoryEntry('replaceState', location, trackOptions)\n }\n\n /*-\n Adds a new history entry and updates the browser's address bar.\n\n Does not add a history entry if the given URL is already the current browser location.\n If the URL did change, an `up:location:changed` event is emitted.\n\n When [navigating](/learn/navigation-defaults) (or rendering with [`{ history: true }`](/api/up.render#options.history)),\n Unpoly will update the browser location for you. You only need to call `up.history.push()` to push\n a new entry without rendering.\n\n ## Restoration\n\n The new history entry will be owned by Unpoly.\n When the user navigates back to this history entry,\n Unpoly will [restore the content](/learn/restoring-history) at that URL.\n\n To push a history entry that you want to restore yourself, use the browser's\n [`history.pushState()`](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState) function\n or handle the `up:location:changed` event.\n\n ## When history is turned off\n\n This function does nothing when `up.history.config.enabled` excludes the `'location'` aspect.\n See [Turning off history aspects](/learn/updating-history#disabling).\n\n @function up.history.push\n @param {string} url\n The URL for the history entry to be added.\n @experimental\n */\n function push(location, trackOptions) {\n if (isLocation(location)) return\n placeAdoptedHistoryEntry('pushState', location, trackOptions)\n }\n\n function placeAdoptedHistoryEntry(method, location, trackOptions) {\n // When up.history.config.enabled excludes 'location', we do nothing.\n // We don't adopt a URL that we never pushed.\n if (isEnabled('location')) {\n adoptBase(location)\n\n withTrackOptions(trackOptions, function() {\n // Call this instead of originalPushState in case someone else has patched history.pushState()\n // Our own tests do this to rate-limit the use of the history API.\n history[method](null, { up: true }, location)\n })\n }\n }\n\n function isAdoptedBase(location) {\n // We handle bases (path + query string) that were pushed or replaced via up.history methods.\n // All other bases we assume are pushed by external JS that wants to handle restoration itself.\n return !!adoptedBases.get(location)\n }\n\n function adoptBase(location = currentLocation()) {\n location = u.normalizeURL(location)\n adoptedBases.set(location, true)\n }\n\n function isAdoptedState() {\n return history.state?.up\n }\n\n function adoptState() {\n let { state } = history\n\n // If we already have history.state.up, don't waste another replaceState() call.\n // We're on a throttling quota after all.\n if (isAdoptedState()) return\n\n // Add our { up } key to \"don't care\" states like \"\", null or {}, but not\n // to other values.\n if (u.isBlank(state) || u.isObject(state)) {\n withTrackOptions({ pauseTracking: true }, function() {\n history.replaceState({ ...state, up: true }, '')\n })\n }\n }\n\n function restoreLocation(location) {\n\n // An up.Offline error (the server could not be reached) is critical and surfaces as an\n // unhandled rejection, while the page keeps its content. This is intentional: losing the\n // connection while restoring is worth reporting, unlike an error status, which we render.\n up.error.muteUncriticalRejection(up.render({\n guardEvent: up.event.build('up:location:restore', { location, log: `Restoring location ${location}` }),\n\n // The browser has already restored the URL, but hasn't changed content\n // four our synthetic history state. We're now fetching the content for the restored URL.\n url: location,\n target: config.restoreTargets,\n\n // The browser won't let us prevent the state restoration, so we're\n // rendering whatever the server sends us.\n fail: false,\n\n history: true,\n // (1) While the browser has already restored the earlier URL, we must still\n // pass it to render() so the current layer can track the new URL.\n // (2) Since we're passing the current URL, up.history.push() will not add another state.\n // (2) Pass the current URL to ensure that this exact URL is being rendered\n // and not something derived from the up.Response.\n location,\n\n // Don't replace elements in a modal that might still be open\n // We will close all overlays and update the root layer.\n peel: true,\n layer: 'root',\n\n cache: 'auto',\n revalidate: 'auto',\n\n // We already saved view state in onPop()\n saveScroll: false,\n scroll: ['restore', 'auto'],\n saveFocus: false,\n focus: ['restore', 'auto'],\n }))\n }\n\n function reactToChange(event) {\n if (event.alreadyHandled) {\n return\n }\n\n if (!event.willHandle) {\n up.puts('up.history', 'Ignoring history entry owned by foreign script')\n return\n }\n\n if (event.reason === 'pop') {\n up.viewport.saveFocus({ location: event.previousLocation })\n up.viewport.saveScroll({ location: event.previousLocation })\n restoreLocation(event.location)\n } else if (event.reason === 'hash') {\n // We handle every hashchange, since only we know reveal obstructions.\n up.viewport.revealHash(location.hash, { strong: true })\n }\n }\n\n\n /*-\n This event is emitted when the user is [restoring a previous history entry](/learn/restoring-history),\n usually by pressing the back button.\n\n Listeners may prevent `up:location:restore` or mutate `event.renderOptions`\n to [customize the restoration behavior](/learn/restoring-history#custom-behavior).\n\n When this event is emitted, the [browser location](/api/up.history.location) has already been updated.\n\n @learn-ref restoring-history\n\n @event up:location:restore\n @param {string} event.location\n The URL for the restored history entry.\n @param {Object} event.renderOptions\n An object with [render options](/api/up.render#parameters) for the render pass\n that will restore content for this history entry.\n\n Listeners may inspect and modify these options.\n Modifying render options cannot stop the browser from restoring the URL in the address bar.\n @param event.preventDefault()\n Prevents Unpoly from restoring content for this history entry.\n\n Preventing the event will *not* stop the browser from restoring the URL in the address bar.\n @stable\n */\n\n function findMetaTags(head = document.head) {\n return head.querySelectorAll(config.selector('metaTagSelectors'))\n }\n\n /*-\n Configures whether this `<head>` element is updated during [history changes](/learn/updating-history).\n\n @learn-ref updating-history\n\n ### Default meta elements\n\n By [default](/api/up.history.config#config.metaTagSelectors), popular `<meta>` and certain `<link>`\n elements in the `<head>` are considered meta tags.\n They will be updated when history is changed, in addition to the document's title and URL.\n\n ```html\n <link rel=\"canonical\" href=\"https://example.com/dresses/green-dresses\"> <!-- mark-line -->\n <meta name=\"description\" content=\"About the AcmeCorp team\"> <!-- mark-line -->\n <meta property=\"og:image\" content=\"https://app.com/og.jpg\"> <!-- mark-line -->\n <script src=\"/assets/app.js\"></script>\n <link rel=\"stylesheet\" href=\"/assets/app.css\">\n ```\n\n The linked JavaScript and stylesheet are *not* part of history state and will not be updated\n during history changes.\n\n ### Including additional elements {#including-meta-tags}\n\n To update additional `<head>` elements during history changes, mark them with an `[up-meta]` attribute:\n\n ```html\n <link rel=\"license\" href=\"https://opensource.org/license/mit/\" up-meta>\n ```\n\n Only elements in the `<head>` can be matched this way.\n\n To include additional elements by default, configure `up.history.config.metaTagSelectors`.\n\n ### Excluding elements {#excluding-meta-tags}\n\n To leave a `<head>` element unchanged during history changes, set an `[up-meta=false]` attribute:\n\n ```html\n <meta charset=\"utf-8\" up-meta=\"false\">\n ```\n\n To exclude elements by default, configure `up.history.config.noMetaTagSelectors`.\n\n @selector [up-meta]\n @stable\n */\n\n function updateMetaTags(newMetaTags) {\n let oldMetaTags = findMetaTags()\n for (let oldMetaTag of oldMetaTags) {\n // We do not use up.destroy() as meta tags may be inserted/removed\n // multiple times as we open and close an overlay.\n oldMetaTag.remove()\n }\n\n for (let newMetaTag of newMetaTags) {\n document.head.append(newMetaTag)\n }\n }\n\n function getLang(doc = document) {\n // return e.attr(doc.documentElement, 'lang')\n let { documentElement } = doc\n if (documentElement.matches('html')) {\n return doc.documentElement.lang\n }\n }\n\n function updateLang(newLang) {\n e.setAttrPresence(e.root, 'lang', newLang, !!newLang)\n }\n\n function patchHistoryAPI() {\n const originalPushState = history.pushState\n history.pushState = function(...args) {\n originalPushState.apply(this, args)\n trackCurrentLocation({ reason: 'push', alreadyHandled: true })\n }\n\n const originalReplaceState = history.replaceState\n history.replaceState = function(...args) {\n originalReplaceState.apply(this, args)\n trackCurrentLocation({ reason: 'replace', alreadyHandled: true })\n }\n }\n\n function adoptInitialHistoryEntry() {\n // Unpoly replaces the initial page state so it can later restore it when the user\n // goes back to that initial URL. However, if the initial request was a POST,\n // Unpoly will wrongly assume that it can restore the state by reloading with GET.\n if (up.protocol.initialRequestMethod() === 'GET') {\n // Replace the vanilla state of the initial page load with an Unpoly-enabled state\n adoptState()\n\n // Adopt all #hash navigations to the same URL.\n adoptBase()\n }\n }\n\n // Wait until the framework is booted before we (1) patch window.history\n // and (2) replace the current history state.\n up.on('up:framework:boot', function({ mode }) {\n trackCurrentLocation({ reason: null, alreadyHandled: true }) // no event is emitted while booting\n patchHistoryAPI()\n adoptInitialHistoryEntry()\n\n // (1) Honor obstructions when the initial URL contains a #hash.\n // (2) Wait until booting because the developer might choose not to boot Unpoly.\n // (3) Don't scroll when the user manually boots later, as the user might already have scrolled elsewhere.\n if (mode === 'auto') {\n // (1) When reloading, Chrome's default scrolling behavior\n // happens *before* DOMContentLoaded. We fix that as soon as possible.\n // (2) When following a link to another URL with a #hash URL, Chrome's default\n // scrolling behavior happens *after* DOMContentLoaded. We wait one more task to\n // fix the scroll position after the browser did its thing.\n up.viewport.revealHash(location.hash, { strong: true, focus: true })\n }\n })\n\n up.on(window, 'hashchange, popstate', () => {\n // We do not detect the reason here because we're in a state where\n // location and previousLocation are the same. This will be fixed by trackCurrentLocation().\n trackCurrentLocation({ reason: 'detect', alreadyHandled: false })\n })\n\n function onJumpLinkClicked(event, link) {\n // If other JavaScript already handled this click, do nothing.\n if (event.defaultPrevented) return\n\n // Don't handle clicks that would open a new tab.\n if (up.event.isModified(event)) return\n\n let [currentBase, currentHash] = splitLocation(up.layer.current.location)\n let [linkBase, linkHash] = splitLocation(u.normalizeURL(link))\n let verbatimHREF = link.getAttribute('href')\n\n // (1) If we're not scrolling the page, we must leave the event unprevented\n // and allow the link to be followed, or handled by other JavaScript.\n // (2) currentBase may be undefined if we're on a layer that was opened from a string.\n let isJumpLink = (currentBase === linkBase) || verbatimHREF.startsWith('#')\n if (!isJumpLink) return\n\n // By default we will honor a { scroll-behavior } style from CSS.\n // This can be overridden by an [up-scroll-behavior] attribute.\n let behavior = link.getAttribute('up-scroll-behavior') ?? 'auto'\n\n // (1) Check if we recognize the link hash, because it matches a fragment or\n // a well-known anchor like \"#top\".\n // (2) Scroll with { behavior: 'auto' } (instead of thew default { behavior: 'instant' }\n // so it picks up any scroll-behavior CSS rule on the viewport element.\n let layer = up.layer.get(link)\n let revealFn = up.viewport.revealHashFn(linkHash, { layer, behavior, focus: true })\n\n if (revealFn) {\n // (1) Prevent the browser, Unpoly or other JavaScript from following the link.\n // (2) This means we will be responsible to change the hash in the address bar.\n up.event.halt(event)\n\n up.log.putsEvent(event)\n\n // (1) Because we prevented the event, it is up to us to change the hash.\n // (2) We should not set the location if the layer shows no live location.\n if (linkHash !== currentHash && layer.showsLiveHistory('location')) {\n // We use pushState() instead of setting location.hash so we don't trigger\n // a hashchange event or cause browser scrolling.\n let newHREF = currentBase + linkHash\n push(newHREF, { reason: 'hash', alreadyHandled: true })\n }\n\n revealFn()\n } else {\n // (1) At this point revealHash() could not find a matching fragment.\n // The hash also isn't '#top', which would also have been handled by revealHash().\n // (2) We might be looking at a <a href=\"#\"> that wants to be handled be a script\n // that is called after this click listener.\n }\n }\n\n up.on('up:click', 'a[href*=\"#\"]', onJumpLinkClicked)\n\n /*-\n Changes the link's destination so it points to the previous URL.\n\n If no previous URL is known, the link will not be changed.\n\n > [NOTE]\n > Clicking an `[up-back]` link will *not* call [`history.back()`](https://developer.mozilla.org/en-US/docs/Web/API/History/back).\n > Instead, the link will [navigate](/api/up.navigate) to the previous URL.\n\n ### Example\n\n This link …\n\n ```html\n <a href=\"/default\" up-back>\n Go back\n </a>\n ```\n\n … will be transformed to:\n\n ```html\n <a href=\"/default\" up-follow up-href=\"/previous-page\" up-scroll=\"restore\">\n Go back\n </a>\n ```\n\n @learn-ref restoring-history#back-link\n\n @selector [up-back]\n @stable\n @signature\n */\n up.macro('[up-back]', function(link) {\n if (previousLocation) {\n e.setMissingAttrs(link, {\n 'up-href': previousLocation,\n 'up-scroll': 'restore'\n })\n link.removeAttribute('up-back')\n up.link.makeFollowable(link)\n }\n })\n\n up.on('up:framework:reset', reset)\n\n return {\n config,\n isEnabled,\n push,\n replace,\n get location() { return currentLocation() },\n get previousLocation() { return previousLocation },\n isLocation,\n findMetaTags,\n updateMetaTags,\n getLang,\n updateLang,\n refineOption,\n options: historyOptions,\n }\n})()\n","require('./fragment.sass')\n\nconst u = up.util\nconst e = up.element\n\n/*-\nThe JavaScript API to render, look up and destroy page fragments. Every link, form, overlay or poll that Unpoly handles ends in `up.render()`, and your own code can call it with the same options.\n\n`up.render()` replaces elements on the current page with matching elements from a server response or an HTML string. `up.navigate()` does the same with the defaults of a user navigation, like updating history and scrolling to the new content. `up.reload()` fetches a fresh copy of a fragment from the URL it was loaded from, and `up.destroy()` removes a fragment, with an optional animation.\n\nLookup functions like `up.fragment.get()` differ from `document.querySelector()`: they only see the [current layer](/api/up.layer.current), ignore elements that are playing out their exit animation, and understand Unpoly's own selectors like `:main` or `:origin`. Elements marked `[up-keep]` are kept across updates. For low-level DOM utilities that complement the browser's native API, see `up.element`.\n\n@learn-ref advanced-rendering\n\n@module up.fragment\n*/\nup.fragment = (function() {\n\n function upTagName(element) {\n let tagName = element.localName\n if (tagName.startsWith('up-')) {\n return tagName\n }\n }\n\n const STRONG_TARGET_DERIVERS = [\n '[up-id]',\n '[id]',\n 'html',\n 'head',\n 'body',\n ]\n\n /*-\n Configures defaults for fragment updates.\n\n @property up.fragment.config\n\n @section Targeting\n @param {Array<string>} [config.mainTargets=['[up-main]', 'main', ':layer']]\n An array of CSS selectors matching default [render targets](/learn/targeting-fragments).\n\n When no explicit target is given, Unpoly will update the first selector matching both\n the current page and the server response.\n\n When [navigating](/learn/navigation-defaults) to a main target, Unpoly will automatically\n [reset scroll positions](/learn/scrolling#auto) and\n [update the browser history](/learn/updating-history).\n\n This property is aliased as [`up.layer.config.any.mainTargets`](/api/up.layer.config#config.any.mainTargets).\n\n Also see [targeting the main fragment](/learn/targeting-fragments#targeting-the-main-element).\n\n @param {Array<string|Function<Element>: string|undefined>} [config.targetDerivers]\n An array of [target derivation patterns](/learn/target-derivation#derivation-patterns)\n used to [guess a target selector](/learn/target-derivation) for an element.\n\n For instance, a pattern `'a[href]'` is applicable to all `<a href=\"...\">` elements.\n It produces a target like `a[href=\"/users\"]`.\n\n If your deriver can't be expressed in a pattern string, you may also add a function that\n accepts an `Element` and returns a target selector, if applicable. If the function\n is not applicable it may return `undefined`. In that case the next pattern will be tried.\n\n @param {Array<string|RegExp>} [config.badTargetClasses]\n An array of class names that should be ignored when\n [deriving a target selector from a fragment](/learn/target-derivation).\n\n The class names may also be passed as a regular expression.\n\n @param {boolean} [config.verifyDerivedTarget=true]\n Whether [derived targets](/learn/target-derivation) must match the element to be applicable.\n\n When verification is disabled, the first applicable [derivation pattern](/learn/target-derivation#derivation-patterns)\n will be used, even if the produced target would match another element on the page.\n\n Also see [Derived target verification](/learn/target-derivation#verification).\n\n @param {string} [config.match='region']\n How to match fragments when a [target selector](/learn/targeting-fragments) yields multiple results.\n\n When set to `'region'` Unpoly will prefer to match fragments in the\n [region](/learn/targeting-fragments#ambiguous-selectors) of the [origin element](/api/up.render#options.origin).\n\n If set to `'first'` Unpoly will always use the first matching fragment.\n\n @section Render options\n\n @param {Object} [config.navigateOptions]\n An object of default render options to apply when [navigating](/learn/navigation-defaults).\n\n To set defaults for *all* render passes (when navigating or not), use `up.fragment.config.renderOptions`.\n\n @param {Object} [config.renderOptions]\n An object of low-level render options to apply to *any* render pass.\n\n When [navigating](/learn/navigation-defaults), the defaults from `up.fragment.config.navigateOptions` will also be applied.\n\n > [!important]\n > By design only a minimal set of options is configured. This is to spare callers from excessive unsetting\n > of defaults when rendering a fragment without navigation.\n > Any opinionated settings (in particular `{ cache, history, scroll }`)\n > should be configured in `up.fragment.config.navigateOptions`.\n\n @experimental\n\n @param {Object} [config.reloadOptions]\n An object of default render options to apply when [reloading fragments](/api/up.reload).\n\n To set defaults for *all* render passes (when reloading or not), use `up.fragment.config.renderOptions`.\n\n @experimental\n\n @param {Array<string>} [config.autoHistoryTargets]\n When an updated fragment contains an element matching one of the given [target selectors](/learn/targeting-fragments),\n history will be updated with `{ history: 'auto' }`.\n\n By default Unpoly will auto-update history when updating a [main target](#config.mainTargets).\n\n @param {Array<boolean|string|Function(Element)>} [config.autoScroll]\n An array of scroll strategies to try after updating a fragment with `{ scroll: 'auto' }`.\n\n See [Scrolling](/learn/scrolling) for available strategies.\n\n The default configuration tries, in this order:\n\n - If the URL has a `#hash`, scroll to the hash.\n - If updating a [main target](/api/up-main), reset scroll positions.\n\n @param {Array<boolean|string|Function(Element)>} [config.autoFocus]\n An array of focus strategies when updating a fragment with `{ focus: 'auto' }`.\n\n See [Controlling focus](/learn/focus) for available strategies.\n\n The default configuration tries the following strategies, in this order:\n\n - Focus a `#hash` in the URL.\n - Focus an `[autofocus]` element in the new fragment.\n - If updating a [main target](/api/up-main), focus the new fragment.\n - If focus was lost with the old fragment, re-focus a [similar](/learn/target-derivation) element.\n - If focus was lost with the old fragment, focus the new fragment.\n\n @section Preprocessing\n\n @param {Function(string): string} [config.normalizeKeepHTML]\n A function that normalizes a HTML string before comparison with [`[up-keep=\"same-html\"]`](/learn/keeping-elements#same-html).\n\n By default only light normalization is applied:\n\n - Line indentation is ignored.\n - Some fluctuating attributes are ignored, such as CSP nonces.\n\n You can configure your own normalization instead of the default. For example, the following\n would only strip leading and trailing whitespace:\n\n ```js\n up.fragment.config.normalizeKeepHTML = (str) => str.trim()\n ```\n\n See [Keeping an element until its HTML changes](/learn/keeping-elements#same-html) for context.\n\n @section Responses\n\n @param {boolean|Function(up.Response): boolean} [config.autoRevalidate]\n Whether to reload a fragment after it was rendered from a cached response with `{ revalidate: 'auto' }`.\n\n By default Unpoly verifies cached responses that are older than `up.network.config.cacheExpireAge`:\n\n ```js\n up.fragment.config.autoRevalidate = (response) => response.expired\n ```\n\n You can exempt server paths from being auto-revalidated like this:\n\n ```js\n up.fragment.config.autoRevalidate = (response) => response.expired && response.url != '/dashboard'\n ```\n\n @param {Function(Object): boolean} [config.skipResponse]\n When to finish a render pass without changes,\n usually to [not re-insert identical content](/learn/render-lifecycle#skipping-responses).\n\n By default Unpoly skips the following responses:\n\n - Responses without text in their body.\n Such responses occur when the server answers a [conditional request](/learn/conditional-requests)\n with `304 Not Modified`, or responds with `204 No Content`.\n - When [revalidating](/learn/caching#revalidation), if the expired response and fresh response\n have the exact same text.\n\n The configured function accepts an object with the same properties\n as an `up:fragment:loaded` event. You can provide a different function to use your own logic.\n For example, the following would never skip a response by default:\n\n ```js\n up.fragment.config.skipResponse = ({ response, expiredResponse }) => false\n ```\n\n You may also skip responses by calling `event.skip()` on an `up:fragment:loaded` event.\n\n @param {Function(up.Response): boolean} [config.renderableResponse]\n Whether the given response has a [content-type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type)\n that is considered renderable.\n\n By default Unpoly renders responses with an [HTML content-type](/api/up.Response.prototype.isHTML).\n Trying to render responses with a different type will throw an error, even if the response body contains HTML markup.\n\n Restricting content types is a security precaution. It protects in a hypothetical scenario where an attacker can both\n upload a file *and* can use an existing XSS vulnerability to cause Unpoly to render that file. It doesn't\n affect applications that reliably escape user input.\n\n To render *any* response regardless of content-type, configure a function that always returns `true`:\n\n ```js\n up.fragment.config.renderableResponse = (response) => true\n ```\n\n @experimental\n\n @stable\n */\n const config = new up.Config('up.fragment.config', () => ({\n badTargetClasses: [/^up-/],\n\n strongTargetDerivers: STRONG_TARGET_DERIVERS,\n\n targetDerivers: [\n ...STRONG_TARGET_DERIVERS,\n 'main',\n '[up-main]',\n upTagName,\n 'link[rel][type]',\n 'link[rel=preload][href]',\n 'link[rel=preconnect][href]',\n 'link[rel=prefetch][href]',\n 'link[rel]',\n 'meta[property]',\n '*[name]',\n 'form[action]',\n 'a[href]',\n '[class]',\n '[up-flashes]',\n 'form',\n ],\n\n verifyDerivedTarget: true,\n\n renderOptions: {\n hungry: true,\n keep: true,\n saveScroll: true,\n saveFocus: true,\n focusVisible: 'auto',\n abort: 'target',\n failOptions: true,\n feedback: true,\n },\n\n // These defaults will be set to both success and fail options\n // if { navigate: true } is given.\n navigateOptions: {\n cache: 'auto',\n revalidate: 'auto',\n fallback: true,\n focus: 'auto',\n scroll: 'auto',\n history: 'auto',\n peel: 'dismiss',\n },\n\n reloadOptions: {\n target: ':main',\n scroll: 'keep',\n focus: 'keep',\n },\n\n match: 'region',\n autoHistoryTargets: [':main'],\n autoFocus: ['hash', 'autofocus', 'main-if-main', 'keep', 'target-if-lost'],\n autoScroll: ['hash', 'layer-if-main'],\n autoRevalidate: (response) => response.expired,\n skipResponse: defaultSkipResponse,\n renderableResponse: (response) => response.isHTML(),\n normalizeKeepHTML: defaultNormalizeKeepHTML\n }))\n\n // Users who are not using layers will prefer settings default targets\n // as up.fragment.config.mainTargets instead of up.layer.config.any.mainTargets.\n u.delegate(config, ['mainTargets'], () => up.layer.config.any)\n\n function defaultSkipResponse({ response, expiredResponse }) {\n return !response.text || response.text === expiredResponse?.text\n }\n\n /*-\n Returns the URL from which the given element was loaded.\n\n If the given element was never directly updated, but part of a larger fragment update,\n the [closest](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest) known source of an ancestor element is returned.\n\n ## Example\n\n In the HTML below, the element `#one` was loaded from the URL `/foo`:\n\n ```html\n <div id=\"one\" up-source=\"/foo\">\n <div id=\"two\">...</div>\n </div>\n ```\n\n We can now ask for the source of an element:\n\n ```javascript\n up.fragment.source('#two') // returns '/foo'\n ```\n\n @function up.fragment.source\n @param {Element|string} element\n The element or CSS selector for which to look up the source URL.\n @return {string|undefined}\n The URL from which the element was loaded.\n @stable\n */\n function sourceOf(element, options = {}) {\n element = getSmart(element, options)\n return e.closestAttr(element, 'up-source')\n }\n\n function normalizeSource(source) {\n // Don't use u.matchableURL() here. We need to keep the trailing slash here,\n // to support backends that care about trailing slashes.\n return u.normalizeURL(source, { hash: false })\n }\n\n /*-\n Returns the last modification time of the content in the given element.\n\n The last modification time corresponds to the `Last-Modified` header in the response that\n rendered the fragment. Alternatively the `[up-time]` attribute of the element or an ancestor is used.\n\n If no ancestor fragment with an `[up-time]` attribute exists, `undefined` is returned.\n\n When the fragment is reloaded,\n its modification time is sent as an `If-Modified-Since` request header. The server may check the header and decide to [skip rendering](/learn/conditional-requests).\n\n @learn-ref conditional-requests\n\n @function up.fragment.time\n @param {Element} element\n @return {Date|undefined}\n The fragment's last modification time.\n\n Returns `undefined` if the fragment was rendered without a modification time.\n @stable\n */\n function timeOf(element) {\n let value = e.closestAttr(element, 'up-time')\n if (value && value !== 'false') {\n // We support both Unix timestamps (e.g. \"1445412480\")\n // and RFC 1123 times (e.g. \"Wed, 21 Oct 2015 07:28:00 GMT\").\n if (/^\\d+$/.test(value)) {\n value = Number(value) * 1000\n }\n return new Date(value)\n }\n }\n\n /*-\n Sets the time when the fragment's underlying data was last changed.\n\n When the fragment is reloaded,\n its known modification time is sent as an `If-Modified-Since` request header.\n The server may check the header and decide to [skip rendering](/learn/conditional-requests).\n\n @learn-ref conditional-requests\n\n ### How `[up-time]` attributes are set\n\n Unpoly will automatically set an `[up-time]` attribute when a fragment was rendered\n from a response with a `Last-Modified` header. When a fragment was rendered without such a header,\n Unpoly will set `[up-time=false]` to indicate that its modification time is unknown.\n\n A large response may contain multiple fragments that are later reloaded individually\n and should each have their own modification time. In this case the server may also render multiple\n fragments with each their own `[up-time]` attribute.\n See [Individual versions per fragment](/learn/conditional-requests#fragment-versions) for an example.\n\n @selector [up-time]\n @param {string} up-time\n The time when the element's underlying data was last changed.\n\n The value can either be a Unix timestamp (e.g. `\"1445412480\"`)\n or an [RFC 1123](https://www.rfc-editor.org/rfc/rfc1123) time (e.g. `Wed, 21 Oct 2015 07:28:00 GMT`).\n\n You can also set the value to `\"false\"` to prevent a `If-Modified-Since` request header\n when reloading this fragment.\n @stable\n */\n\n /*-\n Returns the [ETag](https://en.wikipedia.org/wiki/HTTP_ETag) of the content in the given element.\n\n The returned ETag corresponds to the [`ETag` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag)\n in the response that rendered the fragment. Alternatively the `[up-etag]` attribute of the element\n or an ancestor is used.\n\n If no ancestor fragment with an `[up-etag]` attribute exists, `undefined` is returned.\n\n When the fragment is reloaded,\n its ETag is sent as an `If-None-Match` request header. The server may check the header and decide to [skip rendering](/learn/conditional-requests).\n\n @learn-ref conditional-requests\n\n @function up.fragment.etag\n @param {Element} element\n @return {string|undefined}\n The fragment's ETag.\n\n Returns `undefined` if the fragment was rendered without an ETag.\n @stable\n */\n function etagOf(element) {\n let value = e.closestAttr(element, 'up-etag')\n if (value && value !== 'false') {\n return value\n }\n }\n\n /*-\n Sets an [ETag](https://en.wikipedia.org/wiki/HTTP_ETag) for the fragment's underlying data.\n\n ETags can be used to skip unnecessary rendering of unchanged content.\n This is useful for [reloading](/api/up.reload), [cache revalidation](/learn/caching#revalidation) and [polling](/api/up-poll).\n\n @learn-ref conditional-requests\n\n ### How `[up-etag]` attributes are set\n\n Unpoly will automatically set an `[up-etag]` attribute when a fragment was rendered\n from a response with a `ETag` header. When a fragment was rendered without such a header,\n Unpoly will set `[up-etag=false]` to indicate that its ETag is unknown.\n\n A large response may contain multiple fragments that are later reloaded individually\n and should each have their own ETag. In this case the server may also render multiple\n fragments with each their own `[up-etag]` attribute.\n See [Individual versions per fragment](/learn/conditional-requests#fragment-versions) for an example.\n\n @selector [up-etag]\n @param {string} up-etag\n An ETag for the element's underlying data.\n\n You can also set the value to `\"false\"` to prevent a `If-None-Match` request header\n when reloading this fragment.\n @stable\n */\n\n /*-\n When Unpoly inserts a fragment, the `[up-source]` attribute is automatically set\n to the URL from which the fragment's HTML was loaded.\n\n When an element is [reloaded](/api/up.reload) or [polled](/api/up-poll),\n Unpoly will request the URL from the closest `[up-source]` attribute.\n\n The `[up-source]` attribute is only set for `GET` requests.\n\n @learn-ref polling#source\n\n ## Using an explicit source URL\n\n To indicate a different source URL for a fragment (and its descendants),\n manually set `[up-source]` attribute:\n\n ```html\n <div class=\"unread-count\" up-poll up-source=\"/unread-count\"> <!-- mark: up-source=\"/unread-count\" -->\n 2 new messages\n </div>\n ```\n\n When such an `[up-source]` attribute is explicitly set in the HTML, Unpoly will not overwrite\n it on insertion.\n\n ## Accessing the source URL from JavaScript\n\n To retrieve the source URL from JavaScript, use `up.fragment.source()`.\n\n @selector [up-source]\n @param {string} up-source\n The URL from which this element and its descendants were initially requested.\n @stable\n */\n\n /*-\n Replaces elements on the current page with matching elements from a server response or HTML string.\n\n ## Choosing which fragment to update\n\n The current and new elements must both match the same [target selector](/learn/targeting-fragments).\n The selector is either given as `{ target }` option,\n or a [main target](/api/up-main) is used as default.\n\n Let's say your current HTML looks like this:\n\n ```html\n <div class=\"one\">old one</div>\n <div class=\"two\">old two</div>\n ```\n\n We now replace the second `<div>` by [targeting](/learn/targeting-fragments) its CSS class:\n\n ```js\n up.render({ target: '.two', url: '/new' })\n ```\n\n The server renders a response for `/new`:\n\n ```html\n <div class=\"one\">new one</div>\n <div class=\"two\">new two</div>\n ```\n\n Unpoly looks for the selector `.two` in the response and places it\n in the current page. The current page now looks like this:\n\n ```html\n <div class=\"one\">old one</div>\n <div class=\"two\">new two</div>\n ```\n\n Note how only `.two` has changed. The update for `.one` was\n discarded, since it didn't match the selector.\n\n See [targeting fragments](/learn/targeting-fragments) for many examples for how you can target content.\n\n ## Passing the new fragment\n\n The new fragment content can be passed as one of the following options:\n\n @include providing-html-table\n\n See [providing HTML to render](/learn/providing-html) for more details and examples.\n\n ## Enabling side effects\n\n This function has many options to enable scrolling, focus, request cancellation and other side\n effects. These options are all disabled by default and must be opted into one-by-one.\n\n To enable defaults that a user would expect for navigation (like clicking a link),\n pass [`{ navigate: true }`](#options.navigate) or use `up.navigate()` instead.\n\n ## Hooking into the render process\n\n Your code may hook into specific stages of the rendering process. This allows you to modify the rendered result or handle error cases.\n\n See [render hooks](/learn/render-lifecycle) for details.\n\n ## Concurrency\n\n Unfinished requests [targeting](/learn/targeting-fragments) the updated fragment or its descendants are [aborted](/learn/aborting-requests).\n You may control this behavior using the [`{ abort }`](#options.abort) option.\n\n @function up.render\n\n @section Targeting\n @param {string|Element|jQuery|Array<string>} [target]\n The [target selector](/learn/targeting-fragments) to update.\n\n Instead of passing the target as the first argument, you may also pass it as\n a `{ target }` option. See [`{ target }`](#options.target) for details.\n\n @mix up.render/targeting\n\n @section Navigation\n @mix up.render/navigation\n\n @section Request\n @mix up.render/request\n\n @section Caching\n @mix up.render/caching\n\n @section Local content\n @mix up.render/local-content\n\n @section Layer\n @mix up.render/layer\n\n @section History\n @mix up.render/history\n\n @section Animation\n @mix up.render/motion\n\n @section Scrolling\n @mix up.render/scrolling\n\n @section Focus\n @mix up.render/focus\n\n @section Loading state\n @mix up.render/loading-state\n\n @section Client state\n @mix up.render/client-state\n\n @section Lifecycle hooks\n @mix up.render/lifecycle-hooks\n\n @return {up.RenderJob}\n A promise that fulfills with an `up.RenderResult` once the page has been updated.\n\n The promise rejects when one of the following conditions occur:\n\n - the render pass was [aborted](/learn/aborting-requests)\n - the server sends an [error status](/learn/error-responses)\n - there is a [network issue](/learn/network-issues)\n - [targets](/learn/targeting-fragments) could not be matched\n\n See [Render lifecycle hooks](/learn/render-lifecycle) for more information about handling\n errors, or running code after rendering.\n\n @stable\n @signature\n */\n const render = up.mockable((...args) => {\n let options = parseTargetAndOptions(args)\n return new up.RenderJob(options).execute()\n })\n\n /*-\n [Navigates](/learn/navigation-defaults) to the given URL by updating a major fragment in the current page.\n\n `up.navigate()` will mimic a click on a vanilla `<a href>` link to satisfy user expectations\n regarding scrolling, focus, request cancellation and [many other side effects](/learn/navigation-defaults).\n To update a fragment without side effects, use `up.render()`.\n\n Instead of calling `up.navigate()` you may also call `up.render({ navigate: true })`.\n\n @function up.navigate\n\n @section Targeting\n @param {string|Element|jQuery} [target]\n The [target selector](/learn/targeting-fragments) to update.\n\n If omitted a [main target](/api/main) will be rendered.\n\n You can also pass a DOM element or jQuery element here, in which case a selector\n will be [derived from the element attributes](/learn/target-derivation). The given element\n will also be set as the `{ origin }` option.\n\n Instead of passing the target as the first argument, you may also pass it as\n [`{ target }` option](/api/up.render#options.target).\n\n @mix up.render/targeting\n\n @section Request\n @mix up.render/request\n @param options.url\n The URL to navigate to.\n\n @section Caching\n @mix up.render/caching\n\n @section Local content\n @mix up.render/local-content\n\n @section Layer\n @mix up.render/layer\n\n @section History\n @mix up.render/history\n\n @section Animation\n @mix up.render/motion\n\n @section Scrolling\n @mix up.render/scrolling\n\n @section Focus\n @mix up.render/focus\n\n @section Loading state\n @mix up.render/loading-state\n\n @section Client state\n @mix up.render/client-state\n\n @section Lifecycle hooks\n @mix up.render/lifecycle-hooks\n\n @return\n @like up.render\n @stable\n */\n const navigate = up.mockable((...args) => {\n const options = parseTargetAndOptions(args)\n return render({ ...options, navigate: true })\n })\n\n /*-\n This event is [emitted](/api/up.emit) after the server response was loaded, but before\n the HTML is used to [change a fragment](/api/up.render).\n\n This gives you a chance to inspect the response or DOM state right before a fragment would be inserted.\n You may then choose to [change render options](#event.renderOptions) or [abort](#event.preventDefault)\n the render pass to do something else instead.\n\n The event is emitted on the targeted layer.\n When [opening an overlay](/learn/opening-overlays), the event is emitted on the parent layer\n of the new overlay.\n\n @learn-ref render-lifecycle\n\n ### Example: Making a full page load instead\n\n Event listeners may call `event.preventDefault()` on an `up:fragment:loaded` event\n to prevent any changes to the DOM and browser history.\n\n This is useful to detect an entirely different page layout\n (like a maintenance page or fatal server error)\n which should be opened with a full page load:\n\n ```js\n up.on('up:fragment:loaded', (event) => {\n let isMaintenancePage = event.response.header('X-Maintenance')\n\n if (isMaintenancePage) {\n // Prevent the fragment update and don't update browser history\n event.preventDefault() // mark-line\n\n // Make a full page load for the same request.\n event.request.loadPage() // mark-line\n }\n })\n ```\n\n ### Example: Changing render options {#changing-render-options}\n\n Instead of preventing the update, listeners may also access the `event.renderOptions` object\n to mutate options to the `up.render()` call that will process the server response:\n\n ```js\n up.on('up:fragment:loaded', async function(event) {\n // If we see an X-Course-Completed header, render the main target\n if (event.response.header('X-Course-Completed')) {\n event.renderOptions.target = ':main' // mark-line\n }\n })\n ```\n\n ### Example: Do something else, then retry\n\n You may retry a prevented fragment update later, by calling `up.render(event.renderOptions)`:\n\n ```js\n up.on('up:fragment:loaded', async function(event) {\n // When we couldn't access a page since we're signed out, the server sends a header\n if (event.response.header('X-Session-Missing')) {\n // Don't render the error message\n event.preventDefault() // mark-line\n\n // Sign in using a modal overlay\n await up.layer.ask({ url: '/sign_in', acceptEvent: 'app:session:created' })\n\n // Now that we're signed in, retry the original request\n up.render(event.renderOptions) // mark-line\n }\n })\n ```\n\n ### Example: Discarding a revalidation response\n\n When rendering [cached](/learn/caching) content that is too old, Unpoly automatically reloads the fragment\n to ensure that the user never sees expired content. This process is called [cache revalidation](/learn/caching#revalidation).\n\n To prevent the insertion of [revalidated](/learn/caching#revalidation) content *after* the\n server responded you may prevent the `up:fragment:loaded` event with an `{ revalidating: true }` property.\n\n The following would skip rendering a revalidation response if it has the same `X-Version` header as\n the original, stale response:\n\n ```js\n up.on('up:fragment:loaded', function(event) {\n if (event.revalidating) {\n let newVersion = event.response.header('X-Version')\n let oldVersion = event.expiredResponse.header('X-Version')\n if (newVersion === oldVersion) {\n event.skip()\n }\n }\n })\n ```\n\n Also see [skipping a loaded response](/learn/render-lifecycle#skipping-responses).\n\n ### Cases that trigger the event {#cases}\n\n The `up:fragment:loaded` event is emitted when we have an HTML response from the server\n *and* we are about to render elements:\n\n | Case | `up:fragment:loaded` emitted? |\n |-----------------------------------------------------------------|-------------------------------|\n | Server responds with 200 OK | ✔️ yes |\n | Server responds with an [error code](/learn/error-responses) | ✔️ yes |\n | Rendering from [cache](/learn/caching) | ✔️ yes |\n | Rendering a [string of HTML](/learn/providing-html#string) | ❌ no |\n | Server [renders nothing](/learn/conditional-requests#rendering-nothing) | ❌ no |\n | [Fatal network error](/learn/network-issues#disconnects) | ❌ no |\n | [Preloading](/learn/preloading) | ❌ no |\n\n @event up:fragment:loaded\n\n @param event.preventDefault()\n Aborts this render pass without changes.\n\n Programmatic callers will reject with an `up.Aborted` error.\n\n @param event.skip()\n Finishes this render pass without changes,\n usually to [not re-insert identical content](/learn/render-lifecycle#skipping-responses).\n\n Programmatic callers will fulfill with an [empty](/api/up.RenderResult.prototype.none) `up.RenderResult`.\n\n To configure global rules for responses that should be skipped, you may\n also use `up.fragment.config.skipResponse` instead of registering an `up:fragment:loaded` listener.\n\n @param {up.Request} event.request\n The original request to the server.\n\n @param {up.Response} event.response\n The response received from the server.\n\n @param {boolean} event.revalidating\n Whether responding to a [cache revalidation](/learn/caching#revalidation) request.\n @experimental\n\n @param {up.Response|undefined} event.expiredResponse\n When [revalidating](/learn/caching#revalidation), this property is set to the expired content\n that is being reloaded.\n\n You may compare the `{ response }` and `{ expiredResponse }` properties to prevent\n [re-insertion of identical content](/learn/render-lifecycle#skipping-responses).\n\n Also see `up.fragment.config.skipResponse`.\n\n @experimental\n\n @param {Element|undefined} event.origin\n The link, input or form element that caused the fragment update.\n\n If no origin element is known, this property is left `undefined`.\n\n @param {Object} event.renderOptions\n Options for the `up.render()` call that will process the server response.\n\n Listeners may inspect or [modify](#changing-render-options) these options.\n @stable\n */\n\n /*-\n This event is emitted when the device loses its network connection while [rendering](/api/up.render) content.\n\n Listeners may decide how to handle the connection loss. E.g. you may choose to display an error, or to offer a button that retries the failed request.\n See [handling connection loss](/learn/network-issues#disconnects) for more details and examples.\n\n The event is emitted on the targeted layer.\n\n @learn-ref network-issues#disconnects\n\n ## Example\n\n This handler will ask the user if they want to retry a failed fragment update:\n\n ```js\n up.on('up:fragment:offline', function(event) {\n if (confirm('You are offline. Retry?')) event.retry()\n })\n ```\n\n ### Cases that trigger the event {#cases}\n\n The `up:fragment:offline` event is emitted when we have a fatal connectivity issue\n *and* we were about to render elements:\n\n | Case | `up:fragment:offline` emitted? |\n |-----------------------------------------------------------------|--------------------------------|\n | [Fatal network error](/learn/network-issues#disconnects) | ✔️ yes |\n | Server responds with an [error code](/learn/error-responses) | ❌ no |\n | Server [renders nothing](/learn/conditional-requests#rendering-nothing) | ❌ no |\n | [Preloading](/learn/preloading) fails | ❌ no |\n\n\n @event up:fragment:offline\n\n @param {up.Request} event.request\n The original request to the server.\n\n @param {Object} event.renderOptions\n Options for the `up.render()` call that has caused the failed request.\n\n @param {Function(Object): Promise<up.RenderResult>} event.retry()\n Retry the render pass with the same options.\n\n You may pass an object to override individual properties from the original render options.\n\n Retrying causes a second render pass with its own async `up.RenderResult`.\n The promise from the original render pass has already been rejected when `up:fragment:offline` is emitted.\n\n @param {Element} [event.origin]\n The link or form element that caused the fragment update.\n\n @stable\n */\n\n /*-\n Elements with an `[up-keep]` attribute will be kept when rendering.\n\n @learn-ref keeping-elements\n\n ## Basic example\n\n A common use case is to keep the playback state of media elements:\n\n ```html\n <article>\n <p>Content</p>\n <audio id=\"player\" up-keep src=\"song.mp3\"></audio>\n </article>\n ```\n\n When [targeting](/learn/targeting-fragments) the `<article>` fragment, the `<audio>` element and\n its playback state will be the same before and after the update. All other elements (like the `<p>`)\n will be updated with new content.\n\n See [Keeping elements](/learn/keeping-elements) for elaborate examples.\n\n ## Limitations\n\n - The `[up-keep]` attribute is only supported for elements within the `<body>`.\n - If an `<audio up-keep>` or `<video up-keep>` element is a *direct* child of the `<body>`,\n it will lose its playback state during a fragment update.\n To keep its playback state in all browsers,\n insert a container element between the `<body>` and the media element.\n\n\n @selector [up-keep]\n @param [up-keep='true']\n How long to keep the element.\n\n When set to `'true'` (the default), the element is kept as long as its\n [derived target](/learn/target-derivation) can be correlated in both the old and new content.\n\n When set to `'same-html'`, the element is kept as long as its outer HTML\n does not change between versions. See [Keeping an element until its HTML changes](/learn/keeping-elements#same-html).\n\n When set to `'same-data'`, the element is kept as long as its [data](/learn/data)\n does not change between versions. See [Keeping an element until its data changes](/learn/keeping-elements#same-data).\n\n When set to `'false'` the element is never kept. A new element with `[up-keep=\"false\"]`\n will always replace an existing element, even if that existing element has `[up-keep=\"true\"]`.\n See [Forcing an update](/learn/keeping-elements#forcing-updates).\n @param [up-on-keep]\n Code to run before an existing element is kept during a page update.\n\n Calling `event.preventDefault()` will prevent the element from being kept.\n It will then be swapped with `newFragment`.\n\n The code may use the variables `event` (of type `up:fragment:keep`),\n `this` (the old fragment), `newFragment` and `newData`.\n @stable\n @signature\n */\n\n function emitFragmentKeep({ oldElement, newElement: newFragment, newData, renderOptions }) {\n const log = ['Keeping fragment %o', oldElement]\n const callback = up.script.callbackAttr(oldElement, 'up-on-keep', { expandObject: ['newFragment', 'newData'] })\n return up.emit(oldElement, 'up:fragment:keep', { log, callback, newFragment, newData, renderOptions })\n }\n\n /*-\n This event is emitted before an existing element is [kept](/learn/keeping-elements)\n during a render pass.\n\n Event listeners can call `event.preventDefault()` on an `up:fragment:keep` event\n to prevent the element from being kept. If the event is prevented, the element\n will be replaced with a fragment from the response.\n\n @learn-ref keeping-elements\n\n ### Example\n\n The following would only keep an `<audio up-keep>` element as long as it plays\n the same song (as identified by the tag's `src` attribute):\n\n ```js\n up.on('up:fragment:keep', 'audio', function(event, element) {\n if (element.getAttribute('src') !== event.newFragment.getAttribute('src')) {\n // Preventing the event forces an update\n event.preventDefault()\n }\n })\n ```\n\n You may also define an `up:fragment:keep` listener in HTML using an [`[up-on-keep]`](/api/up-keep#up-on-keep) attribute.\n\n @event up:fragment:keep\n @param event.preventDefault()\n Prevents the fragment from being kept.\n\n The fragment will be replaced with `event.newFragment`.\n @param {Element} event.target\n The fragment that will be kept.\n @param {Element} event.newFragment\n The new element from the response.\n @param {Object} event.newData\n The [data](/learn/data) attached to the new element.\n @param {Object} event.renderOptions\n An object with [render options](/api/up.render#parameters) for the current render pass.\n @stable\n */\n\n /*-\n The `up:fragment:kept` event is emitted *after* an existing element has been [kept](/learn/keeping-elements) during a render pass.\n\n All [keep conditions](/learn/keeping-elements#conditions) have already been evaluated.\n The keeping can no longer be prevented. For this, use `up:fragment:keep` instead.\n\n @learn-ref keeping-elements\n\n @event up:fragment:kept\n @param {Element} event.target\n The fragment that has been kept.\n @param {Element} event.newFragment\n The response fragment that has been discarded.\n @param {Object} event.newData\n The [data](/learn/data) attached to the discarded element.\n @experimental\n */\n\n function emitFragmentKept({ oldElement, newElement: newFragment, newData }) {\n return up.emit(oldElement, 'up:fragment:kept', { log: false, newFragment, newData })\n }\n\n /*-\n Returns a object detailing a keep operation iff the given { oldElement } is [up-keep] and\n we can find a matching partner in { newElement }.\n\n Otherwise returns undefined.\n\n @function up.fragment.keepPlan\n @param {Element} options.oldElement\n @param {Element} options.newElement\n @param {boolean} options.descendantsOnly\n @param {boolean} options.keep\n @internal\n */\n function findKeepPlan(options) {\n if (options.keep === false) return\n\n const { oldElement, newElement } = options\n\n let oldElementMode = keepMode(oldElement)\n // Early return if no [up-keep] attr or if [up-keep=false]\n if (!oldElementMode) { return }\n\n let partner\n let partnerSelector = up.fragment.tryToTarget(oldElement)\n if (!partnerSelector) {\n up.warn('[up-keep]', 'Cannot keep untargetable %o', oldElement)\n }\n\n const lookupOpts = { layer: options.layer }\n\n if (options.descendantsOnly) {\n // Since newElement is from a freshly parsed HTML document, we could use\n // up.element functions to match the selector. However, since we also want\n // to use custom selectors like \":main\" or \"&\" we use up.fragment.get().\n partner = up.fragment.get(newElement, partnerSelector, lookupOpts)\n } else {\n partner = e.subtreeFirst(newElement, partnerSelector, lookupOpts)\n }\n\n // (1) The partner must be matched\n // (2) The partner does not need to be [up-keep]\n if (!partner) return\n\n let partnerMode = keepMode(partner)\n\n // (1) The partner must not be [up-keep=false], regardless of oldElement's state.\n // (2) We already tested old element for [up-keep=false] at the beginning of findKeepPlan().\n if (partnerMode === false) return\n\n let oldIdentity = keepIdentity(oldElement, oldElementMode)\n let partnerIdentity = keepIdentity(partner, oldElementMode)\n\n if (!u.isEqual(oldIdentity, partnerIdentity)) return\n\n const plan = {\n oldElement, // the element that should be kept\n newElement: partner, // the element that would have replaced it but now does not\n newData: up.script.data(partner), // the parsed up-data attribute of the element we will discard\n renderOptions: options,\n }\n\n // Preventing up:fragment:keep will force a replacement\n if (emitFragmentKeep(plan).defaultPrevented) return\n\n // If we came this far, we can keep oldElement.\n return plan\n }\n\n function keepIdentity(element, mode = keepMode(element)) {\n return element.upKeepIdentity ??= u.copy(buildKeepIdentity(element, mode))\n }\n\n function defaultNormalizeKeepHTML(html) {\n // Remove attributes that might fluctuate beteen responses, but don't normally contribute to element identity.\n html = e.removeAttrsFromHTML(html, ['up-etag', 'up-source', 'up-time', 'nonce', ...up.script.config.nonceableAttributes])\n // Remove leading spaces.\n html = html.replace(/^[ \\t]+/mg, '')\n return html\n }\n\n function buildKeepIdentity(element, mode) {\n if (mode === 'same-html') {\n return config.normalizeKeepHTML(element.outerHTML)\n } else if (mode === 'same-data') {\n return up.data(element)\n } else {\n return true\n }\n }\n\n // Snapshot the keep identity before macros make changes.\n // TODO: Doesn't this need to happen before other macros?\n up.macro('[up-keep]', (element) => keepIdentity(element))\n\n function keepMode(element) {\n return e.booleanOrStringAttr(element, 'up-keep')\n }\n\n\n function emitFragmentInserted(element, meta) {\n if (element.upInserted) return\n element.upInserted = true\n\n const log = ['Inserted fragment %o', element]\n\n // TODO: Is it important to wrap the entire compilation in mutate()? In case a programmatic cal to up.hello calls a compiler runs up.hello()?\n\n return mutate(() => up.emit(element, 'up:fragment:inserted', { ...meta, log }))\n }\n\n /*-\n When a page fragment has been [inserted or updated](/api/up.render),\n this event is [emitted](/api/up.emit) on the new element.\n\n When an element with children is inserted, `up:fragment:inserted` is only\n emitted once for the entire new subtree.\n\n If you're looking to run code when a new fragment matches\n a selector, use `up.compiler()`.\\\n This event is emitted after compilation.\n\n @learn-ref render-lifecycle\n\n ### Example\n\n ```js\n up.on('up:fragment:inserted', function(event, fragment) {\n console.log(\"Looks like we have a new %o!\", fragment)\n })\n ```\n\n @event up:fragment:inserted\n @param {Element} event.target\n The fragment that has been inserted or updated.\n @param {up.Layer} event.layer\n The [layer](/api/up.layer) of the new fragment.\n @param {boolean} event.ok\n Whether the element was loaded from a [successful response](/learn/error-responses#fail-options).\n @param {boolean} event.revalidating\n Whether the element was reloaded for the purpose of [cache revalidation](/learn/caching#revalidation).\n\n @stable\n */\n\n\n function emitFragmentDestroyed(fragment, options) {\n const log = options.log ?? ['Destroyed fragment %o', fragment]\n const parent = options.parent || document\n return mutate(() => up.emit(parent, 'up:fragment:destroyed', { fragment, parent, log }))\n }\n\n /*-\n This event is [emitted](/api/up.emit) after a page fragment was [destroyed](/api/up.destroy) and removed from the DOM.\n\n If the destruction is [animated](/api/up.motion), this event is emitted *after* the animation has ended.\n\n The event is emitted on the parent element of the fragment that was removed.\n If an element with children is destroyed, `up:fragment:destroyed`\n is only emitted once for the entire subtree\n that was removed.\n\n @learn-ref render-lifecycle\n\n @event up:fragment:destroyed\n @param {Element} event.fragment\n The detached element that has been removed from the DOM.\n @param {Element} event.parent\n The former parent element of the fragment that has now been detached from the DOM.\n @param {Element} event.target\n The former parent element of the fragment that has now been detached from the DOM.\n @stable\n */\n\n function isNotDestroying(element) {\n return !element.closest('.up-destroying')\n }\n\n /*-\n Returns whether the given fragment is both [attached to the DOM](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected)\n and not currently in a destroy animation.\n\n ## Understanding aliveness\n\n A fragment that is alive can be [targeted](/learn/targeting-fragments), and can be discovered by `up.fragment` functions.\n\n A fragment becomes \"unalive\" immediately when it is destroyed, or when an ancestor is destroyed.\n If the destruction is [animated](/api/up.motion), the fragment is \"unalive\" while the animation is still playing.\n\n | Element state | `up.fragment.isAlive(element)` |\n |---------------------------|----------------------|\n | Entered DOM | `true` |\n | Enter animation playing | `true` |\n | Still element in the DOM | `true` |\n | Exit animation playing | `false` |\n | Removed from DOM | `false` |\n\n ## See also\n\n - The `.up-destroying` class is automatically assigned to elements in their exit animation.\n - All `up.fragment` functions (like `up.fragment.get()`) ignore elements in their exit animation.\n - The `up.Layer#isAlive()` method checks if an overlay is attached to the DOM and also not in a closing animation.\n\n @function up.fragment.isAlive\n @param {Element} fragment\n The fragment to check.\n @return {boolean}\n Whether the fragment (and its ancestors) are considered alive.\n @experimental\n */\n function isAlive(fragment) {\n return fragment.isConnected && isNotDestroying(fragment)\n }\n\n /*-\n Returns the first fragment matching the given CSS selector.\n\n This function differs from `document.querySelector()` and `up.element.get()`:\n\n - This function only selects elements in the [current layer](/api/up.layer.current).\n Pass a `{ layer }`option to match elements in other layers.\n - This function ignores elements that are being [destroyed](/api/up.destroy) or that are being\n removed by a [transition](/api/up.morph).\n - This function prefers to match elements in the [region](/learn/targeting-fragments#ambiguous-selectors)\n of a given `{ origin }` element (optional).\n - This function supports non-standard CSS extensions like `:main` or `:layer`.\n\n If no element matches these conditions, `undefined` is returned.\n\n ### Matching a selector in a layer\n\n To select the first element with the selector `.foo` on the [current layer](/api/up.layer.current):\n\n ```js\n let foo = up.fragment.get('.foo')\n ```\n\n You may also pass a `{ layer }` option to match elements within another layer:\n\n ```js\n let foo = up.fragment.get('.foo', { layer: 'any' })\n ```\n\n ### Matching the descendant of an element\n\n To only select in the descendants of an element, pass a root element as the first argument:\n\n ```js\n let container = up.fragment.get('.container')\n let fooInContainer = up.fragment.get(container, '.foo')\n ```\n\n ### Matching in the origin's region\n\n When processing a user interaction, it is often helpful to match elements in the region of the link\n that's being clicked or of the form field that's being changed. In this case you may pass\n the triggering element as `{ origin }` element.\n\n Assume the following HTML:\n\n ```html\n <div class=\"element\">\n </div>\n <div class=\"element\">\n <a href=\"...\"></a>\n </div>\n ```\n\n When processing an event for the `<a href=\"...\">` you can pass the link element\n as `{ origin }` to match the [closest](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest)\n element in the link's ancestry:\n\n ```js\n let link = event.target\n up.fragment.get('.element') // returns the first .element\n up.fragment.get('.element', { origin: link }) // returns the second .element\n ```\n\n When the link does not have an ancestor matching `.element`,\n Unpoly will search the entire layer for `.element`.\n\n To [disable region-aware fragment matching](/learn/targeting-fragments#disabling-region-aware-fragment-matching), pass a `{ match: 'first' }` option:\n\n ```js\n up.fragment.get('.element', { origin: link, match: 'first' })\n ```\n\n ### Matching an origin sibling\n\n When processing a user interaction, it is often helpful to match elements\n within the same container as the the link that's being clicked or the form field that's\n being changed.\n\n Assume the following HTML:\n\n ```html\n <div class=\"element\" id=\"one\">\n <div class=\"inner\"></div>\n </div>\n <div class=\"element\" id=\"two\">\n <a href=\"...\"></a>\n <div class=\"inner\"></div>\n </div>\n ```\n\n When processing an event for the `<a href=\"...\">` you can pass the link element\n as `{ origin }` to match within the link's container:\n\n ```js\n let link = event.target\n up.fragment.get('.element .inner') // returns the first .inner\n up.fragment.get('.element .inner', { origin: link }) // returns the second .inner\n ```\n\n Only when the link's `.element` container does not have a child `.inner`,\n Unpoly will search the entire layer for `.element .inner`.\n\n ### Elements are returned unchanged\n\n Passing an existing element will return it unchanged:\n\n ```js\n let element = document.querySelector(...)\n up.fragment.get(element) // returns the given element\n ```\n\n ### Similar features\n\n - The [`.up-destroying`](/api/up-destroying) class is assigned to elements during their removal animation.\n - The [`up.element.get()`](/api/up.element.get) function simply returns the first element matching a selector\n without filtering by layer or destruction state.\n\n @function up.fragment.get\n @section Search scope\n @param {Element|jQuery|Document} [root=document]\n The root element for the search. Only the root's descendants will be matched.\n\n May be omitted to search through all elements in the current `document`.\n @param {string|Element} selector\n The selector to match.\n\n If passed an `Element` instead of a string, that element is returned without further lookups.\n @param {string} [options.layer='current']\n The layer in which to select elements.\n\n See `up.layer.get()` for a list of supported layer values.\n\n If a root element was passed as first argument, this option is ignored and the\n root element's layer is searched.\n\n @param {boolean} [options.destroying=false]\n Whether to include destroyed elements still playing out their exit animation.\n\n @experimental\n\n @section Region awareness\n @param {string} [options.match='region']\n Controls which fragment to return when the [`selector`](#selector) yields multiple results.\n\n When set to `'region'` Unpoly will prefer to match fragments in the\n [region](/learn/targeting-fragments#ambiguous-selectors) of the [origin element](#options.origin).\n\n If set to `'first'` Unpoly will always return the first matching fragment.\n\n Defaults to `up.fragment.config.match`, which defaults to `'region'`.\n\n @param {Element|jQuery} [options.origin]\n The origin element that triggered this fragment lookup, e.g. a button that was clicked.\n\n Unpoly will prefer to match fragments in the [region](/learn/targeting-fragments#ambiguous-selectors)\n of the origin element.\n\n The `selector` argument may refer to the origin as `:origin`.\n @return {Element|undefined}\n The first matching element, or `undefined` if no such element matched.\n @stable\n @signature\n */\n function getSmart(...args) {\n let [root, selector, options] = parseGetArgs(args)\n\n if (u.isElementLike(selector)) {\n // (1) up.fragment.get(root: Element, element: Element, [options]) should just return element.\n // The given root and options are ignored. We also don't check if it's destroying.\n // (2) We do use e.get() to unwrap a jQuery collection.\n return e.get(selector)\n }\n\n if (root) {\n // We don't match around { origin } if we're given a root for the search.\n return getFirstDescendant(root, selector, options)\n }\n\n // (1) If we don't have a root element we will use a context-sensitive lookup strategy\n // that tries to match elements in the region of { origin } before going through\n // the entire layer.\n // (2) We must not pass a { document } option to up.FragmentFinder.\n return new up.FragmentFinder({\n selector,\n ...u.pick(options, ['layer', 'match', 'origin', 'destroying']),\n }).find()\n }\n\n function getFirstDescendant(...args) {\n let [root, selectorString, options] = parseGetArgs(args)\n\n let selector = new up.Selector(selectorString, root, options)\n return selector.firstDescendant(root)\n }\n\n function parseGetArgs(args) {\n return u.args(args, 'val', 'val', 'options')\n }\n\n /*-\n Returns all elements matching the given CSS selector, but\n ignores elements that are being [destroyed](/api/up.destroy) or that are being\n removed by a [transition](/api/up.morph).\n\n By default this function only selects elements in the [current layer](/api/up.layer.current).\n Pass a `{ layer }`option to match elements in other layers. See `up.layer.get()` for a list\n of supported layer values.\n\n Returns an empty list if no element matches these conditions.\n\n ### Example\n\n To select all elements with the selector `.foo` on the [current layer](/api/up.layer.current):\n\n ```js\n let foos = up.fragment.all('.foo')\n ```\n\n You may also pass a `{ layer }` option to match elements within another layer:\n\n ```js\n let foos = up.fragment.all('.foo', { layer: 'any' })\n ```\n\n To select in the descendants of an element, pass a root element as the first argument:\n\n ```js\n let container = up.fragment.get('.container')\n let foosInContainer = up.fragment.all(container, '.foo')\n ```\n\n ### Similar features\n\n - The [`.up-destroying`](/api/up-destroying) class is assigned to elements during their removal animation.\n - The [`up.element.all()`](/api/up.element.all) function simply returns all elements matching a selector\n without further filtering.\n\n @function up.fragment.all\n\n @section Search scope\n @param {Element|jQuery|Document} [root=document]\n The root element for the search. Only the root's descendants will be matched.\n\n May be omitted to search through all elements in the given [layer](#options.layer).\n\n @param {string} selector\n The selector to match.\n\n @param {string} [options.layer='current']\n The layer in which to select elements.\n\n See `up.layer.get()` for a list of supported layer values.\n\n If a `root` element was passed as first argument, this option is ignored and the\n root element's layer is searched.\n\n @section Origin\n @param {string|Element|jQuery} [options.origin]\n The origin element that triggered this fragment lookup, e.g. a button that was clicked.\n\n The `selector` argument may refer to the origin as `:origin`.\n\n @return {List<Element>}\n A list of all elements matching the selector.\n\n Returns an empty list if there are no matches.\n @stable\n */\n function getAll(...args) {\n let [root, selectorString, options] = parseGetArgs(args)\n\n // (0) up.fragment.all(element) or up.fragment.all(element, element) should return an array of that element.\n if (u.isElement(selectorString)) {\n return [selectorString]\n }\n\n // (1) up.fragment.all(list) or up.fragment.all(element, list) should return the list unchanged\n if (u.isList(selectorString)) {\n return selectorString\n }\n\n // (2) up.fragment.all(rootElement, selector) should find selector within\n // the descendants of rootElement.\n // (3) up.fragment.all(selector) should find selector within the current layer.\n // (4) up.fragment.all(selector, { layer }) should find selector within the given layer(s).\n let selector = new up.Selector(selectorString, root, options)\n return selector.descendants(root)\n }\n\n /*-\n Marks a target selector as optional.\n\n If a `:maybe` selector is not found in the current page or the server response,\n Unpoly will skip rendering the fragment instead of throwing an error.\n\n An optional selector will be omitted from an `X-Up-Target` header unless it\n matches in the current page.\n\n @learn-ref targeting-fragments#missing-targets\n\n ### Example\n\n When [updating multiple fragments](/learn/targeting-fragments#multiple)\n you may combine required and optional selectors in a single target string.\n\n The link below will update the fragments `.content` (required) and `.details` (optional):\n\n ```html\n <a href=\"/card/5\" up-target=\".content, .details:maybe\">...</a>\n ```\n\n Only the fragment `.content` is required to match. If `.details` is missing\n in the current page or the server response, Unpoly will only update `.content`\n without an error.\n\n @selector :maybe\n @stable\n */\n\n /*-\n Returns a list of a `root` element's descendants matching the given selector.\n\n If the `root` element itself matches the selector, it is also included in the returned list.\n\n ## Ignored elements\n\n The following elements are ignored, even if they match the selector:\n\n - Elements in a different [layer](/api/up.layer) than `root`.\n - Elements that are being [destroyed](/api/up.destroy) with an animation.\n - Elements that are being removed by a [transition](/api/up-transition).\n\n To include all elements matching the selector, use `up.element.subtree()`.\n\n @function up.fragment.subtree\n @param {Element} root\n The root element for the search.\n @param {string} selector\n The CSS selector to match.\n @return {NodeList<Element>|Array<Element>}\n A list of all matching elements.\n @stable\n */\n function getSubtree(element, selector, options = {}) {\n return new up.Selector(selector, element, options).subtree(element)\n }\n\n /*-\n Returns whether the given `root` matches or contains the given selector or element.\n\n Will always return `false` if the two elements are on different [layers](/api/up.layer).\n\n @param {Element|Document} root\n @param {string|Element} query\n The selector or element to look for.\n @return {boolean}\n @function up.fragment.contains\n Whether the root contains the given element or selector.\n @experimental\n */\n function contains(root, selectorOrElement) {\n if (u.isElement(selectorOrElement)) {\n // The root may be in no layer, e.g. while a closed overlay plays its closing animation.\n return e.contains(root, selectorOrElement) && up.layer.get(root)?.contains(selectorOrElement)\n } else {\n return getSubtree(root, selectorOrElement).length > 0\n }\n }\n\n /*-\n Returns the first element that matches the selector by testing the element itself\n and traversing up through ancestors in element's layers.\n\n `up.fragment.closest()` will only match elements in the same [layer](/api/up.layer) as\n the given element. To match ancestors regardless of layers, use `up.element.closest()`.\n\n @function up.fragment.closest\n @param {Element} element\n The element on which to start the search.\n @param {string} selector\n The CSS selector to match.\n @return {Element|null|undefined} element\n The matching element.\n\n Returns `null` or `undefined` if no element matches in the same layer.\n @stable\n */\n function closest(element, selector, options) {\n return new up.Selector(selector, element, options).closest(element)\n }\n\n /*-\n Destroys the given element or selector.\n\n All registered [destructors](/learn/enhancing-elements#destructor) are called.\n The element is then removed from the DOM.\n\n Unfinished requests targeting the destroyed fragment or its descendants are [aborted](/learn/aborting-requests).\n\n Emits the event [`up:fragment:destroyed`](/api/up:fragment:destroyed).\n\n ## Animating the removal\n\n You may animate the element's removal by passing an option like `{ animation: 'fade-out' }`.\n Unpoly ships with a number of [predefined animations](/api/up.animate#named-animations) and\n you may also define [custom animations](/api/up.animation).\n\n If the element's removal is animated, the element will remain in the DOM until after the animation\n has completed. While the animation is running the element will be given the `.up-destroying` class.\n The element will also be given the [`[inert]`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inert)\n attribute to prevent interaction and to hide its content from assistive technologies.\n\n To prevent accidental selection of destroying elements, they are ignored by\n Unpoly features like [`[up-target]`](/learn/targeting-fragments) or `up.fragment.get()`.\n\n ## Running code after removal\n\n Destroying an element without animation works synchronously:\n\n ```js\n console.log(element.isConnected) // logs \"true\"\n\n up.destroy(element) // no need to await\n\n console.log(element.isConnected) // logs \"false\"\n ```\n\n When the removal is animated, it remains attached while the exit animation\n plays. To run code after the element was detached from the DOM, pass an `{ onFinished }` callback:\n\n ```js\n console.log(element.isConnected) // logs \"true\"\n\n up.destroy(element, {\n animation: 'fade-out',\n duration: 500,\n onFinished() { console.log(element.isConnected) }\n })\n\n console.log(element.isConnected) // logs \"true\"\n\n // After 500 ms the { onFinished } callback logs \"false\"\n ```\n\n ## Detecting destructor errors\n\n If a [destructor](/learn/enhancing-elements#destructor) throws an error, `up.destroy()` will still remove the element and *not* throw an error.\n\n Instead destructor errors will print to the [error console](https://developer.mozilla.org/en-US/docs/Web/API/console/error)\n and emit an [`error` event on `window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/error_event).\n\n See [errors in user code](/learn/render-lifecycle#errors-in-user-code) for details.\n\n @function up.destroy\n @section Scope\n @param {string|Element|jQuery} element\n The element to remove.\n @section Animation\n @param {string|Function(element, options): Promise} [options.animation='none']\n An animation to play before the element is removed from the DOM.\n @param options.duration\n @like up.animate\n @param options.easing\n @like up.animate\n @param {Function} [options.onFinished]\n A callback that is run when any animations are finished and the element was removed from the DOM.\n @stable\n @signature\n */\n function destroy(...args) {\n const options = parseTargetAndOptions(args)\n const element = getSmart(options.target, options)\n\n if (element) {\n new up.Change.DestroyFragment({ ...options, element }).execute()\n }\n\n return up.migrate.formerlyAsync?.('up.destroy()')\n }\n\n function parseTargetAndOptions(args) {\n const options = u.parseArgIntoOptions(args, 'target')\n if (u.isElement(options.target)) {\n options.origin ||= options.target\n }\n return options\n }\n\n /*-\n Elements are assigned the `.up-destroying` class before they are [destroyed](/api/up.destroy)\n or while they are being removed by a [transition](/api/up.morph).\n\n @learn-ref transitions#how-a-transition-plays\n\n If the removal is [animated](/api/up.destroy#animating-the-removal),\n the class is assigned before the animation starts.\n\n ### Destroying elements are ignored\n\n Destroyed elements remain attached to the DOM while they are playing out their exit animation.\n To prevent accidental selection of destroying elements, they are ignored by\n Unpoly features like [`[up-target]`](/learn/targeting-fragments) or `up.fragment.get()`.\n\n Only the low-level DOM helpers in `up.element` will *not* ignore elements that are being destroyed.\n\n ### Accessibility\n\n While an element's destruction is animating, the element is also assigned an\n [`[inert]`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inert) attribute.\n\n This prevents interaction with the element and hides it from assistive technologies.\n\n @selector .up-destroying\n @stable\n */\n\n function markFragmentAsDestroying(element) {\n element.classList.add('up-destroying')\n element.setAttribute('inert', '')\n }\n\n /*-\n Replaces the given element with a fresh copy fetched from the server.\n\n @learn-ref live-fragments\n\n By default, reloading is **not** considered a [user navigation](/learn/navigation-defaults) and will not scroll, focus\n or update the browser location. You may change this with `{ navigate: true }`.\n\n ## Example\n\n ```js\n let { fragment } = await up.reload('.inbox')\n console.log(\"New .inbox element: \", fragment)\n ```\n\n ## Controlling the URL that is reloaded\n\n Unpoly remembers [the URL from which a fragment was loaded](/api/up-source),\n so you don't usually need to pass a URL when reloading.\n\n To reload from another URL, pass a `{ url }` option or set an `[up-source]` attribute\n on the element being reloaded or its ancestors.\n\n ## Skipping updates when nothing changed\n\n The server can answer `304 Not Modified` when the fragment hasn't changed. See [conditional requests](/learn/conditional-requests).\n\n ## Restoring content from cache\n\n To instantly restore a fragment to the last [cached](/learn/caching) version, pass a `{ cache: true }` option:\n\n ```js\n up.reload('.inbox', { cache: true }) // mark: cache: true\n ```\n\n If the fragment source isn't cached, a network request is made.\n\n To restore a fragment from cache, but [revalidate](/learn/caching#revalidation) cached content that\n has [expired](/learn/caching#expiration), also pass a `{ revalidate: 'auto' }` option:\n\n ```js\n up.reload('.inbox', { cache: true, revalidate: 'auto' }) // mark: revalidate: 'auto'\n ```\n\n @function up.reload\n\n @section Targeting\n @param {string|Element|Array<Element>|jQuery} [element]\n The element or selector that should be reloaded.\n\n If omitted, an element matching a selector in `up.fragment.config.mainTargets` will be reloaded.\n\n When an `Element` object is passed, a target selector will be [derived](/learn/target-derivation).\n\n @section Render options\n @param {Object} [options]\n Additional [render options](/api/up.render#parameters) to use when reloading the fragment.\n\n Common options are documented below, but most [options for `up.render()`](/api/up.render#parameters) may be used.\n\n Defaults can be configured in `up.fragment.config.reloadOptions` and `up.fragment.config.renderOptions`.\n\n @param {boolean} [options.navigate=false]\n Whether the reloading constitutes a [user navigation](/learn/navigation-defaults).\n\n @section Request\n @mix up.render/request\n @param options.url\n The URL from which to reload the fragment.\n\n Defaults to the [URL from which the fragment was originally loaded](/api/up.fragment.source).\n\n @section Caching\n @param {boolean} [options.cache=false]\n Whether to restore the fragment from the [cache](/learn/caching).\n\n By default the cache is ignored and a new HTTP request is sent.\n Pass `{ cache: true }` to restore the fragment from the cache.\n\n @param {boolean|string} [options.revalidate=false]\n @like up.render\n\n @section Scrolling\n @param [options.scroll='keep']\n Whether to scroll after the fragment was reloaded.\n\n By default Unpoly will [keep scroll positions](/learn/scrolling#keep) of all viewports\n around the updated fragment.\n\n See [scrolling](/learn/scrolling) for a list of allowed values.\n\n @like up.render\n\n @section Focus\n @param [options.focus='keep']\n What to focus after the fragment was reloaded.\n\n By default Unpoly will [keep the current focus](/learn/focus#keep)\n within the updated fragment.\n\n See [focus](/learn/focus) for a list of allowed values.\n\n @like up.render\n\n @section Loading state\n @mix up.render/loading-state\n\n @section Client state\n @mix up.reload/client-state\n\n @section Lifecycle hooks\n @mix up.render/lifecycle-hooks\n\n @return\n @like up.render\n\n @stable\n @signature\n */\n function reload(...args) {\n const options = { ...config.reloadOptions, ...parseTargetAndOptions(args) }\n options.target ||= ':main'\n const element = getSmart(options.target, options)\n options.url ||= sourceOf(element)\n options.headers = u.merge(options.headers, conditionalHeaders(element))\n if (options.keepData || e.booleanAttr(element, 'up-keep-data')) {\n options.data = up.data(element)\n }\n up.migrate.postprocessReloadOptions?.(options)\n return render(options)\n }\n\n function conditionalHeaders(element) {\n let headers = {}\n let time = timeOf(element)\n if (time) {\n headers['If-Modified-Since'] = time.toUTCString()\n }\n let etag = etagOf(element)\n if (etag) {\n headers['If-None-Match'] = etag\n }\n return headers\n }\n\n /*-\n Fetches the given URL with JavaScript and [replaces](/api/up.render) the\n [current layer](/api/up.layer.current)'s [main fragment](/api/up.fragment.config#config.mainTargets)\n with a matching fragment from the server response.\n\n ### Example\n\n This would replace the current page with the response for `/users`:\n\n ```js\n up.visit('/users')\n ```\n\n @function up.visit\n\n @section Destination\n @param {string} url\n The URL to visit.\n\n @section Render options\n @param {Object} [options]\n Additional [render options](/api/up.render#parameters) to use for rendering the destination URL.\n\n Most [options for `up.render()`](/api/up.render#parameters) may be used.\n\n @return\n @like up.render\n\n @stable\n */\n function visit(url, options) {\n return navigate({ ...options, url })\n }\n\n const KEY_PATTERN = /^(onFail|on|fail)?(.+)$/\n\n /*-\n Removes a \"fail\" prefix or infix from an options key.\n\n Returns `undefined` if the given key has no \"fail\" prefix or infix.\n\n ## Examples\n\n ```js\n successKey('target') // result: undefined\n successKey('onFinished') // result: undefined\n successKey('failTarget') // result: 'target'\n successKey('onFailFinished') // result: 'onFinished'\n ```\n\n @function up.fragment.successKey\n @internal\n */\n function successKey(key) {\n let match = KEY_PATTERN.exec(key)\n if (match) {\n let [_, prefix, suffix] = match\n\n switch (prefix) {\n case 'onFail':\n return 'on' + u.upperCaseFirst(suffix)\n case 'fail':\n return u.lowerCaseFirst(suffix)\n }\n }\n }\n\n /*-\n Adds a \"fail\" prefix or infix from an options key.\n\n Returns `undefined` if the key already has a \"fail\" prefix or infix.\n\n ## Examples\n\n ```js\n failKey('target') // result: 'failTarget'\n failKey('onFinished') // result: 'onFailFinished'\n failKey('failTarget') // result: undefined\n failKey('onFailFinished') // result: undefined\n ```\n\n @function up.fragment.failKey\n @internal\n */\n function failKey(key) {\n let match = KEY_PATTERN.exec(key)\n if (match) {\n let [_, prefix, suffix] = match\n\n switch (prefix) {\n case 'on':\n return 'onFail' + u.upperCaseFirst(suffix)\n case undefined:\n return 'fail' + u.upperCaseFirst(suffix)\n }\n }\n }\n\n /*-\n [Derives a CSS selector](/learn/target-derivation) that matches the given element as good as possible.\n\n If no target can be derived and [verified](/learn/target-derivation#verification), an error `up.CannotTarget` is thrown.\n\n ### Example\n\n ```js\n element = up.element.createFromHTML('<span class=\"klass\">...</span>')\n selector = up.fragment.toTarget(element) // returns '.klass'\n ```\n\n @function up.fragment.toTarget\n @section Element\n @param {Element|string} element\n The element for which to create a selector.\n\n When a string is given, it is returned unchanged.\n @param {boolean} [options.strong=false]\n Whether to provide a more unique selector by only considering the element's `[id]` and `[up-id]` attributes.\n\n Weaker target derivers, like the element's class, are not considered in strong mode.\n The element's tag name is only considered for singleton elements like `<html>` or `<body>`.\n\n @experimental\n @section Verification\n @param {boolean} [options.verify]\n Whether to verify that the derived selector matches the given element.\n\n Defaults to `up.fragment.config.verifyDerivedTarget`.\n\n @param {Element} [options.origin]\n The origin used to [resolve an ambiguous selector](/learn/targeting-fragments#ambiguous-selectors)\n during [target verification](/learn/target-derivation#verification).\n @return {string}\n The derived selector string.\n @stable\n */\n function toTarget(element, options) {\n return u.presence(element, u.isString) || tryToTarget(element, options) || cannotTarget(element)\n }\n\n /*-\n Returns whether Unpoly can [derive a target selector](/learn/target-derivation) for the given element.\n\n @function up.fragment.isTargetable\n @section Element\n @param {Element} element\n The element to test.\n @param [options.strong]\n @like up.fragment.toTarget\n @section Verification\n @param [options.verify]\n @like up.fragment.toTarget\n @param [options.origin]\n @like up.fragment.toTarget\n @return {boolean}\n Whether a selector can be derived for the given element.\n @stable\n */\n function isTargetable(element, options) {\n return !!tryToTarget(element, options)\n }\n\n function untargetableMessage(element) {\n return `Cannot derive good target selector from a <${element.localName}> element without identifying attributes. Try setting an [id] or configure up.fragment.config.targetDerivers.`\n }\n\n function cannotTarget(element) {\n throw new up.CannotTarget(untargetableMessage(element))\n }\n\n function tryToTarget(element, options = {}) {\n let derivers = options.strong ? config.strongTargetDerivers : config.targetDerivers\n\n return u.findResult(derivers, function(deriver) {\n let target = deriveTarget(element, deriver)\n\n if (target && isGoodTarget(target, element, options)) {\n return target\n }\n })\n }\n\n function deriveTarget(element, deriver) {\n if (u.isFunction(deriver)) {\n return deriver(element)\n } else if (element.matches(deriver)) {\n try {\n // Now that we know that a deriver is applicable to our element, we're using\n // the element's tag name and attribute to form a more specific target.\n // E.g. a deriver '[up-id]' should result in a target '[up-id=\"messages\"]'.\n return deriveTargetFromPattern(element, deriver)\n } catch (e) {\n if (e instanceof up.CannotParse) {\n // This error can be thrown for two reasons:\n // (1) up.element.parseSelector() cannot parse the given string\n // (2) up.element.parseSelector() parses a selector with a depth > 1.\n return deriver\n } else {\n throw e\n }\n }\n }\n }\n\n function deriveTargetFromPattern(element, deriver) {\n // Now that we know that a deriver is applicable to our element, we're using\n // the element's tag name and attribute to form a more specific target.\n // E.g. a deriver '[up-id]' should result in a target '[up-id=\"messages\"]'.\n\n let { includePath, excludeRaw } = e.parseSelector(deriver)\n\n if (includePath.length !== 1) {\n // It's not straightforward to improve a descendant selector like '.foo .bar' or '.foo > .bar'.\n // It's also not common to see such selectors configured in config.targetDerivers.\n // Hence we just return the matching deriver.\n throw new up.CannotParse(deriver)\n }\n\n let { tagName, id, classNames, attributes } = includePath[0]\n let result = ''\n\n if (tagName === '*') {\n // In a deriver '*' means to include the actual tag name in the target-\n // Use the local name, which keeps the case of camelCase SVG elements like <clipPath>.\n // Type selectors match those case-sensitively, so tagName.toLowerCase() would not match.\n result += element.localName\n } else if (tagName) {\n // If a deriver contains an actual tag name like 'main' it becomes\n // part of the target selector.\n result += tagName\n }\n\n for (let className of classNames) {\n result += e.classSelector(className)\n }\n\n if (id) {\n result += e.idSelector(id)\n }\n\n for (let attributeName in attributes) {\n // If a deriver contains an attribute value (e.g. '[rel=canonical]') we use that for the target.\n // If the deriver has a value-less attribute (e.g. '[rel]') we use the actual attribute value from the element.\n let attributeValue = attributes[attributeName] || element.getAttribute(attributeName)\n\n if (attributeName === 'id') {\n // We allow a deriver '[id]' to apply to all elements with an ID.\n // However, we want to use an ID selector ('#foo') instead of an attribute selector ('[id=foo]').\n result += e.idSelector(attributeValue)\n } else if (attributeName === 'class') {\n // We allow a deriver '[class]' to apply to all elements with a class.\n // However, we want to (1) filter class against config.badTargetClasses and\n // (2) use an class selector ('.foo') instead of an attribute selector ('[class=foo]').\n for (let goodClass of goodClassesForTarget(element)) {\n result += e.classSelector(goodClass)\n }\n } else {\n result += e.attrSelector(attributeName, attributeValue)\n }\n }\n\n if (excludeRaw) {\n result += excludeRaw\n }\n\n return result\n }\n\n function isGoodTarget(target, element, options = {}) {\n let verify = options.verify ?? config.verifyDerivedTarget\n return !isAlive(element) || !verify || up.fragment.get(target, { layer: element, ...options }) === element\n }\n\n /*-\n Sets a unique identifier for this element.\n\n This identifier is used in [target derivation](/learn/target-derivation)\n to create a CSS selector that matches this element precisely.\n If the element already has [other attributes that make a good identifier](/learn/target-derivation#derivation-patterns),\n like a good `[id]` or `[class]` attribute, it is not necessary to also set `[up-id]`.\n\n @learn-ref target-derivation\n\n ### Example\n\n Take this element:\n\n ```html\n <section>\n <h2>Latest news</h2>\n </section>\n ```\n\n Unpoly cannot generate a good CSS selector for this element:\n\n ```js\n up.fragment.toTarget(element)\n // throws error: up.CannotTarget\n ```\n\n We can improve this by assigning an `[up-id]`:\n\n ```html\n <section up-id=\"latest-news\">\n <h2>Latest news</h2>\n </section>\n ```\n\n The attribute value is used to create a better selector:\n\n ```js\n up.fragment.toTarget(element)\n // returns '[up-id=\"latest-news\"]'\n ```\n\n @selector [up-id]\n @param up-id\n A string that uniquely identifies this element.\n @stable\n */\n\n function matchesPattern(pattern, str) {\n if (u.isRegExp(pattern)) {\n return pattern.test(str)\n } else {\n return pattern === str\n }\n }\n\n function goodClassesForTarget(element) {\n let isGood = (klass) => !u.some(config.badTargetClasses, (badTargetClass) => matchesPattern(badTargetClass, klass))\n return u.filter(element.classList, isGood)\n }\n\n const MAIN_PSEUDO = /:main\\b/\n const LAYER_PSEUDO = /:layer\\b/\n const ORIGIN_PSEUDO = /:origin\\b/\n\n function containsMainPseudo(target) {\n return MAIN_PSEUDO.test(target)\n }\n\n function expandTargets(targets, options = {}) {\n const { layer } = options\n if (layer !== 'new' && !(layer instanceof up.Layer)) {\n up.fail('Must pass an up.Layer as { layer } option, but got %o', layer)\n }\n\n // Copy the list since targets might be a jQuery collection, and this does not support shift or push.\n targets = u.copy(u.wrapList(targets))\n\n const expanded = []\n\n while (targets.length) {\n let target = targets.shift()\n if (target === true) target = ':main'\n\n if (containsMainPseudo(target)) {\n let mode = resolveMode(options)\n let replaced = up.layer.mainTargets(mode).map((mainTarget) => target.replace(MAIN_PSEUDO, mainTarget))\n targets.unshift(...replaced)\n } else if (LAYER_PSEUDO.test(target)) {\n // Discard this target for new layers, which don't have a first-swappable-element.\n // Also don't && the layer check into the `else if` condition above, or it will\n // be returned as a verbatim string below.\n if (layer === 'new' || layer.state === 'opening') continue\n let firstSwappableTarget = toTarget(layer.getFirstSwappableElement(), options)\n targets.unshift(target.replace(LAYER_PSEUDO, firstSwappableTarget))\n } else if (u.isElementLike(target)) {\n expanded.push(toTarget(target, options))\n } else if (u.isString(target)) {\n expanded.push(resolveOrigin(target, options))\n }\n }\n\n return u.uniq(expanded)\n }\n\n function resolveMode({ layer, mode }) {\n if (layer === 'new') {\n return mode || up.fail('Must pass a { mode } option together with { layer: \"new\" }')\n } else {\n return layer.mode\n }\n }\n\n function modernResolveOrigin(target, { origin } = {}) {\n return target.replace(ORIGIN_PSEUDO, function(match) {\n if (origin) {\n return toTarget(origin)\n } else {\n up.fail('Missing { origin } element to resolve \"%s\" reference (found in %s)', match, target)\n }\n })\n }\n\n function resolveOrigin(target, options) {\n // up.FormValidator sometimes calls resolveOrigin(undefined)\n if (!u.isString(target)) return target\n return (up.migrate.resolveOrigin || modernResolveOrigin)(target, options)\n }\n\n function splitTarget(target) {\n return u.getComplexTokens(target)\n }\n\n function parseTargetSteps(target, options = {}) {\n let defaultPlacement = options.defaultPlacement || 'swap'\n let defaultMaybe = options.defaultMaybe ?? false\n\n let steps = []\n let simpleSelectors = splitTarget(target)\n\n for (let selector of simpleSelectors) {\n if (selector === ':none') continue\n\n let placement = defaultPlacement\n let maybe = defaultMaybe\n\n selector = selector.replace(/::?(before|after|content)\\b/, (_match, customPlacement) => {\n placement = customPlacement\n return ''\n })\n\n selector = selector.replace(/:maybe\\b/, () => {\n maybe = true\n return ''\n })\n\n // Each step inherits all options of this change.\n const step = {\n ...options,\n selector,\n placement,\n maybe,\n originalRenderOptions: options,\n }\n\n steps.push(step)\n }\n\n return steps\n }\n\n function hasAutoHistory(newFragments, layer) {\n // We cannot use up.fragment.contains(fragment, config.autoHistoryTargets)\n // because fragment is not yet attached when we are called from up.Change.OpenLayer.\n\n let vanillaSelector = expandTargets(config.autoHistoryTargets, { layer }).join()\n\n for (let newFragment of newFragments) {\n if (e.subtree(newFragment, vanillaSelector).length) {\n return true\n }\n }\n\n up.puts('up.render()', \"Will not auto-update history because fragment doesn't contain a selector from up.fragment.config.autoHistoryTargets\")\n return false\n }\n\n /*-\n A pseudo-selector that matches the layer's [main fragment](/api/up-main).\n\n Use `:main` to only update the main fragment, while keeping static layout elements around it.\n To replace all visible elements of a layer, see `:layer`.\n\n @learn-ref targeting-fragments\n\n ## Targeting the main fragment\n\n You can target the main fragment using the `:main` selector:\n\n ```html\n <a href=\"/cards/5\" up-target=\":main\">Load post</a>\n\n <main>\n Post will appear here\n </main>\n ```\n\n Unpoly will also update `:main` if no other target is given:\n\n ```html\n <a href=\"/cards/5\" up-follow>Load post</a>\n\n <main>\n Post will appear here\n </main>\n ```\n\n Also see [targeting the main fragment](/learn/targeting-fragments#targeting-the-main-element).\n\n ## Default main targets\n\n The default main targets are:\n\n - any element with an `[up-main]` attribute\n - the HTML5 [`<main>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/main) element\n - the current layer's [topmost swappable element](/api/layer)\n\n You may configure main target selectors in `up.fragment.config.mainTargets`.\n\n @selector :main\n @stable\n */\n\n /*-\n Marks this element as the [main fragment](/learn/targeting-fragments#targeting-the-main-element) of your application layout.\n\n Unpoly will update the main fragment when no more specific render target is given.\n\n @learn-ref targeting-fragments\n\n ## Example\n\n Many links simply replace the main fragment in your application layout.\n\n Unpoly lets you mark this element as a default target using the `[up-main]` attribute:\n\n ```html\n <body>\n <div class=\"layout\">\n <div class=\"layout--side\">\n ...\n </div>\n <div class=\"layout--content\" up-main>\n ...\n </div>\n </div>\n </body>\n ```\n\n Once the main fragment is marked, you no longer need `[up-target]` in a link.\\\n Use `[up-follow]` and the `[up-main]` element will be replaced:\n\n ```html\n <a href=\"/foo\" up-follow>...</a>\n ```\n\n If you want to update something more specific, you can still use `[up-target]`:\n\n ```html\n <a href=\"/foo\" up-target=\".profile\">...</a>\n ```\n\n ## Overlays can use a different main fragment {#overlays}\n\n Overlays often use a different default selector, e.g. to exclude a navigation bar.\n\n To mark a different main fragment for an overlay, set the [layer mode](/learn/overlays#layer-modes) as the\n value of the `[up-main]` attribute:\n\n ```html\n <body>\n <div class=\"layout\" up-main=\"root\">\n <div class=\"layout--side\">\n ...\n </div>\n <div class=\"layout--content\" up-main=\"modal\">\n ...\n </div>\n </div>\n </body>\n ```\n\n ## Using existing elements as main targets\n\n Instead of the `[up-main]` attribute you may also use the standard [`<main>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/main) element.\n\n You may also configure an existing selector in `up.fragment.config.mainTargets`:\n\n ```js\n up.fragment.config.mainTargets.push('.layout--content')\n ```\n\n You may configure layer-specific targets in `up.layer.config`:\n\n ```js\n up.layer.config.popup.mainTargets.push('.menu') // for popup overlays\n up.layer.config.drawer.mainTargets.push('.menu') // for drawer overlays\n up.layer.config.overlay.mainTargets.push('.layout--content') // for all overlay modes\n ```\n\n @selector [up-main]\n @param [up-main]\n A space-separated list of [layer modes](/learn/overlays#layer-modes) for which this element is the main fragment.\n\n Omit the attribute value to make this the main fragment for *all* layer modes.\n\n To use a different main fragment for all overlays (but not the root layer), set `[up-main=overlay]`.\n @stable\n */\n\n /*-\n To make a server request without changing a fragment, use the `:none` [target](/learn/targeting-fragments).\n\n @learn-ref targeting-fragments\n\n ### Example\n\n Clicking this link will make a request to `/ping`, but not update any element:\n\n ```html\n <a href=\"/ping\" up-target=\":none\">Ping server</a>\n ```\n\n @selector :none\n @stable\n */\n\n /*-\n Your [target selectors](/learn/targeting-fragments) may use this pseudo-selector\n to reference the origin element that triggered the change.\n\n The `:origin` placeholder will be replaced with a target [derived](/learn/target-derivation)\n from the origin element.\n\n @learn-ref targeting-fragments#ambiguous-selectors\n\n\n ## Example\n\n @include origin-selector-example\n\n ## Default origins\n\n The origin element is automatically set for many actions, for example:\n\n @include default-origins\n\n ## Setting the origin programmatically\n\n When updating fragments programmatically through functions like `up.render()`\n you may pass an origin element as an `{ origin }` option:\n\n ```js\n element.addEventListener('click', function(event) {\n up.render('.preview', { url: '/preview', origin: element })\n })\n ```\n\n You do not need to pass an `{ origin }` for functions that already have a\n natural origin:\n\n ```js\n up.follow(link) // link will be set as { origin }\n ```\n\n > [TIP]\n > Ensuring an origin is set may improve the precision of fragment lookup, even if\n > a [target selector](/learn/targeting-fragments) doesn't contain an `:origin` reference.\n > In the example above, Unpoly would prefer to match `.preview` in the\n > [region](/learn/targeting-fragments#ambiguous-selectors) of the origin.\n > If no origin is known, Unpoly will always match the first `.preview` in the\n > current [layer](/api/up.layer).\n\n @selector :origin\n @stable\n */\n\n /*-\n Your [target selectors](/learn/targeting-fragments) may use this pseudo-selector\n to replace the layer's topmost swappable element.\n\n @learn-ref targeting-fragments\n\n ## What is targeted\n\n @include topmost-swappable-layer-element\n\n Use `:layer` to replace all visible elements of a layer. To only update a layer's main fragment\n while keeping static layout elements around it, see `:main`.\n\n ## Example\n\n We open an overlay with a target selector `#foo`:\n\n ```\n up.layer.open({ target: '#foo', content: 'Hello from overlay' })\n ```\n\n The topmost swappable element is now `#foo`, which we can select with `:layer`:\n\n ```js\n // targets '#foo'\n up.render({ target: ':layer', url: '/page2' })\n ```\n\n The resolution of `:layer` depends on the targeted layer. For example, when rendering in\n the root layer, `:layer` will resolve to the `<body>`:\n\n ```js\n // targets the body\n up.render({ target: ':layer', layer: 'root', url: '/page2' })\n ```\n\n @selector :layer\n @stable\n */\n\n /*-\n Returns whether the given element matches the given CSS selector or other element.\n\n Other than [`Element#matches()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/matches)\n this function supports non-standard selectors like `:main` or `:layer`.\n\n Instead of a selector you may also pass a second element. In that case\n the function returns whether both elements match the same [derived target](/learn/target-derivation).\n\n ### Examples\n\n ```js\n let element = document.querySelector('div[up-main]')\n up.fragment.matches(element, 'div') // result: true\n up.fragment.matches(element, 'span') // result: false\n up.fragment.matches(element, ':main') // result: true\n up.fragment.matches(element, element) // result: true\n ```\n\n @function up.fragment.matches\n\n @section Comparison\n @param {Element} fragment\n The element to test.\n @param {string|Element} selector\n The selector that the `fragment` should match.\n\n When an `Element` is passed as this `selector` argument, this functions tests whether `fragment` matches\n a [target derived](/learn/target-derivation) from `selector`.\n\n @section Layer\n @param {string|up.Layer} [options.layer]\n The layer for which to match.\n\n Pseudo-selectors like `:main` may expand to different selectors in different layers.\n\n Defaults to the layer of `fragment`.\n @param {string|up.Layer} [options.mode]\n Required if `{ layer: 'new' }` is passed.\n\n @return {boolean}\n Whether `fragment` matches the given `selector`.\n\n @stable\n */\n function matches(element, selector, options = {}) {\n element = e.get(element)\n if (u.isElement(selector)) {\n let target = tryToTarget(selector)\n return target && element.matches(target)\n } else {\n return new up.Selector(selector, element, options).matches(element)\n }\n }\n\n function matchSelectorMap(element, selectorMap, { layer = element } = {}) {\n let hits = []\n\n if (selectorMap && element) {\n for (let [selector, value] of Object.entries(selectorMap)) {\n if (u.isDefined(value) && matches(element, selector, { layer })) {\n hits.push(value)\n }\n }\n }\n\n return hits\n }\n\n function shouldRevalidate(request, response, options = {}) {\n return request.fromCache && u.evalAutoOption(options.revalidate, config.autoRevalidate, response)\n }\n\n function isContainedByRivalStep(steps, candidateStep) {\n return u.some(steps, function(rivalStep) {\n return (rivalStep !== candidateStep) &&\n ((rivalStep.placement === 'swap') || (rivalStep.placement === 'content')) &&\n rivalStep.oldElement.contains(candidateStep.oldElement)\n })\n }\n\n function compressNestedSteps(steps) {\n if (steps.length < 2) return steps\n let compressed = u.uniqBy(steps, 'oldElement')\n compressed = u.reject(compressed, (step) => isContainedByRivalStep(compressed, step))\n return compressed\n }\n\n /*-\n [Aborts requests](/learn/aborting-requests) targeting a fragment or layer.\n\n Always emits the event `up:fragment:aborted`, regardless of whether there were requests to abort.\n If a request was aborted, the event `up:request:aborted` will also be emitted.\n\n @learn-ref aborting-requests\n\n ### Aborting requests targeting a fragment\n\n To abort pending requests [targeting](/learn/targeting-fragments) an element or its descendants,\n pass a reference or CSS selector for that element:\n\n ```js\n up.fragment.abort(element)\n up.fragment.abort('.foo')\n ```\n\n You may also pass an `{ origin }` or `{ layer }` option to help look up the selector.\n\n ### Aborting requests targeting a layer\n\n To abort all requests targeting elements on a given layer,\n pass a [`{ layer }` option](/learn/targeting-other-layers):\n\n ```js\n up.fragment.abort({ layer: 'root' })\n ```\n\n ### Aborting all requests\n\n This would abort requests targeting any elements on any layer:\n\n ```js\n up.fragment.abort({ layer: 'any' })\n ```\n\n ### Low-level API\n\n There is also a low-level `up.network.abort()` function, which aborts requests\n matching arbitrary conditions.\n\n If possible, prefer `up.fragment.abort()`, which matches requests by screen region.\n Only when requests are aborted by screen region, components\n can [react to being aborted](/api/up:fragment:aborted).\n\n\n @function up.fragment.abort\n @section Matching requests\n @param {string|Element|List<Element>} [element]\n The element (or selector) for which requests should be aborted.\n\n May be omitted with `{ layer }` option.\n @param {string|up.Layer} [options.layer]\n The [layer](/learn/targeting-other-layers) for which requests should be aborted.\n\n May be omitted with `element` argument.\n @param {Element} [options.origin]\n The element causing requests to be aborted.\n\n This is used to look up an `element` selector or `{ layer }` name.\n @param {up.Request} [options.except]\n A request that should not be aborted, even if it matches\n the conditions above.\n\n @experimental\n @section Debugging\n @param {string} [options.reason]\n The reason for aborting requests.\n\n The promise by an aborted `up.request()` will reject with this reason\n to help debugging an unexpected aborting.\n\n If omitted, a default message will describe the abort conditions.\n @stable\n */\n function abort(...args) {\n let options = parseTargetAndOptions(args)\n\n // The function that checks whether a given function will be aborted.\n let testFn\n\n // The reason will be logged with the up:request:abort event when we actually abort an event.\n // It should be a string, not an array that goes through sprintf().\n let { reason, newLayer, jid } = options\n\n // At the end we're going to emit up:fragment:aborted on these elements.\n // Other async code observing these elements can then chose to abort itself.\n let elements\n\n // An element can be passed as first argument (public API) or as { target } option.\n // There's also an internal API that { target } can be an array of elements.\n // This is used by up.RenderJob.\n if (options.target) {\n // If we're given an element or selector, we abort all requests\n // targeting that subtree.\n elements = getAll(options.target, options)\n testFn = (request) => request.isBoundToSubtrees(elements)\n reason ||= 'Aborting requests within fragment'\n } else {\n // If we're not given an element or selector, we abort all layers\n // matching the { layer } option. If no { layer } option is given,\n // all requests in the current layer are aborted.\n //\n // This behavior is slightly inconsistent with that of other up.fragment\n // functions, which operate on the main element if no other target is given.\n // However, when we navigate on a layer, we want to abort *all* requests on\n // that layer, even requests with a target outside of main, e.g. a nav bar.\n let layers = up.layer.getAll(options)\n elements = u.map(layers, 'element')\n testFn = (request) => request.isBoundToLayers(layers)\n reason ||= 'Aborting requests within ' + layers.join(', ')\n }\n\n let testFnWithAbortable = (request) => request.abortable && testFn(request)\n up.network.abort(testFnWithAbortable, { ...options, reason })\n\n // We *always* emit an `up:fragment:aborted` event, even when there is no\n // request being aborted. This event serves for *any* async code that may want\n // to abort itself, e.g. timers waiting for a delay.\n for (let element of elements) {\n // Some effort has invested to log about aborting only when necessary:\n //\n // (1) We don't log on up:fragment:aborted. This event is emitted with *every*\n // fragment update, whether or not we're actually aborting requests. Logging\n // with every update would make the log noisy and confusing.\n // (2) When we *do* abort a request, up:request:aborted is emitted and logged.\n // This is done in up.Request#setAbortedState().\n // (3) When up.fragment.abort() is called via up.render({ abort }) we also log\n // a message \"Change with { abort } option will abort other requests' before\n // we abort the first request. This is done via an { logOnce } option that\n // this function passes on to up.network.abort().\n up.emit(element, 'up:fragment:aborted', { reason, newLayer, jid, log: reason })\n }\n }\n\n /*-\n This event is emitted when requests for an element were [aborted](/learn/aborting-requests).\n\n This event is emitted on the element for which requests were aborted.\n If requests for an entire layer were aborted, this event is emitted on the\n [layer's outmost element](/api/up.Layer.prototype.element).\n\n @learn-ref aborting-requests\n\n ### Example\n\n This would run code when an element or its descendants were aborted:\n\n ```js\n up.on(element, 'up:fragment:aborted', function(event) {\n // element or its descendants were aborted\n })\n ```\n\n A more common use case is to run code when an element *or one of its ancestors*\n were aborted:\n\n ```js\n // Listen to all up:fragment:aborted events in case an ancestor\n let off = up.on('up:fragment:aborted', function(event) {\n if (up.fragment.contains(event.target, element)) {\n // element or an ancestor in the same layer was aborted\n }\n })\n // Because we're registering a global event listener, we should\n // clean up when `element` is destroyed.\n up.destructor(element, off)\n ```\n\n To simplify observing an element and its ancestors for aborted requests,\n the function `up.fragment.onAborted()` is provided. This allows us to shorten\n the above code:\n\n ```js\n // Listen to all up:fragment:aborted events in case an ancestor\n up.fragment.onAborted(element, function(event) {\n // element or an ancestor in the same layer was aborted\n })\n ```\n\n @event up:fragment:aborted\n @param {Element} event.target\n The element for which requests were aborted.\n @param {string} event.reason\n A string describing the reason for aborting this fragment.\n\n @experimental\n @param {boolean} event.newLayer\n Whether the fragment was aborted by a [new overlay opening](/learn/opening-overlays).\n\n @experimental\n @stable\n */\n\n /*-\n Runs a callback when the given element *or its ancestors in the same layer* were [aborted](/learn/aborting-requests).\n\n Aborting another layer doesn't run the callback. For example, aborting the root layer\n doesn't affect elements in an overlay, like it doesn't abort the overlay's requests.\n\n This utility function simplifies consumption of the `up:fragment:aborted` event.\n\n ### Example\n\n Let's say we want to [reload](/api/up.reload) an element after 10 seconds.\n If requests for that element were [aborted](/learn/aborting-requests) before the\n 10 seconds are over, we no longer want to reload:\n\n ```js\n let timeout = setTimeout(() => up.reload(element), 10000)\n up.fragment.onAborted(element, () => clearTimeout(timeout))\n ```\n\n @function up.fragment.onAborted\n @param {Element} element\n The element to observe with its ancestors in the same layer.\n @param {Function(event)} callback\n The callback to run.\n\n It will be called with an `up:fragment:aborted` argument.\n @return {Function}\n A function that unsubscribes the callback.\n\n When the element is destroyed, the callback will be unsubscribed automatically.\n @experimental\n */\n function onAborted(fragment, callback) {\n // Aborting the root layer should not abort a poller in an overlay, like it doesn't abort the overlay's requests.\n return up.event.onClosest(fragment, 'up:fragment:aborted', { layer: 'origin' }, callback)\n }\n\n /*-\n Runs a callback when the given element *or its ancestors in the same layer* were [kept](/learn/keeping-elements).\n\n @function up.fragment.onKept\n @param {Element} element\n The element to observe with its ancestors in the same layer.\n @param {Function(event)} callback\n The callback to run.\n\n It will be called with an `up:fragment:kept` argument.\n @return {Function}\n A function that unsubscribes the callback.\n\n When the element is destroyed, the callback will be unsubscribed automatically.\n @experimental\n */\n function onKept(fragment, callback) {\n return up.event.onClosest(fragment, 'up:fragment:kept', { layer: 'origin' }, callback)\n }\n\n // This function lives in up.fragment (not up.element)\n // because we stop the observe via up.fragment.onAborted().\n function onFirstIntersect(element, callback, { margin = 0 } = {}) {\n // IntersectionObserver has some ms lag until it reports intersection entries.\n // This lag also exists for the initial intersection check.\n //\n // This is too slow for us when rendering an [up-defer=\"reveal\"]\n // that both (1) already cached and (2) scrolled into viewport when inserted.\n // In that case we want to immediately render the cached content and not show\n // a flash of unloaded partial. The same is true when revalidating such a partial.\n if (e.isIntersectingWindow(element, { margin })) {\n callback()\n return\n }\n\n // This function will be called (1) for the initial intersection check\n // and (2) whenever the intersection state changes.\n function processIntersectEntries(entries) {\n for (let entry of entries) {\n if (entry.isIntersecting) {\n disconnect()\n callback()\n return // just in case we have multiple entries queued\n }\n }\n }\n\n let observer = new IntersectionObserver(processIntersectEntries, { rootMargin: `${margin}px` })\n let disconnect = () => observer.disconnect()\n observer.observe(element)\n up.destructor(element, disconnect)\n }\n\n const STARTS_WITH_SELECTOR = /^([\\w-]+|\\*)?(#|\\.|[:[][a-z-]{3,})/\n\n function provideNodes(value, { origin, originLayer, data, htmlParser = e.createNodesFromHTML } = {}) {\n if (u.isString(value) && STARTS_WITH_SELECTOR.test(value)) {\n let [parsedValue, parsedData] = u.parseScalarJSONPairs(value)[0]\n data = { ...data, ...parsedData }\n value = up.fragment.get(parsedValue, { layer: 'closest', origin, originLayer }) || up.fail(`Cannot find template \"%s\"`, value)\n }\n\n if (u.isString(value)) {\n value = htmlParser(value)\n }\n\n if (isTemplate(value)) {\n value = cloneTemplate(value, data, { htmlParser })\n }\n\n return u.wrapList(value)\n }\n\n function isTemplate(value) {\n return u.isElement(value) && value.matches('template, script[type]') && !up.script.isScript(value)\n }\n\n /*-\n Clones a [template](/learn/templates) element.\n\n Emits the `up:template:clone` event. You can use that event to integrate [template engines](/learn/templates)\n like Mustache, EJS or Handlebars.\n\n @learn-ref templates\n\n ### Example\n\n ```js\n let nodes = up.template.clone('#table-placeholder')\n up.render({ fragment: nodes[0] })\n ```\n\n ### Passing variables\n\n Any [template variables](/learn/templates#dynamic) can be passed as a second argument:\n\n ```js\n let nodes = up.template.clone('#table-placeholder', { rows: 10 })\n ```\n\n @function up.template.clone\n @param {string|Element} template\n The element to clone.\n\n This is usually a `<template>` element or a `<script>` with a custom type.\n\n You may also pass a selector for the element to clone.\n @param {Object} [data = {}]\n An object with [template variables](/learn/templates#dynamic).\n @param {Element} [options.origin]\n An optional [origin](/api/origin) element used for [template lookup](/learn/templates#lookup).\n @return {List<Node>}\n A [list](/api/List) of [`Node`](https://developer.mozilla.org/en-US/docs/Web/API/Node) objects that represent\n the cloned templates.\n\n You can pass this list to any rendering function, like `up.render()` or `up.Preview#insert()`.\n @stable\n */\n function cloneTemplate(templateOrSelector, data = {}, { origin, htmlParser } = {}) {\n // Like provideNodes(), look in the origin's layer first, then in ancestor layers.\n let template = getSmart(templateOrSelector, { origin, layer: 'closest' }) || up.fail('Template not found: %o', templateOrSelector)\n let event = up.emit(template, 'up:template:clone', { data, nodes: null, log: [\"Using template %o\", templateOrSelector] })\n let nodes = event.nodes ?? defaultTemplateNodes(template, htmlParser)\n for (let node of nodes) {\n node.upTemplateData = data\n }\n return nodes\n }\n\n /*-\n This event is emitted before a [template is cloned](/learn/templates).\n\n @learn-ref templates\n\n ### Integrating template engines\n\n Listeners can use this event to [integrate template engines](/learn/templates#dynamic) by following these steps:\n\n - Listen to the `up:template:clone` event on selected `<template>` or `<script>` elements.\n - Process the given template (`event.target`) and data (`event.data`).\n - Set `event.nodes` to a [list](/api/List) of [`Node`](https://developer.mozilla.org/en-US/docs/Web/API/Node) objects representing\n the template results.\n\n When no listener sets `event.nodes`, Unpoly will simply parse the template's inner HTML. Any variables in `event.data`\n will be made available for [post-processing in a compiler](/learn/templates#compiler-postprocessing).\n\n ### Example: Integrating Mustache.js\n\n We want to integrate [Mustache](https://github.com/janl/mustache.js) to enable templates like this:\n\n ```html\n <script id=\"greeter-template\" type=\"text/mustache\"> <!-- mark: type=\"text/mustache\" -->\n <div id=\"greeter\">\n Hello, {{name}}!\n </div>\n </script>\n ```\n\n An event handler for a Mustache integration would look like this:\n\n ```js\n up.on('up:template:clone', '[type=\"text/mustache\"]', function(event) { // mark: [type=\"text/mustache\"]\n const template = event.target.innerHTML\n const result = Mustache.render(template, event.data)\n event.nodes = up.element.createNodesFromHTML(result)\n })\n ```\n\n Also see documentation for `up.element.createNodesFromHTML()`.\n\n @event up:template:clone\n @param {Element} event.target\n The template element being cloned.\n @param {Object} event.data\n Any [template variables](/learn/templates#dynamic) that should be used when cloning.\n @param {null|List<Element>} event.nodes\n A list of element and text nodes representing the cloned template result.\n\n The value is `null` initially and must be set by a listener.\n When no listener sets `event.nodes`, Unpoly will parse the template's inner HTML.\n @stable\n */\n\n function defaultTemplateNodes(template, htmlParser = e.createNodesFromHTML) {\n let templateText = template.innerHTML\n return htmlParser(templateText)\n }\n\n /*-\n Inserts the given `element` at a given `position` relative to the `reference` element.\n\n The new element will be [compiled](/api/up.hello), unless it is already compiled.\n\n Returns a function that [destroys](/api/up.destroy) the inserted element and removes it from the DOM.\n\n @function up.fragment.insertTemp\n\n @param {Element} reference\n The reference element relative to which the new element will be inserted.\n\n @param {string} [position='beforeend']\n The insert position relative to the `reference` element.\n\n @include adjacent-positions\n\n @param {Element|string} newElement\n The element to insert.\n\n You may also pass a string of HTML, which will be [parsed into an element](/api/up.element.createFromHTML).\n\n You may also pass a CSS selector matching the new element.\n\n If the element is a `<template>`, it will be cloned before insertion.\n\n The new element will be [compiled](/api/up.hello), unless it is already compiled.\n\n If the element is attached to the document before assertion, it will be moved back to its original place\n when reverting the temporary insertion. Moved elements are not re-compiled or destroyed.\n\n @return {Function}\n A function that [destroys](/api/up.destroy) the inserted element and removes it from the DOM.\n\n @internal\n */\n function insertTemp(...args) {\n let [reference, position = 'beforeend', tempValue] = u.args(args, 'val', u.isAdjacentPosition, 'val')\n\n let tempNodes = provideNodes(tempValue, { origin: reference })\n // We may be given a NodeList, or an HTML string without a single root Element.\n // In these cases we wrap it in an <up-wrapper> so we have a single root Element we\n // can pass into Element#insertAdjacentElement(), up.hello() or up.destroy().\n // This simplifies our code significantly.\n let tempElement = e.wrapIfRequired(tempNodes)\n\n // In case the element was already attached to this document, we need to remember\n // its position so we can return it when reverting.\n let oldPosition = document.contains(tempElement) && e.documentPosition(tempElement)\n\n reference.insertAdjacentElement(position, tempElement)\n\n if (oldPosition) {\n // Don't compile or destroy an element if it was connected to the document before the move.\n return () => {\n oldPosition[0].insertAdjacentElement(oldPosition[1], tempElement)\n }\n } else {\n up.hello(tempElement)\n return () => up.destroy(tempElement)\n }\n }\n\n /*-\n @function up.fragment.trackSelector\n @param {Function(): List<Element>} selectFn\n A function that returns the elements that currently match.\n\n It is called again after every render pass. To keep this cheap, look up elements\n within a small root instead of the entire document.\n @param {Function(Element): Function(Element)} callback\n A callback that is called when we discover a new match.\n The callback can return another function that is called when that element no longer matches.\n @internal\n */\n function trackSelector(selectFn, callback) {\n let tracker = new up.SelectorTracker(selectFn, callback)\n return tracker.start()\n }\n\n let mutateLevel = 0\n let afterMutateCleaner = u.cleaner('fifo')\n\n function mutate(callback) {\n try {\n mutateLevel++\n return callback()\n } finally {\n if (--mutateLevel === 0) {\n afterMutateCleaner.clean()\n }\n }\n }\n\n function afterMutate(callback) {\n if (mutateLevel === 0) {\n callback()\n } else {\n afterMutateCleaner(callback)\n }\n }\n\n up.on('up:framework:boot', function() {\n const { documentElement } = document\n\n up.hello(documentElement)\n\n documentElement.setAttribute('up-source', normalizeSource(location.href))\n\n if (!up.browser.canPushState() && up.history.isEnabled('location')) {\n return up.warn('Cannot push history changes. Next render pass with history will load a full page.')\n }\n })\n\n return {\n config,\n reload,\n destroy,\n render,\n navigate,\n get: getSmart,\n getFirstDescendant,\n all: getAll,\n subtree: getSubtree,\n contains,\n closest,\n source: sourceOf,\n normalizeSource,\n visit,\n markAsDestroying: markFragmentAsDestroying,\n emitInserted: emitFragmentInserted,\n emitDestroyed: emitFragmentDestroyed,\n emitKeep: emitFragmentKeep,\n emitKept: emitFragmentKept,\n keepPlan: findKeepPlan,\n defaultNormalizeKeepHTML, // export for testing\n successKey,\n failKey,\n expandTargets,\n resolveOrigin,\n toTarget,\n tryToTarget,\n isTargetable,\n matches,\n matchSelectorMap,\n hasAutoHistory,\n time: timeOf,\n etag: etagOf,\n shouldRevalidate,\n abort,\n onAborted,\n onKept,\n onFirstIntersect,\n splitTarget,\n parseTargetSteps,\n isAlive,\n isNotDestroying,\n compressNestedSteps,\n containsMainPseudo,\n insertTemp,\n provideNodes,\n cloneTemplate,\n trackSelector,\n mutate,\n afterMutate,\n // swapTemp,\n // timer: scheduleTimer\n }\n})()\n\nup.reload = up.fragment.reload\nup.destroy = up.fragment.destroy\nup.render = up.fragment.render\nup.navigate = up.fragment.navigate\nup.visit = up.fragment.visit\nup.template = { clone: up.fragment.cloneTemplate }\n\n/*-\nReturns the current [context](/learn/layer-context).\n\nThis is aliased as `up.layer.context`.\n\n@learn-ref layer-context\n\n@property up.context\n@param {Object} context\n The context object.\n\n If no context has been set an empty object is returned.\n@experimental\n*/\nu.delegate(up, ['context'], () => up.layer.current)\n","require('./viewport.sass')\n\n/*-\nFeatures to control scrolling and focus when fragments are updated.\n\nThe default viewport is the [document's scrolling element](https://developer.mozilla.org/en-US/docs/Web/API/Document/scrollingElement). Mark additional scrolling containers, like a pane that scrolls on its own, with `[up-viewport]` so Unpoly can scroll them when revealing an element and save their scroll positions for history restoration. Elements fixed to the screen edge, like a sticky header, get `[up-fixed=top]` so revealed content is not hidden behind them.\n\nFrom JavaScript, `up.reveal()` scrolls an element into view, and `up.viewport.saveScroll()` and `up.viewport.restoreScroll()` save and restore scroll positions. Defaults like the reveal padding live in `up.viewport.config`.\n\n@learn-ref scrolling-and-focus\n\n@module up.viewport\n*/\nup.viewport = (function() {\n\n const u = up.util\n const e = up.element\n const f = up.fragment\n\n /*-\n Configures defaults for scrolling.\n\n @property up.viewport.config\n @section Layout\n @param {Array} [config.viewportSelectors]\n An array of CSS selectors that match viewports.\n\n By default this contains the `[up-viewport]` attribute.\n\n Matching elements must have a [derivable target selector](/learn/target-derivation).\n\n @param {Array} [config.fixedTopSelectors]\n An array of CSS selectors that find elements fixed to the\n top edge of the screen (using `position: fixed`).\n\n See [`[up-fixed=\"top\"]`](/api/up-fixed-top) for details.\n @param {Array} [config.fixedBottomSelectors]\n An array of CSS selectors that match elements fixed to the\n bottom edge of the screen (using `position: fixed`).\n\n See [`[up-fixed=\"bottom\"]`](/api/up-fixed-bottom) for details.\n @param {Array} [config.anchoredRightSelectors]\n An array of CSS selectors that find elements anchored to the\n right edge of the screen (using `right:0` with `position: fixed` or `position: absolute`).\n\n See [`[up-anchored=\"right\"]`](/api/up-anchored-right) for details.\n\n @section Scrolling\n @param {number} [config.revealSnap]\n When [revealing](/api/up.reveal) elements, Unpoly will scroll a viewport\n to the top when the revealed element is closer to the viewport's top edge\n than `config.revealSnap`.\n\n Set to `0` to disable snapping.\n @param {number} [config.revealPadding]\n The desired padding between a [revealed](/api/up.reveal) element and the\n closest [viewport](/api/up.viewport) edge (in pixels).\n @param {number} [config.revealMax]\n A number indicating how many top pixel rows of a tall element to [reveal](/api/up.reveal).\n\n Defaults to 50% of the available window height.\n\n You may set this to `false` to always reveal as much of the element as the viewport allows.\n\n You may also pass a function that receives an argument `{ viewportRect, elementRect }` and returns\n a maximum height in pixels. Each given rectangle has properties `{ top, right, bottom, left, width, height }`.\n\n @experimental\n @param {number} [config.revealTop=false]\n Whether to always scroll a [revealed](/api/up.reveal) element to the top.\n\n By default Unpoly will scroll as little as possible to make the element visible.\n\n @section Focus\n @param {Function(Object): boolean} [config.autoFocusVisible]\n Whether elements focused by Unpoly should have a [visible focus ring](/learn/focus-visibility).\n\n By default the focus ring will be visible if either the user [interacted with the keyboard](/api/up.event.inputDevice)\n or the focused element is a [form field](/api/up.form.config#config.fieldSelectors).\n\n The value is a function that accepts an object with `{ element, inputDevice }` properties and returns\n a boolean. The `{ element }` property is the focused element. The `{ inputDevice }` property is a string\n denoting the [interaction's input device](/api/up.event.inputDevice).\n\n The default configuration is implemented like this:\n\n ```js\n up.viewport.config.autoFocusVisible = ({ element, inputDevice }) =>\n inputDevice === 'key' || up.form.isField(element)\n ```\n\n @experimental\n @stable\n */\n const config = new up.Config('up.viewport.config', () => ({\n viewportSelectors: ['[up-viewport]', '[up-fixed]'],\n fixedTopSelectors: ['[up-fixed~=top]'],\n fixedBottomSelectors: ['[up-fixed~=bottom]'],\n anchoredRightSelectors: ['[up-anchored~=right]', '[up-fixed~=top]', '[up-fixed~=bottom]', '[up-fixed~=right]'],\n revealSnap: 200,\n revealPadding: 0,\n revealTop: false,\n revealMax() { return 0.5 * window.innerHeight },\n autoFocusVisible({ element, inputDevice }) { return inputDevice === 'key' || up.form.isField(element) }\n }))\n\n const bodyShifter = new up.BodyShifter()\n\n up.compiler(config.selectorFn('anchoredRightSelectors'), function(element) {\n return bodyShifter.onAnchoredElementInserted(element)\n })\n\n /*-\n Scrolls the given element's viewport so the first rows of the\n element are visible for the user.\n\n ### Fixed elements obstructing the viewport\n\n Many applications have a navigation bar fixed to the top or bottom,\n obstructing the view of an element.\n\n You can make `up.reveal()` aware of these fixed elements\n so it can scroll the viewport far enough so the revealed element is fully visible.\n To make `up.reveal()` aware of fixed elements you can either:\n\n - give the element an attribute [`up-fixed=\"top\"`](/api/up-fixed-top) or [`up-fixed=\"bottom\"`](/api/up-fixed-bottom)\n - [configure default options](/api/up.viewport.config) for `{ fixedTopSelectors }` or `{ fixedBottomSelectors }`\n\n @learn-ref scrolling#reveal\n @function up.reveal\n\n @param {string|Element|jQuery} element\n The element to reveal.\n\n @param {number} [options.snap]\n When the revealed element would be closer to the viewport's top edge\n than this value, Unpoly will scroll the viewport to the top.\n\n Set to `0` to disable snapping.\n\n Defaults to `up.viewport.config.revealSnap`.\n\n @param {boolean} [options.top]\n Whether to scroll the viewport so that the first element row aligns\n with the top edge of the viewport.\n\n Defaults to `up.viewport.config.revealTop`.\n\n @param {number} [options.padding]\n The desired padding between the revealed element and the\n closest [viewport](/api/up.viewport) edge (in pixels).\n\n Defaults to `up.viewport.config.revealPadding`.\n\n @param {string}[options.behavior='instant']\n When set to `'instant'`, this will immediately scroll to the new position.\n\n When set to `'smooth'`, this will scroll smoothly to the new position.\n\n When set to `'auto'`, the behavior is determined by the CSS property\n [`scroll-behavior`](https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-behavior) of the viewport element.\n\n @param {string|Element|jQuery} [options.viewport]\n The scrolling element to scroll.\n\n Defaults to the [given element's viewport](/api/up.viewport.get).\n\n @return {undefined}\n\n @stable\n @signature\n */\n const reveal = up.mockable(function(element, options) {\n // copy options, since we will mutate it below (options.layer = ...).\n options = u.options(options)\n element = f.get(element, options)\n\n // Now that we have looked up the element with an option like { layer: 'any' },\n // the only layer relevant from here on is the element's layer.\n if (!(options.layer = up.layer.get(element))) {\n up.fail('Cannot reveal a detached element')\n }\n\n const motion = new up.RevealMotion(element, options)\n motion.start()\n\n if (options.focus) {\n tryFocus(element, { force: true, preventScroll: true })\n }\n\n return up.migrate.formerlyAsync?.('up.reveal()') || true\n })\n\n /*-\n Focuses the given element.\n\n Focusing an element will also [reveal](/api/up.reveal) it, unless `{ preventScroll: true }` is passed.\n\n @learn-ref focus#js\n @function up.focus\n\n @param {string|Element|jQuery} element\n The element to focus.\n\n @param {boolean} [options.preventScroll=false]\n Whether to prevent changes to the scroll position.\n\n @param {string} [options.inputDevice]\n The [input device](/api/up.event.inputDevice) used for the current interaction.\n\n Accepts values `'key'`, `'pointer'` and `'unknown'`.\n\n Defaults to the [current input device](up.event.inputDevice).\n\n @internal\n\n @param {boolean|string} [options.focusVisible='auto']\n Whether the focused element should have a [visible focus ring](/learn/focus-visibility).\n\n If set to `true` the element will be assigned the `.up-focus-visible` class.\n\n If set to `false` the element will be assigned the `.up-focus-hidden` class.\n\n If set to `'auto'` (the default), focus will be visible if `up.viewport.config.autoFocusVisible()`\n returns `true` for the given element and [current input device](/api/up.event.inputDevice).\n\n The [`:focus-visible`](https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible) pseudo-class will\n also be set or removed accordingly on [supporting browsers](https://caniuse.com/mdn-api_htmlelement_focus_options_focusvisible_parameter).\n\n @experimental\n\n @param {boolean} [options.force=false]\n Whether to force focus even if `element` would otherwise not be a focusable element.\n\n @stable\n\n @stable\n */\n function doFocus(element, { preventScroll, force, inputDevice, focusVisible } = {}) {\n if (force) {\n // (1) Element#tabIndex is -1 for all non-interactive elements,\n // whether or not the element has an [tabindex=-1] attribute.\n // (2) Element#tabIndex is 0 for interactive elements, like links,\n // inputs or buttons. [up-clickable] elements also get a [tabindex=0].\n // to participate in the regular tab order.\n if (!element.hasAttribute('tabindex') && element.tabIndex === -1) {\n element.setAttribute('tabindex', '-1')\n }\n }\n\n inputDevice ??= up.event.inputDevice\n focusVisible ??= 'auto'\n focusVisible = u.evalAutoOption(focusVisible, config.autoFocusVisible, { element, inputDevice })\n\n element.focus({\n preventScroll: true, // Focus without scrolling, since we're going to use our custom scrolling logic below.\n focusVisible, // Control native :focus-visible for browsers that support this option\n })\n\n // Don't rely on the `focusin` listener below to remove our focus classes, to cover\n // an edge case where the element focused multiple times with different focus devices.\n removeFocusClasses(element)\n element.classList.add(focusVisible ? 'up-focus-visible' : 'up-focus-hidden')\n\n if (!preventScroll) {\n // Use up.reveal() which scrolls far enough to ignore fixed nav bars\n // obstructing the focused element.\n return reveal(element)\n }\n }\n\n function removeFocusClasses(element) {\n element?.classList.remove('up-focus-hidden', 'up-focus-visible')\n }\n\n // Wait until another element is focused. Otherwise we would lose .up-focus-hidden\n // when the user switches to another window, then returns to the app window (where\n // a content element might still be :focus-visible).\n up.on('focusin', function({ relatedTarget }) {\n removeFocusClasses(relatedTarget)\n })\n\n\n /*-\n This class is assigned to elements that were [focused by Unpoly](/learn/focus) but should not\n have a [visible focus ring](/learn/focus-visibility).\n\n You can use this class to [remove an unwanted focus outline](#example).\n\n @learn-ref focus-visibility\n\n ## Relation to `:focus-visible`\n\n Unpoly will try to unset `:focus-visible` whenever it sets `.up-focus-visible`, but can only do so\n in [some browsers](https://caniuse.com/mdn-api_htmlelement_focus_options_focusvisible_parameter).\n Because of this the `.up-focus-hidden` class may be set on elements that the browser considers to be\n [`:focus-visible`](https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible).\n\n ## Example\n\n @include focus-ring-hide-example\n\n @selector .up-focus-hidden\n @experimental\n */\n\n /*-\n This class is assigned to elements that were [focused by Unpoly](/learn/focus) and should\n have a [visible focus ring](/learn/focus-visibility).\n\n You can use this class to [give a new component a focus ring](#example) for keyboard users,\n while not rendering a focus ring for mouse or touch users.\n\n @learn-ref focus-visibility\n\n ## Relation to `:focus-visible`\n\n Unpoly will try to force `:focus-visible` whenever it sets `.up-focus-visible`, but can only do so\n in [some browsers](https://caniuse.com/mdn-api_htmlelement_focus_options_focusvisible_parameter).\n Because of this the `.up-focus-visible` class may be set on elements that the browser considers to *not* be\n [`:focus-visible`](https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible).\n\n ## Example\n\n @include focus-ring-show-example\n\n @selector .up-focus-visible\n @experimental\n */\n\n function tryFocus(element, options) {\n doFocus(element, options)\n return element === document.activeElement\n }\n\n /*-\n [Reveals](/api/up.reveal) an element matching the given `#hash` anchor.\n\n Other than the default behavior found in browsers, `up.viewport.revealHash()` works with\n [multiple viewports](/api/up-viewport) and honors [fixed elements](/api/up-fixed-top) obstructing the user's\n view of the viewport.\n\n When the page initially loads, this function is automatically called with the hash from\n the current URL.\n\n If no element matches the given `#hash` anchor, a falsy value is returned.\n\n ### Example\n\n ```js\n up.viewport.revealHash('#chapter2')\n ```\n\n @function up.viewport.revealHash\n @param {string} hash\n Must be given!\n @param {up.Layer|string} [options.layer]\n @param {Element} [options.origin]\n @param {boolean} [options.strong]\n @param {string} [options.behavior=\"instant\"]\n @internal\n */\n function revealHash(...args) {\n return revealHashFn(...args)?.()\n }\n\n /*-\n Returns a function that [reveals](/api/up.reveal) an element matching the given `#hash` anchor.\n Returns a function that scrolls to the top if the hash is `#top` or `#`.\n Returns `undefined` if we cannot scroll.\n\n @function up.viewport.revealHashFn\n @internal\n */\n function revealHashFn(hash, { strong, layer, origin, behavior = 'instant', focus = false } = {}) {\n if (!hash) return\n\n let match = firstHashTarget(hash, { layer, origin })\n\n if (match) {\n return () => {\n let doReveal = () => reveal(match, { top: true, behavior, focus })\n if (strong) u.fastTask(doReveal)\n return doReveal()\n }\n } else if (hash === '#top') {\n return () => {\n return scrollTo(0, { behavior })\n }\n }\n }\n\n function allSelector() {\n // On Edge the document viewport can be changed from CSS\n return [rootSelector(), ...config.viewportSelectors].join()\n }\n\n /*-\n Returns the scrolling container for the given element.\n\n Returns the [document's scrolling element](/api/up.viewport.root)\n if no closer viewport exists.\n\n @function up.viewport.get\n @param {string|Element|jQuery} target\n @return {Element}\n @stable\n */\n function closest(target, options = {}) {\n const element = f.get(target, options)\n // Use up.element.closest() which searches across layer boundaries.\n // It is OK to find a viewport in a parent layer. Layers without its\n // own viewport (like popups) are scrolled by the parent layer's viewport.\n return element.closest(allSelector())\n }\n\n /*-\n Returns a list of all viewports contained within the\n given selector or element.\n\n If the given element itself is a viewport, it is included\n in the returned list.\n\n @function up.viewport.subtree\n @param {string|Element|jQuery} target\n @param {Object} options\n @return {List<Element>}\n @internal\n */\n function getSubtree(element, options = {}) {\n element = f.get(element, options)\n return e.subtree(element, allSelector())\n }\n\n /*-\n Returns the closest viewport around the given element, and all viewports\n contained within the given element.\n\n This is relevant when updating a fragment with `{ scroll: 'top' | 'bottom' | 'restore' }` or a pixel value.\n In that case we restore / reset the scroll tops of all viewports around the fragment.\n\n @function up.viewport.around\n @param {string|Element|jQuery} element\n @param {Object} options\n @return {List<Element>}\n @internal\n */\n function getAround(element, options = {}) {\n element = f.get(element, options)\n return e.around(element, allSelector())\n }\n\n /*-\n Returns a list of all the viewports on the current layer.\n\n @function up.viewport.all\n @internal\n */\n function getAll(options = {}) {\n return f.all(allSelector(), options)\n }\n\n function rootSelector() {\n return getRoot().tagName\n }\n\n /*-\n Returns the [scrolling element](https://developer.mozilla.org/en-US/docs/Web/API/document/scrollingElement)\n for the browser's main content area.\n\n @property up.viewport.root\n @param {Element} root\n @stable\n */\n function getRoot() {\n return document.scrollingElement\n }\n\n function rootWidth() {\n // This should happen on the <html> element, regardless of document.scrollingElement\n return e.root.clientWidth\n }\n\n function rootHeight() {\n // This should happen on the <html> element, regardless of document.scrollingElement\n return e.root.clientHeight\n }\n\n function isRoot(element) {\n return element === getRoot()\n }\n\n function rootScrollbarWidth() {\n return window.innerWidth - rootWidth()\n }\n\n function scrollTopKey(viewport) {\n return up.fragment.tryToTarget(viewport)\n }\n\n /*-\n @function up.viewport.fixedElements\n @internal\n */\n function fixedElements(root = document) {\n const queryParts = ['[up-fixed]'].concat(config.fixedTopSelectors).concat(config.fixedBottomSelectors)\n return root.querySelectorAll(queryParts.join())\n }\n\n /*-\n Saves scroll positions for later restoration.\n\n The scroll positions will be associated with the current URL.\n They can later be restored by calling `up.viewport.restoreScroll()`\n at the same URL, or by following a link with an [`[up-scroll=\"restore\"]`](/learn/scrolling#restore)\n attribute.\n\n Unpoly automatically saves scroll positions before [navigating](/learn/navigation-defaults).\n\n @function up.viewport.saveScroll\n @param {Element|Array<Element>} [viewport]\n The viewports for which to save scroll positions.\n\n Defaults to all viewports within the given layer.\n @param {string} [options.location]\n The URL for which to save scroll positions.\n\n If omitted, the given [layer's location](/api/up.Layer.prototype.location) is used.\n @param {string} [options.layer = 'current']\n The layer for which to save scroll positions.\n\n If omitted, positions for the current layer will be saved.\n @stable\n */\n function saveScroll(...args) {\n const [viewports, options] = parseOptions(args)\n const location = options.location || options.layer.location\n if (location) {\n const tops = getScrollTopsForViewportElements(viewports)\n options.layer.lastScrollTops.set(location, tops)\n }\n }\n\n /*-\n Returns a hash with scroll positions.\n\n Each key in the hash is a viewport selector. The corresponding\n value is the viewport's vertical scroll position:\n\n getScrollTopsForSave(viewports)\n => { '.main': 0, '.sidebar': 73 }\n\n @function getScrollTopsForSave\n @return {Object<string, number>}\n @internal\n */\n function getScrollTopsForViewportElements(viewports) {\n let tops = {}\n for (let viewport of viewports) {\n let key = scrollTopKey(viewport)\n if (key) {\n tops[key] = viewport.scrollTop\n } else {\n up.warn('up.viewport.saveScroll()', 'Cannot save scroll positions for untargetable viewport %o', viewport)\n }\n }\n return tops\n }\n\n function getScrollTops(...args) {\n let viewports = getAll(...args)\n return getScrollTopsForViewportElements(viewports)\n }\n\n /*-\n Restores [previously saved](/api/up.viewport.saveScroll) scroll positions.\n\n If no saved scroll position is known, scroll positions are not changed\n and `false` is returned.\n\n Unpoly automatically restores scroll positions when the user [presses the back button](/learn/restoring-history).\n\n @function up.viewport.restoreScroll\n @param {Element|Array<Element>} [viewport]\n The viewports for which to restore scroll positions.\n\n Defaults to all viewports within the given layer.\n @param {up.Layer|string} [options.layer='current']\n The layer on which to restore scroll positions.\n @param {string} [options.location]\n The URL for which to restore scroll positions.\n\n If omitted, the given [layer's location](/api/up.Layer.prototype.location) is used.\n @return {boolean}\n Returns whether scroll positions could be restored.\n @stable\n */\n function restoreScroll(...args) {\n const [viewports, options] = parseOptions(args)\n const location = options.location || options.layer.location\n const scrollTops = options.scrollTops ?? options.layer.lastScrollTops.get(location)\n if (scrollTops) {\n setScrollPositions(viewports, scrollTops, 0)\n up.puts('up.viewport.restoreScroll()', 'Restored scroll positions to %o', scrollTops)\n return true\n } else {\n return false\n }\n }\n\n /*-\n Saves focus-related state for later restoration.\n\n Saved state includes:\n\n @include focus-state\n\n State can only be preserved if the focused element is [targetable](/api/up.fragment.isTargetable).\n\n Saved state will be associated with the given layer's location.\n It can later be restored by calling `up.viewport.restoreFocus()`\n at the same location, or by following a link with an [`[up-focus=\"restore\"]`](/learn/focus#restore)\n attribute to that same location.\n\n Unpoly automatically saves focus-related state before [navigating](/learn/navigation-defaults).\n\n @function up.viewport.saveFocus\n @param {string} [options.location]\n The URL for which to save focus state.\n\n If omitted, the given [layer's location](/api/up.Layer.prototype.location) is used.\n @param {string} [options.layer = 'current']\n The layer for which to save focus state.\n\n If omitted, state for the current layer will be saved.\n @stable\n */\n function saveFocus(options = {}) {\n const layer = up.layer.get(options)\n const location = options.location || layer.location\n if (location) {\n const focusCapsule = up.FocusCapsule.preserve(layer)\n // `focusCapsule` may be undefined if `layer` did not have focus.\n // In that case we nullify a previously known capsule for `location`.\n layer.lastFocusCapsules.set(location, focusCapsule)\n }\n }\n\n /*-\n Restores [previously saved](/api/up.viewport.saveFocus) focus-related state.\n\n Unpoly automatically restores focus-related state when the user [presses the back button](/learn/restoring-history).\n\n @function up.viewport.restoreFocus\n @param {up.Layer|string} [options.layer='current']\n The layer on which to restore focus-related state.\n @param {string} [options.location]\n The URL for which to restore focus-related state.\n\n If omitted, the given [layer's location](/api/up.Layer.prototype.location) is used.\n @return {boolean}\n Returns whether focus state could be restored.\n @stable\n */\n function restoreFocus(options = {}) {\n const layer = up.layer.get(options)\n const location = options.location || layer.location\n const locationCapsule = layer.lastFocusCapsules.get(location)\n // The capsule returns `true` if we could rediscover and focus the previous element.\n if (locationCapsule && locationCapsule.restore(layer)) {\n up.puts('up.viewport.restoreFocus()', 'Restored focus to \"%s\"', locationCapsule._target)\n return true\n } else {\n return false\n }\n }\n\n function newStateCache() {\n return new up.FIFOCache({ capacity: 30, normalizeKey: u.matchableURL })\n }\n\n function parseOptions(args) {\n const [reference, options] = u.args(args, 'val', 'options')\n\n options.layer = up.layer.get(options)\n\n let viewports\n if (reference) {\n viewports = [closest(reference, options)]\n } else if (options.around) {\n // This is relevant when updating a fragment with { scroll: 'restore' | 'reset' }.\n // In tht case we restore / reset the scroll tops of all viewports around the fragment.\n viewports = getAround(options.around, options)\n } else {\n viewports = getAll(options)\n }\n return [viewports, options]\n }\n\n function scrollTo(position, ...args) {\n const [viewports, options] = parseOptions(args)\n setScrollPositions(viewports, {}, position, options.behavior)\n return true\n }\n\n function setScrollPositions(viewports, tops, defaultTop, behavior = 'instant') {\n for (let viewport of viewports) {\n const key = scrollTopKey(viewport)\n let top = tops[key] || defaultTop\n\n // Negative numbers scroll to the bottom, leaving an unscrolled buffer.\n if (top < 0 || Object.is(top, -0)) {\n top += viewport.scrollHeight - viewport.clientHeight\n }\n\n viewport.scrollTo({ top, behavior })\n }\n }\n\n function absolutize(element, options = {}) {\n const viewport = closest(element)\n\n const viewportRect = viewport.getBoundingClientRect()\n const originalRect = element.getBoundingClientRect()\n\n const boundsRect = new up.Rect({\n left: originalRect.left - viewportRect.left,\n top: originalRect.top - viewportRect.top,\n width: originalRect.width,\n height: originalRect.height\n })\n\n // Allow the caller to run code before we start shifting elements around.\n options.afterMeasure?.()\n\n e.setStyle(element, {\n // If the element had a layout context before, make sure the\n // ghost will have layout context as well (and vice versa).\n position: element.style.position === 'static' ? 'static' : 'relative',\n top: 'auto', // CSS default\n right: 'auto', // CSS default\n bottom: 'auto', // CSS default\n left: 'auto', // CSS default\n width: '100%', // stretch to the <up-bounds> width we set below\n height: '100%'\n }) // stretch to the <up-bounds> height we set below\n\n // Wrap the ghost in another container so its margin can expand\n // freely. If we would position the element directly (old implementation),\n // it would gain a layout context which cannot be crossed by margins.\n const bounds = e.createFromSelector('up-bounds')\n // Insert the bounds object before our element, then move element into it.\n e.insertBefore(element, bounds)\n bounds.appendChild(element)\n\n const moveBounds = function(diffX, diffY) {\n boundsRect.left += diffX\n boundsRect.top += diffY\n return e.setStyle(bounds, boundsRect, 'px')\n }\n\n // Position the bounds initially\n moveBounds(0, 0)\n\n // In theory, element should not have moved visually. However, element\n // (or a child of element) might collapse its margin against a previous\n // sibling element, and now that it is absolute it does not have the\n // same sibling. So we manually correct element's top position so it aligns\n // with the previous top position.\n const newElementRect = element.getBoundingClientRect()\n moveBounds(originalRect.left - newElementRect.left, originalRect.top - newElementRect.top)\n\n u.each(fixedElements(element), e.fixedToAbsolute)\n\n return {\n bounds,\n moveBounds\n }\n }\n\n /*-\n Marks this element as a scrolling container (\"viewport\").\n\n Apply this attribute if your app uses a custom panel layout with fixed positioning\n instead of scrolling the [document's scrolling element](https://developer.mozilla.org/en-US/docs/Web/API/Document/scrollingElement). Alternatively, you can also push a selector\n matching your custom viewport to the `up.viewport.config.viewportSelectors` array.\n\n When [scrolling](/learn/scrolling), Unpoly will always scroll the viewport closest\n to the updated element. By default this is the document's scrolling element.\n\n Elements with the `[up-viewport]` attribute must also have a [derivable target selector](/learn/target-derivation).\n\n ### Example\n\n Here is an example of a layout for an e-mail client, showing a list of e-mails\n on the left side and the e-mail text on the right side:\n\n ```css\n .side {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100px;\n overflow-y: scroll;\n }\n\n .main {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 100px;\n right: 0;\n overflow-y: scroll;\n }\n ```\n\n This would be the HTML (notice the `up-viewport` attribute):\n\n ```html\n <div class=\"side\" up-viewport>\n <a href=\"/emails/5001\" up-target=\".main\">Re: Your invoice</a>\n <a href=\"/emails/2023\" up-target=\".main\">Quote for services</a>\n <a href=\"/emails/9002\" up-target=\".main\">Fwd: Room reservation</a>\n </div>\n\n <div class=\"main\" up-viewport>\n <h1>Re: Your Invoice</h1>\n <p>\n Lorem ipsum dolor sit amet, consetetur sadipscing elitr.\n Stet clita kasd gubergren, no sea takimata sanctus est.\n </p>\n </div>\n ```\n\n @learn-ref scrolling#multiple-viewports\n @selector [up-viewport]\n @stable\n @signature\n */\n\n /*-\n Marks this element as being fixed to the top edge of the screen\n using `position: fixed`.\n\n When [following a link](/api/up-follow), the viewport is scrolled\n so the targeted element becomes visible. By using this attribute you can make\n Unpoly aware of fixed elements that are obstructing the viewport contents.\n Unpoly will then scroll the viewport far enough that the revealed element is fully visible.\n\n Instead of using this attribute,\n you can also configure a selector in `up.viewport.config.fixedTopSelectors`.\n\n ### Example\n\n ```html\n <div class=\"top-nav\" up-fixed=\"top\">\n <!-- chip: Navigation bar fixed to the top edge -->\n </div>\n ```\n\n ### Use with sticky positioning\n\n You can use `[up-fixed]` on elements with [`position: sticky`](https://www.w3schools.com/howto/howto_css_sticky_element.asp).\n\n Unpoly will measure sticky elements like permanently fixed elements.\n The current scroll position is not taken into account.\n\n @learn-ref scroll-tuning#fixed-layout-elements-obstructing-the-viewport\n @selector [up-fixed=top]\n @stable\n @signature\n */\n\n /*-\n Marks this element as being fixed to the bottom edge of the screen\n using `position: fixed`.\n\n When [following a link](/api/up-follow), the viewport is scrolled\n so the targeted element becomes visible. By using this attribute you can make\n Unpoly aware of fixed elements that are obstructing the viewport contents.\n Unpoly will then scroll the viewport far enough that the revealed element is fully visible.\n\n Instead of using this attribute,\n you can also configure a selector in `up.viewport.config.fixedBottomSelectors`.\n\n ### Example\n\n ```html\n <div class=\"bottom-nav\" up-fixed=\"bottom\">\n <!-- chip: Navigation bar fixed to the bottom edge -->\n </div>\n ```\n\n ### Use with sticky positioning\n\n You can use `[up-fixed]` on elements with [`position: sticky`](https://www.w3schools.com/howto/howto_css_sticky_element.asp).\n\n Unpoly will measure sticky elements like permanently fixed elements.\n The current scroll position is not taken into account.\n\n @learn-ref scroll-tuning#fixed-layout-elements-obstructing-the-viewport\n @selector [up-fixed=bottom]\n @stable\n */\n\n\n /*-\n Marks this element as being anchored to the right edge of the screen,\n like a fixed navigation bar.\n\n @learn-ref overlays\n\n Since [overlays](/api/up.layer) hide the document scroll bar,\n elements anchored to the right appear to jump when an overlay opens or\n closes. Applying this attribute to anchored elements will make Unpoly\n aware of the issue and adjust the `right` property accordingly.\n You may customize this behavior by styling the `.up-scrollbar-away` class.\n\n Instead of applying this attribute to each affected element,\n you can also configure a selector in `up.viewport.config.anchoredRightSelectors`.\n\n > [note]\n > Elements with `[up-fixed=top]` or `[up-fixed=bottom]` are also considered to be right-anchored.\n\n ### Example\n\n Here is the CSS for a navigation bar that is anchored to the top edge of the screen:\n\n ```css\n .top-nav {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n }\n ```\n\n By adding an `up-anchored=\"right\"` attribute to the element, we can prevent the\n `right` edge from jumping when an [overlay](/api/up.layer) opens or closes:\n\n ```html\n <div class=\"top-nav\" up-anchored=\"right\">...</div>\n ```\n\n @selector [up-anchored=right]\n @stable\n */\n\n /*-\n This class is assigned to the `<body>` and [right-anchored](/api/up-anchored-right)\n elements while an [overlay](/api/up.layer) with a scrolling viewport is open.\n\n @learn-ref overlays\n\n Overlays temporarily hide the document's main scroll bar to prevent multiple scrollbars from being rendered.\n Without a scrollbar, the `<body>` becomes wider. This may cause elements to jump in width as the overlay opens and\n closes. Elements can use this class to compensate by setting a larger `right` or `margin-right` style in their CSS.\n\n ### Default styles\n\n Unpoly sets some default styles for `.up-scrollbar-away` that will usually stabilize\n the width of absolutely positioned elements without additional CSS:\n\n - The right padding of the `<body>` element is increased by the scrollbar width\n - The `right` property of [right-anchored](/api/up-anchored-right) elements is increased by the scrollbar width.\n\n You can inspect the default styles\n in [`viewport.sass`](https://github.com/unpoly/unpoly/blob/master/src/unpoly/viewport.sass).\n\n ### Customizing styles\n\n A chat support box is fixed to the bottom-right part of the screen, keeping a distance of 20 pixels from the window corner:\n\n ```css\n .chat {\n position: fixed;\n bottom: 20px;\n right: 20px;\n }\n ```\n\n While a scrolling overlay is open, we want to add the scrollbar width to the `right`\n so its position remains stable:\n\n ```css\n .chat.up-scrollbar-away {\n right: calc(20px + var(--up-scrollbar-width)) !important\n }\n ```\n\n The `var(--up-scrollbar-width)` property is provided by Unpoly. It contains the width of the main document scrollbar\n that is now hidden, e.g. `15px`.\n\n @selector .up-scrollbar-away\n @experimental\n */\n\n /*-\n @function up.viewport.firstHashTarget\n @internal\n */\n function firstHashTarget(hash, options = {}) {\n hash = pureHash(hash)\n if (hash) {\n const selector = [\n // Match an <* id=\"hash\">\n e.idSelector(hash),\n // Match an <a name=\"hash\">\n 'a' + e.attrSelector('name', hash)\n ].join()\n return f.get(selector, options)\n }\n }\n\n /*-\n Returns `'foo'` if the hash is `'#foo'`.\n\n @function pureHash\n @internal\n */\n function pureHash(value) {\n return value?.replace(/^#/, '')\n }\n\n function focusedElementWithin(scopeElement) {\n const focusedElement = document.activeElement\n if (up.fragment.contains(scopeElement, focusedElement)) {\n return focusedElement\n }\n }\n\n const CURSOR_PROPS = ['selectionStart', 'selectionEnd', 'scrollLeft', 'scrollTop']\n\n function copyCursorProps(from, to = {}) {\n for (let key of CURSOR_PROPS) {\n try {\n to[key] = from[key]\n } catch (_error) {\n // Safari throws a TypeError when accessing { selectionStart }\n // from a focused <input type=\"submit\">. We ignore it.\n }\n }\n return to\n }\n\n return {\n reveal,\n revealHash,\n revealHashFn,\n firstHashTarget,\n config,\n get: closest,\n subtree: getSubtree,\n around: getAround,\n getScrollTops,\n get root() { return getRoot() },\n rootWidth,\n rootHeight,\n isRoot,\n rootScrollbarWidth,\n saveScroll,\n restoreScroll,\n scrollTo,\n saveFocus,\n restoreFocus,\n absolutize,\n focus: doFocus,\n tryFocus,\n newStateCache,\n focusedElementWithin,\n copyCursorProps,\n bodyShifter,\n }\n})()\n\nup.focus = up.viewport.focus\nup.reveal = up.viewport.reveal\n","/*-\nFeatures to animate fragment updates.\n\nA *transition* morphs an old element into its new version. Set an `[up-transition]` attribute on a link or form, or pass a `{ transition }` option to `up.render()`. An *animation* shows or hides a single element without a counterpart, for example when an overlay opens with an [`[up-animation]`](/api/up-layer-new#up-animation) attribute, or when `up.destroy()` removes a fragment.\n\nUnpoly ships with [predefined transitions](/api/up.morph#named-transitions) and [predefined animations](/api/up.animate#named-animations). Define your own with `up.transition()` and `up.animation()`. To play an effect outside a render pass, call `up.animate()` or `up.morph()` directly.\n\n@learn-ref motion\n\n@module up.motion\n*/\nup.motion = (function() {\n\n const u = up.util\n const e = up.element\n\n const motionController = new up.MotionController('motion')\n\n /*-\n Sets default options for animations and transitions.\n\n @property up.motion.config\n @param {number} [config.duration=175]\n The default duration for all animations and transitions (in milliseconds).\n @param {string} [config.easing='ease']\n The default timing function that controls the acceleration of animations and transitions.\n\n See [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function)\n for a list of pre-defined timing functions.\n @param {boolean} [config.enabled]\n Whether animation is enabled.\n\n By default, animations are enabled, unless the user has configured their\n system to [minimize non-essential motion](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion).\n\n Set this to `false` to disable animation globally.\n This can be useful in full-stack integration tests.\n @stable\n */\n const config = new up.Config('up.motion.config', () => ({\n duration: 175,\n easing: 'ease',\n enabled: !matchMedia('(prefers-reduced-motion: reduce)').matches\n }))\n\n let namedAnimations = new up.Registry('animation', findAnimationFn)\n\n /*-\n Defines a named animation.\n\n ## Example\n\n Here is the definition of the pre-defined `fade-in` animation:\n\n ```js\n up.animation('fade-in', function(element, options) {\n element.style.opacity = 0\n return up.animate(element, { opacity: 1 }, options)\n })\n ```\n\n ## Callback contract\n\n For animations that can be expressed through [CSS transitions](https://www.w3schools.com/css/css3_transitions.asp),\n we recommend that your definitions end by calling [`up.animate()`](/api/up.animate) with an object argument,\n passing along your `options` and returning the result.\n\n If you choose to *not* use `up.animate()` and roll your own\n animation code instead, your code must honor the following contract:\n\n 1. It must honor the options `{ duration, easing }`, if given.\n 2. It must *not* remove any of the given elements from the DOM.\n 3. It returns a promise that is fulfilled when the animation has ended.\n 4. If during the animation an event `up:motion:finish` is emitted on\n the given element, the animation instantly jumps to the last frame\n and resolves the returned promise.\n\n Calling [`up.animate()`](/api/up.animate) with an object argument\n will take care of all these points.\n\n @function up.animation\n @param {string} name\n The name of the new animation.\n @param {Function(element, options): Promise} animation\n The callback function that executes the animation.\n @stable\n @signature\n */\n\n let namedTransitions = new up.Registry('transition', findTransitionFn)\n\n /*-\n Defines a named transition that [morphs](/api/up.morph) from one element to another.\n\n ## Example\n\n Here is the definition of the pre-defined `cross-fade` transition:\n\n ```js\n up.transition('cross-fade', function(oldElement, newElement, options) {\n return Promise.all([\n up.animate(oldElement, 'fade-out', options),\n up.animate(newElement, 'fade-in', options)\n ])\n })\n ```\n\n ## Callback contract\n\n For animations that can be expressed through [CSS transitions](https://www.w3schools.com/css/css3_transitions.asp),\n we recommend that your definitions end by calling [`up.animate()`](/api/up.animate) with an object argument,\n passing along your `options` and returning the result.\n\n If you choose to *not* use `up.animate()` and roll your own\n logic instead, your code must honor the following contract:\n\n 1. It must honor the options `{ duration, easing }` if given.\n 2. It must *not* remove any of the given elements from the DOM.\n 3. It returns a promise that is fulfilled when the transition has ended.\n 4. If during the transition an event `up:motion:finish` is emitted on\n either element, the transition instantly jumps to the last frame\n and resolves the returned promise.\n\n Calling [`up.animate()`](/api/up.animate) with an object argument\n will take care of all these points.\n\n @function up.transition\n @param {string} name\n The name of the new transition.\n @param {Function(oldElement, newElement, options): Promise} transition\n The callback function that executes the transition.\n @stable\n @signature\n */\n\n function reset() {\n motionController.reset()\n }\n\n /*-\n Applies the given animation to the given element.\n\n ## Example\n\n ```js\n up.animate('.warning', 'fade-in')\n ```\n\n You can pass additional options:\n\n ```js\n up.animate('.warning', 'fade-in', {\n duration: 250,\n easing: 'linear'\n })\n ```\n\n ## Named animations\n\n Unpoly ships with a number of [predefined animations](/learn/animations#available-animations)\n\n You can define additional named animations using [`up.animation()`](/api/up.animation).\n\n ## Animating CSS properties directly\n\n By passing an object instead of an animation name, you can animate\n the CSS properties of the given element:\n\n ```js\n let warning = document.querySelector('.warning')\n warning.style.opacity = 0\n up.animate(warning, { opacity: 1 })\n ```\n\n CSS properties must be given using `kebab-case` keys.\n\n ## Multiple animations on the same element\n\n Unpoly doesn't allow more than one concurrent animation on the same element.\n\n If you attempt to animate an element that is already being animated,\n the previous animation will instantly jump to its last frame before\n the new animation begins.\n\n @function up.animate\n @section Element\n @param {Element|jQuery|string} element\n The element to animate.\n @section Animation\n @param {string|Function(element, options): Promise|Object} animation\n Can either be:\n\n - The name of a [registered](/api/up.animation) animation\n - A function performing the animation (same contract as a function passed to `up.animation()`)\n - An object of CSS properties describing the last frame of the animation (using kebab-case property names)\n @param {number} [options.duration=175]\n The duration of the animation, in milliseconds.\n @param {string} [options.easing='ease']\n The timing function that controls the animation's acceleration.\n\n See [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function)\n for a list of pre-defined timing functions.\n @return {Promise}\n A promise for the animation's end.\n @stable\n */\n async function animate(element, animationValue, { duration, easing, onFinished } = {}) {\n // If passed a selector, up.fragment.get() will prefer a match on the current layer.\n element = up.fragment.get(element)\n\n // Finish a previous animation, unless we're called from an animation or transition function.\n if (!motionController.nested) motionController.finish(element)\n\n // Convert the given animation value to a function we can call.\n // This returns undefined for values like `undefined`, `false`, `[null, null]` etc.\n const animationFn = up.error.guardFn(findAnimationFn(animationValue))\n\n // (A) Apply defaults.\n // (B) Set zero duration if motion is disabled.\n // (C) Leave out our callbacks, so a nested call from the motion function won't call them again.\n const timingOptions = effectiveTimingOptions({ duration, easing })\n\n let trackable = async function() {\n if (animationFn && canAnimateElement(element)) {\n try {\n await animationFn(element, timingOptions)\n } finally {\n onFinished?.()\n }\n } else {\n // Behave like a sync function. Don't delay changes by a microtask.\n onFinished?.()\n }\n }\n\n await motionController.startFunction([element], trackable)\n }\n\n function canAnimateElement(element) {\n return !e.isSingleton(element)\n }\n\n /*-\n This function will:\n\n - Apply the configured default easing\n - Apply the configured default duration\n - Set a duration of 0 if motion is disabled. This causes animations to instantly jump to the last frame.\n\n @function effectiveTimingOptions\n @internal\n */\n function effectiveTimingOptions({ duration, easing }) {\n return {\n duration: config.enabled ? (duration ?? config.duration) : 0,\n easing: easing ?? config.easing,\n }\n }\n\n /*-\n Animates the given element's CSS properties using CSS transitions.\n\n Does not track the animation, nor does it finish existing animations\n (use `up.motion.animate()` for that). It does, however, listen to the motionController's\n finish event.\n\n @function animateNow\n @param {Element|jQuery|string} element\n The element to animate.\n @param {Object} lastFrame\n The CSS properties that should be transitioned to.\n @param {number} [options.duration=175]\n The duration of the animation, in milliseconds.\n @param {string} [options.easing='ease']\n The timing function that controls the animation's acceleration.\n See [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function)\n for a list of pre-defined timing functions.\n @return {Promise}\n A promise that fulfills when the animation ends.\n @internal\n */\n async function animateNow(element, lastFrame, { duration, easing, finishedFrame }) {\n // There is also Animation#commitStyles(), but that has two issues:\n // (A) Throws on detached elements\n // (B) Can't set an empty last frame property, e.g. when we're transforming towards { transform: '' }\n let applyFinishedFrame = () => e.setStyle(element, finishedFrame ?? lastFrame)\n\n // A Web Animation with a duration of 0 (e.g. with disabled motion) would only finish\n // on the next animation frame. We don't want to depend on the rendering loop when nothing moves.\n if (!duration) return applyFinishedFrame()\n\n // if (up.migrate.loaded) lastFrame = up.migrate.fixSetStyleProps(lastFrame)\n // TODO: We could accepting camelCase everywhere we now run fixSetStyleProps or fixStyleProps\n let camelizedLastFrame = u.withRenamedKeys(lastFrame, u.kebabToCamelCase)\n let animation = element.animate([ camelizedLastFrame ], { duration, easing, fill: 'forwards' })\n let offFinish\n let conclude = () => {\n animation.finish()\n applyFinishedFrame()\n animation.cancel()\n offFinish()\n }\n offFinish = up.on(element, 'up:motion:finish', conclude)\n await animation.finished\n conclude()\n }\n\n /*-\n Completes [animations](/api/up.animate) and [transitions](/api/up.morph).\n\n If called without arguments, all animations on the screen are completed.\n If given an element (or selector), animations on that element and its children\n are completed.\n\n Animations are completed by jumping to the last animation frame instantly.\n Promises returned by animation and transition functions instantly settle.\n\n Emits the `up:motion:finish` event that is handled by `up.animate()`.\n\n Does nothing if there are no animations to complete.\n\n @function up.motion.finish\n @param {Element|jQuery|string} [element]\n The element around which to finish all animations.\n @return {Promise}\n A promise that fulfills when animations and transitions have finished.\n @stable\n */\n function finish(element) {\n element = up.fragment.get(element)\n motionController.finish(element)\n return up.migrate.formerlyAsync?.('up.motion.finish()')\n }\n\n /*-\n This event is emitted on an animating element by `up.motion.finish()` to\n request the animation to instantly finish and skip to the last frame.\n\n @learn-ref controlling-motion#finishing-running-animations\n\n Custom [animation](/api/up.animation) and [transition](/api/up.transition) functions are expected\n to instantly settle their promises when this event is observed on the\n animating element.\n\n > [IMPORTANT]\n > The `up:motion:finish` event does **not** signal the end of an animation.\n > For this see [awaiting postprocessing](/learn/render-lifecycle#postprocessing).\n\n @event up:motion:finish\n @param {Element} event.target\n The animating element.\n @stable\n */\n\n /*-\n Performs an animated transition between two elements.\n\n Transitions are implemented by performing two animations in parallel,\n causing `oldElement` to disappear and `newElement` to appear.\n\n - `newElement` is [inserted before](https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore) `oldElement`\n - `oldElement` is removed from the [document flow](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Positioning) with `position: absolute`.\n It will be positioned over its original place in the flow that is now occupied by `newElement`.\n - Both `oldElement` and `newElement` are animated in parallel\n - `oldElement` is removed from the DOM\n\n ## Named transitions\n\n Unpoly ships with a number of [predefined transitions](/learn/transitions#available-transitions).\n\n You can define additional named transitions using [`up.transition()`](/api/up.transition).\n\n\n @function up.morph\n @section Elements\n @param {Element|jQuery|string} oldElement\n The old element to transition away from.\n\n It will be removed from the DOM when the transition finishes.\n @param {Element|jQuery|string} newElement\n The new element that will remain in the DOM once the transition finishes.\n\n It should be detached before calling `up.morph()`.\n @section Transition\n @param {Function(oldElement, newElement, options)|string} transition\n Can either be:\n\n - The name of a [registered](/api/up.transition) transition\n - A function performing the transition (same contract as a function passed to `up.transition()`)\n @param {number} [options.duration=175]\n The duration of the transition, in milliseconds.\n @param {string} [options.easing='ease']\n The timing function that controls the transition's acceleration.\n\n See [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function)\n for a list of pre-defined timing functions.\n @return {Promise}\n A promise that fulfills when the transition ends.\n @stable\n */\n async function morph(oldElement, newElement, transitionValue, options) {\n // (A) If passed a selector, up.fragment.get() will prefer a match on the current layer.\n // (B) This also unwraps jQuery collections.\n oldElement = up.fragment.get(oldElement)\n newElement = up.fragment.get(newElement)\n\n await swap(oldElement, newElement, transitionValue, options)()\n }\n\n // Inserts newElement now: before the absolutized oldElement when transitioning, in place of it otherwise.\n // Returns a function that starts the transition and removes oldElement.\n //\n // Between the two calls a render pass compiles, focuses and scrolls:\n //\n // (A) Compilers may change newElement's size or position.\n // (B) Compilers capture an [up-keep] identity before a transition adds inline styles.\n // (C) We scroll newElement into position before we start the enter animation.\n function swap(oldElement, newElement, transitionValue, { duration, easing, beforeRemove, afterRemove } = {}) {\n // Convert the given transition value to a function we can call.\n // This returns undefined for values like `undefined`, `false`, `[null, null]` etc.\n const transitionFn = up.error.guardFn(findTransitionFn(transitionValue))\n\n // (A) Apply defaults.\n // (B) Set zero duration if motion is disabled.\n // (C) Leave out our callbacks, so a nested call from the motion function won't call them again.\n const timingOptions = effectiveTimingOptions({ duration, easing })\n\n const cluster = [newElement, oldElement]\n const { nested } = motionController\n let play\n\n // Finish previous transitions before we measure or replace elements.\n if (!nested) cluster.forEach((element) => motionController.finish(element))\n\n if (transitionFn && canAnimateElement(oldElement)) {\n if (nested) {\n // If morph() is called inside a transition function, we don't want to create additional absolutized bounds.\n play = () => transitionFn(oldElement, newElement, timingOptions)\n } else {\n const viewport = up.viewport.get(oldElement)\n const scrollTopBeforeScroll = viewport.scrollTop\n\n const oldRemote = up.viewport.absolutize(oldElement, {\n afterMeasure: () => e.insertBefore(oldElement, newElement)\n })\n\n play = async () => {\n // Since our caller may have scrolled the viewport (containing both oldElement and newElement),\n // we must shift the old copy so it looks like it is still sitting in the same position.\n oldRemote.moveBounds(0, viewport.scrollTop - scrollTopBeforeScroll)\n\n await transitionFn(oldElement, newElement, timingOptions)\n\n beforeRemove?.()\n // TODO: Don't expose { bounds }, why not remove()?\n oldRemote.bounds.remove()\n afterRemove?.()\n }\n }\n } else {\n beforeRemove?.()\n swapElementsDirectly(oldElement, newElement)\n // Nothing to animate. We only report the removal when the motion would start.\n play = afterRemove\n }\n\n return () => motionController.startFunction(cluster, async () => play?.())\n }\n\n function findTransitionFn(value) {\n if (isNone(value)) {\n return undefined\n } else if (u.isFunction(value)) {\n return value\n } else if (u.isArray(value)) {\n return composeTransitionFn(...value)\n } else if (u.isString(value) && value.includes('/')) {\n return composeTransitionFn(...value.split('/'))\n } else {\n return namedTransitions.get(value)\n }\n }\n\n function composeTransitionFn(oldAnimation, newAnimation) {\n // A composition of two null-animations is a null-transform\n // and should be skipped. If only one half is a null-animation, we animate the other half.\n if (!isNone(oldAnimation) || !isNone(newAnimation)) {\n const oldAnimationFn = findAnimationFn(oldAnimation) || u.asyncNoop\n const newAnimationFn = findAnimationFn(newAnimation) || u.asyncNoop\n return (oldElement, newElement, options) => Promise.all([\n oldAnimationFn(oldElement, options),\n newAnimationFn(newElement, options)\n ])\n }\n }\n\n function findAnimationFn(value) {\n if (isNone(value)) {\n return undefined\n } else if (u.isFunction(value)) {\n return value\n } else if (u.isOptions(value)) {\n return (element, options) => animateNow(element, value, options)\n } else {\n return namedAnimations.get(value)\n }\n }\n\n // Have a separate function so we can mock it in specs.\n const swapElementsDirectly = up.mockable(function(oldElement, newElement) {\n oldElement.replaceWith(newElement)\n })\n\n function motionOptions(element, options, parserOptions) {\n options = u.options(options)\n let parser = new up.OptionsParser(element, options, parserOptions)\n\n parser.booleanOrString('animation')\n parser.booleanOrString('transition')\n parser.string('easing')\n parser.number('duration')\n\n return options\n }\n\n up.on('up:framework:boot', function() {\n // Explain to the user why animations aren't working.\n // E.g. the user might have disabled animations in her OS.\n if (!config.enabled) {\n up.puts('up.motion', 'Animations are disabled')\n }\n })\n\n /*-\n Returns whether the given animation option will cause the animation\n to be skipped.\n\n @function up.motion.isNone\n @internal\n */\n function isNone(motionValue) {\n // false, undefined, '', null, the string \"none\" and an empty object of CSS properties are all ways to skip animations\n return !motionValue || motionValue === 'none' || (u.isOptions(motionValue) && u.isBlank(motionValue))\n }\n\n function registerOpacityAnimation(name, from, to) {\n namedAnimations.put(name, function(element, options) {\n element.style.opacity = u.evalOption(from, element)\n return animateNow(element, { opacity: to }, options)\n })\n }\n\n function currentOpacity(element) {\n return e.style(element, 'opacity')\n }\n\n registerOpacityAnimation('fade-in', 0, 1)\n registerOpacityAnimation('fade-out', currentOpacity, 0)\n\n function translateCSS(dx, dy) {\n return { transform: `translate(${dx}px, ${dy}px)` }\n }\n\n function zeroTranslateCSS() {\n return { transform: 'translate(0, 0)' }\n }\n\n function untranslatedBox(element) {\n e.setStyle(element, zeroTranslateCSS())\n return element.getBoundingClientRect()\n }\n\n function registerMoveAnimations(direction, boxToTransform) {\n const animationToName = `move-to-${direction}`\n const animationFromName = `move-from-${direction}`\n\n namedAnimations.put(animationToName, function(element, options) {\n const box = untranslatedBox(element)\n const transform = boxToTransform(box)\n return animateNow(element, transform, options)\n })\n\n namedAnimations.put(animationFromName, function(element, options) {\n const box = untranslatedBox(element)\n const transform = boxToTransform(box)\n e.setStyle(element, transform)\n return animateNow(element, zeroTranslateCSS(), { ...options, finishedFrame: { transform: '' } })\n })\n }\n\n registerMoveAnimations('top', function(box) {\n const travelDistance = box.top + box.height\n return translateCSS(0, -travelDistance)\n })\n\n registerMoveAnimations('bottom', function(box) {\n const travelDistance = up.viewport.rootHeight() - box.top\n return translateCSS(0, travelDistance)\n })\n\n registerMoveAnimations('left', function(box) {\n const travelDistance = box.left + box.width\n return translateCSS(-travelDistance, 0)\n })\n\n registerMoveAnimations('right', function(box) {\n const travelDistance = up.viewport.rootWidth() - box.left\n return translateCSS(travelDistance, 0)\n })\n\n namedTransitions.put('cross-fade', ['fade-out', 'fade-in'])\n namedTransitions.put('move-left', ['move-to-left', 'move-from-right'])\n namedTransitions.put('move-right', ['move-to-right', 'move-from-left'])\n namedTransitions.put('move-up', ['move-to-top', 'move-from-bottom'])\n namedTransitions.put('move-down', ['move-to-bottom', 'move-from-top'])\n\n /*-\n Swaps a fragment with an animated transition.\n\n You can use a [predefined transition](/learn/transitions#available-transitions) or [define your own](/api/up.transition).\n\n > [NOTE]\n > Transitions are not possible when replacing the `<body>` element.\n > To transition the entire page, wrap it in a container element.\n\n @learn-ref transitions\n\n ## Following a link with animation\n\n The link will load the fragment `#story` from the URL `/page2`.\n Once the response is received, the old fragment version will fly out to the left, while the new\n version will fly in from the right.\n\n ```html\n <a href=\"/page2\"\n up-target=\"#story\"\n up-transition=\"move-left\">\n Next page\n </a>\n ```\n\n ## Submitting a form with animation\n\n The form will load the fragment `.content` from the URL `/tasks`.\n Once the response is received, the old fragment version will fade out, while the new\n version will fade in.\n\n ```html\n <form action=\"/tasks\"\n up-target=\".content\"\n up-transition=\"cross-fade\">\n ...\n </form>\n ```\n\n @selector [up-transition]\n @params-note\n All modifying attributes for `[up-follow]` (links) or `[up-submit]` (forms) may also be used.\n @param [up-transition]\n The [name of a transition](/learn/transitions#available-transitions).\n @param [up-duration]\n The duration of the transition in milliseconds.\n @param [up-easing]\n The [timing function](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function)\n that controls the acceleration of the transition.\n @param [up-fail-transition]\n The transition to use when the server responds with an error code.\n\n See [[error-responses]].\n @stable\n @signature\n */\n\n up.on('up:framework:reset', reset)\n\n return {\n morph,\n swap,\n animate,\n finish,\n transition: namedTransitions.put,\n animation: namedAnimations.put,\n config,\n isNone,\n swapElementsDirectly,\n motionOptions,\n }\n})()\n\nup.transition = up.motion.transition\nup.animation = up.motion.animation\nup.morph = up.motion.morph\nup.animate = up.motion.animate\n","require('./network.sass')\n\nconst u = up.util\n\n/*-\nFeatures to make HTTP requests and cache their responses.\n\nUnpoly uses this client automatically when following a link or submitting a form. To make a request from your own code, call `up.request()`. It returns an `up.Request` that fulfills with an `up.Response` and that can be aborted. Responses can be cached so that a later request for the same URL renders instantly, and cached content is revalidated after rendering. The cache is managed through `up.cache.get()`, `up.cache.expire()` and `up.cache.evict()`.\n\nEvents are emitted throughout the request lifecycle. `up:network:late` fires when requests take longer than expected and drives the default progress bar; `up:request:offline` fires when a request fails without a response. Defaults for timeouts, concurrency and caching live in `up.network.config`.\n\n@learn-ref network\n\n@module up.network\n*/\nup.network = (function() {\n\n /*-\n Sets default options for network requests.\n\n @property up.network.config\n\n @section Requests\n @param {number|Function(): number} [config.concurrency]\n The maximum number of concurrently loading requests.\n\n Additional requests are queued. [Preload](/learn/preloading) requests are\n always queued behind non-preload requests.\n\n By default Unpoly allows 6 concurrent requests.\n You might find it useful to set a concurrency of `1` in end-to-end tests\n to prevent race conditions.\n\n Your browser may impose additional concurrency limits regardless of what you configure here.\n\n @param {boolean} [config.wrapMethod=true]\n Whether to wrap non-standard HTTP methods in a POST request.\n\n If this is set, methods other than GET and POST will be converted to a `POST` request\n and will carry their original method as a `_method` parameter. This is to [prevent unexpected redirect behavior](https://makandracards.com/makandra/38347).\n\n If you disable method wrapping, make sure that your server always redirects with\n a 303 status code (rather than 302).\n\n @param {number|Function(up.Request): number|boolean} [config.lateDelay=400]\n The number of milliseconds to wait before emitting the [`up:network:late` event](/api/up:network:late) and showing\n the [progress bar](/learn/progress-bar).\n\n To never consider a request to be late, configure a function that returns `false` for that request.\n\n @param {number|undefined} [config.timeout=90_000]\n A default [timeout](/api/up.request#options.timeout) for [requests](/api/up.request) in milliseconds.\n\n Set `undefined` to not use a timeout.\n\n @param {boolean|Function(up.Response): boolean} [config.fail]\n Whether Unpoly will consider a response to constitute an [error response](/learn/error-responses).\n\n By default, Unpoly will consider any status code other than HTTP 2xx or [304](/learn/conditional-requests#rendering-nothing) to represent an error response.\n You may use this option to customize this behavior. For instance, you can fail a response if it contains a given header or body text.\n\n The following configuration will fail all responses with an `X-Unauthorized` header:\n\n ```js\n let badStatus = up.network.config.fail\n up.network.config.fail = (response) => badStatus(response) || response.header('X-Unauthorized')\n ```\n\n Also see [Customizing failure detection](/learn/error-responses#customizing-failure-detection).\n\n @section Caching\n @param {boolean} [config.cacheEnabled=true]\n Whether to use the [cache](/learn/caching).\n\n When set to `false`, no response is read from or written to the cache,\n even for requests with `{ cache: true }`. [Preloading](/learn/preloading) is disabled as well.\n\n See [Disabling the cache globally](/learn/caching#disabling-globally).\n\n @param {number} [config.cacheSize=70]\n The maximum number of responses to cache.\n\n If the size is exceeded, the oldest responses will be dropped from the cache.\n\n @param {number} [config.cacheExpireAge=15_000]\n The number of milliseconds after which a cache entry is considered [expired](/learn/caching#expiration) and will trigger [revalidation](/learn/caching#revalidation) when used.\n\n The configured age should at least cover the average time between [preloading](/learn/preloading) and following a link.\n\n Defaults to 15 seconds.\n\n @param {number} [config.cacheEvictAge=90*60*1000]\n The number of milliseconds after which a cache entry is [evicted](/learn/caching#eviction).\n\n In practice you will often prefer [*expiration*](/learn/caching#expiration) over *eviction*.\n\n Defaults to 90 minutes.\n\n @param {Function(up.Request): boolean} [config.autoCache]\n Whether to [cache](/learn/caching) the given request with `{ cache: 'auto' }`.\n\n By default, Unpoly will auto-cache requests with [safe](https://developer.mozilla.org/en-US/docs/Glossary/Safe/HTTP) HTTP methods like `GET`.\n\n You may change this default to prevent auto-caching of some of your routes. For example, this will prevent auto-caching\n of requests to URLs ending with `/edit`:\n\n ```js\n let defaultAutoCache = up.network.config.autoCache\n up.network.config.autoCache = function(request) {\n return defaultAutoCache(request) && !request.url.endsWith('/edit')\n }\n ```\n\n @param {(Function(up.Request): boolean|string)|boolean} [config.expireCache]\n A function that controls [cache expiration](/learn/caching#expiration) when the given request is sent.\n\n Returning `true` will expire the entire cache.\\\n Returning `false` will not expire any cache entries.\\\n Returning a [URL pattern](/api/url-patterns) will expire matching cache entries only.\n\n By default, Unpoly will expire the entire cache when it sends a request with an [unsafe](https://developer.mozilla.org/en-US/docs/Glossary/Safe/HTTP) HTTP method:\n\n ```js\n up.request({ url: '/path', method: 'get' }) // no cache entries expired\n up.request({ url: '/path', method: 'post' }) // entire cache expired\n ```\n\n @param {(Function(up.Request): boolean|string)|boolean} [config.evictCache=false]\n A function that controls [cache eviction](/learn/caching#eviction) when the given request is sent.\n\n Returning `true` will evict the entire cache.\\\n Returning `false` will not evict any cache entries.\\\n Returning a [URL pattern](/api/url-patterns) will evict matching cache entries only.\n\n By default, Unpoly will *not* evict any cache entries when a request is sent.\n\n @param {boolean|Function(): boolean} [config.progressBar]\n Whether to show a [progress bar](/learn/progress-bar) for [late requests](#config.lateDelay).\n\n @stable\n */\n const config = new up.Config('up.network.config', () => ({\n concurrency: 6,\n wrapMethod: true,\n cacheEnabled: true,\n cacheSize: 70,\n cacheExpireAge: 15 * 1000,\n cacheEvictAge: 90 * 60 * 1000,\n lateDelay: 400,\n fail(response) { return (response.status < 200 || response.status > 299) && response.status !== 304 },\n autoCache(request) { return request.isSafe() },\n expireCache(request) { return !request.isSafe() },\n evictCache: false,\n progressBar: true,\n timeout: 90_000,\n }))\n\n const queue = new up.Request.Queue()\n\n const cache = new up.Request.Cache()\n\n let progressBar = null\n\n /*-\n Returns a [cached](/learn/caching) request matching the given request options.\n\n The request may still be in flight.\n\n Returns `undefined` if the given request is not currently cached.\n\n > [important]\n > `up.request()` and `up.render()` will only write to the cache when a [`{ cache }`](/api/up.request#options.cache)\n > option is set.\n\n ## Example\n\n ```\n let request = up.cache.get({ url: '/foo' })\n\n if (request) {\n let response = await request\n console.log(\"Response is %o\", response)\n } else {\n console.log(\"The path /foo has not been requested before!\")\n }\n ```\n\n @function up.cache.get\n @param {Object} requestOptions\n The request options to match against the cache.\n\n See `options` for `up.request()` for documentation.\n @return {up.Request|undefined}\n The cached request.\n @experimental\n */\n\n /*-\n [Evicts](/learn/caching#eviction) responses in the [cache](/learn/caching).\n\n The server may also evict cache entries by sending an [`X-Up-Evict-Cache`](/api/X-Up-Evict-Cache) header.\n\n ## Example\n\n Calling without argument will clear the entire cache:\n\n ```js\n up.cache.evict()\n ```\n\n To only remove some cache entries, pass a [URL pattern](/api/url-patterns):\n\n ```js\n up.cache.evict('/users/*')\n ```\n\n @function up.cache.evict\n @param {string} [pattern]\n A [URL pattern](/api/url-patterns) matching cache entries that should be removed.\n\n If omitted, the entire cache is evicted.\n @stable\n */\n\n /*-\n [Expires](/learn/caching#expiration) entries in the [cache](/learn/caching).\n\n Expired entries remain in the cache, but will be [revalidated](/learn/caching#revalidation)\n after rendering.\n\n By default, Unpoly automatically expires the entire cache whenever it sends\n a request with a non-GET HTTP method. To customize this rule, use `up.network.config.expireCache`.\n\n The server may also expire cache entries by sending an [`X-Up-Expire-Cache`](/api/X-Up-Expire-Cache) header.\n\n ## Example\n\n Calling without argument will mark the entire cache as expired:\n\n ```js\n up.cache.expire()\n ```\n\n To only expire some cache entries, pass a [URL pattern](/api/url-patterns):\n\n ```js\n up.cache.expire('/users/*')\n ```\n\n @function up.cache.expire\n @param {string} [pattern]\n A [URL pattern](/api/url-patterns) matching cache entries that should be expired.\n\n If omitted, the entire cache is expired.\n @stable\n */\n\n /*-\n Manually stores a request in the [cache](/learn/caching).\n\n Future calls to `up.request()` will try to reuse this request before\n making a new request.\n\n @function up.cache.put\n @param {up.Request} request\n The request to cache. The request is also a promise for the response.\n @internal\n */\n\n function reset() {\n abortRequests()\n queue.reset()\n cache.reset()\n progressBar?.destroy()\n progressBar = null\n }\n\n /*-\n Makes a request to the given URL.\n\n Returns an `up.Request` object which contains information about the request.\n This request object is also a promise for an `up.Response` that contains\n the response text, headers, etc.\n\n ### Example\n\n ```js\n let request = up.request('/search', { params: { query: 'sunshine' } })\n console.log('We made a request to', request.url)\n\n let response = await request\n console.log('The response text is', response.text)\n ```\n\n ### Error handling\n\n The returned promise will fulfill with an `up.Response` when the server\n responds with an HTTP status of 2xx (like `200`).\n\n When the server responds with an HTTP error code (like `422` or `500`), the promise\n will *reject* with `up.Response`.\n\n When the request fails from a fatal error (like a timeout or loss of connectivity),\n the promise will reject with an [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object.\n\n Here is an example for a complete control flow that handles both HTTP error codes\n and fatal errors:\n\n ```js\n try {\n let response = await up.request('/search', { params: { query: 'sunshine' } })\n console.log('Successful response with text:', response.text)\n } catch (e) {\n if (e instanceof up.Response) {\n console.log('Server responded with HTTP status %s and text %s', e.status, e.text)\n } else {\n console.log('Fatal error during request:', e.message)\n }\n }\n ```\n\n ### Caching\n\n You may [cache](/learn/caching) responses by passing a `{ cache }` option. Responses for a cached\n request will resolve instantly.\n\n See [Caching](/learn/caching) for more details and examples.\n\n @function up.request\n\n @section Request\n @param {string} [url]\n The requested URL.\n\n Instead of passing the URL as a string argument, you can also pass it as an `{ url }` option.\n\n @param {string} [options.url]\n The requested URL.\n\n @param {string} [options.method='GET']\n The HTTP method for the request.\n\n @param {Object|up.Params|FormData|string|Array} [options.params={}]\n [Parameters](/api/up.Params) that should be sent as the request's\n [query string](https://en.wikipedia.org/wiki/Query_string) or payload.\n\n When making a `GET` request to a URL with a query string, the given `{ params }` will be added\n to the query parameters.\n\n @param {Object} [options.headers={}]\n An object of additional HTTP headers.\n\n Unpoly will by default send a number of custom request headers.\n See `up.protocol` for details.\n\n @param {boolean} [options.wrapMethod]\n Whether to wrap non-standard HTTP methods in a POST request.\n\n If this is set, methods other than GET and POST will be converted to a `POST` request\n and will carry their original method as a `_method` parameter. This is to [prevent unexpected redirect behavior](https://makandracards.com/makandra/38347).\n\n Defaults to [`up.network.config`](/api/up.network.config#config.wrapMethod).\n\n @param {number} [options.timeout]\n A timeout in milliseconds.\n\n If the request is queued due to [many concurrent requests](/api/up.network.config#config.concurrency),\n the timeout will not include the time spent waiting in the queue.\n\n @param {string} [options.contentType]\n The format in which to encode the request params.\n\n Allowed values are `application/x-www-form-urlencoded` and `multipart/form-data`.\n Only `multipart/form-data` can transport binary data.\n\n If this option is omitted Unpoly will prefer `application/x-www-form-urlencoded`,\n unless request params contains binary data.\n\n @param {string} [options.payload]\n A custom payload for this request.\n\n By default Unpoly will build a payload from the given `{ params }` option.\n Therefore this option is not required when making a standard link or form request to a server\n that renders HTML.\n\n A use case for this option is talking to a JSON API that expects requests with a `application/json` payload.\n\n If a `{ payload }` option is given you must also pass a `{ contentType }`.\n\n @param {boolean} [options.background=false]\n Whether this request will load in the background.\n\n Background requests are deprioritized and won't show the [progress bar](/learn/progress-bar).\n See [[background-requests]].\n\n @param {number} [options.lateDelay]\n The number of milliseconds after which this request can cause\n an `up:network:late` event.\n\n Defaults to `up.network.config.lateDelay`.\n\n @param {string|boolean|Function(up.Response): boolean} [options.fail]\n Whether the response to this request should be considered an [error response](/learn/error-responses).\n\n By [default](/api/up.network.config#config.fail), any HTTP status code other than 2xx or 304 is considered an error code.\n Pass `{ fail: false }` to handle *any* response as successful, even with a 4xx or 5xx status code.\n\n An error response will cause the [returned promise](#return-value) to reject.\n\n @section Caching\n @param {boolean} [options.cache=false]\n Whether to read from and write to the [cache](/learn/caching).\n\n With `{ cache: true }`, Unpoly will try to reuse a cached response before connecting\n to the network. If no cached response exists, Unpoly will make a request and cache\n the server response.\n\n With `{ cache: 'auto' }`, Unpoly will use the cache only if `up.network.config.autoCache`\n returns `true` for this request.\n\n With `{ cache: false }` (the default), Unpoly will always make a network request.\n\n @param {boolean|string} [options.expireCache]\n Whether to [expire](/learn/caching#expiration) the [cache](/learn/caching) when this request is sent.\n\n Defaults to the result of `up.network.config.expireCache`, which defaults to expiring the entire cache for a non-GET request.\n Pass `false` to not expire any cache entries.\n\n You may also pass a [URL pattern](/api/url-patterns) to only expire matching responses.\n\n @param {boolean|string} [options.evictCache]\n Whether to [evict](/learn/caching#eviction) the [cache](/learn/caching) when this request is sent.\n\n Defaults to the result of `up.network.config.evictCache`, which defaults to `false`.\n\n You may also pass a [URL pattern](/api/url-patterns) to only evict matching responses.\n\n\n @section Render context\n @param {string} [options.target='body']\n The CSS selector that will be sent as an `X-Up-Target` header.\n\n The targets of concurrent requests to the same URL [may be merged](/api/X-Up-Target#merging).\n\n @param {string} [options.failTarget='body']\n The CSS selector that will be sent as an `X-Up-Fail-Target` header.\n\n @param {string} [options.layer='current']\n The [layer](/api/up.layer) this request is associated with.\n\n If this request is intended to update an existing fragment, this is that fragment's layer.\n\n If this request is intended to [open an overlay](/learn/opening-overlays),\n the associated layer is the future overlay's parent layer.\n\n @param {string} [options.failLayer='current']\n The [layer](/api/up.layer) this request is associated with if the server [sends an HTTP error status](/learn/error-responses).\n\n @param {Element} [options.origin]\n The DOM element that caused this request to be sent, e.g. a hyperlink or form element.\n\n @return {up.Request}\n An object with information about the request.\n\n The request object is also a promise for its `up.Response`.\n\n @stable\n @signature\n */\n function makeRequest(...args) {\n const options = parseRequestOptions(args)\n const request = new up.Request(options)\n processRequest(request)\n return request\n }\n\n function parseRequestOptions(args) {\n let options = u.parseArgIntoOptions(args, 'url')\n up.migrate.handleRequestOptions?.(options)\n return options\n }\n\n function processRequest(request) {\n cache.expire(request.expireCache ?? u.evalOption(config.expireCache, request) ?? false)\n cache.evict(request.evictCache ?? u.evalOption(config.evictCache, request) ?? false)\n useCachedRequest(request) || queueRequest(request)\n }\n\n function useCachedRequest(newRequest) {\n // If we have an existing promise matching this new request,\n // we use it unless `request.cache` is explicitly set to `false`.\n let cachedRequest\n if (newRequest.willCache() && (cachedRequest = cache.get(newRequest))) {\n up.puts('up.request()', 'Re-using previous request to %s', newRequest)\n\n // Check if we need to upgrade a cached background request to a foreground request.\n // This might affect whether we're going to emit an up:network:late event further\n // down. Consider this case:\n //\n // - User preloads a request (1). We have a cache miss and connect to the network.\n // This will never trigger `up:network:late`, because we only track foreground requests.\n // - User loads the same request (2) in the foreground (no preloading).\n // We have a cache hit and receive the earlier request that is still preloading.\n // Now we *should* trigger `up:network:late`.\n // - The request (1) finishes. This triggers `up:network:recover`.\n if (!newRequest.background) {\n queue.promoteToForeground(cachedRequest)\n }\n\n cachedRequest.mergeIfUnsent(newRequest)\n\n // We cannot simply return `cachedRequest`, since that might have a different #hash property.\n // While two requests with a different #hash have the same cache key, they are\n // not the same object.\n //\n // What we do instead is have `request` follow the state of `cachedRequest`'s exchange.\n //\n // There is also the edge case where a cached request is still in-flight and, when the\n // response is finally received, has a Vary header that makes it incompatible with\n // `newRequest`. In this case we re-process `newRequest` as if it was just made.\n cache.track(cachedRequest, newRequest, { onIncompatible: processRequest })\n\n // Make newRequest abortable on its own, e.g. by up.fragment.abort().\n // Aborting it only rejects newRequest, while cachedRequest keeps loading for others.\n if (!newRequest.ended) queue.track(newRequest)\n\n return true\n }\n }\n\n // If no existing promise is available, we queue a network request.\n function queueRequest(request) {\n handleCaching(request)\n\n queue.asap(request)\n\n return true\n }\n\n function handleCaching(request) {\n // Several code paths lead here:\n //\n // (1) A request with { cache: true } when there was a cache miss.\n // (2) A request with { cache: false }. This may still update the cache if we end up with a fresher response,\n // but should keep a good cache entry if we end up with a network error.\n //\n // A code path that does *never* lead here:\n //\n // (3) A request with { cache: true } when there was a cache hit.\n\n if (request.willCache()) {\n // Here we have a request with { request: true } and a cache miss.\n //\n // Cache the request before it is queued and loaded.\n // This way additional requests to the same endpoint will hit and track this request.\n // Since nothing was cached for this request, we're not overriding an existing cache entry.\n cache.put(request)\n\n // If the request changed its URL or params in up:request:load, the cache needs to re-index.\n request.onLoading = () => cache.reindex(request)\n }\n\n // Once we receive a response we honor options/headers for eviction/expiration,\n // even if the request was not cachable.\n //\n // We do this synchronously, before the request's promise settles. Otherwise a request made\n // synchronously after an abort (e.g. by a compiler during the render that aborted it)\n // would hit the aborted request in the cache.\n request.onSettle = function(responseOrError) {\n cache.expire(responseOrError.expireCache ?? false, { except: request })\n cache.evict(responseOrError.evictCache ?? false, { except: request })\n\n let isResponse = responseOrError instanceof up.Response\n let isNetworkError = !isResponse\n let isSuccessResponse = isResponse && responseOrError.ok\n let isErrorResponse = isResponse && !responseOrError.ok\n let isEmptyResponse = isResponse && responseOrError.none\n let redirectRequest = isResponse && responseOrError.redirectRequest\n\n if (isErrorResponse) {\n // Evict an earlier cache entry with a successful response (as we now know a better state, even if that state is an error page).\n cache.evict(request.url)\n } else if (isNetworkError || isEmptyResponse) {\n // Only evict this one request instance in case we put it into the cache at the start of this function.\n // We keep other requests for the same URL but with a different { cacheRoute } (due to Vary).\n cache.evict(request)\n } else if (isSuccessResponse) {\n if (cache.get(request)) {\n // We now re-put the request into the cache, regardless of its { cache } setting, for multiple reasons:\n //\n // (1) In case we evicted the entire cache above, we must re-cache a cacheable request.\n // (2) An un-cacheable request should still update an existing cache entry\n // (written by a earlier, cacheable request with the same cache key)\n // since the later response will be fresher.\n // (3) Now that we have a response the cache needs to be updated with Vary info.\n cache.put(request)\n }\n\n if (redirectRequest && (redirectRequest.willCache() || cache.get(redirectRequest))) {\n // (1) If GET /foo redirected to GET /bar, both /foo and /bar should yield the cached response.\n // (2) If POST /foo redirected to GET /bar, we should now cache GET /bar (although we didn't cache POST /foo)\n // (3) If POST /foo redirected to GET /bar without caching, but /bar was already cached, update cache for /bar\n cache.put(redirectRequest)\n }\n }\n }\n }\n\n /*-\n Returns whether Unpoly is currently loading a [request](/api/up.request).\n\n The network is also considered busy while requests are [loading in the background](/learn/background-requests).\n\n @function up.network.isBusy\n @return {boolean}\n Whether a request is loading.\n @stable\n */\n function isBusy() {\n return queue.isBusy()\n }\n\n /*-\n Makes a full-page request, replacing the entire browser environment with a new page from the server response.\n\n Aborts all pending requests.\n\n Also see `up.Request#loadPage()`.\n\n @function up.network.loadPage\n @param {string} options.url\n The URL to load as a full page.\n @param options.method\n @like up.render\n @param options.params\n @like up.render\n\n Additional [parameters](/api/up.Params) that should be sent as the request's\n [query string](https://en.wikipedia.org/wiki/Query_string) or payload.\n\n Binary values from file inputs will be removed from the given params.\n @stable\n */\n function loadPage(requestsAttrs) {\n new up.Request(requestsAttrs).loadPage()\n }\n\n /*-\n Aborts pending [requests](/api/up.request) matching a condition.\n\n > [important]\n > This is a low-level API for matching requests by their properties. If possible, use `up.fragment.abort()`,\n > which matches requests by screen region. Only when requests are aborted by screen region can components\n > [react to being aborted](/api/up:fragment:aborted).\n\n @learn-ref aborting-requests\n\n ## Effects of aborting\n\n When an `up.request()` is aborted, its returned promise rejects with an `up.Aborted` error:\n\n ```js\n try {\n let response = await up.request('/path')\n console.log(response.text)\n } catch (error) {\n if (error.name === 'AbortError') {\n console.log('Request was aborted: ' + error.message)\n }\n }\n ```\n\n Also the event `up:request:aborted` will be emitted.\n The region-specific event `up:fragment:aborted` will *not* be emitted by this function.\n For this use `up.fragment.abort()` instead.\n\n ## Aborting all requests\n\n Without arguments, this will abort all pending requests:\n\n ```js\n up.network.abort()\n ```\n\n ## Aborting a single request\n\n To abort a given `up.Request` object, pass it as the first argument:\n\n ```js\n let request = up.request('/path')\n up.network.abort(request)\n ```\n\n ## Aborting requests matching a pattern\n\n To abort all requests matching an [URL pattern](/api/url-patterns), pass it as the first argument:\n\n ```js\n up.network.abort('/path/*')\n ```\n\n ## Aborting requests matching an arbitrary condition\n\n To abort all requests matching an arbitrary condition, pass a function that takes a request\n and returns a boolean value. Unpoly will abort all requests for which the given\n function returns `true`. For example, to abort all requests with an HTTP method of `GET`:\n\n ```js\n up.network.abort((request) => request.method == 'GET')\n ```\n\n ## Aborting requests targeting a fragment or layer\n\n Use `up.fragment.abort()`.\n\n @function up.network.abort\n @param {string|Function(up.Request): boolean|up.Request|boolean} [condition=true]\n A condition that controls which requests to abort.\n\n If set to a string, it is interpreted as a [URL pattern](/api/url-patterns). All requests\n matching that pattern will be aborted.\n\n If set to an `up.Request` object, that one request is aborted.\n\n If set to a function, it will be called for each pending request.\n All requests for which the function returns `true` will be aborted.\n\n If set to `true`, all pending requests are aborted.\n @param {string} [options.reason]\n A reason for why the request was aborted.\n\n If omitted, a generic reason like `\"Aborted request to GET /path\"` will be used.\n\n The reason will be set as the error's message.\n @param {up.Request} [options.except]\n An `up.Request` that should not be aborted even if it matches the given `condition`.\n\n @experimental\n @stable\n */\n function abortRequests(...args) {\n up.migrate.preprocessAbortArgs?.(args)\n queue.abort(...args)\n }\n\n /*-\n This event is [emitted](/api/up.emit) when a [request](/api/up.request)\n was [aborted](/learn/aborting-requests).\n\n @learn-ref aborting-requests#reacting\n\n The event is emitted on the layer that caused the request.\n\n Also see `up:fragment:aborted`.\n\n @event up:request:aborted\n\n @param {up.Request} event.request\n The aborted request.\n\n @param {up.Layer} [event.layer]\n The [layer](/api/up.layer) this request is associated with.\n\n If this request was intended to update an existing fragment, this is that fragment's layer.\n\n If this request was intended to [open an overlay](/learn/opening-overlays),\n the associated layer is the future overlay's parent layer.\n\n @param {Element} [event.origin]\n The link or form element that caused the request.\n\n @param event.preventDefault()\n\n @stable\n */\n\n /*-\n This event is [emitted](/api/up.emit) when [requests](/api/up.request)\n are taking long to finish loading.\n\n @learn-ref network-issues#slow-server-responses\n\n ## Timing\n\n By default, Unpoly will wait 400 ms for a request to finish\n before emitting `up:network:late`. You may configure this delay\n [globally](/api/up.network.config#config.lateDelay),\n for [individual links](/api/up-follow#up-late-delay), or for [specific requests](/api/up.request#options.lateDelay).\n\n Once all responses have been received, an [`up:network:recover`](/api/up:network:recover)\n event will be emitted.\n\n If additional requests are made while Unpoly is already busy waiting,\n **no** additional `up:network:late` events will be emitted.\n\n ## Default behavior\n\n By default, Unpoly will show a [progress bar](/learn/progress-bar) while late requests\n are pending. You can [disable](/learn/progress-bar#disabling) the progress bar\n or [implement custom loading indicators](/learn/progress-bar#custom-implementation).\n\n @event up:network:late\n @stable\n @signature\n */\n\n /*-\n This event is [emitted](/api/up.emit) when [requests](/api/up.request)\n have [taken long to finish](/api/up:network:late), but have finished now.\n\n @learn-ref network-issues#slow-server-responses\n\n @event up:network:recover\n @stable\n */\n\n /*-\n This event is [emitted](/api/up.emit) before a [request](/api/up.request)\n is sent over the network.\n\n @learn-ref network\n\n Only requests that are sent via Unpoly features\n (like `[up-follow]` or `up.request()`) will trigger this event.\n When making requests using `fetch()` or `XMLHttpRequest`, no event is emitted.\n\n The event is emitted on the layer that caused the request.\n\n ## Changing requests before loading {#changing-requests}\n\n Listeners to `up:request:load` can inspect or\n mutate the [request options](/api/up.request#parameters-request)\n before the request is loaded.\n\n For example, this listener changes requests to `/stocks`\n to include a custom header and have a timeout of 10 seconds:\n\n ```js\n up.on('up:request:load', (event) => {\n if (event.request.url === '/stocks') {\n event.request.headers['X-Client-Time'] = Date.now().toString()\n event.request.timeout = 10_000\n }\n })\n ```\n\n @event up:request:load\n @param {up.Request} event.request\n The request that will be sent.\n\n Listeners can [inspect or mutate request options](#changing-requests) before the request is sent.\n @param {up.Layer} [event.layer]\n The [layer](/api/up.layer) this request is associated with.\n\n If this request is intended to update an existing fragment, this is that fragment's layer.\n\n If this request is intended to [open an overlay](/learn/opening-overlays),\n the associated layer is the future overlay's parent layer.\n @param {Element} [event.origin]\n The link or form element that caused the request.\n @param event.preventDefault()\n [Aborts](/api/up.Request.prototype.abort) the request before it is sent.\n @stable\n */\n\n /*-\n This event is [emitted](/api/up.emit) when the response to a [request](/api/up.request)\n has been received.\n\n @learn-ref network\n\n Note that this event will also be emitted when the server signals an\n error with an HTTP status like `500`. Only if the request\n encounters a fatal error (like a loss of network connectivity),\n `up:request:offline` is emitted instead.\n\n The event is emitted on the layer that caused the request.\n\n > [tip]\n > If you're looking to influence a render pass after a server response,\n > use `up:fragment:loaded` instead.\n\n @event up:request:loaded\n\n @param {up.Request} event.request\n The request.\n\n @param {up.Response} event.response\n The response that was received from the server.\n\n @param {up.Layer} [event.layer]\n The [layer](/api/up.layer) this request is associated with.\n\n If this request is intended to update an existing fragment, this is that fragment's layer.\n\n If this request is intended to [open an overlay](/learn/opening-overlays),\n the associated layer is the future overlay's parent layer.\n\n @param {Element} [event.origin]\n The link or form element that caused the request.\n\n @stable\n */\n\n /*-\n This event is [emitted](/api/up.emit) when a [request](/api/up.request)\n encounters a fatal error, like a [timeout](/api/up.network.config#config.timeout) or loss of network connectivity.\n\n @learn-ref network-issues#disconnects\n\n > [note]\n > This event will *not* be emitted when the server produces\n > an error message with an HTTP status like `500`. When the server can produce\n > any response, [`up:request:loaded`](/api/up:request:loaded) is emitted instead.\n\n The event is emitted on the layer that caused the request.\n\n To effectively [handle disconnects while rendering](/learn/network-issues#disconnects), use the `up:fragment:offline` event instead.\n\n @event up:request:offline\n\n @param {up.Request} event.request\n The failed request.\n\n @param {up.Layer} [event.layer]\n The [layer](/api/up.layer) this request is associated with.\n\n If this request was intended to update an existing fragment, this is that fragment's layer.\n\n If this request was intended to [open an overlay](/learn/opening-overlays),\n the associated layer is the future overlay's parent layer.\n\n @param {Element} [event.origin]\n The link or form element that caused the request.\n\n @stable\n */\n\n function isSafeMethod(method) {\n return u.contains(['GET', 'OPTIONS', 'HEAD'], u.normalizeMethod(method))\n }\n\n function onLate() {\n if (u.evalOption(config.progressBar)) {\n progressBar = new up.ProgressBar()\n }\n }\n\n function onRecover() {\n progressBar?.conclude()\n }\n\n up.on('up:network:late', onLate)\n up.on('up:network:recover', onRecover)\n up.on('up:framework:reset', reset)\n\n return {\n request: makeRequest,\n // buildRequest,\n // processRequest,\n cache,\n isBusy,\n isSafeMethod,\n config,\n abort: abortRequests,\n queue, // for testing\n loadPage,\n }\n})()\n\nup.request = up.network.request\n\nup.cache = up.network.cache\n","require('./layer.sass')\n\nconst u = up.util\n\n/*-\nFeatures to open, close and look up overlays.\n\nAdd `[up-layer=new]` to a link or form to show its response in a new overlay, or open one from JavaScript with `up.layer.open()`. An overlay closes when the user dismisses it, or when an `[up-accept]` link or form closes it with a result value. `up.layer.ask()` opens an overlay and returns a promise for that value, so a subinteraction reads like a function call.\n\n`up.layer.current` is the layer your code is working with, and most functions in this module operate on it: `up.layer.on()` listens to events from the current layer only, and `up.layer.dismiss()` closes it. The layers themselves are `up.Layer` objects, listed in `up.layer.stack`.\n\n@learn-ref overlays\n\n@module up.layer\n*/\nup.layer = (function() {\n\n const LAYER_CLASSES = [\n up.Layer.Root,\n up.Layer.Modal,\n up.Layer.Popup,\n up.Layer.Drawer,\n up.Layer.Cover\n ]\n\n /*-\n Configures default attributes for new overlays.\n\n All options for `up.layer.open()` can be configured.\n The configuration will also be used for `[up-layer=new]` links.\n\n Defaults are configured separately for each [layer mode](/learn/overlays#layer-modes):\n\n | Object | Effect |\n |---------------------------|------------------------------|\n | `up.layer.config.root` | Defaults for the root layer |\n | `up.layer.config.modal` | Defaults for modal overlays |\n | `up.layer.config.drawer` | Defaults for drawer overlays |\n | `up.layer.config.popup` | Defaults for popup overlays |\n | `up.layer.config.cover` | Defaults for cover overlays |\n\n For convenience, you can configure options that affect all layer modes\n or all overlay modes:\n\n | Object | Effect |\n |---------------------------|------------------------------|\n | `up.layer.config.any` | Defaults for all layers |\n | `up.layer.config.overlay` | Defaults for all overlays |\n\n ### Configuration inheritance\n\n Options configured this way are inherited.\n For example, when you open a new drawer overlay, defaults from `up.layer.config.drawer`,\n `up.layer.config.overlay`, and `up.layer.config.any` will be used (in decreasing priority).\n\n ### Example\n\n To make all modal overlays move in from beyond the top edge of the screen:\n\n ```js\n up.layer.config.modal.openAnimation = 'move-from-top'\n ```\n\n To configure an additional [main target](/api/up-main)\n for overlays of any mode:\n\n ```js\n up.layer.config.overlay.mainTargets.unshift('.content')\n ```\n\n @property up.layer.config\n\n @param {string} [config.mode='modal']\n The default [mode](/learn/overlays#layer-modes) used when opening a new overlay.\n\n @param {Object} config.any\n Defaults for all layer modes.\n\n @param {Array<string>} config.any.mainTargets\n An array of CSS selectors matching default [render targets](/learn/targeting-fragments).\n\n This is an alias for `up.fragment.config.mainTargets`.\n\n @param {Object} config.root\n Defaults for the [root layer](/learn/overlays#layer-modes).\n\n Inherits from `up.layer.config.any`.\n\n @param {Array<string>} config.root.mainTargets\n An array of CSS selectors matching default [render targets](/learn/targeting-fragments)\n for the [root layer](/learn/overlays#layer-modes), but not for overlays.\n\n @param {Object} config.overlay\n Defaults for all [overlays](/learn/overlays#layer-modes).\n\n In addition to the options documented here,\n all options for `up.layer.open()` may also be configured.\n\n Inherits from `up.layer.config.any`.\n\n @param {string|Function} config.overlay.openAnimation\n The opening animation.\n\n @param {number} config.overlay.openDuration\n The duration of the opening animation.\n\n @param {string} config.overlay.openEasing\n The easing function for the opening animation.\n\n @param {string|Function} config.overlay.closeAnimation\n The closing animation.\n\n @param {number} config.overlay.closeDuration\n The duration of the closing animation.\n\n @param {string} config.overlay.closeEasing\n The easing function for the closing animation.\n\n @param {string} config.overlay.dismissLabel\n The label for the dismiss icon in the top-right corner.\n\n @param {string} config.overlay.dismissARIALabel\n The accessibility label for the dismiss icon in the top-right corner.\n\n @param {string|boolean} [config.overlay.history='auto']\n Whether the layer's location or title will be visible in the browser's\n address bar and window title.\n\n If set to `'auto'`, the overlay has [visible history](/learn/history-in-overlays) if its initial fragment\n is an [auto history target](/api/up.fragment.config#config.autoHistoryTargets).\n\n If set to `true`, the overlay always has visible history.\n If set to `false`, the overlay never has visible history.\n\n @param {boolean} config.overlay.trapFocus\n Whether to [trap focus](/learn/focus#overlay-focus-trap) within the overlay while it is in [front](/api/up.layer.front).\n\n By default focus is trapped for all overlays except [popups](/learn/overlays#layer-modes).\n\n @param {string} [config.overlay.class]\n An HTML class for the overlay's container element.\n\n See [overlay classes](/learn/customizing-overlays#overlay-classes).\n\n @param {Object} config.modal\n Defaults for [modal overlays](/learn/overlays#layer-modes).\n\n Inherits from `up.layer.config.overlay` and `up.layer.config.any`.\n\n @param {Object} config.cover\n Defaults for [cover overlays](/learn/overlays#layer-modes).\n\n Inherits from `up.layer.config.overlay` and `up.layer.config.any`.\n\n @param {Object} config.drawer\n Defaults for [drawer overlays](/learn/overlays#layer-modes).\n\n Inherits from `up.layer.config.overlay` and `up.layer.config.any`.\n\n @param {Object} config.popup\n Defaults for [popup overlays](/learn/overlays#layer-modes).\n\n Inherits from `up.layer.config.overlay` and `up.layer.config.any`.\n\n @param {Array<string>} config.foreignOverlaySelectors\n An array of CSS selectors matching overlays not constructed by Unpoly.\n\n Other JavaScript libraries often attach their overlay elements\n to the end of the `<body>`, which makes Unpoly consider these overlays\n to be part of the root layer. This can cause Unpoly to steal focus from foreign\n overlays, or cause Unpoly overlays to close incorrectly when the foreign overlay is clicked.\n Adding a selector to this array will cause Unpoly to\n be less opinionated about user interactions within matching elements.\n\n By default, this contains a selector matching the\n [`<dialog>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog) element.\n\n @stable\n */\n const config = new up.Config('up.layer.config', function() {\n const newConfig = {\n mode: 'modal',\n any: {\n mainTargets: [\n \"[up-main='']\",\n 'main',\n ':layer' // this is <body> for the root layer\n ]\n },\n root: {\n mainTargets: ['[up-main~=root]'],\n history: true\n },\n overlay: {\n mainTargets: ['[up-main~=overlay]'],\n openAnimation: 'fade-in',\n closeAnimation: 'fade-out',\n dismissLabel: '×',\n dismissARIALabel: 'Dismiss dialog',\n dismissible: true,\n history: 'auto',\n trapFocus: true,\n },\n cover: {\n mainTargets: ['[up-main~=cover]']\n },\n drawer: {\n mainTargets: ['[up-main~=drawer]'],\n backdrop: true,\n position: 'left',\n size: 'medium',\n openAnimation(layer) {\n switch (layer.position) {\n case 'left': return 'move-from-left'\n case 'right': return 'move-from-right'\n }\n },\n closeAnimation(layer) {\n switch (layer.position) {\n case 'left': return 'move-to-left'\n case 'right': return 'move-to-right'\n }\n }\n },\n modal: {\n mainTargets: ['[up-main~=modal]'],\n backdrop: true,\n size: 'medium'\n },\n popup: {\n mainTargets: ['[up-main~=popup]'],\n position: 'bottom',\n size: 'medium',\n align: 'left',\n dismissible: 'outside key',\n trapFocus: false,\n },\n foreignOverlaySelectors: ['dialog'],\n }\n\n for (let Class of LAYER_CLASSES) {\n newConfig[Class.mode].Class = Class\n }\n\n return newConfig\n })\n\n /*-\n A list of layers that are currently open.\n\n The first element in the list is the [root layer](/api/up.layer.root).\n The last element is the [frontmost layer](/api/up.layer.front).\n\n @property up.layer.stack\n @param {List<up.Layer>} stack\n @stable\n */\n let stack = null\n\n let handlers = []\n\n function mainTargets(mode) {\n return u.flatMap(modeConfigs(mode), 'mainTargets')\n }\n\n /*\n Returns an array of config objects that apply to the given mode name.\n\n The config objects are in descending order of specificity.\n */\n function modeConfigs(mode) {\n if (mode === 'root') {\n return [config.root, config.any]\n } else {\n return [config[mode], config.overlay, config.any]\n }\n }\n\n function normalizeLayerOption(options) {\n if (options.layer instanceof up.Layer) return\n\n up.migrate.handleLayerOptions?.(options)\n\n if (u.isGiven(options.layer)) { // might be the number 0, which is falsy\n let match = String(options.layer).match(/^(new|shatter|swap)( (\\w+))?/)\n if (match) {\n options.layer = 'new'\n\n const openMethod = match[1]\n const shorthandMode = match[3]\n\n // The mode may come from one of these sources:\n // (1) As { mode } option\n // (2) As a { layer } short hand like { layer: 'new popup' }\n // (3) As the default in config.mode\n options.mode ||= shorthandMode || config.mode\n\n if (openMethod === 'swap') {\n // If an overlay is already open, we replace that with a new overlay.\n // If we're on the root layer, we open an overlay.\n if (up.layer.isOverlay()) {\n options.baseLayer = 'parent'\n }\n } else if (openMethod === 'shatter') {\n // Dismiss all overlays and open a new overlay.\n options.baseLayer = 'root'\n }\n }\n // If no options.layer is given we still want to avoid updating \"any\" layer.\n // Other options might have a hint for a more appropriate layer.\n } else if (u.isElementLike(options.target)) {\n // If we are targeting an actual Element or jQuery collection (and not\n // a selector string) we operate in that element's layer.\n options.layer = stack.get(options.target, { normalizeLayerOptions: false })\n } else if (options.origin) {\n // Links update their own layer by default.\n options.layer = 'origin'\n } else {\n // If nothing is given, we assume the current layer\n options.layer = 'current'\n }\n }\n\n function setBaseLayerOption(options) {\n if (options.baseLayer instanceof up.Layer) return\n\n // Remember the layer that was current when the request was made,\n // so changes with `{ layer: 'new' }` will know what to stack on.\n // Note if options.baseLayer is given, up.layer.get('current', options) will\n // return the resolved version of that.\n options.baseLayer = stack.get('current', { ...options, normalizeLayerOptions: false })\n }\n\n function normalizeOptions(options) {\n normalizeLayerOption(options)\n options.context ??= {}\n setBaseLayerOption(options)\n }\n\n function build(options, beforeNew) {\n const { mode } = options\n const { Class } = config[mode]\n\n // modeConfigs() returns the most specific options first,\n // but in merge() below later args override keys from earlier args.\n const configs = modeConfigs(mode).toReversed()\n\n let handleDeprecatedConfig = up.migrate.handleLayerConfig\n if (handleDeprecatedConfig) {\n configs.forEach(handleDeprecatedConfig)\n }\n\n // We allow to pass the open animation as up.layer.open({ animation, duration, easing })\n // or a[up-animation][up-duration][up-easing] options.\n options.openAnimation ??= u.pluckKey(options, 'animation')\n options.openDuration ??= u.pluckKey(options, 'duration')\n options.openEasing ??= u.pluckKey(options, 'easing')\n\n options = u.mergeDefined(...configs, { mode, stack }, options)\n\n if (beforeNew) {\n options = beforeNew(options)\n }\n\n return new Class(options)\n }\n\n function reset() {\n stack.reset()\n handlers = u.filter(handlers, 'isDefault')\n }\n\n /*-\n [Opens a new overlay](/learn/opening-overlays).\n\n Opening a layer is considered [navigation](/learn/navigation-defaults) by default.\n\n @learn-ref opening-overlays\n\n ## Example\n\n ```js\n let layer = await up.layer.open({ url: '/contacts' })\n console.log(layer.mode) // logs \"modal\"\n ```\n\n @function up.layer.open\n\n @section Render options\n @param {Object} [options]\n Render options to apply when opening the new overlay.\n\n Common options are documented below, but most [options for `up.render()`](/api/up.render#parameters) can be used.\n\n You can configure default layer options in `up.layer.config`.\n For example, options in `up.layer.config.overlay` become defaults for all overlays,\n while options in `up.layer.config.drawer` become defaults for all drawers.\n\n @param {boolean} [options.navigate=true]\n Whether to apply [navigation defaults](/learn/navigation-defaults).\n\n @section Placement\n @param {string} [options.target]\n The selector of the root content element to place inside the overlay container.\n\n The given `{ target }` must be matchable within the HTML provided by either the `{ url }`, `{ content }`, `{ fragment }`, or `{ document }` option.\n\n If the `{ target }` option is omitted, Unpoly will use the first matching [main target](/api/up-main) configured for the overlay mode. For example, the default selectors for modals are configured in `up.layer.config.modal.mainTargets`. See [main targets in overlays](/api/up-main#overlays).\n\n @param {string} [options.layer=\"new\"]\n Whether to stack the new overlay or replace existing overlays.\n\n The following values are supported:\n\n @include new-overlay-placement-table\n\n @param {Element} [options.origin]\n The link or button element that caused this overlay to open.\n\n When the overlay closes, the origin [receives the focus](/learn/focus#overlays) again. When you open an overlay from JavaScript, pass the element the user interacted with, e.g. `{ origin: event.target }` in an event handler. Without an origin, focus moves to the parent layer, and keyboard users lose their place on the page.\n\n When opening a popup, the overlay is anchored relative to the origin element.\n\n @param {string} [options.position]\n For **popups**, the position of the popup relative to the link or button that opened\n the overlay. See [popup position](/learn/customizing-overlays#popup-position).\n\n For **drawers**, the screen edge on which to position the drawer (`left` or `right`).\n See [drawer position](/learn/customizing-overlays#drawer-position).\n\n @param {string} [options.align]\n For **popups**, the alignment of the popup within its `{ position }`.\n See [popup position](/learn/customizing-overlays#popup-position).\n\n @section Request\n @mix up.render/request\n @param options.abort\n Whether to abort existing requests before rendering.\n\n By default, opening a new overlay will abort all requests within the [main](/api/main) element\n of its base layer.\n\n See [aborting requests](/learn/aborting-requests) for details and a list of options.\n\n @param options.abortable\n Whether the request may be aborted by other requests.\n\n By default, the request will be aborted:\n\n - By another request opening another overlay from the same base layer\n - By another request targeting the base layer's [main](/api/main) element\n\n See [Preventing a request from being aborted](/learn/aborting-requests#preventing).\n\n @section Local content\n @mix up.render/local-content\n\n @section Customization\n\n @param {string} [options.mode]\n The kind of overlay to open.\n\n See [available layer modes](/learn/overlays#layer-modes).\n\n @param {string} [options.size]\n The size of the overlay.\n\n Supported values are `'small'`, `'medium'`, `'large'`, and `'grow'`.\\\n See [overlay sizes](/learn/customizing-overlays#overlay-sizes) for details.\n\n @param {string} [options.class]\n An optional HTML class for the overlay's container element.\n\n See [overlay classes](/learn/customizing-overlays#overlay-classes).\n\n @param {boolean|string|Array<string>} [options.dismissible=true]\n How the overlay can be [dismissed](/learn/closing-overlays) by the user.\n\n Supported values are `'key'`, `'outside'`, and `'button'`.\\\n See [customizing dismiss controls](/learn/customizing-overlays#customizing-dismiss-controls)\n for details.\n\n You can enable multiple dismiss controls by passing an array or\n a space-separated string.\n\n Passing `true` or `false` will enable or disable all dismiss controls.\n\n @param {string} [options.dismissLabel]\n The label for the dismiss icon in the top-right corner.\n\n @param {string} [options.dismissARIALabel]\n The accessibility label for the dismiss icon in the top-right corner.\n\n @param {boolean}[options.trapFocus]\n Whether to [trap focus](/learn/focus#overlay-focus-trap) within the overlay while it is in [front](/api/up.layer.front).\n\n By default focus is trapped for all overlays except [popups](/learn/overlays#layer-modes).\n\n @section Client state\n @param {Object} [options.data]\n The [data object](/learn/data) for the overlay's root content element (`{ target }`).\n\n If the content element already has an `[up-data]` attribute, properties from `{ data }` take precedence.\n\n @param {Object} [options.context={}]\n The initial [context](/api/up.layer.context) object for the new overlay.\n\n @experimental\n\n @section History\n @mix up.render/history\n @param {boolean|string} [options.history]\n Whether the overlay has [visible history](/learn/history-in-overlays).\n\n If set to `true`, the overlay location, title, and meta tags will be shown\n while the overlay is open. When the overlay is closed, the parent layer's history is restored.\n\n If set to `'auto'`, history will be visible if the initial overlay\n content matches a [main target](/api/up-main).\n\n If set to `false`, fragment changes within the overlay will *never* update the address bar.\n You can still access the overlay's current location using `up.layer.location`.\n\n See [History in overlays](/learn/history-in-overlays).\n\n @section Animation\n @param {string|Function|boolean} [options.animation='fade-in']\n The opening animation.\n\n @param {string} [options.easing='ease']\n The [timing function](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function)\n that controls the opening animation's acceleration.\n\n @param {number} [options.duration=175]\n The duration of the opening animation in milliseconds.\n\n @param {string|Function|boolean} [options.closeAnimation='fade-out']\n The closing animation.\n\n @param {string} [options.closeEasing='ease']\n The [timing function](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function)\n that controls the closing animation's acceleration.\n\n @param {number} [options.closeDuration=175]\n The duration of the closing animation in milliseconds.\n\n @section Close conditions\n\n @param {string|Array<string>} [options.acceptEvent]\n One or more event types that will cause this overlay to automatically be\n [accepted](/learn/closing-overlays) when a matching event occurs within the overlay.\n\n The [acceptance value](/learn/closing-overlays#acceptance-values)\n is the event object that caused the overlay to close.\n\n See [Closing when an event is emitted](/learn/subinteractions#event-condition).\n\n @param {string|Array<string>} [options.dismissEvent]\n One or more event types that will cause this overlay to automatically be\n [dismissed](/learn/closing-overlays) when a matching event occurs within the overlay.\n\n The [dismissal value](/learn/closing-overlays#dismissal-values)\n is the event object that caused the overlay to close.\n\n See [Closing when an event is emitted](/learn/subinteractions#event-condition).\n\n @param {string|Array<string>} [options.acceptLocation]\n One or more [URL patterns](/api/url-patterns) that will cause this overlay to automatically be\n [accepted](/learn/closing-overlays) when the overlay reaches a matching [location](/api/up.layer.location).\n\n The [acceptance value](/learn/closing-overlays#acceptance-values)\n is an object of [named segments matches](/api/url-patterns#capturing-named-segments) captured\n by the URL pattern. It also contains the matched URL as a `location` key.\n\n See [Closing when a location is reached](/learn/subinteractions#location-condition).\n\n @param {string|Array<string>} [options.dismissLocation]\n One or more [URL patterns](/api/url-patterns) that will cause this overlay to automatically be\n [dismissed](/learn/closing-overlays) when the overlay reaches a matching [location](/api/up.layer.location).\n\n The [dismissal value](/learn/closing-overlays#dismissal-values)\n is an object of [named segments matches](/api/url-patterns#capturing-named-segments) captured\n by the URL pattern. It also contains the matched URL as a `location` key.\n\n See [Closing when a location is reached](/learn/subinteractions#location-condition).\n\n @param {string} [options.acceptFragment]\n A CSS selector that will cause this overlay to automatically be\n [accepted](/learn/closing-overlays) when a matching element is observed within the overlay.\n\n The [acceptance value](/learn/closing-overlays#acceptance-values)\n is the matching fragment's [data](/learn/data) object.\\\n If the fragment has no data, the value is an empty object.\n\n See [Closing when a fragment is detected](/learn/subinteractions#fragment-condition).\n\n @param {string} [options.dismissFragment]\n A CSS selector that will cause this overlay to automatically be\n [dismissed](/learn/closing-overlays) when a matching element is observed within the overlay.\n\n The [dismissal value](/learn/closing-overlays#dismissal-values)\n is the matching fragment's [data](/learn/data) object.\\\n If the fragment has no data, the value is an empty object.\n\n See [Closing when a fragment is detected](/learn/subinteractions#fragment-condition).\n\n @section Callbacks\n @param {Function(Event)} [options.onOpened]\n A function that is called when the overlay was inserted into the DOM.\n\n The function argument is an `up:layer:opened` event.\n\n The overlay may still play an opening animation when this function is called.\n To be called when the opening animation is done, pass an\n [`{ onFinished }`](/api/up.render#options.onFinished) option.\n\n @param {Function(Event)} [options.onAccept]\n A function that is called when the overlay is about to be [accepted](/learn/closing-overlays).\n\n The function argument is an `up:layer:accept` event.\n The overlay's [acceptance value](/learn/closing-overlays#acceptance-values) is available as `event.value`.\n\n To keep the overlay open, call `event.preventDefault()`.\n This has no effect when the overlay is closed because a background layer is being\n [updated](/learn/closing-overlays#peeling).\n\n To run code after the overlay closed, use `{ onAccepted }` instead.\n\n @param {Function(Event)} [options.onAccepted]\n A function that is called when the overlay was [accepted](/learn/closing-overlays).\n\n The function argument is an `up:layer:accepted` event.\n\n @param {string} [options.onAcceptedReload]\n A selector to [reload](/api/up.reload) after the overlay was [accepted](/learn/closing-overlays).\n\n The element is looked up in the layer that opened the overlay.\n An element near the `{ origin }` is preferred, and the selector may use `:origin`.\n\n When an `{ onAccepted }` callback is also set, it runs first.\n\n See [[subinteractions#reloading-on-acceptance]].\n\n @experimental\n\n @param {Function(Event)} [options.onDismiss]\n A function that is called when the overlay is about to be [dismissed](/learn/closing-overlays).\n\n The function argument is an `up:layer:dismiss` event.\n The overlay's [dismissal value](/learn/closing-overlays#dismissal-values) is available as `event.value`.\n\n To keep the overlay open, call `event.preventDefault()`.\n This has no effect when the overlay is closed because a background layer is being\n [updated](/learn/closing-overlays#peeling).\n\n To run code after the overlay closed, use `{ onDismissed }` instead.\n\n @param {Function(Event)} [options.onDismissed]\n A function that is called when the overlay was [dismissed](/learn/closing-overlays).\n\n The function argument is an `up:layer:dismissed` event.\n\n @param {string} [options.onDismissedReload]\n A selector to [reload](/api/up.reload) after the overlay was [dismissed](/learn/closing-overlays).\n\n The element is looked up in the layer that opened the overlay.\n An element near the `{ origin }` is preferred, and the selector may use `:origin`.\n\n When an `{ onDismissed }` callback is also set, it runs first.\n\n @experimental\n\n @include up.render/lifecycle-hooks\n\n @return {Promise<up.Layer>}\n A promise for the `up.Layer` object that describes the new overlay.\n\n The promise is fulfilled once the overlay was placed into the DOM.\n At this time an overlay's opening animation will still be playing.\n\n @stable\n */\n async function open(options) {\n options = u.options(options, {\n layer: 'new',\n defaultToEmptyContent: true,\n navigate: true\n })\n\n // Even if we are given { content } we need to pipe this through up.render()\n // since a lot of options processing is happening there.\n //\n // Defaults for the layer mode will be merged in later, by OpenLayer via up.layer.build().\n let result = await up.render(options)\n return result.layer\n }\n\n /*-\n This event is emitted before an overlay is [opened](/learn/opening-overlays).\n\n At emission time, the overlay is not yet part of the [layer stack](/api/up.layer.stack).\n The overlay's elements have not yet been placed in the DOM.\n Listeners can prevent this event to prevent the overlay from opening.\n\n The event is emitted on the `document`.\n\n @learn-ref opening-overlays\n\n ### Changing layer options\n\n Listeners can inspect and manipulate options for the overlay that is about to open.\n\n For example, to give overlays the CSS class `.warning` if the initial URL contains\n the word `\"confirm\"`:\n\n ```js\n up.on('up:layer:open', function(event) {\n if (event.layerOptions.url.includes('confirm')) {\n event.layerOptions.class = 'warning'\n }\n })\n ```\n\n @event up:layer:open\n @param {Object} event.layerOptions\n Options for the overlay that is about to open.\n\n Listeners can inspect and change the options.\n All options for `up.layer.open()` can be used.\n @param {Element} event.origin\n The link element that is opening the overlay.\n @param event.preventDefault()\n Prevents this overlay from opening.\n\n Programmatic callers will reject with an `up.Aborted` error.\n @stable\n */\n\n /*-\n This event is emitted after a new overlay was placed into the DOM.\n\n @learn-ref opening-overlays\n\n ## Customizing the overlay appearance\n\n The event is emitted right before the opening animation starts. Because the overlay\n has not yet been painted by the browser, this is a good occasion to\n [customize overlay elements](/learn/customizing-overlays#customizing-overlay-elements):\n\n ```js\n up.on('up:layer:opened', function(event) {\n if (isChristmas()) {\n up.element.affix(event.layer.element, '.santa-hat', { text: 'Merry Christmas!' })\n }\n })\n ```\n\n See [Customizing overlays](/learn/customizing-overlays) for other methods to change\n the overlay appearance.\n\n @event up:layer:opened\n @param {Element} event.origin\n The link element that is opening the overlay.\n @param {up.Layer} event.layer\n The [layer object](/api/up.Layer) that is opening.\n @stable\n */\n\n /*-\n This event is emitted after a layer's [location property](/api/up.Layer.prototype.location)\n has changed value.\n\n This event is *also* emitted when a layer [without visible history](/api/up.Layer.prototype.history)\n has reached a new location. If you are only interested in changes that are visible in\n the browser's address bar, observe `up:location:changed` instead.\n\n The event is also emitted for location changes on the [root layer](/learn/overlays#layer-modes).\n\n This event is *not* emitted when an overlay is opened. For this, observe `up:layer:opened` instead.\n\n @learn-ref history-in-overlays\n\n @param {string} event.location\n The current layer location.\n @param {string|undefined} event.previousLocation\n The previous layer location.\n\n May be `undefined` if the layer was opened without a known location.\n @param {up.Layer} event.layer\n The [layer object](/api/up.Layer) that had its location changed.\n @event up:layer:location:changed\n @stable\n */\n\n /*-\n [Opens an overlay](/learn/opening-overlays) and returns a promise for its [acceptance](/learn/closing-overlays).\n\n It's useful to think of overlays as [promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)\n that can either be **fulfilled (accepted)** or **rejected (dismissed)**.\n\n @learn-ref subinteractions#awaiting-subinteractions-from-javascript\n\n ## Example\n\n Instead of using `up.layer.open()` and passing callbacks, you can use `up.layer.ask()`.\n `up.layer.ask()` returns a promise for the [acceptance value](/learn/closing-overlays#acceptance-values), which you can `await`:\n\n ```js\n let user = await up.layer.ask({ url: '/users/new' })\n console.log(\"New user is \" + user)\n ```\n\n To handle the case where the overlay wasn't completed successfully, you\n can `catch` the rejected promise. It rejects with the [dismissal value](/learn/closing-overlays#dismissal-values):\n\n ```js\n try {\n let user = await up.layer.ask({ url: '/users/new' })\n console.log(\"New user is\", user)\n } catch (reason) {\n console.error(\"Could not register:\", reason)\n }\n ```\n\n @function up.layer.ask\n\n @mix up.layer.open\n\n @return {Promise}\n A promise that settles when the overlay closes.\n\n When the overlay is accepted, the promise will fulfill with the overlay's [acceptance value](/learn/closing-overlays#acceptance-values).\n\n When the overlay is dismissed, the promise will reject with the overlay's [dismissal value](/learn/closing-overlays#dismissal-values).\n\n @stable\n @signature\n */\n function ask(options) {\n return new Promise(function(resolve, reject) {\n open(up.RenderOptions.chainCallbacks(options, {\n onAccepted: (event) => resolve(event.value),\n onDismissed: (event) => reject(event.value),\n }))\n })\n }\n\n // The layer classes' selectors never change, so we only build this once.\n const ANY_SELECTOR = u.map(LAYER_CLASSES, (Class) => Class.selector()).join()\n\n // Returns the closest ancestor (or self) that is a layer element. This looks at the DOM, not the\n // layer stack: for an element in a closing overlay it returns that overlay's element, while\n // up.layer.get(element) returns nothing.\n function closestLayerElement(element) {\n return element.closest(ANY_SELECTOR)\n }\n\n function optionToString(option) {\n if (u.isString(option)) {\n return `layer \"${option}\"`\n } else {\n return option.toString()\n }\n }\n\n function isWithinForeignOverlay(element) {\n let selector = config.selector('foreignOverlaySelectors')\n return !!(selector && element.closest(selector))\n }\n\n /*-\n Shows the response to a link click or form submission within [a new overlay](/learn/opening-overlays).\n\n @learn-ref opening-overlays\n\n ## Example\n\n This link will open its response in a modal overlay:\n\n ```html\n <a href=\"/menu\" up-layer=\"new\">Open menu</a> <!-- mark: up-layer=\"new\" -->\n ```\n\n This form will show error messages from a [failed submission](/learn/error-responses) within a modal overlay:\n\n ```html\n <form action=\"/submit\" up-fail-layer=\"new\"> <!-- mark: up-fail-layer=\"new\" -->\n ...\n </form>\n ```\n\n @selector [up-layer=new]\n\n @params-note\n All modifying attributes for `[up-follow]` (links) or `[up-submit]` (forms) can also be used.\\\n Default layer attributes can be configured in `up.layer.config`.\n\n @section Placement\n @param [up-target]\n The selector of the root content element to place inside the overlay container.\n\n The target must be matchable within the HTML provided by either the `[href]`, `[up-content]`, `[up-fragment]`, or `[up-document]` attribute.\n\n If the attribute is omitted, Unpoly will use the first matching [main target](/api/up-main) configured for the overlay mode. For example, the default selectors for modals are configured in `up.layer.config.modal.mainTargets`. See [main targets in overlays](/api/up-main#overlays).\n\n @param [up-layer=\"new\"]\n @like up.layer.open/options.layer\n\n @param [up-position]\n @like up.layer.open/options.position\n\n @param [up-align]\n @like up.layer.open/options.align\n\n @section Request\n @mix up-follow/request\n @param [up-abort]\n Whether to abort existing requests before rendering.\n\n By default, opening a new overlay will abort all requests within the [main](/api/main) element\n of its base layer.\n\n See [aborting requests](/learn/aborting-requests) for details and a list of options.\n\n @param [up-abortable]\n Whether the request may be aborted by other requests.\n\n By default, the request will be aborted:\n\n - By another request opening another overlay from the same base layer\n - By another request targeting the base layer's [main](/api/main) element\n\n See [Preventing a request from being aborted](/learn/aborting-requests#preventing).\n\n @section Local content\n @mix up-follow/local-content\n\n @section Customization\n @param [up-mode='modal']\n The kind of overlay to open.\n\n Defaults to `up.layer.config.mode`, which defaults to `'modal'`.\n\n See [available layer modes](/learn/overlays#layer-modes).\n\n @param [up-size='medium']\n The size of the overlay.\n\n See [overlay sizes](/learn/customizing-overlays#overlay-sizes) for details.\n\n @param [up-class]\n An optional HTML class for the overlay's container element.\n\n See [overlay classes](/learn/customizing-overlays#overlay-classes).\n\n @param [up-dismissible]\n How the overlay can be [dismissed](/learn/closing-overlays) by the user.\n\n See [customizing dismiss controls](/learn/customizing-overlays#customizing-dismiss-controls)\n for details.\n\n You can enable multiple dismiss controls by separating values with a space or comma character.\n\n Passing `true` or `false` will enable or disable all dismiss controls.\n\n @section Client state\n @param [up-use-data]\n The [data object](/learn/data) for the overlay's root content element (`[up-target]`),\n encoded as [relaxed JSON](/api/relaxed-json).\n\n If the content element already has an `[up-data]` attribute, properties from `[up-use-data]` take precedence.\n\n @param [up-context]\n The new overlay's [context](/api/up.layer.context) object, encoded as [relaxed JSON](/api/relaxed-json).\n\n @experimental\n\n @section History\n @mix up-follow/history\n @param [up-history]\n Whether the overlay has [visible history](/learn/history-in-overlays).\n\n If set to `'true'`, the overlay location, title, and meta tags will be shown\n while the overlay is open. When the overlay is closed, the parent layer's history is restored.\n\n If set to `'auto'`, history will be visible if the initial overlay\n content matches a [main target](/api/up-main).\n\n If set to `'false'`, fragment changes within the overlay will *never* update the address bar.\n You can still access the overlay's current location using `up.layer.location`.\n\n See [History in overlays](/learn/history-in-overlays).\n\n @section Animation\n @param [up-animation='fade-in']\n The [name](/learn/animations#available-animations) of the opening animation.\n\n @param [up-easing='ease']\n The [timing function](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function)\n that controls the opening animation's acceleration.\n\n @param [up-duration='175']\n The duration of the opening animation in milliseconds.\n\n @param [up-close-animation='fade-out']\n The [name](/learn/animations#available-animations) of the closing animation.\n\n @param [up-close-easing='ease']\n The [timing function](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function)\n that controls the closing animation's acceleration.\n\n @param [up-close-duration=175]\n The duration of the closing animation in milliseconds.\n\n @section Close conditions\n @param [up-accept-event]\n An event type that will cause this overlay to automatically be\n [accepted](/learn/closing-overlays) when a matching event occurs within the overlay.\n\n The [acceptance value](/learn/closing-overlays#acceptance-values)\n is the event object that caused the overlay to close.\n\n You can listen to multiple event types by separating types with a space or comma.\n\n See [Closing when an event is emitted](/learn/subinteractions#event-condition).\n\n @param [up-dismiss-event]\n An event type that will cause this overlay to automatically be\n [dismissed](/learn/closing-overlays) when a matching event occurs within the overlay.\n\n The [dismissal value](/learn/closing-overlays#dismissal-values)\n is the event object that caused the overlay to close.\n\n You can listen to multiple event types by separating types with a space or comma.\n\n See [Closing when an event is emitted](/learn/subinteractions#event-condition).\n\n @param [up-accept-location]\n One or more space-separated [URL patterns](/api/url-patterns) that will cause this overlay to automatically be\n [accepted](/learn/closing-overlays) when the overlay reaches a matching [location](/api/up.layer.location).\n\n The [acceptance value](/learn/closing-overlays#acceptance-values)\n is an object of [named segments matches](/api/url-patterns#capturing-named-segments) captured\n by the URL pattern. It also contains the matched URL as a `location` key.\n\n See [Closing when a location is reached](/learn/subinteractions#location-condition).\n\n @param [up-dismiss-location]\n One or more space-separated [URL patterns](/api/url-patterns) that will cause this overlay to automatically be\n [dismissed](/learn/closing-overlays) when the overlay reaches a matching [location](/api/up.layer.location).\n\n The [dismissal value](/learn/closing-overlays#dismissal-values)\n is an object of [named segments matches](/api/url-patterns#capturing-named-segments) captured\n by the URL pattern. It also contains the matched URL as a `location` key.\n\n See [Closing when a location is reached](/learn/subinteractions#location-condition).\n\n @param [up-accept-fragment]\n A CSS selector that will cause this overlay to automatically be\n [accepted](/learn/closing-overlays) when a matching element is observed within the overlay.\n\n The [acceptance value](/learn/closing-overlays#acceptance-values)\n is the matching fragment's [data](/learn/data) object.\\\n If the fragment has no data, the value is an empty object.\n\n See [Closing when a fragment is detected](/learn/subinteractions#fragment-condition).\n\n @param [up-dismiss-fragment]\n A CSS selector that will cause this overlay to automatically be\n [dismissed](/learn/closing-overlays) when a matching element is observed within the overlay.\n\n The [dismissal value](/learn/closing-overlays#dismissal-values)\n is the matching fragment's [data](/learn/data) object.\\\n If the fragment has no data, the value is an empty object.\n\n See [Closing when a fragment is detected](/learn/subinteractions#fragment-condition).\n\n @section Callbacks\n @param [up-on-opened]\n A JavaScript snippet that is called when the overlay was inserted into the DOM.\n\n The snippet runs in the following scope:\n\n | Expression | Value |\n |------------|------------------------------------------|\n | `this` | The link that opened the overlay |\n | `layer` | An `up.Layer` object for the new overlay |\n | `event` | An `up:layer:opened` event |\n\n @param [up-on-accept]\n A JavaScript snippet that is called when the overlay is about to be [accepted](/learn/closing-overlays).\n\n The snippet runs in the following scope:\n\n | Expression | Value |\n |------------|-----------------------------------------------|\n | `this` | The link that originally opened the overlay |\n | `layer` | An `up.Layer` object for the closing overlay |\n | `value` | The overlay's [acceptance value](/learn/closing-overlays#acceptance-values) |\n | `response` | The server response that is causing the overlay to close |\n | `event` | An `up:layer:accept` event |\n\n To keep the overlay open, call `event.preventDefault()`.\n This has no effect when the overlay is closed because a background layer is being\n [updated](/learn/closing-overlays#peeling).\n\n To run code after the overlay closed, use `[up-on-accepted]` instead.\n\n @param [up-on-accepted]\n A JavaScript snippet that is called when the overlay was [accepted](/learn/closing-overlays).\n\n The snippet runs in the following scope:\n\n | Expression | Value |\n |------------|-----------------------------------------------|\n | `this` | The link that originally opened the overlay |\n | `layer` | An `up.Layer` object for the accepted overlay |\n | `value` | The overlay's [acceptance value](/learn/closing-overlays#acceptance-values) |\n | `response` | The server response that caused the overlay to close |\n | `event` | An `up:layer:accepted` event |\n\n To only reload an element, use `[up-on-accepted-reload]` instead.\n\n @param [up-on-accepted-reload]\n A selector to [reload](/api/up.reload) after the overlay was [accepted](/learn/closing-overlays).\n\n The element is looked up in the layer that opened the overlay.\n An element near the link is preferred, and the selector may use `:origin` to refer to the link.\n\n Unlike `[up-on-accepted]`, this attribute runs no JavaScript, so it needs no [CSP nonce](/learn/script-security#callback-nonces).\n When both attributes are set, the `[up-on-accepted]` callback runs first.\n\n See [[subinteractions#reloading-on-acceptance]].\n\n @experimental\n\n @param [up-on-dismiss]\n A JavaScript snippet that is called when the overlay is about to be [dismissed](/learn/closing-overlays).\n\n The snippet runs in the following scope:\n\n | Expression | Value |\n |------------|------------------------------------------------|\n | `this` | The link that originally opened the overlay |\n | `layer` | An `up.Layer` object for the closing overlay |\n | `value` | The overlay's [dismissal value](/learn/closing-overlays#dismissal-values) |\n | `response` | The server response that is causing the overlay to close |\n | `event` | An `up:layer:dismiss` event |\n\n To keep the overlay open, call `event.preventDefault()`.\n This has no effect when the overlay is closed because a background layer is being\n [updated](/learn/closing-overlays#peeling).\n\n To run code after the overlay closed, use `[up-on-dismissed]` instead.\n\n @param [up-on-dismissed]\n A JavaScript snippet that is called when the overlay was [dismissed](/learn/closing-overlays).\n\n The snippet runs in the following scope:\n\n | Expression | Value |\n |------------|------------------------------------------------|\n | `this` | The link that originally opened the overlay |\n | `layer` | An `up.Layer` object for the dismissed overlay |\n | `value` | The overlay's [dismissal value](/learn/closing-overlays#dismissal-values) |\n | `response` | The server response that caused the overlay to close |\n | `event` | An `up:layer:dismissed` event |\n\n To only reload an element, use `[up-on-dismissed-reload]` instead.\n\n @param [up-on-dismissed-reload]\n A selector to [reload](/api/up.reload) after the overlay was [dismissed](/learn/closing-overlays).\n\n The element is looked up in the layer that opened the overlay.\n An element near the link is preferred, and the selector may use `:origin` to refer to the link.\n\n Unlike `[up-on-dismissed]`, this attribute runs no JavaScript, so it needs no [CSP nonce](/learn/script-security#callback-nonces).\n When both attributes are set, the `[up-on-dismissed]` callback runs first.\n\n @experimental\n\n @mix up-follow/lifecycle-hooks\n\n @stable\n @signature\n */\n\n /*-\n [Dismisses](/learn/closing-overlays) the [current layer](/api/up.layer.current) when this element is clicked or submitted.\n\n The [relaxed JSON](/api/relaxed-json) value of the `[up-dismiss]` attribute becomes the overlay's\n [dismissal value](/learn/closing-overlays#dismissal-values).\n\n @learn-ref closing-overlays\n\n ## On a button\n\n To dismiss the [current layer](/api/up.layer.current) when a button is clicked, use an `[up-dismiss]` attribute:\n\n ```html\n <button up-dismiss>Close overlay</button>\n ```\n\n This button will dismiss the overlay with the value `{ id: 5 }`:\n\n ```html\n <button up-dismiss=\"{ id: 5 }\">Choose user #5</button>\n ```\n\n See [Closing when a button is clicked](/learn/closing-overlays#on-click).\n\n ## On a hyperlink\n\n When [reusing a page within an overlay](/learn/subinteractions#reusing-existing-screens),\n the same link may need to close the overlay, but navigate somewhere else when the page is shown on the root layer.\n\n In this case, use a hyperlink (`<a>`) with a fallback URL in its `[href]` attribute:\n\n ```html\n <a href=\"/list\" up-dismiss>Finish</a>\n ```\n\n Unpoly will only navigate to `/list` when this link is clicked in the [root layer](/api/up.layer).\n In an overlay, the `click` event is prevented and the overlay is dismissed.\n\n See [Closing when a link is followed](/learn/closing-overlays#on-follow).\n\n ## On a form\n\n To dismiss an overlay when a form is submitted, set an `[up-dismiss]` attribute on the `<form>` element.\n This will immediately dismiss the overlay upon submission, without making a network request:\n\n ```html\n <form up-dismiss> <!-- mark: up-dismiss -->\n ...\n </form>\n ```\n\n The form's field values will become the [dismissal value](/learn/closing-overlays#dismissal-values) of the closed overlay\n as an `up.Params` value.\n\n See [Closing when a form is submitted](/learn/closing-overlays#on-submit).\n\n @selector [up-dismiss]\n\n @section Dismissal\n @param [up-dismiss]\n On buttons or links, the overlay's [dismissal value](/learn/closing-overlays#dismissal-values)\n as a [relaxed JSON](/api/relaxed-json) string.\n\n @param [up-confirm]\n A message the user needs to confirm before the layer is closed.\n\n See [[confirmation-dialogs#overlays]].\n\n @section Animation\n @param [up-animation]\n @like [up-accept]\n @param [up-duration]\n @like [up-accept]\n @param [up-easing]\n @like [up-accept]\n @stable\n */\n\n /*-\n [Accepts](/learn/closing-overlays) the [current layer](/api/up.layer.current) when this element is clicked or submitted.\n\n @learn-ref closing-overlays\n\n ## On a button\n\n To accept the [current layer](/api/up.layer.current) when a button is clicked, use an `[up-accept]` attribute:\n\n ```html\n <button up-accept>Close overlay</button>\n ```\n\n This button will accept the overlay with the value `{ id: 5 }`:\n\n ```html\n <button up-accept=\"{ id: 5 }\">Choose user #5</button>\n ```\n\n See [Closing when a button is clicked](/learn/closing-overlays#on-click).\n\n ## On a hyperlink\n\n When [reusing a page within an overlay](/learn/subinteractions#reusing-existing-screens),\n the same link may need to close the overlay, but navigate somewhere else when the page is shown on the root layer.\n\n In this case, use a hyperlink (`<a>`) with a fallback URL in its `[href]` attribute:\n\n ```html\n <a href=\"/list\" up-accept>Finish</a>\n ```\n\n Unpoly will only navigate to `/list` when this link is clicked in the [root layer](/api/up.layer).\n In an overlay, the `click` event is prevented and the overlay is accepted.\n\n See [Closing when a link is followed](/learn/closing-overlays#on-follow).\n\n ## On a form\n\n To accept an overlay when a form is submitted, set an `[up-accept]` attribute on the `<form>` element.\n This will immediately accept the overlay upon submission, without making a network request:\n\n ```html\n <form up-accept> <!-- mark: up-accept -->\n ...\n </form>\n ```\n\n The form's field values will become the [acceptance value](/learn/closing-overlays#acceptance-values) of the closed overlay\n as an `up.Params` value.\n\n See [Closing when a form is submitted](/learn/closing-overlays#on-submit).\n\n @selector [up-accept]\n\n @section Acceptance\n @param [up-accept]\n On buttons and links, the overlay's [acceptance value](/learn/closing-overlays#acceptance-values)\n as a [relaxed JSON](/api/relaxed-json) string.\n\n If the attribute value is omitted, a value `null` will be used.\n @param [up-confirm]\n A message the user needs to confirm before the layer is closed.\n\n See [[confirmation-dialogs#overlays]].\n\n @section Animation\n @param [up-animation]\n @like [up-layer=new]/up-close-animation\n @param [up-duration]\n @like [up-layer=new]/up-close-duration\n @param [up-easing]\n @like [up-layer=new]/up-close-easing\n\n @stable\n */\n\n up.on('up:fragment:destroyed', function() {\n stack.sync()\n })\n\n up.on('up:framework:evaled', function() {\n // Due to circular dependencies we must delay initialization of the stack until all of\n // Unpoly's submodules have been evaled. We cannot delay initialization until up:framework:boot,\n // since by then user scripts have run and event listeners will no longer register as \"default\".\n stack = new up.LayerStack()\n })\n\n up.on('up:framework:reset', reset)\n\n const api = {\n config,\n mainTargets,\n open,\n build,\n ask,\n normalizeOptions,\n closestLayerElement,\n optionToString,\n get stack() { return stack.layers },\n isWithinForeignOverlay,\n }\n\n /*-\n Returns the current layer in the [layer stack](/api/up.layer.stack).\n\n The *current* layer is usually the [frontmost layer](/api/up.layer.front).\n However, there are some cases where the current layer is a layer in the background:\n\n - While an element in a background layer is being [compiled](/learn/enhancing-elements).\n - While an Unpoly event like `up:request:loaded` is being triggered from a background layer.\n - While an event listener bound to a background layer using `up.Layer#on()` is being called.\n\n To temporarily change the current layer from your own code, use `up.Layer#asCurrent()`.\n\n ### Remembering the current layer\n\n Most functions in the `up.layer` package affect the current layer. For example, `up.layer.dismiss()`\n is shorthand for `up.layer.current.dismiss()`.\n\n As described above, `up.layer.current` is set to the correct layer in compilers and most events,\n even if that layer is not the frontmost layer.\n\n If you have async code, the current layer can change when your callback is called.\n To address this, you can retrieve the current layer for later reference:\n\n ```js\n function dismissCurrentLayerIn(seconds) {\n let savedLayer = up.layer.current // returns an up.Layer object\n let dismiss = () => savedLayer.dismiss()\n setTimeout(dismiss, seconds * 1000)\n }\n\n dismissCurrentLayerIn(10) //\n ```\n\n @property up.layer.current\n @param {up.Layer} current\n @stable\n @signature\n */\n\n /*-\n Returns the number of layers in the [layer stack](/api/up.layer.stack).\n\n The count includes the [root layer](/api/up.layer.root).\n Hence a page with a single overlay would return a count of 2.\n\n @property up.layer.count\n @param {number} count\n The number of layers in the stack.\n @stable\n */\n\n /*-\n Returns an `up.Layer` object for the given element or [layer option](/learn/targeting-other-layers).\n\n ### Looking up the layer of an element\n\n Passing an element will return the layer containing that element:\n\n ```js\n let element = document.querySelector(...)\n up.layer.get(element) // returns the element's layer\n ```\n\n If the given element is detached or part of a closing overlay, `undefined` is returned.\n\n ### Getting the nth layer\n\n Pass a number to return the `up.Layer` object at that index:\n\n ```js\n up.layer.get(0) // returns the root layer\n up.layer.get(1) // returns the first overlay\n ```\n\n ### Resolving a layer option\n\n Pass any [layer option](/learn/targeting-other-layers) to return the `up.Layer` object\n of the first layer matching that option:\n\n ```js\n up.layer.get('front') // returns the front layer\n ```\n\n To look up one of multiple layer options, separate the values using a comma:\n\n ```js\n // returns the parent layer, or the root if we're already on root:\n up.layer.get('parent, root')\n ```\n\n ### Existing `up.Layer` objects are returned\n\n Passing an existing `up.Layer` object will return it unchanged:\n\n ```js\n let layer = up.layer.root\n up.layer.get(layer) // returns the given layer\n ```\n\n ### Missing values return the current layer\n\n Passing `null` or `undefined` will return the [current layer](/api/up.layer.current):\n\n ```js\n up.layer.get(undefined) // returns the current layer\n ```\n\n @function up.layer.get\n @param {string|up.Layer|number} [value='current']\n The [layer option](/learn/targeting-other-layers) to look up.\n @return {up.Layer|undefined}\n The layer matching the given option.\n\n If no layer matches, `undefined` is returned.\n @stable\n */\n\n /*-\n Returns an array of `up.Layer` objects matching the given [layer option](/learn/targeting-other-layers).\n\n @function up.layer.getAll\n @param {string|up.Layer|number} [layer='current']\n The [layer option](/learn/targeting-other-layers) to look up.\n @return {Array<up.Layer>}\n An array of matching layers.\n @experimental\n */\n\n /*-\n Returns the [root layer](/learn/overlays#layer-modes).\n\n The root layer represents the initial page before any overlay was [opened](/learn/opening-overlays).\n The root layer always exists and cannot be closed.\n\n @property up.layer.root\n @param {up.Layer} root\n @stable\n */\n\n /*-\n Returns an array of all [overlays](/learn/overlays#layer-modes).\n\n If no overlay is open, an empty array is returned.\n\n To get an array of *all* layers including the [root layer](/api/up.layer.root),\n use `up.layer.stack`.\n\n @property up.layer.overlays\n @param {Array<up.Layer>} overlays\n @stable\n */\n\n /*-\n Returns the frontmost layer in the [layer stack](/api/up.layer.stack).\n\n The frontmost layer is the layer directly facing the user. If an overlay is\n stacked on top of the frontmost layer, that overlay becomes the new frontmost layer.\n\n In most cases, you don't want to refer to the frontmost layer\n but to the [current layer](/api/up.layer.current) instead.\n\n @property up.layer.front\n @param {up.Layer} front\n @stable\n */\n\n /*-\n [Dismisses](/api/up.layer.dismiss) all overlays.\n\n Afterwards the only remaining layer will be the [root layer](/api/up.layer.root).\n\n @learn-ref closing-overlays\n\n @function up.layer.dismissOverlays\n @param {any} [value]\n The dismissal value.\n @param {Object} [options]\n See options for `up.layer.dismiss()`.\n @stable\n */\n u.delegate(api, [\n 'get',\n 'getAll',\n 'root',\n 'overlays',\n 'current',\n 'front',\n 'sync',\n 'count',\n 'attachedCount',\n 'dismissOverlays'\n ], () => stack)\n\n /*-\n [Accepts](/learn/closing-overlays) the [current layer](/api/up.layer.current).\n\n This is a shortcut for `up.layer.current.accept()`.\n See `up.Layer#accept()` for more documentation.\n\n @learn-ref closing-overlays\n\n @function up.layer.accept\n @mix up.Layer#accept\n @stable\n */\n\n /*-\n This event is emitted *before* a layer is [accepted](/learn/closing-overlays).\n\n The event is emitted on the [element of the layer](/api/up.layer.element) that is about to close.\n\n @learn-ref closing-overlays\n\n @event up:layer:accept\n @param {up.Layer} event.layer\n The layer that is about to close.\n @param {any} [event.value]\n The overlay's [acceptance value](/learn/closing-overlays#acceptance-values).\n\n Listeners can replace or mutate this value.\n @param {Element} [event.origin]\n The element that is causing the layer to close.\n\n Will be `undefined` if the overlay is not closing due to a user interacting with an element.\n @param {up.Response} [event.response]\n The server response that is causing this overlay to close.\n\n Will be `undefined` if the overlay is not closing in reaction to a server response.\n\n See [Using the discarded response](/learn/closing-overlays#using-the-discarded-response).\n @param event.preventDefault()\n Prevents the overlay from closing.\n\n This has no effect when the overlay is closed because a background layer is being\n [updated](/learn/closing-overlays#peeling). In that case `event.value` is `':peel'`.\n\n To prevent closing for a single overlay, pass an [`{ onAccept }`](/api/up.layer.open#options.onAccept) option\n or set an [`[up-on-accept]`](/api/up-layer-new#up-on-accept) attribute when opening it.\n @stable\n */\n\n /*-\n This event is emitted *after* a layer was [accepted](/learn/closing-overlays).\n\n The event is emitted on the [layer element](/api/up.layer.element) when the close animation\n is starting. If the layer has no close animation and was already removed from the DOM,\n the event is emitted a second time on the `document`.\n\n > [tip]\n > To prevent a layer from being closed, listen to `up:layer:accept` instead.\n\n @learn-ref closing-overlays\n\n @event up:layer:accepted\n @param {up.Layer} event.layer\n The layer that was closed.\n @param {any} [event.value]\n The overlay's final [acceptance value](/learn/closing-overlays#acceptance-values).\n @param {Element} [event.origin]\n The element that caused the layer to close.\n\n Will be `undefined` if the overlay was not closed by a user interacting with an element.\n @param {up.Response} [event.response]\n The server response that caused this overlay to close.\n\n Will be `undefined` if the overlay was not closed in reaction to a server response.\n\n See [Using the discarded response](/learn/closing-overlays#using-the-discarded-response).\n @stable\n */\n\n /*-\n [Dismisses](/learn/closing-overlays) the [current layer](/api/up.layer.current).\n\n This is a shortcut for `up.layer.current.dismiss()`.\n See `up.Layer#dismiss()` for more documentation.\n\n @learn-ref closing-overlays\n\n @function up.layer.dismiss\n @param {any} [value]\n @like up.Layer#dismiss\n @param {Object} [options]\n See [options for `up.Layer#dismiss()`](/api/up.Layer.prototype.dismiss#parameters).\n @stable\n */\n\n /*-\n This event is emitted *before* a layer is [dismissed](/learn/closing-overlays).\n\n The event is emitted on the [element of the layer](/api/up.layer.element) that is about to close.\n\n @learn-ref closing-overlays\n\n @event up:layer:dismiss\n @param {up.Layer} event.layer\n The layer that is about to close.\n @param {any} [event.value]\n The overlay's [dismissal value](/learn/closing-overlays#dismissal-values).\n\n Listeners can replace or mutate this value.\n @param {Element} [event.origin]\n The element that is causing the layer to close.\n\n Will be `undefined` if the overlay is not closing due to a user interacting with an element.\n @param {up.Response} [event.response]\n The server response that is causing this overlay to close.\n\n Will be `undefined` if the overlay is not closing in reaction to a server response.\n\n See [Using the discarded response](/learn/closing-overlays#using-the-discarded-response).\n @param event.preventDefault()\n Event listeners can call this method to prevent the overlay from closing.\n\n This has no effect when the overlay is closed because a background layer is being\n [updated](/learn/closing-overlays#peeling). In that case `event.value` is `':peel'`.\n\n To prevent closing for a single overlay, pass an [`{ onDismiss }`](/api/up.layer.open#options.onDismiss) option\n or set an [`[up-on-dismiss]`](/api/up-layer-new#up-on-dismiss) attribute when opening it.\n @stable\n */\n\n /*-\n This event is emitted *after* a layer was [dismissed](/learn/closing-overlays).\n\n The event is emitted on the [layer element](/api/up.layer.element) when the close animation\n is starting. If the layer has no close animation and was already removed from the DOM,\n the event is emitted a second time on the `document`.\n\n > [tip]\n > To prevent a layer from being closed, listen to `up:layer:dismiss` instead.\n\n @learn-ref closing-overlays\n\n @event up:layer:dismissed\n @param {up.Layer} event.layer\n The layer that was closed.\n @param {any} [event.value]\n The overlay's final [dismissal value](/learn/closing-overlays#dismissal-values).\n @param {Element} [event.origin]\n The element that caused the layer to close.\n\n Will be `undefined` if the overlay was not closed by a user interacting with an element.\n @param {up.Response} [event.response]\n The server response that caused this overlay to close.\n\n Will be `undefined` if the overlay was not closed in reaction to a server response.\n\n See [Using the discarded response](/learn/closing-overlays#using-the-discarded-response).\n @stable\n */\n\n /*-\n Returns whether the [current layer](/api/up.layer.current) is the [root layer](/api/up.layer.root).\n\n This is a shortcut for `up.layer.current.isRoot()`.\n See `up.Layer#isRoot()` for more documentation.\n\n @function up.layer.isRoot\n @return\n @like up.Layer#isRoot\n @stable\n */\n\n /*-\n Returns whether the [current layer](/api/up.layer.current) is *not* the [root layer](/api/up.layer.root).\n\n This is a shortcut for `up.layer.current.isOverlay()`.\n See `up.Layer#isOverlay()` for more documentation.\n\n @function up.layer.isOverlay\n @return\n @like up.Layer#isOverlay\n @stable\n */\n\n /*-\n Returns whether the [current layer](/api/up.layer.current) is the [frontmost layer](/api/up.layer.front).\n\n This is a shortcut for `up.layer.current.isFront()`.\n See `up.Layer#isFront()` for more documentation.\n\n @function up.layer.isFront\n @return\n @like up.Layer#isFront\n @stable\n */\n\n /*-\n Listens to a [DOM event](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Events)\n that originated on an element [contained](/api/up.Layer.prototype.contains) by the [current layer](/api/up.layer.current).\n\n This is a shortcut for `up.layer.current.on()`.\n See `up.Layer#on()` for more documentation.\n\n @function up.layer.on\n @include up.on/after-element\n @stable\n @signature\n */\n\n /*-\n Unbinds an event listener previously bound to the [current layer](/api/up.layer.current).\n\n This is a shortcut for `up.layer.current.off()`.\n See `up.Layer#off()` for more documentation.\n\n @function up.layer.off\n @include up.off/after-element\n @stable\n */\n\n /*-\n [Emits](/api/up.emit) an event on the [current layer](/api/up.layer.current)'s [element](/api/up.layer.element).\n\n This is a shortcut for `up.layer.current.emit()`.\n See `up.Layer#emit()` for more documentation.\n\n @function up.layer.emit\n @param eventType\n @like up.Layer#emit\n @param props\n @like up.Layer#emit\n @param props.log\n @like up.Layer#emit\n @return\n @like up.Layer#emit\n @stable\n */\n\n /*-\n Returns the parent layer of the [current layer](/api/up.layer.current).\n\n This is a shortcut for `up.layer.current.parent`.\n See `up.Layer#parent` for more documentation.\n\n @property up.layer.parent\n @param parent\n @like up.Layer#parent\n @stable\n */\n\n /*-\n Whether the [current layer](/api/up.layer.current) has [visible history](/learn/history-in-overlays).\n\n When it does, fragment updates within the layer can change the browser's address bar and window title.\n\n This is a shortcut for `up.layer.current.history`.\n See `up.Layer#history` for more documentation.\n\n @learn-ref history-in-overlays\n\n @property up.layer.history\n @param history\n @like up.Layer#history\n @stable\n */\n\n /*-\n The location URL of the [current layer](/api/up.layer.current).\n\n This is a shortcut for `up.layer.current.location`.\n See `up.Layer#location` for more documentation.\n\n @learn-ref history-in-overlays\n\n @property up.layer.location\n @param location\n @like up.Layer#location\n @stable\n */\n\n /*-\n The [current layer](/api/up.layer.current)'s [mode](/api/up.layer.mode),\n which governs its [appearance and behavior](/learn/customizing-overlays).\n\n This is a shortcut for `up.layer.current.mode`.\n See `up.Layer#mode` for more documentation.\n\n @learn-ref customizing-overlays\n\n @property up.layer.mode\n @param mode\n @like up.Layer#mode\n @stable\n */\n\n /*-\n The [context](/learn/layer-context) of the [current layer](/api/up.layer.current).\n\n This is a shortcut for `up.layer.current.context`.\n See `up.Layer#context` for more documentation.\n\n Aliased as `up.context`.\n\n @learn-ref layer-context\n\n @property up.layer.context\n @param context\n @like up.Layer#context\n @experimental\n */\n\n /*-\n The outmost element of the [current layer](/api/up.layer.current).\n\n This is a shortcut for `up.layer.current.element`.\n See `up.Layer#element` for more documentation.\n\n @property up.layer.element\n @param element\n @like up.Layer#element\n @stable\n */\n\n /*-\n Returns whether the given `element` is contained by the [current layer](/api/up.layer.current).\n\n This is a shortcut for `up.layer.current.contains(element)`.\n See `up.Layer#contains` for more documentation.\n\n @function up.layer.contains\n @param element\n @like up.Layer#contains\n @return\n @like up.Layer#contains\n @stable\n */\n\n\n /*-\n The [size](/learn/customizing-overlays#overlay-sizes) of the [current layer](/api/up.layer.current).\n\n This is a shortcut for `up.layer.current.size`.\n See `up.Layer#size` for more documentation.\n\n @property up.layer.size\n @param size\n @like up.Layer#size\n @stable\n */\n\n /*-\n Creates an element with the given `selector` and appends it to the [current layer's](/api/up.layer.current) content.\n\n This is a shortcut for `up.layer.current.affix(selector)`.\n See `up.Layer#affix` for more documentation.\n\n @function up.layer.affix\n @include up.element.createFromSelector/all\n @experimental\n */\n\n u.delegate(api, [\n 'accept',\n 'dismiss',\n 'isRoot',\n 'isOverlay',\n 'isFront',\n 'on',\n 'off',\n 'emit',\n 'parent',\n 'history',\n 'location',\n 'mode',\n 'context',\n 'element',\n 'contains',\n 'size',\n 'affix'\n ], () => stack.current)\n\n return api\n})()\n","require('./link.sass')\n\n/*-\nFeatures to follow links without a full page load.\n\nSet an `[up-follow]` attribute to let Unpoly handle a link, and an [`[up-target]`](/api/up-follow#up-target) attribute to choose the fragment it updates. The same behavior is available from JavaScript through `up.follow()`, and `up:link:follow` lets your code observe or prevent any link Unpoly follows.\n\nLinks feel faster with `[up-instant]`, which follows on `mousedown` instead of `click`, and `[up-preload]`, which fetches the response before the user clicks. An `[up-defer]` placeholder loads its content from another URL after the page has rendered, or when it is scrolled into view.\n\n@learn-ref links\n\n@module up.link\n*/\n\nup.link = (function() {\n\n const u = up.util\n const e = up.element\n\n let lastTouchstartTarget = null\n let lastMousedownTarget = null\n let lastInstantTarget = null\n\n const ATTRS_WITH_LOCAL_HTML = '[up-content], [up-fragment], [up-document]'\n const ATTRS_SUGGESTING_FOLLOW = `${ATTRS_WITH_LOCAL_HTML}, [up-target], [up-layer], [up-transition], [up-preload]`\n const DEFAULT_INTERACTIVE_ELEMENT = 'a[href], button'\n\n /*-\n Configures defaults for link handling.\n\n In particular, you can configure Unpoly to handle [all links on the page](/learn/handling-all-links)\n without requiring developers to set `[up-...]` attributes.\n\n @property up.link.config\n\n @section Followable links\n\n @param {Array<string>} config.followSelectors\n An array of CSS selectors matching links that will be [followed through Unpoly](/api/up-follow).\n\n You can customize this property to automatically follow *all* links on a page without requiring an `[up-follow]` attribute.\n See [Handling all links](/learn/handling-all-links).\n\n @param {Array<string>} config.noFollowSelectors\n Exceptions to `up.link.config.followSelectors`.\n\n Matching links will *not* be [followed through Unpoly](/api/up-follow), even if they match `up.link.config.followSelectors`.\n\n By default Unpoly excludes:\n\n @include no-follow-reasons\n\n @section Instant click\n\n @param {Array<string>} config.instantSelectors\n An array of CSS selectors matching elements that are [activated on `mousedown`](/api/up-instant)\n instead of on `click`.\n\n You can customize this property to follow *all* links on `mousedown` without requiring an `[up-instant]` attribute.\n See [Handling all links](/learn/handling-all-links).\n\n Note that an instant link must also be [followable](/api/up.link.isFollowable), usually by giving it an\n [`[up-follow]`](/api/up-follow) attribute or by configuring `up.link.config.followSelectors`.\n\n @param {Array<string>} config.noInstantSelectors\n Exceptions to `up.link.config.instantSelectors`.\n\n Matching links will *not* be [followed on `mousedown`](/api/up-instant), even if they match `up.link.config.instantSelectors`.\n\n By default Unpoly excludes:\n\n - Elements with an `[up-instant=false]` attribute.\n - Links that are [not followable](#config.noFollowSelectors).\n\n @section Preloading\n\n @param {Array<string>} config.preloadSelectors\n An array of CSS selectors matching links that are [preloaded on hover](/learn/preloading#on-hover).\n\n You can customize this property to preload *all* links on hover without requiring an `[up-preload]` attribute.\n See [Handling all links](/learn/handling-all-links).\n\n @param {Array<string>} config.noPreloadSelectors\n Exceptions to `up.link.config.preloadSelectors`.\n\n Matching links will *not* be [preloaded on hover](/learn/preloading#on-hover), even if they match `up.link.config.preloadSelectors`.\n\n By default Unpoly excludes:\n\n - Links with an `[up-preload=false]` attribute.\n - Links that are [not followable](#config.noFollowSelectors).\n - Links with an [unsafe method](/api/up.link.isSafe).\n - When the link destination [cannot be cached](/api/up.network.config#config.autoCache).\n\n @param {number} [config.preloadDelay=90]\n The number of milliseconds to wait before [preloading on hover](/learn/preloading#on-hover).\n\n @section Interactive elements\n\n @param {Array<string>} [config.clickableSelectors]\n A list of CSS selectors matching elements that should behave like links or buttons.\n\n See [[faux-interactive-elements]].\n\n @experimental\n\n @param {Array<string>} [config.noClickableSelectors]\n Exceptions to `up.link.config.clickableSelectors`.\n\n Matching elements will *not* receive [interactive behavior](/api/up-follow),\n even if they match `up.link.config.clickableSelectors`.\n\n @experimental\n\n @stable\n */\n const config = new up.Config('up.link.config', () => ({\n // (1) We want to follow all elements with an [up-follow] attribute.\n // This can be an <a up-follow href=\"/path\"> or an <span up-follow up-href=\"/path\">\n // (2) Users expect a link to be followable if it uses a signature attribute\n // like [up-target] or [up-transition], even without an [up-href] attribute.\n // (3) We sometimes allow <a> links without an [href], e.g. <a up-target=\".foo\" up-content=\"html\">.\n followSelectors: ['[up-follow]', `a:is(${ATTRS_SUGGESTING_FOLLOW})`],\n\n // (1) We don't want to follow <a href=\"#anchor\"> links without a path. Instead\n // we will let the browser change the current location's anchor and up.reveal()\n // on hashchange to scroll past obstructions.\n // (2) We want to follow links with [href=#] only if they have a local source of HTML\n // through [up-content], [up-fragment] or [up-document].\n // Many web developers are used to give JavaScript-handled links an [href=\"#\"]\n // attribute. Also frameworks like Bootstrap only style links if they have an [href].\n // (3) We don't want to handle <a href=\"javascript:foo()\"> links.\n noFollowSelectors: ['[up-follow=false]', 'a[download]', 'a[target]', 'a[href^=\"javascript:\"]', 'a[href^=\"mailto:\"]', 'a[href^=\"tel:\"]', `a[href^=\"#\"]:not(${ATTRS_WITH_LOCAL_HTML})`, e.crossOriginSelector('href'), e.crossOriginSelector('up-href')],\n\n instantSelectors: ['[up-instant]'],\n noInstantSelectors: ['[up-instant=false]', '[onclick]'],\n\n preloadSelectors: ['[up-preload]'],\n noPreloadSelectors: ['[up-preload=false]'],\n\n // (1) Users can explicitly add A11Y behavior to non-interactive elements with [up-clickable]\n // (2) We have some elements like [up-emit] or [up-accept] which may or may not be interactive elements\n // (3) When a link is followable, is should also be clickable. Even a <span up-follow> or a <a up-content>.\n // (4) Prevent unnecessary compilation of elements that are already interactive (a[href], button).\n clickableSelectors: ['[up-clickable]', '[up-follow]', '[up-emit]', '[up-accept]', '[up-dismiss]', `a:is(${ATTRS_SUGGESTING_FOLLOW})`],\n noClickableSelectors: ['[up-clickable=false]', DEFAULT_INTERACTIVE_ELEMENT],\n\n preloadDelay: 90,\n }))\n\n function isPreloadDisabled(link) {\n // (1) Don't preload when we cannot change the browser URL. Following such a link will make a full page load ignoring our cache.\n // When up.history.config.enabled excludes 'location', we never change the browser URL, so we can preload.\n // (2) Don't preload when the link isn't going to be handled by Unpoly.\n // (3) Don't preload when we're not going to cache the content according to up.network.config.autoCache.\n // By default this only caches safe links.\n return (!up.browser.canPushState() && up.history.isEnabled('location')) || !isFollowable(link) || !willCache(link)\n }\n\n function willCache(link) {\n // Instantiate a lightweight request with basic link attributes needed for the cache-check.\n const options = parseRequestOptions(link)\n if (options.url) {\n if (options.cache == null) { options.cache = 'auto' }\n options.basic = true\n const request = new up.Request(options)\n return request.willCache()\n }\n }\n\n function reset() {\n lastTouchstartTarget = null\n lastMousedownTarget = null\n lastInstantTarget = null\n }\n\n /*-\n Follows the given link with JavaScript and updates a fragment with the server response.\n\n By default, the layer's [main fragment](/api/up-main)\n will be replaced. Attributes like [`[up-target]`](/api/up-follow#up-target)\n or [`[up-layer]`](/api/up-follow#up-layer) will be honored.\n\n Following a link is considered [navigation](/learn/navigation-defaults) by default.\n\n Emits the event `up:link:follow`.\n\n @learn-ref following-links\n\n ## Examples\n\n Assume we have a link with an [`[up-target]`](/api/up-follow#up-target) attribute:\n\n ```html\n <a href=\"/users\" up-target=\".main\">Users</a>\n ```\n\n Calling `up.follow()` with this link will replace the page's `.main` fragment\n as if the user had clicked on the link:\n\n ```js\n let link = document.querySelector('a')\n up.follow(link)\n ```\n\n @function up.follow\n\n @section General\n @param {Element|jQuery|string} link\n The link to follow.\n\n @param {Object} [options]\n [Render options](/api/up.render#parameters) that should be used for following the link.\n\n Unpoly will parse render options from the given link's attributes.\n E.g. the `[up-target]` attribute will be parsed into a `{ target }` option.\n See `[up-follow]` for a list of supported attributes.\n\n You may pass this additional `options` object to\n [supplement or override](/learn/attributes-and-options#options)\n options parsed from the link attributes.\n\n @section Targeting\n @mix up.render/targeting\n\n @section Navigation\n @mix up.render/navigation\n @param [options.navigate=true]\n\n @section Request\n @mix up.render/request\n\n @section Local content\n @mix up.render/local-content\n\n @section Layer\n @mix up.render/layer\n\n @section History\n @mix up.render/history\n\n @section Animation\n @mix up.render/motion\n\n @section Caching\n @mix up.render/caching\n\n @section Scrolling\n @mix up.render/scrolling\n\n @section Focus\n @mix up.render/focus\n\n @section Loading state\n @mix up.render/loading-state\n\n @section Client state\n @mix up.render/client-state\n\n @section Lifecycle hooks\n @mix up.render/lifecycle-hooks\n\n @return\n @like up.render\n\n @stable\n @signature\n */\n const follow = up.mockable(function(link, options, parserOptions) {\n return up.render(followOptions(link, options, parserOptions))\n })\n\n function parseRequestOptions(link, options, parserOptions) {\n options = u.options(options)\n const parser = new up.OptionsParser(link, options, { ...parserOptions, fail: false })\n\n options.url = followURL(link, options)\n options.method = followMethod(link, options)\n parser.json('headers')\n parser.json('params')\n parser.booleanOrString('cache')\n parser.booleanOrString('expireCache')\n parser.booleanOrString('evictCache')\n parser.booleanOrString('revalidate')\n parser.booleanOrString('abort')\n parser.boolean('abortable')\n parser.boolean('background')\n parser.string('contentType')\n parser.booleanOrNumber('lateDelay')\n parser.number('timeout')\n parser.booleanOrString('fail')\n\n return options\n }\n\n /*-\n Parses the [render](/api/up.render) options that would be used to\n [follow](/api/up.follow) the given link, but does not render.\n\n ## Example\n\n Given a link with some `[up-...]` attributes:\n\n ```html\n <a href=\"/foo\" up-target=\".content\" up-layer=\"new\">...</a>\n ```\n\n We can parse the link's render options like this:\n\n ```js\n let link = document.querySelector('a[href=\"/foo\"]')\n let options = up.link.followOptions(link)\n // result: { url: '/foo', method: 'GET', target: '.content', layer: 'new', ... }\n ```\n\n @function up.link.followOptions\n @param {Element|jQuery|string} link\n The link from which to parse options.\n @param {Object} [options]\n Additional options for following the link.\n\n Values from this object will override any attributes set on the link element.\n @internal\n @return {Object}\n An object of [render options](/api/up.render#parameters).\n @stable\n */\n function followOptions(link, options, parserOptions) {\n // If passed a selector, up.fragment.get() will prefer a match on the current layer.\n link = effectiveLink(up.fragment.get(link))\n options = u.options(options)\n\n const parser = new up.OptionsParser(link, options, { fail: true, ...parserOptions })\n\n parser.include(parseRequestOptions)\n\n // Fragment options\n options.origin ||= link\n parser.boolean('navigate', { default: true })\n parser.string('confirm', { attr: ['up-confirm', 'data-confirm'] })\n parser.string('target')\n parser.booleanOrString('fallback')\n parser.string('match')\n parser.string('document')\n parser.string('fragment')\n parser.string('content')\n parser.boolean('keep', { attr: 'up-use-keep' }) // cannot be [up-keep] because it would affect the link itself\n parser.boolean('hungry', { attr: 'up-use-hungry' }) // cannot be [up-hungry] because it would affect the link itself\n parser.json('data', { attr: 'up-use-data' }) // cannot be [up-data] because it would affect the link itself\n parser.json('dataMap', { attr: 'up-use-data-map' }) // could be [up-data-map], but be consistent with [up-use-data]\n\n // Lifecycle options\n parser.renderCallback('onLoaded')\n parser.renderCallback('onRendered')\n parser.renderCallback('onFinished')\n parser.renderCallback('onOffline') // not a request option!\n parser.renderCallback('onError') // not a request option!\n\n // Layer options\n parser.booleanOrString('peel')\n parser.string('layer')\n parser.string('baseLayer')\n parser.json('context')\n parser.string('mode')\n parser.string('align')\n parser.string('position')\n parser.string('class')\n parser.string('size')\n parser.booleanOrString('dismissible')\n parser.renderCallback('onOpened')\n parser.renderCallback('onAccept')\n parser.renderCallback('onAccepted')\n parser.renderCallback('onDismiss')\n parser.renderCallback('onDismissed')\n parser.string('onAcceptedReload')\n parser.string('onDismissedReload')\n parser.string('acceptEvent')\n parser.string('dismissEvent')\n parser.string('acceptFragment')\n parser.string('dismissFragment')\n parser.string('acceptLocation')\n parser.string('dismissLocation')\n parser.booleanOrString('closeAnimation')\n parser.string('closeEasing')\n parser.number('closeDuration')\n\n // Status effects\n parser.include(up.status.statusOptions)\n\n // Viewport options\n parser.booleanOrString('focus')\n parser.booleanOrString('focusVisible')\n parser.boolean('saveScroll')\n parser.boolean('saveFocus')\n parser.booleanOrNumberOrString('scroll')\n parser.json('scrollMap')\n parser.boolean('revealTop')\n parser.number('revealMax')\n parser.number('revealPadding')\n parser.number('revealSnap')\n parser.string('scrollBehavior')\n\n // History options\n // { history } is actually a boolean, but we keep the deprecated string\n // variant which should now be passed as { location }.\n parser.booleanOrString('history')\n parser.booleanOrString('location')\n parser.booleanOrString('title')\n parser.boolean('metaTags')\n parser.booleanOrString('lang')\n\n // Motion options\n parser.include(up.motion.motionOptions)\n\n // This is the event that may be prevented to stop the follow.\n // up.form.submit() changes this to be up:form:submit instead.\n // The guardEvent will also be assigned a { renderOptions } property in up.render()\n options.guardEvent ??= up.event.build('up:link:follow', { log: ['Following link %o', link] })\n\n return options\n }\n\n /*-\n This event is [emitted](/api/up.emit) when a link is [followed](/api/up.follow) through Unpoly.\n\n The event is emitted on the `<a>` element that is being followed.\n\n @learn-ref following-links\n\n ## Changing render options\n\n Listeners may inspect and manipulate [render options](/api/up.render#parameters) for the coming fragment update.\n\n The code below will open all form-contained links in an overlay so as not to\n lose the user's form data:\n\n ```js\n up.on('up:link:follow', function(event, link) {\n if (link.closest('form')) {\n event.renderOptions.layer = 'new modal'\n }\n })\n ```\n\n When changing render options for a [preloaded link](/learn/preloading), consider making the\n same change for `up:link:preload` so the [preload request](/learn/preloading#preload-request-behavior) sends the same [HTTP headers](/api/up.protocol).\n\n In the example above, we want to ensure an `X-Up-Mode: modal` header is sent, so we modify\n both events:\n\n ```js\n up.on('up:link:follow up:link:preload', function(event, link) {\n if (link.closest('form')) {\n event.renderOptions.layer = 'new modal'\n }\n })\n ```\n\n @event up:link:follow\n @param {Element} event.target\n The link element that will be followed.\n @param {Object} event.renderOptions\n An object with [render options](/api/up.render#parameters) for the coming fragment update.\n\n Listeners may inspect and modify these options. It is recommended that\n render options for `up:link:preload` be changed in the same way.\n @param event.preventDefault()\n Prevents the link from being followed.\n @stable\n */\n\n /*-\n [Preloads](/learn/preloading) a `GET` link.\n\n When the link is clicked later, the response will already be [cached](/learn/caching),\n making the interaction feel instant.\n\n You may use this function to [programmatically populate the cache](/learn/preloading#scripted)\n with pages the user is likely to click or that should be\n [accessible while offline](/learn/network-issues#offline-cache).\n\n @learn-ref preloading\n\n @function up.link.preload\n\n @section General\n @param {string|Element|jQuery} link\n The element or selector whose destination should be preloaded.\n\n @param {Object} [options]\n [Render options](/api/up.render#parameters) to apply when preloading this link.\n\n Most [options for `up.follow()`](/api/up.follow#parameters) can be used,\n but no elements will be changed while preloading.\n\n @section Request\n @param {string} [options.url]\n The URL to preload.\n\n Defaults to the link's `[href]` attribute.\n\n @param {Object} [options.headers]\n @like up.follow\n\n @param {boolean} [options.abortable=false]\n @like up.follow\n\n @param {boolean} [options.background=true]\n @like up.follow\n\n @return {Promise}\n A promise that will be fulfilled when the request was loaded and cached.\n\n When [caching is disabled](/learn/caching#disabling-globally), no request is made and the promise fulfills right away.\n\n When the link cannot be preloaded, the promise rejects with an error.\n @stable\n */\n function preload(link, options) {\n // If passed a selector, up.fragment.get() will match in the current layer.\n link = effectiveLink(up.fragment.get(link))\n\n let issue = preloadIssue(link)\n if (issue) {\n return Promise.reject(new up.Error(issue))\n }\n\n // Preloading only serves to fill the cache\n if (!up.network.config.cacheEnabled) return Promise.resolve()\n\n const guardEvent = up.event.build('up:link:preload', { log: ['Preloading link %o', link] })\n\n return follow(link, {\n // These are forced, so [up-background] or [up-abortable] attributes on the link have no effect.\n // This is intentional: a preload only fills the cache. It should never show the progress bar,\n // and must survive other render passes to be useful.\n abort: false,\n abortable: false,\n background: true,\n cache: true,\n ...options,\n ...up.RenderOptions.NO_INPUT_INTERFERENCE,\n ...up.RenderOptions.NO_PREVIEWS,\n guardEvent,\n preload: true, // hint to up.Change.FromURL to stop execution after sending the request\n })\n }\n\n // A click on an [up-expand] area follows its link.\n // Returns that link for an area, and the given element otherwise.\n function effectiveLink(element) {\n let link = element.upExpandedPair?.[1]\n return element.contains(link) ? link : element\n }\n\n function preloadIssue(link) {\n if (!isSafe(link)) {\n return 'Will not preload an unsafe link'\n }\n }\n\n /*-\n This event is [emitted](/api/up.emit) before a link is [preloaded](/learn/preloading).\n\n Listeners may prevent this event to stop the link from being preloaded\n or [change render options](/api/up:link:follow#changing-render-options) for the preload request.\n\n @learn-ref preloading\n\n ## Example\n\n The following would disable preloading on slow 2G connections:\n\n ```js\n function isSlowConnection() {\n // https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation\n return navigator.connection && navigator.connection.effectiveType.includes('2g')\n }\n\n up.on('up:link:preload', function(event) {\n if (isSlowConnection()) {\n event.preventDefault()\n }\n })\n ```\n\n @event up:link:preload\n @param {Element} event.target\n The link element that will be preloaded.\n @param {Object} event.renderOptions\n An object with [render options](/api/up.render#parameters) for the preloading.\n\n Listeners may inspect or [modify](/api/up:link:follow#changing-render-options) these options.\n @param event.preventDefault()\n Prevents the link from being preloaded.\n @stable\n */\n\n /*-\n Returns the HTTP method that Unpoly will use when [following](/api/up-follow) the given link.\n\n Looks at the link's `[up-method]` or `[data-method]` attributes. Defaults to `\"get\"`.\n\n @function up.link.followMethod\n @param {Element} link\n The link from which to evaluate the method.\n @param {string} options.method\n A value to override the value parsed from the attribute.\n @return {string}\n The HTTP method.\n @internal\n */\n function followMethod(link, options = {}) {\n return u.normalizeMethod(options.method || link.getAttribute('up-method') || link.getAttribute('data-method'))\n }\n\n function followURL(link, options = {}) {\n const url = options.url || link.getAttribute('up-href') || link.getAttribute('href')\n\n // Developers sometimes make a <a href=\"#\"> to give a JavaScript interaction standard\n // link behavior (like keyboard navigation or default styles). However, we don't want to\n // consider this a link with remote content, and rather honor [up-content], [up-document]\n // and [up-fragment] attributes.\n if (url !== '#') {\n return url\n }\n }\n\n /*-\n Returns whether the given link will be [followed](/api/up.follow) by Unpoly\n instead of making a full page load.\n\n By default Unpoly will follow links if the element has\n one of the following attributes:\n\n - `[up-follow]`\n - `[up-target]`\n - `[up-layer]`\n - `[up-transition]`\n - `[up-preload]`\n - `[up-content]`\n - `[up-fragment]`\n - `[up-document]`\n\n To make additional elements followable, see `up.link.config.followSelectors`.\n\n @function up.link.isFollowable\n @param {Element|jQuery|string} link\n The link to test.\n @return {boolean}\n Whether Unpoly will handle the given link.\n @stable\n */\n function isFollowable(link) {\n link = up.fragment.get(link)\n return config.matches(link, 'followSelectors')\n }\n\n /*-\n Makes sure that the given link will be [followed](/api/up.follow)\n by Unpoly instead of making a full page load.\n\n If the link is not already [followable](/api/up.link.isFollowable), the link\n will receive an `[up-follow]` attribute.\n\n @function up.link.makeFollowable\n @param {Element|jQuery|string} link\n The element or selector for the link to make followable.\n @experimental\n */\n function makeFollowable(link) {\n if (!isFollowable(link)) {\n link.setAttribute('up-follow', '')\n }\n }\n\n function makeClickable(element) {\n // We default to a button role, except if the element looks link-ish\n let role = element.matches('a, [up-follow]') ? 'link' : 'button'\n\n // We set some defaults for interactivity and A11y, but preserve any existing attributes set by the user.\n e.setMissingAttrs(element, {\n tabindex: '0', // Make them part of the natural tab order\n role, // Make screen readers pronounce \"button\" or \"link\"\n 'up-clickable': '' // Get pointer cursor from link.css\n })\n\n element.addEventListener('keydown', function(event) {\n // (1) Buttons are expected to be triggered using the Space or Enter key\n // (2) Links are expected to be triggered using the Enter key\n // (3) We use the element's current role (instead of the `role` variable above)\n // to honor any custom [role] attribute set by the user.\n if ((event.key === 'Enter') || (element.role === 'button' && event.key === ' ')) {\n return forkEventAsUpClick(event)\n }\n })\n }\n\n /*-\n Enables [keyboard interaction and other accessibility behaviors](/learn/faux-interactive-elements#accessibility)\n for non-interactive elements that represent clickable buttons.\n\n It's up to you to make the element appear interactive visually, e.g., by assigning a `.button` class from your design system.\n\n @learn-ref faux-interactive-elements\n\n ## Example\n\n Add the `[up-clickable]` attribute to a non-interactive element, like a `<span>`:\n\n ```html\n <span id=\"faux-button\" up-clickable>Click me</span> <!-- mark: up-clickable -->\n ```\n\n To react to the element's activation, handle the `up:click` event:\n\n ```js\n let button = document.querySelector('#faux-button')\n\n button.addEventListener('up:click', function(event) {\n console.log('Click on faux button!')\n })\n ```\n\n ## Act on press\n\n To activate the element on `mousedown` instead of `click`, also set an `[up-instant]` attribute:\n\n ```html\n <span id=\"faux-button\" up-clickable up-instant>Click me</span> <!-- mark: up-instant -->\n ```\n\n ## Unobtrusive use\n\n To make elements clickable without an explicit `[up-clickable]` attribute, configure `up.link.config.clickableSelectors`:\n\n ```js\n up.link.config.clickableSelectors.push('.button')\n ```\n\n Any matching element will now gain [keyboard interaction and other accessibility behaviors](/learn/faux-interactive-elements#accessibility):\n\n ```html\n <span class=\"button\">I can be used with the keyboard</span>\n ```\n\n @selector [up-clickable]\n @param [up-instant]\n Whether this element is activated on `mousedown` instead of waiting for `click`.\n @experimental\n */\n up.macro(config.selectorFn('clickableSelectors'), makeClickable)\n\n // function willJump(link) {\n // let [linkBase, linkHash] = splitLocation(u.normalizeURL(link))\n // let verbatimHREF = link.getAttribute('href')\n // }\n\n function shouldHandleClick(event, link) {\n // Users may configure up.link.config.followSelectors.push('a')\n // and then opt out individual links with [up-follow=false].\n if (event.defaultPrevented) {\n return false\n }\n\n return isClickTarget(event.target, link)\n }\n\n // Returns whether a click on the given target is meant for the given link,\n // and not for another interactive element within the link.\n function isClickTarget(target, link) {\n // A click within a nested [up-expand] area belongs to that area, but only if:\n // (1) The area works. Only the [up-expand] macro sets an { upExpandedPair },\n // so an inert area or [up-expand=false] does not take the click.\n // (2) The area is not the element we're testing, e.g. when the area asks about a click on itself.\n // (3) The area is inside the element. closest() may also find an area around it,\n // but that outer area does not take the click from its content.\n const innerArea = target.closest('[up-expand]')\n if (innerArea?.upExpandedPair && innerArea !== link && link.contains(innerArea)) {\n return false\n }\n\n // An element within the link may be a better target that handles the click itself:\n // (1) A nested link or [up-follow] element is always followed on its own.\n // (2) A field always handles its own click.\n // (3) A link's buttons, labels and summaries are part of its content, so clicking them follows the link.\n // A clickable container like an [up-expand] area leaves them to handle their own clicks.\n const betterTargetSelector = `a, [up-follow], ${link.matches('a') ? up.form.fieldSelector() : interactiveSelector()}`\n const betterTarget = target.closest(betterTargetSelector)\n // The click is meant for the link if:\n // (1) Nothing more specific than the link was clicked.\n // (2) The closest better target is the link itself.\n // (3) closest() walked past the link to an element around it, like an outer [up-expand] area\n // or a <label> around the link. A better target must lie between the click target and the link.\n return !betterTarget || (betterTarget === link) || !link.contains(betterTarget)\n }\n\n // Elements within a clickable container that handle their own clicks.\n function interactiveSelector() {\n return [up.form.fieldSelector(), up.form.anyButtonSelector(), 'label', 'summary'].join()\n }\n\n function isInstant(linkOrDescendant) {\n const element = linkOrDescendant.closest(config.selector('instantSelectors'))\n // (1) Allow users to configure up.link.config.instantSelectors.push('a')\n // but opt out individual links with [up-follow=false].\n // (2) A press on an element that handles its own click is not instant. Otherwise we would\n // emit up:click on mousedown, ignore it, and then halt the click that the element needs.\n return element && !isInstantDisabled(element) && isClickTarget(linkOrDescendant, element)\n }\n\n function isInstantDisabled(link) {\n // (1) We cannot resolve config.noInstantSelectors via a :not() selector because\n // convertClicks() needs to check if a given link is instant.\n // (2) We cannot implement this as !isFollowable(link) because [up-clickable] can add\n // instant support for non-followable elements.\n // (3) A link that matches config.instantSelectors, but neither config.followSelectors nor\n // config.noFollowSelectors, stays instant even though nothing follows it. This is intentional:\n // users may handle its up:click themselves. The docs ask that instant links are also followable.\n return config.matches(link, 'noInstantSelectors') || config.matches(link, 'noFollowSelectors')\n }\n\n /*-\n Provide an `up:click` event that improves on standard click\n in several ways:\n\n - It is emitted on mousedown for [up-instant] elements\n - It is not emitted if the element has disappeared (or was overshadowed)\n between `mousedown` and `click`. This can happen if `mousedown` creates a new element\n that obstructs interaction with this element, or if a `mousedown` handler removes this element.\n - It is not emitted if the user clicks with a non-first mouse button.\n - It is not emitted if the user holds a modifier key when clicking.\n\n Stopping an `up:click` event will also stop the underlying event.\n\n Also see docs for `up:click`.\n\n @function up.link.convertClicks\n @param {up.Layer} layer\n @internal\n */\n function convertClicks(layer) {\n layer.on('click', function(event, element) {\n // We never handle events for the right mouse button,\n // or when Shift/CTRL/Meta/ALT is pressed\n if (up.event.isModified(event)) {\n return\n }\n\n // (1) Instant links should not have a `click` event.\n // This would trigger the browsers default follow-behavior and possibly activate JS libs.\n // (2) A11Y: We also need to check whether the [up-instant] behavior did trigger on mousedown.\n // Keyboard navigation will not necessarily trigger a mousedown event.\n if (isInstant(element) && lastInstantTarget === element) {\n up.event.halt(event)\n\n // (1) In case mousedown has created a layer over the click coordinates,\n // Chrome will emit an event with { target: document.body } on click.\n // Ignore that event and only process if we would still hit the\n // expect layers at the click coordinates.\n // (2) A click made by JavaScript, e.g. element.click(), has no meaningful coordinates and\n // may run while another click is being handled. We skip the mouse checks for such clicks.\n } else if (up.event.inputDevice === 'key' || up.event.isSyntheticClick(event) || (layer.wasHitByMouseEvent(event) && !didUserDragAway(event))) {\n // Event is a `PointerEvent` with an { pointerType } property.\n // Its values are 'mouse', 'pen', 'touch' or '' (unknown, meaning synthetic or keyboard).\n forkEventAsUpClick(event)\n }\n\n // In case the user switches input modes.\n lastMousedownTarget = null\n lastInstantTarget = null\n })\n\n layer.on('touchstart', { passive: true }, function(event, element) {\n // Remember for isLongPressPossible() on mousedown\n lastTouchstartTarget = element\n })\n\n layer.on('mousedown', function(event, element) {\n // We never handle events for the right mouse button,\n // or when Shift/CTRL/Meta/ALT is pressed\n if (up.event.isModified(event)) {\n return\n }\n\n // Remember for the didUserDragAway() test on click\n lastMousedownTarget = element\n\n // (1) Instant links emit up:click on mousedown\n // (2) On touch devices we never act on mousedown as the user may be long-pressing to open the context menu\n // (3) When another script prevented the mousedown, e.g. to keep the focus in a search field,\n // the press is not instant. A forked up:click would be prevented as well, and we would halt the click.\n // Like the browser, we still act on the click.\n if (!event.defaultPrevented && isInstant(element) && !isLongPressPossible(event)) {\n // Remember that we already emitted an event so we don't do it again on click\n lastInstantTarget = element\n\n // A11Y: Keyboard navigation will not necessarily trigger a mousedown event.\n // We also don't want to listen to the enter key, since some screen readers\n // use the enter key for something else.\n forkEventAsUpClick(event)\n }\n\n // (1) Now that we tested isLongPressPossible() we can reset the last touchstart target for the next press\n // (2) Do it here rather than on click because, when long pressing opens the menu, there won't be a click\n lastTouchstartTarget = null\n })\n }\n\n function isLongPressPossible(mousedownEvent) {\n let mousedownTarget = mousedownEvent.target\n return (lastTouchstartTarget === mousedownTarget) && mousedownTarget.closest('[href]')\n }\n\n function didUserDragAway(clickEvent) {\n return lastMousedownTarget && (lastMousedownTarget !== clickEvent.target)\n }\n\n function forkEventAsUpClick(originalEvent) {\n let forwardedProps = ['clientX', 'clientY', 'button', ...up.event.keyModifiers]\n const newEvent = up.event.fork(originalEvent, 'up:click', forwardedProps)\n up.emit(originalEvent.target, newEvent, { log: false })\n }\n\n /*-\n A `click` event that honors the `[up-instant]` attribute.\n\n This event is generally emitted when an element is clicked. However, for elements\n with an `[up-instant]` attribute, this event is emitted on `mousedown` instead.\n If the press lands on an element within that handles its own click, like a checkbox, or another script\n prevented the `mousedown` event, `up:click` is emitted on `click` as usual.\n\n This is useful for listening to links being activated without needing to know whether\n a link is `[up-instant]`.\n\n @learn-ref faux-interactive-elements\n\n ## Example\n\n Assume we have two links, one of which is `[up-instant]`:\n\n ```html\n <a href=\"/one\">Link 1</a>\n <a href=\"/two\" up-instant>Link 2</a>\n ```\n\n The following event listener will be called when *either* link is activated:\n\n ```js\n document.addEventListener('up:click', function(event) {\n ...\n })\n ```\n\n ## Cancellation\n\n You may cancel an `up:click` event using `event.preventDefault()`.\n\n Canceling `up:click` on a hyperlink will prevent Unpoly from [following](/api/up-follow) that link.\n\n The underlying `click` or `mousedown` event will also be canceled.\n\n ## Accessibility\n\n If the user activates an element using their keyboard, the `up:click` event will be emitted\n when the key is pressed even if the element has an `[up-instant]` attribute.\n\n ## Only unmodified clicks are considered\n\n To prevent overriding native browser behavior, the `up:click` event is only emitted for unmodified clicks.\n\n In particular, it is not emitted when the user holds `Shift`, `CTRL`, or `Meta` while clicking,\n nor when the user clicks with a secondary mouse button.\n\n @event up:click\n @param {Element} event.target\n The clicked element.\n @param {Event} event.originalEvent\n The underlying `click` or `mousedown` event.\n @param event.preventDefault()\n Prevents this event and also the original `click` or `mousedown` event.\n @stable\n */\n\n /*-\n Returns whether the given link has a [safe](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.1.1)\n HTTP method like `GET`.\n\n You can configure links to use unsafe methods like `POST` or `DELETE` by setting an [`[up-method]`](/api/up-follow#up-method) attribute.\n\n @function up.link.isSafe\n @param {Element} link\n The link to test.\n @return {boolean}\n Whether the link will be followed using a safe HTTP method.\n @stable\n */\n function isSafe(link) {\n const method = followMethod(link)\n return up.network.isSafeMethod(method)\n }\n\n function onLoadCondition(condition, link, callback) {\n switch (condition) {\n case 'insert':\n callback()\n break\n case 'reveal': {\n let margin = e.numberAttr(link, 'up-intersect-margin')\n up.fragment.onFirstIntersect(link, callback, { margin })\n break\n }\n case 'hover':\n new up.LinkFollowIntent(link, callback)\n break\n case 'manual':\n // Wait for explicit call of up.deferred.load().\n break\n }\n }\n\n /*-\n Loads a [`[up-defer=\"manual\"]`](/api/up-defer) placeholder.\n\n @learn-ref lazy-loading#scripted\n\n @function up.deferred.load\n\n @section General\n @param {Element} placeholder\n The `[up-defer]` placeholder to load.\n\n @param {Object} [options]\n [Render options](/api/up.render#parameters) that should be used for loading the placeholder.\n\n Unpoly will parse render options from the given placeholder's attributes.\n You may pass this additional `options` object to [supplement or override](/learn/attributes-and-options#options)\n options parsed from the placeholder attributes. See `[up-follow]` for a list of supported attributes.\n\n Common options are documented below, but most [options for `up.follow()`](/api/up.follow#parameters) may be used.\n\n @section Targeting\n @param {string} [options.target=':origin']\n @like [up-defer]/up-target\n\n @section Request\n @param [options.url]\n The URL from which to load the deferred content.\n\n Defaults to the placeholder's [`[up-href]`](/api/up-defer#up-href) or `[href]` attribute.\n\n @like up.follow\n\n @param [options.headers]\n @like up.follow\n\n @param {boolean} [options.background=false]\n @like [up-defer]/up-background\n\n @section Caching\n @mix up.render/caching\n\n @return {up.RenderJob}\n A promise that fulfills with an `up.RenderResult` once the deferred content\n has been loaded and rendered.\n\n @stable\n @signature\n */\n function loadDeferred(link, options) {\n let guardEvent = up.event.build('up:deferred:load', { log: ['Loading deferred %o', link] })\n\n // These options override up.link.follow() behavior\n let forcedOptions = {\n navigate: false,\n guardEvent,\n ...options,\n }\n\n // These defaults can be overridden using [up-...] attributes.\n let defaults = {\n target: ':origin',\n // An error response renders nothing and keeps the placeholder, unless the placeholder\n // has an [up-fail-target] or [up-fail=false] attribute.\n failTarget: ':none',\n cache: 'auto',\n revalidate: 'auto',\n feedback: true,\n }\n\n return follow(link, forcedOptions, { defaults })\n }\n\n /*-\n This event is emitted before an `[up-defer]` placeholder loads its deferred content.\n\n The event can be [prevented](#event.preventDefault) to stop the network request.\n The loading will not be attempted again, but you can use `up.deferred.load()` to load it manually afterwards.\n\n @learn-ref lazy-loading\n\n @event up:deferred:load\n @param {Element} event.target\n The `[up-defer]` placeholder that is about to load its content.\n @param {Object} event.renderOptions\n An object with [render options](/api/up.render#parameters) for the coming fragment update.\n\n Listeners may inspect and modify these options.\n @param event.preventDefault()\n Prevents the deferred content from being loaded.\n @stable\n @signature\n */\n\n /*-\n A placeholder for content to be loaded later from another URL.\n\n By moving expensive but non-[critical](https://developer.mozilla.org/en-US/docs/Web/Performance/Critical_rendering_path) fragments into partials,\n you can paint critical content earlier.\n\n @learn-ref lazy-loading\n\n ## Example\n\n @include defer-example\n\n @selector [up-defer]\n\n @params-note\n All modifying attributes for `[up-follow]` may also be used.\n\n @section Timing\n @param [up-defer='insert']\n When to load and render the deferred content.\n\n When set to `'insert'` (the default), the deferred content will load immediately when\n the `[up-defer]` element is inserted into the DOM.\n\n When set to `'reveal'`, the deferred content will load when the `[up-defer]` placeholder is scrolled\n into the [viewport](/api/up-viewport). If the element is already visible when\n inserted, loading will start immediately. Also see [loading as the placeholder becomes visible](/learn/lazy-loading#on-reveal).\n\n When set to `'manual'`, the deferred content will not load on its own.\n You can control the load timing by calling `up.deferred.load()` from your own JavaScript.\n\n @param [up-intersect-margin='0']\n With `[up-defer=reveal]`, this enlarges the viewport by the given number of pixels before\n computing the intersection.\n\n A positive number will load the deferred content some pixels before it becomes visible.\n\n A negative number will require the user to scroll some pixels into the element before it is loaded.\n\n @experimental\n\n @section Targeting\n @param [up-target=':origin']\n A selector for the fragment to render the content in.\n\n By default the `[up-defer]` element itself will be replaced with the loaded content.\n For this the element must have a [derivable target selector](/learn/target-derivation).\n\n You may target one or [multiple](/learn/targeting-fragments#multiple) fragments.\n To target the placeholder itself, you can use the `:origin` target instead of spelling out a selector.\n\n @param [up-fail]\n How to handle [error responses](/learn/error-responses).\n\n By default, a server response with an error code is not rendered,\n and the placeholder keeps its fallback content.\n\n Set `[up-fail=false]` to render *any* response that contains a matching fragment,\n even with a 4xx or 5xx status code.\n\n @param [up-fail-target]\n A selector for the fragment to render an [error response](/learn/error-responses) in.\n\n By default, a server response with an error code is not rendered.\n\n @section Request\n @param [up-href]\n The URL from which to load the deferred content.\n\n If your `[up-defer]` placeholder is a [standard hyperlink](/learn/lazy-loading#seo), you can use an `[href]` attribute instead.\n\n @param [up-headers]\n A [relaxed JSON](/api/relaxed-json) object with additional request headers.\n\n @param [up-background='false']\n Whether to load the deferred content [in the background](/learn/background-requests).\n\n Background requests will not show the [global progress bar](/learn/progress-bar).\n\n @section Caching\n @mix up-follow/caching\n\n @stable\n @signature\n */\n up.attribute('up-defer', { defaultValue: 'insert' }, function(link, condition) {\n let doLoad = (options) => up.error.muteUncriticalRejection(loadDeferred(link, options))\n onLoadCondition(condition, link, doLoad)\n })\n\n /*-\n [Follows](/api/up.follow) this link with JavaScript and updates a fragment with the server response.\n\n Following a link is considered [navigation](/learn/navigation-defaults) by default.\n\n @learn-ref following-links\n\n ## Example\n\n This link will update the `<div class=\"content\">` fragment with the same element\n fetched from `/posts/5`:\n\n ```html\n <a href=\"/posts/5\" up-follow up-target=\".content\">Read post</a>\n ```\n\n If no `[up-target]` attribute is set, the [main fragment](/api/up-main) is updated.\n\n ## Following all links automatically\n\n You can configure Unpoly to follow *all* links on a page without requiring an `[up-follow]` attribute.\n\n See [Handling all links](/learn/handling-all-links).\n\n ## Unfollowable links\n\n Even with an `[up-follow]` attribute, some links cannot be handled by Unpoly:\n\n @include no-follow-reasons\n\n Clicking such links will fall back to default browser behavior.\n\n ## Preventing Unpoly from following links\n\n You can tell Unpoly to ignore clicks on an `[up-follow]` link, causing the link to be non-interactive.\n Use one of the following methods:\n\n - Prevent the `up:link:follow` event on the link element\n - Prevent the `up:click` event on the link element\n\n To force a [full page load](/api/up.network.loadPage) when a followable link is clicked:\n\n - Set an [`[up-follow=false]`](/learn/attributes-and-options#boolean-attributes) attribute on the link element\n - Prevent the `up:link:follow` event, then call `up.network.loadPage(event.renderOptions)`\n\n ## Making non-interactive elements act as hyperlinks\n\n You can set an `[up-follow]` attribute on any non-interactive element to make it behave like a hyperlink:\n\n ```html\n <span up-follow up-href=\"/details\">Read more</span>\n ```\n\n See [Acting like a hyperlink](/learn/faux-interactive-elements#acting-like-a-hyperlink) for details.\n\n ## Advanced fragment changes\n\n Links can update multiple fragments or append content to an existing element.\n\n See [Fragment placement](/learn/targeting-fragments) for details.\n\n ## Short notation\n\n You may omit the `[up-follow]` attribute if the link has one of the following attributes:\n\n - `[up-target]`\n - `[up-layer]`\n - `[up-transition]`\n - `[up-content]`\n - `[up-fragment]`\n - `[up-document]`\n\n Such a link will still be followed through Unpoly.\n\n @selector [up-follow]\n\n @section Targeting\n @mix up-follow/targeting\n\n @section Navigation\n @mix up-follow/navigation\n\n @section Request\n @mix up-follow/request\n\n @section Local content\n @mix up-follow/local-content\n\n @section Layer\n @mix up-follow/layer\n\n @section History\n @mix up-follow/history\n\n @section Animation\n @mix up-follow/motion\n\n @section Caching\n @mix up-follow/caching\n\n @section Scrolling\n @mix up-follow/scrolling\n\n @section Focus\n @mix up-follow/focus\n\n @section Loading state\n @mix up-follow/loading-state\n\n @section Client state\n @mix up-follow/client-state\n\n @section Lifecycle hooks\n @mix up-follow/lifecycle-hooks\n\n @stable\n @signature\n */\n up.on('up:click', config.selectorFn('followSelectors'), function(event, link) {\n if (shouldHandleClick(event, link)) {\n up.event.halt(event, { log: true })\n\n // When the user clicks an hyperlink, the browser will focus the link element on `click`.\n // However, for an `[up-instant]` link we will emit `up:click` on `mousedown` and halt the `click` event.\n // Without a `click` event the browser won't focus the link.\n //\n // This also has an unfortunate effect on `input[up-validate]`:\n //\n // - User types into a text field\n // - With focus still on the text field, the user clicks on an `[up-instant]`.\n // - The link is being followed, causing a request for the new fragment.\n // - When the response is received, Unpoly will update the targeted fragment.\n // - This causes the text field (probably being replaced) from losing focus, causing a `change` event,\n // triggering `[up-validate]` and another server request for the validation.\n // - The link request is probably `{ abort: true }`, but since it happened *before* the\n // validation request there was nothing to abort.\n // - When the validation response is received, the text field is probably gone, causing error.\n //\n // To preserve behavioral symmetry to standard links, we manually focus the link when it was activated\n // on `mousedown`.\n up.focus(link, { preventScroll: true })\n\n up.error.muteUncriticalRejection(follow(link))\n }\n })\n\n /*-\n Activates this link-like element on `mousedown` instead of `click` (\"Act on press\").\n\n For links with `[up-follow]`, this will save time that would otherwise be spent\n waiting for the user to release the mouse button. Since the request starts right away,\n the interaction will appear faster.\n\n For [faux-interactive elements](/learn/faux-interactive-elements), setting `[up-instant]` will cause\n the `up:click` event to be emitted on `mousedown` instead of `click`.\n A press on a control within the element, or a press whose `mousedown` was prevented, still emits `up:click` on `click`.\n\n To apply the instant effect without changing your HTML, configure `up.link.config.instantSelectors`.\n\n @learn-ref following-links#instant\n\n ## Example\n\n ```html\n <a href=\"/users\" up-follow up-instant>User list</a> <!-- mark: up-instant -->\n ```\n\n ## Accessibility\n\n Links or [faux-interactive elements](/learn/faux-interactive-elements) with `[up-instant]`\n can still be activated with the keyboard.\n\n With `[up-instant]`, users can no longer cancel a click by dragging the pressed mouse away from the element.\n However, for navigation actions this isn't required. E.g., many operating systems switch tabs on `mousedown`\n instead of `click`.\n\n @selector [up-instant]\n @stable\n @signature\n */\n\n /*-\n Enlarges the click area of a descendant link.\n A click anywhere in the area does what a click on its link does.\n\n @learn-ref faux-interactive-elements\n\n When Unpoly follows the link, the area takes over the link's Unpoly attributes, like\n [`[up-target]`](/api/up-follow#up-target), `[up-instant]`, or `[up-preload]`.\n A click on the area then follows the link itself. Events like `up:link:follow` are emitted on the link,\n and the link is the [origin](/learn/targeting-fragments#referring-to-the-origin-element) of the fragment update.\n\n ## Example\n\n ```html\n <div class=\"notification\" up-expand>\n Record was saved!\n <a href=\"/records\" up-follow>Close</a>\n </div>\n ```\n\n In the example above, clicking anywhere within the `.notification` element\n would [follow](/api/up.follow) the *Close* link.\n\n A click on another link, a form field, a button, a label or a `<summary>` within the area is left to that element.\n To keep the area from following a click on another element, prevent its [`up:click`](/api/up:click) event.\n\n ## Multiple contained links\n\n If a container contains more than one link, you can set the value of the\n `[up-expand]` attribute to a CSS selector that defines which link should be expanded:\n\n ```html\n <div class=\"notification\" up-expand=\"#close\"> <!-- mark: #close -->\n Record was saved!\n <a id=\"details\" href=\"/records/5\" up-follow>Details</a>\n <a id=\"close\" href=\"/records\" up-follow>Close</a> <!-- mark: id=\"close\" -->\n </div>\n ```\n\n ## Links that Unpoly doesn't follow\n\n When Unpoly doesn't [follow](/api/up.link.isFollowable) the expanded link, a click on the area clicks the link.\n The browser then does what the link does. A plain link makes a full page load, a `[download]` link downloads its file,\n and a `[target=_blank]` link opens a new tab.\n\n To update a fragment instead, give the link an `[up-follow]` attribute or [follow all links](/learn/handling-all-links).\n\n ## Feedback classes\n\n Unpoly assigns the `.up-active` class to clicked links while they are loading.\n This class is assigned to both the expanded link and the expanded click area.\n\n Assume this `[up-expand]` container with two contained links:\n\n ```html\n <div up-expand>\n <a href=\"/foo\" up-follow>Foo</a>\n <a href=\"/bar\" up-follow>Bar</a>\n </div>\n ```\n\n When either the `[up-expand]` container or the first link is clicked, the `.up-active` class\n is assigned to both elements:\n\n ```html\n <div up-expand class=\"up-active\"> <!-- mark: class=\"up-active\" -->\n <a href=\"/foo\" up-follow class=\"up-active\">Foo</a> <!-- mark: class=\"up-active\" -->\n <a href=\"/bar\" up-follow>Bar</a>\n </div>\n ```\n\n When a non-expanded link is clicked, only that link becomes `.up-active`:\n\n ```html\n <div up-expand>\n <a href=\"/foo\" up-follow>Foo</a> <!-- chip: not active -->\n <a href=\"/bar\" up-follow class=\"up-active\">Bar</a> <!-- mark: class=\"up-active\" -->\n </div>\n ```\n\n ## Limitations\n\n `[up-expand]` has some limitations for advanced browser users:\n\n - Users won't be able to right-click the expanded area to open a context menu.\n - Users won't be able to `CTRL`+click the expanded area to open a new tab.\n\n To overcome these limitations, consider nesting the entire clickable area in an actual `<a>` tag.\n [It's OK to put block elements inside an anchor tag](https://makandracards.com/makandra/43549-it-s-ok-to-put-block-elements-inside-an-a-tag).\n\n @selector [up-expand]\n @params-note\n When Unpoly follows the expanded link, the enlarged click area takes over the link's Unpoly attributes.\n @param [up-expand]\n A CSS selector that defines which containing link should be expanded.\n\n If omitted, the first link in this element will be expanded.\n @stable\n */\n up.attribute('up-expand', { defaultValue: 'a, [up-href]', macro: true }, function(area, childLinkSelector) {\n let childLink = e.get(area, childLinkSelector)\n if (childLink) {\n // Remember the expander and expandee so we can set .up-active classes efficiently,\n // and so we can hand a click on a non-followable area to the link.\n childLink.upExpandedPair = area.upExpandedPair = [area, childLink]\n\n // This is our current workaround for expanded areas gaining an .up-current class from the contained link.\n e.addClasses(area, e.upClasses(childLink))\n\n // [up-nav] only marks elements with a URL as .up-current.\n // We give the area its link's URL, whether or not Unpoly follows the link.\n e.setMissingAttr(area, 'up-href', e.attr(childLink, 'up-href') || e.attr(childLink, 'href'))\n\n // A click on the area does what a click on the link does.\n // When Unpoly follows the link, the area takes over the link's attributes, so it is followable, instant or\n // preloadable like the link. Following the area then follows the link (see effectiveLink()).\n // Otherwise a click on the area clicks the link (see below), so the browser does whatever the link does.\n if (isFollowable(childLink)) {\n e.setMissingAttrs(area, e.upAttrs(childLink))\n makeFollowable(area)\n }\n // A11y: We could also consider making the area clickable, via makeClickable().\n // However, since the original link is already present within the area,\n // we would not add accessibility benefits. We might also confuse screen readers\n // with a nested link.\n }\n })\n\n up.on('up:click', '[up-expand]', function(event, area) {\n let childLink = area.upExpandedPair?.[1]\n // (1) A followable area is followed by the [up-follow] handler.\n // (2) A click within the expanded element belongs to that element. This includes the up:click that\n // childLink.click() emits below, so the area never handles its own forwarded click.\n // (3) We ignore clicks on other links, fields, buttons or labels in the area.\n if (childLink && !isFollowable(area) && !childLink.contains(event.target) && shouldHandleClick(event, area)) {\n up.event.halt(event)\n // The browser runs the link's default action within the user's click,\n // so popup blockers allow a link with [target=_blank].\n childLink.click()\n }\n })\n\n /*-\n [Preloads](/learn/preloading) this link before the user clicks it.\n When the link is clicked, the response will already be [cached](/learn/caching),\n making the interaction feel instant.\n\n Unpoly will only preload [links with safe methods](/api/up.link.isSafe). The `[up-preload]` attribute\n has no effect on unsafe links.\n\n Links with an `[up-preload]` attribute are always [followed by Unpoly](/api/up-follow) and will not make a full page load.\n\n @learn-ref preloading\n\n ### Example\n\n ```html\n <a href=\"/path\" up-preload>Hover over me to preload my content</a>\n ```\n\n @selector [up-preload]\n @params-note\n All modifying attributes for `[up-follow]` may also be used.\n @section Timing\n @param [up-preload='hover']\n When to preload this link.\n\n When set to `'hover'` (the default), preloading will start when the user hovers\n over this link [for a while](#up-preload-delay). On touch devices, preloading will\n begin when the user places their finger on the link. Also see [preloading on hover](/learn/preloading#on-hover).\n\n When set to `'insert'`, preloading will start immediately when this\n link is inserted into the DOM. Also see [eagerly preloading on insertion](/learn/preloading#on-insert).\n\n When set to `'reveal'`, preloading will start when the link is scrolled\n into the [viewport](/api/up-viewport). If the link is already visible when\n inserted, preloading will start immediately. Also see [preloading when a link becomes visible](/learn/preloading#on-reveal).\n\n When set to `'false'`, the link will not be preloaded.\n You can still preload this link programmatically using `up.link.preload()`.\n\n @param [up-preload-delay]\n With [`[up-preload=\"hover\"]`](#up-preload), this requires the user to hover\n for the given number of milliseconds before the link is preloaded.\n\n Defaults to `up.link.config.preloadDelay`.\n\n @param [up-intersect-margin='0']\n With `[up-preload=reveal]`, this enlarges the viewport by the given number of pixels before\n computing the intersection.\n\n A positive number will preload the link some pixels before it becomes visible.\n\n A negative number will require the user to scroll some pixels into the link before it is preloaded.\n\n @experimental\n @section Request\n @param href\n The URL to preload.\n @param [up-headers]\n @like [up-follow]\n @stable\n @signature\n */\n up.compiler(config.selectorFn('preloadSelectors'), function(link) {\n // An [up-expand] area preloads its link, so we check whether we can preload that link.\n if (!isPreloadDisabled(effectiveLink(link))) {\n let doPreload = (options) => up.error.muteUncriticalRejection(preload(link, options))\n // We need to map several cases here:\n //\n // (1) <a up-preload> => 'hover'\n // (2) <a up-preload=\"\"> => 'hover'\n // (3) <a up-preload=\"true\"> => 'hover'\n // (4) <a up-preload=\"up-preload\"> => 'hover'\n // (5) <a up-preload=\"insert\"> => 'insert\n // (6) <a up-preload=\"false\"> => do nothing (already excluded by config.noPreloadSelectors)\n // (7) <a> => only do something if we have it in config.preloadSelectors\n let condition = e.booleanOrStringAttr(link, 'up-preload')\n if (condition === true || u.isUndefined(condition)) condition = 'hover'\n onLoadCondition(condition, link, doPreload)\n }\n })\n\n up.on('up:framework:reset', reset)\n\n return {\n follow,\n followOptions,\n requestOptions: parseRequestOptions,\n preload,\n makeFollowable,\n isSafe,\n isFollowable,\n shouldHandleClick,\n convertClicks,\n config,\n loadDeferred,\n }\n})()\n\nup.follow = up.link.follow\nup.deferred = { load: up.link.loadDeferred }\n","/*-\nFeatures to submit and validate forms without a full page load.\n\nSet an `[up-submit]` attribute to let Unpoly handle a form, or call `up.submit()` from JavaScript. The `up:form:submit` event lets your code observe or prevent any submission.\n\nTo render a new form state while the user is still typing, mark fields with `[up-validate]`. This shows validation errors as the user moves through the form, and can update other fields that depend on the changed value. `[up-switch]` shows, hides or disables other elements depending on a field's value, without a server request. `[up-autosubmit]` submits the form whenever a field changes, and `up.watch()` runs your own callback instead.\n\n@learn-ref forms\n\n@module up.form\n*/\nup.form = (function() {\n\n const u = up.util\n const e = up.element\n\n /*-\n Sets default options for form submission and validation.\n\n @property up.form.config\n\n @section Submittable forms\n\n @param {Array<string>} [config.submitSelectors]\n An array of CSS selectors matching forms that will be [submitted through Unpoly](/learn/submitting-forms).\n\n You can configure Unpoly to handle *all* forms on a page without requiring an `[up-submit]` attribute:\n\n ```js\n up.form.config.submitSelectors.push('form')\n ```\n\n Individual forms may opt out with an `[up-submit=false]` attribute.\n You may configure additional exceptions in `config.noSubmitSelectors`.\n\n @param {Array<string>} [config.noSubmitSelectors]\n Exceptions to `up.form.config.submitSelectors`.\n\n Matching forms will *not* be [submitted through Unpoly](/learn/submitting-forms),\n even if they match `up.form.config.submitSelectors`.\n\n @section Form elements\n\n @param {Array<string>} [config.groupSelectors=['[up-form-group]', 'fieldset', 'label', 'form']]\n An array of CSS selectors matching a [form group](/api/up-form-group).\n\n When [validating](/learn/validation#validating-after-changing-a-field) a field,\n Unpoly will re-render the [closest](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest)\n form group around that field.\n\n When a group is matched, Unpoly will [derive a target selector](/learn/target-derivation) for the element.\n In the example below, changing the *City* field would validate the target `#city_group`:\n\n ```html\n <fieldset id=\"city_group\">\n <label for=\"city\">City</label>\n <input type=\"text\" name=\"city\" id=\"city\" up-validate>\n </fieldset>\n ```\n\n If no good selector can be derived from the group element, the resulting target will\n use a `:has()` suffix that matches the changed field. In the example below the target\n would be `fieldset:has(#city)`:\n\n ```html\n <fieldset> <!-- no [id] attribute to derive a selector from -->\n <label for=\"city\">City</label>\n <input type=\"text\" name=\"city\" id=\"city\" up-validate>\n </fieldset>\n ```\n\n @param {Array<string>} [config.fieldSelectors]\n An array of CSS selectors that represent form fields, such as `input` or `select`.\n\n [Form-associated custom elements](/learn/custom-form-fields#form-associated) are matched by\n default and need not be added.\n\n Add a selector to [register any element as a field](/learn/custom-form-fields#registering).\n Matching elements must have a `value` property.\n\n You may configure exceptions in `config.noFieldSelectors`.\n\n @param {Array<string>} [config.noFieldSelectors]\n Exceptions to `up.form.config.fieldSelectors`.\n\n Matching elements will *not* be considered a form field, even if they match `up.form.config.fieldSelectors`.\n\n For example, a form-associated custom element that renders a button should not count as a field:\n\n ```js\n up.form.config.noFieldSelectors.push('my-submit-button')\n ```\n\n @experimental\n\n @param {Array<string>} [config.submitButtonSelectors]\n An array of CSS selectors that represent submit buttons, such as `input[type=submit]` or `button[type=submit]`.\n\n Selectors must only match native submit buttons: a `<button>` without a `[type]` or with `[type=submit]`,\n an `<input type=\"submit\">` or an `<input type=\"image\">`. A browser cannot submit a form through other elements,\n and [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData) rejects them.\n\n @param {Array<string>} [config.anyButtonSelectors]\n An array of CSS selectors that represent buttons of any kind, such as `button` or `input[type=button]`.\n\n Unpoly uses this to disable a form's buttons while the form is submitting.\n To find the button that *submits* a form, see `config.submitButtonSelectors`.\n\n @experimental\n\n @param {Function(string): boolean|boolean} [config.arrayParam]\n Whether a param name is treated as an array with multiple values.\n\n By default, only field names ending in `\"[]\"` are treated as arrays.\n You can configure another function that accepts a param name and returns a `boolean`.\n\n If set to `true` then all fields are handled as arrays and functions like\n `up.watch()` always get the value passed as an array.\n\n @experimental\n\n @section Watching fields\n\n @param {number} [config.watchInputDelay=0]\n The number of milliseconds to [wait before running a watcher callback](/learn/watch-options#debouncing).\n\n This default delay is only applied when [watching the `input` event](/learn/watch-options#events).\n There is no default delay when watching other types of events.\n\n @param {Array<string>|Function(Element): Array<string>} [config.watchInputEvents=['input', 'change']]\n An array of events to substitute if [watching the `input` event](/learn/watch-options#events).\n\n This can be used to watch [misbehaving fields](/learn/watch-options#normalizing-non-standard-events)\n that don't emit the [standard `input` event](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event)\n as its value is being edited.\n\n It's OK to name multiple events that may result in the same change (e.g. `['keydown', 'keyup']`).\n Unpoly guarantees the callback is only run once per changed value.\n\n Instead of configuring an array of event types, you may also set a function that accepts\n a form field and returns an array of event types to watch for that field.\n\n @param {Array<string>|Function(Element): Array<string>} [config.watchChangeEvents=['change']]\n An array of events to substitute if [watching the `change` event](/learn/watch-options#events).\n\n This can be used to watch [misbehaving fields](/learn/watch-options#normalizing-non-standard-events)\n that don't emit the [standard `change` event](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event)\n after its value was changed.\n\n It's OK to name multiple events that may result in the same change (e.g. `['change', 'blur']`).\n Unpoly guarantees the callback is only run once per changed value.\n\n Instead of configuring an array of event types, you may also set a function that accepts\n a form field and returns an array of event types to watch for that field.\n\n @section Validation\n\n @param {boolean} [config.validateBatch=true]\n Whether to [batch validations](/api/up.validate#batching).\n\n @stable\n */\n const config = new up.Config('up.form.config', () => ({\n groupSelectors: ['[up-form-group]', 'fieldset', 'label', 'form'],\n fieldSelectors: [\n 'select',\n 'input:not([type=submit], [type=image], [type=button], [type=reset])',\n 'textarea',\n // Form-associated custom elements. No selector can name them directly, but they are the only\n // elements outside this list that :enabled and :disabled match — both states, so that an\n // element does not stop being a field while it is disabled. CSS defines :enabled by\n // capability (\"can be activated or accept focus\"), and older HTML counted `a, area, link`\n // with an [href] among the elements that :enabled matches. They are excluded in case an\n // engine still reads it that way. Chrome, Firefox and Safari do not.\n ':is(:enabled, :disabled):not(input, select, textarea, button, fieldset, optgroup, option, a, area, link)',\n ],\n noFieldSelectors: [],\n submitSelectors: ['form:is([up-submit], [up-target], [up-layer], [up-transition])'],\n noSubmitSelectors: ['[up-submit=false]', '[target]', e.crossOriginSelector('action')],\n submitButtonSelectors: ['input[type=submit]', 'input[type=image]', 'button[type=submit]', 'button:not([type])'],\n anyButtonSelectors: ['button', 'input:is([type=submit], [type=image], [type=button], [type=reset])'],\n // Although we only need to bind to `input`, we always also bind to `change`\n // in case another script manually triggers it.\n validateBatch: true,\n watchInputEvents: ['input', 'change'],\n watchInputDelay: 0,\n watchChangeEvents: ['change'],\n watchableEvents: ['input', 'change'],\n arrayParam: (name) => name.endsWith('[]'),\n }))\n\n function findFormElements(root, selectorFn) {\n root = e.get(root) // unwrap jQuery\n let elements = up.fragment.subtree(root, selectorFn())\n\n // Like the browser, a [form] attribute takes precedence over the surrounding form.\n if (root.matches('form')) {\n elements = elements.filter((element) => !element.hasAttribute('form') || getForm(element) === root)\n }\n\n // If findFormElements() is called with an entire form, gather fields outside the form\n // element that are associated with the form (through <input form=\"id-of-form\">, which\n // is an HTML feature.)\n if (root.matches('form[id]')) {\n const formReference = e.attrSelector('form', root.getAttribute('id'))\n const externalElementsSelector = selectorFn(formReference)\n const externalElements = up.fragment.all(externalElementsSelector, { layer: root })\n elements = u.uniq([...elements, ...externalElements])\n }\n\n return elements\n }\n\n const [fieldSelector, isField] = config.selectorFns('fieldSelectors')\n\n /*-\n Returns whether the given element is a form field, such as `input` or `select`.\n\n To configure what Unpoly considers a form field, use `up.form.config.fieldSelectors`.\n\n @function up.form.isField\n @param {Element} element\n The element to check.\n @return {boolean}\n Whether the given element is a form field.\n @stable\n */\n\n /*-\n Returns a list of form fields within the given element.\n\n You can configure what Unpoly considers a form field by adding CSS selectors to the\n `up.form.config.fieldSelectors` array.\n\n If the given element is itself a form field, a list of that given element is returned.\n\n If the given element is a `<form>` with an `[id]`, the list also includes fields outside the form\n that are associated with it through a [`[form]`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#form) attribute.\n\n Fields in another [layer](/api/up.layer) and fields that are being [destroyed](/api/up.destroy) are ignored.\n\n @function up.form.fields\n @param {Element|jQuery} root\n The element to scan for contained form fields.\n\n If the element is itself a form field, a list of that element is returned.\n @return {List<Element>}\n The field elements within the given element.\n @stable\n */\n function findFields(root) {\n return findFormElements(root, fieldSelector)\n }\n\n // ALWAYS read and write a field's state through the accessors below. Direct property or\n // attribute access is wrong for at least one kind of field.\n\n // Falls back on absence, not falseness: a native field reports '' and means it.\n function readFieldName(field) {\n return field.name ?? field.getAttribute('name')\n }\n\n // The property is the only source. A form-associated element reports its value to the browser\n // through setFormValue(), which a script cannot read back.\n function readFieldValue(field) {\n return field.value\n }\n\n // The field's own state only: an ancestor <fieldset disabled> also disables it for the browser,\n // which we deliberately don't track here. Only up.Params.fromForm() honors it, for request params.\n // Asks the same question as writeFieldDisabled(), so the two cannot disagree about which\n // spelling is authoritative.\n function readFieldDisabled(field) {\n return 'disabled' in field ? field.disabled : field.hasAttribute('disabled')\n }\n\n // Write only the spelling the control implements. Assigning a { disabled } property that a\n // form-associated element never declared would *create* it, shadowing the attribute in\n // readFieldDisabled() from then on.\n //\n // The undo closure reuses this spelling on purpose, so do not simplify it to\n // `() => writeFieldDisabled(field, false)`: a custom element that upgrades in between would be\n // disabled through its attribute and re-enabled through a property that only just appeared,\n // leaving our attribute on the element for good.\n function writeFieldDisabled(field, disabled) {\n if ('disabled' in field) {\n field.disabled = disabled\n return () => { field.disabled = !disabled }\n } else {\n field.toggleAttribute('disabled', disabled)\n return () => field.toggleAttribute('disabled', !disabled)\n }\n }\n\n // A browser only submits the button that was pressed. With no submitter we assume the form's\n // first submit button, which is what the browser itself does for an implicit submission — press\n // Enter in a text field and event.submitter *is* the first submit button.\n function defaultSubmitButton(form) {\n return findSubmitButtons(form)[0]\n }\n\n function findFieldsAndButtons(container) {\n return [\n ...findFields(container),\n ...findAnyButtons(container),\n ]\n }\n\n const [submitButtonSelector, isSubmitButton] = config.selectorFns('submitButtonSelectors')\n\n /*-\n Returns a list of submit buttons within the given element.\n\n You can configure what Unpoly considers a submit button by adding CSS selectors to the\n `up.form.config.submitButtonSelectors` array.\n\n Buttons in another [layer](/api/up.layer) and buttons that are being [destroyed](/api/up.destroy) are ignored.\n\n @function up.form.submitButtons\n @param {Element|jQuery} root\n The element to scan for contained submit buttons.\n @return {List<Element>}\n The list of found submit buttons.\n @experimental\n */\n function findSubmitButtons(root) {\n return findFormElements(root, submitButtonSelector)\n }\n\n /*-\n Returns a selector for any button, including buttons that don't submit their form.\n\n @function up.form.anyButtonSelector\n @internal\n */\n const [anyButtonSelector, isAnyButton] = config.selectorFns('anyButtonSelectors')\n\n function findAnyButtons(root) {\n return findFormElements(root, anyButtonSelector)\n }\n\n /*-\n Submits a form via JavaScript and updates a fragment with the server response.\n\n The server must render an element matching the [target selector](/learn/targeting-fragments) from the `{ target }` option\n or the form's `[up-target]` attribute.\n A matching element in the current page is then swapped with the new element from the server response.\n The response may include other HTML (even an entire HTML document), but only the matching element will be updated.\n\n Submitting a form is considered [navigation](/learn/navigation-defaults).\n\n Emits the event [`up:form:submit`](/api/up:form:submit).\n\n @learn-ref submitting-forms\n\n ### Example\n\n ```js\n up.submit('form.new-user', { target: '.main' })\n ```\n\n @function up.submit\n\n @section General\n\n @param {Element|jQuery|string} form\n The form to submit.\n\n If the argument points to an element that is not a form,\n Unpoly will search its ancestors for the [closest](/api/up.fragment.closest) form.\n\n @param {Object} [options]\n Additional [render options](/api/up.render#parameters) that should be used for submitting the form.\n\n Unpoly will parse render options from the form's attributes.\n You may pass this additional `options` object to [supplement or override](/learn/attributes-and-options#options)\n options parsed from attributes. See `[up-submit]` for a list of supported attributes.\n\n @section Targeting\n @mix up.render/targeting\n @param options.failTarget\n The [target selector](/learn/targeting-fragments) to update when the server responds with an error code.\n\n By default, error responses will update the `<form>` element itself.\n\n See [[error-responses]].\n\n @param options.origin\n The element that triggered the form submission.\n\n This defaults to the first applicable:\n\n - An element within the form that was focused when the form was submitted (e.g. when the user presses `Enter` inside a text field)\n - The [button clicked to submit the form](/api/up:form:submit#event.submitButton).\n - The first submit button\n - The `<form>` element\n\n @section Navigation\n @mix up.render/navigation\n @param [options.navigate=true]\n\n @section Request\n @mix up.submit/request\n\n @section Layer\n @mix up.render/layer\n\n @section History\n @mix up.render/history\n\n @section Animation\n @mix up.render/motion\n\n @section Caching\n @mix up.render/caching\n\n @section Scrolling\n @mix up.render/scrolling\n\n @section Focus\n @mix up.render/focus\n\n @section Loading state\n @mix up.submit/loading-state\n\n @section Client state\n @mix up.render/client-state\n\n @section Lifecycle hooks\n @mix up.render/lifecycle-hooks\n\n @return\n @like up.render\n\n @stable\n */\n const submit = up.mockable((form, options) => {\n return up.render(submitOptions(form, options))\n })\n\n /*-\n Parses the [render](/api/up.render) options that would be used to\n [submit](/api/up.submit) the given form, but does not render.\n\n ## Example\n\n Given a form element:\n\n ```html\n <form action=\"/foo\" method=\"post\" up-target=\".content\">\n ...\n </form>\n ```\n\n We can parse the form's render options like this:\n\n ```js\n let form = document.querySelector('form')\n let options = up.form.submitOptions(form)\n // result: { url: '/foo', method: 'POST', target: '.content', ... }\n ```\n\n @param {Element|jQuery|string} form\n The form for which to parse render options.\n @param {Object} [options]\n Additional options for the form submission.\n\n Values from these options will override any attributes set on the given form element.\n\n @internal\n @function up.form.submitOptions\n @return {Object}\n The parsed submit options.\n @stable\n */\n function submitOptions(form, options, parserOptions) {\n form = up.fragment.get(form)\n form = getForm(form)\n\n options = u.options(options)\n\n let parser = new up.OptionsParser(form, options, parserOptions)\n\n parser.include(destinationOptions)\n\n // We should usually be able to derive a target selector since form[action] is a default\n // deriver. In cases when we cannot, we should usually update a main target since\n // submitting is navigation, and { fallback: true } is a navigation default.\n parser.string('failTarget', { default: up.fragment.tryToTarget(form) })\n\n // The guardEvent will also be assigned an { renderOptions } property in up.render()\n options.guardEvent ||= up.event.build('up:form:submit', {\n submitButton: options.submitButton,\n log: 'Submitting form',\n params: options.params,\n form,\n })\n\n options.origin ||= up.viewport.focusedElementWithin(form) || options.submitButton || form\n options.activeElements = u.uniq([options.origin, options.submitButton, form].filter(u.isElement))\n\n // Now that we have extracted everything form-specific into options, we can call\n // up.link.followOptions(). This will also parse the myriads of other options\n // that are possible on both <form> and <a> elements.\n parser.include(up.link.followOptions)\n\n Object.assign(options, submitButtonOverrides(options.submitButton))\n\n return options\n }\n\n function watchOptions(field, options, parserOptions = {}) {\n options = u.options(options)\n\n // Computing the effective options for a given field is pretty involved,\n // as there are multiple layers of defaults. In increasing priority these are:\n //\n // Users can configure app-wide defaults for some options:\n //\n // \t\tup.form.config.watchInputDelay = 100\n //\n // Forms can configure [up-watch-...] prefixed defaults for all watchers:\n //\n // \t\t<form up-watch-disable=\"false\">\n // \t\t\t<input up-autosubmit>\n // \t\t</form>\n //\n // Form-wide options can be overridden at the input level:\n //\n // \t\t<form up-watch-disable=\"true\">\n // \t\t\t<input up-autosubmit up-watch-disable=\"false\">\n // \t\t</form>\n //\n // You may also set [up-watch-...] attribute on any element containing fields.\n // The closest attribute around the changed field is honored.\n //\n // This is particularly useful for a group of radio buttons:\n //\n // \t\t<form up-watch-disable=\"true\">\n // \t\t\t<fieldset up-autosubmit up-watch-disable=\"false\">\n // \t\t\t\t<input type=\"radio\" name=\"kind\" value=\"0\">\n // \t\t\t\t<input type=\"radio\" name=\"kind\" value=\"1\">\n // \t\t\t\t<input type=\"radio\" name=\"kind\" value=\"2\">\n // \t\t\t</fieldset>\n // \t\t</form>\n //\n // Programmatic callers may also override all HTML attributes by passing an options hash:\n //\n // up.validate(field, { disable: true })\n\n parserOptions.closest ??= true\n parserOptions.attrPrefix ??= 'up-watch-'\n\n let parser = new up.OptionsParser(field, options, parserOptions)\n\n parser.include(up.status.statusOptions, parserOptions)\n parser.string('event')\n parser.number('delay')\n\n let config = up.form.config\n if (options.event === 'input') {\n // Expand the event name via the map in `up.form.config.watchInputEvents`.\n // This way we can fix components\n options.event = u.evalOption(config.watchInputEvents, field)\n options.delay ??= config.watchInputDelay\n } else if (options.event === 'change') {\n options.event = u.evalOption(config.watchChangeEvents, field)\n }\n\n options.origin ||= field\n\n // The callback to [up-watch] is not parsed here.\n // It is parsed in watch(), which calls watchCallbackFromElement().\n\n return options\n }\n\n function validateOptions(field, options, parserOptions = {}) {\n options = u.options(options)\n let parser = new up.OptionsParser(field, options, { ...parserOptions, closest: true, attrPrefix: 'up-validate-' })\n parser.string('url')\n parser.string('method', { normalize: u.normalizeMethod })\n parser.boolean('batch', { default: config.validateBatch })\n parser.json('params')\n parser.json('headers')\n // parser.include(destinationOptions)\n parser.include(watchOptions, { defaults: { event: 'change' } })\n return options\n }\n\n /*-\n Disables all fields and buttons within the given element.\n\n To automatically disable a form when it is submitted, add the [`[up-disable]`](/api/up-submit#up-disable)\n property to the `<form>` element.\n\n Returns a function that re-enables the elements that were disabled.\n\n ## Dealing with focus loss\n\n When a focused field is disabled, it will lose focus.\n\n In that case Unpoly will focus the [closest form group](/api/up.form.group) around the disabled control.\n\n @function up.form.disableTemp\n @param {Element} element\n The element within which fields and buttons should be disabled.\n @return {Function}\n A function that re-enables the elements that were disabled.\n @internal\n */\n\n function disableContainerTemp(container, { preview } = {}) {\n let controls = findFieldsAndButtons(container)\n return u.sequence(u.map(controls, (control) => disableControlTemp(control, preview)))\n }\n\n function disableControlTemp(control, preview) {\n // Ignore controls that were already disabled before us.\n // This way we don't accidentally re-enable a control that we didn't change.\n if (readFieldDisabled(control)) return\n\n // Look the fallback up before disabling, while the control is still focusable.\n let focusFallback\n if (document.activeElement === control) focusFallback = findGroup(control, { targetable: false })\n\n let undoDisable = writeFieldDisabled(control, true)\n if (focusFallback) up.focus(focusFallback, { force: true, preventScroll: true })\n\n if (preview) {\n // Disabled by a preview to block input while a request is loading.\n // Still counts as enabled when we read params or watch values.\n control.upPreviewDisabled = true\n undoDisable = u.sequence(undoDisable, () => delete control.upPreviewDisabled)\n }\n\n // (1) This function is only returned if we didn't early-return above\n // for a control that is already disabled.\n // (2) In case our disabling caused focus loss: We don't care about restoring focus,\n // selection or scroll position here. The up.form.disableTemp() function is *only*\n // used via up.Preview#disable(), and previews already use a FocusCapsule\n // to preserve and restore focus-related state.\n return undoDisable\n }\n\n function getDisableContainers(disable, origin) {\n let originScope = () => getRegion(origin)\n\n if (disable === true) {\n return [originScope()]\n } else if (u.isElement(disable)) {\n return [disable]\n } else if (u.isString(disable)) {\n return up.fragment.subtree(originScope(), disable, { origin })\n } else if (u.isArray(disable)) {\n return u.flatMap(disable, (d) => getDisableContainers(d, origin))\n } else {\n return []\n }\n }\n\n function getDisablePreviewFn(disable, origin) {\n return function(preview) {\n let containers = getDisableContainers(disable, origin)\n for (let container of containers) {\n preview.disable(container)\n }\n }\n }\n\n // Changes the DOM so the browser's form-data algorithm sees the same controls as Unpoly.\n // Returns a function that restores the DOM.\n //\n // The browser decides the form owner of a control across the whole page: A [form=\"X\"] control\n // belongs to the first form#X in document order, and a control within a <form> belongs to it\n // even when it is in another layer (a popup attached within the form). Unpoly isolates layers.\n function prepareParamsReadTemp(form) {\n let undo = u.cleaner()\n let ownControls = new Set(findFieldsAndButtons(form))\n\n // Fields and buttons that a preview disabled still count, e.g. for a second submission\n // while the first one is loading.\n for (let control of ownControls) {\n if (control.upPreviewDisabled && readFieldDisabled(control)) undo(writeFieldDisabled(control, false))\n }\n\n // Our [form=\"X\"] controls must belong to our form, not to an earlier form#X in another layer,\n // e.g. when the same page is open in an overlay and in the layer below.\n // We don't use form.id, which an <input name=\"id\"> shadows.\n let id = form.getAttribute('id')\n if (id) {\n for (let otherForm of document.querySelectorAll('form' + e.idSelector(id))) {\n if (otherForm !== form) undo(e.setAttrsTemp(otherForm, { id: 'up-isolated-' + u.uid() }))\n }\n }\n\n // Controls of other layers must not belong to our form.\n // We collect them before we change any, since form.elements is a live collection.\n let foreignControls = u.filter(form.elements, (control) => (isField(control) || isAnyButton(control)) && !ownControls.has(control))\n for (let control of foreignControls) {\n undo(e.setAttrsTemp(control, { form: 'up-isolated-' + u.uid() }))\n }\n\n return undo.clean\n }\n\n function setContainerDisabled(container, disabled) {\n // This function is much simpler than disableContainerTemp(), as we only require\n // it for [up-enable-for] / [up-disable-for].\n for (let control of findFieldsAndButtons(container)) {\n writeFieldDisabled(control, disabled)\n }\n }\n\n // This was extracted from submitOptions().\n // Validation needs to submit a form without options intended for the final submission,\n // like [up-scroll], [up-confirm], etc.\n function destinationOptions(form, options, parserOptions) {\n options = u.options(options)\n form = getForm(form)\n const parser = new up.OptionsParser(form, options, parserOptions)\n\n parser.string('contentType', { attr: 'enctype' })\n parser.json('headers')\n\n // A `submit` event may already have handed us { submitButton: event.submitter }. Resolve this\n // before parsing params, because the button's [name] and [value] are contributed by the\n // browser's form-data algorithm inside up.Params.fromForm().\n const submitButton = (options.submitButton ??= defaultSubmitButton(form))\n\n // Parse params from form fields.\n const paramParts = [\n up.Params.fromForm(form, options),\n e.jsonAttr(form, 'up-params'),\n ]\n\n const headerParts = [\n e.jsonAttr(form, 'up-headers'),\n ]\n\n if (submitButton) {\n paramParts.push(\n e.jsonAttr(submitButton, 'up-params')\n )\n\n headerParts.push(\n e.jsonAttr(submitButton, 'up-headers')\n )\n\n // Submit buttons may have [formmethod] and [formaction] attribute\n // that override [method] and [action] attribute from the <form> element.\n options.method ||= submitButton.getAttribute('formmethod')\n options.url ||= submitButton.getAttribute('formaction')\n }\n\n // We merge any { params } option into the params that we got from the form elements.\n options.params = up.Params.merge(\n ...paramParts,\n options.params,\n )\n\n // We merge any { headers } option to the headers that we got from the form elements.\n options.headers = u.merge(\n ...headerParts,\n options.headers,\n )\n\n // Parse the form element's { url, method } *after* parsing the submit button.\n // The submit button's [formmethod] and [formaction] attributes have precedence.\n parser.string('url', { attr: 'action', default: up.fragment.source(form) })\n parser.string('method', {\n attr: ['up-method', 'data-method', 'method'],\n default: 'GET',\n normalize: u.normalizeMethod\n })\n if (options.method === 'GET') {\n // Only for GET forms, browsers discard all query params from the form's [action] URL.\n // The URLs search part will be replaced with the serialized form data.\n // See design/query-params-in-form-actions/cases.html for\n // a demo of vanilla browser behavior.\n options.url = up.Params.stripURL(options.url)\n }\n\n return options\n }\n\n function submitButtonOverrides(submitButton) {\n if (!submitButton) return {}\n let followOptions = up.link.followOptions(submitButton, {}, { defaults: false })\n // The parsing of [formmethod] and [formaction] (into { method, url })\n // already happens in destinationOptions()\n return u.omit(followOptions, ['method', 'url', 'guardEvent', 'origin', 'params', 'headers'])\n }\n\n /*-\n This event is [emitted](/api/up.emit) when a form is [submitted](/api/up.submit) through Unpoly.\n\n When the form is being [validated](/api/up-validate), this event is not emitted.\n Instead, an `up:form:validate` event is emitted.\n\n @learn-ref submitting-forms\n\n ## Changing render options\n\n Listeners may inspect and manipulate [render options](/api/up.render#parameters) for the coming fragment update.\n\n The code below will use a custom [transition](/api/up-transition)\n when a form submission [fails](/learn/error-responses):\n\n ```js\n up.on('up:form:submit', function(event) {\n event.renderOptions.failTransition = 'shake'\n })\n ```\n\n @event up:form:submit\n\n @section Submission\n\n @param {Element} event.form\n The form that is being submitted.\n\n @param {up.Params} event.params\n The [form parameters](/api/up.Params) that will be sent as the form's request payload.\n\n Listeners may inspect and modify params before they are sent.\n\n @param {Element} [event.submitButton]\n The button used to submit the form.\n\n If no button was pressed directly (e.g., the user pressed `Enter` inside a focused text field),\n this returns the first submit button.\n\n If the form has no submit buttons, this property is `undefined`.\n\n @param {Element} event.target\n The element that caused the form submission.\n\n This is usually a submit button or a focused field from which the user pressed `Enter`.\n If the element is not known, the event is emitted on the `<form>` element.\n\n @section Render pass\n\n @param {Object} event.renderOptions\n An object with [render options](/api/up.render#parameters) for the fragment update.\n\n Listeners may inspect and modify these options.\n\n @param event.preventDefault()\n Prevents the form from being submitted.\n\n @stable\n */\n\n /*-\n Watches form fields and runs a callback when a value changes.\n\n While you can also listen to a [standard `input` event](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event),\n `up.watch()` adds the following behavior:\n\n - The callback only runs when a value was actually changed. Multiple events resulting in the same value will only run the callback once.\n - The callback's execution frequency can be [debounced](/learn/watch-options#debouncing).\n - Guarantees that [only one async callback is running concurrently](#async-callbacks).\n\n ## Example\n\n The following would print to the console whenever an input field changes:\n\n ```js\n up.watch('input.query', function(value) {\n console.log('Query is now', value)\n })\n ```\n\n ## Callback arguments {#callback-arguments}\n\n The watch callback may accept up to three arguments that describe the observed change:\n\n ```js\n up.watch('input.query', function(value, name, options) {\n console.log('Query is now', value)\n })\n ```\n\n Here is a full description of the individual callback arguments:\n\n @include watch-callback-arguments\n\n When rendering from a watch callback, you should forward the `options` to the rendering function:\n\n ```js\n up.watch('input.query', function(value, name, options) { // mark: options\n return up.reload('main', { ...options, params: { query: value }}) // mark: options\n })\n ```\n\n > [tip]\n > A rendering watch callback can often be replaced with `[up-autosubmit]`.\n\n ## Watching multiple fields\n\n Instead of a single form field, you can also pass multiple fields,\n a `<form>` or any container that contains form fields.\n The callback will be run if any of the given fields change:\n\n ```js\n up.watch('form', function(value, name) {\n console.log('The value of %o is now %o', name, value)\n })\n ```\n\n ## Async callbacks\n\n When your callback does async work (like fetching data over the network), it should return a promise\n that settles once the work concludes:\n\n ```js\n up.watch('input.query', function(value, name, options) {\n let url = '/search?query=' + encodeURIComponent(value)\n return up.render('.results', { url, ...options }) // mark: return\n })\n ```\n\n Unpoly will guarantee that only one async callback is running concurrently.\n If the form is changed while an async callback is still processing, Unpoly will wait\n until the callback concludes and then run it again with the latest field values.\n\n You can also return a promise by using `async` / `await`:\n\n ```js\n up.watch('input.query', async function(value, name, options) { // mark: async\n let url = '/search?query=' + encodeURIComponent(value)\n await up.render('.results', { url, ...options }) // mark: await\n })\n ```\n\n ## Batching changes\n\n You may also pass the `{ batch: true }` option to receive all\n changes since the last callback in a single object:\n\n ```js\n up.watch('form', { batch: true }, function(diff, options) {\n for (let name in diff) {\n let value = diff[name]\n console.log('The value of %o is now %o', name, value)\n }\n })\n ```\n\n @function up.watch\n\n @section Observed events\n @param {Element|jQuery} element\n The form field that will be watched.\n\n You can pass a field, a `<form>` or any container that contains form fields.\n The callback will be run if any of the contained fields change.\n\n @param {string|Array<string>} [options.event='input']\n The types of event to observe.\n\n See [which events to watch](/learn/watch-options#events).\n\n @param {number} [options.delay=0]\n The number of milliseconds to wait between an observed event and running the callback.\n\n See [debouncing callbacks](/learn/watch-options#debouncing).\n\n @section Callback\n @param {boolean} [options.batch=false]\n If set to `true`, the callback will receive multiple\n detected changes in a [single diff object as its argument](#batching-changes).\n\n The object's keys are the names of the changed fields.\n The object's values are the values of the changed fields.\n\n @experimental\n\n @param {Function(value, name, options): Promise} callback\n The callback to run when the field's value changes.\n\n The callback is called with [arguments](#callback-arguments) that\n describe the change.\n\n An [async callback function must return a promise](#async-callbacks) that settles when\n the callback completes.\n\n @return {Function()}\n A destructor function that unsubscribes the watcher when called.\n\n Watching will stop automatically when the form is [destroyed](/api/up.destroy).\n\n @stable\n @signature\n */\n function watch(...args) {\n let [root, options, callback] = u.args(args, 'val', 'options', 'callback')\n\n root = up.element.get(root) // unwrap jQuery\n callback ||= watchCallbackFromElement(root) || up.fail('No callback given for up.watch()')\n\n const watcher = new up.FieldWatcher(root, options, callback)\n\n return watcher.start()\n }\n\n function watchCallbackFromElement(element) {\n return up.script.callbackAttr(element, 'up-watch', { argNames: ['value', 'name', 'options'] })\n }\n\n /*-\n Automatically submits a form when a field changes.\n\n ## Example\n\n We have a search form like this:\n\n ```html\n <form method=\"GET\" action=\"/search\">\n <input type=\"search\" name=\"query\">\n <input type=\"checkbox\" name=\"archive\"> Include archived\n </form>\n ```\n\n To cause the form to automatically submit when either field is changed,\n call `up.autosubmit()`:\n\n ```js\n up.autosubmit(form)\n ```\n\n @function up.autosubmit\n\n @section Observed events\n @param {string|Element|jQuery} element\n The field or form to watch.\n\n @param options.event\n @like up.watch\n\n @param options.delay\n @like up.watch\n\n @section Render options\n @param {Object} [options]\n Additional [render options](/api/up.render#parameters) to use when the form is submitted.\n\n Unpoly will parse render options from the watched form's attributes.\n You may pass this additional `options` object to [supplement or override](/learn/attributes-and-options#options)\n options parsed from attributes. See `[up-submit]` for a list of supported attributes.\n\n Common options are documented below, but most [options for `up.submit()`](/api/up.submit#parameters) may be used.\n\n @section Request\n @include up.submit/request\n\n @section Loading state\n @include up.render/loading-state\n\n @return {Function()}\n A destructor function that stops auto-submitting when called.\n\n Auto-submitting will stop automatically when the observed fields are removed from the DOM.\n\n @stable\n */\n function autosubmit(target, options = {}) {\n const onChange = (_diff, renderOptions) => submit(target, renderOptions)\n return watch(target, { logPrefix: 'up.autosubmit()', ...options, batch: true }, onChange)\n }\n\n function getGroupSelectors() {\n return up.migrate.migratedFormGroupSelectors?.() || config.groupSelectors\n }\n\n /*-\n Returns the [form group](/api/up-form-group) for the given element.\n\n By default, a form group is a container with an `[up-form-group]` attribute, a `<fieldset>` or a `<label>`.\n This can be configured in `up.form.config.groupSelectors`.\n\n Form groups may be nested. This function returns the [closest](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest) group around the given element.\n If no closer group is found, the `<form>` element is returned.\n\n ## Example\n\n This is a form with two groups:\n\n ```html\n <form>\n <fieldset>\n <label for=\"email\">E-mail</label>\n <input type=\"text\" name=\"email\" id=\"email\">\n </fieldset>\n <fieldset>\n <label for=\"password\">Password</label>\n <input type=\"text\" name=\"password\" id=\"password\">\n </fieldset>\n </form>\n ```\n\n We can now retrieve the form group for any element in the form:\n\n ```js\n let passwordField = document.querySelector('#password')\n let group = up.form.group(passwordField) // returns second <fieldset>\n ```\n\n @function up.form.group\n @param {Element} element\n The element for which to find a form group.\n @param {boolean} [options.targetable=false]\n Only return a group that Unpoly can target with a selector.\n @return {Element|undefined}\n The closest form group around the given element.\n\n If no better group can be found, the `<form>` element is returned.\n\n If the element is not within a `<form>`, returns `undefined`.\n\n With `{ targetable: true }`, returns `undefined` when no group around the element can be targeted.\n @experimental\n */\n function findGroup(field, { targetable = false } = {}) {\n return findGroupSolution(field, { targetable })?.element\n }\n\n /*-\n Marks this element as a form group, which (usually) contains a label, input and error message.\n\n @learn-ref validation#form-groups\n\n You are not required to use form groups to [submit forms through Unpoly](/learn/submitting-forms).\n However, structuring your form into groups will help Unpoly make smaller changes to the DOM when\n working with complex forms. For instance, when [validating](/learn/validation#validating-after-changing-a-field) a field,\n Unpoly will re-render the [closest](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest)\n form group around that field.\n\n By default Unpoly will also consider a `<fieldset>` or `<label>` around a field to be a form group.\n You can configure this in `up.form.config.groupSelectors`.\n\n ## Example\n\n Many apps use form groups to wrap a label, input field, error message and help text:\n\n ```html\n <form up-validate>\n <div up-form-group>\n <label for=\"email\">E-mail</label>\n <input type=\"text\" name=\"email\" id=\"email\">\n </div>\n <div up-form-group>\n <label for=\"password\">Password</label>\n <input type=\"text\" name=\"password\" id=\"password\">\n <div class=\"error\">Must be 8 characters or longer</div>\n </div>\n </form>\n ```\n\n The form above also uses the `[up-validate]` attribute to [validate](/learn/validation#validating-after-changing-a-field)\n form groups after changing a field:\n\n - After changing the *E-mail* field, Unpoly will validate the `[up-form-group]:has(#email)` target.\n - After changing the *Password* field, Unpoly will validate the `[up-form-group]:has(#password)` target.\n\n @selector [up-form-group]\n @stable\n */\n\n // Returns the closest group around the given field, with a target selector whenever we can derive one.\n // With { targetable: true } we skip groups for which we cannot derive a target.\n function findGroupSolution(field, { targetable }) {\n return u.findResult(getGroupSelectors(), function(groupSelector) {\n let group = field.closest(groupSelector)\n if (group) {\n let strongDerivedGroupTarget = up.fragment.tryToTarget(group, { strong: true })\n let goodDerivedFieldTarget = up.fragment.tryToTarget(field)\n // Most forms have multiple groups with no identifying attributes, e.g. <div up-form-group>.\n // Hence we use a :has() selector to identify the form group by the selector\n // of the contained field, which usually has an identifying [name] or [id] attribute.\n let groupHasFieldTarget = goodDerivedFieldTarget && (group !== field) && `${groupSelector}:has(${goodDerivedFieldTarget})`\n let target = strongDerivedGroupTarget || groupHasFieldTarget\n if (target || !targetable) {\n return {\n target,\n element: group,\n origin: field\n }\n }\n }\n })\n }\n\n\n /*-\n Renders a new form state from its current field values, to show validation errors or\n update [dependent elements](/learn/reactive-server-forms).\n\n Typical use cases are to [show validation errors](/learn/validation#validating-after-changing-a-field)\n after a field was changed or to update forms where one field depends on the value of another.\n\n @learn-ref reactive-server-forms\n\n `up.validate()` submits the given element's form with an additional `X-Up-Validate`\n HTTP header. Upon seeing this header, the server is expected to validate (but not commit)\n the form submission and render a new form state. See [this example](/api/up-validate#backend-protocol)\n for control flow on the server.\n\n To automatically update a form after a field was changed, use the `[up-validate]` attribute.\n You may combine `[up-validate]` and `up.validate()` within the same form. In order to reduce\n requests, their updates will be [batched together](#batching).\n\n ## Controlling what is updated\n\n `up.validate()` always submits the entire form with its current field values to the form's\n `[action]` path. Typically only a fragment of the form is updated with the response.\n This minimizes the chance for loss of transient state like scroll positions, cursor selection\n or user input while the request is in flight.\n\n Passing a form field will update the closest [form group](/api/up-form-group) around the field:\n\n ```js\n up.validate('input[name=email]')\n ```\n\n If the given field has an `[up-validate]` attribute with a custom target selector, that selector\n will be updated instead.\n\n You may also update arbitrary elements within the form:\n\n ```js\n up.validate('.preview')\n ```\n\n You may also choose to re-render an entire form.\n In this case it is recommended to [disable fields](/learn/disabling-forms) while rendering.\n This prevents the loss of user input made while the request is in flight:\n\n ```js\n up.validate('form', { disable: true })\n ```\n\n ## Multiple validations are batched together {#batching}\n\n In order to reduce requests, multiple calls of `up.validate()` within the same\n [task](https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/) are consolidated into a single request.\n For instance, the following will send a single request [targeting](/learn/targeting-fragments) `.foo, .bar`:\n\n ```js\n up.validate('.foo')\n up.validate('.bar')\n ```\n\n Validating the same target multiple times will also only send a single request.\n For instance, the following will send a single request targeting `.qux`:\n\n ```js\n up.validate('.qux')\n up.validate('.qux')\n ```\n\n When one of your target elements is an ancestor of another target, Unpoly will only request the ancestor.\n For instance, the following would send a single request targeting `form`:\n\n ```js\n up.validate('input[name=email]')\n up.validate('form')\n ```\n\n When a validation request is already in flight,\n additional validations are [queued](/learn/reactive-server-forms#race-conditions).\n When the current request has loaded, queued validations are batched using\n the same rules as outlined above.\n\n ### Batching with multiple URLs {#batching-multiple-urls}\n\n Even with multiple URLs, only a single validation request per form will be in flight at the same time.\n\n Batches will be partitioned by URL. Batch requests are sent in sequence, with no concurrency.\n Additional validations are queued until the current batch request has loaded.\n\n For instance, let's assume the following four validations are queued:\n\n ```js\n up.validate('.foo', { url: '/path1' })\n up.validate('.bar', { url: '/path2' })\n up.validate('.baz', { url: '/path1' })\n up.validate('.qux', { url: '/path2' })\n ```\n\n This will send a sequence of two requests:\n\n 1. A request to `/path1` targeting `.foo, .baz`. The other validations are queued.\n 2. Once that request finishes, a second request to `/path2` targeting `.bar, .qux`.\n\n ### Disabling batching {#batching-disable}\n\n By disabling batching, Unpoly will send individual requests for each call to `up.validate()`\n and for each change of an `[up-validate]` field. Additional validations are queued until the\n current validation request has loaded.\n\n There are multiple ways to disable batching:\n\n - Globally by configuring `up.form.config.validateBatch = false`.\n - Setting an [`[up-validate-batch]`](/api/up-validate) attribute on the element with `[up-validate]`.\n - Passing an option `up.validate(element, { batch: false })`.\n\n ## Preventing race conditions\n\n Unpoly sends one validation request per form at a time and batches the rest.\n\n See [preventing race conditions](/learn/reactive-server-forms#race-conditions) for details.\n\n @function up.validate\n\n @section Targeting\n @param {string|Element|jQuery} element\n The field or fragment that should be re-rendered on the server.\n\n See [controlling what is updated](#controlling-what-is-updated).\n\n @param {string} [options.target=element]\n The [target selector](/learn/targeting-fragments) to re-render.\n\n By default, the given `element` will be rendered.\n If `element` is a field, its form group or `[up-validate]` target will be rendered.\n\n @param {boolean} [options.formGroup = true]\n Whether, when a field is given as `element`,\n the field's closest [form group](/api/up-form-group) should be targeted.\n\n @param {Element} [options.origin=element]\n The element or field that caused this validation pass.\n\n The names of all fields contained within the origin will be passed as an `X-Up-Validate` request header.\n\n @section Render options\n @param {Object} [options]\n Additional [render options](/api/up.render#parameters) to use when re-rendering the targeted\n fragment.\n\n Common options are documented below, but most [options for `up.submit()`](/api/up.submit#parameters) may be used.\n\n Note that validation requests may be [batched together](/api/up.validate#batching).\n In this case Unpoly will try to merge render options where possible (e.g. `{ headers, target }`).\n When a render option cannot be merged (e.g. `{ scroll }`),\n the option from the last validation in the batch will be used.\n\n @section Client state\n @mix up.reload/client-state\n\n @section Request\n @param {string} options.url\n The URL to which to submit the validation request.\n\n By default, Unpoly will use the form's `[action]` attribute.\n\n See [Validating against other URLs](/api/up-validate#urls).\n\n @param {string} options.method\n The method to use for submitting the validation request.\n\n By default, Unpoly will use the form's `[method]` attribute.\n\n See [Validating against other URLs](/api/up-validate#urls).\n\n @param {boolean} [options.batch=true]\n Whether to [consolidate multiple validations into a single request](/api/up.validate#batching).\n\n Defaults to `up.form.config.validateBatch`, which defaults to `true`.\n\n @param options.params\n @like up.submit\n\n @param options.headers\n @like up.submit\n\n @section Loading state\n @mix up.submit/loading-state\n\n @return {Promise<up.RenderResult>}\n A promise that fulfills when the server-side validation is received and the form was updated.\n\n @stable\n */\n function validate(...args) {\n let options = parseValidateArgs(...args)\n let form = getForm(options.origin)\n let validator = getFormValidator(form)\n return validator.validate(options)\n }\n\n /*-\n Parses the many signatures of `up.validate()`.\n\n See specs for examples.\n\n @function up.form.parseValidateArgs\n @internal\n */\n function parseValidateArgs(originOrTarget, ...args) {\n const options = u.extractOptions(args)\n\n if (options.origin) {\n options.target ||= up.fragment.toTarget(originOrTarget)\n } else {\n options.origin ||= up.fragment.get(originOrTarget)\n }\n\n return options\n }\n\n /*-\n This event is emitted before a form is being [validated](/api/up-validate).\n\n @learn-ref validation\n\n Listeners can [inspect](#properties), [modify](#event.renderOptions), or [prevent](#event.preventDefault)\n the render pass that will load and show the validation results.\n\n @event up:form:validate\n\n @section Validation\n\n @param {Element} event.target\n The form that is being validated.\n\n @param {Element} event.form\n The form that is being validated.\n\n @param {up.Params} event.params\n The [form parameters](/api/up.Params) that will be sent as the form's request payload.\n\n Listeners may inspect and modify params before they are sent.\n Note that the request may be a [batch of multiple validations](/api/up.validate#batching).\n\n @param {List<Element>} event.fields\n The [form fields](/api/up.form.fields) that triggered this validation pass.\n\n When multiple fields are validating within the same [task](https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/),\n Unpoly will make a [single validation request with multiple targets](/api/up.validate#batching).\n\n The names of the validating fields are also sent\n as an `X-Up-Validate` request header.\n\n @experimental\n\n @section Render pass\n\n @param {Object} event.renderOptions\n An object with [render options](/api/up.render#parameters) for the fragment update\n that will show the validation results.\n\n Listeners may inspect and modify these options.\n\n Note that the request may be a [batch of multiple validations](/api/up.validate#batching).\n In that case `event.renderOptions` will contain the merged render options\n for every targeted fragment. Unpoly will try to merge render options where possible (e.g. `{ headers, target }`).\n When a render option cannot be merged (e.g. `{ scroll }`),\n the option from the last validation in the batch will be used.\n\n @param event.preventDefault()\n Prevents the validation request from being sent to the server.\n\n @stable\n */\n\n function getForm(element) {\n return getLiteralForm(element) || getAssociatedForm(element) || getClosestForm(element)\n }\n\n function getLiteralForm(element) {\n // We're making a lot of calls to getForm() and getRegion().\n // For performance reasons we want to return a literal <form> without further DOM look-ups.\n if (element instanceof HTMLFormElement) return element\n }\n\n function getClosestForm(element) {\n // Return the closest form for vanilla fields, or any non-field element within a form (like a form group).\n // Like the browser, a [form] attribute decides alone, even when it matches no form in our layer.\n if (!element.hasAttribute('form')) return element.closest('form')\n }\n\n function getAssociatedForm(element) {\n // We support fields without a <form> ancestor, which are associated via an [form] attribute.\n // We could use element's { form } property, but that is not layer-aware. It will always return\n // the first form with a matching [id].\n let formID = element.getAttribute('form')\n if (formID) {\n let selector = 'form' + e.idSelector(formID)\n return up.fragment.get(selector, { layer: element })\n }\n }\n\n function getFormValidator(form) {\n return form.upFormValidator ||= setupFormValidator(form)\n }\n\n function setupFormValidator(form) {\n const validator = new up.FormValidator(form)\n const stop = validator.start()\n up.destructor(form, stop)\n return validator\n }\n\n // Alternative to getForm() which always returns a likely scope:\n //\n // (1) Called with an origin within a form => Returns the closest form\n // (2) Called with an origin outside a form => Returns the origin's layer element\n // (3) Called without an origin element => Returns the current layer element\n //\n // Does not support a selector string as a first argument. Only works with Element arguments.\n function getRegion(origin) {\n return getOriginRegion(origin) || up.layer.current.element\n }\n\n function getOriginRegion(origin) {\n if (origin) {\n return getForm(origin) || up.layer.closestLayerElement(origin)\n }\n }\n\n /*-\n @function up.form.trackFields\n @param {Element} root\n A form or a container element within a form.\n @param {Function(Element): boolean} options.guard\n Optional, additional condition whether a field matches.\n @param {Function(Element): Function(Element)} callback\n A callback that is called when we discover a new match.\n The callback can return another function that is called when that field no longer matches.\n @internal\n */\n const trackFields = up.mockable(function(...args) {\n let [root, { guard }, callback] = u.args(args, 'val', 'options', 'callback')\n\n let selectFn = function() {\n // A detached root has no fields left to track.\n if (!root.isConnected) return []\n\n let region = getRegion(root)\n\n // Only look at fields that can belong to the root, instead of every field on the page.\n // With many trackers (e.g. many small forms with [up-autosubmit]) the latter would cost\n // trackers × fields after every render pass.\n return u.filter(findFields(root), function(field) {\n return (getRegion(field) === region) // will also match external fields with [form]\n && (!guard || guard(field)) // user-provided condition\n })\n }\n\n return up.fragment.trackSelector(selectFn, callback)\n })\n\n function focusedField() {\n return u.presence(document.activeElement, isField)\n }\n\n /*-\n Returns whether the given form will be [submitted](/learn/submitting-forms) through Unpoly\n instead of making a full page load.\n\n By default, Unpoly will submit forms if the element has\n one of the following attributes:\n\n - [`[up-submit]`](/api/up-submit)\n - [`[up-target]`](/api/up-follow#up-target)\n - [`[up-layer]`](/api/up-follow#up-layer)\n - `[up-transition]`\n\n To consider other selectors to be submittable, see `up.form.config.submitSelectors`.\n\n @function up.form.isSubmittable\n @param {Element|jQuery|string} form\n The form to check.\n @return {boolean}\n Whether the form will be submitted through Unpoly.\n @stable\n */\n function isSubmittable(form) {\n form = up.fragment.get(form)\n return config.matches(form, 'submitSelectors')\n }\n\n /*-\n Submits this form via JavaScript and updates a fragment with the server response.\n\n The server must render an element matching the [target selector](/learn/targeting-fragments) from the `[up-target]` attribute.\n A matching element in the current page is then swapped with the new element from the server response.\n The response may include other HTML (even an entire HTML document), but only the matching element will be updated.\n\n @learn-ref submitting-forms\n\n ## Example\n\n This will submit the form in-page and update a fragment matching `#success`:\n\n ```html\n <form method=\"post\" action=\"/users\" up-submit up-target=\"#success\"> <!-- mark: up-submit -->\n ...\n </form>\n\n <div id=\"success\">\n <!-- chip: Content will appear here -->\n </div>\n ```\n\n See [Submitting forms](/learn/submitting-forms) for elaborate examples.\n\n ## Input validation\n\n When the form could not be submitted due to invalid user input,\n Unpoly can re-render the form with validation errors.\n\n See [Validating forms](/learn/validation) for details and examples.\n\n ## Short notation\n\n You may omit the `[up-submit]` attribute if the form has one of the following attributes:\n\n - [`[up-target]`](#up-target)\n - [`[up-layer]`](#up-layer)\n - [`[up-transition]`](#up-transition)\n\n @selector [up-submit]\n\n @params-note\n Most of these attributes can also be [set on the submit button](/learn/submitting-forms#submit-buttons).\n\n @section Targeting\n @mix up-follow/targeting\n @param up-target\n The [target selector](/learn/targeting-fragments) to update for a successful form submission.\n\n @param [up-fail-target=form]\n The [target selector](/learn/targeting-fragments) to update when the server responds with an error code.\n\n By default, error responses will update the `<form>` element itself.\n\n See [[error-responses]].\n\n @section Navigation\n @mix up-follow/navigation\n\n @section Request\n @param action\n Where to send the form data when the form is submitted.\n\n @param method\n The HTTP method to use for the request.\n\n The value is case-insensitive.\n\n You can also use methods that would not be allowed on a `<form>` element,\n such as `'patch'` or `'delete'`. These will be [wrapped in a POST request](/api/up.network.config#config.wrapMethod).\n\n @mix up-follow/request-extras\n @param up-params\n Additional [Form parameters](/api/up.Params) that should be sent as the request's\n [query string](https://en.wikipedia.org/wiki/Query_string) or payload.\n\n The given value will be added to params [parsed](/api/up.Params.fromForm)\n from the form's input fields. If a param with the same name already\n existed in the form, it will be deleted and overridden with the given value.\n\n @section Layer\n @mix up-follow/layer\n\n @section History\n @mix up-follow/history\n\n @section Animation\n @mix up-follow/motion\n\n @section Caching\n @mix up-follow/caching\n\n @section Scrolling\n @mix up-follow/scrolling\n\n @section Focus\n @mix up-follow/focus\n\n @section Loading state\n @mix up-follow/loading-state\n @param up-disable\n [Disables form controls](/learn/disabling-forms) while the request is loading.\n\n The values of disabled fields will still be included in the submitted form params.\n\n @section Client state\n @mix up-follow/client-state\n\n @section Lifecycle hooks\n @mix up-follow/lifecycle-hooks\n\n @stable\n @signature\n */\n\n up.on('submit', config.selectorFn('submitSelectors'), function(event, form) {\n // We pass on the event.submitter prop as a { submitButton } prop.\n // Otherwise submitOptions() would default to the first submit button.\n const submitButton = u.presence(event.submitter, isSubmitButton)\n\n // Allow individual submit buttons from opting out of Unpoly handling.\n if (submitButton?.getAttribute('up-submit') === 'false') return\n\n // Don't handle a form that's already been handled by foreign code.\n if (event.defaultPrevented) return\n\n up.event.halt(event, { log: true })\n\n // The browser resolves a [form] attribute across the whole page. A button or a field (pressing Enter)\n // can then submit a form in another layer: when two layers have a form with the same ID, or when\n // [form] refers to a form that only exists in another layer. Layers don't share forms.\n for (let control of [event.submitter, document.activeElement]) {\n if (control && control.form === form && getForm(control) !== form) {\n up.fail('Prevented %o from submitting a form in another layer ([form=\"%s\"])', control, control.getAttribute('form'))\n }\n }\n\n up.error.muteUncriticalRejection(submit(form, { submitButton }))\n })\n\n /*-\n Controls the state of another element when this field changes.\n\n @learn-ref switching-form-state\n\n ## Example\n\n The controlling form field gets an `[up-switch]` attribute with a selector for the elements to show or hide:\n\n ```html\n <select name=\"level\" up-switch=\".level-dependent\"> <!-- mark: up-switch=\".level-dependent\" -->\n <option value=\"beginner\">beginner</option>\n <option value=\"intermediate\">intermediate</option>\n <option value=\"expert\">expert</option>\n </select>\n ```\n\n The target elements can choose how to alter their state after the controlling field changes.\n For example, the `[up-show-for]` will show an element while the field has one of the given values:\n\n ```html\n <div class=\"level-dependent\" up-show-for=\"beginner\"> <!-- mark: up-show-for=\"beginner\" -->\n shown for beginner level, hidden for other levels\n </div>\n ```\n\n There are other attributes like `[up-hide-for]`, `[up-disable-for]` or `[up-enable-for]`.\n You can also [implement custom switching effects](/learn/switching-form-state#custom-effects).\n\n @selector [up-switch]\n\n @section Dependencies\n @param up-switch\n A CSS selector for elements whose state depends on this field's value.\n\n @param [up-switch-region='form']\n A selector for the region in which elements are switched.\n\n By default all matching elements within the form are switched.\n You can expand or narrow the search scope by configuring a different selector.\n\n @section Observed events\n @param [up-watch-event='input']\n The type of event to watch.\n\n See [which events to watch](/learn/watch-options#events).\n\n Switching is never [debounced](/learn/watch-options#debouncing). `[up-switch]` ignores\n `[up-watch-delay]` and `up.form.config.watchInputDelay`, since its effects are applied on the client.\n\n @stable\n @signature\n */\n up.compiler('[up-switch]', (switcher) => {\n return new up.Switcher(switcher).start()\n })\n\n /*-\n When an `[up-switch]` field changes, this event is emitted on all dependent elements.\n\n You can listen to `up:form:switch` to implement [custom switching effects](/learn/switching-form-state#custom-effects).\n\n @learn-ref switching-form-state#custom-effects\n\n ## Event targets\n\n This event is *not* emitted on the switching field. Instead each element matching the switch selector will receive an `up:form:switch` event:\n\n ```html\n <!-- Switching field won't receive an event on change -->\n <select name=\"role\" up-switch=\".role-dependent\">\n <option value=\"trainee\">Trainee</option>\n <option value=\"manager\">Manager</option>\n </select>\n\n <!-- Dependent field will receive up:form:switch -->\n <input class=\"role-dependent\" name=\"department\">\n\n <!-- Dependent field will receive up:form:switch -->\n <input class=\"role-dependent\" name=\"budget\">\n ```\n\n ## Timing\n\n The `up:form:switch` is emitted at the following times:\n\n - when the switching field is initially rendered.\n - after a switching field has changed its value.\n - after a switching checkbox was checked or unchecked.\n - when a new selector match enters the form.\n - when a [kept](/api/up-keep) `[up-switch]` field is transported to a new form.\n\n @event up:form:switch\n\n @param {Element} event.target\n The dependent element matching the `[up-switch]` selector.\n\n If multiple elements match the selector, this event is emitted once for\n each match.\n\n @param {Element} event.field\n The controlling `[up-switch]` field.\n\n @param {Array<string>} event.fieldTokens\n An array describing the state of the controlling `[up-switch]` field.\n\n The array contains:\n\n - The field's value.\n - A pseudo-value [`:blank` or `:present`](/learn/switching-form-state#presence), depending on the field's value.\n - For [checkboxes](/learn/switching-form-state#checkboxes), a pseudo-value `:checked` or `:unchecked`.\n\n @experimental\n\n @stable\n */\n\n /*-\n Only shows this element if an input field with `[up-switch]` has one of the given values.\n\n The element will be hidden for all other values.\n\n @learn-ref switching-form-state\n\n @selector [up-show-for]\n @param [up-show-for]\n A list of input values for which this element should be shown.\n\n @include switch-token-serialization\n @stable\n */\n\n /*-\n Hides this element while an input field with `[up-switch]` has one of the given values.\n\n The element will be shown for all other values.\n\n @learn-ref switching-form-state#toggle\n\n @selector [up-hide-for]\n @param [up-hide-for]\n A list of input values for which this element should be hidden.\n\n @include switch-token-serialization\n @stable\n */\n\n /*-\n Disables this element while an input field with `[up-switch]` has one of the given values.\n\n The element will be enabled for all other values.\n\n @learn-ref switching-form-state#disable\n\n @selector [up-disable-for]\n @param [up-disable-for]\n A list of input values for which this element should be disabled.\n\n @include switch-token-serialization\n @stable\n */\n\n /*-\n Enables this element while an input field with `[up-switch]` has one of the given values.\n\n The element will be disabled for all other values.\n\n @learn-ref switching-form-state#disable\n\n @selector [up-enable-for]\n @param [up-enable-for]\n A list of input values for which this element should be enabled.\n\n @include switch-token-serialization\n @stable\n */\n\n /*-\n Watches form fields and runs a callback when a value changes.\n\n @learn-ref submitting-forms#autosubmit\n\n Only fields with a `[name]` attribute can be watched.\n\n ## Example\n\n The following would log a message whenever the `<input>` changes:\n\n ```html\n <input name=\"query\" up-watch=\"console.log('New value', value)\">\n ```\n\n ## Callback context\n\n The script given to `[up-watch]` runs with the following context:\n\n @include watch-callback-arguments\n\n ## Watching multiple fields\n\n You can set `[up-watch]` on any element to observe all contained fields.\n The `name` argument contains the name of the field that was changed:\n\n ```html\n <form>\n <div up-watch=\"console.log(`New value of ${name} is ${value}`)\">\n <input type=\"email\" name=\"email\">\n <input type=\"password\" name=\"password\">\n </div>\n\n <!-- This field is outside the [up-watch] container and will not be watched -->\n <input type=\"text\" name=\"screen-name\">\n </form>\n ```\n\n You may also set `[up-watch]` on a `<form>` element to watch *all* fields in a form:\n\n ```html\n <form up-watch=\"console.log(`New value of ${name} is ${value}`)\">\n <input type=\"email\" name=\"email\">\n <input type=\"password\" name=\"password\">\n <input type=\"text\" name=\"screen-name\">\n </form>\n ```\n\n ## Watching radio buttons\n\n Multiple radio buttons with the same `[name]` produce a single value for the form.\n\n To watch a group of radio buttons, use the `[up-watch]` attribute on an\n element that contains all radio button elements with a given name:\n\n ```html\n <div up-watch=\"console.log('New value is', value)\">\n <input type=\"radio\" name=\"format\" value=\"html\"> HTML format\n <input type=\"radio\" name=\"format\" value=\"pdf\"> PDF format\n <input type=\"radio\" name=\"format\" value=\"txt\"> Text format\n </div>\n ```\n\n ## Async callbacks\n\n When your callback does async work (like fetching data over the network), it must return a promise\n that settles once the work concludes:\n\n ```html\n <input name=\"query\" up-watch=\"return asyncWork()\"> <!-- mark: return -->\n ```\n\n Unpoly will guarantee that only one async callback is running concurrently.\n If the form is changed while an async callback is still processing, Unpoly will wait\n until the callback concludes and then run it again with the latest field values.\n\n @selector [up-watch]\n\n @section Callback\n @param up-watch\n The code to run when any field's value changes.\n\n See [callback context](#callback-context).\n\n @section Observed events\n @mix up-watch/observed-events\n\n @stable\n */\n\n up.attribute('up-watch', (formOrField) => watch(formOrField))\n\n /*-\n Renders a new form state when a field changes, to [show validation errors](/learn/validation#validating-after-changing-a-field) or\n update [dependent elements](/learn/reactive-server-forms).\n\n When a form field with an `[up-validate]` attribute is changed, the form is submitted to the server\n which is expected to render a new form state from its current field values.\n The [form group](/api/up-form-group) around the changed field is updated with the server response.\n This quickly signals whether a change is valid,\n without the need to scroll for error messages or to backtrack to\n fields completed earlier.\n\n @learn-ref validation\n @learn-ref reactive-server-forms\n\n > [NOTE]\n > `[up-validate]` is a tool to implement highly dynamic forms that must update\n > *as the user is completing fields*.\\\n > If you only need to [validate forms after submission](/learn/validation#validating-after-submission),\n > you don't need `[up-validate]`.\n\n ## Marking fields for validation\n\n Let's look at a standard registration form that asks for an e-mail and password.\n The form is organized into [form groups](/api/up-form-group) of labels, inputs and\n an optional error message:\n\n ```html\n <form method=\"post\" action=\"/users\">\n\n <fieldset> <!-- mark: <fieldset> -->\n <label for=\"email\">E-mail</label>\n <input type=\"text\" id=\"email\" name=\"email\">\n </fieldset> <!-- mark: </fieldset> -->\n\n <fieldset> <!-- mark: <fieldset> -->\n <label for=\"password\">Password</label>\n <input type=\"password\" id=\"password\" name=\"password\">\n </fieldset> <!-- mark: </fieldset> -->\n\n <button type=\"submit\">Register</button>\n\n </form>\n ```\n\n We have some data constraints that we want to validate as the user is filling in fields:\n\n - When the user changes the `email` field, we want to validate that the e-mail address\n is formatted correctly and is still available.\n - When the user changes the `password` field, we want to validate\n the minimum password length.\n\n If validation fails, we want to show validation errors *as soon as the user blurs the field*.\n\n We can implement this by giving both fields an `[up-validate]` attribute:\n\n ```html\n <form method=\"post\" action=\"/users\">\n\n <fieldset>\n <label for=\"email\">E-mail</label>\n <input type=\"text\" id=\"email\" name=\"email\" up-validate> <!-- mark: up-validate -->\n </fieldset>\n\n <fieldset>\n <label for=\"password\">Password</label>\n <input type=\"password\" id=\"password\" name=\"password\" up-validate> <!-- mark: up-validate -->\n </fieldset>\n\n <button type=\"submit\">Register</button>\n\n </form>\n ```\n\n Whenever a field with `[up-validate]` changes, the form is submitted to its `[action]` path\n with an additional `X-Up-Validate` HTTP header.\n\n Read on to learn [how a validation request is sent to the server](#backend-protocol),\n and\n [how the server response is displayed](#how-validation-results-are-displayed).\n\n ## Backend protocol\n\n When the user changes the `email` field in the registration form above,\n the following request will be sent:\n\n ```http\n POST /users HTTP/1.1\n X-Up-Validate: email\n X-Up-Target: fieldset:has(#email)\n Content-Type: application/x-www-form-urlencoded\n\n email=foo%40bar.com&password=secret\n ```\n\n Upon seeing an `X-Up-Validate` header, the server is expected to validate (but not commit)\n the form submission and render a new form state from the request parameters.\n\n This requires a change in the backend code that handles the form's `[action]` path.\n Until now, the backend only had to handle two cases:\n\n 1. The form was submitted with valid data. We create a new account and sign in the user.\n 2. The form submission failed due to an invalid email or password. We re-render the form with error messages.\n\n A [Ruby on Rails](https://rubyonrails.org/) implementation would look like this:\n\n ```ruby\n class UsersController < ApplicationController\n\n def create\n # Instantiate model from request parameters\n user_params = params.permit(:email, :password)\n @user = User.new(user_params)\n\n if @user.save\n # Form is submitted successfully\n sign_in @user\n else\n # Submission failed\n render 'form', status: :unprocessable_entity\n end\n\n end\n\n end\n ```\n\n The examples use Ruby on Rails, but work similarly with any other backend.\n\n To honor the validation protocol, our backend needs to handle a third case:\n\n <ol start=\"3\">\n <li>When seeing an <code>X-Up-Validate</code> header, render a new form state from request parameters</li>\n </ol>\n\n In our example backend above, this change could look like this:\n\n ```ruby\n class UsersController < ApplicationController\n\n def create\n # Instantiate model from request parameters\n user_params = params.permit(:email, :password)\n @user = User.new(user_params)\n\n if request.headers['X-Up-Validate'] # mark-line\n @user.validate # mark-line\n render 'form' # mark-line\n elsif @user.save\n # Form is submitted successfully\n sign_in @user\n else\n # Submission failed\n render 'form', status: :unprocessable_entity\n end\n\n end\n\n end\n ```\n\n > [TIP]\n > If you're using Python with Django, you may find the [`django-forms-dynamic`](https://github.com/dabapps/django-forms-dynamic)\n > package useful to implement this pattern.\n\n The server is free to respond with any HTTP status code, regardless of the validation result.\n Unpoly will always consider a validation request to be successful, even if the\n server responds with a non-2xx status code.\n\n Upon seeing an `X-Up-Validate` header, the server now renders a new form state from request parameters,\n showing eventual validation errors and updating [dependent elements](/learn/reactive-server-forms):\n\n ```html\n <form method=\"post\" action=\"/users\">\n\n <fieldset>\n <label for=\"email\">E-mail</label>\n <input type=\"text\" id=\"email\" name=\"email\" value=\"foo@bar.com\" up-validate>\n <div class=\"error\">E-mail has already been taken!</div> <!-- mark-line -->\n </fieldset>\n\n <fieldset>\n <label for=\"password\">Password</label>\n <input type=\"password\" id=\"password\" name=\"password\" value=\"secret\" up-validate>\n <div class=\"error\">Password is too short!</div> <!-- mark-line -->\n </fieldset>\n\n </form>\n ```\n\n ## How validation results are displayed\n\n `[up-validate]` always submits the entire form with its current field values to the form's\n `[action]` path. Typically, only a fragment of the form is updated with the response.\n This minimizes the chance for loss of transient state like scroll positions, cursor selection,\n or user input while the request is in flight.\n\n By default, Unpoly will only update the closest [form group](/api/up-form-group)\n around the validating field. In the [example above](#marking-fields-for-validation),\n after changing the `email` field, only the `<fieldset>` around the field will be updated.\n\n If the form is not structured into groups, the entire\n form will be updated.\n\n\n ### Updating a different fragment {#target}\n\n If you don't want to update the field's form group, you can set the `[up-validate]`\n attribute to any [target selector](/learn/targeting-fragments):\n\n ```html\n <input name=\"email\" up-validate=\".email-errors\"> <!-- mark: up-validate=\".email-errors\" -->\n <div class=\"email-errors\"></div>\n ```\n\n You may [update multiple fragments](/learn/targeting-fragments#multiple)\n by separating their target selectors with a comma:\n\n ```html\n <input name=\"email\" up-validate=\".email-errors, .base-errors\"> <!-- mark: up-validate=\".email-errors, .base-errors\" -->\n ```\n\n To update another fragment *in addition* to the field's form group, include\n the group in the target list.\\\n You can refer to the changed field as `:origin`:\n\n ```html\n <fieldset>\n <input name=\"email\" up-validate=\"fieldset:has(:origin), .base-errors\"> <!-- mark: up-validate=\"fieldset:has(:origin), .base-errors\" -->\n </fieldset>\n ```\n\n ## Updating dependent elements\n\n The `[up-validate]` attribute is a useful tool to partially update a form\n when an element depends on the value of another field.\n\n See [Reactive server forms](/learn/reactive-server-forms) for more details and examples.\n\n\n ## Validating while typing\n\n @include validating-while-typing\n\n\n ## Preventing race conditions\n\n Unpoly sends one validation request per form at a time and batches the rest.\n\n See [preventing race conditions](/learn/reactive-server-forms#race-conditions) for more details.\n\n ## Validating multiple fields\n\n You can set `[up-validate]` on any element to validate *all contained fields* on change.\n\n In the [example above](#marking-fields-for-validation),\n instead of setting `[up-validate]` on each individual `<input>`, we can also set it on the `<form>`:\n\n ```html\n <form method=\"post\" action=\"/users\" up-validate> <!-- mark: up-validate -->\n\n <fieldset>\n <label for=\"email\">E-mail</label>\n <input type=\"text\" id=\"email\" name=\"email\"> <!-- chip \"will validate\" -->\n </fieldset>\n\n <fieldset>\n <label for=\"password\">Password</label>\n <input type=\"password\" id=\"password\" name=\"password\"> <!-- chip \"will validate\" -->\n </fieldset>\n\n <button type=\"submit\">Register</button>\n\n </form>\n ```\n\n You can also set `[up-validate]` on an intermediate container to only validate its children:\n\n\n ```html\n <form method=\"post\" action=\"/users\">\n\n <div up-validate> <!-- mark: up-validate -->\n <fieldset>\n <label for=\"email\">E-mail</label>\n <input type=\"text\" id=\"email\" name=\"email\"> <!-- chip \"will validate\" -->\n </fieldset>\n\n <fieldset>\n <label for=\"password\">Password</label>\n <input type=\"password\" id=\"password\" name=\"password\"> <!-- chip \"will validate\" -->\n </fieldset>\n </div>\n\n <fieldset>\n <label for=\"name\">Name</label>\n <input type=\"text\" id=\"name\" name=\"name\"> <!-- chip \"will NOT validate\" -->\n </fieldset>\n\n <button type=\"submit\">Register</button>\n\n </form>\n ```\n\n ### Validating radio buttons\n\n Multiple radio buttons with the same `[name]` produce a single value for the form.\n\n To validate a group of radio buttons, use the `[up-validate]` attribute on an\n element that contains all radio button elements with a given name:\n\n ```html\n <fieldset up-validate>\n <input type=\"radio\" name=\"format\" value=\"html\"> HTML format\n <input type=\"radio\" name=\"format\" value=\"pdf\"> PDF format\n <input type=\"radio\" name=\"format\" value=\"txt\"> Text format\n </fieldset>\n ```\n\n ## Validating against other URLs {#urls}\n\n By default, validation requests will use `[method]` and `[action]` attributes from the form element.\n\n You can validate against another server endpoint by setting `[up-validate-url]`\n and `[up-validate-method]` attributes:\n\n ```html\n <form method=\"post\" action=\"/order\" up-validate-url=\"/validate-order\"> <!-- mark: up-validate-url=\"/validate-order\" -->\n ...\n </form>\n ```\n\n To have individual fields validate against different URLs, you can also set `[up-validate-url]` on a field:\n\n ```html\n <form method=\"post\" action=\"/register\">\n <input name=\"email\" up-validate-url=\"/validate-email\"> <!-- mark: up-validate-url=\"/validate-email\" -->\n <input name=\"password\" up-validate-url=\"/validate-password\"> <!-- mark: up-validate-url=\"/validate-password\" -->\n </form>\n ```\n\n Multiple validations to the same URL will be [batched together](/api/up.validate#batching).\n\n\n ## Programmatic validation\n\n To update form fragments from your JavaScript, use the [`up.validate()`](/api/up.validate) function.\n You may combine `[up-validate]` and `up.validate()` within the same form. Their updates\n will be [batched together](/api/up.validate#batching) in order to\n [prevent race conditions](/learn/reactive-server-forms#race-conditions).\n\n\n @selector [up-validate]\n\n @section Targeting\n @param [up-validate]\n The [target selector](/learn/targeting-fragments) to update with the server response.\n\n Defaults to the closest [form group](/api/up-form-group) around the validating field.\n\n You can set another selector to [update a different fragment](/api/up-validate#target).\n To refer to the changed field, use the `:origin` pseudo-selector.\n\n @section Observed events\n @mix up-watch/observed-events\n @param [up-watch-event='change']\n\n @section Request\n @param [up-validate-url]\n The URL to which to submit the validation request.\n\n By default, Unpoly will use the form's `[action]` attribute.\n\n See [Validating against other URLs](/api/up-validate#urls).\n\n @param [up-validate-method]\n The method to use for submitting the validation request.\n\n By default, Unpoly will use the form's `[method]` attribute.\n\n See [Validating against other URLs](/api/up-validate#urls).\n\n @param [up-validate-params]\n @like [up-submit]/up-params\n @experimental\n\n @param [up-validate-headers]\n A [relaxed JSON](/api/relaxed-json) object with additional request headers.\n\n By default, Unpoly will send an `X-Up-Validate` header so the server\n can [distinguish the validation request from a regular form submission](#backend-protocol).\n\n @experimental\n\n @param [up-validate-batch='true']\n Whether to [consolidate multiple validations into a single request](/api/up.validate#batching).\n\n Defaults to `up.form.config.validateBatch`, which defaults to `true`.\n\n @section Loading state\n @mix up-watch/loading-state\n\n\n @stable\n @signature\n */\n up.compiler('[up-validate]', { rerun: true }, function(element) {\n // There are non-intuitive ways that an [up-validate] field can find its way into a <form>,\n // e.g. when the field is also [up-keep] and is transplanted into a new <form> later.\n let form = getForm(element)\n if (form) getFormValidator(form)\n })\n\n /*-\n Automatically submits a form when a field changes.\n\n @learn-ref submitting-forms#autosubmit\n\n ## Example\n\n The following would automatically submit the form when the `query` field is changed:\n\n ```html\n <form method=\"GET\" action=\"/search\">\n <input type=\"search\" name=\"query\" up-autosubmit> <!-- mark: up-autosubmit -->\n <input type=\"checkbox\" name=\"archive\"> Include archived\n </form>\n ```\n\n ## Auto-submitting multiple fields\n\n You can set `[up-autosubmit]` on any element to submit the form when a contained field changes.\n\n For instance, to auto-submit a form when any field changes, set the `[up-autosubmit]` on the `<form>` element:\n\n ```html\n <form method=\"GET\" action=\"/search\" up-autosubmit>\n <input type=\"search\" name=\"query\">\n <input type=\"checkbox\" name=\"archive\"> Include archived\n </form>\n ```\n\n ## Auto-submitting radio buttons\n\n Multiple radio buttons with the same `[name]` (a radio button group)\n produce a single value for the form.\n\n To auto-submit a group of radio buttons, use the `[up-autosubmit]` attribute on an\n element containing the entire button group:\n\n ```html\n <div up-autosubmit>\n <input type=\"radio\" name=\"format\" value=\"html\"> HTML format\n <input type=\"radio\" name=\"format\" value=\"pdf\"> PDF format\n <input type=\"radio\" name=\"format\" value=\"txt\"> Text format\n </div>\n ```\n\n @selector [up-autosubmit]\n\n @section Observed events\n @mix up-watch/observed-events\n\n @section Loading state\n @mix up-watch/loading-state\n\n @stable\n @signature\n */\n up.attribute('up-autosubmit', function(formOrField) {\n // An outer [up-autosubmit] already submits when our fields change, honoring our [up-watch-*] attributes.\n // A second watcher would submit the form twice for the same change.\n // We don't warn, since a partial with [up-autosubmit] may be rendered with or without an outer one.\n // An outer [up-autosubmit] of another form doesn't see our fields, e.g. for <input form=\"other-form\">.\n let outer = up.fragment.closest(formOrField.parentElement, '[up-autosubmit]:not([up-autosubmit=false])')\n if (outer && getForm(outer) === getForm(formOrField)) return\n\n return autosubmit(formOrField, { logPrefix: '[up-autosubmit]' })\n })\n\n return {\n config,\n submit,\n submitOptions,\n destinationOptions,\n submitButtonOverrides,\n watchOptions,\n validateOptions,\n isSubmittable,\n watch,\n validate,\n autosubmit,\n fieldSelector,\n anyButtonSelector,\n fields: findFields,\n trackFields,\n isField,\n submitButtons: findSubmitButtons,\n defaultSubmitButton,\n readFieldName,\n readFieldValue,\n readFieldDisabled,\n writeFieldDisabled,\n focusedField,\n // disableWhile,\n disableTemp: disableContainerTemp,\n prepareParamsReadTemp,\n setDisabled: setContainerDisabled,\n getDisablePreviewFn,\n // handleDisableOption,\n group: findGroup,\n groupSolution: findGroupSolution,\n groupSelectors: getGroupSelectors,\n get: getForm,\n getRegion,\n }\n})()\n\nup.submit = up.form.submit\nup.watch = up.form.watch\nup.autosubmit = up.form.autosubmit\nup.validate = up.form.validate\n","/*-\nFeatures to show which request is loading and which link leads to the current page.\n\nWhile a request is loading, the origin element that triggered it gets an `.up-active` class and the targeted fragments get `.up-loading`. For richer loading state, a link or form can show an `[up-placeholder]` inside the fragment it targets, or name an `[up-preview]` function registered with `up.preview()`. A preview can change the page in any way, up to rendering the expected result before the server confirms it. Every effect is reverted when the request ends.\n\nWithin an `[up-nav]` container, links pointing to the current location are marked `.up-current`, and the class moves as the user navigates.\n\n@learn-ref loading-state\n@learn-ref navigation-bars\n\n@module up.status\n*/\nup.status = (function() {\n\n const u = up.util\n const e = up.element\n\n /*-\n Sets default options for status effects.\n\n @property up.status.config\n\n @section Feedback classes\n @param {Array<string>} [config.activeClasses=['up-active']]\n An array of classes to set on [activated links or form elements](/api/up-active).\n\n @param {Array<string>} [config.loadingClasses=['up-loading']]\n An array of classes to set on [loading fragments](/api/up-loading).\n\n @param {Array<string>} [config.revalidatingClasses=['up-revalidating']]\n An array of classes to set on [revalidating fragments](/api/up-revalidating).\n\n @experimental\n\n @section Navigational containers\n @param {Array<string>} [config.navSelectors=['[up-nav]', 'nav']]\n An array of CSS selectors that match [navigational containers](/learn/navigation-bars).\n\n @param {Array<string>} [config.noNavSelectors=['[up-nav=false]']]\n Exceptions to `up.status.config.navSelectors`.\n\n @param {Array<string>} [config.currentClasses=['up-current']]\n An array of classes to set on [links that point the current location](/api/up-current).\n\n @stable\n */\n const config = new up.Config('up.status.config', () => ({\n currentClasses: ['up-current'],\n activeClasses: ['up-active'],\n loadingClasses: ['up-loading'],\n revalidatingClasses: ['up-revalidating'],\n navSelectors: ['[up-nav]', 'nav'],\n noNavSelectors: ['[up-nav=false]'],\n }))\n\n let namedPreviewFns = new up.Registry('preview')\n\n /*-\n Registers a named [preview](/learn/previews) function.\n\n Preview functions are applied using the `[up-preview]` attribute or [`{ preview }`](/api/up.render#options.preview) option.\n See [Previews](/learn/previews) for an overview.\n\n ## Example\n\n This preview sets a temporary `[app-loading=true]` attribute on the targeted fragment:\n\n ```js\n up.preview('loading-attr', function(preview) {\n preview.setAttrs({ 'app-loading': true })\n })\n ```\n\n The `preview` argument is an `up.Preview` instance that offers many utilities to make temporary changes.\n For example, you can use it to insert or move elements, add classes or set attributes.\n\n We can use the `loading-attr` preview in any link or form by setting an `[up-preview]` attribute:\n\n ```html\n <a href=\"/edit\" up-follow up-preview=\"loading-attr\">Edit page</a> <!-- mark: up-preview=\"loading-attr\" -->\n ```\n\n ## Accepting parameters {#parameters}\n\n Preview functions can accept an options object as a second argument.\n This is useful to define multiple variations of a preview effect.\n\n For example, the following preview accepts a `{ size }` option to show a spinner of varying size:\n\n ```js\n up.preview('spinner', function(preview, { size = 50 }) {\n let spinner = up.element.createFromSelector('img', { src: 'spinner.gif', width: size })\n preview.insert(preview.fragment, spinner)\n })\n ```\n\n From HTML you can append the options to the `[up-preview]` argument, after the preview name:\n\n ```html\n <a href=\"/edit\" up-follow up-preview=\"spinner { size: 100 }\">Edit page</a> <!-- mark: { size: 100 } -->\n ```\n\n @function up.preview\n @param {string} name\n The name of the preview.\n @param {Function(up.Preview, Object)} callback\n The function that applies the temporary page mutation.\n\n Any [preview parameters](#parameters) will be passed as a second argument.\n @stable\n */\n\n const SELECTOR_LINK = 'a, [up-href]'\n\n function linkCurrentURLs(link) {\n // Check if we have computed the URLs before.\n // Computation is sort of expensive (multiplied by number of links),\n // so we cache the results in a link property\n return link.upCurrentURLs ||= new up.LinkCurrentURLs(link)\n }\n\n function getNavLocations(nav) {\n let layerRef = e.attr(nav, 'up-layer') || 'origin'\n let layers = up.layer.getAll(layerRef, { origin: nav })\n return u.compact(layers.map(getMatchableLayerLocation))\n }\n\n function updateNav(nav, links, { newLinks, anyLocationChanged }) {\n // Only look up current layer locations when either:\n //\n // (1) the location changed (anyLocationChanged = true) or\n // (2) we haven't cached previous locations\n //\n // Otherwise we re-use the previous locations.\n let currentLocations = (!anyLocationChanged && nav.upNavLocations) || getNavLocations(nav)\n\n // We only process when either:\n //\n // (1) We have unprocessed links (newLinks = true)\n // (2) The location for this nav's [up-layer] setting changed\n if (newLinks || !u.isEqual(nav.upNavLocations, currentLocations)) {\n for (let link of links) {\n const isCurrent = linkCurrentURLs(link).isAnyCurrent(currentLocations)\n for (let currentClass of config.currentClasses) {\n link.classList.toggle(currentClass, isCurrent)\n }\n e.setAttrPresence(link, 'aria-current', 'page', isCurrent)\n }\n\n // Remember which locations we last processed\n nav.upNavLocations = currentLocations\n }\n }\n\n /*-\n Looks for [up-nav] containers in the given fragment and updates their contained links.\n Because we update full navs, we only need to lookup layer locations once.\n\n @function updateNavsAround\n @internal\n */\n function updateNavsAround(root, opts) {\n const navSelector = config.selector('navSelectors')\n const fullNavs = e.around(root, navSelector)\n\n for (let fullNav of fullNavs) {\n let links = e.subtree(fullNav, SELECTOR_LINK)\n updateNav(fullNav, links, opts)\n }\n }\n\n function getMatchableLayerLocation(layer) {\n return u.matchableURL(layer.location)\n }\n\n\n /*-\n @function findActivatableAreas\n @param {string|Element|jQuery} element\n @internal\n */\n function findActivatableAreas(element) {\n return element.upExpandedPair || [element]\n }\n\n /*-\n While rendering, the `.up-active` class is added to the [origin](/api/origin) element that triggered the change.\n\n The class remains set while the request is loading.\n It is removed when the request [ends](/api/up.Request.prototype.ended) for any reason.\n\n @learn-ref feedback-classes\n\n > [tip]\n > If you're looking to style the [targeted](/learn/targeting-fragments) fragment, see `.up-loading`.\n\n @selector .up-active\n @stable\n @signature\n */\n\n /*-\n While rendering, all [targeted fragments](/learn/targeting-fragments) are assigned the `.up-loading` class.\n\n The class remains set while the request is loading.\n It is removed when the request [ends](/api/up.Request.prototype.ended) for any reason.\n\n @learn-ref feedback-classes\n\n > [tip]\n > If you're looking to style the [origin](/api/origin) that targeted the fragment, see `.up-active`.\n\n @selector .up-loading\n @stable\n @signature\n */\n\n /*-\n While [revalidating](/learn/caching#revalidation) content rendered from a stale cache entry,\n all [targeted fragments](/learn/targeting-fragments) are assigned the `.up-revalidating` class.\n\n The class remains set while the revalidation request is loading.\n It is removed when the request [ends](/api/up.Request.prototype.ended) for any reason.\n\n @learn-ref feedback-classes\n\n ## Example\n\n This fragment has been rendered from an older cache entry. Unpoly will automatically send a revalidation request\n and marks the fragment as `.up-revalidating`:\n\n ```html\n <div id=\"target\" class=\"up-revalidating\"> <!-- mark: class=\"up-revalidating\" -->\n Possibly stale content\n </div>\n ```\n\n You can style revalidating fragments to convey that content might be stale:\n\n ```css\n .up-revalidating {\n filter: grayscale(80%);\n opacity: 0.5;\n }\n ```\n\n\n @selector .up-revalidating\n @experimental\n */\n\n function runPreviews(request, renderOptions) {\n let { bindLayer } = request\n let focusCapsule = up.FocusCapsule.preserve(bindLayer)\n let applyPreviews = () => doRunPreviews(request, renderOptions)\n let revertPreviews = bindLayer.asCurrent(applyPreviews)\n focusCapsule?.autoVoid()\n return () => {\n bindLayer.asCurrent(revertPreviews)\n focusCapsule?.restore(bindLayer, { preventScroll: true })\n }\n }\n\n function doRunPreviews(request, renderOptions) {\n let { fragment, fragments, origin } = request\n let cleaner = u.cleaner()\n let previewForFragment = (fragment) => new up.Preview({ fragment, request, renderOptions, cleaner })\n\n // Some preview effects only run once per render pass.\n // The { fragment } for these previews will be the first fragment,\n // or null if there is no first fragment (when opening a layer).\n let singlePreview = previewForFragment(fragment)\n singlePreview.run(resolvePreviewFns(renderOptions.preview))\n singlePreview.run(getPlaceholderPreviewFn(renderOptions.placeholder))\n singlePreview.run(getFeedbackClassesPreviewFn(renderOptions.feedback, fragments))\n singlePreview.run(up.form.getDisablePreviewFn(renderOptions.disable, origin))\n\n // Other fragment effects run once per targeted fragment.\n // This is useful for batched validations, where we may update multiple fragments,\n // but each with individual preview effects.\n for (let fragment of fragments) {\n let eachPreview = previewForFragment(fragment)\n eachPreview.run(up.fragment.matchSelectorMap(fragment, renderOptions.previewMap))\n eachPreview.run(up.fragment.matchSelectorMap(fragment, renderOptions.placeholderMap).flatMap(getPlaceholderPreviewFn))\n }\n\n return cleaner.clean\n }\n\n /*-\n Links or forms can name a [preview function](/learn/previews) that is called while\n loading content from the server.\n\n When the user interacts with a link or form, its preview function is invoked immediately.\n The function will usually [mutate the DOM](/learn/previews#basic-mutations) to signal that the app is working\n or to provide clues for how the page will ultimately look.\n For example, if the user is deleting an item from a list, the preview\n function could hide that item visually.\n\n See [Previews](/learn/previews) for details and examples.\n\n @learn-ref previews\n\n ## Usage\n\n To refer to a preview function, set its name as an `[up-preview]` attribute:\n\n ```html\n <a href=\"/edit\" up-follow up-preview=\"spinner\">Edit page</a> <!-- mark: up-preview=\"spinner\" -->\n ```\n\n To [call multiple previews](/learn/previews#multiple), separate their names with a comma:\n\n ```html\n <a href=\"/edit\" up-follow up-preview=\"spinner, dim-page\">Edit page</a> <!-- mark: up-preview=\"spinner, dim-page\" -->\n ```\n\n [Preview options](/learn/previews#parameters) can be appended after each preview name, encoded as [relaxed JSON](/api/relaxed-json):\n\n ```html\n <a href=\"/edit\"\n up-follow\n up-preview=\"spinner { size: 20 }, dim-page { animation: 'pulse' }\"> <!-- mark: spinner { size: 20 }, dim-page { animation: 'pulse' } -->\n Edit page\n </a>\n ```\n\n @selector [up-preview]\n\n @param up-preview\n The name of a preview function defined with `up.preview()`.\n\n To call multiple previews, separate names with a comma.\n\n @stable\n @signature\n */\n\n /*-\n Links or forms can define a [placeholder](/learn/placeholders) that will be shown within the targeted\n fragment while loading content from the server.\n\n All other children of the targeted fragment will be hidden while\n the request is in flight. When the request [ends](/api/up.Request.prototype.ended) for any reason,\n the placeholder will be removed and the original fragment children will be shown again.\n\n When [targeting multiple fragments](/learn/targeting-fragments#multiple),\n the placeholder will be shown in the first fragment.\n\n @learn-ref placeholders\n\n ## Example\n\n This link will show the message *\"Loading…\"* within `#target` while its request is loading:\n\n ```html\n <a href=\"/path\" up-target=\"#target\" up-placeholder=\"<p>Loading…</p>\">Show story</a> <!-- mark: up-placeholder=\"<p>Loading…</p>\" -->\n\n <div id=\"target\">\n Old content\n </div>\n ```\n\n See [Placeholders](/learn/placeholders) for details and elaborate examples.\n\n @selector [up-placeholder]\n @param up-placeholder\n The HTML string for the placeholder.\n\n You can also [use a template](/learn/placeholders#from-template)\n by setting this attribute to a CSS selector matching\n a `<template>` or `<script>` element.\n @experimental\n @signature\n */\n\n function getPlaceholderPreviewFn(placeholder) {\n if (!placeholder) return\n\n return function(preview) {\n preview.showPlaceholder(placeholder)\n }\n }\n\n function resolvePreviewFns(value) {\n if (u.isFunction(value)) {\n return [value]\n } else if (u.isString(value)) {\n return resolvePreviewString(value)\n } else if (u.isArray(value)) {\n return value.flatMap(resolvePreviewFns)\n } else {\n return []\n }\n }\n\n function resolvePreviewString(str) {\n return u.map(u.parseScalarJSONPairs(str), ([name, parsedOptions]) => {\n let previewFn = namedPreviewFns.get(name)\n\n return function(preview, runOptions) {\n up.puts('[up-preview]', 'Showing preview %o', name)\n return previewFn(preview, parsedOptions || runOptions)\n }\n })\n }\n\n function getActiveElements({ origin, activeElements }) {\n activeElements ||= u.wrapList(origin)\n // If the link area was grown with [up-expand], we highlight the [up-expand] container.\n return u.flatMap(activeElements, findActivatableAreas)\n }\n\n function getFeedbackClassesPreviewFn(feedbackOption, fragments) {\n if (!feedbackOption) return\n\n return function(preview) {\n const { renderOptions } = preview\n\n if (renderOptions.expiredResponse) {\n preview.addClassBatch(fragments, config.revalidatingClasses)\n } else {\n preview.addClassBatch(getActiveElements(renderOptions), config.activeClasses)\n preview.addClassBatch(fragments, config.loadingClasses)\n }\n }\n }\n\n function statusOptions(element, options, parserOptions) {\n options = u.options(options)\n const parser = new up.OptionsParser(element, options, parserOptions)\n parser.booleanOrString('disable')\n parser.boolean('feedback')\n parser.string('preview')\n parser.booleanOrString('revalidatePreview')\n parser.string('placeholder')\n return options\n }\n\n /*-\n Marks this element as a [navigational container](/learn/navigation-bars), such as a menu or navigation bar.\n\n When a link within an `[up-nav]` element points to [its layer's location](/api/up.layer.location),\n it is assigned the `.up-current` class. When the browser navigates to another location, the class is removed automatically.\n\n @learn-ref navigation-bars\n\n ## Example\n\n Let's look at a simple menu with two links:\n\n ```html\n <div up-nav> <!-- mark: up-nav -->\n <a href=\"/foo\">Foo</a>\n <a href=\"/bar\">Bar</a>\n </div>\n ```\n\n When the browser location changes to `/foo`, the first link is marked as `.up-current`:\n\n ```html\n <div up-nav>\n <a href=\"/foo\" class=\"up-current\">Foo</a> <!-- mark: class=\"up-current\" -->\n <a href=\"/bar\">Bar</a>\n </div>\n ```\n\n When the browser location changes to `/bar`, the first link loses its `.up-current` class.\n Now the second link is marked as `.up-current`:\n\n ```html\n <div up-nav>\n <a href=\"/foo\">Foo</a>\n <a href=\"/bar\" class=\"up-current\">Bar</a> <!-- mark: class=\"up-current\" -->\n </div>\n ```\n\n @selector [up-nav]\n @param [up-layer=\"origin\"]\n The [layers](/api/up.layer) for which to match link locations.\n\n By default, links are only marked as current when they point to the location *of their own layer*.\n To highlight links that point to the location of *another* layer, set this attribute to\n any [layer option](/learn/targeting-other-layers).\n\n If the configured option matches multiple layers (e.g. `any` or `current, root`),\n links are highlighted if they match the location of any matching layer.\n\n See [Matching the location of other layers](/learn/navigation-bars#layers) for examples.\n @stable\n @signature\n */\n\n /*-\n Links within [navigational containers](/learn/navigation-bars)\n may use the `[up-alias]` attribute to define alternative URLs for which they\n should also be highlighted as `.up-current`.\n\n @learn-ref navigation-bars#aliases\n\n ### Example\n\n The link below will be highlighted with `.up-current` at both `/profile` and `/profile/edit` locations:\n\n ```html\n <nav>\n <a href=\"/profile\" up-alias=\"/profile/edit\">Profile</a>\n </nav>\n ```\n\n To configure multiple alternative URLs, use a [URL pattern](/api/url-patterns).\n\n ### Setting URL aliases from macros {#from-macro}\n\n An `[up-alias]` attribute can be set by a [macro](/api/up.macro).\n\n This can be useful to link nested navigation trees programmatically.\\\n Let's say we have a main navigation linking to two sections:\n\n ```html\n <nav class=\"main-nav\">\n <a href=\"/companies\" data-section=\"companies\">Companies</a> <!-- mark: data-section=\"companies\"-->\n <a href=\"/users\" data-section=\"users\">Users</a> <!-- mark: data-section=\"users\"-->\n </nav>\n ```\n\n We also have a sub-navigation for each section:\n\n ```html\n <nav class=\"sub-nav\" data-section=\"companies\"> <!-- mark: data-section=\"companies\"-->\n <a href=\"/companies\">All companies</a>\n <a href=\"/companies/sync\">Sync CRM</a>\n <a href=\"/companies/export\">Export</a>\n </nav>\n\n <nav class=\"sub-nav\" data-section=\"users\"> <!-- mark: data-section=\"users\"-->\n <a href=\"/users\">All users</a>\n <a href=\"/users/online\">Now online</a>\n <a href=\"/users/profile\">Your profile</a>\n </nav>\n ```\n\n We want the main navigation section to be `.up-current` for any sub-section URL.\n We can do that with a macro that finds the respective sub-navigation, and sets an `[up-alias]` attribute at the main navigation link:\n\n ```js\n up.macro('.main-nav a', function(link, { section }) {\n let subLinks = document.querySelectorAll(`.sub-nav[data-section=\"${section}\"] a`)\n let subURLs = up.util.map(subLinks, (subLink) => subLink.getAttribute('href'))\n link.setAttribute('up-alias', subURLs.join())\n })\n ```\n\n\n @selector [up-alias]\n @param up-alias\n A [URL pattern](/api/url-patterns) with alternative URLs.\n @stable\n */\n\n /*-\n When a link within a [navigational container](/learn/navigation-bars) points to the current location, it is assigned the `.up-current` class.\n\n @learn-ref navigation-bars\n\n ## Example\n\n @include nav-example\n\n @selector .up-current\n @stable\n @signature\n */\n\n up.on('up:compilers:before', (_event, newFragment) => {\n updateNavsAround(newFragment, { newLinks: true, anyLocationChanged: false })\n })\n\n up.on('up:layer:location:changed up:layer:opened up:layer:dismissed up:layer:accepted', () => {\n updateNavsAround(document.body, { newLinks: false, anyLocationChanged: true })\n })\n\n return {\n config,\n // showAroundRequest,\n preview: namedPreviewFns.put,\n resolvePreviewFns,\n runPreviews,\n statusOptions,\n }\n})()\n\nup.preview = up.status.preview\n","/*-\nFeatures to update fragments without a user click.\n\nAn element with `[up-hungry]` is updated whenever a server response contains a matching element, even when the response was requested for a different target. This keeps things like unread counters current with every request. `[up-flashes]` builds on this to show confirmations and alerts from any response, including responses rendered in an overlay. An element with `[up-poll]` reloads itself from the server periodically, and `up:fragment:poll` lets your code skip a scheduled reload.\n\n@learn-ref live-fragments\n@learn-ref flashes\n\n@module up.radio\n*/\nup.radio = (function() {\n\n const e = up.element\n\n /*-\n Configures defaults for passive updates.\n\n @property up.radio.config\n\n @section Hungry elements\n @param {Array<string>} [config.hungrySelectors]\n An array of CSS selectors that are replaced whenever matching elements are found in a response.\n These elements are replaced even when they are not targeted directly.\n\n By default this contains the `[up-hungry]` attribute.\n\n The configured selectors will be used to find hungry elements in the current page.\n For each matching element a target will be [derived](/learn/target-derivation) from that\n specific element. E.g. when you configure `up.radio.config.hungrySelectors.push('input')`,\n a given input will be targeted with its derived selector (like `input[name=email]`).\n\n For this to work hungry elements [must have a derivable target selector](/api/up-hungry#derivable-target-required).\n\n @param {Array<string>} [config.noHungrySelectors=['[up-hungry=false]']]\n Exceptions to `up.radio.config.hungrySelectors`.\n\n @section Polling\n @param {number} [config.pollInterval=30000]\n The default [polling](/api/up-poll) interval in milliseconds.\n\n @stable\n */\n const config = new up.Config('up.radio.config', () => ({\n hungrySelectors: ['[up-hungry]'],\n noHungrySelectors: ['[up-hungry=false]'],\n pollInterval: 30000,\n }))\n\n function hungrySteps(renderOptions) {\n let { hungry, origin, layer: renderLayer, meta } = renderOptions\n let steps = { current: [], other: [] }\n\n if (!hungry) return steps\n\n let hungrySelector = config.selector('hungrySelectors')\n\n // When multiple steps target the same new selector, we're updating the layer\n // that's closer to the layer of the render pass.\n //\n // In this case two steps will match the same { newElement }. Hence this case is\n // not covered by step compression (which looks at { oldElement }).\n const layerPreference = [renderLayer, ...renderLayer.ancestors, ...renderLayer.descendants]\n\n for (let elementLayer of layerPreference) {\n let hungries = up.fragment.all(elementLayer.element, hungrySelector, { layer: elementLayer })\n\n for (let element of hungries) {\n let selector = up.fragment.tryToTarget(element, { origin })\n if (!selector) {\n up.warn('[up-hungry]', 'Ignoring untargetable fragment %o', element)\n continue\n }\n\n let ifLayer = e.attr(element, 'up-if-layer')\n let applicableLayers = ifLayer ? up.layer.getAll(ifLayer, { baseLayer: elementLayer }) : [elementLayer]\n\n let motionOptions = up.motion.motionOptions(element)\n\n // We cannot emit up:fragment:hungry here as we don't know { newElement } yet.\n let selectEvent = up.event.build('up:fragment:hungry', { log: false })\n let selectCallback = up.script.callbackAttr(element, 'up-on-hungry', { expandObject: ['newFragment', 'renderOptions'] })\n\n let step = {\n selector, // The selector for a single step is { selector }\n oldElement: element, // The match on the current page\n layer: elementLayer, // May be different from { layer } when we found an [up-hungry][up-if-layer=any]\n origin, // The { origin } passed into the fn. will be used to match { newElement } later.\n ...motionOptions, // The hungry element defines its own transition, duration, easing.\n placement: 'swap', // Hungry elements are always swapped, never appended\n keep: true, // Always honor [up-keep] in hungry elements. Set here because we don't inherit default render options.\n maybe: true, // Don't fail if we cannot match { newElement } later.\n meta,\n selectEvent, // Used by up.ResponseDoc#selectStep()\n selectCallback, // Used by up.ResponseDoc#selectStep()\n // The step also gets a reference to the original render options.\n // Although these render options are not used to render the hungry step, it will be\n // passed to up:fragment:hungry listener to e.g. only update hungry elements if the\n // original render pass would update history.\n originalRenderOptions: renderOptions,\n }\n\n if (applicableLayers.includes(renderLayer)) {\n let list = renderLayer === elementLayer ? steps.current : steps.other\n list.push(step)\n }\n }\n\n }\n\n // Remove nested steps on other layers.\n // Note that `steps.current` is already compressed by up.Change.UpdateLayer once it's been mixed with\n // the explicit target steps. So we're not doing it again here.\n steps.other = up.fragment.compressNestedSteps(steps.other)\n\n return steps\n }\n\n /*-\n Before an `[up-hungry]` element is added to a render pass, an event `up:fragment:hungry` is emitted on that element.\n\n @learn-ref hungry-elements#conditions\n\n ## Preventing hungry elements from being updated\n\n You may prevent the `up:fragment:hungry` event to exclude a hungry element from the render pass.\n Use this to define arbitrary conditions for when a hungry element should be updated.\n\n For example, the following would update a hungry element only for render passes that [update history](/learn/updating-history):\n\n ```js\n element.addEventListener('up:fragment:hungry', function(event) {\n if (!event.renderOptions.history) event.preventDefault()\n })\n ```\n\n You may also define conditions based on the *new* element that a hungry element would be swapped with.\n The following would skip an update if the new element has the class `.is-empty`:\n\n ```js\n element.addEventListener('up:fragment:hungry', function(event) {\n if (event.newFragment.classList.contains('is-empty')) {\n event.preventDefault()\n }\n })\n ```\n\n @event up:fragment:hungry\n @param {Element} event.target\n The hungry element that is about to be swapped.\n @param {Element} event.newFragment\n The fragment in the new content that this hungry element would be swapped with.\n @param {Object} event.renderOptions\n The [render options](/api/up.render#parameters) for the current render pass.\n @param event.preventDefault()\n Prevents the hungry element from being targeted in the current render pass.\n @stable\n */\n\n /*-\n Elements with an `[up-hungry]` attribute are updated whenever the server\n sends a matching element, even if the element is not [targeted](/learn/targeting-fragments).\n\n Hungry elements are optional in the same way as `:maybe` targets.\n When an `[up-hungry]` element does not match in the server response, the element will not be updated,\n but no error is thrown.\n\n @learn-ref hungry-elements\n\n ## Use cases\n\n Common use cases for `[up-hungry]` are elements that live in the application layout,\n outside of the fragment that is typically being targeted. Examples include:\n\n - Unread message counters\n - Page-specific subnavigation\n - Account-wide notifications (e.g. about an expired credit card)\n\n Instead of explicitly including such elements in every [target selector](/learn/targeting-fragments)\n (e.g. `.content, .unread-messages:maybe`) we can mark the element as `[up-hungry]`:\n\n ```html\n <div class=\"unread-messages\" up-hungry>\n You have no unread messages\n </div>\n ```\n\n A selector for the hungry element (`.unread-messages`) will be added to target selectors automatically.\n\n ## Derivable target required {#derivable-target-required}\n\n When an `[up-hungry]` element piggy-backs on another fragment update, Unpoly\n will [derive a target selector](/learn/target-derivation) for the hungry element.\n\n For this to work the hungry element must have an [identifying attribute](/learn/target-derivation#derivation-patterns),\n such as an `[id]` or a unique `[class]` attribute.\n When no good target can be derived, the hungry element is excluded from the update and a\n message like this will be [logged](/api/up.log):\n\n ```text\n [up-hungry] Ignoring untargetable fragment <div>\n ```\n\n ## Behavior with multiple layers\n\n By default only hungry elements on the targeted [layer](/api/up.layer) are updated.\n\n To match a hungry element when updating other layers, set an [`[up-if-layer]`](#up-if-layer) attribute.\n For example, a hungry element with `[up-if-layer=\"subtree\"]` will piggy-back on render passes for both\n its own layer and any overlay covering it.\n\n ## Conflict resolution\n\n When Unpoly renders new content, each element in that content can only be inserted once.\n When hungry elements conflict with each other or with the [target selector](/learn/targeting-fragments),\n the conflict is resolved using the following rules:\n\n 1. When the target selector and a hungry element match the same element in the response, the element is updated once, as part of the target selector.\n 2. When hungry elements are nested within each other, only the outermost hungry element is updated. We recommend using hungry elements sparingly, and adding elements to the target selector instead.\n 3. When hungry elements on different layers match the same element in the response,\n only the hungry element on the layer closest to the rendering layer is updated.\n\n ## Disabling\n\n By default hungry elements are processed for all updates of the current layer.\n You can disable the processing of hungry elements using one of the following methods:\n\n - Rendering with an [`{ hungry: false }`](/api/up.render#options.hungry) option will not process any hungry elements.\n - Setting an [`[up-use-hungry=\"false\"]`](/api/up-follow#up-use-hungry) attribute on a link or form will not update hungry elements when the element is activated.\n - Preventing an `up:fragment:hungry` event will prevent the hungry element\n from being updated.\n - Calling `event.preventDefault()` in an `[up-on-hungry]` attribute handler will prevent the hungry element\n from being updated.\n\n @selector [up-hungry]\n\n @section Layer\n @param [up-if-layer='current']\n Only piggy-back on updates on [layers](/api/up.layer) that match the given [layer reference](/learn/targeting-other-layers).\n\n Relative references like `'parent'` or `'child'` will be resolved in relation to the hungry element's layer.\n\n To match a hungry element when updating one of multiple layers, separate the references with a comma.\n For example, `'current, child'` will match for updates on either the hungry element's layer or\n its direct child.\n\n To match a hungry element when updating *any* layer, set this attribute to `'any'`.\n\n @section Animation\n @param [up-transition]\n @like [up-transition]\n\n @param [up-duration]\n @like [up-transition]\n\n @param [up-easing]\n @like [up-transition]\n\n @section Callbacks\n @param [up-on-hungry]\n Code to run before this element is included in a fragment update.\n\n Calling `event.preventDefault()` will prevent the hungry fragment\n from being updated.\n\n For instance, if you want to auto-update a hungry navigation bar\n only when changing history entries:\n\n ```html\n <nav id=\"side-nav\" up-hungry up-on-hungry=\"if (!renderOptions.history) event.preventDefault()\">\n ...\n </nav>\n ```\n\n The code may use the variables `event` (of type `up:fragment:hungry`),\n `this` (the hungry element), `newFragment` and `renderOptions`.\n\n @stable\n @signature\n */\n\n /*-\n Starts [polling](/api/up-poll) the given element.\n\n The given element does not need an `[up-poll]` attribute.\n\n @function up.radio.startPolling\n @section General\n @param {Element} fragment\n The fragment to reload periodically.\n @param {Object} [options]\n Options for reloading the fragment.\n\n By default Unpoly will parse options from the fragment's attributes (see `[up-poll]`).\n You may pass this additional `options` object to [supplement or override](/learn/attributes-and-options#options) options parsed from the fragment's attributes.\n @section Trigger\n @param {number} [options.interval]\n The reload interval in milliseconds.\n\n Defaults to `up.radio.config.pollInterval`.\n\n @param {string} [options.ifLayer='front']\n Controls polling while the fragment's [layer](/api/up.layer) is covered by an overlay.\n\n When set to `'front'`, polling will pause while the fragment's layer is covered by an overlay.\n When the fragment's layer is uncovered, polling will resume.\n\n When set to `'any'`, polling will continue on background layers.\n\n @section Request\n @param {string} [options.url]\n The URL from which to reload the fragment.\n\n Defaults to the URL this fragment was [originally loaded from](/api/up-source).\n\n @param {string} [options.method='get']\n The HTTP method used to reload the fragment.\n\n @experimental\n\n @param {string} [options.headers={}]\n A JSON object with additional request headers.\n\n @param {string} [options.params={}]\n A JSON object with additional [parameters](/api/up.Params) that should be sent as the request's\n [query string](https://en.wikipedia.org/wiki/Query_string) or payload.\n\n When making a `GET` request to a URL with a query string, the given `{ params }` will be added\n to the query parameters.\n\n @section Client state\n @param {boolean} [options.keepData=false]\n Whether to [preserve](/learn/data#preserving) the polling fragment's\n [data object](/learn/data) through reloads.\n\n @experimental\n\n @section Loading state\n @mix up.render/loading-state\n @stable\n */\n function startPolling(fragment, options = {}) {\n up.FragmentPolling.forFragment(fragment).forceStart(options)\n }\n\n /*-\n Stops [polling](/api/up-poll) the given element.\n\n @function up.radio.stopPolling\n @param {Element} fragment\n The fragment to stop reloading.\n @stable\n */\n function stopPolling(element) {\n up.FragmentPolling.forFragment(element).forceStop()\n }\n\n function pollOptions(fragment, options = {}) {\n const defaults = { background: true }\n const parser = new up.OptionsParser(fragment, options, { defaults })\n parser.number('interval', { default: config.pollInterval })\n parser.string('ifLayer', { default: 'front' })\n parser.include(up.link.requestOptions)\n parser.include(up.status.statusOptions)\n // An error response renders nothing, unless the fragment has [up-fail=false].\n // Polling then tries again after the next interval.\n options.failTarget ??= ':none'\n return options\n }\n\n /*-\n Elements with an `[up-poll]` attribute are [reloaded](/api/up.reload) from the server periodically.\n\n @learn-ref polling\n\n ## Example\n\n This fragment `#score` will be reloaded every 30 seconds:\n\n ```html\n <div id=\"score\" up-poll> <!-- mark: id=\"score\" -->\n Score: 1400\n </div>\n ```\n\n @selector [up-poll]\n\n @section Trigger\n @param [up-interval]\n The reload interval in milliseconds.\n\n Defaults to `up.radio.config.pollInterval`, which defaults to 30 seconds.\n\n @param [up-if-layer='front']\n Controls polling while the fragment's [layer](/api/up.layer) is covered by an overlay.\n\n When set to `'front'`, polling will pause while the fragment's layer is covered by an overlay.\n When the fragment's layer is uncovered, polling will resume.\n\n When set to `'any'`, polling will continue on background layers.\n\n @experimental\n\n @section Request\n @param [up-href]\n The URL from which to reload the fragment.\n\n Defaults to the URL this fragment was [originally loaded from](/api/up-source).\n\n @param [up-method='get']\n The HTTP method used to reload the fragment.\n\n @experimental\n\n @param [up-headers]\n A [relaxed JSON](/api/relaxed-json) object with additional request headers.\n\n @param [up-params]\n A [relaxed JSON](/api/relaxed-json) object with additional [parameters](/api/up.Params) that should be sent as the request's\n [query string](https://en.wikipedia.org/wiki/Query_string) or payload.\n\n When making a `GET` request to a URL with a query string, the given `{ params }` will be added\n to the query parameters.\n\n @param [up-fail]\n How to handle [error responses](/learn/error-responses).\n\n By default, polling will skip server responses with an error code,\n even when the response contains a matching fragment. After the configured\n interval, the server will be polled again.\n\n Set `[up-fail=false]` to render *any* response that contains a matching fragment,\n even with a 4xx or 5xx status code.\n\n @section Client state\n @param [up-keep-data]\n Whether to [preserve](/learn/data#preserving) the polling fragment's\n [data object](/learn/data) through reloads.\n\n @experimental\n\n @section Loading state\n @mix up-follow/loading-state\n\n @stable\n @signature\n */\n up.attribute('up-poll', function(fragment) {\n up.FragmentPolling.forFragment(fragment).onPollAttributeObserved()\n })\n\n /*-\n This event is emitted before a [polling](/api/up-poll) fragment is reloaded from the server.\n\n @learn-ref polling#preventing-request\n\n Listeners may prevent the `up:fragment:poll` event to prevent the fragment from being reloaded.\n Preventing the event will only skip a single update:\n\n ```js\n up.on('up:fragment:poll', function(event) {\n // Don't reload a fragment that contains a playing video\n let video = event.target.querySelector('video')\n if (video && !video.paused) {\n event.preventDefault()\n }\n })\n ```\n\n The server will be polled again after the configured interval, emitting another `up:fragment:poll` event.\n\n @event up:fragment:poll\n @param {Element} event.target\n The polling fragment.\n @param {Object} event.renderOptions\n An object with [render options](/api/up.render#parameters) for the render pass that reloads the polling fragment.\n\n Listeners may inspect and modify these options.\n @param event.preventDefault()\n Prevents the fragment from being reloaded.\n @stable\n */\n\n /*-\n Use an `[up-flashes]` element to show confirmations, alerts or warnings.\n\n @learn-ref flashes\n\n <figure>\n <img src=\"images/flashes.png\" alt=\"Screenshot of three flash messages\" width=\"480\">\n <figcaption>\n\n Three flash messages stacked on top of each other: a confirmation (\"User created successfully!\"),\n an error (\"Could not save your changes!\") and a warning (\"Your credit card is expiring in 3 days.\").\n Each kind has its own color, so the user can tell them apart at a glance.\n\n </figcaption>\n </figure>\n\n Your application layout should have an empty `[up-flashes]` element to indicate where flash messages should be inserted:\n\n ```html\n <nav>\n Navigation items ...\n </nav>\n <div up-flashes></div> <!-- mark-line -->\n <main>\n Main page content ...\n </main>\n ```\n\n To render a flash message, include an `[up-flashes]` element in your response.\n The element's content should be the messages you want to render:\n\n ```html\n <div up-flashes>\n <strong>User was updated!</strong>\n </div>\n\n <main>\n Main response content ...\n </main>\n ```\n\n See [notification flashes](/learn/flashes) for more details and examples.\n\n @selector [up-flashes]\n @section Animation\n @param [up-transition]\n The name of a [transition](/api/up.motion) to morph between the old and new notification flashes.\n @param [up-duration]\n @like [up-transition]\n\n @param [up-easing]\n @like [up-transition]\n @stable\n */\n up.macro('[up-flashes]', function(fragment) {\n e.setMissingAttrs(fragment, {\n 'up-hungry': '',\n 'up-if-layer': 'subtree',\n 'up-keep': '',\n 'role': 'alert',\n })\n\n fragment.addEventListener('up:fragment:keep', function(event) {\n if (!e.isEmpty(event.newFragment)) event.preventDefault()\n })\n })\n\n return {\n config,\n hungrySteps,\n startPolling,\n stopPolling,\n pollOptions,\n }\n})()\n","/*\nPlay nice with Rails UJS\n========================\n\nUnpoly is mostly a superset of Rails UJS, so we convert attributes like `[data-method]` to `[up-method]´.\n*/\n(function() {\n\n function isRailsUJSLoaded() {\n return window.Rails || // rails-ujs gem\n window.jQuery?.rails // jquery-ujs gem\n }\n\n function swapAttr(element, dataAttr, upAttr) {\n if (element.hasAttribute(dataAttr)) {\n let dataValue = element.getAttribute(dataAttr)\n up.element.setMissingAttr(element, upAttr, dataValue)\n element.removeAttribute(dataAttr)\n }\n }\n\n function defineMacro(elementSelector, relevantFn) {\n up.macro(`:is([data-confirm], [data-method]):is(${elementSelector})`, function(element) {\n // It would be nicer to test isRailsUJSLoaded() once at up:framework:boot,\n // but this would make it harder to test.\n if (isRailsUJSLoaded() && relevantFn(element)) {\n swapAttr(element, 'data-confirm', 'up-confirm')\n swapAttr(element, 'data-method', 'up-method')\n }\n })\n }\n\n defineMacro('a[href], [up-href]', (el) => up.link.isFollowable(el))\n defineMacro('form, input[type=submit], button[type=submit], button:not([type])', (el) => up.form.isSubmittable(up.form.get(el)))\n\n})()\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","require('./unpoly/namespace')\nrequire('./unpoly/mockable')\nrequire('./unpoly/util')\nrequire('./unpoly/error')\nrequire('./unpoly/migrate_stub')\nrequire('./unpoly/browser')\nrequire('./unpoly/element')\n\nrequire('./unpoly/errors/error')\nrequire('./unpoly/errors/not_implemented')\nrequire('./unpoly/errors/aborted')\nrequire('./unpoly/errors/blocked')\nrequire('./unpoly/errors/cannot_match')\nrequire('./unpoly/errors/cannot_parse')\nrequire('./unpoly/errors/cannot_target')\nrequire('./unpoly/errors/offline')\n\nrequire('./unpoly/classes/record')\nrequire('./unpoly/classes/config')\nrequire('./unpoly/classes/log_config')\nrequire('./unpoly/classes/registry')\nrequire('./unpoly/classes/options_parser')\nrequire('./unpoly/classes/fifo_cache')\nrequire('./unpoly/classes/rect')\n\nrequire('./unpoly/classes/body_shifter')\nrequire('./unpoly/classes/change/change')\nrequire('./unpoly/classes/change/addition')\nrequire('./unpoly/classes/render_job')\nrequire('./unpoly/classes/change/destroy_fragment')\nrequire('./unpoly/classes/change/open_layer')\nrequire('./unpoly/classes/change/update_layer')\nrequire('./unpoly/classes/change/update_steps')\nrequire('./unpoly/classes/change/close_layer')\nrequire('./unpoly/classes/change/from_url')\nrequire('./unpoly/classes/change/from_response')\nrequire('./unpoly/classes/change/from_content')\nrequire('./unpoly/classes/csp_info')\nrequire('./unpoly/classes/hello_fragment')\nrequire('./unpoly/classes/destructor_pass')\nrequire('./unpoly/classes/event_emitter')\nrequire('./unpoly/classes/event_listener')\nrequire('./unpoly/classes/event_listener_group')\nrequire('./unpoly/classes/selector_tracker')\nrequire('./unpoly/classes/field_watcher')\nrequire('./unpoly/classes/switcher')\nrequire('./unpoly/classes/form_validator')\nrequire('./unpoly/classes/focus_capsule')\nrequire('./unpoly/classes/fragment_processor')\nrequire('./unpoly/classes/fragment_finder')\nrequire('./unpoly/classes/fragment_focus')\nrequire('./unpoly/classes/fragment_polling')\nrequire('./unpoly/classes/fragment_scrolling')\nrequire('./unpoly/classes/layer/base')\nrequire('./unpoly/classes/layer/overlay')\nrequire('./unpoly/classes/layer/overlay_with_tether')\nrequire('./unpoly/classes/layer/overlay_with_viewport')\nrequire('./unpoly/classes/layer/root')\nrequire('./unpoly/classes/layer/modal')\nrequire('./unpoly/classes/layer/popup')\nrequire('./unpoly/classes/layer/drawer')\nrequire('./unpoly/classes/layer/cover')\nrequire('./unpoly/classes/layer_lookup')\nrequire('./unpoly/classes/layer_stack')\nrequire('./unpoly/classes/link_current_urls')\nrequire('./unpoly/classes/link_follow_intent')\nrequire('./unpoly/classes/motion_controller')\nrequire('./unpoly/classes/nonceable_callback')\nrequire('./unpoly/classes/overlay_focus')\nrequire('./unpoly/classes/params')\nrequire('./unpoly/classes/preview')\nrequire('./unpoly/classes/progress_bar')\nrequire('./unpoly/classes/render_options')\nrequire('./unpoly/classes/render_result')\nrequire('./unpoly/classes/request')\nrequire('./unpoly/classes/request/cache')\nrequire('./unpoly/classes/request/queue')\nrequire('./unpoly/classes/request/form_renderer')\nrequire('./unpoly/classes/request/xhr_renderer')\nrequire('./unpoly/classes/response')\nrequire('./unpoly/classes/response_doc')\nrequire('./unpoly/classes/reveal_motion')\nrequire('./unpoly/classes/script_gate')\nrequire('./unpoly/classes/selector')\nrequire('./unpoly/classes/tether')\nrequire('./unpoly/classes/url_pattern')\n\nrequire('./unpoly/framework')\nrequire('./unpoly/event')\nrequire('./unpoly/protocol')\nrequire('./unpoly/log')\nrequire('./unpoly/script')\nrequire('./unpoly/history')\nrequire('./unpoly/fragment')\nrequire('./unpoly/viewport')\nrequire('./unpoly/motion')\nrequire('./unpoly/network')\nrequire('./unpoly/layer')\nrequire('./unpoly/link')\nrequire('./unpoly/form')\nrequire('./unpoly/status')\nrequire('./unpoly/radio')\nrequire('./unpoly/rails')\n\nup.framework.onEvaled()\n"],"names":[],"sourceRoot":""}