{"version":3,"file":"alertDialog.cjs","sources":["../../src/dom/alertDialog.js"],"sourcesContent":["/* global document, HTMLElement */\n\nconst alertDialog = (message) => {\n    const dialog = document.createElement('dialog');\n    document.body.append(dialog);\n\n    const itemsToInsert = Array.isArray(message) ? message : [message];\n\n    for (const item of itemsToInsert) {\n        if (item instanceof HTMLElement) {\n            dialog.append(item);\n        } else if (typeof item?.innerHTML === 'string') {\n            const div = document.createElement('div');\n            div.innerHTML = item.innerHTML;\n            const children = div.children;\n            for (const child of children) {\n                dialog.append(child);\n            }\n        } else {\n            const textNode = document.createTextNode(item);\n            dialog.append(textNode);\n        }\n    }\n\n    dialog.addEventListener(\n        'click',\n        function (evt) {\n            if (evt.target === dialog) {\n                dialog.close();\n            }\n        }\n    );\n\n    dialog.showModal();\n};\n\nexport { alertDialog };\n"],"names":["message","dialog","document","createElement","body","append","itemsToInsert","Array","isArray","item","HTMLElement","innerHTML","div","children","child","textNode","createTextNode","addEventListener","evt","target","close","showModal"],"mappings":";oBAEqBA,UACjB,MAAMC,OAASC,SAASC,cAAc;AACtCD,SAASE,KAAKC,OAAOJ;AAErB,MAAMK,cAAgBC,MAAMC,QAAQR,SAAWA,QAAU,CAACA;AAE1D,IAAK,MAAMS,QAAQH,cACf,GAAIG,gBAAgBC,YAChBT,OAAOI,OAAOI;KACX,GAA+B,iBAApBA,MAAME,UAAwB,CAC5C,MAAMC,IAAMV,SAASC,cAAc;AACnCS,IAAID,UAAYF,KAAKE;AACrB,MAAME,SAAWD,IAAIC;AACrB,IAAK,MAAMC,SAASD,SAChBZ,OAAOI,OAAOS,MAEtB,KAAO,CACH,MAAMC,SAAWb,SAASc,eAAeP;AACzCR,OAAOI,OAAOU,SAClB,CAGJd,OAAOgB,iBACH,QACA,SAAUC,KACFA,IAAIC,SAAWlB,QACfA,OAAOmB,OAEf;AAGJnB,OAAOoB"}