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AAUiC,EAAYT,EAAIvB,EAAOgC,UAAWA,EACnE,EItCAoG,EAAQ3F,YAAcA,EACtB,S","sources":["webpack://silverstripe-base/./themes/app/src/scripts/common/ajax.js","webpack://silverstripe-base/./node_modules/a11y-dialog/dist/a11y-dialog.esm.js","webpack://silverstripe-base/./themes/app/src/scripts/components/modal.js","webpack://silverstripe-base/./node_modules/wretch/dist/addons/queryString.js","webpack://silverstripe-base/./node_modules/wretch/dist/constants.js","webpack://silverstripe-base/./node_modules/wretch/dist/utils.js","webpack://silverstripe-base/./node_modules/wretch/dist/config.js","webpack://silverstripe-base/./node_modules/wretch/dist/resolver.js","webpack://silverstripe-base/./node_modules/wretch/dist/middleware.js","webpack://silverstripe-base/./node_modules/wretch/dist/core.js","webpack://silverstripe-base/./node_modules/wretch/dist/index.js"],"sourcesContent":["import wretch from 'wretch'\nimport QueryStringAddon from 'wretch/addons/queryString'\n\nwretch.options({\n headers: { 'X-Requested-With': 'XMLHttpRequest' },\n})\n\nexport default wretch().addon(QueryStringAddon)\n","var focusableSelectors = [\n 'a[href]:not([tabindex^=\"-\"])',\n 'area[href]:not([tabindex^=\"-\"])',\n 'input:not([type=\"hidden\"]):not([type=\"radio\"]):not([disabled]):not([tabindex^=\"-\"])',\n 'input[type=\"radio\"]:not([disabled]):not([tabindex^=\"-\"])',\n 'select:not([disabled]):not([tabindex^=\"-\"])',\n 'textarea:not([disabled]):not([tabindex^=\"-\"])',\n 'button:not([disabled]):not([tabindex^=\"-\"])',\n 'iframe:not([tabindex^=\"-\"])',\n 'audio[controls]:not([tabindex^=\"-\"])',\n 'video[controls]:not([tabindex^=\"-\"])',\n '[contenteditable]:not([tabindex^=\"-\"])',\n '[tabindex]:not([tabindex^=\"-\"])',\n];\n\nvar TAB_KEY = 'Tab';\nvar ESCAPE_KEY = 'Escape';\n\n/**\n * Define the constructor to instantiate a dialog\n *\n * @constructor\n * @param {Element} element\n */\nfunction A11yDialog(element) {\n // Prebind the functions that will be bound in addEventListener and\n // removeEventListener to avoid losing references\n this._show = this.show.bind(this);\n this._hide = this.hide.bind(this);\n this._maintainFocus = this._maintainFocus.bind(this);\n this._bindKeypress = this._bindKeypress.bind(this);\n\n this.$el = element;\n this.shown = false;\n this._id = this.$el.getAttribute('data-a11y-dialog') || this.$el.id;\n this._previouslyFocused = null;\n this._listeners = {};\n\n // Initialise everything needed for the dialog to work properly\n this.create();\n}\n\n/**\n * Set up everything necessary for the dialog to be functioning\n *\n * @param {(NodeList | Element | string)} targets\n * @return {this}\n */\nA11yDialog.prototype.create = function () {\n this.$el.setAttribute('aria-hidden', true);\n this.$el.setAttribute('aria-modal', true);\n this.$el.setAttribute('tabindex', -1);\n\n if (!this.$el.hasAttribute('role')) {\n this.$el.setAttribute('role', 'dialog');\n }\n\n // Keep a collection of dialog openers, each of which will be bound a click\n // event listener to open the dialog\n this._openers = $$('[data-a11y-dialog-show=\"' + this._id + '\"]');\n this._openers.forEach(\n function (opener) {\n opener.addEventListener('click', this._show);\n }.bind(this)\n );\n\n // Keep a collection of dialog closers, each of which will be bound a click\n // event listener to close the dialog\n const $el = this.$el;\n\n this._closers = $$('[data-a11y-dialog-hide]', this.$el)\n // This filter is necessary in case there are nested dialogs, so that\n // only closers from the current dialog are retrieved and effective\n .filter(function (closer) {\n // Testing for `[aria-modal=\"true\"]` is not enough since this attribute\n // and the collect of closers is done at instantation time, when nested\n // dialogs might not have yet been instantiated. Note that if the dialogs\n // are manually instantiated, this could still fail because none of these\n // selectors would match; this would cause closers to close all parent\n // dialogs instead of just the current one\n return closer.closest('[aria-modal=\"true\"], [data-a11y-dialog]') === $el\n })\n .concat($$('[data-a11y-dialog-hide=\"' + this._id + '\"]'));\n\n this._closers.forEach(\n function (closer) {\n closer.addEventListener('click', this._hide);\n }.bind(this)\n );\n\n // Execute all callbacks registered for the `create` event\n this._fire('create');\n\n return this\n};\n\n/**\n * Show the dialog element, disable all the targets (siblings), trap the\n * current focus within it, listen for some specific key presses and fire all\n * registered callbacks for `show` event\n *\n * @param {CustomEvent} event\n * @return {this}\n */\nA11yDialog.prototype.show = function (event) {\n // If the dialog is already open, abort\n if (this.shown) {\n return this\n }\n\n // Keep a reference to the currently focused element to be able to restore\n // it later\n this._previouslyFocused = document.activeElement;\n this.$el.removeAttribute('aria-hidden');\n this.shown = true;\n\n // Set the focus to the dialog element\n moveFocusToDialog(this.$el);\n\n // Bind a focus event listener to the body element to make sure the focus\n // stays trapped inside the dialog while open, and start listening for some\n // specific key presses (TAB and ESC)\n document.body.addEventListener('focus', this._maintainFocus, true);\n document.addEventListener('keydown', this._bindKeypress);\n\n // Execute all callbacks registered for the `show` event\n this._fire('show', event);\n\n return this\n};\n\n/**\n * Hide the dialog element, enable all the targets (siblings), restore the\n * focus to the previously active element, stop listening for some specific\n * key presses and fire all registered callbacks for `hide` event\n *\n * @param {CustomEvent} event\n * @return {this}\n */\nA11yDialog.prototype.hide = function (event) {\n // If the dialog is already closed, abort\n if (!this.shown) {\n return this\n }\n\n this.shown = false;\n this.$el.setAttribute('aria-hidden', 'true');\n\n // If there was a focused element before the dialog was opened (and it has a\n // `focus` method), restore the focus back to it\n // See: https://github.com/KittyGiraudel/a11y-dialog/issues/108\n if (this._previouslyFocused && this._previouslyFocused.focus) {\n this._previouslyFocused.focus();\n }\n\n // Remove the focus event listener to the body element and stop listening\n // for specific key presses\n document.body.removeEventListener('focus', this._maintainFocus, true);\n document.removeEventListener('keydown', this._bindKeypress);\n\n // Execute all callbacks registered for the `hide` event\n this._fire('hide', event);\n\n return this\n};\n\n/**\n * Destroy the current instance (after making sure the dialog has been hidden)\n * and remove all associated listeners from dialog openers and closers\n *\n * @return {this}\n */\nA11yDialog.prototype.destroy = function () {\n // Hide the dialog to avoid destroying an open instance\n this.hide();\n\n // Remove the click event listener from all dialog openers\n this._openers.forEach(\n function (opener) {\n opener.removeEventListener('click', this._show);\n }.bind(this)\n );\n\n // Remove the click event listener from all dialog closers\n this._closers.forEach(\n function (closer) {\n closer.removeEventListener('click', this._hide);\n }.bind(this)\n );\n\n // Execute all callbacks registered for the `destroy` event\n this._fire('destroy');\n\n // Keep an object of listener types mapped to callback functions\n this._listeners = {};\n\n return this\n};\n\n/**\n * Register a new callback for the given event type\n *\n * @param {string} type\n * @param {Function} handler\n */\nA11yDialog.prototype.on = function (type, handler) {\n if (typeof this._listeners[type] === 'undefined') {\n this._listeners[type] = [];\n }\n\n this._listeners[type].push(handler);\n\n return this\n};\n\n/**\n * Unregister an existing callback for the given event type\n *\n * @param {string} type\n * @param {Function} handler\n */\nA11yDialog.prototype.off = function (type, handler) {\n var index = (this._listeners[type] || []).indexOf(handler);\n\n if (index > -1) {\n this._listeners[type].splice(index, 1);\n }\n\n return this\n};\n\n/**\n * Iterate over all registered handlers for given type and call them all with\n * the dialog element as first argument, event as second argument (if any). Also\n * dispatch a custom event on the DOM element itself to make it possible to\n * react to the lifecycle of auto-instantiated dialogs.\n *\n * @access private\n * @param {string} type\n * @param {CustomEvent} event\n */\nA11yDialog.prototype._fire = function (type, event) {\n var listeners = this._listeners[type] || [];\n var domEvent = new CustomEvent(type, { detail: event });\n\n this.$el.dispatchEvent(domEvent);\n\n listeners.forEach(\n function (listener) {\n listener(this.$el, event);\n }.bind(this)\n );\n};\n\n/**\n * Private event handler used when listening to some specific key presses\n * (namely ESCAPE and TAB)\n *\n * @access private\n * @param {Event} event\n */\nA11yDialog.prototype._bindKeypress = function (event) {\n // This is an escape hatch in case there are nested dialogs, so the keypresses\n // are only reacted to for the most recent one\n const focused = document.activeElement;\n if (focused && focused.closest('[aria-modal=\"true\"]') !== this.$el) return\n\n // If the dialog is shown and the ESCAPE key is being pressed, prevent any\n // further effects from the ESCAPE key and hide the dialog, unless its role\n // is 'alertdialog', which should be modal\n if (\n this.shown &&\n event.key === ESCAPE_KEY &&\n this.$el.getAttribute('role') !== 'alertdialog'\n ) {\n event.preventDefault();\n this.hide(event);\n }\n\n // If the dialog is shown and the TAB key is being pressed, make sure the\n // focus stays trapped within the dialog element\n if (this.shown && event.key === TAB_KEY) {\n trapTabKey(this.$el, event);\n }\n};\n\n/**\n * Private event handler used when making sure the focus stays within the\n * currently open dialog\n *\n * @access private\n * @param {Event} event\n */\nA11yDialog.prototype._maintainFocus = function (event) {\n // If the dialog is shown and the focus is not within a dialog element (either\n // this one or another one in case of nested dialogs) or within an element\n // with the `data-a11y-dialog-focus-trap-ignore` attribute, move it back to\n // its first focusable child.\n // See: https://github.com/KittyGiraudel/a11y-dialog/issues/177\n if (\n this.shown &&\n !event.target.closest('[aria-modal=\"true\"]') &&\n !event.target.closest('[data-a11y-dialog-ignore-focus-trap]')\n ) {\n moveFocusToDialog(this.$el);\n }\n};\n\n/**\n * Convert a NodeList into an array\n *\n * @param {NodeList} collection\n * @return {Array}\n */\nfunction toArray(collection) {\n return Array.prototype.slice.call(collection)\n}\n\n/**\n * Query the DOM for nodes matching the given selector, scoped to context (or\n * the whole document)\n *\n * @param {String} selector\n * @param {Element} [context = document]\n * @return {Array}\n */\nfunction $$(selector, context) {\n return toArray((context || document).querySelectorAll(selector))\n}\n\n/**\n * Set the focus to the first element with `autofocus` with the element or the\n * element itself\n *\n * @param {Element} node\n */\nfunction moveFocusToDialog(node) {\n var focused = node.querySelector('[autofocus]') || node;\n\n focused.focus();\n}\n\n/**\n * Get the focusable children of the given element\n *\n * @param {Element} node\n * @return {Array}\n */\nfunction getFocusableChildren(node) {\n return $$(focusableSelectors.join(','), node).filter(function (child) {\n return !!(\n child.offsetWidth ||\n child.offsetHeight ||\n child.getClientRects().length\n )\n })\n}\n\n/**\n * Trap the focus inside the given element\n *\n * @param {Element} node\n * @param {Event} event\n */\nfunction trapTabKey(node, event) {\n var focusableChildren = getFocusableChildren(node);\n var focusedItemIndex = focusableChildren.indexOf(document.activeElement);\n\n // If the SHIFT key is being pressed while tabbing (moving backwards) and\n // the currently focused item is the first one, move the focus to the last\n // focusable item from the dialog element\n if (event.shiftKey && focusedItemIndex === 0) {\n focusableChildren[focusableChildren.length - 1].focus();\n event.preventDefault();\n // If the SHIFT key is not being pressed (moving forwards) and the currently\n // focused item is the last one, move the focus to the first focusable item\n // from the dialog element\n } else if (\n !event.shiftKey &&\n focusedItemIndex === focusableChildren.length - 1\n ) {\n focusableChildren[0].focus();\n event.preventDefault();\n }\n}\n\nfunction instantiateDialogs() {\n $$('[data-a11y-dialog]').forEach(function (node) {\n new A11yDialog(node);\n });\n}\n\nif (typeof document !== 'undefined') {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', instantiateDialogs);\n } else {\n if (window.requestAnimationFrame) {\n window.requestAnimationFrame(instantiateDialogs);\n } else {\n window.setTimeout(instantiateDialogs, 16);\n }\n }\n}\n\nexport { A11yDialog as default };\n","import '@styles/components/modal.css'\nimport ajax from '@common/ajax'\nimport { on, off } from 'delegated-events'\nimport A11yDialog from 'a11y-dialog'\n\nconst generateTemplate = (id, useDefaultClose = true, useCustomClose = false, title = false) => {\n const role = useDefaultClose ? 'dialog' : 'alertdialog'\n const labeledBy = title ? 'aria-labelledby=\"modal-title\"' : ''\n\n const html = `\n
\n
\n\n ${\n useCustomClose === false\n ? ''\n : ''\n }\n\n
\n \n \n \n
\n
\n `\n\n return html\n}\n\nconst populateModal = async (opts = {}, modalEl) => {\n const type = opts.type\n const title = opts.title ?? ''\n const url = opts.url\n\n let modalContent = ''\n\n if (type === 'video') {\n modalContent = `\n
\n

Watch ${title}

\n
\n \n
\n
\n `\n\n modalEl.querySelector('.modal-container').innerHTML = modalContent\n }\n\n if (type === 'content') {\n modalContent = await ajax.get(url).text()\n\n modalEl.querySelector('.modal-container').innerHTML = modalContent\n }\n}\n\nconst handleModal = (e) => {\n e.preventDefault()\n\n const triggerEl = e.target.closest('[data-modal]')\n\n openModal({\n type: triggerEl.dataset.modal,\n title: triggerEl.dataset.modalTitle,\n url: triggerEl.href,\n updateUrl: triggerEl.dataset.modalUpdateUrl ?? false,\n useDefaultClose: triggerEl.dataset.modalDisableDefaultClose === undefined,\n useCustomClose: triggerEl.dataset.modalUseCustomClose !== undefined,\n })\n\n return false\n}\n\nconst openModal = (opts = {}) => {\n const type = opts.type\n const title = opts.title ?? false\n const useCustomClose = opts.useCustomClose ?? false\n let useDefaultClose = opts.useDefaultClose ?? true\n\n if (type === 'video') {\n useDefaultClose = false\n }\n\n if (type === 'subscribe') {\n useDefaultClose = false\n }\n\n const id = `modal-${Math.floor(Math.random() * Date.now())}`\n const template = generateTemplate(id, useDefaultClose, useCustomClose, title)\n const node = document.createRange().createContextualFragment(template)\n\n document.body.append(node)\n\n const modalEl = document.getElementById(id)\n const modal = new A11yDialog(modalEl)\n\n const hideModal = () => {\n modal.hide()\n }\n\n if (useCustomClose) {\n on('click', '.modal-custom-close', hideModal)\n }\n\n const currentUrl = opts.defaultUrl ?? window.location.href\n\n modal.on('show', () => {\n document.documentElement.classList.add('has-modal-active')\n\n if (opts.updateUrl !== false) {\n window.history.replaceState({}, '', opts.updateUrl)\n }\n })\n\n modal.on('hide', () => {\n document.documentElement.classList.remove('has-modal-active')\n\n modal.destroy()\n\n if (opts.updateUrl !== false) {\n window.history.replaceState({}, '', currentUrl)\n }\n\n if (useCustomClose) {\n off('click', '.modal-custom-close', hideModal)\n }\n })\n\n modal.on('destroy', (el) => {\n el.remove()\n })\n\n modal.show()\n\n populateModal(\n {\n type: type,\n url: opts.url ?? false,\n updateUrl: opts.updateUrl,\n defaultUrl: opts.defaultUrl,\n },\n modalEl\n )\n}\n\nexport default {\n init: () => {\n const clickArgs = ['click', '[data-modal]', handleModal]\n off(...clickArgs)\n on(...clickArgs)\n\n // If we have video modals, load the YouTube API\n if (document.querySelectorAll('[data-modal=\"video\"]').length) {\n const tag = document.createElement('script')\n tag.src = 'https://www.youtube.com/iframe_api'\n\n const firstScriptTag = document.getElementsByTagName('script')[0]\n\n firstScriptTag.parentNode.insertBefore(tag, firstScriptTag)\n }\n },\n openModal,\n}\n","function stringify(value) {\n return typeof value !== \"undefined\" ? value : \"\";\n}\nconst appendQueryParams = (url, qp, replace, config) => {\n let queryString;\n if (typeof qp === \"string\") {\n queryString = qp;\n }\n else {\n const usp = config.polyfill(\"URLSearchParams\", true, true);\n for (const key in qp) {\n const value = qp[key];\n if (qp[key] instanceof Array) {\n for (const val of value)\n usp.append(key, stringify(val));\n }\n else {\n usp.append(key, stringify(value));\n }\n }\n queryString = usp.toString();\n }\n const split = url.split(\"?\");\n if (!queryString)\n return replace ? split[0] : url;\n if (replace || split.length < 2)\n return split[0] + \"?\" + queryString;\n return url + \"&\" + queryString;\n};\n/**\n * Adds the ability to append query parameters from a javascript object.\n *\n * ```js\n * import QueryAddon from \"wretch/addons/queryString\"\n *\n * wretch().addon(QueryAddon)\n * ```\n */\nconst queryString = {\n wretch: {\n query(qp, replace = false) {\n return { ...this, _url: appendQueryParams(this._url, qp, replace, this._config) };\n }\n }\n};\nexport default queryString;\n//# sourceMappingURL=queryString.js.map","export const JSON_MIME = \"application/json\";\nexport const CONTENT_TYPE_HEADER = \"Content-Type\";\nexport const FETCH_ERROR = Symbol();\nexport const CATCHER_FALLBACK = Symbol();\n//# sourceMappingURL=constants.js.map","import { CONTENT_TYPE_HEADER } from \"./constants.js\";\nexport function extractContentType(headers = {}) {\n var _a;\n return (_a = Object.entries(headers).find(([k]) => k.toLowerCase() === CONTENT_TYPE_HEADER.toLowerCase())) === null || _a === void 0 ? void 0 : _a[1];\n}\nexport function isLikelyJsonMime(value) {\n return /^application\\/.*json.*/.test(value);\n}\nexport const mix = function (one, two, mergeArrays = false) {\n return Object.entries(two).reduce((acc, [key, newValue]) => {\n const value = one[key];\n if (Array.isArray(value) && Array.isArray(newValue)) {\n acc[key] = mergeArrays ? [...value, ...newValue] : newValue;\n }\n else if (typeof value === \"object\" && typeof newValue === \"object\") {\n acc[key] = mix(value, newValue, mergeArrays);\n }\n else {\n acc[key] = newValue;\n }\n return acc;\n }, { ...one });\n};\n//# sourceMappingURL=utils.js.map","import { mix } from \"./utils.js\";\nconst config = {\n // Default options\n options: {},\n // Error type\n errorType: \"text\",\n // Polyfills\n polyfills: {\n // fetch: null,\n // FormData: null,\n // URLSearchParams: null,\n // performance: null,\n // PerformanceObserver: null,\n // AbortController: null\n },\n polyfill(p, doThrow = true, instance = false, ...args) {\n const res = this.polyfills[p] ||\n (typeof self !== \"undefined\" ? self[p] : null) ||\n (typeof global !== \"undefined\" ? global[p] : null);\n if (doThrow && !res)\n throw new Error(p + \" is not defined\");\n return instance && res ? new res(...args) : res;\n }\n};\n/**\n * Sets the default fetch options that will be stored internally when instantiating wretch objects.\n *\n * ```js\n * import wretch from \"wretch\"\n *\n * wretch.options({ headers: { \"Accept\": \"application/json\" } });\n *\n * // The fetch request is sent with both headers.\n * wretch(\"...\", { headers: { \"X-Custom\": \"Header\" } }).get().res();\n * ```\n *\n * @param options Default options\n * @param replace If true, completely replaces the existing options instead of mixing in\n */\nexport function setOptions(options, replace = false) {\n config.options = replace ? options : mix(config.options, options);\n}\n/**\n * Sets the default polyfills that will be stored internally when instantiating wretch objects.\n * Useful for browserless environments like `node.js`.\n *\n * Needed for libraries like [fetch-ponyfill](https://github.com/qubyte/fetch-ponyfill).\n *\n * ```js\n * import wretch from \"wretch\"\n *\n * wretch.polyfills({\n * fetch: require(\"node-fetch\"),\n * FormData: require(\"form-data\"),\n * URLSearchParams: require(\"url\").URLSearchParams,\n * });\n *\n * // Uses the above polyfills.\n * wretch(\"...\").get().res();\n * ```\n *\n * @param polyfills An object containing the polyfills\n * @param replace If true, replaces the current polyfills instead of mixing in\n */\nexport function setPolyfills(polyfills, replace = false) {\n config.polyfills = replace ? polyfills : mix(config.polyfills, polyfills);\n}\n/**\n * Sets the default method (text, json, …) used to parse the data contained in the response body in case of an HTTP error.\n * As with other static methods, it will affect wretch instances created after calling this function.\n *\n * _Note: if the response Content-Type header is set to \"application/json\", the body will be parsed as json regardless of the errorType._\n *\n * ```js\n * import wretch from \"wretch\"\n *\n * wretch.errorType(\"json\")\n *\n * wretch(\"http://server/which/returns/an/error/with/a/json/body\")\n * .get()\n * .res()\n * .catch(error => {\n * // error[errorType] (here, json) contains the parsed body\n * console.log(error.json)\n * })\n * ```\n *\n * If null, defaults to \"text\".\n */\nexport function setErrorType(errorType) {\n config.errorType = errorType;\n}\nexport default config;\n//# sourceMappingURL=config.js.map","import { middlewareHelper } from \"./middleware.js\";\nimport { mix } from \"./utils.js\";\nimport { FETCH_ERROR, CATCHER_FALLBACK } from \"./constants.js\";\n/**\n * This class inheriting from Error is thrown when the fetch response is not \"ok\".\n * It extends Error and adds status, text and body fields.\n */\nexport class WretchError extends Error {\n}\nexport const resolver = (wretch) => {\n const sharedState = Object.create(null);\n wretch = wretch._addons.reduce((w, addon) => addon.beforeRequest &&\n addon.beforeRequest(w, wretch._options, sharedState)\n || w, wretch);\n const { _url: url, _options: opts, _config: config, _catchers: _catchers, _resolvers: resolvers, _middlewares: middlewares, _addons: addons } = wretch;\n const catchers = new Map(_catchers);\n const finalOptions = mix(config.options, opts);\n // The generated fetch request\n let finalUrl = url;\n const _fetchReq = middlewareHelper(middlewares)((url, options) => {\n finalUrl = url;\n return config.polyfill(\"fetch\")(url, options);\n })(url, finalOptions);\n // Throws on an http error\n const referenceError = new Error();\n const throwingPromise = _fetchReq\n .catch(error => {\n throw { [FETCH_ERROR]: error };\n })\n .then(response => {\n if (!response.ok) {\n const err = new WretchError();\n // Enhance the error object\n err[\"cause\"] = referenceError;\n err.stack = err.stack + \"\\nCAUSE: \" + referenceError.stack;\n err.response = response;\n err.url = finalUrl;\n if (response.type === \"opaque\") {\n throw err;\n }\n return response.text().then((body) => {\n var _a;\n err.message = body;\n if (config.errorType === \"json\" || ((_a = response.headers.get(\"Content-Type\")) === null || _a === void 0 ? void 0 : _a.split(\";\")[0]) === \"application/json\") {\n try {\n err.json = JSON.parse(body);\n }\n catch (e) { /* ignore */ }\n }\n err.text = body;\n err[\"status\"] = response.status;\n throw err;\n });\n }\n return response;\n });\n // Wraps the Promise in order to dispatch the error to a matching catcher\n const catchersWrapper = (promise) => {\n return promise.catch(err => {\n const fetchErrorFlag = err.hasOwnProperty(FETCH_ERROR);\n const error = fetchErrorFlag ? err[FETCH_ERROR] : err;\n const catcher = ((error === null || error === void 0 ? void 0 : error.status) && catchers.get(error.status)) ||\n catchers.get(error === null || error === void 0 ? void 0 : error.name) || (fetchErrorFlag && catchers.has(FETCH_ERROR) && catchers.get(FETCH_ERROR));\n if (catcher)\n return catcher(error, wretch);\n const catcherFallback = catchers.get(CATCHER_FALLBACK);\n if (catcherFallback)\n return catcherFallback(error, wretch);\n throw error;\n });\n };\n const bodyParser = funName => cb => funName ?\n // If a callback is provided, then callback with the body result otherwise return the parsed body itself.\n catchersWrapper(throwingPromise.then(_ => _ && _[funName]()).then(_ => cb ? cb(_) : _)) :\n // No body parsing method - return the response\n catchersWrapper(throwingPromise.then(_ => cb ? cb(_) : _));\n const responseChain = {\n _wretchReq: wretch,\n _fetchReq,\n _sharedState: sharedState,\n res: bodyParser(null),\n json: bodyParser(\"json\"),\n blob: bodyParser(\"blob\"),\n formData: bodyParser(\"formData\"),\n arrayBuffer: bodyParser(\"arrayBuffer\"),\n text: bodyParser(\"text\"),\n error(errorId, cb) {\n catchers.set(errorId, cb);\n return this;\n },\n badRequest(cb) { return this.error(400, cb); },\n unauthorized(cb) { return this.error(401, cb); },\n forbidden(cb) { return this.error(403, cb); },\n notFound(cb) { return this.error(404, cb); },\n timeout(cb) { return this.error(408, cb); },\n internalError(cb) { return this.error(500, cb); },\n fetchError(cb) { return this.error(FETCH_ERROR, cb); },\n };\n const enhancedResponseChain = addons.reduce((chain, addon) => ({\n ...chain,\n ...addon.resolver\n }), responseChain);\n return resolvers.reduce((chain, r) => r(chain, wretch), enhancedResponseChain);\n};\n//# sourceMappingURL=resolver.js.map","/**\n * @private @internal\n */\nexport const middlewareHelper = (middlewares) => (fetchFunction) => {\n return middlewares.reduceRight((acc, curr) => curr(acc), fetchFunction) || fetchFunction;\n};\n//# sourceMappingURL=middleware.js.map","import { mix, extractContentType, isLikelyJsonMime } from \"./utils.js\";\nimport { JSON_MIME, CONTENT_TYPE_HEADER, CATCHER_FALLBACK } from \"./constants.js\";\nimport { resolver } from \"./resolver.js\";\nimport config from \"./config.js\";\nexport const core = {\n _url: \"\",\n _options: {},\n _config: config,\n _catchers: new Map(),\n _resolvers: [],\n _deferred: [],\n _middlewares: [],\n _addons: [],\n addon(addon) {\n return { ...this, _addons: [...this._addons, addon], ...addon.wretch };\n },\n errorType(errorType) {\n return {\n ...this,\n _config: {\n ...this._config,\n errorType\n }\n };\n },\n polyfills(polyfills, replace = false) {\n return {\n ...this,\n _config: {\n ...this._config,\n polyfills: replace ? polyfills : mix(this._config.polyfills, polyfills)\n }\n };\n },\n url(_url, replace = false) {\n if (replace)\n return { ...this, _url };\n const split = this._url.split(\"?\");\n return {\n ...this,\n _url: split.length > 1 ?\n split[0] + _url + \"?\" + split[1] :\n this._url + _url\n };\n },\n options(options, replace = false) {\n return { ...this, _options: replace ? options : mix(this._options, options) };\n },\n headers(headerValues) {\n return { ...this, _options: mix(this._options, { headers: headerValues || {} }) };\n },\n accept(headerValue) {\n return this.headers({ Accept: headerValue });\n },\n content(headerValue) {\n return this.headers({ [CONTENT_TYPE_HEADER]: headerValue });\n },\n auth(headerValue) {\n return this.headers({ Authorization: headerValue });\n },\n catcher(errorId, catcher) {\n const newMap = new Map(this._catchers);\n newMap.set(errorId, catcher);\n return { ...this, _catchers: newMap };\n },\n catcherFallback(catcher) {\n return this.catcher(CATCHER_FALLBACK, catcher);\n },\n resolve(resolver, clear = false) {\n return { ...this, _resolvers: clear ? [resolver] : [...this._resolvers, resolver] };\n },\n defer(callback, clear = false) {\n return {\n ...this,\n _deferred: clear ? [callback] : [...this._deferred, callback]\n };\n },\n middlewares(middlewares, clear = false) {\n return {\n ...this,\n _middlewares: clear ? middlewares : [...this._middlewares, ...middlewares]\n };\n },\n fetch(method = this._options.method, url = \"\", body = null) {\n let base = this.url(url).options({ method });\n // \"Jsonify\" the body if it is an object and if it is likely that the content type targets json.\n const contentType = extractContentType(base._options.headers);\n const jsonify = typeof body === \"object\" && (!base._options.headers || !contentType || isLikelyJsonMime(contentType));\n base =\n !body ? base :\n jsonify ? base.json(body, contentType) :\n base.body(body);\n return resolver(base\n ._deferred\n .reduce((acc, curr) => curr(acc, acc._url, acc._options), base));\n },\n get(url = \"\") {\n return this.fetch(\"GET\", url);\n },\n delete(url = \"\") {\n return this.fetch(\"DELETE\", url);\n },\n put(body, url = \"\") {\n return this.fetch(\"PUT\", url, body);\n },\n post(body, url = \"\") {\n return this.fetch(\"POST\", url, body);\n },\n patch(body, url = \"\") {\n return this.fetch(\"PATCH\", url, body);\n },\n head(url = \"\") {\n return this.fetch(\"HEAD\", url);\n },\n opts(url = \"\") {\n return this.fetch(\"OPTIONS\", url);\n },\n body(contents) {\n return { ...this, _options: { ...this._options, body: contents } };\n },\n json(jsObject, contentType) {\n const currentContentType = extractContentType(this._options.headers);\n return this.content(contentType ||\n isLikelyJsonMime(currentContentType) && currentContentType ||\n JSON_MIME).body(JSON.stringify(jsObject));\n }\n};\n//# sourceMappingURL=core.js.map","import { setOptions, setErrorType, setPolyfills } from \"./config.js\";\nimport { core } from \"./core.js\";\nimport { WretchError } from \"./resolver.js\";\n/**\n * Creates a new wretch instance with a base url and base\n * [fetch options](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch).\n *\n * ```ts\n * import wretch from \"wretch\"\n *\n * // Reusable instance\n * const w = wretch(\"https://domain.com\", { mode: \"cors\" })\n * ```\n *\n * @param _url The base url\n * @param _options The base fetch options\n * @returns A fresh wretch instance\n */\nfunction factory(_url = \"\", _options = {}) {\n return { ...core, _url, _options };\n}\nfactory[\"default\"] = factory;\n/** {@inheritDoc setOptions} */\nfactory.options = setOptions;\n/** {@inheritDoc setErrorType} */\nfactory.errorType = setErrorType;\n/** {@inheritDoc setPolyfills} */\nfactory.polyfills = setPolyfills;\nfactory.WretchError = WretchError;\nexport default factory;\n//# sourceMappingURL=index.js.map"],"names":["wretch","options","headers","addon","QueryStringAddon","focusableSelectors","A11yDialog","element","this","_show","show","bind","_hide","hide","_maintainFocus","_bindKeypress","$el","shown","_id","getAttribute","id","_previouslyFocused","_listeners","create","$$","selector","context","collection","document","querySelectorAll","Array","prototype","slice","call","moveFocusToDialog","node","querySelector","focus","instantiateDialogs","forEach","setAttribute","hasAttribute","_openers","opener","addEventListener","_closers","filter","closer","closest","concat","_fire","event","activeElement","removeAttribute","body","removeEventListener","destroy","on","type","handler","push","off","index","indexOf","splice","listeners","domEvent","CustomEvent","detail","dispatchEvent","listener","focused","key","preventDefault","focusableChildren","join","child","offsetWidth","offsetHeight","getClientRects","length","getFocusableChildren","focusedItemIndex","shiftKey","trapTabKey","target","readyState","window","requestAnimationFrame","setTimeout","handleModal","e","triggerEl","openModal","dataset","modal","title","modalTitle","url","href","updateUrl","modalUpdateUrl","useDefaultClose","undefined","modalDisableDefaultClose","useCustomClose","modalUseCustomClose","opts","arguments","Math","floor","random","Date","now","template","generateTemplate","createRange","createContextualFragment","append","modalEl","getElementById","hideModal","currentUrl","defaultUrl","location","documentElement","classList","add","history","replaceState","remove","el","async","modalContent","innerHTML","ajax","get","text","populateModal","init","clickArgs","tag","createElement","src","firstScriptTag","getElementsByTagName","parentNode","insertBefore","stringify","value","appendQueryParams","qp","replace","config","queryString","usp","polyfill","val","toString","split","query","_url","_config","CONTENT_TYPE_HEADER","FETCH_ERROR","Symbol","CATCHER_FALLBACK","extractContentType","_a","Object","entries","find","k","toLowerCase","isLikelyJsonMime","test","mix","one","two","mergeArrays","reduce","acc","newValue","isArray","errorType","polyfills","p","doThrow","instance","args","res","self","global","Error","WretchError","resolver","sharedState","_addons","w","beforeRequest","_options","_catchers","_resolvers","resolvers","_middlewares","middlewares","addons","catchers","Map","finalOptions","finalUrl","_fetchReq","fetchFunction","reduceRight","curr","middlewareHelper","referenceError","throwingPromise","catch","error","then","response","ok","err","stack","message","json","JSON","parse","status","bodyParser","funName","cb","_","fetchErrorFlag","hasOwnProperty","catcher","name","has","catcherFallback","responseChain","_wretchReq","_sharedState","blob","formData","arrayBuffer","errorId","set","badRequest","unauthorized","forbidden","notFound","timeout","internalError","fetchError","enhancedResponseChain","chain","r","core","_deferred","headerValues","accept","headerValue","Accept","content","auth","Authorization","newMap","resolve","clear","defer","callback","fetch","method","base","contentType","jsonify","delete","put","post","patch","head","contents","jsObject","currentContentType","factory"],"sourceRoot":""}