import{d as o}from"./dayjs.min.js?ver=1.3.21";import{A as u,t as a}from"./Translator.js?ver=1.3.21";import{S as p}from"./Str.js?ver=1.3.21";import{u as h,t as y}from"./timezone.js?ver=1.3.21";import{S as l}from"./IconButton.js?ver=1.3.21";import{E as S,A as $}from"./index.js?ver=1.3.21";const _=function(t,s){if(s===0||s===null||s===void 0)return t===0?0:100;const r=(t-s)/s*100;return Math.round(r*100)/100},d=(t,s="")=>{let r="";return typeof t=="string"?r=t:t&&t.message?r=t.message:r=p.objectToString(t),r||(r=s||a("Nothing....")),r},w=(t,s="",r=1e3)=>{let e=d(t,a("Something is wrong!"));m({offset:20,type:"error",title:a("Error"),message:e,dangerouslyUseHTMLString:!0,customClass:s,duration:r})},B=(t,s="",r=1e3)=>{let e=d(t,a("Okay...!"));m({offset:20,type:"success",title:a("Success"),message:e,dangerouslyUseHTMLString:!0,customClass:s,duration:r})},N=t=>{let s=d(t,a("Okay...!"));m({type:"info",title:a("Info"),message:s,dangerouslyUseHTMLString:!0,duration:2e3})};o.extend(h);o.extend(y);let z=o.tz.guess();function b(t){return/([Zz]|[+-]\d{2}:\d{2}|[+-]\d{4})/.test(t)}const A=(t,s=!1,r=null,e="UTC",n=!1)=>{if(!t)return"";const c=M(t,e,r||z);if(n)return g(c);const f=E(c);return s?`${f} at ${g(c)}`:f},M=(t,s,r)=>{if(T(t)){const e=Number(t),n=e<1e12?e*1e3:e;return o(n).tz(r)}return b(t)?o(t).tz(r):o.tz(t,s).tz(r)},T=t=>typeof t=="number"||/^\d+$/.test(t),E=t=>{const s=t.year(),r=t.date().toString().padStart(2,"0"),e=t.format("MMM");return s===o().year()?`${e} ${r}`:`${r} ${e}, ${s}`},g=t=>{const s=t.format("h"),r=t.format("mm"),e=t.format("a");return`${s}:${r} ${e}`},m=$,H=S.confirm,I=(t,s)=>l.readableFileSizeFromBytes(t)+" of "+l.readableFileSizeFromBytes(s),O=t=>{try{const s=new URL(t);return s.protocol==="http:"||s.protocol==="https:"}catch{return!1}},R=(t,s="")=>{const r={visa:"images/credit-card/visa.svg",mastercard:"images/credit-card/mastercard.svg",unionpay:"images/credit-card/unionpay.svg",amex:"images/credit-card/amex.svg"};return t in r?u.assetUrl(r[t]):s==="card"?u.assetUrl("images/credit-card/card.svg"):null},j=t=>{const s={},r=[];return t.forEach(e=>{e.bundle_items=[],s[e.id]=e}),t.forEach(e=>{var i;const n=(i=e==null?void 0:e.line_meta)==null?void 0:i.bundle_parent_item_id;n&&s[n]?s[n].bundle_items.push(e):r.push(e)}),r};export{H as $,w as a,A as b,_ as c,I as d,N as e,j as f,R as g,B as h,O as i};
