{"version":3,"sources":["webpack:///./node_modules/vuejs-confirm-dialog/dist/vuejs-confirm-dialog.es.js"],"names":["DialogsStore","useDialogWrapper","addDialog","dialogData","push","removeDialog","id","index","findIndex","dialog","splice","removeAll","createEventHook","fns","off","fn","indexOf","on","trigger","param","forEach","isClient","window","noop","document","navigator","location","_global","globalThis","global","self","globalKey","useConfirmDialog","revealed","confirmHook","cancelHook","revealHook","_resolve","reveal","data","value","Promise","resolve","confirm","isCanceled","cancel","isRevealed","onReveal","onConfirm","onCancel","_a","_b","platform","test","__defProp$3","Object","defineProperty","__getOwnPropSymbols$3","getOwnPropertySymbols","__hasOwnProp$3","prototype","hasOwnProperty","__propIsEnum$3","propertyIsEnumerable","__defNormalProp$3","obj","key","enumerable","configurable","writable","__spreadValues$3","a","b","prop","call","initialRect","top","left","bottom","right","height","width","text","lastDialogId","getDialogId","createConfirmDialog","initialAttrs","options","chore","keepInitial","setAttrs","attrs","propsRef","close","DIALOG_ID","DialogsStore2","props","closeAll","dialog2","DialogsWrapper","name","map","is","install","app","component"],"mappings":"0HAAA,8KACA,MAAMA,EAAe,eAAS,IACxBC,EAAmB,WACvB,MAAMC,EAAY,SAASC,GACzBH,EAAaI,KAAK,eAAQD,KAEtBE,EAAe,SAASC,GAC5B,MAAMC,EAAQP,EAAaQ,UAAWC,GAAWA,EAAOH,IAAMA,GAC9DN,EAAaU,OAAOH,EAAO,IAEvBI,EAAY,WAChBX,EAAaU,OAAO,IAEtB,MAAO,CACLV,eACAE,YACAG,eACAM,cAGJ,SAASC,IACP,MAAMC,EAAM,GACNC,EAAOC,IACX,MAAMR,EAAQM,EAAIG,QAAQD,IACX,IAAXR,GACFM,EAAIH,OAAOH,EAAO,IAEhBU,EAAMF,IACVF,EAAIT,KAAKW,GACF,CACLD,IAAK,IAAMA,EAAIC,KAGbG,EAAWC,IACfN,EAAIO,QAASL,GAAOA,EAAGI,KAEzB,MAAO,CACLF,KACAH,MACAI,WAGJ,MAAMG,EAA6B,qBAAXC,OA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MG,EAAW,KACfF,EAAc3E,QAAS8E,IACrBA,EAAQjE,SAASO,OAAQ,IAE3B7B,KAEF,MAAO,CACLkF,QACAI,WACA3D,SACAQ,WAAY,eAAS,IAAMA,EAAWN,OAASP,EAASO,OACxDQ,YACAC,YAGJ,IAAIkD,EAAiB,eAAgB,CACnCC,KAAM,iBACN,QACE,MAAQpG,aAAc+F,GAAkB9F,IACxC,MAAO,IAAM8F,EAAcM,IAAKlG,GACvB,eAAEA,EAAWM,OAAQ,CAC1B6F,GAAInG,EAAWM,OACfuC,UAAW7C,EAAWwC,QACtBM,SAAU9C,EAAW0C,OACrBqB,IAAK/D,EAAWG,MACbH,EAAW6F,YAKtB,SAASO,EAAQC,GACfA,EAAIC,UAAU,iBAAkBN,K","file":"js/npm.vuejs-confirm-dialog.09eff3c9.js","sourcesContent":["import { reactive, markRaw, computed, ref, watch, defineComponent, h } from \"vue\";\nconst DialogsStore = reactive([]);\nconst useDialogWrapper = function() {\n const addDialog = function(dialogData) {\n DialogsStore.push(markRaw(dialogData));\n };\n const removeDialog = function(id) {\n const index = DialogsStore.findIndex((dialog) => dialog.id == id);\n DialogsStore.splice(index, 1);\n };\n const removeAll = function() {\n DialogsStore.splice(0);\n };\n return {\n DialogsStore,\n addDialog,\n removeDialog,\n removeAll\n };\n};\nfunction createEventHook() {\n const fns = [];\n const off = (fn) => {\n const index = fns.indexOf(fn);\n if (index !== -1)\n fns.splice(index, 1);\n };\n const on = (fn) => {\n fns.push(fn);\n return {\n off: () => off(fn)\n };\n };\n const trigger = (param) => {\n fns.forEach((fn) => fn(param));\n };\n return {\n on,\n off,\n trigger\n };\n}\nconst isClient = typeof window !== \"undefined\";\nconst noop = () => {\n};\nisClient ? window : void 0;\nisClient ? window.document : void 0;\nisClient ? window.navigator : void 0;\nisClient ? window.location : void 0;\nconst _global = typeof globalThis !== \"undefined\" ? globalThis : typeof window !== \"undefined\" ? window : typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : {};\nconst globalKey = \"__vueuse_ssr_handlers__\";\n_global[globalKey] = _global[globalKey] || {};\n_global[globalKey];\nfunction useConfirmDialog(revealed = ref(false)) {\n const confirmHook = createEventHook();\n const cancelHook = createEventHook();\n const revealHook = createEventHook();\n let _resolve = noop;\n const reveal = (data) => {\n revealHook.trigger(data);\n revealed.value = true;\n return new Promise((resolve) => {\n _resolve = resolve;\n });\n };\n const confirm = (data) => {\n revealed.value = false;\n confirmHook.trigger(data);\n _resolve({ data, isCanceled: false });\n };\n const cancel = (data) => {\n revealed.value = false;\n cancelHook.trigger(data);\n _resolve({ data, isCanceled: true });\n };\n return {\n isRevealed: computed(() => revealed.value),\n reveal,\n confirm,\n cancel,\n onReveal: revealHook.on,\n onConfirm: confirmHook.on,\n onCancel: cancelHook.on\n };\n}\nvar _a, _b;\nisClient && (window == null ? void 0 : window.navigator) && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.platform) && /iP(ad|hone|od)/.test((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.platform);\nvar __defProp$3 = Object.defineProperty;\nvar __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;\nvar __hasOwnProp$3 = Object.prototype.hasOwnProperty;\nvar __propIsEnum$3 = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues$3 = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp$3.call(b, prop))\n __defNormalProp$3(a, prop, b[prop]);\n if (__getOwnPropSymbols$3)\n for (var prop of __getOwnPropSymbols$3(b)) {\n if (__propIsEnum$3.call(b, prop))\n __defNormalProp$3(a, prop, b[prop]);\n }\n return a;\n};\nconst initialRect = {\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n height: 0,\n width: 0\n};\n__spreadValues$3({\n text: \"\"\n}, initialRect);\nlet lastDialogId = 0;\nfunction getDialogId() {\n return ++lastDialogId;\n}\nfunction createConfirmDialog(dialog, initialAttrs = {}, options = { chore: false, keepInitial: false }) {\n const setAttrs = (attrs) => {\n if (!attrs) {\n propsRef.value = {};\n return;\n }\n for (const prop in attrs) {\n propsRef.value[prop] = attrs[prop];\n }\n };\n const propsRef = ref({});\n setAttrs(initialAttrs);\n const revealed = ref(false);\n const close = () => {\n revealed.value = false;\n removeDialog(DIALOG_ID);\n };\n const { addDialog, removeDialog, removeAll, DialogsStore: DialogsStore2 } = useDialogWrapper();\n const {\n reveal,\n isRevealed,\n onConfirm,\n onReveal,\n onCancel,\n confirm,\n cancel\n } = useConfirmDialog();\n const DIALOG_ID = getDialogId();\n onReveal((props) => {\n revealed.value = true;\n if (props)\n setAttrs(props);\n addDialog({\n id: DIALOG_ID,\n dialog,\n isRevealed,\n confirm,\n cancel,\n props: propsRef.value,\n close,\n revealed\n });\n });\n watch(\n isRevealed,\n (value) => {\n if (!value) {\n if (options.chore) {\n setAttrs(options.keepInitial ? initialAttrs : null);\n }\n removeDialog(DIALOG_ID);\n }\n }\n );\n const closeAll = () => {\n DialogsStore2.forEach((dialog2) => {\n dialog2.revealed.value = false;\n });\n removeAll();\n };\n return {\n close,\n closeAll,\n reveal,\n isRevealed: computed(() => isRevealed.value && revealed.value),\n onConfirm,\n onCancel\n };\n}\nvar DialogsWrapper = defineComponent({\n name: \"DialogsWrapper\",\n setup() {\n const { DialogsStore: DialogsStore2 } = useDialogWrapper();\n return () => DialogsStore2.map((dialogData) => {\n return h(dialogData.dialog, {\n is: dialogData.dialog,\n onConfirm: dialogData.confirm,\n onCancel: dialogData.cancel,\n key: dialogData.id,\n ...dialogData.props\n });\n });\n }\n});\nfunction install(app) {\n app.component(\"DialogsWrapper\", DialogsWrapper);\n}\nexport { DialogsWrapper, createConfirmDialog, install };\n"],"sourceRoot":""}