"use strict";const e=require("../../../../common/vendor.js"),t=require("../common/util.js"),o=Symbol("None"),r={title:"",showCancelButton:!1,show:!1,closeOnClickModal:!0,msg:"",type:"alert",inputType:"text",inputValue:"",showErr:!1,zIndex:99,lazyRender:!0,inputError:""};exports.defaultOptions=r,exports.getMessageDefaultOptionKey=e=>e?`__MESSAGE_OPTION__${e}`:"__MESSAGE_OPTION__",exports.useMessage=function(s=""){const n=s?"__MESSAGE_OPTION__"+s:"__MESSAGE_OPTION__",l=e.inject(n,e.ref(o));l.value===o&&(l.value=r,e.provide(n,l));const p=e=>o=>{const r=t.deepMerge({type:e},"string"==typeof o?{title:o}:o);return"confirm"===r.type||"prompt"===r.type?r.showCancelButton=!0:r.showCancelButton=!1,i(r)},i=e=>new Promise(((o,s)=>{const n=t.deepMerge(r,"string"==typeof e?{title:e}:e);l.value=t.deepMerge(n,{show:!0,success:e=>{a(),o(e)},fail:e=>{a(),s(e)}})})),u=p("alert"),c=p("confirm"),_=p("prompt"),a=()=>{l.value!==o&&(l.value.show=!1)};return{show:i,alert:u,confirm:c,prompt:_,close:a}};
