{ "version": 3, "sources": ["../../Private/Assets/Helper.js"], "sourcesContent": ["const convertCamelCase = (string) => string.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\nconst getDataOptions = (dataSetName, fallback = \"{}\") =>\n JSON.parse(document.querySelector(`[data-${convertCamelCase(dataSetName)}]`)?.dataset?.[dataSetName] || fallback);\n\nconst photoswipeAttributes = getDataOptions(\"photoswipeAttributes\", false);\nconst getPswpContainer = () => document.querySelector(\".pswp\");\n\nfunction setPswpContainerAttributes() {\n if (!photoswipeAttributes) {\n return;\n }\n const container = getPswpContainer();\n if (!container) {\n return;\n }\n Object.entries(photoswipeAttributes).forEach(([key, value]) => {\n if (key === \"class\") {\n container.classList.add(...value.split(\" \"));\n return;\n }\n container.setAttribute(key, value);\n });\n}\n\nfunction dispatchEvent(detail) {\n const event = new CustomEvent(\"neosphotoswipe\", { detail });\n document.dispatchEvent(event);\n}\n\nfunction isNode(element) {\n return element instanceof Node;\n}\n\nfunction createElement(markupOrNode, wrappingClass) {\n let node = isNode(markupOrNode) ? markupOrNode : null;\n let appendElement = null;\n\n if (!node && typeof markupOrNode === \"string\") {\n node = document.createElement(\"template\");\n node.innerHTML = markupOrNode;\n }\n if (node.tagName === \"TEMPLATE\") {\n appendElement = node.content.cloneNode(true);\n } else if (isNode(node)) {\n appendElement = node;\n }\n\n const element = document.createElement(\"div\");\n element.classList.add(wrappingClass);\n element.append(appendElement);\n return element;\n}\n\nfunction addEventListener(type, callback) {\n const listener = [\"neos-photoswipe:init\", `neos-photoswipe.${type}:init`];\n listener.forEach((event) => window.addEventListener(event, callback, true));\n}\n\nexport { getPswpContainer, dispatchEvent, createElement, getDataOptions, setPswpContainerAttributes, addEventListener };\n"], "mappings": "AAAA,IAAMA,EAAoBC,GAAWA,EAAO,QAAQ,kBAAmB,OAAO,EAAE,YAAY,EACtFC,EAAiB,CAACC,EAAaC,EAAW,OAC5C,KAAK,MAAM,SAAS,cAAc,SAASJ,EAAiBG,CAAW,CAAC,GAAG,GAAG,UAAUA,CAAW,GAAKC,CAAQ,EAE9GC,EAAuBH,EAAe,uBAAwB,EAAK,EACnEI,EAAmB,IAAM,SAAS,cAAc,OAAO,EAE7D,SAASC,GAA6B,CAClC,GAAI,CAACF,EACD,OAEJ,IAAMG,EAAYF,EAAiB,EAC9BE,GAGL,OAAO,QAAQH,CAAoB,EAAE,QAAQ,CAAC,CAACI,EAAKC,CAAK,IAAM,CAC3D,GAAID,IAAQ,QAAS,CACjBD,EAAU,UAAU,IAAI,GAAGE,EAAM,MAAM,GAAG,CAAC,EAC3C,MACJ,CACAF,EAAU,aAAaC,EAAKC,CAAK,CACrC,CAAC,CACL,CAEA,SAASC,EAAcC,EAAQ,CAC3B,IAAMC,EAAQ,IAAI,YAAY,iBAAkB,CAAE,OAAAD,CAAO,CAAC,EAC1D,SAAS,cAAcC,CAAK,CAChC,CAEA,SAASC,EAAOC,EAAS,CACrB,OAAOA,aAAmB,IAC9B,CAEA,SAASC,EAAcC,EAAcC,EAAe,CAChD,IAAIC,EAAOL,EAAOG,CAAY,EAAIA,EAAe,KAC7CG,EAAgB,KAEhB,CAACD,GAAQ,OAAOF,GAAiB,WACjCE,EAAO,SAAS,cAAc,UAAU,EACxCA,EAAK,UAAYF,GAEjBE,EAAK,UAAY,WACjBC,EAAgBD,EAAK,QAAQ,UAAU,EAAI,EACpCL,EAAOK,CAAI,IAClBC,EAAgBD,GAGpB,IAAMJ,EAAU,SAAS,cAAc,KAAK,EAC5C,OAAAA,EAAQ,UAAU,IAAIG,CAAa,EACnCH,EAAQ,OAAOK,CAAa,EACrBL,CACX,CAEA,SAASM,EAAiBC,EAAMC,EAAU,CACrB,CAAC,uBAAwB,mBAAmBD,CAAI,OAAO,EAC/D,QAAST,GAAU,OAAO,iBAAiBA,EAAOU,EAAU,EAAI,CAAC,CAC9E", "names": ["convertCamelCase", "string", "getDataOptions", "dataSetName", "fallback", "photoswipeAttributes", "getPswpContainer", "setPswpContainerAttributes", "container", "key", "value", "dispatchEvent", "detail", "event", "isNode", "element", "createElement", "markupOrNode", "wrappingClass", "node", "appendElement", "addEventListener", "type", "callback"] }