{"version":3,"file":"index-20FrbeN2.js","sources":["../../../app/frontend/entrypoints/marketing/mdb/util/index.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta2): util/index.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst MAX_UID = 1000000;\nconst MILLISECONDS_MULTIPLIER = 1000;\nconst TRANSITION_END = 'transitionend';\n\n// Shoutout AngusCroll (https://goo.gl/pxwQGp)\nconst toType = (obj) => {\n if (obj === null || obj === undefined) {\n return `${obj}`;\n }\n\n return {}.toString\n .call(obj)\n .match(/\\s([a-z]+)/i)[1]\n .toLowerCase();\n};\n\n/**\n * --------------------------------------------------------------------------\n * Public Util Api\n * --------------------------------------------------------------------------\n */\n\nconst getUID = (prefix) => {\n do {\n prefix += Math.floor(Math.random() * MAX_UID);\n } while (document.getElementById(prefix));\n\n return prefix;\n};\n\nconst getSelector = (element) => {\n let selector = element.getAttribute('data-mdb-target');\n\n if (!selector || selector === '#') {\n const hrefAttr = element.getAttribute('href');\n\n selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;\n }\n\n return selector;\n};\n\nconst getSelectorFromElement = (element) => {\n const selector = getSelector(element);\n\n if (selector) {\n return document.querySelector(selector) ? selector : null;\n }\n\n return null;\n};\n\nconst getElementFromSelector = (element) => {\n const selector = getSelector(element);\n\n return selector ? document.querySelector(selector) : null;\n};\n\nconst getTransitionDurationFromElement = (element) => {\n if (!element) {\n return 0;\n }\n\n // Get transition-duration of the element\n let { transitionDuration, transitionDelay } = window.getComputedStyle(element);\n\n const floatTransitionDuration = Number.parseFloat(transitionDuration);\n const floatTransitionDelay = Number.parseFloat(transitionDelay);\n\n // Return 0 if element or transition duration is not found\n if (!floatTransitionDuration && !floatTransitionDelay) {\n return 0;\n }\n\n // If multiple durations are defined, take the first\n transitionDuration = transitionDuration.split(',')[0];\n transitionDelay = transitionDelay.split(',')[0];\n\n return (\n (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *\n MILLISECONDS_MULTIPLIER\n );\n};\n\nconst triggerTransitionEnd = (element) => {\n element.dispatchEvent(new Event(TRANSITION_END));\n};\n\nconst isElement = (obj) => (obj[0] || obj).nodeType;\n\nconst emulateTransitionEnd = (element, duration) => {\n let called = false;\n const durationPadding = 5;\n const emulatedDuration = duration + durationPadding;\n\n function listener() {\n called = true;\n element.removeEventListener(TRANSITION_END, listener);\n }\n\n element.addEventListener(TRANSITION_END, listener);\n setTimeout(() => {\n if (!called) {\n triggerTransitionEnd(element);\n }\n }, emulatedDuration);\n};\n\nconst typeCheckConfig = (componentName, config, configTypes) => {\n Object.keys(configTypes).forEach((property) => {\n const expectedTypes = configTypes[property];\n const value = config[property];\n const valueType = value && isElement(value) ? 'element' : toType(value);\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new Error(\n `${componentName.toUpperCase()}: ` +\n `Option \"${property}\" provided type \"${valueType}\" ` +\n `but expected type \"${expectedTypes}\".`\n );\n }\n });\n};\n\nconst isVisible = (element) => {\n if (!element) {\n return false;\n }\n\n if (element.style && element.parentNode && element.parentNode.style) {\n const elementStyle = getComputedStyle(element);\n const parentNodeStyle = getComputedStyle(element.parentNode);\n\n return (\n elementStyle.display !== 'none' &&\n parentNodeStyle.display !== 'none' &&\n elementStyle.visibility !== 'hidden'\n );\n }\n\n return false;\n};\n\nconst findShadowRoot = (element) => {\n if (!document.documentElement.attachShadow) {\n return null;\n }\n\n // Can find the shadow root otherwise it'll return the document\n if (typeof element.getRootNode === 'function') {\n const root = element.getRootNode();\n return root instanceof ShadowRoot ? root : null;\n }\n\n if (element instanceof ShadowRoot) {\n return element;\n }\n\n // when we don't find a shadow root\n if (!element.parentNode) {\n return null;\n }\n\n return findShadowRoot(element.parentNode);\n};\n\nconst noop = () => function () {};\n\nconst reflow = (element) => element.offsetHeight;\n\nconst getjQuery = () => {\n const { jQuery } = window;\n\n if (jQuery && !document.body.hasAttribute('data-mdb-no-jquery')) {\n return jQuery;\n }\n\n return null;\n};\n\nconst onDOMContentLoaded = (callback) => {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', callback);\n } else {\n callback();\n }\n};\n\nconst isRTL = document.documentElement.dir === 'rtl';\n\nconst array = (collection) => {\n return Array.from(collection);\n};\n\nconst element = (tag) => {\n return document.createElement(tag);\n};\n\nconst defineJQueryPlugin = (name, plugin) => {\n onDOMContentLoaded(() => {\n const $ = getjQuery();\n /* istanbul ignore if */\n if ($) {\n const JQUERY_NO_CONFLICT = $.fn[name];\n $.fn[name] = plugin.jQueryInterface;\n $.fn[name].Constructor = plugin;\n $.fn[name].noConflict = () => {\n $.fn[name] = JQUERY_NO_CONFLICT;\n return plugin.jQueryInterface;\n };\n }\n });\n};\n\nexport {\n getjQuery,\n TRANSITION_END,\n getUID,\n getSelectorFromElement,\n getElementFromSelector,\n getTransitionDurationFromElement,\n triggerTransitionEnd,\n isElement,\n emulateTransitionEnd,\n typeCheckConfig,\n isVisible,\n findShadowRoot,\n noop,\n reflow,\n array,\n element,\n onDOMContentLoaded,\n isRTL,\n defineJQueryPlugin,\n};\n"],"names":["toType","obj","getSelector","element","selector","hrefAttr","getSelectorFromElement","getElementFromSelector","isElement","typeCheckConfig","componentName","config","configTypes","property","expectedTypes","value","valueType","getjQuery","jQuery","onDOMContentLoaded","callback","tag"],"mappings":"AAYA,MAAMA,EAAUC,GACVA,GAAQ,KACH,GAAGA,CAAG,GAGR,CAAE,EAAC,SACP,KAAKA,CAAG,EACR,MAAM,aAAa,EAAE,CAAC,EACtB,cAiBCC,EAAeC,GAAY,CAC/B,IAAIC,EAAWD,EAAQ,aAAa,iBAAiB,EAErD,GAAI,CAACC,GAAYA,IAAa,IAAK,CACjC,MAAMC,EAAWF,EAAQ,aAAa,MAAM,EAE5CC,EAAWC,GAAYA,IAAa,IAAMA,EAAS,KAAM,EAAG,IAC7D,CAED,OAAOD,CACT,EAEME,EAA0BH,GAAY,CAC1C,MA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