mirror of
https://github.com/KarolChang/jm-expense-vue-ts.git
synced 2024-12-26 03:38:35 +00:00
65 lines
48 KiB
JavaScript
65 lines
48 KiB
JavaScript
import{g as je}from"./dateFormat.a9df66b7.js";import{r as Dt}from"./record.2f186259.js";import{S as It}from"./Spinner.33b65f67.js";import{_ as Lt}from"./index.c104fbd6.js";import{e as Ot,x as le,f as Mt,o as g,g as m,h as c,F as O,k as ce,n as Ve,t as p,m as J,P as H,p as Ft,A as Ht,B as jt,l as P}from"./vendor.961f4417.js";var et="/jm-expense-vue-ts/assets/favicon.90f8b31e.ico",tt="/jm-expense-vue-ts/assets/karol.27263ac1.png";const ot="SweetAlert2:",Vt=e=>{const t=[];for(let o=0;o<e.length;o++)t.indexOf(e[o])===-1&&t.push(e[o]);return t},_e=e=>e.charAt(0).toUpperCase()+e.slice(1),S=e=>Array.prototype.slice.call(e),A=e=>{console.warn(`${ot} ${typeof e=="object"?e.join(" "):e}`)},W=e=>{console.error(`${ot} ${e}`)},qe=[],qt=e=>{qe.includes(e)||(qe.push(e),A(e))},Wt=(e,t)=>{qt(`"${e}" is deprecated and will be removed in the next major release. Please use "${t}" instead.`)},pe=e=>typeof e=="function"?e():e,Ae=e=>e&&typeof e.toPromise=="function",te=e=>Ae(e)?e.toPromise():Promise.resolve(e),Ee=e=>e&&Promise.resolve(e)===e,R={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconColor:void 0,iconHtml:void 0,template:void 0,toast:!1,showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:{},target:"body",color:void 0,backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showDenyButton:!1,showCancelButton:!1,preConfirm:void 0,preDeny:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,denyButtonText:"No",denyButtonAriaLabel:"",denyButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusDeny:!1,focusCancel:!1,returnFocus:!0,showCloseButton:!1,closeButtonHtml:"×",closeButtonAriaLabel:"Close this dialog",loaderHtml:"",showLoaderOnConfirm:!1,showLoaderOnDeny:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputLabel:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,returnInputValueOnDeny:!1,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,willOpen:void 0,didOpen:void 0,didRender:void 0,willClose:void 0,didClose:void 0,didDestroy:void 0,scrollbarPadding:!0},Nt=["allowEscapeKey","allowOutsideClick","background","buttonsStyling","cancelButtonAriaLabel","cancelButtonColor","cancelButtonText","closeButtonAriaLabel","closeButtonHtml","color","confirmButtonAriaLabel","confirmButtonColor","confirmButtonText","currentProgressStep","customClass","denyButtonAriaLabel","denyButtonColor","denyButtonText","didClose","didDestroy","footer","hideClass","html","icon","iconColor","iconHtml","imageAlt","imageHeight","imageUrl","imageWidth","preConfirm","preDeny","progressSteps","returnFocus","reverseButtons","showCancelButton","showCloseButton","showConfirmButton","showDenyButton","text","title","titleText","willClose"],Rt={},Ut=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusDeny","focusCancel","returnFocus","heightAuto","keydownListenerCapture"],nt=e=>Object.prototype.hasOwnProperty.call(R,e),st=e=>Nt.indexOf(e)!==-1,ve=e=>Rt[e],zt=e=>{nt(e)||A(`Unknown parameter "${e}"`)},Kt=e=>{Ut.includes(e)&&A(`The parameter "${e}" is incompatible with toasts`)},Yt=e=>{ve(e)&&Wt(e,ve(e))},Zt=e=>{!e.backdrop&&e.allowOutsideClick&&A('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`');for(const t in e)zt(t),e.toast&&Kt(t),Yt(t)},Jt="swal2-",it=e=>{const t={};for(const o in e)t[e[o]]=Jt+e[o];return t},s=it(["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","show","hide","close","title","html-container","actions","confirm","deny","cancel","default-outline","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","input-label","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loader","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error"]),X=it(["success","warning","info","question","error"]),C=()=>document.body.querySelector(`.${s.container}`),oe=e=>{const t=C();return t?t.querySelector(e):null},$=e=>oe(`.${e}`),f=()=>$(s.popup),ne=()=>$(s.icon),rt=()=>$(s.title),ue=()=>$(s["html-container"]),lt=()=>$(s.image),ct=()=>$(s["progress-steps"]),he=()=>$(s["validation-message"]),T=()=>oe(`.${s.actions} .${s.confirm}`),F=()=>oe(`.${s.actions} .${s.deny}`),Xt=()=>$(s["input-label"]),K=()=>oe(`.${s.loader}`),V=()=>oe(`.${s.actions} .${s.cancel}`),se=()=>$(s.actions),at=()=>$(s.footer),ge=()=>$(s["timer-progress-bar"]),Se=()=>$(s.close),Gt=`
|
|
a[href],
|
|
area[href],
|
|
input:not([disabled]),
|
|
select:not([disabled]),
|
|
textarea:not([disabled]),
|
|
button:not([disabled]),
|
|
iframe,
|
|
object,
|
|
embed,
|
|
[tabindex="0"],
|
|
[contenteditable],
|
|
audio[controls],
|
|
video[controls],
|
|
summary
|
|
`,xe=()=>{const e=S(f().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')).sort((o,n)=>{const i=parseInt(o.getAttribute("tabindex")),r=parseInt(n.getAttribute("tabindex"));return i>r?1:i<r?-1:0}),t=S(f().querySelectorAll(Gt)).filter(o=>o.getAttribute("tabindex")!=="-1");return Vt(e.concat(t)).filter(o=>E(o))},$e=()=>L(document.body,s.shown)&&!L(document.body,s["toast-shown"])&&!L(document.body,s["no-backdrop"]),me=()=>f()&&L(f(),s.toast),Qt=()=>f().hasAttribute("data-loading"),U={previousBodyPadding:null},v=(e,t)=>{if(e.textContent="",t){const n=new DOMParser().parseFromString(t,"text/html");S(n.querySelector("head").childNodes).forEach(i=>{e.appendChild(i)}),S(n.querySelector("body").childNodes).forEach(i=>{e.appendChild(i)})}},L=(e,t)=>{if(!t)return!1;const o=t.split(/\s+/);for(let n=0;n<o.length;n++)if(!e.classList.contains(o[n]))return!1;return!0},eo=(e,t)=>{S(e.classList).forEach(o=>{!Object.values(s).includes(o)&&!Object.values(X).includes(o)&&!Object.values(t.showClass).includes(o)&&e.classList.remove(o)})},x=(e,t,o)=>{if(eo(e,t),t.customClass&&t.customClass[o]){if(typeof t.customClass[o]!="string"&&!t.customClass[o].forEach)return A(`Invalid type of customClass.${o}! Expected string or iterable object, got "${typeof t.customClass[o]}"`);d(e,t.customClass[o])}},Te=(e,t)=>{if(!t)return null;switch(t){case"select":case"textarea":case"file":return e.querySelector(`.${s.popup} > .${s[t]}`);case"checkbox":return e.querySelector(`.${s.popup} > .${s.checkbox} input`);case"radio":return e.querySelector(`.${s.popup} > .${s.radio} input:checked`)||e.querySelector(`.${s.popup} > .${s.radio} input:first-child`);case"range":return e.querySelector(`.${s.popup} > .${s.range} input`);default:return e.querySelector(`.${s.popup} > .${s.input}`)}},ut=e=>{if(e.focus(),e.type!=="file"){const t=e.value;e.value="",e.value=t}},dt=(e,t,o)=>{!e||!t||(typeof t=="string"&&(t=t.split(/\s+/).filter(Boolean)),t.forEach(n=>{Array.isArray(e)?e.forEach(i=>{o?i.classList.add(n):i.classList.remove(n)}):o?e.classList.add(n):e.classList.remove(n)}))},d=(e,t)=>{dt(e,t,!0)},I=(e,t)=>{dt(e,t,!1)},M=(e,t)=>{const o=S(e.childNodes);for(let n=0;n<o.length;n++)if(L(o[n],t))return o[n]},G=(e,t,o)=>{o===`${parseInt(o)}`&&(o=parseInt(o)),o||parseInt(o)===0?e.style[t]=typeof o=="number"?`${o}px`:o:e.style.removeProperty(t)},y=(e,t="flex")=>{e.style.display=t},k=e=>{e.style.display="none"},We=(e,t,o,n)=>{const i=e.querySelector(t);i&&(i.style[o]=n)},be=(e,t,o)=>{t?y(e,o):k(e)},E=e=>!!(e&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)),to=()=>!E(T())&&!E(F())&&!E(V()),Ne=e=>e.scrollHeight>e.clientHeight,ft=e=>{const t=window.getComputedStyle(e),o=parseFloat(t.getPropertyValue("animation-duration")||"0"),n=parseFloat(t.getPropertyValue("transition-duration")||"0");return o>0||n>0},De=(e,t=!1)=>{const o=ge();E(o)&&(t&&(o.style.transition="none",o.style.width="100%"),setTimeout(()=>{o.style.transition=`width ${e/1e3}s linear`,o.style.width="0%"},10))},oo=()=>{const e=ge(),t=parseInt(window.getComputedStyle(e).width);e.style.removeProperty("transition"),e.style.width="100%";const o=parseInt(window.getComputedStyle(e).width),n=t/o*100;e.style.removeProperty("transition"),e.style.width=`${n}%`},pt=()=>typeof window=="undefined"||typeof document=="undefined",no=100,a={},so=()=>{a.previousActiveElement&&a.previousActiveElement.focus?(a.previousActiveElement.focus(),a.previousActiveElement=null):document.body&&document.body.focus()},io=e=>new Promise(t=>{if(!e)return t();const o=window.scrollX,n=window.scrollY;a.restoreFocusTimeout=setTimeout(()=>{so(),t()},no),window.scrollTo(o,n)}),ro=`
|
|
<div aria-labelledby="${s.title}" aria-describedby="${s["html-container"]}" class="${s.popup}" tabindex="-1">
|
|
<button type="button" class="${s.close}"></button>
|
|
<ul class="${s["progress-steps"]}"></ul>
|
|
<div class="${s.icon}"></div>
|
|
<img class="${s.image}" />
|
|
<h2 class="${s.title}" id="${s.title}"></h2>
|
|
<div class="${s["html-container"]}" id="${s["html-container"]}"></div>
|
|
<input class="${s.input}" />
|
|
<input type="file" class="${s.file}" />
|
|
<div class="${s.range}">
|
|
<input type="range" />
|
|
<output></output>
|
|
</div>
|
|
<select class="${s.select}"></select>
|
|
<div class="${s.radio}"></div>
|
|
<label for="${s.checkbox}" class="${s.checkbox}">
|
|
<input type="checkbox" />
|
|
<span class="${s.label}"></span>
|
|
</label>
|
|
<textarea class="${s.textarea}"></textarea>
|
|
<div class="${s["validation-message"]}" id="${s["validation-message"]}"></div>
|
|
<div class="${s.actions}">
|
|
<div class="${s.loader}"></div>
|
|
<button type="button" class="${s.confirm}"></button>
|
|
<button type="button" class="${s.deny}"></button>
|
|
<button type="button" class="${s.cancel}"></button>
|
|
</div>
|
|
<div class="${s.footer}"></div>
|
|
<div class="${s["timer-progress-bar-container"]}">
|
|
<div class="${s["timer-progress-bar"]}"></div>
|
|
</div>
|
|
</div>
|
|
`.replace(/(^|\n)\s*/g,""),lo=()=>{const e=C();return e?(e.remove(),I([document.documentElement,document.body],[s["no-backdrop"],s["toast-shown"],s["has-column"]]),!0):!1},j=()=>{a.currentInstance.resetValidationMessage()},co=()=>{const e=f(),t=M(e,s.input),o=M(e,s.file),n=e.querySelector(`.${s.range} input`),i=e.querySelector(`.${s.range} output`),r=M(e,s.select),h=e.querySelector(`.${s.checkbox} input`),B=M(e,s.textarea);t.oninput=j,o.onchange=j,r.onchange=j,h.onchange=j,B.oninput=j,n.oninput=()=>{j(),i.value=n.value},n.onchange=()=>{j(),n.nextSibling.value=n.value}},ao=e=>typeof e=="string"?document.querySelector(e):e,uo=e=>{const t=f();t.setAttribute("role",e.toast?"alert":"dialog"),t.setAttribute("aria-live",e.toast?"polite":"assertive"),e.toast||t.setAttribute("aria-modal","true")},fo=e=>{window.getComputedStyle(e).direction==="rtl"&&d(C(),s.rtl)},po=e=>{const t=lo();if(pt()){W("SweetAlert2 requires document to initialize");return}const o=document.createElement("div");o.className=s.container,t&&d(o,s["no-transition"]),v(o,ro);const n=ao(e.target);n.appendChild(o),uo(e),fo(n),co()},Ie=(e,t)=>{e instanceof HTMLElement?t.appendChild(e):typeof e=="object"?ho(e,t):e&&v(t,e)},ho=(e,t)=>{e.jquery?go(t,e):v(t,e.toString())},go=(e,t)=>{if(e.textContent="",0 in t)for(let o=0;o in t;o++)e.appendChild(t[o].cloneNode(!0));else e.appendChild(t.cloneNode(!0))},Q=(()=>{if(pt())return!1;const e=document.createElement("div"),t={WebkitAnimation:"webkitAnimationEnd",animation:"animationend"};for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&typeof e.style[o]!="undefined")return t[o];return!1})(),mo=()=>{const e=document.createElement("div");e.className=s["scrollbar-measure"],document.body.appendChild(e);const t=e.getBoundingClientRect().width-e.clientWidth;return document.body.removeChild(e),t},bo=(e,t)=>{const o=se(),n=K();!t.showConfirmButton&&!t.showDenyButton&&!t.showCancelButton?k(o):y(o),x(o,t,"actions"),yo(o,n,t),v(n,t.loaderHtml),x(n,t,"loader")};function yo(e,t,o){const n=T(),i=F(),r=V();ye(n,"confirm",o),ye(i,"deny",o),ye(r,"cancel",o),wo(n,i,r,o),o.reverseButtons&&(o.toast?(e.insertBefore(r,n),e.insertBefore(i,n)):(e.insertBefore(r,t),e.insertBefore(i,t),e.insertBefore(n,t)))}function wo(e,t,o,n){if(!n.buttonsStyling)return I([e,t,o],s.styled);d([e,t,o],s.styled),n.confirmButtonColor&&(e.style.backgroundColor=n.confirmButtonColor,d(e,s["default-outline"])),n.denyButtonColor&&(t.style.backgroundColor=n.denyButtonColor,d(t,s["default-outline"])),n.cancelButtonColor&&(o.style.backgroundColor=n.cancelButtonColor,d(o,s["default-outline"]))}function ye(e,t,o){be(e,o[`show${_e(t)}Button`],"inline-block"),v(e,o[`${t}ButtonText`]),e.setAttribute("aria-label",o[`${t}ButtonAriaLabel`]),e.className=s[t],x(e,o,`${t}Button`),d(e,o[`${t}ButtonClass`])}function vo(e,t){typeof t=="string"?e.style.background=t:t||d([document.documentElement,document.body],s["no-backdrop"])}function Co(e,t){t in s?d(e,s[t]):(A('The "position" parameter is not valid, defaulting to "center"'),d(e,s.center))}function ko(e,t){if(t&&typeof t=="string"){const o=`grow-${t}`;o in s&&d(e,s[o])}}const Po=(e,t)=>{const o=C();!o||(vo(o,t.backdrop),Co(o,t.position),ko(o,t.grow),x(o,t,"container"))};var u={awaitingPromise:new WeakMap,promise:new WeakMap,innerParams:new WeakMap,domCache:new WeakMap};const Bo=["input","file","range","select","radio","checkbox","textarea"],_o=(e,t)=>{const o=f(),n=u.innerParams.get(e),i=!n||t.input!==n.input;Bo.forEach(r=>{const h=s[r],B=M(o,h);So(r,t.inputAttributes),B.className=h,i&&k(B)}),t.input&&(i&&Ao(t),xo(t))},Ao=e=>{if(!_[e.input])return W(`Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "${e.input}"`);const t=ht(e.input),o=_[e.input](t,e);y(o),setTimeout(()=>{ut(o)})},Eo=e=>{for(let t=0;t<e.attributes.length;t++){const o=e.attributes[t].name;["type","value","style"].includes(o)||e.removeAttribute(o)}},So=(e,t)=>{const o=Te(f(),e);if(!!o){Eo(o);for(const n in t)o.setAttribute(n,t[n])}},xo=e=>{const t=ht(e.input);e.customClass&&d(t,e.customClass.input)},Le=(e,t)=>{(!e.placeholder||t.inputPlaceholder)&&(e.placeholder=t.inputPlaceholder)},ie=(e,t,o)=>{if(o.inputLabel){e.id=s.input;const n=document.createElement("label"),i=s["input-label"];n.setAttribute("for",e.id),n.className=i,d(n,o.customClass.inputLabel),n.innerText=o.inputLabel,t.insertAdjacentElement("beforebegin",n)}},ht=e=>{const t=s[e]?s[e]:s.input;return M(f(),t)},_={};_.text=_.email=_.password=_.number=_.tel=_.url=(e,t)=>(typeof t.inputValue=="string"||typeof t.inputValue=="number"?e.value=t.inputValue:Ee(t.inputValue)||A(`Unexpected type of inputValue! Expected "string", "number" or "Promise", got "${typeof t.inputValue}"`),ie(e,e,t),Le(e,t),e.type=t.input,e);_.file=(e,t)=>(ie(e,e,t),Le(e,t),e);_.range=(e,t)=>{const o=e.querySelector("input"),n=e.querySelector("output");return o.value=t.inputValue,o.type=t.input,n.value=t.inputValue,ie(o,e,t),e};_.select=(e,t)=>{if(e.textContent="",t.inputPlaceholder){const o=document.createElement("option");v(o,t.inputPlaceholder),o.value="",o.disabled=!0,o.selected=!0,e.appendChild(o)}return ie(e,e,t),e};_.radio=e=>(e.textContent="",e);_.checkbox=(e,t)=>{const o=Te(f(),"checkbox");o.value="1",o.id=s.checkbox,o.checked=Boolean(t.inputValue);const n=e.querySelector("span");return v(n,t.inputPlaceholder),e};_.textarea=(e,t)=>{e.value=t.inputValue,Le(e,t),ie(e,e,t);const o=n=>parseInt(window.getComputedStyle(n).marginLeft)+parseInt(window.getComputedStyle(n).marginRight);return setTimeout(()=>{if("MutationObserver"in window){const n=parseInt(window.getComputedStyle(f()).width),i=()=>{const r=e.offsetWidth+o(e);r>n?f().style.width=`${r}px`:f().style.width=null};new MutationObserver(i).observe(e,{attributes:!0,attributeFilter:["style"]})}}),e};const $o=(e,t)=>{const o=ue();x(o,t,"htmlContainer"),t.html?(Ie(t.html,o),y(o,"block")):t.text?(o.textContent=t.text,y(o,"block")):k(o),_o(e,t)},To=(e,t)=>{const o=at();be(o,t.footer),t.footer&&Ie(t.footer,o),x(o,t,"footer")},Do=(e,t)=>{const o=Se();v(o,t.closeButtonHtml),x(o,t,"closeButton"),be(o,t.showCloseButton),o.setAttribute("aria-label",t.closeButtonAriaLabel)},Io=(e,t)=>{const o=u.innerParams.get(e),n=ne();if(o&&t.icon===o.icon){Ue(n,t),Re(n,t);return}if(!t.icon&&!t.iconHtml)return k(n);if(t.icon&&Object.keys(X).indexOf(t.icon)===-1)return W(`Unknown icon! Expected "success", "error", "warning", "info" or "question", got "${t.icon}"`),k(n);y(n),Ue(n,t),Re(n,t),d(n,t.showClass.icon)},Re=(e,t)=>{for(const o in X)t.icon!==o&&I(e,X[o]);d(e,X[t.icon]),Fo(e,t),Lo(),x(e,t,"icon")},Lo=()=>{const e=f(),t=window.getComputedStyle(e).getPropertyValue("background-color"),o=e.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix");for(let n=0;n<o.length;n++)o[n].style.backgroundColor=t},Oo=`
|
|
<div class="swal2-success-circular-line-left"></div>
|
|
<span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>
|
|
<div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>
|
|
<div class="swal2-success-circular-line-right"></div>
|
|
`,Mo=`
|
|
<span class="swal2-x-mark">
|
|
<span class="swal2-x-mark-line-left"></span>
|
|
<span class="swal2-x-mark-line-right"></span>
|
|
</span>
|
|
`,Ue=(e,t)=>{e.textContent="",t.iconHtml?v(e,ze(t.iconHtml)):t.icon==="success"?v(e,Oo):t.icon==="error"?v(e,Mo):v(e,ze({question:"?",warning:"!",info:"i"}[t.icon]))},Fo=(e,t)=>{if(!!t.iconColor){e.style.color=t.iconColor,e.style.borderColor=t.iconColor;for(const o of[".swal2-success-line-tip",".swal2-success-line-long",".swal2-x-mark-line-left",".swal2-x-mark-line-right"])We(e,o,"backgroundColor",t.iconColor);We(e,".swal2-success-ring","borderColor",t.iconColor)}},ze=e=>`<div class="${s["icon-content"]}">${e}</div>`,Ho=(e,t)=>{const o=lt();if(!t.imageUrl)return k(o);y(o,""),o.setAttribute("src",t.imageUrl),o.setAttribute("alt",t.imageAlt),G(o,"width",t.imageWidth),G(o,"height",t.imageHeight),o.className=s.image,x(o,t,"image")},jo=e=>{const t=document.createElement("li");return d(t,s["progress-step"]),v(t,e),t},Vo=e=>{const t=document.createElement("li");return d(t,s["progress-step-line"]),e.progressStepsDistance&&(t.style.width=e.progressStepsDistance),t},qo=(e,t)=>{const o=ct();if(!t.progressSteps||t.progressSteps.length===0)return k(o);y(o),o.textContent="",t.currentProgressStep>=t.progressSteps.length&&A("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),t.progressSteps.forEach((n,i)=>{const r=jo(n);if(o.appendChild(r),i===t.currentProgressStep&&d(r,s["active-progress-step"]),i!==t.progressSteps.length-1){const h=Vo(t);o.appendChild(h)}})},Wo=(e,t)=>{const o=rt();be(o,t.title||t.titleText,"block"),t.title&&Ie(t.title,o),t.titleText&&(o.innerText=t.titleText),x(o,t,"title")},No=(e,t)=>{const o=C(),n=f();t.toast?(G(o,"width",t.width),n.style.width="100%",n.insertBefore(K(),ne())):G(n,"width",t.width),G(n,"padding",t.padding),t.color&&(n.style.color=t.color),t.background&&(n.style.background=t.background),k(he()),Ro(n,t)},Ro=(e,t)=>{e.className=`${s.popup} ${E(e)?t.showClass.popup:""}`,t.toast?(d([document.documentElement,document.body],s["toast-shown"]),d(e,s.toast)):d(e,s.modal),x(e,t,"popup"),typeof t.customClass=="string"&&d(e,t.customClass),t.icon&&d(e,s[`icon-${t.icon}`])},gt=(e,t)=>{No(e,t),Po(e,t),qo(e,t),Io(e,t),Ho(e,t),Wo(e,t),Do(e,t),$o(e,t),bo(e,t),To(e,t),typeof t.didRender=="function"&&t.didRender(f())},Y=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),Uo=()=>{S(document.body.children).forEach(t=>{t===C()||t.contains(C())||(t.hasAttribute("aria-hidden")&&t.setAttribute("data-previous-aria-hidden",t.getAttribute("aria-hidden")),t.setAttribute("aria-hidden","true"))})},mt=()=>{S(document.body.children).forEach(t=>{t.hasAttribute("data-previous-aria-hidden")?(t.setAttribute("aria-hidden",t.getAttribute("data-previous-aria-hidden")),t.removeAttribute("data-previous-aria-hidden")):t.removeAttribute("aria-hidden")})},bt=["swal-title","swal-html","swal-footer"],zo=e=>{const t=typeof e.template=="string"?document.querySelector(e.template):e.template;if(!t)return{};const o=t.content;return Qo(o),Object.assign(Ko(o),Yo(o),Zo(o),Jo(o),Xo(o),Go(o,bt))},Ko=e=>{const t={};return S(e.querySelectorAll("swal-param")).forEach(o=>{q(o,["name","value"]);const n=o.getAttribute("name"),i=o.getAttribute("value");typeof R[n]=="boolean"&&i==="false"&&(t[n]=!1),typeof R[n]=="object"&&(t[n]=JSON.parse(i))}),t},Yo=e=>{const t={};return S(e.querySelectorAll("swal-button")).forEach(o=>{q(o,["type","color","aria-label"]);const n=o.getAttribute("type");t[`${n}ButtonText`]=o.innerHTML,t[`show${_e(n)}Button`]=!0,o.hasAttribute("color")&&(t[`${n}ButtonColor`]=o.getAttribute("color")),o.hasAttribute("aria-label")&&(t[`${n}ButtonAriaLabel`]=o.getAttribute("aria-label"))}),t},Zo=e=>{const t={},o=e.querySelector("swal-image");return o&&(q(o,["src","width","height","alt"]),o.hasAttribute("src")&&(t.imageUrl=o.getAttribute("src")),o.hasAttribute("width")&&(t.imageWidth=o.getAttribute("width")),o.hasAttribute("height")&&(t.imageHeight=o.getAttribute("height")),o.hasAttribute("alt")&&(t.imageAlt=o.getAttribute("alt"))),t},Jo=e=>{const t={},o=e.querySelector("swal-icon");return o&&(q(o,["type","color"]),o.hasAttribute("type")&&(t.icon=o.getAttribute("type")),o.hasAttribute("color")&&(t.iconColor=o.getAttribute("color")),t.iconHtml=o.innerHTML),t},Xo=e=>{const t={},o=e.querySelector("swal-input");o&&(q(o,["type","label","placeholder","value"]),t.input=o.getAttribute("type")||"text",o.hasAttribute("label")&&(t.inputLabel=o.getAttribute("label")),o.hasAttribute("placeholder")&&(t.inputPlaceholder=o.getAttribute("placeholder")),o.hasAttribute("value")&&(t.inputValue=o.getAttribute("value")));const n=e.querySelectorAll("swal-input-option");return n.length&&(t.inputOptions={},S(n).forEach(i=>{q(i,["value"]);const r=i.getAttribute("value"),h=i.innerHTML;t.inputOptions[r]=h})),t},Go=(e,t)=>{const o={};for(const n in t){const i=t[n],r=e.querySelector(i);r&&(q(r,[]),o[i.replace(/^swal-/,"")]=r.innerHTML.trim())}return o},Qo=e=>{const t=bt.concat(["swal-param","swal-button","swal-image","swal-icon","swal-input","swal-input-option"]);S(e.children).forEach(o=>{const n=o.tagName.toLowerCase();t.indexOf(n)===-1&&A(`Unrecognized element <${n}>`)})},q=(e,t)=>{S(e.attributes).forEach(o=>{t.indexOf(o.name)===-1&&A([`Unrecognized attribute "${o.name}" on <${e.tagName.toLowerCase()}>.`,`${t.length?`Allowed attributes are: ${t.join(", ")}`:"To set the value, use HTML within the element."}`])})};var Ke={email:(e,t)=>/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(e)?Promise.resolve():Promise.resolve(t||"Invalid email address"),url:(e,t)=>/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(e)?Promise.resolve():Promise.resolve(t||"Invalid URL")};function en(e){e.inputValidator||Object.keys(Ke).forEach(t=>{e.input===t&&(e.inputValidator=Ke[t])})}function tn(e){(!e.target||typeof e.target=="string"&&!document.querySelector(e.target)||typeof e.target!="string"&&!e.target.appendChild)&&(A('Target parameter is not valid, defaulting to "body"'),e.target="body")}function on(e){en(e),e.showLoaderOnConfirm&&!e.preConfirm&&A(`showLoaderOnConfirm is set to true, but preConfirm is not defined.
|
|
showLoaderOnConfirm should be used together with preConfirm, see usage example:
|
|
https://sweetalert2.github.io/#ajax-request`),tn(e),typeof e.title=="string"&&(e.title=e.title.split(`
|
|
`).join("<br />")),po(e)}class nn{constructor(t,o){this.callback=t,this.remaining=o,this.running=!1,this.start()}start(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}stop(){return this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=new Date().getTime()-this.started.getTime()),this.remaining}increase(t){const o=this.running;return o&&this.stop(),this.remaining+=t,o&&this.start(),this.remaining}getTimerLeft(){return this.running&&(this.stop(),this.start()),this.remaining}isRunning(){return this.running}}const sn=()=>{U.previousBodyPadding===null&&document.body.scrollHeight>window.innerHeight&&(U.previousBodyPadding=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight=`${U.previousBodyPadding+mo()}px`)},rn=()=>{U.previousBodyPadding!==null&&(document.body.style.paddingRight=`${U.previousBodyPadding}px`,U.previousBodyPadding=null)},ln=()=>{if((/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!L(document.body,s.iosfix)){const t=document.body.scrollTop;document.body.style.top=`${t*-1}px`,d(document.body,s.iosfix),an(),cn()}},cn=()=>{const e=navigator.userAgent,t=!!e.match(/iPad/i)||!!e.match(/iPhone/i),o=!!e.match(/WebKit/i);t&&o&&!e.match(/CriOS/i)&&f().scrollHeight>window.innerHeight-44&&(C().style.paddingBottom=`${44}px`)},an=()=>{const e=C();let t;e.ontouchstart=o=>{t=un(o)},e.ontouchmove=o=>{t&&(o.preventDefault(),o.stopPropagation())}},un=e=>{const t=e.target,o=C();return dn(e)||fn(e)?!1:t===o||!Ne(o)&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"&&!(Ne(ue())&&ue().contains(t))},dn=e=>e.touches&&e.touches.length&&e.touches[0].touchType==="stylus",fn=e=>e.touches&&e.touches.length>1,pn=()=>{if(L(document.body,s.iosfix)){const e=parseInt(document.body.style.top,10);I(document.body,s.iosfix),document.body.style.top="",document.body.scrollTop=e*-1}},yt=10,hn=e=>{const t=C(),o=f();typeof e.willOpen=="function"&&e.willOpen(o);const i=window.getComputedStyle(document.body).overflowY;bn(t,o,e),setTimeout(()=>{gn(t,o)},yt),$e()&&(mn(t,e.scrollbarPadding,i),Uo()),!me()&&!a.previousActiveElement&&(a.previousActiveElement=document.activeElement),typeof e.didOpen=="function"&&setTimeout(()=>e.didOpen(o)),I(t,s["no-transition"])},wt=e=>{const t=f();if(e.target!==t)return;const o=C();t.removeEventListener(Q,wt),o.style.overflowY="auto"},gn=(e,t)=>{Q&&ft(t)?(e.style.overflowY="hidden",t.addEventListener(Q,wt)):e.style.overflowY="auto"},mn=(e,t,o)=>{ln(),t&&o!=="hidden"&&sn(),setTimeout(()=>{e.scrollTop=0})},bn=(e,t,o)=>{d(e,o.showClass.backdrop),t.style.setProperty("opacity","0","important"),y(t,"grid"),setTimeout(()=>{d(t,o.showClass.popup),t.style.removeProperty("opacity")},yt),d([document.documentElement,document.body],s.shown),o.heightAuto&&o.backdrop&&!o.toast&&d([document.documentElement,document.body],s["height-auto"])},z=e=>{let t=f();t||new fe,t=f();const o=K();me()?k(ne()):yn(t,e),y(o),t.setAttribute("data-loading",!0),t.setAttribute("aria-busy",!0),t.focus()},yn=(e,t)=>{const o=se(),n=K();!t&&E(T())&&(t=T()),y(o),t&&(k(t),n.setAttribute("data-button-to-replace",t.className)),n.parentNode.insertBefore(n,t),d([e,o],s.loading)},wn=(e,t)=>{t.input==="select"||t.input==="radio"?Bn(e,t):["text","email","number","tel","textarea"].includes(t.input)&&(Ae(t.inputValue)||Ee(t.inputValue))&&(z(T()),_n(e,t))},vn=(e,t)=>{const o=e.getInput();if(!o)return null;switch(t.input){case"checkbox":return Cn(o);case"radio":return kn(o);case"file":return Pn(o);default:return t.inputAutoTrim?o.value.trim():o.value}},Cn=e=>e.checked?1:0,kn=e=>e.checked?e.value:null,Pn=e=>e.files.length?e.getAttribute("multiple")!==null?e.files:e.files[0]:null,Bn=(e,t)=>{const o=f(),n=i=>An[t.input](o,Ce(i),t);Ae(t.inputOptions)||Ee(t.inputOptions)?(z(T()),te(t.inputOptions).then(i=>{e.hideLoading(),n(i)})):typeof t.inputOptions=="object"?n(t.inputOptions):W(`Unexpected type of inputOptions! Expected object, Map or Promise, got ${typeof t.inputOptions}`)},_n=(e,t)=>{const o=e.getInput();k(o),te(t.inputValue).then(n=>{o.value=t.input==="number"?parseFloat(n)||0:`${n}`,y(o),o.focus(),e.hideLoading()}).catch(n=>{W(`Error in inputValue promise: ${n}`),o.value="",y(o),o.focus(),e.hideLoading()})},An={select:(e,t,o)=>{const n=M(e,s.select),i=(r,h,B)=>{const b=document.createElement("option");b.value=B,v(b,h),b.selected=Ye(B,o.inputValue),r.appendChild(b)};t.forEach(r=>{const h=r[0],B=r[1];if(Array.isArray(B)){const b=document.createElement("optgroup");b.label=h,b.disabled=!1,n.appendChild(b),B.forEach(w=>i(b,w[1],w[0]))}else i(n,B,h)}),n.focus()},radio:(e,t,o)=>{const n=M(e,s.radio);t.forEach(r=>{const h=r[0],B=r[1],b=document.createElement("input"),w=document.createElement("label");b.type="radio",b.name=s.radio,b.value=h,Ye(h,o.inputValue)&&(b.checked=!0);const D=document.createElement("span");v(D,B),D.className=s.label,w.appendChild(b),w.appendChild(D),n.appendChild(w)});const i=n.querySelectorAll("input");i.length&&i[0].focus()}},Ce=e=>{const t=[];return typeof Map!="undefined"&&e instanceof Map?e.forEach((o,n)=>{let i=o;typeof i=="object"&&(i=Ce(i)),t.push([n,i])}):Object.keys(e).forEach(o=>{let n=e[o];typeof n=="object"&&(n=Ce(n)),t.push([o,n])}),t},Ye=(e,t)=>t&&t.toString()===e.toString();function Ze(){const e=u.innerParams.get(this);if(!e)return;const t=u.domCache.get(this);k(t.loader),me()?e.icon&&y(ne()):En(t),I([t.popup,t.actions],s.loading),t.popup.removeAttribute("aria-busy"),t.popup.removeAttribute("data-loading"),t.confirmButton.disabled=!1,t.denyButton.disabled=!1,t.cancelButton.disabled=!1}const En=e=>{const t=e.popup.getElementsByClassName(e.loader.getAttribute("data-button-to-replace"));t.length?y(t[0],"inline-block"):to()&&k(e.actions)};function Sn(e){const t=u.innerParams.get(e||this),o=u.domCache.get(e||this);return o?Te(o.popup,t.input):null}var ee={swalPromiseResolve:new WeakMap,swalPromiseReject:new WeakMap};const xn=()=>E(f()),vt=()=>T()&&T().click(),$n=()=>F()&&F().click(),Tn=()=>V()&&V().click(),Ct=e=>{e.keydownTarget&&e.keydownHandlerAdded&&(e.keydownTarget.removeEventListener("keydown",e.keydownHandler,{capture:e.keydownListenerCapture}),e.keydownHandlerAdded=!1)},Dn=(e,t,o,n)=>{Ct(t),o.toast||(t.keydownHandler=i=>Ln(e,i,n),t.keydownTarget=o.keydownListenerCapture?window:f(),t.keydownListenerCapture=o.keydownListenerCapture,t.keydownTarget.addEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!0)},ke=(e,t,o)=>{const n=xe();if(n.length)return t=t+o,t===n.length?t=0:t===-1&&(t=n.length-1),n[t].focus();f().focus()},kt=["ArrowRight","ArrowDown"],In=["ArrowLeft","ArrowUp"],Ln=(e,t,o)=>{const n=u.innerParams.get(e);!n||t.isComposing||t.keyCode===229||(n.stopKeydownPropagation&&t.stopPropagation(),t.key==="Enter"?On(e,t,n):t.key==="Tab"?Mn(t,n):[...kt,...In].includes(t.key)?Fn(t.key):t.key==="Escape"&&Hn(t,n,o))},On=(e,t,o)=>{if(!!pe(o.allowEnterKey)&&t.target&&e.getInput()&&t.target.outerHTML===e.getInput().outerHTML){if(["textarea","file"].includes(o.input))return;vt(),t.preventDefault()}},Mn=(e,t)=>{const o=e.target,n=xe();let i=-1;for(let r=0;r<n.length;r++)if(o===n[r]){i=r;break}e.shiftKey?ke(t,i,-1):ke(t,i,1),e.stopPropagation(),e.preventDefault()},Fn=e=>{const t=T(),o=F(),n=V();if(![t,o,n].includes(document.activeElement))return;const i=kt.includes(e)?"nextElementSibling":"previousElementSibling";let r=document.activeElement;for(let h=0;h<se().children.length;h++){if(r=r[i],!r)return;if(E(r)&&r instanceof HTMLButtonElement)break}r instanceof HTMLButtonElement&&r.focus()},Hn=(e,t,o)=>{pe(t.allowEscapeKey)&&(e.preventDefault(),o(Y.esc))};function Pt(e,t,o,n){me()?Je(e,n):(io(o).then(()=>Je(e,n)),Ct(a)),/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?(t.setAttribute("style","display:none !important"),t.removeAttribute("class"),t.innerHTML=""):t.remove(),$e()&&(rn(),pn(),mt()),jn()}function jn(){I([document.documentElement,document.body],[s.shown,s["height-auto"],s["no-backdrop"],s["toast-shown"]])}function ae(e){e=Nn(e);const t=ee.swalPromiseResolve.get(this),o=qn(this);this.isAwaitingPromise()?e.isDismissed||(re(this),t(e)):o&&t(e)}function Vn(){return!!u.awaitingPromise.get(this)}const qn=e=>{const t=f();if(!t)return!1;const o=u.innerParams.get(e);if(!o||L(t,o.hideClass.popup))return!1;I(t,o.showClass.popup),d(t,o.hideClass.popup);const n=C();return I(n,o.showClass.backdrop),d(n,o.hideClass.backdrop),Rn(e,t,o),!0};function Wn(e){const t=ee.swalPromiseReject.get(this);re(this),t&&t(e)}const re=e=>{e.isAwaitingPromise()&&(u.awaitingPromise.delete(e),u.innerParams.get(e)||e._destroy())},Nn=e=>typeof e=="undefined"?{isConfirmed:!1,isDenied:!1,isDismissed:!0}:Object.assign({isConfirmed:!1,isDenied:!1,isDismissed:!1},e),Rn=(e,t,o)=>{const n=C(),i=Q&&ft(t);typeof o.willClose=="function"&&o.willClose(t),i?Un(e,t,n,o.returnFocus,o.didClose):Pt(e,n,o.returnFocus,o.didClose)},Un=(e,t,o,n,i)=>{a.swalCloseEventFinishedCallback=Pt.bind(null,e,o,n,i),t.addEventListener(Q,function(r){r.target===t&&(a.swalCloseEventFinishedCallback(),delete a.swalCloseEventFinishedCallback)})},Je=(e,t)=>{setTimeout(()=>{typeof t=="function"&&t.bind(e.params)(),e._destroy()})};function Bt(e,t,o){const n=u.domCache.get(e);t.forEach(i=>{n[i].disabled=o})}function _t(e,t){if(!e)return!1;if(e.type==="radio"){const n=e.parentNode.parentNode.querySelectorAll("input");for(let i=0;i<n.length;i++)n[i].disabled=t}else e.disabled=t}function zn(){Bt(this,["confirmButton","denyButton","cancelButton"],!1)}function Kn(){Bt(this,["confirmButton","denyButton","cancelButton"],!0)}function Yn(){return _t(this.getInput(),!1)}function Zn(){return _t(this.getInput(),!0)}function Jn(e){const t=u.domCache.get(this),o=u.innerParams.get(this);v(t.validationMessage,e),t.validationMessage.className=s["validation-message"],o.customClass&&o.customClass.validationMessage&&d(t.validationMessage,o.customClass.validationMessage),y(t.validationMessage);const n=this.getInput();n&&(n.setAttribute("aria-invalid",!0),n.setAttribute("aria-describedby",s["validation-message"]),ut(n),d(n,s.inputerror))}function Xn(){const e=u.domCache.get(this);e.validationMessage&&k(e.validationMessage);const t=this.getInput();t&&(t.removeAttribute("aria-invalid"),t.removeAttribute("aria-describedby"),I(t,s.inputerror))}function Gn(){return u.domCache.get(this).progressSteps}function Qn(e){const t=f(),o=u.innerParams.get(this);if(!t||L(t,o.hideClass.popup))return A("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.");const n=es(e),i=Object.assign({},o,n);gt(this,i),u.innerParams.set(this,i),Object.defineProperties(this,{params:{value:Object.assign({},this.params,e),writable:!1,enumerable:!0}})}const es=e=>{const t={};return Object.keys(e).forEach(o=>{st(o)?t[o]=e[o]:A(`Invalid parameter to update: "${o}". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js
|
|
|
|
If you think this parameter should be updatable, request it here: https://github.com/sweetalert2/sweetalert2/issues/new?template=02_feature_request.md`)}),t};function ts(){const e=u.domCache.get(this),t=u.innerParams.get(this);if(!t){At(this);return}e.popup&&a.swalCloseEventFinishedCallback&&(a.swalCloseEventFinishedCallback(),delete a.swalCloseEventFinishedCallback),a.deferDisposalTimer&&(clearTimeout(a.deferDisposalTimer),delete a.deferDisposalTimer),typeof t.didDestroy=="function"&&t.didDestroy(),os(this)}const os=e=>{At(e),delete e.params,delete a.keydownHandler,delete a.keydownTarget,delete a.currentInstance},At=e=>{e.isAwaitingPromise()?(we(u,e),u.awaitingPromise.set(e,!0)):(we(ee,e),we(u,e))},we=(e,t)=>{for(const o in e)e[o].delete(t)};var Et=Object.freeze(Object.defineProperty({__proto__:null,hideLoading:Ze,disableLoading:Ze,getInput:Sn,close:ae,isAwaitingPromise:Vn,rejectPromise:Wn,handleAwaitingPromise:re,closePopup:ae,closeModal:ae,closeToast:ae,enableButtons:zn,disableButtons:Kn,enableInput:Yn,disableInput:Zn,showValidationMessage:Jn,resetValidationMessage:Xn,getProgressSteps:Gn,update:Qn,_destroy:ts},Symbol.toStringTag,{value:"Module"}));const ns=e=>{const t=u.innerParams.get(e);e.disableButtons(),t.input?St(e,"confirm"):Me(e,!0)},ss=e=>{const t=u.innerParams.get(e);e.disableButtons(),t.returnInputValueOnDeny?St(e,"deny"):Oe(e,!1)},is=(e,t)=>{e.disableButtons(),t(Y.cancel)},St=(e,t)=>{const o=u.innerParams.get(e);if(!o.input)return W(`The "input" parameter is needed to be set when using returnInputValueOn${_e(t)}`);const n=vn(e,o);o.inputValidator?rs(e,n,t):e.getInput().checkValidity()?t==="deny"?Oe(e,n):Me(e,n):(e.enableButtons(),e.showValidationMessage(o.validationMessage))},rs=(e,t,o)=>{const n=u.innerParams.get(e);e.disableInput(),Promise.resolve().then(()=>te(n.inputValidator(t,n.validationMessage))).then(r=>{e.enableButtons(),e.enableInput(),r?e.showValidationMessage(r):o==="deny"?Oe(e,t):Me(e,t)})},Oe=(e,t)=>{const o=u.innerParams.get(e||globalThis);o.showLoaderOnDeny&&z(F()),o.preDeny?(u.awaitingPromise.set(e||globalThis,!0),Promise.resolve().then(()=>te(o.preDeny(t,o.validationMessage))).then(i=>{i===!1?(e.hideLoading(),re(e)):e.closePopup({isDenied:!0,value:typeof i=="undefined"?t:i})}).catch(i=>xt(e||globalThis,i))):e.closePopup({isDenied:!0,value:t})},Xe=(e,t)=>{e.closePopup({isConfirmed:!0,value:t})},xt=(e,t)=>{e.rejectPromise(t)},Me=(e,t)=>{const o=u.innerParams.get(e||globalThis);o.showLoaderOnConfirm&&z(),o.preConfirm?(e.resetValidationMessage(),u.awaitingPromise.set(e||globalThis,!0),Promise.resolve().then(()=>te(o.preConfirm(t,o.validationMessage))).then(i=>{E(he())||i===!1?(e.hideLoading(),re(e)):Xe(e,typeof i=="undefined"?t:i)}).catch(i=>xt(e||globalThis,i))):Xe(e,t)},ls=(e,t,o)=>{u.innerParams.get(e).toast?cs(e,t,o):(us(t),ds(t),fs(e,t,o))},cs=(e,t,o)=>{t.popup.onclick=()=>{const n=u.innerParams.get(e);n&&(as(n)||n.timer||n.input)||o(Y.close)}},as=e=>e.showConfirmButton||e.showDenyButton||e.showCancelButton||e.showCloseButton;let de=!1;const us=e=>{e.popup.onmousedown=()=>{e.container.onmouseup=function(t){e.container.onmouseup=void 0,t.target===e.container&&(de=!0)}}},ds=e=>{e.container.onmousedown=()=>{e.popup.onmouseup=function(t){e.popup.onmouseup=void 0,(t.target===e.popup||e.popup.contains(t.target))&&(de=!0)}}},fs=(e,t,o)=>{t.container.onclick=n=>{const i=u.innerParams.get(e);if(de){de=!1;return}n.target===t.container&&pe(i.allowOutsideClick)&&o(Y.backdrop)}},ps=e=>typeof e=="object"&&e.jquery,Ge=e=>e instanceof Element||ps(e),hs=e=>{const t={};return typeof e[0]=="object"&&!Ge(e[0])?Object.assign(t,e[0]):["title","html","icon"].forEach((o,n)=>{const i=e[n];typeof i=="string"||Ge(i)?t[o]=i:i!==void 0&&W(`Unexpected type of ${o}! Expected "string" or "Element", got ${typeof i}`)}),t};function gs(...e){const t=this;return new t(...e)}function ms(e){class t extends this{_main(n,i){return super._main(n,Object.assign({},e,i))}}return t}const bs=()=>a.timeout&&a.timeout.getTimerLeft(),$t=()=>{if(a.timeout)return oo(),a.timeout.stop()},Tt=()=>{if(a.timeout){const e=a.timeout.start();return De(e),e}},ys=()=>{const e=a.timeout;return e&&(e.running?$t():Tt())},ws=e=>{if(a.timeout){const t=a.timeout.increase(e);return De(t,!0),t}},vs=()=>a.timeout&&a.timeout.isRunning();let Qe=!1;const Pe={};function Cs(e="data-swal-template"){Pe[e]=this,Qe||(document.body.addEventListener("click",ks),Qe=!0)}const ks=e=>{for(let t=e.target;t&&t!==document;t=t.parentNode)for(const o in Pe){const n=t.getAttribute(o);if(n){Pe[o].fire({template:n});return}}};var Ps=Object.freeze(Object.defineProperty({__proto__:null,isValidParameter:nt,isUpdatableParameter:st,isDeprecatedParameter:ve,argsToParams:hs,getContainer:C,getPopup:f,getTitle:rt,getHtmlContainer:ue,getImage:lt,getIcon:ne,getInputLabel:Xt,getCloseButton:Se,getActions:se,getConfirmButton:T,getDenyButton:F,getCancelButton:V,getLoader:K,getFooter:at,getTimerProgressBar:ge,getFocusableElements:xe,getValidationMessage:he,isLoading:Qt,isVisible:xn,clickConfirm:vt,clickDeny:$n,clickCancel:Tn,fire:gs,mixin:ms,showLoading:z,enableLoading:z,getTimerLeft:bs,stopTimer:$t,resumeTimer:Tt,toggleTimer:ys,increaseTimer:ws,isTimerRunning:vs,bindClickHandler:Cs},Symbol.toStringTag,{value:"Module"}));let Be;class Z{constructor(...t){if(typeof window=="undefined")return;Be=this;const o=Object.freeze(this.constructor.argsToParams(t));Object.defineProperties(this,{params:{value:o,writable:!1,enumerable:!0,configurable:!0}});const n=this._main(this.params);u.promise.set(this,n)}_main(t,o={}){Zt(Object.assign({},o,t)),a.currentInstance&&(a.currentInstance._destroy(),$e()&&mt()),a.currentInstance=this;const n=_s(t,o);on(n),Object.freeze(n),a.timeout&&(a.timeout.stop(),delete a.timeout),clearTimeout(a.restoreFocusTimeout);const i=As(this);return gt(this,n),u.innerParams.set(this,n),Bs(this,i,n)}then(t){return u.promise.get(this).then(t)}finally(t){return u.promise.get(this).finally(t)}}const Bs=(e,t,o)=>new Promise((n,i)=>{const r=h=>{e.closePopup({isDismissed:!0,dismiss:h})};ee.swalPromiseResolve.set(e,n),ee.swalPromiseReject.set(e,i),t.confirmButton.onclick=()=>ns(e),t.denyButton.onclick=()=>ss(e),t.cancelButton.onclick=()=>is(e,r),t.closeButton.onclick=()=>r(Y.close),ls(e,t,r),Dn(e,a,o,r),wn(e,o),hn(o),Es(a,o,r),Ss(t,o),setTimeout(()=>{t.container.scrollTop=0})}),_s=(e,t)=>{const o=zo(e),n=Object.assign({},R,t,o,e);return n.showClass=Object.assign({},R.showClass,n.showClass),n.hideClass=Object.assign({},R.hideClass,n.hideClass),n},As=e=>{const t={popup:f(),container:C(),actions:se(),confirmButton:T(),denyButton:F(),cancelButton:V(),loader:K(),closeButton:Se(),validationMessage:he(),progressSteps:ct()};return u.domCache.set(e,t),t},Es=(e,t,o)=>{const n=ge();k(n),t.timer&&(e.timeout=new nn(()=>{o("timer"),delete e.timeout},t.timer),t.timerProgressBar&&(y(n),x(n,t,"timerProgressBar"),setTimeout(()=>{e.timeout&&e.timeout.running&&De(t.timer)})))},Ss=(e,t)=>{if(!t.toast){if(!pe(t.allowEnterKey))return $s();xs(e,t)||ke(t,-1,1)}},xs=(e,t)=>t.focusDeny&&E(e.denyButton)?(e.denyButton.focus(),!0):t.focusCancel&&E(e.cancelButton)?(e.cancelButton.focus(),!0):t.focusConfirm&&E(e.confirmButton)?(e.confirmButton.focus(),!0):!1,$s=()=>{document.activeElement instanceof HTMLElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur()};Object.assign(Z.prototype,Et);Object.assign(Z,Ps);Object.keys(Et).forEach(e=>{Z[e]=function(...t){if(Be)return Be[e](...t)}});Z.DismissReason=Y;Z.version="11.4.8";const fe=Z;fe.default=fe;const Fe=e=>(Ht("data-v-e4c5480a"),e=e(),jt(),e),Ts={key:0},Ds={id:"pc",style:{width:"100vw"}},Is={class:"btn-group mb-3",role:"group","aria-label":"Basic radio toggle button group"},Ls=["id","checked"],Os=["for","onClick"],Ms={class:"col-3 mt-4"},Fs={class:"fw-bold"},Hs={class:"fw-bold"},js={class:"col-9"},Vs={class:"bg-white border p-3"},qs={class:"d-flex"},Ws={key:0,src:et,class:"my-auto img-thumbnail me-2",width:"60",height:"60"},Ns={key:1,src:tt,class:"my-auto img-thumbnail me-2",width:"60",height:"60"},Rs={class:"text-start mt-2"},Us={class:"px-1 me-1",style:{"background-color":"yellow"}},zs={style:{color:"salmon"}},Ks=Fe(()=>c("i",{class:"fas fa-chevron-right m-2"},null,-1)),Ys={style:{color:"blue"}},Zs=P(" | "),Js={style:{color:"brown"}},Xs=P(" | "),Gs={style:{color:"orange"}},Qs=P(" | "),ei={style:{color:"green"}},ti=Fe(()=>c("br",null,null,-1)),oi=P(" \u539F\u7D00\u9304\uFF1A"),ni={style:{color:"blue"}},si=P(" | "),ii={style:{color:"brown"}},ri=P(" | "),li={style:{color:"orange"}},ci=P(" | "),ai={style:{color:"green"}},ui=P(" \u7D50\u7B97\u91D1\u984D "),di={style:{color:"orange"}},fi=["onClick"],pi={id:"mobile",class:"card text-center",style:{width:"100vw"}},hi={class:"card-header"},gi={class:"nav nav-tabs card-header-tabs"},mi=["onClick"],bi={class:"card-body"},yi={class:"card-header"},wi={class:"card-body d-flex"},vi={key:0,src:et,class:"my-auto img-thumbnail me-2",width:"60",height:"60"},Ci={key:1,src:tt,class:"my-auto img-thumbnail me-2",width:"60",height:"60"},ki={class:"text-start mt-2"},Pi={class:"px-1 me-1",style:{"background-color":"yellow"}},Bi={style:{color:"salmon"}},_i=Fe(()=>c("i",{class:"fas fa-chevron-right m-2"},null,-1)),Ai={key:0},Ei={style:{color:"blue"}},Si=P(" | "),xi={style:{color:"brown"}},$i=P(" | "),Ti={style:{color:"orange"}},Di=P(" | "),Ii={style:{color:"green"}},Li={key:1},Oi=P(" \u539F\u7D00\u9304\uFF1A"),Mi={style:{color:"blue"}},Fi=P(" | "),Hi={style:{color:"brown"}},ji=P(" | "),Vi={style:{color:"orange"}},qi=P(" | "),Wi={style:{color:"green"}},Ni={key:2},Ri=P(" \u7D50\u7B97\u91D1\u984D "),Ui={style:{color:"orange"}},zi=["onClick"],Ki={class:"mt-3"},Yi=Ot({setup(e){const t=[{title:"\u7E3D\u89BD",btnColor:"secondary"},{title:"\u65B0\u589E",btnColor:"primary"},{title:"\u7DE8\u8F2F",btnColor:"success"},{title:"\u7D50\u7B97",btnColor:"danger"}],o=le(!0),n=le([]),i=le("\u7E3D\u89BD"),r=le({\u7E3D\u89BD:5,\u65B0\u589E:5,\u7DE8\u8F2F:5,\u7D50\u7B97:5}),h=Mt(()=>i.value==="\u7E3D\u89BD"?n.value:n.value.filter(w=>w.action===i.value)),B=async function(){try{const{data:w}=await Dt.getLogs();n.value=w.data,o.value=!1}catch(w){console.error("error",w)}},b=async w=>{if(!w.length)return;let D='<table class="table"><thead><tr><th scope="col">\u9805\u76EE</th><th scope="col">\u5546\u5BB6</th><th scope="col">\u91D1\u984D</th><th scope="col">\u65E5\u671F</th></tr></thead><tbody>';for(const l of w)D+=`<tr><td>${l.item}</td><td>${l.merchant}</td><td>${l.amount}</td><td>${new Date(l.date).toLocaleDateString()}</td></tr>`;D+=`</tbody></table>${document.documentElement.scrollWidth>=500?"":"<style>table{font-size:0.7em;}</style>"}`,await fe.fire({title:"\u7D50\u7B97\u7D00\u9304",html:D})};return B(),(w,D)=>o.value?(g(),Ft(It,{key:1})):(g(),m("div",Ts,[c("div",Ds,[c("div",Is,[(g(),m(O,null,ce(t,(l,N)=>(g(),m(O,{key:N},[c("input",{type:"radio",class:"btn-check",name:"btnradio",id:l.title,autocomplete:"off",checked:i.value===l.title},null,8,Ls),c("label",{class:Ve(`btn btn-outline-${l.btnColor}`),for:l.title,onClick:He=>i.value=l.title},p(l.title),11,Os)],64))),64))]),(g(!0),m(O,null,ce(J(h),(l,N)=>(g(),m("div",{class:"row h-20 mb-3",key:N},[c("div",Ms,[c("div",Fs,p(new Date(l.createdAt).toLocaleDateString()+" "+J(je)(l.createdAt)),1),c("div",Hs,p(new Date(l.createdAt).toLocaleTimeString()),1)]),c("div",js,[c("div",Vs,[c("div",qs,[l.User.displayName==="\u5EFA\u55B5"?(g(),m("img",Ws)):(g(),m("img",Ns)),c("div",Rs,[c("strong",Us,p(l.User.displayName),1),c("strong",zs,p(l.action)+"\u7D00\u9304",1),Ks,l.action==="\u65B0\u589E"||l.action==="\u7DE8\u8F2F"?(g(),m(O,{key:0},[c("strong",Ys,p(l.item),1),Zs,c("strong",Js,p(l.merchant),1),Xs,c("strong",Gs,"$ "+p(l.amount),1),Qs,c("strong",ei,p(new Date(l.date||"").toLocaleDateString()),1)],64)):H("",!0),l.action==="\u7DE8\u8F2F"?(g(),m(O,{key:1},[ti,c("h6",null,[oi,c("strong",ni,p(l.itemBefore),1),si,c("strong",ii,p(l.merchantBefore),1),ri,c("strong",li,"$ "+p(l.amountBefore),1),ci,c("strong",ai,p(new Date(l.dateBefore||"").toLocaleDateString()),1)])],64)):H("",!0),l.action==="\u7D50\u7B97"?(g(),m(O,{key:2},[c("span",null,[ui,c("strong",di,"$ "+p(l.closeAmount),1)]),c("i",{class:"far fa-list-alt fa-lg ms-2",id:"records",onClick:He=>b(l.Records)},null,8,fi)],64)):H("",!0)])])])])]))),128))]),c("div",pi,[c("div",hi,[c("ul",gi,[(g(),m(O,null,ce(t,l=>c("li",{class:"nav-item",key:l.title,onClick:N=>i.value=l.title},[c("span",{class:Ve(["nav-link",{active:i.value===l.title}])},p(l.title),3)],8,mi)),64))])]),c("div",bi,[(g(!0),m(O,null,ce(J(h).slice(0,r.value[i.value]),(l,N)=>(g(),m("div",{class:"card mb-3",key:N},[c("div",yi,p(new Date(l.createdAt).toLocaleDateString()+" "+J(je)(l.createdAt)+new Date(l.createdAt).toLocaleTimeString()),1),c("div",wi,[l.User.displayName==="\u5EFA\u55B5"?(g(),m("img",vi)):(g(),m("img",Ci)),c("div",ki,[c("strong",Pi,p(l.User.displayName),1),c("strong",Bi,p(l.action)+"\u7D00\u9304",1),_i,l.action==="\u65B0\u589E"||l.action==="\u7DE8\u8F2F"?(g(),m("h6",Ai,[c("strong",Ei,p(l.item),1),Si,c("strong",xi,p(l.merchant),1),$i,c("strong",Ti,"$ "+p(l.amount),1),Di,c("strong",Ii,p(new Date(l.date||"").toLocaleDateString()),1)])):H("",!0),l.action==="\u7DE8\u8F2F"?(g(),m("h6",Li,[Oi,c("strong",Mi,p(l.itemBefore),1),Fi,c("strong",Hi,p(l.merchantBefore),1),ji,c("strong",Vi,"$ "+p(l.amountBefore),1),qi,c("strong",Wi,p(new Date(l.dateBefore||"").toLocaleDateString()),1)])):H("",!0),l.action==="\u7D50\u7B97"?(g(),m("h6",Ni,[c("span",null,[Ri,c("strong",Ui,"$ "+p(l.closeAmount),1)]),c("i",{class:"far fa-list-alt fa-lg ms-2",id:"records",onClick:He=>b(l.Records)},null,8,zi)])):H("",!0)])])]))),128)),c("div",Ki,[r.value[i.value]<J(h).length?(g(),m("button",{key:0,type:"button",class:"btn btn-secondary",onClick:D[0]||(D[0]=l=>r.value[i.value]+=5)}," \u66F4\u591A\u7D00\u9304 ")):H("",!0)])])])]))}});var er=Lt(Yi,[["__scopeId","data-v-e4c5480a"]]);export{er as default};
|