{"version":3,"file":"wikipedia-preview.umd.cjs","sources":["../src/cachedRequest.js","../node_modules/dompurify/dist/purify.es.mjs","../src/utils.js","../src/i18n.js","../src/api.js","../src/gallery/gestures.js","../src/gallery/event.js","../src/gallery/slider.js","../src/gallery/fullscreen.js","../src/event.js","../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs","../node_modules/@floating-ui/core/dist/floating-ui.core.mjs","../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs","../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs","../src/popup.js","../src/touchPopup.js","../src/gallery/row.js","../src/preview.js","../src/index.js"],"sourcesContent":["const request = ( url, callback, parseJson = true ) => {\n\tconst xhr = new XMLHttpRequest()\n\txhr.open( 'GET', url )\n\txhr.send()\n\txhr.addEventListener( 'load', () => {\n\t\tconst content = parseJson ?\n\t\t\tJSON.parse( xhr.responseText ) :\n\t\t\txhr.responseText\n\t\tcallback( content )\n\t} )\n\txhr.addEventListener( 'error', () => {\n\t\tcallback( false, xhr.status )\n\t} )\n}\n\nconst dataCache = {}\n\nconst cachedRequest = ( url, transformFn, callback, parseJson = true, r = request ) => {\n\tif ( dataCache[ url ] !== undefined ) {\n\t\tcallback( dataCache[ url ] )\n\t\treturn\n\t}\n\tr( url, ( data, err ) => {\n\t\tif ( data ) {\n\t\t\tcallback( dataCache[ url ] = transformFn( data ) )\n\t\t} else {\n\t\t\tcallback( false, err )\n\t\t}\n\t}, parseJson )\n}\n\nexport { cachedRequest }\n","/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */\n\nconst {\n  entries,\n  setPrototypeOf,\n  isFrozen,\n  getPrototypeOf,\n  getOwnPropertyDescriptor\n} = Object;\nlet {\n  freeze,\n  seal,\n  create\n} = Object; // eslint-disable-line import/no-mutable-exports\nlet {\n  apply,\n  construct\n} = typeof Reflect !== 'undefined' && Reflect;\nif (!freeze) {\n  freeze = function freeze(x) {\n    return x;\n  };\n}\nif (!seal) {\n  seal = function seal(x) {\n    return x;\n  };\n}\nif (!apply) {\n  apply = function apply(fun, thisValue, args) {\n    return fun.apply(thisValue, args);\n  };\n}\nif (!construct) {\n  construct = function construct(Func, args) {\n    return new Func(...args);\n  };\n}\nconst arrayForEach = unapply(Array.prototype.forEach);\nconst arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);\nconst arrayPop = unapply(Array.prototype.pop);\nconst arrayPush = unapply(Array.prototype.push);\nconst arraySplice = unapply(Array.prototype.splice);\nconst stringToLowerCase = unapply(String.prototype.toLowerCase);\nconst stringToString = unapply(String.prototype.toString);\nconst stringMatch = unapply(String.prototype.match);\nconst stringReplace = unapply(String.prototype.replace);\nconst stringIndexOf = unapply(String.prototype.indexOf);\nconst stringTrim = unapply(String.prototype.trim);\nconst objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);\nconst regExpTest = unapply(RegExp.prototype.test);\nconst typeErrorCreate = unconstruct(TypeError);\n/**\n * Creates a new function that calls the given function with a specified thisArg and arguments.\n *\n * @param func - The function to be wrapped and called.\n * @returns A new function that calls the given function with a specified thisArg and arguments.\n */\nfunction unapply(func) {\n  return function (thisArg) {\n    if (thisArg instanceof RegExp) {\n      thisArg.lastIndex = 0;\n    }\n    for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n      args[_key - 1] = arguments[_key];\n    }\n    return apply(func, thisArg, args);\n  };\n}\n/**\n * Creates a new function that constructs an instance of the given constructor function with the provided arguments.\n *\n * @param func - The constructor function to be wrapped and called.\n * @returns A new function that constructs an instance of the given constructor function with the provided arguments.\n */\nfunction unconstruct(func) {\n  return function () {\n    for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n      args[_key2] = arguments[_key2];\n    }\n    return construct(func, args);\n  };\n}\n/**\n * Add properties to a lookup table\n *\n * @param set - The set to which elements will be added.\n * @param array - The array containing elements to be added to the set.\n * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.\n * @returns The modified set with added elements.\n */\nfunction addToSet(set, array) {\n  let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;\n  if (setPrototypeOf) {\n    // Make 'in' and truthy checks like Boolean(set.constructor)\n    // independent of any properties defined on Object.prototype.\n    // Prevent prototype setters from intercepting set as a this value.\n    setPrototypeOf(set, null);\n  }\n  let l = array.length;\n  while (l--) {\n    let element = array[l];\n    if (typeof element === 'string') {\n      const lcElement = transformCaseFunc(element);\n      if (lcElement !== element) {\n        // Config presets (e.g. tags.js, attrs.js) are immutable.\n        if (!isFrozen(array)) {\n          array[l] = lcElement;\n        }\n        element = lcElement;\n      }\n    }\n    set[element] = true;\n  }\n  return set;\n}\n/**\n * Clean up an array to harden against CSPP\n *\n * @param array - The array to be cleaned.\n * @returns The cleaned version of the array\n */\nfunction cleanArray(array) {\n  for (let index = 0; index < array.length; index++) {\n    const isPropertyExist = objectHasOwnProperty(array, index);\n    if (!isPropertyExist) {\n      array[index] = null;\n    }\n  }\n  return array;\n}\n/**\n * Shallow clone an object\n *\n * @param object - The object to be cloned.\n * @returns A new object that copies the original.\n */\nfunction clone(object) {\n  const newObject = create(null);\n  for (const [property, value] of entries(object)) {\n    const isPropertyExist = objectHasOwnProperty(object, property);\n    if (isPropertyExist) {\n      if (Array.isArray(value)) {\n        newObject[property] = cleanArray(value);\n      } else if (value && typeof value === 'object' && value.constructor === Object) {\n        newObject[property] = clone(value);\n      } else {\n        newObject[property] = value;\n      }\n    }\n  }\n  return newObject;\n}\n/**\n * This method automatically checks if the prop is function or getter and behaves accordingly.\n *\n * @param object - The object to look up the getter function in its prototype chain.\n * @param prop - The property name for which to find the getter function.\n * @returns The getter function found in the prototype chain or a fallback function.\n */\nfunction lookupGetter(object, prop) {\n  while (object !== null) {\n    const desc = getOwnPropertyDescriptor(object, prop);\n    if (desc) {\n      if (desc.get) {\n        return unapply(desc.get);\n      }\n      if (typeof desc.value === 'function') {\n        return unapply(desc.value);\n      }\n    }\n    object = getPrototypeOf(object);\n  }\n  function fallbackValue() {\n    return null;\n  }\n  return fallbackValue;\n}\n\nconst html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);\nconst svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);\nconst svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);\n// List of SVG elements that are disallowed by default.\n// We still need to know them so that we can do namespace\n// checks properly in case one wants to add them to\n// allow-list.\nconst svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);\nconst mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);\n// Similarly to SVG, we want to know all MathML elements,\n// even those that we disallow by default.\nconst mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);\nconst text = freeze(['#text']);\n\nconst html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);\nconst svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);\nconst mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);\nconst xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);\n\n// eslint-disable-next-line unicorn/better-regex\nconst MUSTACHE_EXPR = seal(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode\nconst ERB_EXPR = seal(/<%[\\w\\W]*|[\\w\\W]*%>/gm);\nconst TMPLIT_EXPR = seal(/\\$\\{[\\w\\W]*/gm); // eslint-disable-line unicorn/better-regex\nconst DATA_ATTR = seal(/^data-[\\-\\w.\\u00B7-\\uFFFF]+$/); // eslint-disable-line no-useless-escape\nconst ARIA_ATTR = seal(/^aria-[\\-\\w]+$/); // eslint-disable-line no-useless-escape\nconst IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i // eslint-disable-line no-useless-escape\n);\nconst IS_SCRIPT_OR_DATA = seal(/^(?:\\w+script|data):/i);\nconst ATTR_WHITESPACE = seal(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g // eslint-disable-line no-control-regex\n);\nconst DOCTYPE_NAME = seal(/^html$/i);\nconst CUSTOM_ELEMENT = seal(/^[a-z][.\\w]*(-[.\\w]+)+$/i);\n\nvar EXPRESSIONS = /*#__PURE__*/Object.freeze({\n  __proto__: null,\n  ARIA_ATTR: ARIA_ATTR,\n  ATTR_WHITESPACE: ATTR_WHITESPACE,\n  CUSTOM_ELEMENT: CUSTOM_ELEMENT,\n  DATA_ATTR: DATA_ATTR,\n  DOCTYPE_NAME: DOCTYPE_NAME,\n  ERB_EXPR: ERB_EXPR,\n  IS_ALLOWED_URI: IS_ALLOWED_URI,\n  IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,\n  MUSTACHE_EXPR: MUSTACHE_EXPR,\n  TMPLIT_EXPR: TMPLIT_EXPR\n});\n\n/* eslint-disable @typescript-eslint/indent */\n// https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType\nconst NODE_TYPE = {\n  element: 1,\n  attribute: 2,\n  text: 3,\n  cdataSection: 4,\n  entityReference: 5,\n  // Deprecated\n  entityNode: 6,\n  // Deprecated\n  progressingInstruction: 7,\n  comment: 8,\n  document: 9,\n  documentType: 10,\n  documentFragment: 11,\n  notation: 12 // Deprecated\n};\nconst getGlobal = function getGlobal() {\n  return typeof window === 'undefined' ? null : window;\n};\n/**\n * Creates a no-op policy for internal use only.\n * Don't export this function outside this module!\n * @param trustedTypes The policy factory.\n * @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).\n * @return The policy created (or null, if Trusted Types\n * are not supported or creating the policy failed).\n */\nconst _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {\n  if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {\n    return null;\n  }\n  // Allow the callers to control the unique policy name\n  // by adding a data-tt-policy-suffix to the script element with the DOMPurify.\n  // Policy creation with duplicate names throws in Trusted Types.\n  let suffix = null;\n  const ATTR_NAME = 'data-tt-policy-suffix';\n  if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {\n    suffix = purifyHostElement.getAttribute(ATTR_NAME);\n  }\n  const policyName = 'dompurify' + (suffix ? '#' + suffix : '');\n  try {\n    return trustedTypes.createPolicy(policyName, {\n      createHTML(html) {\n        return html;\n      },\n      createScriptURL(scriptUrl) {\n        return scriptUrl;\n      }\n    });\n  } catch (_) {\n    // Policy creation failed (most likely another DOMPurify script has\n    // already run). Skip creating the policy, as this will only cause errors\n    // if TT are enforced.\n    console.warn('TrustedTypes policy ' + policyName + ' could not be created.');\n    return null;\n  }\n};\nconst _createHooksMap = function _createHooksMap() {\n  return {\n    afterSanitizeAttributes: [],\n    afterSanitizeElements: [],\n    afterSanitizeShadowDOM: [],\n    beforeSanitizeAttributes: [],\n    beforeSanitizeElements: [],\n    beforeSanitizeShadowDOM: [],\n    uponSanitizeAttribute: [],\n    uponSanitizeElement: [],\n    uponSanitizeShadowNode: []\n  };\n};\nfunction createDOMPurify() {\n  let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();\n  const DOMPurify = root => createDOMPurify(root);\n  DOMPurify.version = '3.2.6';\n  DOMPurify.removed = [];\n  if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {\n    // Not running in a browser, provide a factory function\n    // so that you can pass your own Window\n    DOMPurify.isSupported = false;\n    return DOMPurify;\n  }\n  let {\n    document\n  } = window;\n  const originalDocument = document;\n  const currentScript = originalDocument.currentScript;\n  const {\n    DocumentFragment,\n    HTMLTemplateElement,\n    Node,\n    Element,\n    NodeFilter,\n    NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,\n    HTMLFormElement,\n    DOMParser,\n    trustedTypes\n  } = window;\n  const ElementPrototype = Element.prototype;\n  const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');\n  const remove = lookupGetter(ElementPrototype, 'remove');\n  const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');\n  const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');\n  const getParentNode = lookupGetter(ElementPrototype, 'parentNode');\n  // As per issue #47, the web-components registry is inherited by a\n  // new document created via createHTMLDocument. As per the spec\n  // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)\n  // a new empty registry is used when creating a template contents owner\n  // document, so we use that as our parent document to ensure nothing\n  // is inherited.\n  if (typeof HTMLTemplateElement === 'function') {\n    const template = document.createElement('template');\n    if (template.content && template.content.ownerDocument) {\n      document = template.content.ownerDocument;\n    }\n  }\n  let trustedTypesPolicy;\n  let emptyHTML = '';\n  const {\n    implementation,\n    createNodeIterator,\n    createDocumentFragment,\n    getElementsByTagName\n  } = document;\n  const {\n    importNode\n  } = originalDocument;\n  let hooks = _createHooksMap();\n  /**\n   * Expose whether this browser supports running the full DOMPurify.\n   */\n  DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;\n  const {\n    MUSTACHE_EXPR,\n    ERB_EXPR,\n    TMPLIT_EXPR,\n    DATA_ATTR,\n    ARIA_ATTR,\n    IS_SCRIPT_OR_DATA,\n    ATTR_WHITESPACE,\n    CUSTOM_ELEMENT\n  } = EXPRESSIONS;\n  let {\n    IS_ALLOWED_URI: IS_ALLOWED_URI$1\n  } = EXPRESSIONS;\n  /**\n   * We consider the elements and attributes below to be safe. Ideally\n   * don't add any new ones but feel free to remove unwanted ones.\n   */\n  /* allowed element names */\n  let ALLOWED_TAGS = null;\n  const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);\n  /* Allowed attribute names */\n  let ALLOWED_ATTR = null;\n  const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);\n  /*\n   * Configure how DOMPurify should handle custom elements and their attributes as well as customized built-in elements.\n   * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)\n   * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)\n   * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.\n   */\n  let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {\n    tagNameCheck: {\n      writable: true,\n      configurable: false,\n      enumerable: true,\n      value: null\n    },\n    attributeNameCheck: {\n      writable: true,\n      configurable: false,\n      enumerable: true,\n      value: null\n    },\n    allowCustomizedBuiltInElements: {\n      writable: true,\n      configurable: false,\n      enumerable: true,\n      value: false\n    }\n  }));\n  /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */\n  let FORBID_TAGS = null;\n  /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */\n  let FORBID_ATTR = null;\n  /* Decide if ARIA attributes are okay */\n  let ALLOW_ARIA_ATTR = true;\n  /* Decide if custom data attributes are okay */\n  let ALLOW_DATA_ATTR = true;\n  /* Decide if unknown protocols are okay */\n  let ALLOW_UNKNOWN_PROTOCOLS = false;\n  /* Decide if self-closing tags in attributes are allowed.\n   * Usually removed due to a mXSS issue in jQuery 3.0 */\n  let ALLOW_SELF_CLOSE_IN_ATTR = true;\n  /* Output should be safe for common template engines.\n   * This means, DOMPurify removes data attributes, mustaches and ERB\n   */\n  let SAFE_FOR_TEMPLATES = false;\n  /* Output should be safe even for XML used within HTML and alike.\n   * This means, DOMPurify removes comments when containing risky content.\n   */\n  let SAFE_FOR_XML = true;\n  /* Decide if document with <html>... should be returned */\n  let WHOLE_DOCUMENT = false;\n  /* Track whether config is already set on this instance of DOMPurify. */\n  let SET_CONFIG = false;\n  /* Decide if all elements (e.g. style, script) must be children of\n   * document.body. By default, browsers might move them to document.head */\n  let FORCE_BODY = false;\n  /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html\n   * string (or a TrustedHTML object if Trusted Types are supported).\n   * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead\n   */\n  let RETURN_DOM = false;\n  /* Decide if a DOM `DocumentFragment` should be returned, instead of a html\n   * string  (or a TrustedHTML object if Trusted Types are supported) */\n  let RETURN_DOM_FRAGMENT = false;\n  /* Try to return a Trusted Type object instead of a string, return a string in\n   * case Trusted Types are not supported  */\n  let RETURN_TRUSTED_TYPE = false;\n  /* Output should be free from DOM clobbering attacks?\n   * This sanitizes markups named with colliding, clobberable built-in DOM APIs.\n   */\n  let SANITIZE_DOM = true;\n  /* Achieve full DOM Clobbering protection by isolating the namespace of named\n   * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.\n   *\n   * HTML/DOM spec rules that enable DOM Clobbering:\n   *   - Named Access on Window (§7.3.3)\n   *   - DOM Tree Accessors (§3.1.5)\n   *   - Form Element Parent-Child Relations (§4.10.3)\n   *   - Iframe srcdoc / Nested WindowProxies (§4.8.5)\n   *   - HTMLCollection (§4.2.10.2)\n   *\n   * Namespace isolation is implemented by prefixing `id` and `name` attributes\n   * with a constant string, i.e., `user-content-`\n   */\n  let SANITIZE_NAMED_PROPS = false;\n  const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';\n  /* Keep element content when removing element? */\n  let KEEP_CONTENT = true;\n  /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead\n   * of importing it into a new Document and returning a sanitized copy */\n  let IN_PLACE = false;\n  /* Allow usage of profiles like html, svg and mathMl */\n  let USE_PROFILES = {};\n  /* Tags to ignore content of when KEEP_CONTENT is true */\n  let FORBID_CONTENTS = null;\n  const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);\n  /* Tags that are safe for data: URIs */\n  let DATA_URI_TAGS = null;\n  const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);\n  /* Attributes safe for values like \"javascript:\" */\n  let URI_SAFE_ATTRIBUTES = null;\n  const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);\n  const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n  const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n  const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\n  /* Document namespace */\n  let NAMESPACE = HTML_NAMESPACE;\n  let IS_EMPTY_INPUT = false;\n  /* Allowed XHTML+XML namespaces */\n  let ALLOWED_NAMESPACES = null;\n  const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);\n  let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);\n  let HTML_INTEGRATION_POINTS = addToSet({}, ['annotation-xml']);\n  // Certain elements are allowed in both SVG and HTML\n  // namespace. We need to specify them explicitly\n  // so that they don't get erroneously deleted from\n  // HTML namespace.\n  const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);\n  /* Parsing of strict XHTML documents */\n  let PARSER_MEDIA_TYPE = null;\n  const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];\n  const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';\n  let transformCaseFunc = null;\n  /* Keep a reference to config to pass to hooks */\n  let CONFIG = null;\n  /* Ideally, do not touch anything below this line */\n  /* ______________________________________________ */\n  const formElement = document.createElement('form');\n  const isRegexOrFunction = function isRegexOrFunction(testValue) {\n    return testValue instanceof RegExp || testValue instanceof Function;\n  };\n  /**\n   * _parseConfig\n   *\n   * @param cfg optional config literal\n   */\n  // eslint-disable-next-line complexity\n  const _parseConfig = function _parseConfig() {\n    let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n    if (CONFIG && CONFIG === cfg) {\n      return;\n    }\n    /* Shield configuration object from tampering */\n    if (!cfg || typeof cfg !== 'object') {\n      cfg = {};\n    }\n    /* Shield configuration object from prototype pollution */\n    cfg = clone(cfg);\n    PARSER_MEDIA_TYPE =\n    // eslint-disable-next-line unicorn/prefer-includes\n    SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;\n    // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.\n    transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;\n    /* Set configuration parameters */\n    ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;\n    ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;\n    ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;\n    URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;\n    DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;\n    FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;\n    FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});\n    FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});\n    USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;\n    ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true\n    ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true\n    ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false\n    ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true\n    SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false\n    SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true\n    WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false\n    RETURN_DOM = cfg.RETURN_DOM || false; // Default false\n    RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false\n    RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false\n    FORCE_BODY = cfg.FORCE_BODY || false; // Default false\n    SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true\n    SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false\n    KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true\n    IN_PLACE = cfg.IN_PLACE || false; // Default false\n    IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;\n    NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;\n    MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;\n    HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;\n    CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};\n    if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {\n      CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;\n    }\n    if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {\n      CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;\n    }\n    if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {\n      CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;\n    }\n    if (SAFE_FOR_TEMPLATES) {\n      ALLOW_DATA_ATTR = false;\n    }\n    if (RETURN_DOM_FRAGMENT) {\n      RETURN_DOM = true;\n    }\n    /* Parse profile info */\n    if (USE_PROFILES) {\n      ALLOWED_TAGS = addToSet({}, text);\n      ALLOWED_ATTR = [];\n      if (USE_PROFILES.html === true) {\n        addToSet(ALLOWED_TAGS, html$1);\n        addToSet(ALLOWED_ATTR, html);\n      }\n      if (USE_PROFILES.svg === true) {\n        addToSet(ALLOWED_TAGS, svg$1);\n        addToSet(ALLOWED_ATTR, svg);\n        addToSet(ALLOWED_ATTR, xml);\n      }\n      if (USE_PROFILES.svgFilters === true) {\n        addToSet(ALLOWED_TAGS, svgFilters);\n        addToSet(ALLOWED_ATTR, svg);\n        addToSet(ALLOWED_ATTR, xml);\n      }\n      if (USE_PROFILES.mathMl === true) {\n        addToSet(ALLOWED_TAGS, mathMl$1);\n        addToSet(ALLOWED_ATTR, mathMl);\n        addToSet(ALLOWED_ATTR, xml);\n      }\n    }\n    /* Merge configuration parameters */\n    if (cfg.ADD_TAGS) {\n      if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {\n        ALLOWED_TAGS = clone(ALLOWED_TAGS);\n      }\n      addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);\n    }\n    if (cfg.ADD_ATTR) {\n      if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {\n        ALLOWED_ATTR = clone(ALLOWED_ATTR);\n      }\n      addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);\n    }\n    if (cfg.ADD_URI_SAFE_ATTR) {\n      addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);\n    }\n    if (cfg.FORBID_CONTENTS) {\n      if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {\n        FORBID_CONTENTS = clone(FORBID_CONTENTS);\n      }\n      addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);\n    }\n    /* Add #text in case KEEP_CONTENT is set to true */\n    if (KEEP_CONTENT) {\n      ALLOWED_TAGS['#text'] = true;\n    }\n    /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */\n    if (WHOLE_DOCUMENT) {\n      addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);\n    }\n    /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */\n    if (ALLOWED_TAGS.table) {\n      addToSet(ALLOWED_TAGS, ['tbody']);\n      delete FORBID_TAGS.tbody;\n    }\n    if (cfg.TRUSTED_TYPES_POLICY) {\n      if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {\n        throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.');\n      }\n      if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {\n        throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.');\n      }\n      // Overwrite existing TrustedTypes policy.\n      trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;\n      // Sign local variables required by `sanitize`.\n      emptyHTML = trustedTypesPolicy.createHTML('');\n    } else {\n      // Uninitialized policy, attempt to initialize the internal dompurify policy.\n      if (trustedTypesPolicy === undefined) {\n        trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);\n      }\n      // If creating the internal policy succeeded sign internal variables.\n      if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {\n        emptyHTML = trustedTypesPolicy.createHTML('');\n      }\n    }\n    // Prevent further manipulation of configuration.\n    // Not available in IE8, Safari 5, etc.\n    if (freeze) {\n      freeze(cfg);\n    }\n    CONFIG = cfg;\n  };\n  /* Keep track of all possible SVG and MathML tags\n   * so that we can perform the namespace checks\n   * correctly. */\n  const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);\n  const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);\n  /**\n   * @param element a DOM element whose namespace is being checked\n   * @returns Return false if the element has a\n   *  namespace that a spec-compliant parser would never\n   *  return. Return true otherwise.\n   */\n  const _checkValidNamespace = function _checkValidNamespace(element) {\n    let parent = getParentNode(element);\n    // In JSDOM, if we're inside shadow DOM, then parentNode\n    // can be null. We just simulate parent in this case.\n    if (!parent || !parent.tagName) {\n      parent = {\n        namespaceURI: NAMESPACE,\n        tagName: 'template'\n      };\n    }\n    const tagName = stringToLowerCase(element.tagName);\n    const parentTagName = stringToLowerCase(parent.tagName);\n    if (!ALLOWED_NAMESPACES[element.namespaceURI]) {\n      return false;\n    }\n    if (element.namespaceURI === SVG_NAMESPACE) {\n      // The only way to switch from HTML namespace to SVG\n      // is via <svg>. If it happens via any other tag, then\n      // it should be killed.\n      if (parent.namespaceURI === HTML_NAMESPACE) {\n        return tagName === 'svg';\n      }\n      // The only way to switch from MathML to SVG is via`\n      // svg if parent is either <annotation-xml> or MathML\n      // text integration points.\n      if (parent.namespaceURI === MATHML_NAMESPACE) {\n        return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);\n      }\n      // We only allow elements that are defined in SVG\n      // spec. All others are disallowed in SVG namespace.\n      return Boolean(ALL_SVG_TAGS[tagName]);\n    }\n    if (element.namespaceURI === MATHML_NAMESPACE) {\n      // The only way to switch from HTML namespace to MathML\n      // is via <math>. If it happens via any other tag, then\n      // it should be killed.\n      if (parent.namespaceURI === HTML_NAMESPACE) {\n        return tagName === 'math';\n      }\n      // The only way to switch from SVG to MathML is via\n      // <math> and HTML integration points\n      if (parent.namespaceURI === SVG_NAMESPACE) {\n        return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];\n      }\n      // We only allow elements that are defined in MathML\n      // spec. All others are disallowed in MathML namespace.\n      return Boolean(ALL_MATHML_TAGS[tagName]);\n    }\n    if (element.namespaceURI === HTML_NAMESPACE) {\n      // The only way to switch from SVG to HTML is via\n      // HTML integration points, and from MathML to HTML\n      // is via MathML text integration points\n      if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {\n        return false;\n      }\n      if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {\n        return false;\n      }\n      // We disallow tags that are specific for MathML\n      // or SVG and should never appear in HTML namespace\n      return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);\n    }\n    // For XHTML and XML documents that support custom namespaces\n    if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {\n      return true;\n    }\n    // The code should never reach this place (this means\n    // that the element somehow got namespace that is not\n    // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).\n    // Return false just in case.\n    return false;\n  };\n  /**\n   * _forceRemove\n   *\n   * @param node a DOM node\n   */\n  const _forceRemove = function _forceRemove(node) {\n    arrayPush(DOMPurify.removed, {\n      element: node\n    });\n    try {\n      // eslint-disable-next-line unicorn/prefer-dom-node-remove\n      getParentNode(node).removeChild(node);\n    } catch (_) {\n      remove(node);\n    }\n  };\n  /**\n   * _removeAttribute\n   *\n   * @param name an Attribute name\n   * @param element a DOM node\n   */\n  const _removeAttribute = function _removeAttribute(name, element) {\n    try {\n      arrayPush(DOMPurify.removed, {\n        attribute: element.getAttributeNode(name),\n        from: element\n      });\n    } catch (_) {\n      arrayPush(DOMPurify.removed, {\n        attribute: null,\n        from: element\n      });\n    }\n    element.removeAttribute(name);\n    // We void attribute values for unremovable \"is\" attributes\n    if (name === 'is') {\n      if (RETURN_DOM || RETURN_DOM_FRAGMENT) {\n        try {\n          _forceRemove(element);\n        } catch (_) {}\n      } else {\n        try {\n          element.setAttribute(name, '');\n        } catch (_) {}\n      }\n    }\n  };\n  /**\n   * _initDocument\n   *\n   * @param dirty - a string of dirty markup\n   * @return a DOM, filled with the dirty markup\n   */\n  const _initDocument = function _initDocument(dirty) {\n    /* Create a HTML document */\n    let doc = null;\n    let leadingWhitespace = null;\n    if (FORCE_BODY) {\n      dirty = '<remove></remove>' + dirty;\n    } else {\n      /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */\n      const matches = stringMatch(dirty, /^[\\r\\n\\t ]+/);\n      leadingWhitespace = matches && matches[0];\n    }\n    if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {\n      // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)\n      dirty = '<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>' + dirty + '</body></html>';\n    }\n    const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;\n    /*\n     * Use the DOMParser API by default, fallback later if needs be\n     * DOMParser not work for svg when has multiple root element.\n     */\n    if (NAMESPACE === HTML_NAMESPACE) {\n      try {\n        doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);\n      } catch (_) {}\n    }\n    /* Use createHTMLDocument in case DOMParser is not available */\n    if (!doc || !doc.documentElement) {\n      doc = implementation.createDocument(NAMESPACE, 'template', null);\n      try {\n        doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;\n      } catch (_) {\n        // Syntax error if dirtyPayload is invalid xml\n      }\n    }\n    const body = doc.body || doc.documentElement;\n    if (dirty && leadingWhitespace) {\n      body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);\n    }\n    /* Work on whole document or just its body */\n    if (NAMESPACE === HTML_NAMESPACE) {\n      return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];\n    }\n    return WHOLE_DOCUMENT ? doc.documentElement : body;\n  };\n  /**\n   * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.\n   *\n   * @param root The root element or node to start traversing on.\n   * @return The created NodeIterator\n   */\n  const _createNodeIterator = function _createNodeIterator(root) {\n    return createNodeIterator.call(root.ownerDocument || root, root,\n    // eslint-disable-next-line no-bitwise\n    NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);\n  };\n  /**\n   * _isClobbered\n   *\n   * @param element element to check for clobbering attacks\n   * @return true if clobbered, false if safe\n   */\n  const _isClobbered = function _isClobbered(element) {\n    return element instanceof HTMLFormElement && (typeof element.nodeName !== 'string' || typeof element.textContent !== 'string' || typeof element.removeChild !== 'function' || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== 'function' || typeof element.setAttribute !== 'function' || typeof element.namespaceURI !== 'string' || typeof element.insertBefore !== 'function' || typeof element.hasChildNodes !== 'function');\n  };\n  /**\n   * Checks whether the given object is a DOM node.\n   *\n   * @param value object to check whether it's a DOM node\n   * @return true is object is a DOM node\n   */\n  const _isNode = function _isNode(value) {\n    return typeof Node === 'function' && value instanceof Node;\n  };\n  function _executeHooks(hooks, currentNode, data) {\n    arrayForEach(hooks, hook => {\n      hook.call(DOMPurify, currentNode, data, CONFIG);\n    });\n  }\n  /**\n   * _sanitizeElements\n   *\n   * @protect nodeName\n   * @protect textContent\n   * @protect removeChild\n   * @param currentNode to check for permission to exist\n   * @return true if node was killed, false if left alive\n   */\n  const _sanitizeElements = function _sanitizeElements(currentNode) {\n    let content = null;\n    /* Execute a hook if present */\n    _executeHooks(hooks.beforeSanitizeElements, currentNode, null);\n    /* Check if element is clobbered or can clobber */\n    if (_isClobbered(currentNode)) {\n      _forceRemove(currentNode);\n      return true;\n    }\n    /* Now let's check the element's type and name */\n    const tagName = transformCaseFunc(currentNode.nodeName);\n    /* Execute a hook if present */\n    _executeHooks(hooks.uponSanitizeElement, currentNode, {\n      tagName,\n      allowedTags: ALLOWED_TAGS\n    });\n    /* Detect mXSS attempts abusing namespace confusion */\n    if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\\w!]/g, currentNode.textContent)) {\n      _forceRemove(currentNode);\n      return true;\n    }\n    /* Remove any occurrence of processing instructions */\n    if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {\n      _forceRemove(currentNode);\n      return true;\n    }\n    /* Remove any kind of possibly harmful comments */\n    if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\\w]/g, currentNode.data)) {\n      _forceRemove(currentNode);\n      return true;\n    }\n    /* Remove element if anything forbids its presence */\n    if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n      /* Check if we have a custom element to handle */\n      if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {\n        if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {\n          return false;\n        }\n        if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {\n          return false;\n        }\n      }\n      /* Keep content except for bad-listed elements */\n      if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {\n        const parentNode = getParentNode(currentNode) || currentNode.parentNode;\n        const childNodes = getChildNodes(currentNode) || currentNode.childNodes;\n        if (childNodes && parentNode) {\n          const childCount = childNodes.length;\n          for (let i = childCount - 1; i >= 0; --i) {\n            const childClone = cloneNode(childNodes[i], true);\n            childClone.__removalCount = (currentNode.__removalCount || 0) + 1;\n            parentNode.insertBefore(childClone, getNextSibling(currentNode));\n          }\n        }\n      }\n      _forceRemove(currentNode);\n      return true;\n    }\n    /* Check whether element has a valid namespace */\n    if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {\n      _forceRemove(currentNode);\n      return true;\n    }\n    /* Make sure that older browsers don't get fallback-tag mXSS */\n    if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\\/no(script|embed|frames)/i, currentNode.innerHTML)) {\n      _forceRemove(currentNode);\n      return true;\n    }\n    /* Sanitize element content to be template-safe */\n    if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {\n      /* Get the element's text content */\n      content = currentNode.textContent;\n      arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n        content = stringReplace(content, expr, ' ');\n      });\n      if (currentNode.textContent !== content) {\n        arrayPush(DOMPurify.removed, {\n          element: currentNode.cloneNode()\n        });\n        currentNode.textContent = content;\n      }\n    }\n    /* Execute a hook if present */\n    _executeHooks(hooks.afterSanitizeElements, currentNode, null);\n    return false;\n  };\n  /**\n   * _isValidAttribute\n   *\n   * @param lcTag Lowercase tag name of containing element.\n   * @param lcName Lowercase attribute name.\n   * @param value Attribute value.\n   * @return Returns true if `value` is valid, otherwise false.\n   */\n  // eslint-disable-next-line complexity\n  const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {\n    /* Make sure attribute cannot clobber */\n    if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {\n      return false;\n    }\n    /* Allow valid data-* attributes: At least one character after \"-\"\n        (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)\n        XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)\n        We don't need to check the value; it's always URI safe. */\n    if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {\n      if (\n      // First condition does a very basic check if a) it's basically a valid custom element tagname AND\n      // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n      // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck\n      _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||\n      // Alternative, second condition checks if it's an `is`-attribute, AND\n      // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n      lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {\n        return false;\n      }\n      /* Check value is safe. First, is attr inert? If so, is safe */\n    } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {\n      return false;\n    } else ;\n    return true;\n  };\n  /**\n   * _isBasicCustomElement\n   * checks if at least one dash is included in tagName, and it's not the first char\n   * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name\n   *\n   * @param tagName name of the tag of the node to sanitize\n   * @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.\n   */\n  const _isBasicCustomElement = function _isBasicCustomElement(tagName) {\n    return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);\n  };\n  /**\n   * _sanitizeAttributes\n   *\n   * @protect attributes\n   * @protect nodeName\n   * @protect removeAttribute\n   * @protect setAttribute\n   *\n   * @param currentNode to sanitize\n   */\n  const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {\n    /* Execute a hook if present */\n    _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);\n    const {\n      attributes\n    } = currentNode;\n    /* Check if we have attributes; if not we might have a text node */\n    if (!attributes || _isClobbered(currentNode)) {\n      return;\n    }\n    const hookEvent = {\n      attrName: '',\n      attrValue: '',\n      keepAttr: true,\n      allowedAttributes: ALLOWED_ATTR,\n      forceKeepAttr: undefined\n    };\n    let l = attributes.length;\n    /* Go backwards over all attributes; safely remove bad ones */\n    while (l--) {\n      const attr = attributes[l];\n      const {\n        name,\n        namespaceURI,\n        value: attrValue\n      } = attr;\n      const lcName = transformCaseFunc(name);\n      const initValue = attrValue;\n      let value = name === 'value' ? initValue : stringTrim(initValue);\n      /* Execute a hook if present */\n      hookEvent.attrName = lcName;\n      hookEvent.attrValue = value;\n      hookEvent.keepAttr = true;\n      hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set\n      _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);\n      value = hookEvent.attrValue;\n      /* Full DOM Clobbering protection via namespace isolation,\n       * Prefix id and name attributes with `user-content-`\n       */\n      if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {\n        // Remove the attribute with this value\n        _removeAttribute(name, currentNode);\n        // Prefix the value and later re-create the attribute with the sanitized value\n        value = SANITIZE_NAMED_PROPS_PREFIX + value;\n      }\n      /* Work around a security issue with comments inside attributes */\n      if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\\/(style|title)/i, value)) {\n        _removeAttribute(name, currentNode);\n        continue;\n      }\n      /* Did the hooks approve of the attribute? */\n      if (hookEvent.forceKeepAttr) {\n        continue;\n      }\n      /* Did the hooks approve of the attribute? */\n      if (!hookEvent.keepAttr) {\n        _removeAttribute(name, currentNode);\n        continue;\n      }\n      /* Work around a security issue in jQuery 3.0 */\n      if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\\/>/i, value)) {\n        _removeAttribute(name, currentNode);\n        continue;\n      }\n      /* Sanitize attribute content to be template-safe */\n      if (SAFE_FOR_TEMPLATES) {\n        arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n          value = stringReplace(value, expr, ' ');\n        });\n      }\n      /* Is `value` valid for this attribute? */\n      const lcTag = transformCaseFunc(currentNode.nodeName);\n      if (!_isValidAttribute(lcTag, lcName, value)) {\n        _removeAttribute(name, currentNode);\n        continue;\n      }\n      /* Handle attributes that require Trusted Types */\n      if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {\n        if (namespaceURI) ; else {\n          switch (trustedTypes.getAttributeType(lcTag, lcName)) {\n            case 'TrustedHTML':\n              {\n                value = trustedTypesPolicy.createHTML(value);\n                break;\n              }\n            case 'TrustedScriptURL':\n              {\n                value = trustedTypesPolicy.createScriptURL(value);\n                break;\n              }\n          }\n        }\n      }\n      /* Handle invalid data-* attribute set by try-catching it */\n      if (value !== initValue) {\n        try {\n          if (namespaceURI) {\n            currentNode.setAttributeNS(namespaceURI, name, value);\n          } else {\n            /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. \"x-schema\". */\n            currentNode.setAttribute(name, value);\n          }\n          if (_isClobbered(currentNode)) {\n            _forceRemove(currentNode);\n          } else {\n            arrayPop(DOMPurify.removed);\n          }\n        } catch (_) {\n          _removeAttribute(name, currentNode);\n        }\n      }\n    }\n    /* Execute a hook if present */\n    _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);\n  };\n  /**\n   * _sanitizeShadowDOM\n   *\n   * @param fragment to iterate over recursively\n   */\n  const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {\n    let shadowNode = null;\n    const shadowIterator = _createNodeIterator(fragment);\n    /* Execute a hook if present */\n    _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);\n    while (shadowNode = shadowIterator.nextNode()) {\n      /* Execute a hook if present */\n      _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);\n      /* Sanitize tags and elements */\n      _sanitizeElements(shadowNode);\n      /* Check attributes next */\n      _sanitizeAttributes(shadowNode);\n      /* Deep shadow DOM detected */\n      if (shadowNode.content instanceof DocumentFragment) {\n        _sanitizeShadowDOM(shadowNode.content);\n      }\n    }\n    /* Execute a hook if present */\n    _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);\n  };\n  // eslint-disable-next-line complexity\n  DOMPurify.sanitize = function (dirty) {\n    let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n    let body = null;\n    let importedNode = null;\n    let currentNode = null;\n    let returnNode = null;\n    /* Make sure we have a string to sanitize.\n      DO NOT return early, as this will return the wrong type if\n      the user has requested a DOM object rather than a string */\n    IS_EMPTY_INPUT = !dirty;\n    if (IS_EMPTY_INPUT) {\n      dirty = '<!-->';\n    }\n    /* Stringify, in case dirty is an object */\n    if (typeof dirty !== 'string' && !_isNode(dirty)) {\n      if (typeof dirty.toString === 'function') {\n        dirty = dirty.toString();\n        if (typeof dirty !== 'string') {\n          throw typeErrorCreate('dirty is not a string, aborting');\n        }\n      } else {\n        throw typeErrorCreate('toString is not a function');\n      }\n    }\n    /* Return dirty HTML if DOMPurify cannot run */\n    if (!DOMPurify.isSupported) {\n      return dirty;\n    }\n    /* Assign config vars */\n    if (!SET_CONFIG) {\n      _parseConfig(cfg);\n    }\n    /* Clean up removed elements */\n    DOMPurify.removed = [];\n    /* Check if dirty is correctly typed for IN_PLACE */\n    if (typeof dirty === 'string') {\n      IN_PLACE = false;\n    }\n    if (IN_PLACE) {\n      /* Do some early pre-sanitization to avoid unsafe root nodes */\n      if (dirty.nodeName) {\n        const tagName = transformCaseFunc(dirty.nodeName);\n        if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n          throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');\n        }\n      }\n    } else if (dirty instanceof Node) {\n      /* If dirty is a DOM element, append to an empty document to avoid\n         elements being stripped by the parser */\n      body = _initDocument('<!---->');\n      importedNode = body.ownerDocument.importNode(dirty, true);\n      if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {\n        /* Node is already a body, use as is */\n        body = importedNode;\n      } else if (importedNode.nodeName === 'HTML') {\n        body = importedNode;\n      } else {\n        // eslint-disable-next-line unicorn/prefer-dom-node-append\n        body.appendChild(importedNode);\n      }\n    } else {\n      /* Exit directly if we have nothing to do */\n      if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&\n      // eslint-disable-next-line unicorn/prefer-includes\n      dirty.indexOf('<') === -1) {\n        return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;\n      }\n      /* Initialize the document to work on */\n      body = _initDocument(dirty);\n      /* Check we have a DOM node from the data */\n      if (!body) {\n        return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';\n      }\n    }\n    /* Remove first element node (ours) if FORCE_BODY is set */\n    if (body && FORCE_BODY) {\n      _forceRemove(body.firstChild);\n    }\n    /* Get node iterator */\n    const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);\n    /* Now start iterating over the created document */\n    while (currentNode = nodeIterator.nextNode()) {\n      /* Sanitize tags and elements */\n      _sanitizeElements(currentNode);\n      /* Check attributes next */\n      _sanitizeAttributes(currentNode);\n      /* Shadow DOM detected, sanitize it */\n      if (currentNode.content instanceof DocumentFragment) {\n        _sanitizeShadowDOM(currentNode.content);\n      }\n    }\n    /* If we sanitized `dirty` in-place, return it. */\n    if (IN_PLACE) {\n      return dirty;\n    }\n    /* Return sanitized string or DOM */\n    if (RETURN_DOM) {\n      if (RETURN_DOM_FRAGMENT) {\n        returnNode = createDocumentFragment.call(body.ownerDocument);\n        while (body.firstChild) {\n          // eslint-disable-next-line unicorn/prefer-dom-node-append\n          returnNode.appendChild(body.firstChild);\n        }\n      } else {\n        returnNode = body;\n      }\n      if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {\n        /*\n          AdoptNode() is not used because internal state is not reset\n          (e.g. the past names map of a HTMLFormElement), this is safe\n          in theory but we would rather not risk another attack vector.\n          The state that is cloned by importNode() is explicitly defined\n          by the specs.\n        */\n        returnNode = importNode.call(originalDocument, returnNode, true);\n      }\n      return returnNode;\n    }\n    let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;\n    /* Serialize doctype if allowed */\n    if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {\n      serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\\n' + serializedHTML;\n    }\n    /* Sanitize final string template-safe */\n    if (SAFE_FOR_TEMPLATES) {\n      arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n        serializedHTML = stringReplace(serializedHTML, expr, ' ');\n      });\n    }\n    return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;\n  };\n  DOMPurify.setConfig = function () {\n    let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n    _parseConfig(cfg);\n    SET_CONFIG = true;\n  };\n  DOMPurify.clearConfig = function () {\n    CONFIG = null;\n    SET_CONFIG = false;\n  };\n  DOMPurify.isValidAttribute = function (tag, attr, value) {\n    /* Initialize shared config vars if necessary. */\n    if (!CONFIG) {\n      _parseConfig({});\n    }\n    const lcTag = transformCaseFunc(tag);\n    const lcName = transformCaseFunc(attr);\n    return _isValidAttribute(lcTag, lcName, value);\n  };\n  DOMPurify.addHook = function (entryPoint, hookFunction) {\n    if (typeof hookFunction !== 'function') {\n      return;\n    }\n    arrayPush(hooks[entryPoint], hookFunction);\n  };\n  DOMPurify.removeHook = function (entryPoint, hookFunction) {\n    if (hookFunction !== undefined) {\n      const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);\n      return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];\n    }\n    return arrayPop(hooks[entryPoint]);\n  };\n  DOMPurify.removeHooks = function (entryPoint) {\n    hooks[entryPoint] = [];\n  };\n  DOMPurify.removeAllHooks = function () {\n    hooks = _createHooksMap();\n  };\n  return DOMPurify;\n}\nvar purify = createDOMPurify();\n\nexport { purify as default };\n//# sourceMappingURL=purify.es.mjs.map\n","import DOMPurify from 'dompurify'\n\nconst decodeUri = ( uri ) => {\n\t// Attempt to decode links that have been encoded multiple times\n\tconst maxAttempts = 5\n\tlet currentUri = uri\n\n\tfor ( let i = 0; i < maxAttempts; i++ ) {\n\t\tconst decoded = decodeURIComponent( currentUri )\n\t\tif ( decoded === currentUri ) {\n\t\t\treturn decoded\n\t\t} else {\n\t\t\tcurrentUri = decoded\n\t\t}\n\t}\n\n\treturn currentUri\n}\n\nconst getWikipediaAttrFromUrl = ( url ) => {\n\tconst regexList = [\n\t\t// https://zh.wikipedia.org/wiki/前岐镇\"\n\t\t// https://en.wikipedia.org/wiki/Cat#Section\n\t\t/^https?:\\/\\/([\\w-]{2,}\\.)?(m\\.)?wikipedia\\.org\\/wiki\\/([^?]+)/,\n\t\t// https://en.wikipedia.org/w/index.php?title=Cat\n\t\t// https://zh.wikipedia.org/w/index.php?title=太阳帆&action=purge\n\t\t/^https?:\\/\\/([\\w-]{2,}\\.)?(m\\.)?wikipedia\\.org\\/w\\/index.php\\?title=([^&]+)/\n\t]\n\n\tfor ( let i = 0; i < regexList.length; i++ ) {\n\t\tconst matches = regexList[ i ].exec( url )\n\t\tif ( matches ) {\n\t\t\treturn {\n\t\t\t\tlang: matches[ 1 ] ? matches[ 1 ].slice( 0, -1 ) : 'en',\n\t\t\t\tmobile: !!matches[ 2 ],\n\t\t\t\ttitle: decodeUri( matches[ 3 ] )\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * Check if the device is a mobile device\n */\nconst isMobile = !!window.matchMedia( '( max-width: 768px )' ).matches\n\n/**\n * Check if the device is a touch device\n */\nconst isTouch = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0\n\nconst isOnline = () => window.navigator.onLine\n\nconst getDir = ( lang ) => {\n\tconst rtl = [ 'ar', 'arc', 'arz', 'dv', 'fa', 'ha', 'he', 'khw', 'ks', 'ku', 'ps', 'ur', 'yi', 'pnb', 'ckb', 'mzn', 'glk', 'ug', 'sd', 'azb', 'lrc' ]\n\treturn rtl.indexOf( lang ) === -1 ? 'ltr' : 'rtl'\n}\n\nconst defaultParams = {\n\tformat: 'json',\n\tformatversion: 2,\n\torigin: '*'\n}\n\nconst buildMwApiUrl = ( lang, params ) => {\n\tparams = { ...defaultParams, ...params }\n\tconst baseUrl = `https://${ lang }.wikipedia.org/w/api.php`\n\treturn baseUrl + '?' + Object.keys( params ).map( ( p ) => {\n\t\treturn `${ p }=${ encodeURIComponent( params[ p ] ) }`\n\t} ).join( '&' )\n}\n\nconst convertUrlToMobile = ( url ) => {\n\treturn url.replace( /https:\\/\\/(.*?)\\./, ( subDomain ) => subDomain + 'm.' )\n}\n\nconst strip = ( html ) => {\n\tconst doc = new window.DOMParser().parseFromString( html, 'text/html' )\n\tfor ( const span of doc.querySelectorAll( 'span' ) ) {\n\t\tif ( span.style.display === 'none' ) {\n\t\t\tspan.remove()\n\t\t}\n\t}\n\treturn doc.body.textContent || ''\n}\n\nconst sanitizeHTML = ( html ) => {\n\treturn DOMPurify.sanitize( html )\n}\n\nconst getDeviceSize = () => {\n\treturn { height: window.innerHeight, width: window.innerWidth }\n}\n\nconst getAnalyticsQueryParam = () => 'wprov=wppw2' + ( isTouch ? 't' : '' )\n\nconst buildWikipediaUrl = ( lang, title, touch, analytics = true ) => {\n\treturn `https://${ lang }${ touch ? '.m' : '' }.wikipedia.org/wiki/${ encodeURIComponent( title ) }${ analytics ? `?${ getAnalyticsQueryParam() }` : '' }`\n}\n\nconst version = () => {\n\t/* eslint-disable-next-line no-undef, no-console */\n\tconsole.log( `Wikipedia Preview - version ${ APP_VERSION } (${ GIT_HASH })` )\n}\n\nconst logError = ( ...err ) => {\n\tconsole.error.apply( console, err ) // eslint-disable-line no-console\n}\n\nconst getElement = ( nodeOrSelector ) => {\n\tif ( typeof nodeOrSelector === 'string' ) {\n\t\treturn document.querySelector( nodeOrSelector )\n\t}\n\treturn nodeOrSelector\n}\n\nconst getLinkIconSvg = ( dir = 'ltr', color = 'unset' ) => {\n\tif ( dir === 'ltr' ) {\n\t\treturn `\n\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"${ color }\" fill-rule=\"evenodd\" d=\"M11 1H6l2.148 2.144-4.15 4.15.707.708 4.15-4.15L11 6V1ZM4 3H2a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V8H8v2H2V4h2V3Z\" clip-rule=\"evenodd\"/>\n\t\t\t</svg>\n\t\t`.trim()\n\t}\n\n\treturn `\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\">\n\t\t\t<path fill=\"${ color }\" fill-rule=\"evenodd\" d=\"M1 1h5L3.852 3.144l4.15 4.15-.707.708-4.15-4.15L1 6V1Zm7 2h2a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V8h1v2h6V4H8V3Z\" clip-rule=\"evenodd\"/>\n\t\t</svg>\n\t`.trim()\n}\n\nconst isVerticallyScrollable = ( element ) => {\n\treturn element.scrollHeight > element.clientHeight\n}\n\nexport {\n\tgetWikipediaAttrFromUrl, isTouch, isOnline, getDir, buildMwApiUrl,\n\tconvertUrlToMobile, strip, sanitizeHTML, getDeviceSize, getAnalyticsQueryParam,\n\tbuildWikipediaUrl, version, logError, getElement, getLinkIconSvg, isVerticallyScrollable, isMobile\n}\n","import en from '../i18n/en.json'\n\nconst messages = {\n\ten\n}\n\nconst msg = ( lang, key, ...params ) => {\n\tif ( !messages[ lang ] ) {\n\t\ttry {\n\t\t\tmessages[ lang ] = require( `./../i18n/${ lang }.json` ).default\n\t\t} catch ( error ) {\n\t\t\tmessages[ lang ] = {}\n\t\t}\n\t}\n\tlet message = messages[ lang ] && messages[ lang ][ key ] || messages.en[ key ] || key\n\tparams.forEach( ( param, i ) => {\n\t\tmessage = message.replace( new RegExp( `\\\\$${ i + 1 }`, 'g' ), param )\n\t} )\n\treturn message\n}\n\nexport { msg }\n","import { cachedRequest } from './cachedRequest'\nimport {\n\tbuildMwApiUrl, convertUrlToMobile, logError,\n\tstrip, getDeviceSize, sanitizeHTML, getAnalyticsQueryParam,\n\tgetDir\n} from './utils'\nimport { msg } from './i18n'\n\nconst titleWithoutSection = ( title ) => {\n\treturn title.split( '#' )[ 0 ]\n}\n\nconst requestMwExtract = ( lang, title, callback, request = cachedRequest ) => {\n\tconst params = {\n\t\taction: 'query',\n\t\tprop: 'extracts|pageimages',\n\t\texsentences: 4,\n\t\texplaintext: 1,\n\t\texsectionformat: 'plain',\n\t\tpiprop: 'thumbnail',\n\t\tpilimit: 1,\n\t\ttitles: title\n\t}\n\tconst url = buildMwApiUrl( lang, params ) + '&' + getAnalyticsQueryParam()\n\trequest( url, ( result ) => {\n\t\tconst page = result.query.pages[ Object.keys( result.query.pages )[ 0 ] ]\n\t\tif ( !page.extract ) {\n\t\t\treturn false\n\t\t}\n\t\treturn {\n\t\t\ttitle,\n\t\t\textractHtml: '<p>' + page.extract + '</p>',\n\t\t\timgUrl: page.thumbnail ? page.thumbnail.source : null,\n\t\t\tdir: getDir( lang ),\n\t\t\ttype: 'standard'\n\t\t}\n\t}, callback )\n}\n\nconst requestPcsSummary = ( lang, title, callback, request = cachedRequest ) => {\n\tconst url = `https://${ lang }.wikipedia.org/api/rest_v1/page/summary/${ encodeURIComponent( title ) }?${ getAnalyticsQueryParam() }`\n\trequest( url, ( data, err ) => {\n\t\tif ( !data ) {\n\t\t\tlogError( msg( lang, 'preview-console-error-message', title, lang ), err )\n\t\t\treturn false\n\t\t}\n\t\tif ( data.type === 'standard' || data.type === 'disambiguation' ) {\n\t\t\treturn {\n\t\t\t\ttitle: data.titles.canonical,\n\t\t\t\textractHtml: sanitizeHTML( data.extract_html ),\n\t\t\t\timgUrl: data.thumbnail ? data.thumbnail.source : null,\n\t\t\t\tdir: data.dir,\n\t\t\t\ttype: data.type\n\t\t\t}\n\t\t}\n\t\t// special case: there is no summary but there is a description\n\t\tif ( data.type === 'no-extract' && data.description ) {\n\t\t\treturn {\n\t\t\t\ttitle: data.titles.canonical,\n\t\t\t\textractHtml: '<p>' + data.description + '</p>',\n\t\t\t\timgUrl: data.thumbnail ? data.thumbnail.source : null,\n\t\t\t\tdir: data.dir,\n\t\t\t\ttype: 'standard'\n\t\t\t}\n\t\t}\n\t\tlogError( msg( lang, 'preview-console-error-message', title, lang ), data )\n\t\treturn false\n\t}, callback )\n\n}\n\nconst simplify = ( node ) => {\n\tif ( !node ) {\n\t\treturn null\n\t}\n\t// remove a bunch of things\n\tconst selector = [\n\t\t'script',\n\t\t'meta',\n\t\t'style',\n\t\t'figure',\n\t\t'table',\n\t\t'sup.mw-ref',\n\t\t'sup.reference',\n\t\t'.pcs-collapse-table-container',\n\t\t'.thumb',\n\t\t'.hatnote',\n\t\t\"[ role='navigation' ]\",\n\t\t'#pcs-edit-section-add-title-description'\n\t].join( ',' )\n\tfor ( const n of node.querySelectorAll( selector ) ) {\n\t\tn.remove()\n\t}\n\n\t// unwrap links\n\tfor ( const a of node.querySelectorAll( 'a' ) ) {\n\t\ta.outerHTML = a.innerHTML\n\t}\n\n\t// remove phonetic notations\n\tfor ( const p of node.querySelectorAll( 'p' ) ) {\n\t\tp.innerHTML = p.innerHTML.replace( /\\s\\(.*?class=\".*?(ext-phonos|IPA).*?\".*?\\)/g, '' )\n\t}\n\n\tif ( node.innerText.trim() === '' ) {\n\t\treturn null\n\t}\n\n\treturn node.outerHTML\n}\n\nconst findLeadImageThumbnail = ( doc ) => {\n\tconst leadImageElement = doc.querySelector( 'meta[property=\"mw:leadImage\"]' )\n\tif ( !leadImageElement ) {\n\t\treturn null\n\t}\n\tconst parts = leadImageElement.getAttribute( 'content' ).split( '/' )\n\tconst filename = decodeURIComponent( parts[ parts.length - 1 ] )\n\tconst a = doc.querySelector( 'a[href*=\"' + filename + '\"]' )\n\tif ( !a ) {\n\t\treturn null\n\t}\n\tconst span = a.querySelector( 'span[data-src]' )\n\tif ( span ) {\n\t\treturn span.getAttribute( 'data-src' )\n\t}\n\tconst img = a.querySelector( 'img[src]' )\n\tif ( img ) {\n\t\treturn img.getAttribute( 'src' )\n\t}\n\treturn null\n\n}\n\nconst getSections = ( lang, title, callback, request = cachedRequest ) => {\n\tconst url = `https://${ lang }.wikipedia.org/api/rest_v1/page/mobile-html/${ encodeURIComponent( title ) }?${ getAnalyticsQueryParam() }`\n\trequest( url, ( data, err ) => {\n\t\tif ( !data ) {\n\t\t\tlogError( msg( lang, 'preview-console-error-message', title, lang ), err )\n\t\t\treturn false\n\t\t}\n\t\tconst doc = new DOMParser().parseFromString( data, 'text/html' )\n\t\tconst leadImageUrl = findLeadImageThumbnail( doc )\n\t\tconst sections = Array.from( doc.querySelectorAll( 'section' ) ).map( ( sectionElement ) => {\n\t\t\tconst sectionTitleElement = sectionElement.querySelector( 'h2, h3, h4, h5, h6' )\n\t\t\tconst sectionId = sectionTitleElement ? sectionTitleElement.id : title\n\t\t\tconst level = sectionTitleElement ? sectionTitleElement.tagName.toLowerCase() : 'h2'\n\n\t\t\tconst imageElement = sectionElement.querySelector( 'figure span.mw-file-element' )\n\t\t\tconst imgUrl = imageElement ?\n\t\t\t\timageElement.getAttribute( 'data-src' ) :\n\t\t\t\tleadImageUrl\n\n\t\t\tconst extractHtml = simplify(\n\t\t\t\tsectionElement.querySelector( 'p' )\n\t\t\t)\n\n\t\t\treturn extractHtml ? {\n\t\t\t\tid: sectionId,\n\t\t\t\tlevel,\n\t\t\t\timgUrl,\n\t\t\t\textractHtml\n\t\t\t} : null\n\t\t} ).filter( ( s ) => s )\n\t\treturn {\n\t\t\tsections,\n\t\t\tdir: doc.body.getAttribute( 'dir' )\n\t\t}\n\t}, callback, false )\n}\n\nconst extractSectionSummary = ( lang, title, sectionId, callback, request ) => {\n\tgetSections( lang, title, ( info ) => {\n\t\tfor ( const section of info.sections ) {\n\t\t\tif ( section.id === sectionId ) {\n\t\t\t\tcallback( {\n\t\t\t\t\ttitle: title + '#' + sectionId,\n\t\t\t\t\textractHtml: section.extractHtml,\n\t\t\t\t\timgUrl: section.imgUrl,\n\t\t\t\t\tdir: info.dir,\n\t\t\t\t\ttype: 'standard'\n\t\t\t\t} )\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tcallback( false )\n\t}, request )\n}\n\nconst requestPagePreview = ( lang, title, callback, request = cachedRequest ) => {\n\tconst [ titlePart, sectionPart ] = title.split( '#' )\n\tif ( !sectionPart ) {\n\t\treturn title.indexOf( ':' ) === -1 ?\n\t\t\trequestPcsSummary( lang, title, callback, request ) :\n\t\t\trequestMwExtract( lang, title, callback, request )\n\t} else {\n\t\treturn extractSectionSummary( lang, titlePart, sectionPart, callback, request )\n\t}\n}\n\nconst requestPageMedia = ( lang, title, callback, request = cachedRequest ) => {\n\ttitle = titleWithoutSection( title )\n\tconst url = `https://${ lang }.wikipedia.org/api/rest_v1/page/media-list/${ encodeURIComponent( title ) }`\n\trequest( url, ( mediaListData ) => {\n\t\tconst items = mediaListData.items || []\n\t\tconst pageMedia = items.reduce( ( mediaArray, item ) => {\n\t\t\tif ( item.showInGallery && item.type === 'image' ) {\n\t\t\t\tconst thumbnail = item && item.srcset && `https:${ item.srcset[ 0 ].src }`\n\t\t\t\tconst media = {\n\t\t\t\t\tcaption: item.caption && item.caption.text.trim(),\n\t\t\t\t\tthumb: thumbnail,\n\t\t\t\t\ttitle: item.title\n\t\t\t\t}\n\n\t\t\t\treturn mediaArray.concat( media )\n\t\t\t}\n\t\t\treturn mediaArray\n\t\t}, [] )\n\n\t\treturn pageMedia\n\n\t}, callback )\n}\n\nconst requestPagePreviewWithMedia = ( lang, title, callback ) => {\n\tlet results = {}\n\trequestPagePreview( lang, title, ( previewData ) => {\n\t\tif ( previewData === false ) {\n\t\t\tresults = { ...results, extractHtml: false }\n\t\t} else {\n\t\t\tresults = { ...results, ...previewData }\n\t\t}\n\n\t\tif ( results.media ) {\n\t\t\tcallback( results )\n\t\t}\n\t} )\n\trequestPageMedia( lang, title, ( mediaData ) => {\n\t\tresults = { ...results, media: mediaData }\n\t\tif ( results.extractHtml !== undefined ) {\n\t\t\tcallback( results )\n\t\t}\n\t} )\n}\n\nconst requestPageMediaInfo = ( lang, title, callback, request = cachedRequest ) => {\n\tconst params = {\n\t\taction: 'query',\n\t\tprop: 'imageinfo',\n\t\tiiextmetadatafilter: 'LicenseShortName|ImageDescription|Artist',\n\t\tiiextmetadatalanguage: lang,\n\t\tiiextmetadatamultilang: 1,\n\t\tiiurlwidth: getDeviceSize().width,\n\t\tiiurlheight: getDeviceSize().height,\n\t\tiiprop: 'url|extmetadata',\n\t\ttitles: title\n\t}\n\n\tconst url = buildMwApiUrl( lang, params )\n\n\trequest( url, ( mediaInfoData ) => {\n\t\tconst pages = mediaInfoData.query.pages\n\t\tconst imageInfo = pages[ 0 ].imageinfo\n\n\t\tif ( !imageInfo ) {\n\t\t\treturn {}\n\t\t}\n\n\t\tconst { Artist, ImageDescription, LicenseShortName } = imageInfo[ 0 ].extmetadata\n\t\tconst author = Artist && strip( Artist.value )\n\t\tconst description = ImageDescription && strip(\n\t\t\t( typeof ImageDescription.value === 'string' && ImageDescription.value ) ||\n\t\t\t( ImageDescription.value[ lang ] ||\n\t\t\t\tImageDescription.value[ Object.keys( ImageDescription.value )[ 0 ] ] )\n\t\t)\n\t\tconst imageUrl = imageInfo[ 0 ].thumburl\n\n\t\treturn {\n\t\t\tauthor,\n\t\t\tdescription,\n\t\t\tlicense: LicenseShortName && LicenseShortName.value,\n\t\t\tfilePage: convertUrlToMobile( imageInfo[ 0 ].descriptionshorturl ),\n\t\t\tbestFitImageUrl: imageUrl\n\t\t}\n\t}, callback )\n}\n\nexport { requestPagePreview, requestPageMedia, requestPageMediaInfo, getSections, requestPagePreviewWithMedia }\n","const scaleMin = 1\nconst scaleMax = 2\nconst getClientWidth = () => window.innerWidth\nconst getClientHeight = () => window.innerHeight\nconst temp = {\n\tscreenX: null,\n\toriginalMarginLeft: null,\n\tcurrentMarginLeft: null,\n\toriginalTransition: null,\n\timgOriginalTransition: null,\n\tdurationStart: null,\n\ttranslateX: 0,\n\ttranslateY: 0,\n\tclientX: null,\n\tclientY: null,\n\timageRect: {}\n}\nconst evCache = []\nlet prevDiff = -1\nlet zoomedIn = false\n\nconst grabImageFromEvent = ( e ) => {\n\treturn e.target.nodeName === 'IMG' ? e.target : e.target.querySelector( 'img' )\n}\n\nconst grabScaleFromTransform = ( transform ) => {\n\treturn transform ?\n\t\tNumber( transform.slice( transform.indexOf( 'scale' ) + 6, -1 ) ) :\n\t\tscaleMin\n}\n\nconst grabTranslateFromTransform = ( transform ) => {\n\tconst re = /translate3d\\((?<x>.*?)px, (?<y>.*?)px, (?<z>.*?)px/\n\tconst coordinates = re.exec( transform )\n\treturn coordinates ?\n\t\t`translate3d(${ coordinates.groups.x }px, ${ coordinates.groups.y }px, ${ 0 }px)` :\n\t\t`translate3d(${ temp.translateX }px, ${ temp.translateY }px, ${ 0 }px)`\n}\n\nconst isInvalidEvent = ( e, prefixClassname ) => {\n\tconst invalidClasses = [\n\t\t`${ prefixClassname }-item-caption`,\n\t\t`${ prefixClassname }-item-caption-expand-cue`,\n\t\t`${ prefixClassname }-item-caption-text`,\n\t\t`${ prefixClassname }-item-attribution`,\n\t\t`${ prefixClassname }-button`\n\t]\n\n\tconst invalidElement = invalidClasses.find( ( className ) => {\n\t\treturn e.target.className.indexOf( className ) > -1\n\t} )\n\n\treturn e.pointerType !== 'touch' || invalidElement\n}\n\nconst isImgZoomedIn = () => {\n\treturn zoomedIn\n}\n\nconst isImgLandscape = ( image ) => {\n\treturn image.naturalHeight <= image.naturalWidth\n}\n\nconst isImgSmallerThanViewport = ( image ) => {\n\tconst buffer = 50\n\treturn image.naturalWidth + buffer < getClientWidth()\n}\n\nconst getFingerAmount = () => {\n\treturn evCache.length\n}\n\nconst getTransformOrigin = ( image, e = null ) => {\n\tconst coordinates = {}\n\tconst setBestVertical = () => {\n\t\tif ( e.clientY > image.naturalHeight && !isImgLandscape( image ) ) {\n\t\t\treturn image.naturalHeight\n\t\t}\n\t\treturn e.clientY\n\t}\n\tif ( evCache.length === 2 ) {\n\t\tcoordinates.x = ( evCache[ 0 ].clientX + evCache[ 1 ].clientX ) / 2\n\t\tcoordinates.y = ( evCache[ 0 ].clientY + evCache[ 1 ].clientY ) / 2\n\t} else {\n\t\tcoordinates.x = e.clientX\n\t\tcoordinates.y = setBestVertical()\n\t}\n\treturn coordinates\n}\n\nconst setTransformOrigin = ( image, e ) => {\n\tconst currentTransformOrigin = getTransformOrigin( image, e )\n\tif ( isImgLandscape( image ) ) {\n\t\tcurrentTransformOrigin.y = currentTransformOrigin.y - image.naturalHeight\n\t} else if ( isImgSmallerThanViewport( image ) ) {\n\t\tcurrentTransformOrigin.x = image.naturalWidth / 2\n\t\tcurrentTransformOrigin.y = image.naturalHeight / 2\n\t}\n\treturn `${ currentTransformOrigin.x }px ${ currentTransformOrigin.y }px`\n}\n\nconst removeEvent = ( e ) => {\n\tfor ( let i = 0; i < evCache.length; i++ ) {\n\t\tif ( evCache[ i ].pointerId === e.pointerId ) {\n\t\t\tevCache.splice( i, 1 )\n\t\t\tbreak\n\t\t}\n\t}\n}\n\nconst clearZoom = ( image ) => {\n\tif ( image ) {\n\t\timage.style.transition = temp.imgOriginalTransition\n\t\timage.style.transform = `scale(${ scaleMin })`\n\t\tzoomedIn = false\n\t\ttemp.translateX = 0\n\t\ttemp.translateY = 0\n\t}\n}\n\nconst toggleZoom = ( e ) => {\n\tconst image = grabImageFromEvent( e )\n\ttemp.clientX = null\n\ttemp.clientY = null\n\ttemp.translateX = 0\n\ttemp.translateY = 0\n\timage.style.transformOrigin = setTransformOrigin( image, e )\n\n\tif ( isImgZoomedIn() ) {\n\t\timage.style.transform = `scale(${ scaleMin })`\n\t\tzoomedIn = false\n\t} else {\n\t\timage.style.transform = `scale(${ scaleMax })`\n\t\tzoomedIn = true\n\t}\n}\n\nconst zoomStart = ( e ) => {\n\tconst image = grabImageFromEvent( e )\n\n\tif ( !image ) {\n\t\treturn\n\t}\n\n\tconst imageRect = image.getBoundingClientRect()\n\ttemp.imageRect.top = imageRect.top\n\ttemp.imageRect.bottom = imageRect.bottom\n\ttemp.imageRect.left = imageRect.left\n\ttemp.imageRect.right = imageRect.right\n\n\tif ( evCache.length < 1 ) {\n\t\tconst imageStyle = window.getComputedStyle( image )\n\t\ttemp.imgOriginalTransition = imageStyle.transition\n\t}\n\tevCache.push( e )\n}\n\nconst zoomMove = ( e ) => {\n\tconst image = grabImageFromEvent( e )\n\tconst transform = image.style.transform\n\tconst delta = 0.01\n\tconst buffer = 0.4\n\tlet scale = grabScaleFromTransform( transform )\n\tconst translate3d = grabTranslateFromTransform( transform )\n\n\tfor ( let i = 0; i < evCache.length; i++ ) {\n\t\tif ( e.pointerId === evCache[ i ].pointerId ) {\n\t\t\tevCache[ i ] = e\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif ( evCache.length === 2 ) {\n\t\tconst deltaX = Math.abs( evCache[ 0 ].clientX - evCache[ 1 ].clientX )\n\t\tconst deltaY = Math.abs( evCache[ 0 ].clientY - evCache[ 1 ].clientY )\n\t\tconst curDiff = Math.sqrt( Math.pow( deltaX, 2 ) + Math.pow( deltaY, 2 ) )\n\n\t\tif ( prevDiff > 0 ) {\n\t\t\timage.style.transformOrigin = setTransformOrigin( image )\n\t\t\timage.style.transition = 'unset'\n\t\t\tif ( curDiff > prevDiff ) {\n\t\t\t\tzoomedIn = true\n\t\t\t\tif ( scale + delta < scaleMax ) {\n\t\t\t\t\t// Expand image\n\t\t\t\t\tscale += delta\n\t\t\t\t\timage.style.transform = `${ translate3d } scale(${ scale })`\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( curDiff < prevDiff ) {\n\t\t\t\tif ( scale - delta > scaleMin + buffer ) {\n\t\t\t\t\t// Contract image\n\t\t\t\t\tscale -= delta\n\t\t\t\t\timage.style.transform = `${ translate3d } scale(${ scale })`\n\t\t\t\t} else {\n\t\t\t\t\tclearZoom( image )\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprevDiff = curDiff\n\t}\n}\n\nconst zoomScroll = ( e, renderNext, items, current, dir ) => {\n\tconst image = grabImageFromEvent( e )\n\n\tif ( !image ) {\n\t\treturn\n\t}\n\n\tconst transform = image.style.transform\n\tconst scale = grabScaleFromTransform( transform )\n\tconst leftLimit = getClientWidth() / 8\n\tconst rightLimit = getClientWidth() - leftLimit\n\tconst topLimit = isImgLandscape( image ) ? getClientHeight() / 4 : getClientHeight() / 8\n\tconst bottomLimit = getClientHeight() - topLimit\n\tconst offset = 80\n\n\timage.style.transition = 'unset'\n\tif ( !temp.clientX || !temp.clientY ) {\n\t\ttemp.clientX = e.clientX\n\t\ttemp.clientY = e.clientY\n\t}\n\n\tconst translateX = temp.translateX + ( e.clientX - temp.clientX )\n\tconst translateY = temp.translateY + ( e.clientY - temp.clientY )\n\tconst scrollingUp = translateY - temp.translateY >= 0\n\tconst scrollingLeft = translateX - temp.translateX >= 0\n\n\tconst isImageWithinBoundaries = () => {\n\t\tconst horizontallyBound = temp.imageRect.left < leftLimit && scrollingLeft ||\n\t\t\ttemp.imageRect.right > rightLimit && !scrollingLeft\n\t\tconst verticallyBound = temp.imageRect.top < topLimit && scrollingUp ||\n\t\t\ttemp.imageRect.bottom > bottomLimit && !scrollingUp\n\n\t\treturn horizontallyBound && verticallyBound\n\t}\n\tconst updateTempValues = () => {\n\t\t// The order matters: update imageRect first\n\t\ttemp.imageRect.top = temp.imageRect.top + ( translateY - temp.translateY )\n\t\ttemp.imageRect.bottom = temp.imageRect.bottom + ( translateY - temp.translateY )\n\t\ttemp.imageRect.left = temp.imageRect.left + ( translateX - temp.translateX )\n\t\ttemp.imageRect.right = temp.imageRect.right + ( translateX - temp.translateX )\n\t\ttemp.translateX = translateX\n\t\ttemp.translateY = translateY\n\t\ttemp.clientX = e.clientX\n\t\ttemp.clientY = e.clientY\n\t}\n\tconst slideToNextOrPrevious = Math.abs( translateX ) - Math.abs( temp.translateX ) > offset\n\n\tif ( isImageWithinBoundaries() ) {\n\t\tupdateTempValues()\n\t\timage.style.transform = `translate3d(${ translateX }px, ${ translateY }px, 0px) scale(${ scale })`\n\t} else if ( slideToNextOrPrevious ) {\n\t\tconst next = ( dir === 'ltr' && translateX < 0 ) || ( dir === 'rtl' && translateX > 0 )\n\t\tif ( !next && items[ current - 1 ] ) {\n\t\t\trenderNext( -1 )\n\t\t} else if ( next && items[ current + 1 ] ) {\n\t\t\trenderNext( 1 )\n\t\t}\n\t}\n}\n\nconst zoomEnd = ( e ) => {\n\tconst image = grabImageFromEvent( e )\n\tif ( image ) {\n\t\timage.style.transition = temp.imgOriginalTransition\n\t}\n\tremoveEvent( e )\n\ttemp.clientX = null\n\ttemp.clientY = null\n\tif ( evCache.length < 2 ) {\n\t\tprevDiff = -1\n\t}\n}\n\nconst slideStart = ( e, container, marginLR ) => {\n\tconst containerStyle = window.getComputedStyle( container )\n\ttemp.durationStart = Date.now()\n\ttemp.screenX = e.clientX\n\ttemp.originalMarginLeft =\n            +containerStyle[ marginLR ].slice( 0, -2 )\n\ttemp.currentMarginLeft =\n            +containerStyle[ marginLR ].slice( 0, -2 )\n\ttemp.originalTransition = containerStyle.transition\n\tcontainer.style.transition = 'unset'\n}\n\nconst slideMove = ( e, container, marginLR, dir ) => {\n\tconst clientX = e.clientX\n\tconst offset = clientX - temp.screenX\n\ttemp.currentMarginLeft = temp.originalMarginLeft + offset * ( dir === 'ltr' ? 1 : -1 )\n\tcontainer.style[ marginLR ] = temp.currentMarginLeft + 'px'\n\te.preventDefault()\n}\n\nconst slideEnd = ( e, container, renderNext, marginLR, current ) => {\n\tconst diff = temp.originalMarginLeft - temp.currentMarginLeft\n\tconst duration = Date.now() - temp.durationStart\n\tif ( Math.abs( diff / getClientWidth() ) > 0.4 ||\n    ( duration <= 300 && Math.abs( diff ) > 5 )\n\t) {\n\t\trenderNext( diff > 0 ? 1 : -1 )\n\t} else {\n\t\tcontainer.style[ marginLR ] = -getClientWidth() * current + 'px'\n\t}\n\n}\n\nexport {\n\ttemp, isInvalidEvent, isImgZoomedIn,\n\tgetFingerAmount, toggleZoom, clearZoom,\n\tzoomStart, zoomMove, zoomScroll, zoomEnd,\n\tslideStart, slideMove, slideEnd\n}\n","let eventListenerStack = []\n\nconst addEventListener = ( target, type, listener, options = undefined ) => {\n\ttarget.addEventListener( type, listener, options )\n\teventListenerStack.push( [ target, type, listener, options ] )\n}\n\nconst clearAllEventListener = () => {\n\teventListenerStack.forEach( ( eventListener ) => {\n\t\tconst [ target, type, listener, options ] = eventListener\n\t\ttarget.removeEventListener( type, listener, options )\n\t} )\n\teventListenerStack = []\n}\n\nexport { addEventListener, clearAllEventListener }\n","import { msg } from '../i18n'\nimport { requestPageMediaInfo } from '../api'\nimport { isOnline, getLinkIconSvg } from '../utils'\nimport { temp, isInvalidEvent, isImgZoomedIn, getFingerAmount, toggleZoom, clearZoom, zoomStart, zoomMove, zoomScroll, zoomEnd, slideStart, slideMove, slideEnd } from './gestures'\nimport { addEventListener } from './event'\n\n// internal state of the slider component\nlet current = 0\nlet dir = ''\nlet lang\nlet gallery\nlet parentContainer\n\nconst getClientWidth = () => window.innerWidth\nconst prefixClassname = 'wp-gallery-fullscreen-slider'\n\nconst renderImageSlider = ( givenLang, givenDir, container, images = [], selectedImage = '' ) => {\n\tconst imageListHtml = images.map( () => `\n\t\t<div class=\"${ prefixClassname }-item\">\n\t\t\t\t<div class=\"${ prefixClassname }-item-loading\">\n\t\t\t\t\t\t<div class=\"${ prefixClassname }-item-loading-spinner\">\n\t\t\t\t\t\t\t\t<div class=\"${ prefixClassname }-item-loading-spinner-animation\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"${ prefixClassname }-item-loading-spinner-animation-bounce\"></div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"${ prefixClassname }-item-loading-text\">${ msg( givenLang, 'gallery-loading-still' ) }</div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"${ prefixClassname }-item-loading-error\">\n\t\t\t\t\t<div class=\"${ prefixClassname }-item-loading-error-text\">${ msg( givenLang, 'gallery-loading-error' ) }</div>\n\t\t\t\t\t<div class=\"${ prefixClassname }-item-loading-error-refresh\">${ msg( givenLang, 'gallery-loading-error-refresh' ) }</div>\n\t\t\t\t</div>\n\t\t</div>\n\t\t`.trim()\n\t).join( '' )\n\n\timages.some( ( image, index ) => {\n\t\tif ( image.thumb === selectedImage ) {\n\t\t\tcurrent = index\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t} )\n\tdir = givenDir\n\tlang = givenLang\n\tgallery = images\n\tparentContainer = container\n\n\treturn `\n\t\t<div class=\"${ prefixClassname }\" style=\"${ dir === 'ltr' ? 'margin-left' : 'margin-right' }:-${ current * getClientWidth() }px\">\n\t\t\t\t<div class=\"${ prefixClassname }-button previous\"></div>\n\t\t\t\t<div class=\"${ prefixClassname }-button next\"></div>\n\t\t\t\t${ imageListHtml }\n\t\t</div>\n\t\t`.trim()\n}\n\nconst renderImageAttribution = ( mediaInfo ) => {\n\tconst author = mediaInfo.author ? mediaInfo.author : msg( lang, 'gallery-unknown-author' )\n\tconst link = mediaInfo.filePage\n\n\treturn `\n\t\t<div class=\"${ prefixClassname }-item-attribution\">\n\t\t\t<div class=\"${ prefixClassname }-item-attribution-info\">\n\t\t\t\t<bdi class=\"${ prefixClassname }-item-attribution-info-author\">${ author } (${ mediaInfo.license })</bdi>\n\t\t\t\t<a href=\"${ link }\" class=\"${ prefixClassname }-item-attribution-info-link\" target=\"_blank\">${ msg( lang, 'gallery-attribution-learnmore' ) } ${ getLinkIconSvg() }</a>\n\t\t\t</div>\n\t\t</div>\n\t`.trim()\n}\n\nconst handleCaptionExpansion = ( item, forceClose = false ) => {\n\tconst caption = item.querySelector( `.${ prefixClassname }-item-caption` )\n\tconst expandCue = item.querySelector( `.${ prefixClassname }-item-caption-expand-cue` )\n\tconst expanded = item.querySelector( '.expanded' )\n\n\tif ( expandCue && expanded || forceClose && expandCue ) {\n\t\texpandCue.classList.remove( 'expanded' )\n\t\tcaption.style.maxHeight = '95px'\n\t} else if ( expandCue ) {\n\t\texpandCue.classList.add( 'expanded' )\n\t\tcaption.style.maxHeight = '241px'\n\t}\n}\n\nconst bindImageEvent = ( container, refresh = false ) => {\n\tconst imageElement = container.querySelector( 'img' )\n\tconst loading = container.querySelector( `.${ prefixClassname }-item-loading` )\n\tconst errorElement = container.querySelector( `.${ prefixClassname }-item-loading-error` )\n\tconst captionElement = container.querySelector( `.${ prefixClassname }-item-caption` )\n\n\t// Check if image has started loading and rendering\n\tfunction checkImageRender() {\n\t\tif ( imageElement.naturalWidth > 0 && imageElement.naturalHeight > 0 ) {\n\t\t\tcaptionElement.style.visibility = 'visible'\n\t\t} else {\n\t\t\trequestAnimationFrame( checkImageRender )\n\t\t}\n\t}\n\tcheckImageRender()\n\n\tif ( refresh ) {\n\t\tconst slider = parentContainer.querySelector( `.${ prefixClassname }` )\n\t\tconst items = slider.querySelectorAll( `.${ prefixClassname }-item` )\n\n\t\titems.forEach( ( item ) => {\n\t\t\tconst image = item.querySelector( 'img' )\n\t\t\tconst caption = item.querySelector( `.${ prefixClassname }-item-caption` )\n\t\t\tconst attribution = item.querySelector( `.${ prefixClassname }-item-attribution` )\n\n\t\t\tif ( image ) {\n\t\t\t\titem.removeChild( image )\n\t\t\t}\n\t\t\tif ( caption ) {\n\t\t\t\titem.removeChild( caption )\n\t\t\t}\n\t\t\tif ( attribution ) {\n\t\t\t\titem.removeChild( attribution )\n\t\t\t}\n\t\t} )\n\n\t\t// eslint-disable-next-line no-use-before-define\n\t\trenderNext( 0, true )\n\t\tloading.style.visibility = 'visible'\n\t\terrorElement.style.visibility = 'hidden'\n\t}\n\n\tif ( imageElement.complete ) {\n\t\tloading.style.visibility = 'hidden'\n\t\terrorElement.style.visibility = 'hidden'\n\t\timageElement.style.visibility = 'visible'\n\t} else {\n\t\tconst textElement = container.querySelector( `.${ prefixClassname }-item-loading-text` )\n\t\tconst timeoutId = setTimeout( () => {\n\t\t\ttextElement.style.visibility = 'visible'\n\t\t}, 5000 )\n\n\t\timageElement.addEventListener( 'load', () => {\n\t\t\tloading.style.visibility = 'hidden'\n\t\t\terrorElement.style.visibility = 'hidden'\n\t\t\ttextElement.style.visibility = 'hidden'\n\t\t\tclearTimeout( timeoutId )\n\t\t} )\n\n\t\timageElement.addEventListener( 'error', () => {\n\t\t\tconst refreshElement = container.querySelector( `.${ prefixClassname }-item-loading-error-refresh` )\n\t\t\tloading.style.visibility = 'hidden'\n\t\t\timageElement.style.visibility = 'hidden'\n\n\t\t\tif ( !isOnline() ) {\n\t\t\t\tconst errorElementText = container.querySelector( `.${ prefixClassname }-item-loading-error-text` )\n\t\t\t\terrorElementText.innerText = msg( lang, 'gallery-loading-error-offline' )\n\t\t\t\terrorElement.classList.add( 'offline' )\n\t\t\t}\n\t\t\terrorElement.style.visibility = 'visible'\n\t\t\tclearTimeout( timeoutId )\n\n\t\t\trefreshElement.addEventListener( 'click', () => {\n\t\t\t\tbindImageEvent( container, true )\n\t\t\t} )\n\t\t} )\n\t}\n\n\tcaptionElement.addEventListener( 'click', () => {\n\t\thandleCaptionExpansion( container )\n\t} )\n}\n\nconst showImageAndInfo = ( index, refreshImage = false ) => {\n\tconst slider = parentContainer.querySelector( `.${ prefixClassname }` )\n\tconst items = slider.querySelectorAll( `.${ prefixClassname }-item` )\n\tconst item = items[ index ]\n\n\tif ( item ) {\n\t\trequestPageMediaInfo(\n\t\t\tlang,\n\t\t\tgallery[ index ].title,\n\t\t\t( mediaInfo ) => {\n\t\t\t\tconst imageElement = item.querySelector( 'img' )\n\t\t\t\tconst atrributionElement = item.querySelector( `.${ prefixClassname }-item-attribution` )\n\n\t\t\t\tif ( !imageElement ) {\n\t\t\t\t\tconst getDescription = () => {\n\t\t\t\t\t\t// description list order\n\t\t\t\t\t\t// (1) commons caption - Not found\n\t\t\t\t\t\t// (2) commons description\n\t\t\t\t\t\t// (3) media-list caption\n\t\t\t\t\t\tif ( mediaInfo.description ) {\n\t\t\t\t\t\t\treturn mediaInfo.description\n\t\t\t\t\t\t} else if ( gallery[ index ].caption ) {\n\t\t\t\t\t\t\treturn gallery[ index ].caption\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn ''\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst description = getDescription()\n\t\t\t\t\tconst isCaptionExpandable = () => {\n\t\t\t\t\t\tif ( getClientWidth() < 400 && description.length > 128 ) {\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t} else if ( getClientWidth() > 400 && description.length > 142 ) {\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst caption = `<div class=\"${ prefixClassname }-item-caption\">\n\t\t\t\t\t\t${ isCaptionExpandable() ? `<div class=\"${ prefixClassname }-item-caption-expand-cue\"></div>` : '' }\n\t\t\t\t\t\t<div class=\"${ prefixClassname }-item-caption-text\"><bdi>${ description }</bdi></div>\n\t\t\t\t\t</div>`\n\n\t\t\t\t\titem.insertAdjacentHTML( 'beforeend', `<div class=\"${ prefixClassname }-item-img\"><img src=\"${ mediaInfo.bestFitImageUrl } ${ refreshImage ? '?timestamp=' + Date.now() : '' }\"/>${ caption }</div>` )\n\t\t\t\t\tbindImageEvent( item )\n\t\t\t\t}\n\n\t\t\t\tif ( !atrributionElement ) {\n\t\t\t\t\titem.insertAdjacentHTML(\n\t\t\t\t\t\t'beforeend',\n\t\t\t\t\t\trenderImageAttribution( mediaInfo )\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t} )\n\t}\n}\n\nconst renderNext = ( offset = 1, refresh = false ) => {\n\tconst slider = parentContainer.querySelector( `.${ prefixClassname }` )\n\tconst items = slider.querySelectorAll( `.${ prefixClassname }-item` )\n\tconst nextButton = slider.querySelector( '.next' )\n\tconst previousButton = slider.querySelector( '.previous' )\n\tconst next = current + offset\n\tconst item = items[ next ]\n\tconst currentImage = items[ current ].querySelector( 'img' )\n\n\tif ( item ) {\n\t\thandleCaptionExpansion( items[ current ], true )\n\t\tcurrent += offset\n\t\tnextButton.style.visibility = current === items.length - 1 ? 'hidden' : 'visible'\n\t\tpreviousButton.style.visibility = current === 0 ? 'hidden' : 'visible'\n\t\tclearZoom( currentImage )\n\n\t\t// render image attribution element - current, next, previous\n\t\tshowImageAndInfo( current, refresh )\n\t\tshowImageAndInfo( current + 1, refresh )\n\t\tshowImageAndInfo( current - 1, refresh )\n\t}\n\n\tslider.style[ dir === 'ltr' ? 'marginLeft' : 'marginRight' ] = -getClientWidth() * current + 'px'\n\n\t// render counter\n\tconst counterContainer = parentContainer.querySelector( '.wp-gallery-fullscreen-counter' )\n\tcounterContainer.textContent = current + 1 + '/' + items.length\n}\n\nconst renderPrevious = () => {\n\trenderNext( -1 )\n}\n\nconst applyGestureEvent = () => {\n\tconst container = parentContainer.querySelector( `.${ prefixClassname }` )\n\tconst marginLR = dir === 'ltr' ? 'marginLeft' : 'marginRight'\n\tconst items = container.querySelectorAll( `.${ prefixClassname }-item` )\n\n\tcontainer.addEventListener( 'pointerdown', ( e ) => {\n\t\tif ( isInvalidEvent( e, prefixClassname ) ) {\n\t\t\treturn\n\t\t}\n\n\t\tzoomStart( e )\n\t\tif ( getFingerAmount() === 1 && !isImgZoomedIn() ) {\n\t\t\tslideStart( e, container, marginLR )\n\t\t}\n\t} )\n\tcontainer.addEventListener( 'pointermove', ( e ) => {\n\t\tif ( isInvalidEvent( e, prefixClassname ) ) {\n\t\t\treturn\n\t\t}\n\n\t\tif ( getFingerAmount() > 1 ) {\n\t\t\tzoomMove( e )\n\t\t} else if ( isImgZoomedIn() ) {\n\t\t\tzoomScroll( e, renderNext, items, current, dir )\n\t\t} else {\n\t\t\tslideMove( e, container, marginLR, dir )\n\t\t}\n\t} )\n\tcontainer.addEventListener( 'pointerout', ( e ) => {\n\t\tif ( isInvalidEvent( e, prefixClassname ) ) {\n\t\t\treturn\n\t\t}\n\n\t\tcontainer.style.transition = temp.originalTransition\n\t\tif ( getFingerAmount() === 1 && !isImgZoomedIn() ) {\n\t\t\tslideEnd( e, container, renderNext, marginLR, current )\n\t\t}\n\t\tzoomEnd( e )\n\t} )\n}\n\nconst toggleFocusMode = () => {\n\tconst galleryScreen = parentContainer.querySelector( '.wp-gallery-fullscreen' )\n\tgalleryScreen.classList.toggle( 'wp-gallery-fullscreen-focus-mode' )\n}\n\nconst onShowFn = () => {\n\tconst sliderContainer = parentContainer.querySelector( `.${ prefixClassname }` )\n\tconst items = sliderContainer.querySelectorAll( `.${ prefixClassname }-item` )\n\tconst nextButton = sliderContainer.querySelector( '.next' )\n\tconst previousButton = sliderContainer.querySelector( '.previous' )\n\tlet tapped = false\n\n\trenderNext( 0 )\n\tapplyGestureEvent()\n\n\tsliderContainer.addEventListener( 'click', ( e ) => {\n\t\tif ( e.target.className === `${ prefixClassname }-item` ||\n\t\t\t\te.target.tagName === 'IMG' ) {\n\t\t\tif ( !tapped ) {\n\t\t\t\ttapped = setTimeout( () => {\n\t\t\t\t\ttapped = null\n\t\t\t\t\ttoggleFocusMode()\n\t\t\t\t}, 300 )\n\t\t\t} else {\n\t\t\t\t// Double tap\n\t\t\t\tclearTimeout( tapped )\n\t\t\t\ttapped = null\n\t\t\t\ttoggleZoom( e )\n\t\t\t}\n\t\t}\n\t} )\n\n\t// set the slider position when user resize the gallery fullscreen size\n\tconst windowResize = function ( el ) {\n\t\tel.style.transition = 'unset'\n\t\tel.style.marginLeft = -current * getClientWidth() + 'px'\n\t}\n\n\tlet windowResizeTimeout // used for debounced\n\taddEventListener( window, 'resize', () => {\n\t\tconst slider = document.querySelector( '.' + prefixClassname )\n\t\twindowResize( slider )\n\n\t\tclearTimeout( windowResizeTimeout )\n\t\twindowResizeTimeout = setTimeout( () => {\n\t\t\tslider.style.removeProperty( 'transition' )\n\t\t}, 100 )\n\t} )\n\n\tif ( items.length === 1 ) {\n\t\tpreviousButton.style.visibility = 'hidden'\n\t\tnextButton.style.visibility = 'hidden'\n\t} else {\n\t\tnextButton.addEventListener( 'click', () => {\n\t\t\trenderNext()\n\t\t} )\n\t\tpreviousButton.addEventListener( 'click', () => {\n\t\t\trenderPrevious()\n\t\t} )\n\t\taddEventListener( window, 'keydown', ( { key } ) => {\n\t\t\tswitch ( key ) {\n\t\t\t\tcase 'ArrowRight':\n\t\t\t\tcase 'Right':\n\t\t\t\t\tif ( dir === 'ltr' ) {\n\t\t\t\t\t\trenderNext()\n\t\t\t\t\t} else {\n\t\t\t\t\t\trenderPrevious()\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase 'ArrowLeft':\n\t\t\t\tcase 'Left':\n\t\t\t\t\tif ( dir === 'ltr' ) {\n\t\t\t\t\t\trenderPrevious()\n\t\t\t\t\t} else {\n\t\t\t\t\t\trenderNext()\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t} )\n\t}\n}\n\nexport { renderImageSlider, onShowFn }\n","import { renderImageSlider, onShowFn as sliderOnShowFn } from './slider'\nimport { addEventListener, clearAllEventListener } from './event'\n\nconst prefixClassname = 'wp-gallery-fullscreen'\n\nconst renderFullScreenGallery = ( lang, dir ) => {\n\treturn `\n\t\t<div class=\"${ prefixClassname }\" lang=\"${ lang }\" dir=\"${ dir }\">\n\t\t\t<div class=\"${ prefixClassname }-close\"></div>\n\t\t\t<div class=\"${ prefixClassname }-counter\"></div>\n\t\t\t<div class=\"${ prefixClassname }-main\"></div>\n\t\t</div>\n\t`.trim()\n}\n\nconst hideFullscreenGallery = ( container ) => {\n\tconst fullscreenGallery = container.querySelector( `.${ prefixClassname }` )\n\tcontainer.removeChild( fullscreenGallery )\n\tclearAllEventListener()\n}\n\nconst showFullscreenGallery = (\n\tmediaItems,\n\tselectedThumb,\n\tlang,\n\tdir,\n\tcontainer = document.body\n) => {\n\n\tif ( container.querySelector( `.${ prefixClassname }` ) ) {\n\t\t// Fullscreen gallery already present in DOM\n\t\treturn\n\t}\n\t// render utils for fullscreen then slider component\n\tcontainer.insertAdjacentHTML( 'beforeend', renderFullScreenGallery( lang, dir ) )\n\tcontainer.querySelector( `.${ prefixClassname }-main` )\n\t\t.insertAdjacentHTML( 'beforeend', renderImageSlider( lang, dir, container, mediaItems, selectedThumb ) )\n\n\t// onShow event for full screen component\n\tconst closeButton = container.querySelector( `.${ prefixClassname }-close` )\n\tcloseButton.addEventListener( 'click', () => {\n\t\thideFullscreenGallery( container )\n\t} )\n\n\taddEventListener( window, 'keydown', ( { key } ) => {\n\t\tif ( key === 'Escape' || key === 'Esc' ) {\n\t\t\thideFullscreenGallery( container )\n\t\t}\n\t} )\n\n\t// onShow event for slider component\n\tsliderOnShowFn()\n}\n\nexport { showFullscreenGallery }\n","import { isMobile, isVerticallyScrollable } from './utils'\nimport { showFullscreenGallery } from './gallery/fullscreen'\n\nexport const customEvents = ( popup ) => {\n\n\tlet eventListenerStack = []\n\tlet timeoutStack = []\n\n\tconst addTimeout = ( func, timeout ) => {\n\t\tconst id = setTimeout( func, timeout )\n\t\ttimeoutStack.push( id )\n\t\treturn id\n\t}\n\n\tconst clearAllTimeout = () => {\n\t\ttimeoutStack.forEach( ( timeoutId ) => {\n\t\t\tclearTimeout( timeoutId )\n\t\t} )\n\t\ttimeoutStack = []\n\t}\n\n\tconst addEventListener = ( target, type, listener, options = undefined ) => {\n\t\ttarget.addEventListener( type, listener, options )\n\t\teventListenerStack.push( [ target, type, listener, options ] )\n\t}\n\n\tconst clearAllEventListener = () => {\n\t\teventListenerStack.forEach( ( eventListener ) => {\n\t\t\tconst [ target, type, listener, options ] = eventListener\n\t\t\ttarget.removeEventListener( type, listener, options )\n\t\t} )\n\t\teventListenerStack = []\n\t}\n\n\tconst onMouseLeave = ( e ) => {\n\t\tconst toElement = e.toElement || e.relatedTarget || e.target\n\t\tconst previewElement = popup.element.currentTargetElement\n\n\t\tif ( toElement !== previewElement && !popup.element.contains( toElement ) ) {\n\t\t\tconst timeoutId = addTimeout( popup.hide, 300 )\n\t\t\tconst persistPopup = () => {\n\t\t\t\tclearTimeout( timeoutId )\n\t\t\t}\n\n\t\t\taddEventListener( popup.element, 'mouseenter', persistPopup )\n\t\t}\n\t}\n\n\tconst onHide = () => {\n\t\tpopup.lang = null\n\t\tpopup.title = null\n\t\tpopup.loading = false\n\n\t\tconst previewBody = popup.element.querySelector( '.wikipediapreview-body' )\n\t\tpreviewBody.style.transition = 'auto'\n\n\t\tclearAllEventListener()\n\t\tclearAllTimeout()\n\t}\n\n\tconst onShow = ( element ) => {\n\t\telement.component = {\n\t\t\tbody: element.querySelector( '.wikipediapreview-body' ),\n\t\t\twikipediapreview: element.querySelector( '.wikipediapreview' ),\n\t\t\twikipediapreviewHeaderImage: element.querySelector( '.wikipediapreview-header-image' ),\n\t\t\twikipediapreviewGalleryImages: element.querySelectorAll( '.wikipediapreview-gallery-image' ),\n\t\t\tcloseBtn: element.querySelector( '.wikipediapreview-header-closebtn' ),\n\t\t\tcontent: element.querySelector( '.wikipediapreview-body > p' ),\n\t\t\tscrollCue: element.querySelector( '.wikipediapreview-scroll-cue' )\n\t\t}\n\n\t\tif ( element.component.wikipediapreviewGalleryImages ) {\n\t\t\telement.component.wikipediapreviewGalleryImages.forEach( ( image ) => {\n\t\t\t\taddEventListener( image, 'click', ( e ) => {\n\t\t\t\t\tconst selected = e.target.style.backgroundImage.slice( 4, -1 ).replace( /\"/g, '' )\n\t\t\t\t\tshowFullscreenGallery( popup.media, selected, popup.lang, popup.dir )\n\t\t\t\t} )\n\t\t\t} )\n\t\t}\n\n\t\tif ( element.component.wikipediapreviewHeaderImage ) {\n\t\t\taddEventListener( element.component.wikipediapreviewHeaderImage, 'click', () => {\n\t\t\t\tshowFullscreenGallery( popup.media, popup.media[ 0 ].thumb, popup.lang, popup.dir )\n\t\t\t} )\n\t\t}\n\n\t\tif ( element.component.closeBtn ) {\n\t\t\taddEventListener( element.component.closeBtn, 'click', popup.hide )\n\t\t}\n\n\t\tif ( isMobile ) {\n\t\t\tconst darkScreen = document.querySelector( '.wp-dark-screen' )\n\t\t\taddEventListener( darkScreen, 'pointerup', popup.hide, true )\n\t\t} else {\n\t\t\taddEventListener( element, 'mouseleave', onMouseLeave )\n\t\t\taddEventListener( element.currentTargetElement, 'mouseleave', onMouseLeave )\n\t\t}\n\n\t\tif ( element.component.scrollCue ) {\n\t\t\tif ( isVerticallyScrollable( element.component.body ) ) {\n\t\t\t\taddEventListener( element.component.body, 'scroll', ( e ) => {\n\t\t\t\t\tif ( e.target.scrollTop > 0 ) {\n\t\t\t\t\t\telement.component.scrollCue.remove()\n\t\t\t\t\t}\n\t\t\t\t} )\n\t\t\t} else {\n\t\t\t\telement.component.scrollCue.remove()\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { onHide, onShow }\n}\n","/**\n * Custom positioning reference element.\n * @see https://floating-ui.com/docs/virtual-elements\n */\n\nconst sides = ['top', 'right', 'bottom', 'left'];\nconst alignments = ['start', 'end'];\nconst placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + \"-\" + alignments[0], side + \"-\" + alignments[1]), []);\nconst min = Math.min;\nconst max = Math.max;\nconst round = Math.round;\nconst floor = Math.floor;\nconst createCoords = v => ({\n  x: v,\n  y: v\n});\nconst oppositeSideMap = {\n  left: 'right',\n  right: 'left',\n  bottom: 'top',\n  top: 'bottom'\n};\nconst oppositeAlignmentMap = {\n  start: 'end',\n  end: 'start'\n};\nfunction clamp(start, value, end) {\n  return max(start, min(value, end));\n}\nfunction evaluate(value, param) {\n  return typeof value === 'function' ? value(param) : value;\n}\nfunction getSide(placement) {\n  return placement.split('-')[0];\n}\nfunction getAlignment(placement) {\n  return placement.split('-')[1];\n}\nfunction getOppositeAxis(axis) {\n  return axis === 'x' ? 'y' : 'x';\n}\nfunction getAxisLength(axis) {\n  return axis === 'y' ? 'height' : 'width';\n}\nfunction getSideAxis(placement) {\n  return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';\n}\nfunction getAlignmentAxis(placement) {\n  return getOppositeAxis(getSideAxis(placement));\n}\nfunction getAlignmentSides(placement, rects, rtl) {\n  if (rtl === void 0) {\n    rtl = false;\n  }\n  const alignment = getAlignment(placement);\n  const alignmentAxis = getAlignmentAxis(placement);\n  const length = getAxisLength(alignmentAxis);\n  let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';\n  if (rects.reference[length] > rects.floating[length]) {\n    mainAlignmentSide = getOppositePlacement(mainAlignmentSide);\n  }\n  return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];\n}\nfunction getExpandedPlacements(placement) {\n  const oppositePlacement = getOppositePlacement(placement);\n  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];\n}\nfunction getOppositeAlignmentPlacement(placement) {\n  return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);\n}\nfunction getSideList(side, isStart, rtl) {\n  const lr = ['left', 'right'];\n  const rl = ['right', 'left'];\n  const tb = ['top', 'bottom'];\n  const bt = ['bottom', 'top'];\n  switch (side) {\n    case 'top':\n    case 'bottom':\n      if (rtl) return isStart ? rl : lr;\n      return isStart ? lr : rl;\n    case 'left':\n    case 'right':\n      return isStart ? tb : bt;\n    default:\n      return [];\n  }\n}\nfunction getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {\n  const alignment = getAlignment(placement);\n  let list = getSideList(getSide(placement), direction === 'start', rtl);\n  if (alignment) {\n    list = list.map(side => side + \"-\" + alignment);\n    if (flipAlignment) {\n      list = list.concat(list.map(getOppositeAlignmentPlacement));\n    }\n  }\n  return list;\n}\nfunction getOppositePlacement(placement) {\n  return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);\n}\nfunction expandPaddingObject(padding) {\n  return {\n    top: 0,\n    right: 0,\n    bottom: 0,\n    left: 0,\n    ...padding\n  };\n}\nfunction getPaddingObject(padding) {\n  return typeof padding !== 'number' ? expandPaddingObject(padding) : {\n    top: padding,\n    right: padding,\n    bottom: padding,\n    left: padding\n  };\n}\nfunction rectToClientRect(rect) {\n  const {\n    x,\n    y,\n    width,\n    height\n  } = rect;\n  return {\n    width,\n    height,\n    top: y,\n    left: x,\n    right: x + width,\n    bottom: y + height,\n    x,\n    y\n  };\n}\n\nexport { alignments, clamp, createCoords, evaluate, expandPaddingObject, floor, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, placements, rectToClientRect, round, sides };\n","import { getSideAxis, getAlignmentAxis, getAxisLength, getSide, getAlignment, evaluate, getPaddingObject, rectToClientRect, min, clamp, placements, getAlignmentSides, getOppositeAlignmentPlacement, getOppositePlacement, getExpandedPlacements, getOppositeAxisPlacements, sides, max, getOppositeAxis } from '@floating-ui/utils';\nexport { rectToClientRect } from '@floating-ui/utils';\n\nfunction computeCoordsFromPlacement(_ref, placement, rtl) {\n  let {\n    reference,\n    floating\n  } = _ref;\n  const sideAxis = getSideAxis(placement);\n  const alignmentAxis = getAlignmentAxis(placement);\n  const alignLength = getAxisLength(alignmentAxis);\n  const side = getSide(placement);\n  const isVertical = sideAxis === 'y';\n  const commonX = reference.x + reference.width / 2 - floating.width / 2;\n  const commonY = reference.y + reference.height / 2 - floating.height / 2;\n  const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;\n  let coords;\n  switch (side) {\n    case 'top':\n      coords = {\n        x: commonX,\n        y: reference.y - floating.height\n      };\n      break;\n    case 'bottom':\n      coords = {\n        x: commonX,\n        y: reference.y + reference.height\n      };\n      break;\n    case 'right':\n      coords = {\n        x: reference.x + reference.width,\n        y: commonY\n      };\n      break;\n    case 'left':\n      coords = {\n        x: reference.x - floating.width,\n        y: commonY\n      };\n      break;\n    default:\n      coords = {\n        x: reference.x,\n        y: reference.y\n      };\n  }\n  switch (getAlignment(placement)) {\n    case 'start':\n      coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);\n      break;\n    case 'end':\n      coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);\n      break;\n  }\n  return coords;\n}\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n *\n * This export does not have any `platform` interface logic. You will need to\n * write one for the platform you are using Floating UI with.\n */\nconst computePosition = async (reference, floating, config) => {\n  const {\n    placement = 'bottom',\n    strategy = 'absolute',\n    middleware = [],\n    platform\n  } = config;\n  const validMiddleware = middleware.filter(Boolean);\n  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));\n  let rects = await platform.getElementRects({\n    reference,\n    floating,\n    strategy\n  });\n  let {\n    x,\n    y\n  } = computeCoordsFromPlacement(rects, placement, rtl);\n  let statefulPlacement = placement;\n  let middlewareData = {};\n  let resetCount = 0;\n  for (let i = 0; i < validMiddleware.length; i++) {\n    const {\n      name,\n      fn\n    } = validMiddleware[i];\n    const {\n      x: nextX,\n      y: nextY,\n      data,\n      reset\n    } = await fn({\n      x,\n      y,\n      initialPlacement: placement,\n      placement: statefulPlacement,\n      strategy,\n      middlewareData,\n      rects,\n      platform,\n      elements: {\n        reference,\n        floating\n      }\n    });\n    x = nextX != null ? nextX : x;\n    y = nextY != null ? nextY : y;\n    middlewareData = {\n      ...middlewareData,\n      [name]: {\n        ...middlewareData[name],\n        ...data\n      }\n    };\n    if (reset && resetCount <= 50) {\n      resetCount++;\n      if (typeof reset === 'object') {\n        if (reset.placement) {\n          statefulPlacement = reset.placement;\n        }\n        if (reset.rects) {\n          rects = reset.rects === true ? await platform.getElementRects({\n            reference,\n            floating,\n            strategy\n          }) : reset.rects;\n        }\n        ({\n          x,\n          y\n        } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));\n      }\n      i = -1;\n    }\n  }\n  return {\n    x,\n    y,\n    placement: statefulPlacement,\n    strategy,\n    middlewareData\n  };\n};\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nasync function detectOverflow(state, options) {\n  var _await$platform$isEle;\n  if (options === void 0) {\n    options = {};\n  }\n  const {\n    x,\n    y,\n    platform,\n    rects,\n    elements,\n    strategy\n  } = state;\n  const {\n    boundary = 'clippingAncestors',\n    rootBoundary = 'viewport',\n    elementContext = 'floating',\n    altBoundary = false,\n    padding = 0\n  } = evaluate(options, state);\n  const paddingObject = getPaddingObject(padding);\n  const altContext = elementContext === 'floating' ? 'reference' : 'floating';\n  const element = elements[altBoundary ? altContext : elementContext];\n  const clippingClientRect = rectToClientRect(await platform.getClippingRect({\n    element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),\n    boundary,\n    rootBoundary,\n    strategy\n  }));\n  const rect = elementContext === 'floating' ? {\n    x,\n    y,\n    width: rects.floating.width,\n    height: rects.floating.height\n  } : rects.reference;\n  const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));\n  const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {\n    x: 1,\n    y: 1\n  } : {\n    x: 1,\n    y: 1\n  };\n  const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n    elements,\n    rect,\n    offsetParent,\n    strategy\n  }) : rect);\n  return {\n    top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,\n    bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,\n    left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,\n    right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x\n  };\n}\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = options => ({\n  name: 'arrow',\n  options,\n  async fn(state) {\n    const {\n      x,\n      y,\n      placement,\n      rects,\n      platform,\n      elements,\n      middlewareData\n    } = state;\n    // Since `element` is required, we don't Partial<> the type.\n    const {\n      element,\n      padding = 0\n    } = evaluate(options, state) || {};\n    if (element == null) {\n      return {};\n    }\n    const paddingObject = getPaddingObject(padding);\n    const coords = {\n      x,\n      y\n    };\n    const axis = getAlignmentAxis(placement);\n    const length = getAxisLength(axis);\n    const arrowDimensions = await platform.getDimensions(element);\n    const isYAxis = axis === 'y';\n    const minProp = isYAxis ? 'top' : 'left';\n    const maxProp = isYAxis ? 'bottom' : 'right';\n    const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n    const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n    const startDiff = coords[axis] - rects.reference[axis];\n    const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));\n    let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;\n\n    // DOM platform can return `window` as the `offsetParent`.\n    if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {\n      clientSize = elements.floating[clientProp] || rects.floating[length];\n    }\n    const centerToReference = endDiff / 2 - startDiff / 2;\n\n    // If the padding is large enough that it causes the arrow to no longer be\n    // centered, modify the padding so that it is centered.\n    const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n    const minPadding = min(paddingObject[minProp], largestPossiblePadding);\n    const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);\n\n    // Make sure the arrow doesn't overflow the floating element if the center\n    // point is outside the floating element's bounds.\n    const min$1 = minPadding;\n    const max = clientSize - arrowDimensions[length] - maxPadding;\n    const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n    const offset = clamp(min$1, center, max);\n\n    // If the reference is small enough that the arrow's padding causes it to\n    // to point to nothing for an aligned placement, adjust the offset of the\n    // floating element itself. To ensure `shift()` continues to take action,\n    // a single reset is performed when this is true.\n    const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n    const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;\n    return {\n      [axis]: coords[axis] + alignmentOffset,\n      data: {\n        [axis]: offset,\n        centerOffset: center - offset - alignmentOffset,\n        ...(shouldAddOffset && {\n          alignmentOffset\n        })\n      },\n      reset: shouldAddOffset\n    };\n  }\n});\n\nfunction getPlacementList(alignment, autoAlignment, allowedPlacements) {\n  const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);\n  return allowedPlacementsSortedByAlignment.filter(placement => {\n    if (alignment) {\n      return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);\n    }\n    return true;\n  });\n}\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = function (options) {\n  if (options === void 0) {\n    options = {};\n  }\n  return {\n    name: 'autoPlacement',\n    options,\n    async fn(state) {\n      var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;\n      const {\n        rects,\n        middlewareData,\n        placement,\n        platform,\n        elements\n      } = state;\n      const {\n        crossAxis = false,\n        alignment,\n        allowedPlacements = placements,\n        autoAlignment = true,\n        ...detectOverflowOptions\n      } = evaluate(options, state);\n      const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;\n      const overflow = await detectOverflow(state, detectOverflowOptions);\n      const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;\n      const currentPlacement = placements$1[currentIndex];\n      if (currentPlacement == null) {\n        return {};\n      }\n      const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));\n\n      // Make `computeCoords` start from the right place.\n      if (placement !== currentPlacement) {\n        return {\n          reset: {\n            placement: placements$1[0]\n          }\n        };\n      }\n      const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];\n      const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {\n        placement: currentPlacement,\n        overflows: currentOverflows\n      }];\n      const nextPlacement = placements$1[currentIndex + 1];\n\n      // There are more placements to check.\n      if (nextPlacement) {\n        return {\n          data: {\n            index: currentIndex + 1,\n            overflows: allOverflows\n          },\n          reset: {\n            placement: nextPlacement\n          }\n        };\n      }\n      const placementsSortedByMostSpace = allOverflows.map(d => {\n        const alignment = getAlignment(d.placement);\n        return [d.placement, alignment && crossAxis ?\n        // Check along the mainAxis and main crossAxis side.\n        d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :\n        // Check only the mainAxis.\n        d.overflows[0], d.overflows];\n      }).sort((a, b) => a[1] - b[1]);\n      const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,\n      // Aligned placements should not check their opposite crossAxis\n      // side.\n      getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));\n      const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];\n      if (resetPlacement !== placement) {\n        return {\n          data: {\n            index: currentIndex + 1,\n            overflows: allOverflows\n          },\n          reset: {\n            placement: resetPlacement\n          }\n        };\n      }\n      return {};\n    }\n  };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = function (options) {\n  if (options === void 0) {\n    options = {};\n  }\n  return {\n    name: 'flip',\n    options,\n    async fn(state) {\n      var _middlewareData$arrow, _middlewareData$flip;\n      const {\n        placement,\n        middlewareData,\n        rects,\n        initialPlacement,\n        platform,\n        elements\n      } = state;\n      const {\n        mainAxis: checkMainAxis = true,\n        crossAxis: checkCrossAxis = true,\n        fallbackPlacements: specifiedFallbackPlacements,\n        fallbackStrategy = 'bestFit',\n        fallbackAxisSideDirection = 'none',\n        flipAlignment = true,\n        ...detectOverflowOptions\n      } = evaluate(options, state);\n\n      // If a reset by the arrow was caused due to an alignment offset being\n      // added, we should skip any logic now since `flip()` has already done its\n      // work.\n      // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643\n      if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n        return {};\n      }\n      const side = getSide(placement);\n      const initialSideAxis = getSideAxis(initialPlacement);\n      const isBasePlacement = getSide(initialPlacement) === initialPlacement;\n      const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n      const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));\n      const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';\n      if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {\n        fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));\n      }\n      const placements = [initialPlacement, ...fallbackPlacements];\n      const overflow = await detectOverflow(state, detectOverflowOptions);\n      const overflows = [];\n      let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];\n      if (checkMainAxis) {\n        overflows.push(overflow[side]);\n      }\n      if (checkCrossAxis) {\n        const sides = getAlignmentSides(placement, rects, rtl);\n        overflows.push(overflow[sides[0]], overflow[sides[1]]);\n      }\n      overflowsData = [...overflowsData, {\n        placement,\n        overflows\n      }];\n\n      // One or more sides is overflowing.\n      if (!overflows.every(side => side <= 0)) {\n        var _middlewareData$flip2, _overflowsData$filter;\n        const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;\n        const nextPlacement = placements[nextIndex];\n        if (nextPlacement) {\n          const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;\n          if (!ignoreCrossAxisOverflow ||\n          // We leave the current main axis only if every placement on that axis\n          // overflows the main axis.\n          overflowsData.every(d => d.overflows[0] > 0 && getSideAxis(d.placement) === initialSideAxis)) {\n            // Try next placement and re-run the lifecycle.\n            return {\n              data: {\n                index: nextIndex,\n                overflows: overflowsData\n              },\n              reset: {\n                placement: nextPlacement\n              }\n            };\n          }\n        }\n\n        // First, find the candidates that fit on the mainAxis side of overflow,\n        // then find the placement that fits the best on the main crossAxis side.\n        let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;\n\n        // Otherwise fallback.\n        if (!resetPlacement) {\n          switch (fallbackStrategy) {\n            case 'bestFit':\n              {\n                var _overflowsData$filter2;\n                const placement = (_overflowsData$filter2 = overflowsData.filter(d => {\n                  if (hasFallbackAxisSideDirection) {\n                    const currentSideAxis = getSideAxis(d.placement);\n                    return currentSideAxis === initialSideAxis ||\n                    // Create a bias to the `y` side axis due to horizontal\n                    // reading directions favoring greater width.\n                    currentSideAxis === 'y';\n                  }\n                  return true;\n                }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];\n                if (placement) {\n                  resetPlacement = placement;\n                }\n                break;\n              }\n            case 'initialPlacement':\n              resetPlacement = initialPlacement;\n              break;\n          }\n        }\n        if (placement !== resetPlacement) {\n          return {\n            reset: {\n              placement: resetPlacement\n            }\n          };\n        }\n      }\n      return {};\n    }\n  };\n};\n\nfunction getSideOffsets(overflow, rect) {\n  return {\n    top: overflow.top - rect.height,\n    right: overflow.right - rect.width,\n    bottom: overflow.bottom - rect.height,\n    left: overflow.left - rect.width\n  };\n}\nfunction isAnySideFullyClipped(overflow) {\n  return sides.some(side => overflow[side] >= 0);\n}\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = function (options) {\n  if (options === void 0) {\n    options = {};\n  }\n  return {\n    name: 'hide',\n    options,\n    async fn(state) {\n      const {\n        rects\n      } = state;\n      const {\n        strategy = 'referenceHidden',\n        ...detectOverflowOptions\n      } = evaluate(options, state);\n      switch (strategy) {\n        case 'referenceHidden':\n          {\n            const overflow = await detectOverflow(state, {\n              ...detectOverflowOptions,\n              elementContext: 'reference'\n            });\n            const offsets = getSideOffsets(overflow, rects.reference);\n            return {\n              data: {\n                referenceHiddenOffsets: offsets,\n                referenceHidden: isAnySideFullyClipped(offsets)\n              }\n            };\n          }\n        case 'escaped':\n          {\n            const overflow = await detectOverflow(state, {\n              ...detectOverflowOptions,\n              altBoundary: true\n            });\n            const offsets = getSideOffsets(overflow, rects.floating);\n            return {\n              data: {\n                escapedOffsets: offsets,\n                escaped: isAnySideFullyClipped(offsets)\n              }\n            };\n          }\n        default:\n          {\n            return {};\n          }\n      }\n    }\n  };\n};\n\nfunction getBoundingRect(rects) {\n  const minX = min(...rects.map(rect => rect.left));\n  const minY = min(...rects.map(rect => rect.top));\n  const maxX = max(...rects.map(rect => rect.right));\n  const maxY = max(...rects.map(rect => rect.bottom));\n  return {\n    x: minX,\n    y: minY,\n    width: maxX - minX,\n    height: maxY - minY\n  };\n}\nfunction getRectsByLine(rects) {\n  const sortedRects = rects.slice().sort((a, b) => a.y - b.y);\n  const groups = [];\n  let prevRect = null;\n  for (let i = 0; i < sortedRects.length; i++) {\n    const rect = sortedRects[i];\n    if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {\n      groups.push([rect]);\n    } else {\n      groups[groups.length - 1].push(rect);\n    }\n    prevRect = rect;\n  }\n  return groups.map(rect => rectToClientRect(getBoundingRect(rect)));\n}\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = function (options) {\n  if (options === void 0) {\n    options = {};\n  }\n  return {\n    name: 'inline',\n    options,\n    async fn(state) {\n      const {\n        placement,\n        elements,\n        rects,\n        platform,\n        strategy\n      } = state;\n      // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a\n      // ClientRect's bounds, despite the event listener being triggered. A\n      // padding of 2 seems to handle this issue.\n      const {\n        padding = 2,\n        x,\n        y\n      } = evaluate(options, state);\n      const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);\n      const clientRects = getRectsByLine(nativeClientRects);\n      const fallback = rectToClientRect(getBoundingRect(nativeClientRects));\n      const paddingObject = getPaddingObject(padding);\n      function getBoundingClientRect() {\n        // There are two rects and they are disjoined.\n        if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {\n          // Find the first rect in which the point is fully inside.\n          return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;\n        }\n\n        // There are 2 or more connected rects.\n        if (clientRects.length >= 2) {\n          if (getSideAxis(placement) === 'y') {\n            const firstRect = clientRects[0];\n            const lastRect = clientRects[clientRects.length - 1];\n            const isTop = getSide(placement) === 'top';\n            const top = firstRect.top;\n            const bottom = lastRect.bottom;\n            const left = isTop ? firstRect.left : lastRect.left;\n            const right = isTop ? firstRect.right : lastRect.right;\n            const width = right - left;\n            const height = bottom - top;\n            return {\n              top,\n              bottom,\n              left,\n              right,\n              width,\n              height,\n              x: left,\n              y: top\n            };\n          }\n          const isLeftSide = getSide(placement) === 'left';\n          const maxRight = max(...clientRects.map(rect => rect.right));\n          const minLeft = min(...clientRects.map(rect => rect.left));\n          const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);\n          const top = measureRects[0].top;\n          const bottom = measureRects[measureRects.length - 1].bottom;\n          const left = minLeft;\n          const right = maxRight;\n          const width = right - left;\n          const height = bottom - top;\n          return {\n            top,\n            bottom,\n            left,\n            right,\n            width,\n            height,\n            x: left,\n            y: top\n          };\n        }\n        return fallback;\n      }\n      const resetRects = await platform.getElementRects({\n        reference: {\n          getBoundingClientRect\n        },\n        floating: elements.floating,\n        strategy\n      });\n      if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {\n        return {\n          reset: {\n            rects: resetRects\n          }\n        };\n      }\n      return {};\n    }\n  };\n};\n\n// For type backwards-compatibility, the `OffsetOptions` type was also\n// Derivable.\n\nasync function convertValueToCoords(state, options) {\n  const {\n    placement,\n    platform,\n    elements\n  } = state;\n  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n  const side = getSide(placement);\n  const alignment = getAlignment(placement);\n  const isVertical = getSideAxis(placement) === 'y';\n  const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;\n  const crossAxisMulti = rtl && isVertical ? -1 : 1;\n  const rawValue = evaluate(options, state);\n\n  // eslint-disable-next-line prefer-const\n  let {\n    mainAxis,\n    crossAxis,\n    alignmentAxis\n  } = typeof rawValue === 'number' ? {\n    mainAxis: rawValue,\n    crossAxis: 0,\n    alignmentAxis: null\n  } : {\n    mainAxis: rawValue.mainAxis || 0,\n    crossAxis: rawValue.crossAxis || 0,\n    alignmentAxis: rawValue.alignmentAxis\n  };\n  if (alignment && typeof alignmentAxis === 'number') {\n    crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;\n  }\n  return isVertical ? {\n    x: crossAxis * crossAxisMulti,\n    y: mainAxis * mainAxisMulti\n  } : {\n    x: mainAxis * mainAxisMulti,\n    y: crossAxis * crossAxisMulti\n  };\n}\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = function (options) {\n  if (options === void 0) {\n    options = 0;\n  }\n  return {\n    name: 'offset',\n    options,\n    async fn(state) {\n      var _middlewareData$offse, _middlewareData$arrow;\n      const {\n        x,\n        y,\n        placement,\n        middlewareData\n      } = state;\n      const diffCoords = await convertValueToCoords(state, options);\n\n      // If the placement is the same and the arrow caused an alignment offset\n      // then we don't need to change the positioning coordinates.\n      if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n        return {};\n      }\n      return {\n        x: x + diffCoords.x,\n        y: y + diffCoords.y,\n        data: {\n          ...diffCoords,\n          placement\n        }\n      };\n    }\n  };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = function (options) {\n  if (options === void 0) {\n    options = {};\n  }\n  return {\n    name: 'shift',\n    options,\n    async fn(state) {\n      const {\n        x,\n        y,\n        placement\n      } = state;\n      const {\n        mainAxis: checkMainAxis = true,\n        crossAxis: checkCrossAxis = false,\n        limiter = {\n          fn: _ref => {\n            let {\n              x,\n              y\n            } = _ref;\n            return {\n              x,\n              y\n            };\n          }\n        },\n        ...detectOverflowOptions\n      } = evaluate(options, state);\n      const coords = {\n        x,\n        y\n      };\n      const overflow = await detectOverflow(state, detectOverflowOptions);\n      const crossAxis = getSideAxis(getSide(placement));\n      const mainAxis = getOppositeAxis(crossAxis);\n      let mainAxisCoord = coords[mainAxis];\n      let crossAxisCoord = coords[crossAxis];\n      if (checkMainAxis) {\n        const minSide = mainAxis === 'y' ? 'top' : 'left';\n        const maxSide = mainAxis === 'y' ? 'bottom' : 'right';\n        const min = mainAxisCoord + overflow[minSide];\n        const max = mainAxisCoord - overflow[maxSide];\n        mainAxisCoord = clamp(min, mainAxisCoord, max);\n      }\n      if (checkCrossAxis) {\n        const minSide = crossAxis === 'y' ? 'top' : 'left';\n        const maxSide = crossAxis === 'y' ? 'bottom' : 'right';\n        const min = crossAxisCoord + overflow[minSide];\n        const max = crossAxisCoord - overflow[maxSide];\n        crossAxisCoord = clamp(min, crossAxisCoord, max);\n      }\n      const limitedCoords = limiter.fn({\n        ...state,\n        [mainAxis]: mainAxisCoord,\n        [crossAxis]: crossAxisCoord\n      });\n      return {\n        ...limitedCoords,\n        data: {\n          x: limitedCoords.x - x,\n          y: limitedCoords.y - y,\n          enabled: {\n            [mainAxis]: checkMainAxis,\n            [crossAxis]: checkCrossAxis\n          }\n        }\n      };\n    }\n  };\n};\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = function (options) {\n  if (options === void 0) {\n    options = {};\n  }\n  return {\n    options,\n    fn(state) {\n      const {\n        x,\n        y,\n        placement,\n        rects,\n        middlewareData\n      } = state;\n      const {\n        offset = 0,\n        mainAxis: checkMainAxis = true,\n        crossAxis: checkCrossAxis = true\n      } = evaluate(options, state);\n      const coords = {\n        x,\n        y\n      };\n      const crossAxis = getSideAxis(placement);\n      const mainAxis = getOppositeAxis(crossAxis);\n      let mainAxisCoord = coords[mainAxis];\n      let crossAxisCoord = coords[crossAxis];\n      const rawOffset = evaluate(offset, state);\n      const computedOffset = typeof rawOffset === 'number' ? {\n        mainAxis: rawOffset,\n        crossAxis: 0\n      } : {\n        mainAxis: 0,\n        crossAxis: 0,\n        ...rawOffset\n      };\n      if (checkMainAxis) {\n        const len = mainAxis === 'y' ? 'height' : 'width';\n        const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;\n        const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;\n        if (mainAxisCoord < limitMin) {\n          mainAxisCoord = limitMin;\n        } else if (mainAxisCoord > limitMax) {\n          mainAxisCoord = limitMax;\n        }\n      }\n      if (checkCrossAxis) {\n        var _middlewareData$offse, _middlewareData$offse2;\n        const len = mainAxis === 'y' ? 'width' : 'height';\n        const isOriginSide = ['top', 'left'].includes(getSide(placement));\n        const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);\n        const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);\n        if (crossAxisCoord < limitMin) {\n          crossAxisCoord = limitMin;\n        } else if (crossAxisCoord > limitMax) {\n          crossAxisCoord = limitMax;\n        }\n      }\n      return {\n        [mainAxis]: mainAxisCoord,\n        [crossAxis]: crossAxisCoord\n      };\n    }\n  };\n};\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = function (options) {\n  if (options === void 0) {\n    options = {};\n  }\n  return {\n    name: 'size',\n    options,\n    async fn(state) {\n      var _state$middlewareData, _state$middlewareData2;\n      const {\n        placement,\n        rects,\n        platform,\n        elements\n      } = state;\n      const {\n        apply = () => {},\n        ...detectOverflowOptions\n      } = evaluate(options, state);\n      const overflow = await detectOverflow(state, detectOverflowOptions);\n      const side = getSide(placement);\n      const alignment = getAlignment(placement);\n      const isYAxis = getSideAxis(placement) === 'y';\n      const {\n        width,\n        height\n      } = rects.floating;\n      let heightSide;\n      let widthSide;\n      if (side === 'top' || side === 'bottom') {\n        heightSide = side;\n        widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';\n      } else {\n        widthSide = side;\n        heightSide = alignment === 'end' ? 'top' : 'bottom';\n      }\n      const maximumClippingHeight = height - overflow.top - overflow.bottom;\n      const maximumClippingWidth = width - overflow.left - overflow.right;\n      const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);\n      const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);\n      const noShift = !state.middlewareData.shift;\n      let availableHeight = overflowAvailableHeight;\n      let availableWidth = overflowAvailableWidth;\n      if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {\n        availableWidth = maximumClippingWidth;\n      }\n      if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {\n        availableHeight = maximumClippingHeight;\n      }\n      if (noShift && !alignment) {\n        const xMin = max(overflow.left, 0);\n        const xMax = max(overflow.right, 0);\n        const yMin = max(overflow.top, 0);\n        const yMax = max(overflow.bottom, 0);\n        if (isYAxis) {\n          availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));\n        } else {\n          availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));\n        }\n      }\n      await apply({\n        ...state,\n        availableWidth,\n        availableHeight\n      });\n      const nextDimensions = await platform.getDimensions(elements.floating);\n      if (width !== nextDimensions.width || height !== nextDimensions.height) {\n        return {\n          reset: {\n            rects: true\n          }\n        };\n      }\n      return {};\n    }\n  };\n};\n\nexport { arrow, autoPlacement, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, shift, size };\n","function hasWindow() {\n  return typeof window !== 'undefined';\n}\nfunction getNodeName(node) {\n  if (isNode(node)) {\n    return (node.nodeName || '').toLowerCase();\n  }\n  // Mocked nodes in testing environments may not be instances of Node. By\n  // returning `#document` an infinite loop won't occur.\n  // https://github.com/floating-ui/floating-ui/issues/2317\n  return '#document';\n}\nfunction getWindow(node) {\n  var _node$ownerDocument;\n  return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;\n}\nfunction getDocumentElement(node) {\n  var _ref;\n  return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;\n}\nfunction isNode(value) {\n  if (!hasWindow()) {\n    return false;\n  }\n  return value instanceof Node || value instanceof getWindow(value).Node;\n}\nfunction isElement(value) {\n  if (!hasWindow()) {\n    return false;\n  }\n  return value instanceof Element || value instanceof getWindow(value).Element;\n}\nfunction isHTMLElement(value) {\n  if (!hasWindow()) {\n    return false;\n  }\n  return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;\n}\nfunction isShadowRoot(value) {\n  if (!hasWindow() || typeof ShadowRoot === 'undefined') {\n    return false;\n  }\n  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;\n}\nfunction isOverflowElement(element) {\n  const {\n    overflow,\n    overflowX,\n    overflowY,\n    display\n  } = getComputedStyle(element);\n  return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);\n}\nfunction isTableElement(element) {\n  return ['table', 'td', 'th'].includes(getNodeName(element));\n}\nfunction isTopLayer(element) {\n  return [':popover-open', ':modal'].some(selector => {\n    try {\n      return element.matches(selector);\n    } catch (e) {\n      return false;\n    }\n  });\n}\nfunction isContainingBlock(elementOrCss) {\n  const webkit = isWebKit();\n  const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;\n\n  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n  // https://drafts.csswg.org/css-transforms-2/#individual-transforms\n  return ['transform', 'translate', 'scale', 'rotate', 'perspective'].some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));\n}\nfunction getContainingBlock(element) {\n  let currentNode = getParentNode(element);\n  while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {\n    if (isContainingBlock(currentNode)) {\n      return currentNode;\n    } else if (isTopLayer(currentNode)) {\n      return null;\n    }\n    currentNode = getParentNode(currentNode);\n  }\n  return null;\n}\nfunction isWebKit() {\n  if (typeof CSS === 'undefined' || !CSS.supports) return false;\n  return CSS.supports('-webkit-backdrop-filter', 'none');\n}\nfunction isLastTraversableNode(node) {\n  return ['html', 'body', '#document'].includes(getNodeName(node));\n}\nfunction getComputedStyle(element) {\n  return getWindow(element).getComputedStyle(element);\n}\nfunction getNodeScroll(element) {\n  if (isElement(element)) {\n    return {\n      scrollLeft: element.scrollLeft,\n      scrollTop: element.scrollTop\n    };\n  }\n  return {\n    scrollLeft: element.scrollX,\n    scrollTop: element.scrollY\n  };\n}\nfunction getParentNode(node) {\n  if (getNodeName(node) === 'html') {\n    return node;\n  }\n  const result =\n  // Step into the shadow DOM of the parent of a slotted node.\n  node.assignedSlot ||\n  // DOM Element detected.\n  node.parentNode ||\n  // ShadowRoot detected.\n  isShadowRoot(node) && node.host ||\n  // Fallback.\n  getDocumentElement(node);\n  return isShadowRoot(result) ? result.host : result;\n}\nfunction getNearestOverflowAncestor(node) {\n  const parentNode = getParentNode(node);\n  if (isLastTraversableNode(parentNode)) {\n    return node.ownerDocument ? node.ownerDocument.body : node.body;\n  }\n  if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {\n    return parentNode;\n  }\n  return getNearestOverflowAncestor(parentNode);\n}\nfunction getOverflowAncestors(node, list, traverseIframes) {\n  var _node$ownerDocument2;\n  if (list === void 0) {\n    list = [];\n  }\n  if (traverseIframes === void 0) {\n    traverseIframes = true;\n  }\n  const scrollableAncestor = getNearestOverflowAncestor(node);\n  const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);\n  const win = getWindow(scrollableAncestor);\n  if (isBody) {\n    const frameElement = getFrameElement(win);\n    return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);\n  }\n  return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));\n}\nfunction getFrameElement(win) {\n  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;\n}\n\nexport { getComputedStyle, getContainingBlock, getDocumentElement, getFrameElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };\n","import { rectToClientRect, detectOverflow as detectOverflow$1, offset as offset$1, autoPlacement as autoPlacement$1, shift as shift$1, flip as flip$1, size as size$1, hide as hide$1, arrow as arrow$1, inline as inline$1, limitShift as limitShift$1, computePosition as computePosition$1 } from '@floating-ui/core';\nimport { round, createCoords, max, min, floor } from '@floating-ui/utils';\nimport { getComputedStyle, isHTMLElement, isElement, getWindow, isWebKit, getDocumentElement, getNodeName, isOverflowElement, getNodeScroll, getOverflowAncestors, getParentNode, isLastTraversableNode, isContainingBlock, isTableElement, getContainingBlock } from '@floating-ui/utils/dom';\nexport { getOverflowAncestors } from '@floating-ui/utils/dom';\n\nfunction getCssDimensions(element) {\n  const css = getComputedStyle(element);\n  // In testing environments, the `width` and `height` properties are empty\n  // strings for SVG elements, returning NaN. Fallback to `0` in this case.\n  let width = parseFloat(css.width) || 0;\n  let height = parseFloat(css.height) || 0;\n  const hasOffset = isHTMLElement(element);\n  const offsetWidth = hasOffset ? element.offsetWidth : width;\n  const offsetHeight = hasOffset ? element.offsetHeight : height;\n  const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;\n  if (shouldFallback) {\n    width = offsetWidth;\n    height = offsetHeight;\n  }\n  return {\n    width,\n    height,\n    $: shouldFallback\n  };\n}\n\nfunction unwrapElement(element) {\n  return !isElement(element) ? element.contextElement : element;\n}\n\nfunction getScale(element) {\n  const domElement = unwrapElement(element);\n  if (!isHTMLElement(domElement)) {\n    return createCoords(1);\n  }\n  const rect = domElement.getBoundingClientRect();\n  const {\n    width,\n    height,\n    $\n  } = getCssDimensions(domElement);\n  let x = ($ ? round(rect.width) : rect.width) / width;\n  let y = ($ ? round(rect.height) : rect.height) / height;\n\n  // 0, NaN, or Infinity should always fallback to 1.\n\n  if (!x || !Number.isFinite(x)) {\n    x = 1;\n  }\n  if (!y || !Number.isFinite(y)) {\n    y = 1;\n  }\n  return {\n    x,\n    y\n  };\n}\n\nconst noOffsets = /*#__PURE__*/createCoords(0);\nfunction getVisualOffsets(element) {\n  const win = getWindow(element);\n  if (!isWebKit() || !win.visualViewport) {\n    return noOffsets;\n  }\n  return {\n    x: win.visualViewport.offsetLeft,\n    y: win.visualViewport.offsetTop\n  };\n}\nfunction shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {\n  if (isFixed === void 0) {\n    isFixed = false;\n  }\n  if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {\n    return false;\n  }\n  return isFixed;\n}\n\nfunction getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {\n  if (includeScale === void 0) {\n    includeScale = false;\n  }\n  if (isFixedStrategy === void 0) {\n    isFixedStrategy = false;\n  }\n  const clientRect = element.getBoundingClientRect();\n  const domElement = unwrapElement(element);\n  let scale = createCoords(1);\n  if (includeScale) {\n    if (offsetParent) {\n      if (isElement(offsetParent)) {\n        scale = getScale(offsetParent);\n      }\n    } else {\n      scale = getScale(element);\n    }\n  }\n  const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);\n  let x = (clientRect.left + visualOffsets.x) / scale.x;\n  let y = (clientRect.top + visualOffsets.y) / scale.y;\n  let width = clientRect.width / scale.x;\n  let height = clientRect.height / scale.y;\n  if (domElement) {\n    const win = getWindow(domElement);\n    const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;\n    let currentWin = win;\n    let currentIFrame = currentWin.frameElement;\n    while (currentIFrame && offsetParent && offsetWin !== currentWin) {\n      const iframeScale = getScale(currentIFrame);\n      const iframeRect = currentIFrame.getBoundingClientRect();\n      const css = getComputedStyle(currentIFrame);\n      const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;\n      const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;\n      x *= iframeScale.x;\n      y *= iframeScale.y;\n      width *= iframeScale.x;\n      height *= iframeScale.y;\n      x += left;\n      y += top;\n      currentWin = getWindow(currentIFrame);\n      currentIFrame = currentWin.frameElement;\n    }\n  }\n  return rectToClientRect({\n    width,\n    height,\n    x,\n    y\n  });\n}\n\nconst topLayerSelectors = [':popover-open', ':modal'];\nfunction isTopLayer(element) {\n  return topLayerSelectors.some(selector => {\n    try {\n      return element.matches(selector);\n    } catch (e) {\n      return false;\n    }\n  });\n}\n\nfunction convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {\n  let {\n    elements,\n    rect,\n    offsetParent,\n    strategy\n  } = _ref;\n  const isFixed = strategy === 'fixed';\n  const documentElement = getDocumentElement(offsetParent);\n  const topLayer = elements ? isTopLayer(elements.floating) : false;\n  if (offsetParent === documentElement || topLayer && isFixed) {\n    return rect;\n  }\n  let scroll = {\n    scrollLeft: 0,\n    scrollTop: 0\n  };\n  let scale = createCoords(1);\n  const offsets = createCoords(0);\n  const isOffsetParentAnElement = isHTMLElement(offsetParent);\n  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n    if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n      scroll = getNodeScroll(offsetParent);\n    }\n    if (isHTMLElement(offsetParent)) {\n      const offsetRect = getBoundingClientRect(offsetParent);\n      scale = getScale(offsetParent);\n      offsets.x = offsetRect.x + offsetParent.clientLeft;\n      offsets.y = offsetRect.y + offsetParent.clientTop;\n    }\n  }\n  return {\n    width: rect.width * scale.x,\n    height: rect.height * scale.y,\n    x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,\n    y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y\n  };\n}\n\nfunction getClientRects(element) {\n  return Array.from(element.getClientRects());\n}\n\nfunction getWindowScrollBarX(element) {\n  // If <html> has a CSS width greater than the viewport, then this will be\n  // incorrect for RTL.\n  return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;\n}\n\n// Gets the entire size of the scrollable document area, even extending outside\n// of the `<html>` and `<body>` rect bounds if horizontally scrollable.\nfunction getDocumentRect(element) {\n  const html = getDocumentElement(element);\n  const scroll = getNodeScroll(element);\n  const body = element.ownerDocument.body;\n  const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);\n  const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);\n  let x = -scroll.scrollLeft + getWindowScrollBarX(element);\n  const y = -scroll.scrollTop;\n  if (getComputedStyle(body).direction === 'rtl') {\n    x += max(html.clientWidth, body.clientWidth) - width;\n  }\n  return {\n    width,\n    height,\n    x,\n    y\n  };\n}\n\nfunction getViewportRect(element, strategy) {\n  const win = getWindow(element);\n  const html = getDocumentElement(element);\n  const visualViewport = win.visualViewport;\n  let width = html.clientWidth;\n  let height = html.clientHeight;\n  let x = 0;\n  let y = 0;\n  if (visualViewport) {\n    width = visualViewport.width;\n    height = visualViewport.height;\n    const visualViewportBased = isWebKit();\n    if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {\n      x = visualViewport.offsetLeft;\n      y = visualViewport.offsetTop;\n    }\n  }\n  return {\n    width,\n    height,\n    x,\n    y\n  };\n}\n\n// Returns the inner client rect, subtracting scrollbars if present.\nfunction getInnerBoundingClientRect(element, strategy) {\n  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');\n  const top = clientRect.top + element.clientTop;\n  const left = clientRect.left + element.clientLeft;\n  const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);\n  const width = element.clientWidth * scale.x;\n  const height = element.clientHeight * scale.y;\n  const x = left * scale.x;\n  const y = top * scale.y;\n  return {\n    width,\n    height,\n    x,\n    y\n  };\n}\nfunction getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {\n  let rect;\n  if (clippingAncestor === 'viewport') {\n    rect = getViewportRect(element, strategy);\n  } else if (clippingAncestor === 'document') {\n    rect = getDocumentRect(getDocumentElement(element));\n  } else if (isElement(clippingAncestor)) {\n    rect = getInnerBoundingClientRect(clippingAncestor, strategy);\n  } else {\n    const visualOffsets = getVisualOffsets(element);\n    rect = {\n      ...clippingAncestor,\n      x: clippingAncestor.x - visualOffsets.x,\n      y: clippingAncestor.y - visualOffsets.y\n    };\n  }\n  return rectToClientRect(rect);\n}\nfunction hasFixedPositionAncestor(element, stopNode) {\n  const parentNode = getParentNode(element);\n  if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {\n    return false;\n  }\n  return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);\n}\n\n// A \"clipping ancestor\" is an `overflow` element with the characteristic of\n// clipping (or hiding) child elements. This returns all clipping ancestors\n// of the given element up the tree.\nfunction getClippingElementAncestors(element, cache) {\n  const cachedResult = cache.get(element);\n  if (cachedResult) {\n    return cachedResult;\n  }\n  let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');\n  let currentContainingBlockComputedStyle = null;\n  const elementIsFixed = getComputedStyle(element).position === 'fixed';\n  let currentNode = elementIsFixed ? getParentNode(element) : element;\n\n  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n  while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {\n    const computedStyle = getComputedStyle(currentNode);\n    const currentNodeIsContaining = isContainingBlock(currentNode);\n    if (!currentNodeIsContaining && computedStyle.position === 'fixed') {\n      currentContainingBlockComputedStyle = null;\n    }\n    const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);\n    if (shouldDropCurrentNode) {\n      // Drop non-containing blocks.\n      result = result.filter(ancestor => ancestor !== currentNode);\n    } else {\n      // Record last containing block for next iteration.\n      currentContainingBlockComputedStyle = computedStyle;\n    }\n    currentNode = getParentNode(currentNode);\n  }\n  cache.set(element, result);\n  return result;\n}\n\n// Gets the maximum area that the element is visible in due to any number of\n// clipping ancestors.\nfunction getClippingRect(_ref) {\n  let {\n    element,\n    boundary,\n    rootBoundary,\n    strategy\n  } = _ref;\n  const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);\n  const clippingAncestors = [...elementClippingAncestors, rootBoundary];\n  const firstClippingAncestor = clippingAncestors[0];\n  const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {\n    const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);\n    accRect.top = max(rect.top, accRect.top);\n    accRect.right = min(rect.right, accRect.right);\n    accRect.bottom = min(rect.bottom, accRect.bottom);\n    accRect.left = max(rect.left, accRect.left);\n    return accRect;\n  }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));\n  return {\n    width: clippingRect.right - clippingRect.left,\n    height: clippingRect.bottom - clippingRect.top,\n    x: clippingRect.left,\n    y: clippingRect.top\n  };\n}\n\nfunction getDimensions(element) {\n  const {\n    width,\n    height\n  } = getCssDimensions(element);\n  return {\n    width,\n    height\n  };\n}\n\nfunction getRectRelativeToOffsetParent(element, offsetParent, strategy) {\n  const isOffsetParentAnElement = isHTMLElement(offsetParent);\n  const documentElement = getDocumentElement(offsetParent);\n  const isFixed = strategy === 'fixed';\n  const rect = getBoundingClientRect(element, true, isFixed, offsetParent);\n  let scroll = {\n    scrollLeft: 0,\n    scrollTop: 0\n  };\n  const offsets = createCoords(0);\n  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n    if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n      scroll = getNodeScroll(offsetParent);\n    }\n    if (isOffsetParentAnElement) {\n      const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);\n      offsets.x = offsetRect.x + offsetParent.clientLeft;\n      offsets.y = offsetRect.y + offsetParent.clientTop;\n    } else if (documentElement) {\n      offsets.x = getWindowScrollBarX(documentElement);\n    }\n  }\n  const x = rect.left + scroll.scrollLeft - offsets.x;\n  const y = rect.top + scroll.scrollTop - offsets.y;\n  return {\n    x,\n    y,\n    width: rect.width,\n    height: rect.height\n  };\n}\n\nfunction isStaticPositioned(element) {\n  return getComputedStyle(element).position === 'static';\n}\n\nfunction getTrueOffsetParent(element, polyfill) {\n  if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {\n    return null;\n  }\n  if (polyfill) {\n    return polyfill(element);\n  }\n  return element.offsetParent;\n}\n\n// Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\nfunction getOffsetParent(element, polyfill) {\n  const win = getWindow(element);\n  if (isTopLayer(element)) {\n    return win;\n  }\n  if (!isHTMLElement(element)) {\n    let svgOffsetParent = getParentNode(element);\n    while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {\n      if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {\n        return svgOffsetParent;\n      }\n      svgOffsetParent = getParentNode(svgOffsetParent);\n    }\n    return win;\n  }\n  let offsetParent = getTrueOffsetParent(element, polyfill);\n  while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {\n    offsetParent = getTrueOffsetParent(offsetParent, polyfill);\n  }\n  if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {\n    return win;\n  }\n  return offsetParent || getContainingBlock(element) || win;\n}\n\nconst getElementRects = async function (data) {\n  const getOffsetParentFn = this.getOffsetParent || getOffsetParent;\n  const getDimensionsFn = this.getDimensions;\n  const floatingDimensions = await getDimensionsFn(data.floating);\n  return {\n    reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),\n    floating: {\n      x: 0,\n      y: 0,\n      width: floatingDimensions.width,\n      height: floatingDimensions.height\n    }\n  };\n};\n\nfunction isRTL(element) {\n  return getComputedStyle(element).direction === 'rtl';\n}\n\nconst platform = {\n  convertOffsetParentRelativeRectToViewportRelativeRect,\n  getDocumentElement,\n  getClippingRect,\n  getOffsetParent,\n  getElementRects,\n  getClientRects,\n  getDimensions,\n  getScale,\n  isElement,\n  isRTL\n};\n\n// https://samthor.au/2021/observing-dom/\nfunction observeMove(element, onMove) {\n  let io = null;\n  let timeoutId;\n  const root = getDocumentElement(element);\n  function cleanup() {\n    var _io;\n    clearTimeout(timeoutId);\n    (_io = io) == null || _io.disconnect();\n    io = null;\n  }\n  function refresh(skip, threshold) {\n    if (skip === void 0) {\n      skip = false;\n    }\n    if (threshold === void 0) {\n      threshold = 1;\n    }\n    cleanup();\n    const {\n      left,\n      top,\n      width,\n      height\n    } = element.getBoundingClientRect();\n    if (!skip) {\n      onMove();\n    }\n    if (!width || !height) {\n      return;\n    }\n    const insetTop = floor(top);\n    const insetRight = floor(root.clientWidth - (left + width));\n    const insetBottom = floor(root.clientHeight - (top + height));\n    const insetLeft = floor(left);\n    const rootMargin = -insetTop + \"px \" + -insetRight + \"px \" + -insetBottom + \"px \" + -insetLeft + \"px\";\n    const options = {\n      rootMargin,\n      threshold: max(0, min(1, threshold)) || 1\n    };\n    let isFirstUpdate = true;\n    function handleObserve(entries) {\n      const ratio = entries[0].intersectionRatio;\n      if (ratio !== threshold) {\n        if (!isFirstUpdate) {\n          return refresh();\n        }\n        if (!ratio) {\n          // If the reference is clipped, the ratio is 0. Throttle the refresh\n          // to prevent an infinite loop of updates.\n          timeoutId = setTimeout(() => {\n            refresh(false, 1e-7);\n          }, 1000);\n        } else {\n          refresh(false, ratio);\n        }\n      }\n      isFirstUpdate = false;\n    }\n\n    // Older browsers don't support a `document` as the root and will throw an\n    // error.\n    try {\n      io = new IntersectionObserver(handleObserve, {\n        ...options,\n        // Handle <iframe>s\n        root: root.ownerDocument\n      });\n    } catch (e) {\n      io = new IntersectionObserver(handleObserve, options);\n    }\n    io.observe(element);\n  }\n  refresh(true);\n  return cleanup;\n}\n\n/**\n * Automatically updates the position of the floating element when necessary.\n * Should only be called when the floating element is mounted on the DOM or\n * visible on the screen.\n * @returns cleanup function that should be invoked when the floating element is\n * removed from the DOM or hidden from the screen.\n * @see https://floating-ui.com/docs/autoUpdate\n */\nfunction autoUpdate(reference, floating, update, options) {\n  if (options === void 0) {\n    options = {};\n  }\n  const {\n    ancestorScroll = true,\n    ancestorResize = true,\n    elementResize = typeof ResizeObserver === 'function',\n    layoutShift = typeof IntersectionObserver === 'function',\n    animationFrame = false\n  } = options;\n  const referenceEl = unwrapElement(reference);\n  const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];\n  ancestors.forEach(ancestor => {\n    ancestorScroll && ancestor.addEventListener('scroll', update, {\n      passive: true\n    });\n    ancestorResize && ancestor.addEventListener('resize', update);\n  });\n  const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;\n  let reobserveFrame = -1;\n  let resizeObserver = null;\n  if (elementResize) {\n    resizeObserver = new ResizeObserver(_ref => {\n      let [firstEntry] = _ref;\n      if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {\n        // Prevent update loops when using the `size` middleware.\n        // https://github.com/floating-ui/floating-ui/issues/1740\n        resizeObserver.unobserve(floating);\n        cancelAnimationFrame(reobserveFrame);\n        reobserveFrame = requestAnimationFrame(() => {\n          var _resizeObserver;\n          (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);\n        });\n      }\n      update();\n    });\n    if (referenceEl && !animationFrame) {\n      resizeObserver.observe(referenceEl);\n    }\n    resizeObserver.observe(floating);\n  }\n  let frameId;\n  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;\n  if (animationFrame) {\n    frameLoop();\n  }\n  function frameLoop() {\n    const nextRefRect = getBoundingClientRect(reference);\n    if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {\n      update();\n    }\n    prevRefRect = nextRefRect;\n    frameId = requestAnimationFrame(frameLoop);\n  }\n  update();\n  return () => {\n    var _resizeObserver2;\n    ancestors.forEach(ancestor => {\n      ancestorScroll && ancestor.removeEventListener('scroll', update);\n      ancestorResize && ancestor.removeEventListener('resize', update);\n    });\n    cleanupIo == null || cleanupIo();\n    (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();\n    resizeObserver = null;\n    if (animationFrame) {\n      cancelAnimationFrame(frameId);\n    }\n  };\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nconst detectOverflow = detectOverflow$1;\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = offset$1;\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = autoPlacement$1;\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = shift$1;\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = flip$1;\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = size$1;\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = hide$1;\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = arrow$1;\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = inline$1;\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = limitShift$1;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n */\nconst computePosition = (reference, floating, options) => {\n  // This caches the expensive `getClippingElementAncestors` function so that\n  // multiple lifecycle resets re-use the same result. It only lives for a\n  // single call. If other functions become expensive, we can add them as well.\n  const cache = new Map();\n  const mergedOptions = {\n    platform,\n    ...options\n  };\n  const platformWithCache = {\n    ...mergedOptions.platform,\n    _c: cache\n  };\n  return computePosition$1(reference, floating, {\n    ...mergedOptions,\n    platform: platformWithCache\n  });\n};\n\nexport { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, platform, shift, size };\n","import { computePosition, autoPlacement, arrow, offset, inline, shift } from '@floating-ui/dom'\nimport '../style/popup.less'\n\nlet popup, arrowElement\n\nconst withPx = ( value ) => {\n\treturn value ? ( value + 'px' ) : value\n}\n\nconst createPopup = ( container, win = window ) => {\n\tif ( !popup ) {\n\t\tpopup = win.document.createElement( 'div' )\n\t\tpopup.classList.add( 'wp-popup' )\n\t\tpopup.style.visibility = 'hidden'\n\t\tcontainer.appendChild( popup )\n\n\t\tarrowElement = win.document.createElement( 'div' )\n\t\tarrowElement.classList.add( 'wp-popup-arrow' )\n\t}\n\n\tconst popupEvents = {/* onShow, onHide */}\n\n\tconst hide = () => {\n\t\tif ( popupEvents.onHide ) {\n\t\t\tpopupEvents.onHide( popup )\n\t\t}\n\t\tpopup.style.visibility = 'hidden'\n\t\tpopup.currentTargetElement = null\n\t}\n\n\tconst show = ( content, nextTo, { x: mouseX, y: mouseY } ) => {\n\t\tpopup.innerHTML = content + arrowElement.outerHTML\n\n\t\t// capture the arrow element\n\t\tconst arrowEl = popup.querySelector( '.wp-popup-arrow' )\n\n\t\tcomputePosition( nextTo, popup, {\n\t\t\tmiddleware: [\n\t\t\t\tinline( { x: mouseX, y: mouseY } ),\n\t\t\t\tshift(),\n\t\t\t\tautoPlacement( {\n\t\t\t\t\tallowedPlacements: [ 'top', 'bottom' ]\n\t\t\t\t} ),\n\t\t\t\toffset( 10 ),\n\t\t\t\tarrow( { element: arrowEl } )\n\t\t\t]\n\t\t} ).then( ( { x, y, middlewareData, placement } ) => {\n\t\t\t// popup\n\t\t\tpopup.style.top = withPx( y )\n\t\t\tpopup.style.left = withPx( x )\n\n\t\t\t// arrow\n\t\t\tif ( middlewareData.arrow && arrowEl ) {\n\t\t\t\tconst { x: arrowX, y: arrowY } = middlewareData.arrow\n\n\t\t\t\tarrowEl.style.left = arrowX !== null ? withPx( arrowX ) : ''\n\t\t\t\tarrowEl.style.top = arrowY !== null ? withPx( arrowY ) : ''\n\n\t\t\t\tif ( placement === 'left' ) {\n\t\t\t\t\tarrowEl.style.right = '-8px'\n\t\t\t\t\tarrowEl.style.transform = 'rotate(90deg)'\n\t\t\t\t} else if ( placement === 'right' ) {\n\t\t\t\t\tarrowEl.style.left = '-8px'\n\t\t\t\t\tarrowEl.style.transform = 'rotate(-90deg)'\n\t\t\t\t} else if ( placement === 'top' ) {\n\t\t\t\t\tarrowEl.style.bottom = '-8px'\n\t\t\t\t\tarrowEl.style.transform = 'rotate(180deg)'\n\t\t\t\t} else if ( placement === 'bottom' ) {\n\t\t\t\t\tarrowEl.style.top = '-8px'\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpopup.currentTargetElement = nextTo\n\t\t\tpopup.style.visibility = 'visible'\n\n\t\t\tif ( popupEvents.onShow ) {\n\t\t\t\tpopupEvents.onShow( popup )\n\t\t\t}\n\t\t} )\n\t}\n\n\tconst subscribe = ( events = {} ) => {\n\t\tif ( events.onShow ) {\n\t\t\tpopupEvents.onShow = events.onShow\n\t\t}\n\t\tif ( events.onHide ) {\n\t\t\tpopupEvents.onHide = events.onHide\n\t\t}\n\t}\n\n\treturn { show, hide, subscribe, element: popup }\n}\n\nexport { createPopup }\n","import '../style/popup.less'\n\nlet popup\nlet originalOverflow\n\nconst addBackgroundScreen = ( document ) => {\n\tif ( !document.querySelector( '.wp-dark-screen' ) ) {\n\t\tconst screen = document.createElement( 'div' )\n\t\tscreen.classList.add( 'wp-dark-screen' )\n\t\tdocument.body.appendChild( screen )\n\t\toriginalOverflow = document.body.style.overflow\n\t\tdocument.body.style.overflow = 'hidden'\n\t}\n}\n\nconst removeBackgroundScreen = ( document ) => {\n\tconst screen = document.getElementsByClassName( 'wp-dark-screen' )\n\tdocument.body.removeChild( screen[ 0 ] )\n\tdocument.body.style.overflow = originalOverflow\n}\n\nconst createTouchPopup = ( container, win = window ) => {\n\tif ( !popup ) {\n\t\tpopup = win.document.createElement( 'div' )\n\t\tpopup.classList.add( 'wp-touch-popup' )\n\t\tpopup.style.visibility = 'hidden'\n\t\tcontainer.appendChild( popup )\n\t}\n\n\tconst popupEvents = {/* onShow, onHide */}\n\n\tconst show = ( content ) => {\n\t\tpopup.innerHTML = content\n\t\tpopup.style.visibility = 'visible'\n\t\taddBackgroundScreen( win.document )\n\n\t\tif ( popupEvents.onShow ) {\n\t\t\tpopupEvents.onShow( popup )\n\t\t}\n\t}\n\n\tconst hide = () => {\n\t\tif ( popupEvents.onHide ) {\n\t\t\tpopupEvents.onHide( popup )\n\t\t}\n\n\t\tpopup.style.visibility = 'hidden'\n\t\tremoveBackgroundScreen( win.document )\n\t}\n\n\tconst subscribe = ( events = {} ) => {\n\t\tif ( events.onShow ) {\n\t\t\tpopupEvents.onShow = events.onShow\n\t\t}\n\t\tif ( events.onHide ) {\n\t\t\tpopupEvents.onHide = events.onHide\n\t\t}\n\t}\n\n\treturn { show, hide, subscribe, element: popup }\n}\n\nexport { createTouchPopup }\n","const getGalleryRow = ( mediaItems ) => {\n\tconst galleryRow = document.createElement( 'div' )\n\tgalleryRow.classList.add( 'wikipediapreview-gallery-row' )\n\n\tif ( mediaItems ) {\n\t\tmediaItems.forEach( ( item ) => {\n\t\t\tconst image = document.createElement( 'div' )\n\n\t\t\timage.classList.add( 'wikipediapreview-gallery-image' )\n\t\t\timage.style.backgroundImage = `url(${ item.thumb })`\n\n\t\t\tgalleryRow.appendChild( image )\n\t\t} )\n\t}\n\n\treturn galleryRow.outerHTML\n}\n\nexport const getGallery = ( mediaItems ) => {\n\tif ( mediaItems && mediaItems.length < 3 ) {\n\t\treturn ''\n\t}\n\treturn `<div class=\"wikipediapreview-gallery\">${ getGalleryRow( mediaItems ) }</div>`\n}\n","import { msg } from './i18n'\nimport { buildWikipediaUrl, getLinkIconSvg } from './utils'\nimport { getGallery } from './gallery'\nimport '../style/preview.less'\n\nconst getPreviewHeader = ( lang, imageUrl = '', media = [] ) => {\n\tconst showThumbnail = imageUrl !== '' && media.length > 0 && media.length < 3\n\tconst thumbnail = imageUrl || media[ 0 ] && media[ 0 ].thumb\n\treturn `\n\t\t<div class= \"wikipediapreview-header ${ showThumbnail ? '' : 'wikipediapreview-header-no-thumb' }\">\n\t\t\t${ showThumbnail ? `<div class=\"wikipediapreview-header-image\" style=\"${ `background-image:url('${ thumbnail }');background-size:cover;` }\"></div>` : '' }\n\t\t\t<div class=\"wikipediapreview-header-wordmark wikipediapreview-header-wordmark-${ lang }\"></div>\n\t\t\t<div class=\"wikipediapreview-header-closebtn\"></div>\n\t\t</div>\n`.trim()\n}\n\nconst getPreviewBody = ( type, message, cta ) => {\n\treturn `\n\t\t<div class=\"wikipediapreview-body wikipediapreview-body-${ type }\">\n\t\t\t<div class=\"wikipediapreview-body-message\">\n\t\t\t\t<div class=\"wikipediapreview-body-icon\"></div>\n\t\t\t\t\t${ message }\n\t\t\t</div>\n\t\t\t<div class=\"wikipediapreview-body-action\">\n\t\t\t\t${ cta }\n\t\t\t</div>\n\t\t</div>\n`.trim()\n}\n\nconst getReadOnWikiCta = ( lang, title, isMobile ) => {\n\treturn `<a href=\"${ buildWikipediaUrl( lang, title, isMobile ) }\" target=\"_blank\" class=\"wikipediapreview-footer-link-cta\">${ msg( lang, 'read-on-wiki' ) }</a>`\n}\n\nconst render = (\n\tlang, isMobile, dir, headerContent, bodyContent, prefersColorScheme\n) => {\n\tconst colorScheme = prefersColorScheme === 'detect' ? '' : `wikipediapreview-${ prefersColorScheme }-theme`\n\treturn `\n\t\t<div class=\"wikipediapreview ${ isMobile ? 'mobile' : '' } ${ colorScheme }\" lang=\"${ lang }\" dir=\"${ dir }\">\n\t\t\t${ headerContent }\n\t\t\t${ bodyContent }\n\t\t</div>\n\t`.trim()\n}\n\nconst renderPreview = ( lang, data, isMobile, prefersColorScheme ) => {\n\tconst imageUrl = data.imgUrl,\n\t\tbodyContent = `\n\t\t\t${ getGallery( data.media ) }\n\t\t\t<div class=\"wikipediapreview-body\">\n\t\t\t\t${ data.extractHtml }\n\t\t\t\t<div class=\"wikipediapreview-footer\">\n\t\t\t\t\t<div class=\"wikipediapreview-footer-link\">\n\t\t\t\t\t\t<a href=\"${ buildWikipediaUrl( lang, data.title, isMobile ) }\"\n\t\t\t\t\t\t\tclass=\"wikipediapreview-footer-link-cta\" target=\"_blank\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t${ msg( lang, 'read-more' ) }\n\t\t\t\t\t\t\t${ getLinkIconSvg( data.dir, '#36C' ) }\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"wikipediapreview-scroll-cue\"></div>\n\t\t\t</div>\n\t\t`.trim()\n\n\treturn render(\n\t\tlang,\n\t\tisMobile,\n\t\tdata.dir,\n\t\tgetPreviewHeader( lang, imageUrl, data.media ),\n\t\tbodyContent,\n\t\tprefersColorScheme\n\t)\n}\n\nconst renderLoading = ( isMobile, lang, dir, prefersColorScheme ) => {\n\tconst bodyContent = `\n\t\t<div class=\"wikipediapreview-body wikipediapreview-body-loading\">\n\t\t\t<div class=\"wikipediapreview-body-loading-line larger\"></div>\n\t\t\t<div class=\"wikipediapreview-body-loading-line medium\"></div>\n\t\t\t<div class=\"wikipediapreview-body-loading-line larger\"></div>\n\t\t\t<div class=\"wikipediapreview-body-loading-line medium\"></div>\n\t\t\t<div class=\"wikipediapreview-body-loading-line smaller\"></div>\n\t\t\t<div class=\"wikipediapreview-body-loading-line larger\"></div>\n\t\t\t<div class=\"wikipediapreview-body-loading-line medium\"></div>\n\t\t\t<div class=\"wikipediapreview-body-loading-line larger\"></div>\n\t\t\t<div class=\"wikipediapreview-body-loading-line medium\"></div>\n\t\t\t<div class=\"wikipediapreview-body-loading-line smaller\"></div>\n\t\t</div>\n\t\t<div class=\"wikipediapreview-footer-loading\"></div>\n\t`.trim()\n\n\treturn render( lang, isMobile, dir, getPreviewHeader( lang ), bodyContent, prefersColorScheme )\n}\n\nconst renderError = ( isMobile, lang, title, dir, prefersColorScheme ) => {\n\tconst message = `<span>${ msg( lang, 'preview-error-message' ) }</span>`\n\tconst cta = getReadOnWikiCta( lang, title, isMobile )\n\n\treturn render( lang, isMobile, dir, getPreviewHeader( lang ), getPreviewBody( 'error', message, cta ), prefersColorScheme )\n}\n\nconst renderDisambiguation = ( isMobile, lang, title, dir, prefersColorScheme ) => {\n\tconst message = `<span>${ msg( lang, 'preview-disambiguation-message', title ) }</span>`\n\tconst cta = getReadOnWikiCta( lang, title, isMobile )\n\n\treturn render( lang, isMobile, dir, getPreviewHeader( lang ), getPreviewBody( 'disambiguation', message, cta ), prefersColorScheme )\n}\n\nconst renderOffline = ( isMobile, lang, dir, prefersColorScheme ) => {\n\tconst message = `<span>${ msg( lang, 'preview-offline-message' ) }</span>`\n\tconst cta = `<a>${ msg( lang, 'preview-offline-cta' ) }</a>`\n\n\treturn render( lang, isMobile, dir, getPreviewHeader( lang ), getPreviewBody( 'offline', message, cta ), prefersColorScheme )\n}\n\nexport { renderPreview, renderLoading, renderError, renderDisambiguation, renderOffline }\n","import { getSections, requestPagePreviewWithMedia } from './api'\nimport { customEvents } from './event'\nimport { createPopup } from './popup'\nimport { createTouchPopup } from './touchPopup'\nimport { renderPreview, renderLoading, renderError, renderDisambiguation, renderOffline } from './preview'\nimport {\n\tgetWikipediaAttrFromUrl, buildWikipediaUrl, getDir, isOnline,\n\tversion, getAnalyticsQueryParam, getElement, isMobile\n} from './utils'\n\nconst invokeCallback = ( events, name, params ) => {\n\tconst callback = events && events[ name ]\n\tif ( callback instanceof Function ) {\n\t\ttry {\n\t\t\tcallback.apply( null, params )\n\t\t} catch ( e ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log( 'Error invoking Wikipedia Preview custom callback', e )\n\t\t}\n\t}\n}\n\n// getPreviewHtml is meant to be used by the Wordpress plugin only\nconst getPreviewHtml = ( title, lang, callback ) => {\n\trequestPagePreviewWithMedia( lang, title, ( data ) => {\n\t\tcallback( renderPreview( lang, data, isMobile ) )\n\t} )\n}\n\nconst forEachRoot = ( rootConfig, callback ) => {\n\tconst roots = []\n\t// rootConfig can be a selector (String)\n\tif (\n\t\ttypeof rootConfig === 'string' ||\n\t\trootConfig instanceof String\n\t) {\n\t\tArray.prototype.forEach.call(\n\t\t\tdocument.querySelectorAll( rootConfig ),\n\t\t\t( node ) => {\n\t\t\t\troots.push( node )\n\t\t\t}\n\t\t)\n\t}\n\n\t// rootConfig can be a node (Document or Element)\n\tif ( rootConfig instanceof Document || rootConfig instanceof Element ) {\n\t\troots.push( rootConfig )\n\t}\n\n\t// rootConfig can be a list of nodes (Element[])\n\tif ( Array.isArray( rootConfig ) ) {\n\t\trootConfig.forEach( ( r ) => {\n\t\t\tif ( r instanceof Element ) {\n\t\t\t\troots.push( r )\n\t\t\t}\n\t\t} )\n\t}\n\n\troots.forEach( ( root ) => callback( root ) )\n}\n\nlet currentPopupId\nlet currentColorScheme\n\nfunction init( {\n\troot = document,\n\tselector = '[data-wikipedia-preview]',\n\tlang = 'en',\n\tdetectLinks = false,\n\tpopupContainer = document.body,\n\tevents = {},\n\tdebug = false,\n\tprefersColorScheme = 'detect'\n} ) {\n\tpopupContainer = getElement( popupContainer ) || document.body\n\tconst globalLang = lang\n\tconst popup = isMobile ?\n\t\tcreateTouchPopup( popupContainer ) :\n\t\tcreatePopup( popupContainer )\n\tconst popupEvents = customEvents( popup )\n\tconst last = {}\n\tconst foundSelectorLinks = []\n\tconst foundDetectLinks = []\n\tcurrentColorScheme = prefersColorScheme\n\n\tconst showPopup = ( e, refresh = false ) => {\n\t\te.preventDefault()\n\t\te.stopPropagation()\n\n\t\tconst popupId = Date.now()\n\t\tconst { currentTarget } = refresh ? last : e\n\t\tconst title = refresh ? last.title : decodeURIComponent( currentTarget.getAttribute( 'data-wp-title' ) || currentTarget.textContent )\n\t\tconst localLang = refresh ? last.lang : currentTarget.getAttribute( 'data-wp-lang' ) || globalLang\n\t\tconst pointerPosition = refresh ? last.pointerPosition : { x: e.clientX, y: e.clientY }\n\t\tconst dir = getDir( localLang )\n\n\t\tif ( popup.element.currentTargetElement === currentTarget && !refresh ) {\n\t\t\t// Hovering over the same link and the popup is already open\n\t\t\treturn\n\t\t}\n\n\t\tcurrentPopupId = popupId\n\n\t\tif ( popup.element.style.visibility === 'visible' ) {\n\t\t\tpopup.hide()\n\t\t}\n\n\t\tpopup.loading = true\n\t\tpopup.dir = dir\n\t\tpopup.show(\n\t\t\trenderLoading( isMobile, localLang, dir, currentColorScheme ),\n\t\t\tcurrentTarget,\n\t\t\tpointerPosition\n\t\t)\n\n\t\trequestPagePreviewWithMedia( localLang, title, ( data ) => {\n\t\t\tif ( popupId !== currentPopupId ) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif ( popup.loading ) {\n\t\t\t\tpopup.loading = false\n\t\t\t\tif ( data.extractHtml ) {\n\t\t\t\t\tpopup.lang = localLang\n\t\t\t\t\tpopup.title = title\n\t\t\t\t\tif ( data.type === 'standard' ) {\n\t\t\t\t\t\tpopup.show(\n\t\t\t\t\t\t\trenderPreview( localLang, data, isMobile, currentColorScheme ),\n\t\t\t\t\t\t\tcurrentTarget,\n\t\t\t\t\t\t\tpointerPosition\n\t\t\t\t\t\t)\n\t\t\t\t\t\tpopup.media = data.media\n\t\t\t\t\t\tinvokeCallback( events, 'onShow', [ title, localLang, 'standard' ] )\n\t\t\t\t\t} else if ( data.type === 'disambiguation' ) {\n\t\t\t\t\t\tconst content = data.extractHtml ?\n\t\t\t\t\t\t\trenderPreview( localLang, data, isMobile, currentColorScheme ) :\n\t\t\t\t\t\t\t// fallback message when no extract is found on disambiguation page\n\t\t\t\t\t\t\trenderDisambiguation(\n\t\t\t\t\t\t\t\tisMobile,\n\t\t\t\t\t\t\t\tlocalLang,\n\t\t\t\t\t\t\t\tdata.title,\n\t\t\t\t\t\t\t\tdata.dir,\n\t\t\t\t\t\t\t\tcurrentColorScheme\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\tpopup.show(\n\t\t\t\t\t\t\tcontent,\n\t\t\t\t\t\t\tcurrentTarget,\n\t\t\t\t\t\t\tpointerPosition\n\t\t\t\t\t\t)\n\t\t\t\t\t\tinvokeCallback( events, 'onShow', [ title, localLang, 'disambiguation' ] )\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif ( isOnline() ) {\n\t\t\t\t\t\tpopup.show(\n\t\t\t\t\t\t\trenderError( isMobile, localLang, title, dir, currentColorScheme ),\n\t\t\t\t\t\t\tcurrentTarget,\n\t\t\t\t\t\t\tpointerPosition\n\t\t\t\t\t\t)\n\t\t\t\t\t\tinvokeCallback( events, 'onShow', [ title, localLang, 'error' ] )\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpopup.show(\n\t\t\t\t\t\t\trenderOffline( isMobile, localLang, dir, currentColorScheme ),\n\t\t\t\t\t\t\tcurrentTarget,\n\t\t\t\t\t\t\tpointerPosition\n\t\t\t\t\t\t)\n\t\t\t\t\t\tinvokeCallback( events, 'onShow', [ title, localLang, 'offline' ] )\n\t\t\t\t\t\tconst again = document.querySelector( '.wikipediapreview-body-action' )\n\t\t\t\t\t\tlast.lang = localLang\n\t\t\t\t\t\tlast.title = title\n\t\t\t\t\t\tlast.pointerPosition = pointerPosition\n\t\t\t\t\t\tlast.target = currentTarget\n\t\t\t\t\t\tagain.addEventListener( 'click', ( event ) => {\n\t\t\t\t\t\t\tshowPopup( event, true )\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst readOnWikiCta = popup.element.querySelector( '.wikipediapreview-footer-cta-readonwiki, .wikipediapreview-cta-readonwiki' )\n\t\t\t\tif ( readOnWikiCta ) {\n\t\t\t\t\treadOnWikiCta.addEventListener( 'click', () => {\n\t\t\t\t\t\tinvokeCallback( events, 'onWikiRead', [ title, localLang ] )\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t\t// add wprov to target's href\n\t\t\t\tif ( currentTarget.tagName === 'A' ) {\n\t\t\t\t\tconst param = getAnalyticsQueryParam().split( '=' )\n\t\t\t\t\tconst url = new URL( currentTarget.href )\n\t\t\t\t\turl.searchParams.set( param[ 0 ], param[ 1 ] )\n\t\t\t\t\tcurrentTarget.href = url.href\n\t\t\t\t}\n\t\t\t}\n\t\t} )\n\t}\n\n\tconst onPointerEnter = ( pointerEvent ) => {\n\t\tshowPopup( pointerEvent )\n\t}\n\n\tconst registerPreviewEvents = ( node ) => {\n\t\tnode.addEventListener( 'pointerenter', onPointerEnter )\n\t}\n\n\tconst preventTapFromNavigatingLink = ( node ) => {\n\t\t// The click event still receives a MouseEvent instead of the newer PointerEvent\n\t\t// in some browsers so we have to grab the pointerType from the preceding pointerdown event.\n\t\tlet currentPointerType = null\n\t\tnode.addEventListener( 'pointerdown', ( e ) => {\n\t\t\tcurrentPointerType = e.pointerType\n\t\t} )\n\t\tnode.addEventListener( 'click', ( e ) => {\n\t\t\tif ( currentPointerType === 'touch' ) {\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t}\n\t\t} )\n\t}\n\n\tforEachRoot( root, ( localRoot ) => {\n\t\tArray.prototype.forEach.call(\n\t\t\tlocalRoot.querySelectorAll( selector ),\n\t\t\t( node ) => {\n\t\t\t\tregisterPreviewEvents( node )\n\t\t\t\tfoundSelectorLinks.push( {\n\t\t\t\t\ttext: node.textContent,\n\t\t\t\t\ttitle: node.getAttribute( 'data-wp-title' ) || node.textContent,\n\t\t\t\t\tlang: node.getAttribute( 'data-wp-lang' ) || globalLang\n\t\t\t\t} )\n\t\t\t}\n\t\t)\n\t} )\n\n\tif ( detectLinks ) {\n\t\tforEachRoot( root, ( localRoot ) => {\n\t\t\tArray.prototype.forEach.call(\n\t\t\t\tlocalRoot.querySelectorAll( 'a' ),\n\t\t\t\t( node ) => {\n\t\t\t\t\tconst matches = getWikipediaAttrFromUrl( node.getAttribute( 'href' ) )\n\t\t\t\t\tif ( matches ) {\n\t\t\t\t\t\tnode.setAttribute( 'data-wp-title', matches.title )\n\t\t\t\t\t\tnode.setAttribute( 'data-wp-lang', matches.lang )\n\t\t\t\t\t\tregisterPreviewEvents( node )\n\t\t\t\t\t\tpreventTapFromNavigatingLink( node )\n\n\t\t\t\t\t\tfoundDetectLinks.push( {\n\t\t\t\t\t\t\ttext: node.textContent,\n\t\t\t\t\t\t\ttitle: matches.title,\n\t\t\t\t\t\t\tlang: matches.lang\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t)\n\t\t} )\n\t}\n\n\tpopup.subscribe( popupEvents )\n\n\tif ( debug ) {\n\t\t/* eslint-disable no-console */\n\t\tconsole.group( 'Wikipedia Preview [debug mode]' )\n\t\tconsole.group( `Searching for \"${ selector }\" inside ${ root }, Total links found: ${ foundSelectorLinks.length }` )\n\t\tfoundSelectorLinks.forEach( ( link, index ) => {\n\t\t\tconsole.log( index + 1, `${ link.text } -> ${ decodeURI( buildWikipediaUrl( link.lang, link.title, isMobile, false ) ) }` )\n\t\t} )\n\t\tconsole.groupEnd()\n\t\tif ( detectLinks ) {\n\t\t\tconsole.group( `Searching for links to Wikipedia, Total links found: ${ foundDetectLinks.length }` )\n\t\t\tfoundDetectLinks.forEach( ( link, index ) => {\n\t\t\t\tconsole.log( index + 1, `${ link.text } -> ${ decodeURI( buildWikipediaUrl( link.lang, link.title, isMobile, false ) ) }` )\n\t\t\t} )\n\t\t\tconsole.groupEnd()\n\t\t}\n\t\tconsole.groupEnd()\n\t\t/* eslint-enable no-console */\n\t}\n\n}\n\nversion()\n\nexport default { init, version, getPreviewHtml, getSections }\n"],"names":["request","url","callback","parseJson","xhr","content","dataCache","cachedRequest","transformFn","r","data","err","entries","setPrototypeOf","isFrozen","getPrototypeOf","getOwnPropertyDescriptor","freeze","seal","create","apply","construct","x","fun","thisValue","args","Func","arrayForEach","unapply","arrayLastIndexOf","arrayPop","arrayPush","arraySplice","stringToLowerCase","stringToString","stringMatch","stringReplace","stringIndexOf","stringTrim","objectHasOwnProperty","regExpTest","typeErrorCreate","unconstruct","func","thisArg","_len","_key","_len2","_key2","addToSet","set","array","transformCaseFunc","l","element","lcElement","cleanArray","index","clone","object","newObject","property","value","lookupGetter","prop","desc","fallbackValue","html$1","svg$1","svgFilters","svgDisallowed","mathMl$1","mathMlDisallowed","text","html","svg","mathMl","xml","MUSTACHE_EXPR","ERB_EXPR","TMPLIT_EXPR","DATA_ATTR","ARIA_ATTR","IS_ALLOWED_URI","IS_SCRIPT_OR_DATA","ATTR_WHITESPACE","DOCTYPE_NAME","CUSTOM_ELEMENT","EXPRESSIONS","NODE_TYPE","getGlobal","_createTrustedTypesPolicy","trustedTypes","purifyHostElement","suffix","ATTR_NAME","policyName","scriptUrl","_","_createHooksMap","createDOMPurify","window","DOMPurify","root","document","originalDocument","currentScript","DocumentFragment","HTMLTemplateElement","Node","Element","NodeFilter","NamedNodeMap","HTMLFormElement","DOMParser","ElementPrototype","cloneNode","remove","getNextSibling","getChildNodes","getParentNode","template","trustedTypesPolicy","emptyHTML","implementation","createNodeIterator","createDocumentFragment","getElementsByTagName","importNode","hooks","IS_ALLOWED_URI$1","ALLOWED_TAGS","DEFAULT_ALLOWED_TAGS","ALLOWED_ATTR","DEFAULT_ALLOWED_ATTR","CUSTOM_ELEMENT_HANDLING","FORBID_TAGS","FORBID_ATTR","ALLOW_ARIA_ATTR","ALLOW_DATA_ATTR","ALLOW_UNKNOWN_PROTOCOLS","ALLOW_SELF_CLOSE_IN_ATTR","SAFE_FOR_TEMPLATES","SAFE_FOR_XML","WHOLE_DOCUMENT","SET_CONFIG","FORCE_BODY","RETURN_DOM","RETURN_DOM_FRAGMENT","RETURN_TRUSTED_TYPE","SANITIZE_DOM","SANITIZE_NAMED_PROPS","SANITIZE_NAMED_PROPS_PREFIX","KEEP_CONTENT","IN_PLACE","USE_PROFILES","FORBID_CONTENTS","DEFAULT_FORBID_CONTENTS","DATA_URI_TAGS","DEFAULT_DATA_URI_TAGS","URI_SAFE_ATTRIBUTES","DEFAULT_URI_SAFE_ATTRIBUTES","MATHML_NAMESPACE","SVG_NAMESPACE","HTML_NAMESPACE","NAMESPACE","IS_EMPTY_INPUT","ALLOWED_NAMESPACES","DEFAULT_ALLOWED_NAMESPACES","MATHML_TEXT_INTEGRATION_POINTS","HTML_INTEGRATION_POINTS","COMMON_SVG_AND_HTML_ELEMENTS","PARSER_MEDIA_TYPE","SUPPORTED_PARSER_MEDIA_TYPES","DEFAULT_PARSER_MEDIA_TYPE","CONFIG","formElement","isRegexOrFunction","testValue","_parseConfig","cfg","ALL_SVG_TAGS","ALL_MATHML_TAGS","_checkValidNamespace","parent","tagName","parentTagName","_forceRemove","node","_removeAttribute","name","_initDocument","dirty","doc","leadingWhitespace","matches","dirtyPayload","body","_createNodeIterator","_isClobbered","_isNode","_executeHooks","currentNode","hook","_sanitizeElements","_isBasicCustomElement","parentNode","childNodes","childCount","i","childClone","expr","_isValidAttribute","lcTag","lcName","_sanitizeAttributes","attributes","hookEvent","attr","namespaceURI","attrValue","initValue","_sanitizeShadowDOM","fragment","shadowNode","shadowIterator","importedNode","returnNode","nodeIterator","serializedHTML","tag","entryPoint","hookFunction","purify","decodeUri","uri","currentUri","decoded","getWikipediaAttrFromUrl","regexList","isMobile","isTouch","isOnline","getDir","lang","defaultParams","buildMwApiUrl","params","__spreadValues","p","convertUrlToMobile","subDomain","strip","span","sanitizeHTML","getDeviceSize","getAnalyticsQueryParam","buildWikipediaUrl","title","touch","analytics","version","logError","getElement","nodeOrSelector","getLinkIconSvg","dir","color","isVerticallyScrollable","messages","en","msg","key","__matchRequireRuntime0__","error","message","param","titleWithoutSection","requestMwExtract","result","page","requestPcsSummary","simplify","selector","n","a","findLeadImageThumbnail","leadImageElement","parts","filename","img","getSections","leadImageUrl","sectionElement","sectionTitleElement","sectionId","level","imageElement","imgUrl","extractHtml","s","extractSectionSummary","info","section","requestPagePreview","titlePart","sectionPart","requestPageMedia","mediaListData","mediaArray","item","thumbnail","media","requestPagePreviewWithMedia","results","previewData","__spreadProps","mediaData","requestPageMediaInfo","mediaInfoData","imageInfo","Artist","ImageDescription","LicenseShortName","author","description","imageUrl","scaleMin","scaleMax","getClientWidth","getClientHeight","temp","evCache","prevDiff","zoomedIn","grabImageFromEvent","grabScaleFromTransform","transform","grabTranslateFromTransform","coordinates","isInvalidEvent","prefixClassname","invalidElement","className","isImgZoomedIn","isImgLandscape","image","isImgSmallerThanViewport","getFingerAmount","getTransformOrigin","e","setBestVertical","setTransformOrigin","currentTransformOrigin","removeEvent","clearZoom","toggleZoom","zoomStart","imageRect","imageStyle","zoomMove","delta","buffer","scale","translate3d","deltaX","deltaY","curDiff","zoomScroll","renderNext","items","current","leftLimit","rightLimit","topLimit","bottomLimit","offset","translateX","translateY","scrollingUp","scrollingLeft","isImageWithinBoundaries","horizontallyBound","verticallyBound","updateTempValues","slideToNextOrPrevious","next","zoomEnd","slideStart","container","marginLR","containerStyle","slideMove","slideEnd","diff","duration","eventListenerStack","addEventListener","target","type","listener","options","clearAllEventListener","eventListener","gallery","parentContainer","renderImageSlider","givenLang","givenDir","images","selectedImage","imageListHtml","renderImageAttribution","mediaInfo","link","handleCaptionExpansion","forceClose","caption","expandCue","expanded","bindImageEvent","refresh","loading","errorElement","captionElement","checkImageRender","attribution","textElement","timeoutId","refreshElement","errorElementText","showImageAndInfo","refreshImage","atrributionElement","slider","nextButton","previousButton","currentImage","counterContainer","renderPrevious","applyGestureEvent","toggleFocusMode","onShowFn","sliderContainer","tapped","windowResize","el","windowResizeTimeout","renderFullScreenGallery","hideFullscreenGallery","fullscreenGallery","showFullscreenGallery","mediaItems","selectedThumb","sliderOnShowFn","customEvents","popup","timeoutStack","addTimeout","timeout","id","clearAllTimeout","onMouseLeave","toElement","previewElement","persistPopup","previewBody","selected","darkScreen","sides","alignments","placements","acc","side","min","max","round","createCoords","v","oppositeSideMap","oppositeAlignmentMap","clamp","start","end","evaluate","getSide","placement","getAlignment","getOppositeAxis","axis","getAxisLength","getSideAxis","getAlignmentAxis","getAlignmentSides","rects","rtl","alignment","alignmentAxis","length","mainAlignmentSide","getOppositePlacement","getOppositeAlignmentPlacement","expandPaddingObject","padding","getPaddingObject","rectToClientRect","rect","y","width","height","computeCoordsFromPlacement","_ref","reference","floating","sideAxis","alignLength","isVertical","commonX","commonY","commonAlign","coords","computePosition","config","__async","strategy","middleware","platform","validMiddleware","statefulPlacement","middlewareData","resetCount","fn","nextX","nextY","reset","detectOverflow","state","_await$platform$isEle","elements","boundary","rootBoundary","elementContext","altBoundary","paddingObject","clippingClientRect","offsetParent","offsetScale","elementClientRect","arrow","arrowDimensions","isYAxis","minProp","maxProp","clientProp","endDiff","startDiff","arrowOffsetParent","clientSize","centerToReference","largestPossiblePadding","minPadding","maxPadding","min$1","center","shouldAddOffset","alignmentOffset","getPlacementList","autoAlignment","allowedPlacements","autoPlacement","_middlewareData$autoP","_middlewareData$autoP2","_placementsThatFitOnE","_a","crossAxis","detectOverflowOptions","__objRest","placements$1","overflow","currentIndex","currentPlacement","alignmentSides","currentOverflows","allOverflows","nextPlacement","placementsSortedByMostSpace","d","b","resetPlacement","getBoundingRect","minX","minY","maxX","maxY","getRectsByLine","sortedRects","groups","prevRect","inline","nativeClientRects","clientRects","fallback","getBoundingClientRect","firstRect","lastRect","isTop","top","bottom","left","right","isLeftSide","maxRight","minLeft","measureRects","resetRects","convertValueToCoords","mainAxisMulti","crossAxisMulti","rawValue","mainAxis","_middlewareData$offse","_middlewareData$arrow","diffCoords","shift","checkMainAxis","checkCrossAxis","limiter","mainAxisCoord","crossAxisCoord","minSide","maxSide","limitedCoords","hasWindow","getNodeName","isNode","getWindow","_node$ownerDocument","getDocumentElement","isElement","isHTMLElement","isShadowRoot","isOverflowElement","overflowX","overflowY","display","getComputedStyle","isTableElement","isTopLayer","isContainingBlock","elementOrCss","webkit","isWebKit","css","getContainingBlock","isLastTraversableNode","getNodeScroll","getNearestOverflowAncestor","getOverflowAncestors","list","traverseIframes","_node$ownerDocument2","scrollableAncestor","isBody","win","getFrameElement","getCssDimensions","hasOffset","offsetWidth","offsetHeight","shouldFallback","unwrapElement","getScale","domElement","$","noOffsets","getVisualOffsets","shouldAddVisualOffsets","isFixed","floatingOffsetParent","includeScale","isFixedStrategy","clientRect","visualOffsets","offsetWin","currentWin","currentIFrame","iframeScale","iframeRect","topLayerSelectors","convertOffsetParentRelativeRectToViewportRelativeRect","documentElement","topLayer","scroll","offsets","isOffsetParentAnElement","offsetRect","getClientRects","getWindowScrollBarX","getDocumentRect","getViewportRect","visualViewport","visualViewportBased","getInnerBoundingClientRect","getClientRectFromClippingAncestor","clippingAncestor","hasFixedPositionAncestor","stopNode","getClippingElementAncestors","cache","cachedResult","currentContainingBlockComputedStyle","elementIsFixed","computedStyle","currentNodeIsContaining","ancestor","getClippingRect","clippingAncestors","firstClippingAncestor","clippingRect","accRect","getDimensions","getRectRelativeToOffsetParent","isStaticPositioned","getTrueOffsetParent","polyfill","getOffsetParent","svgOffsetParent","getElementRects","getOffsetParentFn","getDimensionsFn","floatingDimensions","isRTL","offset$1","autoPlacement$1","shift$1","arrow$1","inline$1","mergedOptions","platformWithCache","computePosition$1","arrowElement","withPx","createPopup","popupEvents","nextTo","mouseX","mouseY","arrowEl","arrowX","arrowY","events","originalOverflow","addBackgroundScreen","screen","removeBackgroundScreen","createTouchPopup","getGalleryRow","galleryRow","getGallery","getPreviewHeader","showThumbnail","getPreviewBody","cta","getReadOnWikiCta","render","headerContent","bodyContent","prefersColorScheme","colorScheme","renderPreview","renderLoading","renderError","renderDisambiguation","renderOffline","invokeCallback","getPreviewHtml","forEachRoot","rootConfig","roots","currentPopupId","currentColorScheme","init","detectLinks","popupContainer","debug","globalLang","last","foundSelectorLinks","foundDetectLinks","showPopup","popupId","currentTarget","localLang","pointerPosition","again","event","readOnWikiCta","onPointerEnter","pointerEvent","registerPreviewEvents","preventTapFromNavigatingLink","currentPointerType","localRoot"],"mappings":";2CAAA,MAAMA,EAAU,CAAEC,EAAKC,EAAUC,EAAY,KAAU,CACtD,MAAMC,EAAM,IAAI,eAChBA,EAAI,KAAM,MAAOH,CAAG,EACpBG,EAAI,KAAI,EACRA,EAAI,iBAAkB,OAAQ,IAAM,CACnC,MAAMC,EAAUF,EACf,KAAK,MAAOC,EAAI,YAAc,EAC9BA,EAAI,aACLF,EAAUG,CAAO,CACjB,CAAA,EACDD,EAAI,iBAAkB,QAAS,IAAM,CACpCF,EAAU,GAAOE,EAAI,MAAM,CAC3B,CAAA,CACF,EAEME,EAAY,CAAA,EAEZC,EAAgB,CAAEN,EAAKO,EAAaN,EAAUC,EAAY,GAAMM,EAAIT,IAAa,CACtF,GAAKM,EAAWL,CAAK,IAAK,OAAY,CACrCC,EAAUI,EAAWL,CAAK,CAAA,EAC1B,MACF,CACCQ,EAAGR,EAAK,CAAES,EAAMC,IAAS,CACnBD,EACJR,EAAUI,EAAWL,GAAQO,EAAaE,CAAM,CAAA,EAE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